Browse Source

合同清单树接口调试

duy 1 year ago
parent
commit
9a6cc4016b

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

@@ -0,0 +1,20 @@
+import { HcApi } from '../../../request/index'
+//获取合同清单树
+export const getFormTree = (form = {}, msg = true) => HcApi({
+    url: '/api/blade-meter/contractInventoryForm/getFormTree',
+    method: 'get',
+    params: form,
+}, msg)
+//获取节点详情
+export const getDetail = (form = {}, msg = true) => HcApi({
+    url: '/api//blade-meter/contractInventoryForm/detail',
+    method: 'get',
+    params: form,
+}, msg)
+
+//导入清单
+export const importExcel = (form, msg = true) => HcApi({
+    url: '/api/blade-meter/contractInventoryForm/importExcel',
+    method: 'post',
+    data: form,
+}, msg)

+ 71 - 41
src/views/project/debit/contract/check-list.vue

@@ -1,8 +1,8 @@
 <template>
     <div class="relative h-full flex">
         <div :id="`hc_tree_card_${uuid}`">
-            <hc-new-card scrollbar>
-                <hc-lazy-tree :h-props="treeProps" is-load-menu @load="treeLoadNode" @loadMenu="treeLoadMenu" @menuTap="treeMenuTap" @nodeTap="treeNodeTap" />
+            <hc-new-card v-loading="treeLoaing" scrollbar>
+                <HcDataTree :h-props="treeProps" :datas="treeData" is-load-menu @menuTap="treeMenuTap" @nodeTap="treeNodeTap" @loadMenu="treeLoadMenu" />
             </hc-new-card>
         </div>
         <div :id="`hc_table_card_${uuid}`" class="flex-1">
@@ -13,7 +13,7 @@
                     <el-button hc-btn type="primary">导出</el-button>
                 </template>
                 <div class="relative">
-                    <infoTable1 v-if="isInfoView" />
+                    <infoTable1 v-if="isInfoView" :info-data="infoData" />
                     <template v-else>
                         <infoTable />
                         <el-divider border-style="dashed">下级节点列表</el-divider>
@@ -53,12 +53,12 @@
                         </el-col>
                         <el-col :span="8">
                             <el-form-item label="中标单价:">
-                                <el-input v-model="formModel.key5" :disabled="treeItem.type === 1" />
+                                <el-input v-model="formModel.key5" :disabled="treeItem.isFormNode === 0" />
                             </el-form-item>
                         </el-col>
                         <el-col :span="8">
                             <el-form-item label="合同数量:">
-                                <el-input v-model="formModel.key6" :disabled="treeItem.type === 1" />
+                                <el-input v-model="formModel.key6" :disabled="treeItem.isFormNode === 0" />
                             </el-form-item>
                         </el-col>
                         <el-col :span="8">
@@ -80,7 +80,7 @@
                         </el-col>
                     </template>
                     <!-- 修改和清单 -->
-                    <template v-if="menuType === 'edit' && treeItem.type === 2">
+                    <template v-if="menuType === 'edit' && treeItem.isFormNode === 1">
                         <el-col :span="8">
                             <el-form-item label="中标单价:">
                                 <el-input v-model="formModel.key5" />
@@ -151,8 +151,8 @@
             <div class="hc-el-upload-drag">
                 <el-upload
                     ref="leadUploadRef" hc drag :show-file-list="false" :auto-upload="false" :headers="getHeader()"
-                    action="/api/blade-resource/oss/endpoint/upload-file" :data="leadUploadData"
-                    accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+                    action="/api/blade-meter/contractInventoryForm/importExcel" :data="leadUploadData" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+                    @on-success="handleFileDUcess"
                 >
                     <div class="hc-ui-upload-btn">
                         <div class="hc-uploader-drop">
@@ -275,11 +275,17 @@
 
 <script setup>
 import { nextTick, onMounted, ref } from 'vue'
-import { getRandom } from 'js-fast-way'
+import { 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'
 import infoTable1 from './components/check-list/info-table1.vue'
+import { getDetail, getFormTree, importExcel } from '~api/project/debit/contract.js'
 
+//变量
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
+const contractId = ref(useAppState.getContractId)
 defineOptions({
     name: 'ProjectDebitContractList',
 })
@@ -289,6 +295,7 @@ const uuid = getRandom(4)
 //渲染完成
 onMounted(() => {
     setSplitRef()
+    treeLoadNode()
 })
 
 //初始化设置拖动分割线
@@ -308,33 +315,51 @@ const searchForm = ref({})
 
 //数据格式
 const treeProps = {
-    label: 'name',
+    label: 'formName',
     children: 'children',
-    isLeaf: 'leaf',
+    isLeaf: 'hasChild',
 }
+const treeData = ref([])
+//获取树的数据
 
-//懒加载的数据
-const treeLoadNode = ({ level, node }, resolve) => {
-    if (level === 0) {
-        return resolve([{ name: '根节点', type: 2 }])
-    }
-    if (level > 3) {
-        return resolve([])
+const treeLoaing = ref(false)
+const treeLoadNode = async ()=>{
+    treeLoaing.value = true
+    const { error, code, data } = await getFormTree({
+        projectId: projectId.value,
+        contractId:contractId.value,
+    })
+    treeLoaing.value = false
+    if (!error && code === 200) {
+        treeData.value = getArrValue(data)
+   
+    } else {
+        treeData.value = []
     }
-    setTimeout(() => {
-        resolve([
-            { name: '清单节点', type: 2, leaf: true },
-            { name: '非清单节点', type: 1 },
-        ])
-    }, 500)
+  
 }
-
 //树被点击
 const isInfoView = ref(false)
-const treeNodeTap = ({ node }) => {
+const treeNodeTap = ({ node, data }) => {
     isInfoView.value = !!node.isLeaf
+    console.log( isInfoView.value, '  isInfoView.value ')
+    getTreeNodeDetail(data)
 }
+const infoData = ref({})
+//获取节点详情
+const getTreeNodeDetail = async (node)=>{
+    const { id } = node
+    const { error, code, data } = await getDetail({
+       id,
+    })
 
+    if (!error && code === 200) {
+        infoData.value = getObjValue(data)
+   
+    } else {
+        infoData.value = {}
+    }
+}
 //菜单
 const treeLoadMenu = ({ item, level }, resolve) => {
     if (level === 1) {
@@ -354,6 +379,7 @@ const treeLoadMenu = ({ item, level }, resolve) => {
     }
 }
 
+
 const menuType = ref('')
 const treeItem = ref({})
 const treeMenuTap = ({ key, data }) => {
@@ -376,20 +402,18 @@ const treeMenuTap = ({ key, data }) => {
 //表格数据
 const tableLoading = ref(false)
 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: 'key10', name: '是否增补' },
-])
-const tableData = ref([
-    { key1: '1111' },
+    { key: 'formNumber', name: '清单编号' },
+    { key: 'formName', name: '清单名称' },
+    { key: 'unit', name: '单位' },
+    { key: 'currentPrice', name: '现行单价' },
+    { key: 'contractTotal', name: '合同数量' },
+    { key: 'contractMoney', name: '合同金额' },
+    { key: 'changePrice', name: '变更后单价' },
+    { key: 'changeTotal', name: '变更后数量' },
+    { key: 'changeMoney', name: '变更后金额' },
+    { key: 'isSupplement', name: '是否增补' },
 ])
+const tableData = ref([])
 
 //弹窗
 const treeModalShow = ref(false)
@@ -408,8 +432,13 @@ const treeModalSave = () => {
 //合同工程清单导入
 const leadModalShow = ref(false)
 const leadUploadRef = ref(null)
-const leadUploadData = ref({})
-
+const leadUploadData = ref({
+    projectId:projectId.value,
+    contractId:contractId.value,
+})
+const handleFileDUcess = (data)=>{
+    console.log(data, 'data')
+}
 const tableLeadData = ref([
     { id: 1, k1: '100', k2: '100', k3: '总则', k4: '', k5: '', k6: '', k7: '1', k8: '100', k9: '' },
     { id: 2, k1: '101-1', k2: '101-1', k3: '保险费', k4: '', k5: '', k6: '', k7: '1', k8: '100', k9: '' },
@@ -419,6 +448,7 @@ const tableLeadData = ref([
 ])
 
 const leadModalSave = () => {
+    leadUploadRef.value.submit()
     leadModalShow.value = false
 }
 

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

@@ -2,47 +2,66 @@
     <hc-info-table>
         <tr>
             <hc-info-table-td center is-title width="120px">清单编号:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.formNumber }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">清单名称:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.formName }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">是否增补清单:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.isSupplement === 1 ? '是' : '否' }}</hc-info-table-td>
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">清单类型:</hc-info-table-td>
-            <hc-info-table-td width="auto">普通清单</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.isSupplement }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">单位:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</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>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.formTag }}</hc-info-table-td>
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">中标单价:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.bidPrice }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">现行单价:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.currentPrice }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">变更后单价:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.changePrice }}</hc-info-table-td>
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">合同数量:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.contractTotal }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">变更后数量:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.changeTotal }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">专项暂定金:</hc-info-table-td>
-            <hc-info-table-td width="auto">-</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.changePrice }}</hc-info-table-td>
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">合同金额:</hc-info-table-td>
-            <hc-info-table-td width="auto">123123</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.contractMoney }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">变更后金额:</hc-info-table-td>
-            <hc-info-table-td width="auto">123123</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.changeMoney }}</hc-info-table-td>
             <hc-info-table-td center is-title width="120px">章编号:</hc-info-table-td>
-            <hc-info-table-td width="auto">200</hc-info-table-td>
+            <hc-info-table-td width="auto">{{ infoData?.chapterNumber }}</hc-info-table-td>
         </tr>
         <tr>
             <hc-info-table-td center is-title width="120px">备注:</hc-info-table-td>
-            <hc-info-table-td width="auto" colspan="5">-</hc-info-table-td>
+            <hc-info-table-td width="auto" colspan="5">{{ infoData?.remark }}</hc-info-table-td>
         </tr>
     </hc-info-table>
 </template>
+
+<script setup>
+import { ref, watch } from 'vue'
+//参数
+const props = defineProps({
+    infoData: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+const infoData = ref(props.infoData)
+//监听
+watch(() => [
+    props.infoData,
+], ([InfoData]) => {
+    console.log(InfoData, 'InfoData')
+    infoData.value = InfoData
+})
+</script>