Pārlūkot izejas kodu

合同计量单元接口调用

duy 1 gadu atpakaļ
vecāks
revīzija
73b7136f18

+ 15 - 3
src/api/modules/project/debit/contract/check-list.js

@@ -2,9 +2,14 @@ import { HcApi } from '../../../../request/index'
 
 // 合同工程清单
 
-//获取合同清单树
-export const getFormTree = (form = {}, msg = true) => HcApi({
-    url: '/api/blade-meter/contractInventoryForm/getFormTree',
+//获取获取合同工程清单表
+// export const getFormTree = (form = {}, msg = true) => HcApi({
+//     url: '/api/blade-meter/contractInventoryForm/getFormTree',
+//     method: 'get',
+//     params: form,
+// }, msg)
+export const getContrInFormAllByConId = (form = {}, msg = true) => HcApi({
+    url: '/api/blade-meter/contractInventoryForm/getContrInFormAllByConId',
     method: 'get',
     params: form,
 }, msg)
@@ -61,4 +66,11 @@ export const lockNode = (form = {}, msg = true) => HcApi({
     url: '/api/blade-meter/contractInventoryForm/lockNode',
     method: 'get',
     params: form,
+}, msg)
+
+//添加同合计量 清单
+export const saveInvenFormMeter = (form, msg = true) => HcApi({
+    url: '/api/blade-meter/inventoryFormMeter/saveInvenFormMeter',
+    method: 'post',
+    params: form,
 }, msg)

+ 56 - 20
src/views/project/debit/contract/components/unit/addCheckList.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-new-dialog is-table :padding="false" widths="1200px" :show="isShow" title="添加合同工程清单" @save="modalSave" @close="modalClose">
+    <hc-new-dialog is-table :padding="false" widths="1200px" :show="isShow" title="添加合同工程清单" :loading="saveLoading" @save="modalSave" @close="modalClose">
         <hc-new-card>
             <template #search>
                 <hc-search-input v-model="searchForm.queryValue" placeholder="请输入清单编号关键词" @search="searchClick" />
@@ -8,24 +8,32 @@
                 :column="tableColumn" :datas="tableData" :loading="tableLoading"
                 is-new is-check :check-style="{ width: 29 }" :index-style="{ width: 60 }"
                 @selection-change="tableCheckChange"
-            />
+            >
+                <template #isSupplement="{ row }">
+                    <span class="text-link">{{ row?.isSupplement === 1 ? '是' : '否' }}</span>
+                </template>
+            </hc-table>
         </hc-new-card>
     </hc-new-dialog>
 </template>
 
 <script setup>
 import { ref, watch } from 'vue'
-
+import { getContrInFormAllByConId, saveInvenFormMeter } from '~api/project/debit/contract/check-list.js'
+import { useAppStore } from '~src/store'
+import { arrToId, getArrValue } from 'js-fast-way'
 const props = defineProps({
     ids: {
         type: [String, Number],
         default: '',
     },
 })
-
 //事件
 const emit = defineEmits(['finish', 'close'])
+const useAppState = useAppStore()
+const contractId = ref(useAppState.getContractId || '')
 
+const ids = ref(props.ids)
 //双向绑定
 // eslint-disable-next-line no-undef
 const isShow = defineModel('modelValue', {
@@ -35,14 +43,16 @@ const isShow = defineModel('modelValue', {
 //监听
 watch(() => [
     props.ids,
-], ([ids]) => {
-    console.log('ids', ids)
+], ([Id]) => {
+  
+    ids.value = Id
 }, { immediate: true })
 
 //监听
 watch(isShow, (val) => {
     if (val) {
         console.log('处理数据')
+        getTableData()
     }
 })
 
@@ -52,30 +62,56 @@ const searchForm = ref({
 })
 
 const searchClick = () => {
-
+    getTableData()
 }
 
 //表格数据
 const tableLoading = ref(false)
 const tableColumn = [
-    { key: 'key1', name: '清单编号' },
-    { key: 'key2', name: '清单名称' },
-    { key: 'key3', name: '现行单价' },
-    { key: 'key4', name: '合同数量' },
-    { key: 'key5', name: '合同变更后数量' },
-    { key: 'key6', name: '已分解量' },
-    { key: 'key7', name: '是否增补' },
+    { key: 'formNumber', name: '清单编号' },
+    { key: 'formName', name: '清单名称' },
+    { key: 'currentPrice', name: '现行单价' },
+    { key: 'contractTotal', name: '合同数量' },
+    { key: 'changeTotal', name: '合同变更后数量' },
+    { key: 'poseNum', name: '已分解量' },
+    { key: 'isSupplement', name: '是否增补' },
 ]
-const tableData = ref([
-    { key1: '1111' },
-])
+const tableData = ref([])
+const getTableData = async () => {
+    tableLoading.value = true
+    const { error, code, data } = await getContrInFormAllByConId({
+       ...searchForm.value,
+       contractId:contractId.value,
+       formNum:searchForm.value.queryValue,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data)
+    } else {
+        tableData.value = []
+    }
+}
 
 //表格选择
+const selectList = ref([])
 const tableCheckChange = (checks) => {
-    console.log(checks)
+    selectList.value = checks
 }
-const modalSave = () => {
-    emit('finish')
+const saveLoading = ref(false)
+const modalSave = async () => {
+    saveLoading.value = true
+    const { error, code, msg } = await saveInvenFormMeter({
+        formIds:arrToId(selectList.value),
+        meterId:ids.value,
+      
+        })
+        //判断状态
+        saveLoading.value = false
+        if (!error && code === 200) {
+            window?.$message?.success(msg)
+            emit('finish', selectList.value)
+        }
+  
     modalClose()
 }
 const modalClose = () => {

+ 36 - 19
src/views/project/debit/contract/components/unit/row-data.vue

@@ -10,7 +10,7 @@
                     </el-col>
                     <el-col :span="6">
                         <el-form-item label="工程编号:">
-                            <el-input v-model="formModel.knodeCodeey2" placeholder="工程编号" />
+                            <el-input v-model="formModel.nodeCode" placeholder="工程编号" />
                         </el-form-item>
                     </el-col>
                     <el-col :span="6">
@@ -92,11 +92,11 @@
                     </template>
                 </hc-title>
                 <hc-table :column="tableColumn" :datas="tableData" is-new :index-style="{ width: 60 }">
-                    <template #key8="{ row }">
-                        <hc-table-input v-model="row.key8" />
+                    <template #poseNum="{ row }">
+                        <hc-table-input v-model="row.poseNum" />
                     </template>
-                    <template #action="{ row }">
-                        <el-link type="danger">删除</el-link>
+                    <template #action="{ row, index }">
+                        <el-link type="danger" @click="delRow(index)">删除</el-link>
                     </template>
                 </hc-table>
                 <div class="mt-4 text-orange">温馨提示:进行过变更的分解清单不允许修改编辑,分解清单编辑后,请重新下达零号变更台账</div>
@@ -104,7 +104,7 @@
         </hc-body>
     </hc-new-dialog>
     <!-- 添加合同工程清单 -->
-    <AddCheckList v-model="addCheckListShow" />
+    <AddCheckList v-model="addCheckListShow" :ids="curTreeData.id" @finish="addCheckFinish" />
 </template>
 
 <script setup>
@@ -139,15 +139,22 @@ const isShow = defineModel('modelValue', {
 
 const ids = ref(props.ids)
 const curTreeData = ref(props.curTreeData)
+const isTable = ref(props.isTable)
 const formModel = ref({})
+const tableData = ref([
+   
+])
 //监听
 watch(() => [
     props.ids,
     props.curTreeData,
-], ([Ids, cur]) => {
+    props.isTable,
+], ([Ids, cur, tabs]) => {
     ids.value = Ids
     curTreeData.value = cur
     formModel.value = cur
+    isTable.value = tabs
+    tableData.value = curTreeData.value.decompositionList
 }, { immediate: true })
 
 //监听
@@ -164,22 +171,23 @@ const formRules = ref({})
 
 //列表
 const tableColumn = ref([
-    { key: 'key1', name: '清单编号' },
-    { key: 'key2', name: '清单名称' },
-    { key: 'key3', name: '单价(元)' },
-    { key: 'key4', name: '合同数量' },
-    { key: 'key5', name: '合同变更后数量' },
-    { key: 'key6', name: '已分解量' },
-    { key: 'key7', name: '分解剩余量' },
-    { key: 'key8', name: '施工图数量' },
-    { key: 'key9', name: '施工图变更后数量' },
+    { key: 'formNumber', name: '清单编号' },
+    { key: 'formName', name: '清单名称' },
+    { key: 'currentPrice', name: '单价(元)' },
+    { key: 'contractTotal', name: '合同数量' },
+    { key: 'changeTotal', name: '合同变更后数量' },
+    { key: 'poseNum', name: '已分解量' },
+    { key: 'residueNum', name: '分解剩余量' },
+    { key: 'poseNum', name: '施工图数量' },
+    { key: 'changeTotal', name: '施工图变更后数量' },
     { key: 'action', name: '操作', width: 80, align: 'center' },
 ])
-const tableData = ref([
-    { key1: '101-1-a' },
-])
+// const tableData = ref([
+//     { key1: '101-1-a' },
+// ])
 const addNodeLoading = ref(false)
 const modalSave = async () => {
+    addNodeLoading.value = true
     const { error, code, msg } = await unitApi.updateForm({
             ...formModel.value,
       
@@ -194,4 +202,13 @@ const modalSave = async () => {
 }
 
 const addCheckListShow = ref(false)
+const addCheckFinish = (val)=>{
+    addCheckListShow.value = false
+    val.forEach((ele)=>{
+        tableData.value.push(ele)
+    })
+}
+const delRow = (index)=>{
+    tableData.value.splice(index, 1)
+}
 </script>

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

@@ -223,6 +223,7 @@ const treeLoadMenu = ({ item, level }, resolve) => {
 }
 const menuType = ref('')
 const treeMenuTap = ({ key, node, data, keys }) => {
+    isInfoView.value = node.isLeaf
     menuType.value = key
     getTreeNodeDetail(data)
     setStoreValue('wbsTreeExpandKeys', keys)
@@ -303,13 +304,13 @@ const removeContractTreeNode = async () => {
 const tableLoading = ref(false)
 const tableColumn = ref([
     { key: 'key1', name: '分解明细', width: 80, align: 'center' },
-    { key: 'key2', name: '清单编号', width: 120, align: 'center' },
-    { key: 'key3', name: '清单名称', align: 'center' },
-    { key: 'key4', name: '单价', width: 90, align: 'center' },
-    { key: 'key5', name: '合同数量', width: 100, align: 'center' },
-    { key: 'key6', name: '变更后数量', width: 110, align: 'center' },
-    { key: 'key7', name: '施工图数量', align: 'center' },
-    { key: 'key8', name: '施工图变更后数量', align: 'center' },
+    { key: 'formNumber', name: '清单编号', width: 120, align: 'center' },
+    { key: 'formName', name: '清单名称', align: 'center' },
+    { key: 'currentPrice', name: '单价', width: 90, align: 'center' },
+    { key: 'contractTotal', name: '合同数量', width: 100, align: 'center' },
+    { key: 'changeTotal', name: '变更后数量', width: 110, align: 'center' },
+    { key: 'poseNum', name: '施工图数量', align: 'center' },
+    { key: 'changeTotal', name: '施工图变更后数量', align: 'center' },
 ])
 const tableData = ref([
     { key2: '1111' },