|
@@ -268,7 +268,7 @@
|
|
@select="searchTreeSelect"/>
|
|
@select="searchTreeSelect"/>
|
|
</div>
|
|
</div>
|
|
<div class="dialog-table">
|
|
<div class="dialog-table">
|
|
- <HcTable :column="dialogTableColumn" :datas="dialogTableData" isCheck @selection-change="dialogTableSelection"/>
|
|
|
|
|
|
+ <HcTable ref="dialogTableRef" :column="dialogTableColumn" :datas="dialogTableData" isCheck @selection-change="dialogTableSelection"/>
|
|
</div>
|
|
</div>
|
|
<div class="dialog-pages">
|
|
<div class="dialog-pages">
|
|
<HcPages :pages="searchFormPage" @change="searchFormPageChange"/>
|
|
<HcPages :pages="searchFormPage" @change="searchFormPageChange"/>
|
|
@@ -973,9 +973,13 @@ const toBackClick = () => {
|
|
//添加独立表单
|
|
//添加独立表单
|
|
const addingFormModal = ref(false)
|
|
const addingFormModal = ref(false)
|
|
const addingFormClick = () => {
|
|
const addingFormClick = () => {
|
|
- addingFormLoading.value = false
|
|
|
|
- addingFormModal.value = true
|
|
|
|
-
|
|
|
|
|
|
+ const { isLeaf } = treeNodeInfo.value
|
|
|
|
+ if (isLeaf) {
|
|
|
|
+ addingFormLoading.value = false
|
|
|
|
+ addingFormModal.value = true
|
|
|
|
+ } else {
|
|
|
|
+ window?.$message?.warning('请先选择一个最子级的节点')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//树配置
|
|
//树配置
|
|
@@ -1000,10 +1004,10 @@ const addingFormTreeLoadNode = async (node, resolve) => {
|
|
//树被点击
|
|
//树被点击
|
|
const addingFormTreeItem = ref({})
|
|
const addingFormTreeItem = ref({})
|
|
const addingFormTreeClick = async (data) => {
|
|
const addingFormTreeClick = async (data) => {
|
|
|
|
+ searchTreeTitle.value = ''
|
|
addingFormTreeItem.value = data
|
|
addingFormTreeItem.value = data
|
|
- const resData = await tabTypeLazyTree(data?.primaryKeyId,'', true)
|
|
|
|
- console.log(resData)
|
|
|
|
- dialogTableData.value = resData
|
|
|
|
|
|
+ searchFormPage.value.current = 1
|
|
|
|
+ getDialogTableData()
|
|
}
|
|
}
|
|
|
|
|
|
//搜索
|
|
//搜索
|
|
@@ -1015,7 +1019,11 @@ const querySearchTree = async (key, resolve) => {
|
|
resolve(resData)
|
|
resolve(resData)
|
|
}
|
|
}
|
|
const searchTreeSelect = (item) => {
|
|
const searchTreeSelect = (item) => {
|
|
- console.log(item)
|
|
|
|
|
|
+ dialogTableRef.value?.clearSelection()
|
|
|
|
+ dialogTableKeys.value = []
|
|
|
|
+ dialogTableData.value = [item]
|
|
|
|
+ searchFormPage.value.current = 1
|
|
|
|
+ searchFormPage.value.total = 0
|
|
}
|
|
}
|
|
|
|
|
|
//搜索
|
|
//搜索
|
|
@@ -1023,9 +1031,11 @@ const searchFormPage = ref({current: 1, size: 20, total: 0})
|
|
const searchFormPageChange = ({current, size}) => {
|
|
const searchFormPageChange = ({current, size}) => {
|
|
searchFormPage.value.current = current
|
|
searchFormPage.value.current = current
|
|
searchFormPage.value.size = size
|
|
searchFormPage.value.size = size
|
|
|
|
+ getDialogTableData()
|
|
}
|
|
}
|
|
|
|
|
|
//表格数据
|
|
//表格数据
|
|
|
|
+const dialogTableRef = ref(null)
|
|
const dialogTableColumn = ref([
|
|
const dialogTableColumn = ref([
|
|
{key:'title', name: '表单名称'},
|
|
{key:'title', name: '表单名称'},
|
|
{key:'tableType', name: '元素表类型'},
|
|
{key:'tableType', name: '元素表类型'},
|
|
@@ -1034,6 +1044,24 @@ const dialogTableColumn = ref([
|
|
{key:'fillRate', name: '填报率'}
|
|
{key:'fillRate', name: '填报率'}
|
|
])
|
|
])
|
|
const dialogTableData = ref([])
|
|
const dialogTableData = ref([])
|
|
|
|
+const getDialogTableData = async () => {
|
|
|
|
+ //处理初始数据
|
|
|
|
+ dialogTableRef.value?.clearSelection()
|
|
|
|
+ dialogTableKeys.value = []
|
|
|
|
+ const primaryKeyId = addingFormTreeItem.value?.primaryKeyId ?? ''
|
|
|
|
+ const searchTitle = searchTreeTitle.value ?? ''
|
|
|
|
+ //获取数据
|
|
|
|
+ const resData = await tabTypeLazyTree(primaryKeyId, searchTitle, true)
|
|
|
|
+ const records = getArrValue(resData?.records)
|
|
|
|
+ console.log(records)
|
|
|
|
+ //处理返回的数据
|
|
|
|
+ dialogTableData.value = records
|
|
|
|
+ if (records.length > 0) {
|
|
|
|
+ searchFormPage.value.total = data.total || 0
|
|
|
|
+ } else {
|
|
|
|
+ searchFormPage.value.total = 0
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
//多选
|
|
//多选
|
|
const dialogTableKeys = ref([]);
|
|
const dialogTableKeys = ref([]);
|
|
@@ -1061,17 +1089,43 @@ const tabTypeLazyTree = async (parentId = '12345678910', titleName = '', search
|
|
return resData
|
|
return resData
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//保存
|
|
//保存
|
|
const addingFormLoading = ref(false)
|
|
const addingFormLoading = ref(false)
|
|
-const addingFormSave = () => {
|
|
|
|
-
|
|
|
|
|
|
+const addingFormSave = async () => {
|
|
|
|
+ const rows = dialogTableKeys.value
|
|
|
|
+ if (rows.length > 0) {
|
|
|
|
+ addingFormLoading.value = true
|
|
|
|
+ const { primaryKeyId } = treeItemInfo.value
|
|
|
|
+ const ids = rowsToId(rows, 'primaryKeyId')
|
|
|
|
+ //发起请求
|
|
|
|
+ const { error, code } = await divisionApi.addWbsContractInfo({
|
|
|
|
+ projectId: projectId.value,
|
|
|
|
+ contractId: contractId.value,
|
|
|
|
+ nodeId: primaryKeyId,
|
|
|
|
+ primaryKeyIds: ids
|
|
|
|
+ })
|
|
|
|
+ //处理结果
|
|
|
|
+ addingFormLoading.value = false
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window.$message?.success('操作成功')
|
|
|
|
+ window?.location?.reload() //刷新页面
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ window.$message?.warning('请先勾选数据')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//关闭
|
|
//关闭
|
|
const addingFormClose = () => {
|
|
const addingFormClose = () => {
|
|
addingFormModal.value = false
|
|
addingFormModal.value = false
|
|
|
|
+ dialogTableKeys.value = []
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//拼接ID
|
|
|
|
+const rowsToId = (rows, key = 'id') => {
|
|
|
|
+ return rows.map((obj) => {
|
|
|
|
+ return obj[key];
|
|
|
|
+ }).join(",")
|
|
|
|
+}
|
|
|
|
|
|
//左右拖动,改变树形结构宽度
|
|
//左右拖动,改变树形结构宽度
|
|
const leftWidth = ref(382);
|
|
const leftWidth = ref(382);
|