Bladeren bron

合同计量单元

ZaiZai 10 maanden geleden
bovenliggende
commit
f4322ea427

+ 37 - 5
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-new-dialog is-table widths="95%" :show="isShow" :title="`中间计量${dataId ? isView ? '查看' : '修改' : '新增'}`" :footer="!isView	" @save="addModalSave" @close="addModalClose">
+    <hc-new-dialog is-table widths="95%" :show="isShow" :title="`中间计量${dataId ? isView ? '查看' : '修改' : '新增'}`" is-footer-center :footer="!isView" @close="addModalClose">
         <div v-loading="isLoading" class="relative h-full flex">
             <div v-if="!dataId" :id="`hc_tree_card_${uuid}`" class="hc_tree_card_border relative">
                 <hc-body scrollbar padding="0px">
@@ -162,6 +162,11 @@
                 </hc-body>
             </div>
         </div>
+        <template #footer>
+            <el-button hc-btn @click="addModalClose">取消</el-button>
+            <el-button hc-btn type="primary" :loading="submitLoading" @click="addModalSave">提交</el-button>
+            <el-button hc-btn type="primary" :loading="submitLoading" @click="submitClose">提交并关闭</el-button>
+        </template>
     </hc-new-dialog>
 
     <!-- 添加分解清单 -->
@@ -743,8 +748,10 @@ const fileUploadSuccess = ({ res }, resolve) => {
     ischangeByGetNode.value = false
 }
 
-//保存
-const addModalSave = async () => {
+//提交保存
+const submitLoading = ref(false)
+const submitData = async () => {
+    submitLoading.value = true
     if (!nodeId.value) {
         window.$message.warning('请先选择一个树节点')
         return
@@ -767,10 +774,11 @@ const addModalSave = async () => {
     const { code, msg } = res
     if (code === 200) {
         window.$message.success('保存成功')
-        continuousOperation()
-        emit('finish')
+        return true
     } else {
+        submitLoading.value = false
         window.$message.error(msg ?? '保存失败')
+        return false
     }
 }
 
@@ -800,6 +808,27 @@ const continuousOperation = () => {
     }
 }
 
+//保存
+const isSubmit = ref(false)
+const addModalSave = async () => {
+    const isValidate = await submitData()
+    if (isValidate) {
+        isSubmit.value = true
+        continuousOperation()
+        submitLoading.value = false
+    }
+}
+
+//提交并关闭
+const submitClose = async () => {
+    const isValidate = await submitData()
+    if (isValidate) {
+        submitLoading.value = false
+        addModalClose()
+        emit('finish')
+    }
+}
+
 //关闭弹窗
 const addModalClose = () => {
     isShow.value = false
@@ -809,6 +838,9 @@ const addModalClose = () => {
     isComparedRaVal.value = null
     setStoreValue('checkRows', [])
     emit('close')
+    if (isSubmit.value) {
+        emit('finish')
+    }
 }
 //关联质检资料
 const qualityMoadal = ref(false)

+ 1 - 1
src/views/debit-pay/admin/middlepay.vue

@@ -328,7 +328,7 @@ const rowDelClick = (row) => {
 //保存完成
 const treeKey = ref(getRandom(2))
 const addModalFinish = () => {
-    //addModalShow.value = false
+    addModalShow.value = false
     TreeAutoExpandKeys.value = getStoreValue('middlepay-tree-auto-expand-keys') || []
     treeKey.value = getRandom(2)
     getTableData().then()