瀏覽代碼

复制本表更改

duy 2 年之前
父節點
當前提交
af6acf3a18
共有 2 個文件被更改,包括 52 次插入15 次删除
  1. 31 15
      src/views/tentative/detect/components/ListItem.vue
  2. 21 0
      src/views/tentative/detect/test-form.vue

+ 31 - 15
src/views/tentative/detect/components/ListItem.vue

@@ -233,6 +233,11 @@ watch(() => [
     props.NodeStatus
 ], ([datas,TabTypeKey,AlllistData,NodeStatus]) => {
     listDatas.value = datas
+    listDatas.value.forEach((item)=>{
+        if(item.pKeyId===singleSaveid.value){
+            item.isCancopy=true
+        }
+    })
     tabTypeKeyInfo.value=TabTypeKey
     alllistDataval.value=AlllistData
     NodeStatusval.value=NodeStatus
@@ -451,6 +456,7 @@ const getBussDataInfo = async (item, index) => {
             contractId:contractId
         }, false)
         console.log(item,'item2222');
+          emit('changesingSaveId', pkeyIds)
         if(item.oper){
             console.log(11111111);
              HTableForm.setPickerKey([item])
@@ -584,8 +590,12 @@ const toBackClick = () => {
 }
 //单个保存
 const tableFormSaveLoading = ref(false)
+const singleSaveid=ref('')
 const tableFormSaveClick = async (item,index) => {
     if (isStatus.value !== '3') {
+        console.log(item,'单个保存');
+        singleSaveid.value=item.pKeyId
+         emit('changesingSaveId', item.pKeyId)
         if(tabTypeKeyInfo.value==='2'&&baseData.value['detectionResult']===''){
               window.$message?.warning('请选择是否合格')
         }else{
@@ -685,24 +695,30 @@ const delClick = async ({pKeyId}) => {
 const copyClickLoading=ref(false)
 //复制本表
 const copyClick = async (item,index) => {
+    console.log(item,'复制item');
     const pkeyIds = getValString(item.pKeyId)
     if (pkeyIds) {
         if (isStatus.value !== '3') {
-            if (!item.isRenderTableForm) {
-                await copeBussTab(pkeyIds)
-            } else if (!item.isTableForm) {
-                window?.$message?.warning('暂无表单数据')
-            } else if (item.isRenderTableForm) {
-                // const res = await saveExcelBussData(item,index,false)
-                // if (res) {
-                //     await copeBussTab(pkeyIds)
-                // } else {
-                //     window?.$message?.warning('复制本表操作失败')
-                // }
-                 await copeBussTab(pkeyIds)
-            } else {
-                window?.$message?.warning(`数据异常了, isRenderTableForm: ${item.isRenderTableForm}, isTableForm: ${item.isTableForm}, pKeyId:${pkeyIds}`)
+            if(item.isRenderTableForm&&!item.isCancopy){
+                window.$message.warning('请先保存数据再复制本表')
+            }else{
+                     if (!item.isRenderTableForm) {
+                        await copeBussTab(pkeyIds)
+                    } else if (!item.isTableForm) {
+                        window?.$message?.warning('暂无表单数据')
+                    } else if (item.isRenderTableForm) {
+                        // const res = await saveExcelBussData(item,index,false)
+                        // if (res) {
+                        //     await copeBussTab(pkeyIds)
+                        // } else {
+                        //     window?.$message?.warning('复制本表操作失败')
+                        // }
+                        await copeBussTab(pkeyIds)
+                    } else {
+                        window?.$message?.warning(`数据异常了, isRenderTableForm: ${item.isRenderTableForm}, isTableForm: ${item.isTableForm}, pKeyId:${pkeyIds}`)
+                    }
             }
+     
         } else {
             window?.$message?.warning('已上报的资料,不允许复制')
         }
@@ -1216,7 +1232,7 @@ const specialNodeClick = async () => {
 }
 
 //事件
-const emit = defineEmits(['renew','offsetTop','updeviceUseIds','upcheckTableId','changesdate','chageorinData','changeIscanclick'])
+const emit = defineEmits(['renew','offsetTop','updeviceUseIds','upcheckTableId','changesdate','chageorinData','changeIscanclick','changesingSaveId'])
 
 //被点击
 const getOffsetTop = (key = '') => {

+ 21 - 0
src/views/tentative/detect/test-form.vue

@@ -48,6 +48,7 @@
                 :tabTypeKey="tabTypeKey"
                  @updeviceUseIds="updeviceUseIds"
                  @upcheckTableId="upcheckTableId"
+                 @changesingSaveId="changesingSaveId"
                  @changeIscanclick="changeIscanclick"
                  :nodeIdvalue="nodeIdvalue"
                  :alllistData="alllistData"
@@ -335,6 +336,14 @@ const getSearchNodeTables = async () => {
         isLoading.value = false
         if (!error && code === 200) {
             listItemData.value = getArrValue(data)
+              listItemData.value.forEach((item)=>{
+                if(item.pKeyId=== singSaveId.value){
+                    item.isCancopy=true
+                }
+            }
+                
+            )
+            
             // console.log( listItemData.value,' listItemData.value');
             // defaultCheckarrIds.value= listItemData.value.projectPosition.join(',')
         } else {
@@ -355,6 +364,13 @@ const getSearchNodeTables = async () => {
         isLoading.value = false
         if (!error && code === 200) {
             listItemData.value = getArrValue(data)
+            listItemData.value.forEach((item)=>{
+                if(item.pKeyId=== singSaveId.value){
+                    item.isCancopy=true
+                }
+            }
+                
+            )
         } else {
             listItemData.value = []
         }
@@ -457,10 +473,15 @@ const checkTabId=ref('')
 const upcheckTableId = (val) => {
     checkTabId.value=val
 }
+const singSaveId=ref('')
 const  iscanclick=ref(true)
 const changeIscanclick=(id)=>{
      iscanclick.value=false
 }
+const changesingSaveId=(id)=>{
+     singSaveId.value=id
+     console.log(id,'idsave');
+}
 //关联工程用途及部位 树
 const linksRelateModal = ref(false)
 const linksRelateModalClick = () => {