Explorar o código

合同工程清单修改

duy hai 1 ano
pai
achega
258dafbcb8

+ 57 - 29
src/views/project/debit/contract/check-list.vue

@@ -202,12 +202,12 @@
             <el-form ref="supplementsFormRef" class="p-4" label-position="left" label-width="auto" :model="supplementsFormModel" :rules="supplementsFormRules">
                 <el-row :gutter="20">
                     <el-col :span="8">
-                        <el-form-item label="清单编号:">
+                        <el-form-item label="清单编号:" prop="formNumber">
                             <el-input v-model="supplementsFormModel.formNumber" />
                         </el-form-item>
                     </el-col>
                     <el-col :span="8">
-                        <el-form-item label="清单名称:">
+                        <el-form-item label="清单名称:" prop="formName">
                             <el-input v-model="supplementsFormModel.formName" />
                         </el-form-item>
                     </el-col>
@@ -287,7 +287,7 @@
 
 <script setup>
 import { nextTick, onMounted, ref } from 'vue'
-import { arrToId, getArrValue, getObjValue, getRandom } from 'js-fast-way'
+import { arrToId, formValidate, getArrValue, getObjValue, getRandom } from 'js-fast-way'
 import { getHeader } from 'hc-vue3-ui'
 import { useAppStore } from '~src/store'
 import infoTable from './components/check-list/info-table.vue'
@@ -344,7 +344,9 @@ const searchForm = ref({})
 const treeProps = {
     label: 'formName',
     children: 'children',
-    isLeaf: 'hasChild',
+    isLeaf: function (data) {
+          return !data.hasChild
+    },
 }
 const ishowTree = ref(true)
 
@@ -554,31 +556,35 @@ const addNodeLoading = ref(false)
 const treeModalSave = async () => {
     console.log(formModel.value, 'form')
     console.log(menuType.value, 'val')
-    if (menuType.value === 'add') {
-        const { error, code } = await addNode({
-            ...formModel.value,
-            isSupplement:0,
-        })
-        //判断状态
-        addNodeLoading.value = false
-        if (!error && code === 200) {
-            window?.$message?.success('新增成功')
-            treeModalShow.value = false
-            window?.location?.reload() //刷新页面
-        }
-    } else if (menuType.value === 'edit') {
-        const { error, code } = await updateForm({
-            ...formModel.value,
-            isSupplement:0,
-        })
-        //判断状态
-        addNodeLoading.value = false
-        if (!error && code === 200) {
-            window?.$message?.success('修改成功')
-            treeModalShow.value = false
-            window?.location?.reload() //刷新页面
+    const res = await formValidate(formRef.value)
+    if (res) {
+        if (menuType.value === 'add') {
+            const { error, code } = await addNode({
+                ...formModel.value,
+                isSupplement:0,
+            })
+            //判断状态
+            addNodeLoading.value = false
+            if (!error && code === 200) {
+                window?.$message?.success('新增成功')
+                treeModalShow.value = false
+                window?.location?.reload() //刷新页面
+            }
+        } else if (menuType.value === 'edit') {
+            const { error, code } = await updateForm({
+                ...formModel.value,
+                isSupplement:0,
+            })
+            //判断状态
+            addNodeLoading.value = false
+            if (!error && code === 200) {
+                window?.$message?.success('修改成功')
+                treeModalShow.value = false
+                window?.location?.reload() //刷新页面
+            }
         }
     }
+   
 }
 
 //合同工程清单导入
@@ -613,7 +619,23 @@ const leadModalSave = async () => {
 const supplementsModalShow = ref(false)
 const supplementsFormRef = ref(null)
 const supplementsFormModel = ref({})
-const supplementsFormRules = ref({})
+const supplementsFormRules = ref({
+    formNumber: {
+        required: true,
+        trigger: 'blur',
+        message: '请输入清单编号',
+    },
+    formName: {
+        required: true,
+        trigger: 'blur',
+        message: '请输入清单名称',
+    },
+    chapterNumber: {
+        required: true,
+        trigger: 'blur',
+        message: '请输入章编号',
+    },
+})
 const supplementLoading = ref(false)
 const addsupply = ()=>{
     supplementsFormModel.value = {
@@ -625,10 +647,14 @@ const addsupply = ()=>{
 }
 const supplementsModalSave = async () => {
     console.log(supplementsFormModel.value, 'val')
-    const { error, code } = await addNode({
+    const res = await formValidate(supplementsFormRef.value)
+    if (res) {
+        const { error, code } = await addNode({
             ...supplementsFormModel.value,
             isSupplement:1,
             parentId:treeItem.value?.id || '',
+            contractId:contractId.value,
+            projectId:projectId.value,
         })
         //判断状态
         supplementLoading.value = false
@@ -637,6 +663,8 @@ const supplementsModalSave = async () => {
             supplementsModalShow.value = false
             window?.location?.reload() //刷新页面
         }
+    }
+    
 }
 
 //调整排序

+ 1 - 1
src/views/project/debit/contract/components/check-list/info-table.vue

@@ -10,7 +10,7 @@
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">清单类型:</hc-info-table-td>
-            <hc-info-table-td width="auto">{{ infoData?.isSupplement }}</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.formTypeName }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">单位:</hc-info-table-td>
             <hc-info-table-td width="auto">{{ infoData?.unit }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">清单标识:</hc-info-table-td>

+ 1 - 1
src/views/project/debit/contract/components/check-list/info-table1.vue

@@ -10,7 +10,7 @@
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">清单类型:</hc-info-table-td>
-            <hc-info-table-td width="auto">{{ infoData?.isSupplement }}</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.formTypeName }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">单位:</hc-info-table-td>
             <hc-info-table-td width="auto">{{ infoData?.unit }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">清单标识:</hc-info-table-td>