ZaiZai 1 năm trước cách đây
mục cha
commit
c15f8732f0
1 tập tin đã thay đổi với 14 bổ sung36 xóa
  1. 14 36
      src/views/tentative/detect/test-form.vue

+ 14 - 36
src/views/tentative/detect/test-form.vue

@@ -280,8 +280,8 @@ onMounted(() => {
         defaultprojectPositionName.value = info?.projectPositionName
     }
     getSearchNodeTables()
-    getSearchNodeTablesall(1)
-    getSearchNodeTablesall(2)
+    getSearchNodeTablesall()
+    //getSearchNodeTablesall(2)
     getCategoryData()
     getContractData()
 })
@@ -363,6 +363,7 @@ const tabTypeChange = (key) => {
     if (listItemBaseData.value.detectionResult === '' && tabTypeKey.value == 2) {
         window.$message?.warning('请选择报告单是否合格')
     }
+    getSearchNodeTablesall()
     getSearchNodeTables()
 }
 
@@ -454,7 +455,8 @@ const getSearchNodeTables = async (newaddId) => {
 
 
 }
-const getSearchNodeTablesall = async (type, newaddId) => {
+const getSearchNodeTablesall = async (newaddId) => {
+    const type = tabTypeKey.value
     orgAlllistData.value = []
     const isid = dataId.length > 0 ? dataId : nodeIdvalue.value || newaddId || ''
     const { error, code, data } = await dataApi.searchNodeTables({
@@ -470,7 +472,6 @@ const getSearchNodeTablesall = async (type, newaddId) => {
 
     })
     //处理数据
-
     if (!error && code === 200) {
         // listItemData.value = getArrValue(data)
         if (type === 1) {
@@ -478,14 +479,11 @@ const getSearchNodeTablesall = async (type, newaddId) => {
             testData.value.forEach((item) => {
                 let bussDataInfoTrialData = item.bussDataInfoTrial
                 if (bussDataInfoTrialData && Object.keys(bussDataInfoTrialData).length !== 0) {
-                    for (var key in bussDataInfoTrialData) {
+                    for (let key in bussDataInfoTrialData) {
                         item[key] = bussDataInfoTrialData[key]
                     }
                 }
-
                 orgAlllistData.value.push(item)
-
-
             })
         } else {
             reportData.value = getArrValue(data)
@@ -496,7 +494,6 @@ const getSearchNodeTablesall = async (type, newaddId) => {
                         item[key] = bussDataInfoTrialData[key]
                     }
                 }
-
                 orgAlllistData.value.push(item)
             })
         }
@@ -511,9 +508,8 @@ const getSearchNodeTablesall = async (type, newaddId) => {
             alllistData.value = []
         }
     }
-
-
 }
+
 //改变原始数据复制隐藏本表的状态
 const newId = ref('')
 //获取数据
@@ -521,8 +517,7 @@ const getTableDataAll = async (newaddId, key) => {
     newId.value = newaddId
     await getSearchNodeTables(newaddId)
     await queryNodeStatus(newaddId)
-    await getSearchNodeTablesall(1, newaddId)
-    await getSearchNodeTablesall(2, newaddId)
+    await getSearchNodeTablesall(newaddId)
 
     //保存后自动展开到当前表单
     if (!isNullES(key)) {
@@ -553,8 +548,7 @@ const changeorinsdate = async (pKeyId, isBussShow, id) => {
 }
 //复制本表改变原始数据
 const chageorinData = async () => {
-    getSearchNodeTablesall(1)
-    getSearchNodeTablesall(2)
+    getSearchNodeTablesall()
 }
 //设置滚动条位置
 const ListItemScrollRef = ref(null)
@@ -1074,15 +1068,10 @@ const tableFormSaveClick = async () => {
                 listItemBaseData.value.tableType = type
             }
         } else { //编辑
-            console.log(alllistData.value, 'alllistData.value')
-
             FormData = alllistData.value
-
             const info = getStoreValue('test-form')
             let recordNo = info?.recordNo || tabTypeKey.value == 1 ? listItemBaseData.value.id : ''
-
             let reportNo = info?.reportNo || tabTypeKey.value == 2 ? listItemBaseData.value.id : ''
-
             //组装type
             if (recordNo === '' && reportNo !== '') {
                 listItemBaseData.value.tableType = '2'
@@ -1091,16 +1080,16 @@ const tableFormSaveClick = async () => {
             } else {
                 listItemBaseData.value.tableType = '1,2'
             }
-
             let notChangeData = []
             if (setTypes.length == 0) { //没操作过页面数据
+                console.log('没操作过页面数据')
                 FormData = []
                 notChangeData = orgAlllistData.value //默认就是原始左右全部数据
                 if (listItemBaseData.value.tableType.length === 1) { //从原始数据过滤当前页面数据
                     notChangeData = orgAlllistData.value.filter(e => e.tableType === listItemBaseData.value.tableType)
                 }
-
             } else if (setTypes.length == 1) {// 操作过一边的数据
+                console.log('操作过一边的数据')
                 orgAlllistData.value.forEach((item1) => {
                     if (item1.tableType.toString() !== tabTypeKey.value) {
                         let data1 = {
@@ -1119,11 +1108,9 @@ const tableFormSaveClick = async () => {
                                 data1[key] = item1[key]
                             })
                         }
-                        console.log(FormData, 'FormData11111')
                         FormData.push(data1)
                     }
                 })
-                console.log(FormData, 'FormData22222222')
                 let tableTypeArr = listItemBaseData.value.tableType.split(',')
                 if (tableTypeArr[0] != tabTypeKey.value) { //两边都有数据/当前操作的数据不是进来时的选项,筛选另一边的数据
                     listItemBaseData.value.tableType = '1,2'
@@ -1151,7 +1138,6 @@ const tableFormSaveClick = async () => {
                 FormData.push(data)
             })
         }
-
         let FormRegExpJson = ListItemRef.value?.getFormRegExpJson()
         if (newId.value?.length > 0) {
             isaddType = false
@@ -1172,6 +1158,7 @@ const tableFormSaveClick = async () => {
             }
             listItemBaseData.value.tableType = tabTypeKey.value
         }
+        console.log(FormData)
         //效验数据
         if (FormData.length > 0) {
             console.log(listItemBaseData.value.tableType, 'istItemBaseData.value.tableType')
@@ -1245,16 +1232,14 @@ const tableFormSaveClick = async () => {
                         listItemBaseData.value.id = data
 
                         await getSearchNodeTables()
-                        await getSearchNodeTablesall(1)
-                        await getSearchNodeTablesall(2)
+                        await getSearchNodeTablesall()
                         await queryNodeStatus(data)
                     } else {
                         listItemBaseData.value.id = data
 
                         // bussPdfsClick(nodeIdvalue.value)
                         await getSearchNodeTables()
-                        await getSearchNodeTablesall(1)
-                        await getSearchNodeTablesall(2)
+                        await getSearchNodeTablesall()
                         await queryNodeStatus(data)
                         await listItemNewId(data)
                         afterAdd.value = true
@@ -1326,27 +1311,20 @@ const setAllListData = (curform) => {
             if (ishasKey.length > 0) { //筛出当前编辑过的数据
                 item.oper = true
             }
-            console.log(curform, 'curform')
-            console.log(orgAlllistData.value, 'orgAlllistData.value')
             let orgData = orgAlllistData.value.filter(e => e.pKeyId === pkeyId)
             item.type = orgData[0]?.tableType
             alllistData.value = alllistData.value.filter(e => e.pkeyId != pkeyId) //去掉老数据
-            console.log(orgData, 'orgData')
             if (orgData.length > 0) {
                 ishasKey = Object.keys(orgData[0]).filter(e => e.indexOf('key_') >= 0)
             }
-
             if (!item.isCollapseLoad && ishasKey.length > 0) { //没操作过,并且存在KEY
                 ishasKey.forEach(key => {
                     item[key] = orgData[0][key]
                 })
             }
-
             alllistData.value.push(item) //加入新数据
         })
     }
-
-
 }
 
 //效验数据