Browse Source

跨节点复制本节点复制方法

duy 2 years ago
parent
commit
8d181ab009

+ 43 - 29
src/views/data-fill/collapse-form/index.vue

@@ -263,7 +263,9 @@
         <HcCopy v-if="showcopyModal" ref="copyRefs"  :contractId="contract_id" :projectId="projectId"  :classify="classifys" 
         <HcCopy v-if="showcopyModal" ref="copyRefs"  :contractId="contract_id" :projectId="projectId"  :classify="classifys" 
         :tree_AutoExpandKeys="tree_AutoExpandKeys"
         :tree_AutoExpandKeys="tree_AutoExpandKeys"
         :treenodeDataInfo="treenodeDataInfo"
         :treenodeDataInfo="treenodeDataInfo"
-        :showcopyModal="showcopyModal"
+        :copyItems="copyItems"
+        @changeModalType="changeType"
+
         />
         />
     </HcDialog>
     </HcDialog>
 </template>
 </template>
@@ -881,8 +883,42 @@ const copyRefs=ref(null)
 const copyModalClose=()=>{
 const copyModalClose=()=>{
     // copyModal.value=false
     // copyModal.value=false
 }
 }
-const copySaveClick=()=>{
-    // copyModal.value=false
+const isOwntype=ref('1')
+const changeType=(type)=>{
+    isOwntype.value=type
+    console.log( isOwntype.value,' isOwntype.value');
+}
+const copySaveClick=async()=>{
+    //本节点复制
+   if(isOwntype.value==='2'){
+        const {pkeyId, isTableRender, isTableForm} =  copyItems.value
+        if (pkeyId) {
+            if (isStatus.value !== 3) {
+                if (!isTableRender) {
+                    await copeBussTab(pkeyId)
+                } else if (!isTableForm) {
+                    window?.$message?.warning('暂无表单数据')
+                } else if (isTableRender) {
+                    copyClickLoading.value = true
+                    const isSave = await saveExcelBussData(items, null, false)
+                    if (isSave) {
+                        await copeBussTab(pkeyId)
+                    } else {
+                        copyClickLoading.value = false
+                        window?.$message?.warning('复制本表操作失败')
+                    }
+                } else {
+                    window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${pkeyId}`)
+                }
+            } else {
+                window?.$message?.warning('已上报的资料,不允许复制')
+            }
+        } else {
+            window?.$message?.warning('pkeyId为空')
+    }
+   }else{
+    window?.$message?.warning('暂无相关接口')
+   }
 }
 }
 //复制本表
 //复制本表
 const copyClickModalLoading = ref(false)
 const copyClickModalLoading = ref(false)
@@ -914,34 +950,12 @@ const copyClick = async (items) => {
         window?.$message?.warning('pkeyId为空')
         window?.$message?.warning('pkeyId为空')
     }
     }
  }
  }
+const copyItems=ref([])
+//跨节点复制弹窗
 // const copyClick =  (items) => {
 // const copyClick =  (items) => {
 //     showcopyModal.value=true
 //     showcopyModal.value=true
-  
-//     // const {pkeyId, isTableRender, isTableForm} = items
-//     // if (pkeyId) {
-//     //     if (isStatus.value !== 3) {
-//     //         if (!isTableRender) {
-//     //             await copeBussTab(pkeyId)
-//     //         } else if (!isTableForm) {
-//     //             window?.$message?.warning('暂无表单数据')
-//     //         } else if (isTableRender) {
-//     //             copyClickLoading.value = true
-//     //             const isSave = await saveExcelBussData(items, null, false)
-//     //             if (isSave) {
-//     //                 await copeBussTab(pkeyId)
-//     //             } else {
-//     //                 copyClickLoading.value = false
-//     //                 window?.$message?.warning('复制本表操作失败')
-//     //             }
-//     //         } else {
-//     //             window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${pkeyId}`)
-//     //         }
-//     //     } else {
-//     //         window?.$message?.warning('已上报的资料,不允许复制')
-//     //     }
-//     // } else {
-//     //     window?.$message?.warning('pkeyId为空')
-//     // }
+//     copyItems.value=items
+    
 // }
 // }
 
 
 //复制表的请求
 //复制表的请求

+ 5 - 10
src/views/data-fill/collapse-form/test-copy.vue

@@ -2,8 +2,6 @@
   <div>
   <div>
     <div class="text-orange-500 ">复跨节点复制: 把当前表格已形成的数据复制到其他工程部位的相同表格里面</div>
     <div class="text-orange-500 ">复跨节点复制: 把当前表格已形成的数据复制到其他工程部位的相同表格里面</div>
     <div class="text-orange-500 mtop5">本节点复制:在当前节点内复制本表及数据</div>
     <div class="text-orange-500 mtop5">本节点复制:在当前节点内复制本表及数据</div>
- 
-  
     <div class="radio-group-box">
     <div class="radio-group-box">
         <el-radio-group v-model="CopyModalType" @change="changeCopyModalType">
         <el-radio-group v-model="CopyModalType" @change="changeCopyModalType">
             <el-radio label="1">跨节点复制</el-radio>
             <el-radio label="1">跨节点复制</el-radio>
@@ -22,10 +20,6 @@
                     @nodeTap="wbsElTreeClick"
                     @nodeTap="wbsElTreeClick"
                     ref="copywbstree"
                     ref="copywbstree"
                     :autoExpandKeys="treeautokeys"
                     :autoExpandKeys="treeautokeys"
-                 
-                   
-                   
-
                 />
                 />
             </el-scrollbar>
             </el-scrollbar>
         </div>
         </div>
@@ -57,6 +51,7 @@ const props = defineProps({
     classify:[String, Number],
     classify:[String, Number],
     tree_AutoExpandKeys:[Array],
     tree_AutoExpandKeys:[Array],
     treenodeDataInfo:[Object],//外层选中的树
     treenodeDataInfo:[Object],//外层选中的树
+    copyItems:[Object],//复制本表的数据
 })
 })
 //参数变量
 //参数变量
 const projectId = ref(props.projectId);
 const projectId = ref(props.projectId);
@@ -64,6 +59,7 @@ const contractId = ref(props.contractId);
 const classify = ref(props.classify);
 const classify = ref(props.classify);
 const tree_AutoExpandKeys = ref(props.tree_AutoExpandKeys);
 const tree_AutoExpandKeys = ref(props.tree_AutoExpandKeys);
 const treenodeDataInfo = ref(props.treenodeDataInfo);
 const treenodeDataInfo = ref(props.treenodeDataInfo);
+const copyItems = ref(props.copyItems);
 const CopyModalType=ref('1')
 const CopyModalType=ref('1')
 const copyModalTable=ref([]);
 const copyModalTable=ref([]);
 const tableLoading=ref(false)
 const tableLoading=ref(false)
@@ -106,12 +102,11 @@ const copyModalTableCheck = async (item) => {
     console.log('复制本表', item);
     console.log('复制本表', item);
 }
 }
 const treeautokeys=ref([])
 const treeautokeys=ref([])
+//事件
+const emit = defineEmits(['changeModalType'])
 const changeCopyModalType=(val)=>{
 const changeCopyModalType=(val)=>{
     if(val==='2'){
     if(val==='2'){
-       nextTick(()=>{
-        // treeautokeys.value=tree_AutoExpandKeys.value
-     
-       })
+        emit('changeModalType',val)
        
        
     }
     }
 }
 }