Browse Source

【复制本表】新增批量和二次确认弹窗功能

duy 1 week ago
parent
commit
4ffd8a09b2
2 changed files with 102 additions and 68 deletions
  1. 8 0
      src/api/modules/data-fill/wbs.js
  2. 94 68
      src/views/data-fill/collapse-form/index.vue

+ 8 - 0
src/api/modules/data-fill/wbs.js

@@ -218,6 +218,14 @@ export default {
             params: form,
         })
     },
+    //表单批量复制
+    async copeBussTabList(form) {
+        return HcApi({
+            url: '/api/blade-manager/exceltab/cope-buss-tab-list',
+            method: 'get',
+            params: form,
+        })
+    },
     //多表预览
     async getBussPdfs(form) {
         return HcApi({

+ 94 - 68
src/views/data-fill/collapse-form/index.vue

@@ -103,7 +103,7 @@
                                 </el-link>
                                 <el-link
                                     v-else type="primary" :disabled="copyClickLoading"
-                                    @click.stop="copyClick(item, index)"
+                                    @click.stop="copyTabClick(item)"
                                 >
                                     复制本表
                                 </el-link>
@@ -113,7 +113,7 @@
                                     :type="item.tabFileType === 2
                                         ? 'success'
                                         : 'primary'
-                                    " :disabled="isStatus == '3'" @click.stop="uploadClick(item, index)"
+                                    " :disabled="isStatus === 3" @click.stop="uploadClick(item, index)"
                                 >
                                     <template v-if="item.tabFileType === 2">
                                         已上传
@@ -195,8 +195,8 @@
                             </HcTooltip>
                         </div>
                         <div class="btn-action">
-                            <!-- 发版隔离--start -->
-                            <!-- <el-button
+                            <!-- 发版隔离 11.18 --start -->
+                            <el-button
                                 v-if="!isOpenFormulaDescription" size="small" hc-btn color="#2550A2"
                                 style="color:#fff;border-radius: 3px;" @click="enableFormulaDescription"
                             >
@@ -207,8 +207,8 @@
                                 style="color:#F3F3F3;border-radius: 3px;" @click="enableFormulaDescription"
                             >
                                 关闭公式说明
-                            </el-button> -->
-                            <!-- 发版隔离--end -->
+                            </el-button>
+                            <!-- 发版隔离 11.18 --end -->
                             <el-button v-if="isEnableBulk" type="warning" size="small" @click="enableBulkReplication">
                                 关闭批量复制
                             </el-button>
@@ -390,8 +390,8 @@
             </HcDragNode>
         </HcDragModal>
     </template>
-    <!-- 复制本表 -->
-    <hc-new-dialog
+    <!-- 复制本表(未使用) -->
+    <!-- <hc-new-dialog
         v-model="showcopyModal" :loading="copyClickModalLoading" save-text="确认复制" title="复制本表" widths="84%"
         @close="copyModalClose" @save="copySaveClick"
     >
@@ -419,7 +419,7 @@
                 </div>
             </div>
         </template>
-    </hc-new-dialog>
+    </hc-new-dialog> -->
 
     <!-- 含水率 -->
     <hc-new-dialog v-model="waterModal" title="含水率" @close="waterModalClose" @save="waterSaveClick">
@@ -540,7 +540,7 @@
         </div>
     </hc-dialog>
     <!-- 导入表格数据 -->
-    <hc-dialog v-model="uploadFileDialog" title="导入表格数据" @save="uploadFileClickSave" @close="initUploadFileForm">
+    <hc-dialog v-model="uploadFileDialog" title="导入表格数据" @save="uploadFileClickSave">
         <div class="dialog-content">
             <!-- 提示文本 -->
             <p class="mb-4 text-orange">
@@ -567,6 +567,20 @@
         </div>
     </hc-dialog>
 
+    <!-- 复制本表 -->
+    <hc-dialog v-model="copyTabDialog" title="复制本表" @save="copyTabClickSave">
+        <div style="color:#000">
+            <!-- 表单内容 -->
+            <span class="mr-4">复制数量</span>
+            <el-input
+                v-model="copyTabForm.size" style="width: 120px; display: inline-block"
+                placeholder="请输入复制数量" type="number" :min="1"
+                oninput="value = value > 0 ? parseInt(value) : ''"
+            />
+            <span class="ml-4">张</span>
+        </div>
+    </hc-dialog>
+
     <!-- 公式说明弹窗 -->
     <el-dialog
         v-model="formulaDescriptionVisible" modal-class="formula-dialog" width="350px" title="公式说明"
@@ -1520,63 +1534,66 @@ const delClick = async ({ pkeyId }, index) => {
     })
 }
 //复制本表相关
-const showcopyModal = ref(false)
-const copyRefs = ref(null)
-const copyModalClose = () => {
-    // copyModal.value=false
-}
-const CopyModalType = ref('1')
-
-const copySaveClick = async () => {
-    //本节点复制
-    if (CopyModalType.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 showcopyModal = ref(false)
+// const copyRefs = ref(null)
+// const copyModalClose = () => {
+//     // copyModal.value=false
+// }
+// const CopyModalType = ref('1')
+
+// const copySaveClick = async () => {
+//     //本节点复制
+//     if (CopyModalType.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)
+
+const copyTabDialog = ref(false)
+const copyTabForm = ref({})
 const copyClickLoading = ref(false)
-const copyClick = async (items) => {
-    const { pkeyId, isTableRender, isTableForm } = items
+const copyTabClickSave = async () => {
+    const { pkeyId, isTableRender, isTableForm } = copyTabForm.value
     if (pkeyId) {
         if (isStatus.value !== 3) {
             if (!isTableRender) {
-                await copeBussTab(pkeyId)
+                await copyBussTab(pkeyId)
             } else if (!isTableForm) {
                 window?.$message?.warning('暂无表单数据')
             } else if (isTableRender) {
                 copyClickLoading.value = true
-                const isSave = await saveExcelBussData(items, null, false)
+                const isSave = await saveExcelBussData(copyTabForm.value, null, false)
                 if (isSave) {
-                    await copeBussTab(pkeyId)
+                    await copyBussTab(pkeyId)
                 } else {
                     copyClickLoading.value = false
                     window?.$message?.warning('复制本表操作失败')
@@ -1593,7 +1610,7 @@ const copyClick = async (items) => {
         window?.$message?.warning('pkeyId为空')
     }
 }
-const copyItems = ref([])
+// const copyItems = ref([])
 //跨节点复制弹窗
 // const copyClick =  (items) => {
 //     showcopyModal.value=true
@@ -1601,15 +1618,27 @@ const copyItems = ref([])
 
 // }
 
+
+//复制本表弹窗
+const copyTabClick = (item) => {
+    copyTabForm.value = {
+        ...item,
+        size: 1,
+    }
+    copyTabDialog.value = true
+}
+
 //复制表的请求
-const copeBussTab = async (pkeyId) => {
+const copyBussTab = async (pkeyId) => {
     copyClickLoading.value = true
-    const { error, code, msg } = await wbsApi.copeBussTab({
+    const { error, code, msg } = await wbsApi.copeBussTabList({
         pkeyId: pkeyId,
+        size: copyTabForm.value.size,
     })
     copyClickLoading.value = false
     if (!error && code === 200) {
         window?.$message?.success('操作成功')
+        copyTabDialog.value = false
         // renewData()
         getNewList()
     } else {
@@ -1631,7 +1660,7 @@ const getNewList = () => {
     }, 1000)
 }
 //隐藏本表
-const tableFormHideLoading = ref(false)
+// const tableFormHideLoading = ref(false)
 const hideClick = async (item, index) => {
     const { pkeyId, isBussShow } = item
     if (pkeyId) {
@@ -2092,6 +2121,10 @@ const checkItem = ref({})
 const uploadFileDialog = ref(false)
 //打开文件选择框
 const uploadFileClick = (item) => {
+    uploadFileForm.value = {
+        pageSize: '1',
+        selectedOption: true,
+    }
     uploadFileDialog.value = true
     checkItem.value = item
 }
@@ -2100,13 +2133,6 @@ const uploadFileForm = ref({
     selectedOption: true,
 })
 
-const initUploadFileForm = () => {
-    uploadFileForm.value = {
-        pageSize: '1',
-        selectedOption: true,
-    }
-}
-
 const uploadFileClickSave = () => {
     if (uploadFileForm.value.selectedOption) {
         if (!uploadFileForm.value.pageSize) {