duy 1 жил өмнө
parent
commit
79ae9b5459

+ 7 - 0
src/api/modules/project/debit/contract/unit.js

@@ -90,4 +90,11 @@ export default {
             params: form,
         }, msg)
     },
+    async removeInfo(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-meter/inventoryFormMeter/removeInfo',
+            method: 'post',
+            params: form,
+        }, msg)
+    },
 }

+ 2 - 1
src/views/project/debit/contract/components/unit/addCheckList.vue

@@ -58,7 +58,7 @@ watch(isShow, (val) => {
 
 //搜索
 const searchForm = ref({
-    queryValue: '',
+  
 })
 
 const searchClick = () => {
@@ -83,6 +83,7 @@ const getTableData = async () => {
        ...searchForm.value,
        contractId:contractId.value,
        formNum:searchForm.value.queryValue,
+       meterId:ids.value,
     })
     tableLoading.value = false
     if (!error && code === 200) {

+ 29 - 8
src/views/project/debit/contract/components/unit/row-data.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-new-dialog v-model="isShow" widths="90%" :is-table="isTable" :padding="false" title="合同计量单元修改" :loading="addNodeLoading" @save="modalSave">
+    <hc-new-dialog v-model="isShow" widths="90%" :is-table="isTable" :padding="false" title="合同计量单元修改" :loading="addNodeLoading" @save="modalSave" @close="closeDialog">
         <hc-body scrollbar :contents="!isTable">
             <el-form ref="formRef" label-position="left" label-width="auto" :model="formModel" :rules="formRules">
                 <el-row :gutter="20">
@@ -95,7 +95,7 @@
                             <hc-table-input v-model="row.poseNum" />
                         </template>
                         <template #action="{ row, index }">
-                            <el-link type="danger" @click="delRow(index)">删除</el-link>
+                            <el-link type="danger" @click="delRow(row, index)">删除</el-link>
                         </template>
                     </hc-table>
                 </div>
@@ -114,6 +114,7 @@ import unitApi from '~api/project/debit/contract/unit.js'
 import { useAppStore } from '~src/store'
 import { getDictionary } from '~api/other'
 import { getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 
 const props = defineProps({
     ids: {
@@ -130,9 +131,7 @@ const props = defineProps({
 })
 //事件
 const emit = defineEmits(['finish', 'close'])
-const useAppState = useAppStore()
-const projectId = ref(useAppState.getProjectId || '')
-const contractId = ref(useAppState.getContractId || '')
+
 //双向绑定
 // eslint-disable-next-line no-undef
 const isShow = defineModel('modelValue', {
@@ -233,7 +232,9 @@ const modalSave = async () => {
         }
     emit('finish')
 }
-
+const closeDialog = ()=>{
+    emit('close')
+}
 const addCheckListShow = ref(false)
 const addCheckFinish = (val)=>{
     addCheckListShow.value = false
@@ -241,7 +242,27 @@ const addCheckFinish = (val)=>{
         tableData.value.push(ele)
     })
 }
-const delRow = (index)=>{
-    tableData.value.splice(index, 1)
+const delRow = async (row, index)=>{
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                removeCon(row.id, index)
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+    })
+}
+const removeCon = async (id, index) => {
+    const { error, code } = await unitApi.removeInfo({
+        formIds: id, 
+        meterId:ids.value,
+    })
+    if (!error && code === 200) {
+        window?.$message?.success('删除成功')
+        tableData.value.splice(index, 1)
+        
+    }
 }
 </script>

+ 8 - 1
src/views/project/debit/contract/unit.vue

@@ -48,7 +48,7 @@
         <treeForm v-model="treeModalShow" :ids="curTreeData.id" :menu-type="menuType" :template-id="curTreeData.templateId" @finish="finishForm" />
 
         <!-- 修改合同计量单元 -->
-        <rowData v-model="editModalShow" :is-table="isInfoView" :ids="curTreeData.id" :cur-tree-data="curTreeData" @finish="finishEdit" />
+        <rowData v-model="editModalShow" :is-table="isInfoView" :ids="curTreeData.id" :cur-tree-data="curTreeData" @finish="finishEdit" @close="closeEdit" />
 
         <!-- 调整排序 -->
         <hc-new-dialog v-model="sortModalShow" is-table widths="1100px" title="调整排序" :loading="sortNodeLoading" @save="sortModalSave">
@@ -359,6 +359,13 @@ const finishEdit = ()=>{
         ishowTree.value = true
     }, 100)
 }
+const closeEdit = ()=>{
+    editModalShow.value = false
+    ishowTree.value = false
+    setTimeout(() => {
+        ishowTree.value = true
+    }, 100)
+}
 //调整排序
 const sortModalShow = ref(false)
 //表格数据