Ver código fonte

材料计量单接口调用

duy 1 ano atrás
pai
commit
2631033bf8

+ 14 - 6
src/api/modules/debit-pay/material/contract.js

@@ -19,10 +19,18 @@ export default {
     },
     //删除
     async remove(form, msg = true) {
-    return HcApi({
-        url: '/api/blade-meter/contractMaterial/remove',
-        method: 'post',
-        params: form,
-    }, msg)
-},
+        return HcApi({
+            url: '/api/blade-meter/contractMaterial/remove',
+            method: 'post',
+            params: form,
+        }, msg)
+    },
+     //材料树
+     async materialTree(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-meter/contractMaterial/materialTree',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
 }

+ 44 - 0
src/api/modules/debit-pay/material/order.js

@@ -0,0 +1,44 @@
+import { HcApi } from '../../../request/index'
+//  材料计量单
+export default {
+    //分页
+    async getPage(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-meter/materialMeterForm/meterPage',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //详情
+    async detail(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-meter/materialMeterForm/detail',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //新增
+    async add(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-meter/materialMeterForm/add',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //修改
+    async update(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-meter/materialMeterForm/update',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //删除
+    async remove(form, msg = true) {
+    return HcApi({
+        url: '/api//blade-meter/materialMeterForm/remove',
+        method: 'post',
+        params: form,
+    }, msg)
+},
+}

+ 1 - 0
src/api/modules/debit-pay/material/periods.js

@@ -41,4 +41,5 @@ export default {
             params: form,
         }, msg)
     },
+   
 }

+ 18 - 16
src/views/debit-pay/material/components/order/dataModal.vue

@@ -3,7 +3,8 @@
         <div class="relative h-full flex">
             <div id="hc_modal_tree">
                 <hc-card-item scrollbar>
-                    <hc-lazy-tree :h-props="treeProps" @load="treeLoadNode" />
+                    <!-- <hc-lazy-tree :h-props="treeProps" @load="treeLoadNode" /> -->
+                    <HcDataTree :h-props="treeProps" :datas="treeLoadNode" />
                 </hc-card-item>
             </div>
             <div id="hc_modal_form">
@@ -106,16 +107,19 @@
 
 <script setup>
 import { nextTick, ref, watch } from 'vue'
-
+import { useAppStore } from '~src/store'
+import contractApi from '~api/debit-pay/material/contract.js'
+import { getArrValue } from 'js-fast-way'
 const props = defineProps({
     ids: {
         type: [String, Number],
         default: '',
     },
 })
-
 //事件
 const emit = defineEmits(['close'])
+const useAppState = useAppStore()
+const contractId = ref(useAppState.getContractId)
 
 //双向绑定
 // eslint-disable-next-line no-undef
@@ -145,6 +149,7 @@ const detailsModalShow = () => {
             minSize: [170, 500],
         })
     })
+    getTreeData()
 }
 
 //数据格式
@@ -155,21 +160,18 @@ const treeProps = {
 }
 
 //懒加载的数据
-const treeLoadNode = ({ level }, resolve) => {
-    if (level === 0) {
-        return resolve([{ name: 'region' }])
-    }
-    if (level > 3) {
-        return resolve([])
+const treeLoadNode = ref([])
+const getTreeData = async ()=>{
+    const { error, code, data } = await contractApi.materialTree({
+       contractId:contractId.value,
+    })
+    if (!error && code === 200) {
+        treeLoadNode.value = getArrValue(data)
+   
+    } else {
+        treeLoadNode.value = []
     }
-    setTimeout(() => {
-        resolve([
-            { name: 'leaf', leaf: true },
-            { name: 'zone' },
-        ])
-    }, 500)
 }
-
 //基础表单
 const baseFormRef = ref(null)
 const baseForm = ref({})

+ 85 - 31
src/views/debit-pay/material/order.vue

@@ -2,8 +2,8 @@
     <hc-new-card>
         <template #header>
             <div class="w-40">
-                <el-select v-model="searchForm.key1" filterable block placeholder="选择计量期" @change="searchKey1Click">
-                    <el-option v-for="item in key1Data" :key="item.id" :label="item.name" :value="item.id" />
+                <el-select v-model="searchForm.meterPeriodId" placeholder="选择计量期" filterable clearable block @change="searchKey1Click">
+                    <el-option v-for="item in key1Data" :key="item.id" :label="item.periodName" :value="item.id" />
                 </el-select>
             </div>
         </template>
@@ -21,9 +21,11 @@
             <div class="flex-1">
                 <hc-card-item>
                     <hc-table
+                        is-current-row
                         :column="tableColumn" :datas="tableData" :loading="tableLoading"
                         is-new is-check :check-style="{ width: 29 }" :index-style="{ width: 60 }"
                         @selection-change="tableCheckChange"
+                        @row-click="hanleRow"
                     >
                         <template #action="{ row }">
                             <el-link type="success" @click="rowEditClick(row)">修改</el-link>
@@ -40,52 +42,52 @@
                     <hc-info-table>
                         <tr>
                             <hc-info-table-td center is-title>合同材料:</hc-info-table-td>
-                            <hc-info-table-td width="120px">水泥</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.contractMaterialName }}</hc-info-table-td>
                             <hc-info-table-td center is-title>材料到场编号:</hc-info-table-td>
-                            <hc-info-table-td width="120px">1</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.materialArriveNumber }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>计量期:</hc-info-table-td>
-                            <hc-info-table-td width="120px">第1期</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.meterPeriodId }}</hc-info-table-td>
                             <hc-info-table-td center is-title>业务日期:</hc-info-table-td>
-                            <hc-info-table-td width="120px">2020-09-10</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.businessDate }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>单价:</hc-info-table-td>
-                            <hc-info-table-td width="120px">5000</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.price }}</hc-info-table-td>
                             <hc-info-table-td center is-title>计量数量:</hc-info-table-td>
-                            <hc-info-table-td width="120px">555</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.meterAmount }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>计量金额:</hc-info-table-td>
-                            <hc-info-table-td width="120px">2775000</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.meterMoney }}</hc-info-table-td>
                             <hc-info-table-td center is-title>备料堆放地点:</hc-info-table-td>
-                            <hc-info-table-td width="120px">-</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.storagePlace }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>存储情况:</hc-info-table-td>
                             <hc-info-table-td width="120px">-</hc-info-table-td>
                             <hc-info-table-td center is-title>材料来源:</hc-info-table-td>
-                            <hc-info-table-td width="120px">-</hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.storageStatus }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>材料是否符合要求:</hc-info-table-td>
-                            <hc-info-table-td width="120px"></hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.materialConformName }}</hc-info-table-td>
                             <hc-info-table-td center is-title>存储方法是否符合要求:</hc-info-table-td>
-                            <hc-info-table-td width="120px"></hc-info-table-td>
+                            <hc-info-table-td width="120px">{{ infoData?.storageConformName }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>合格证号:</hc-info-table-td>
-                            <hc-info-table-td width="auto" colspan="3">-</hc-info-table-td>
+                            <hc-info-table-td width="auto" colspan="3">{{ infoData?.certificate }}</hc-info-table-td>
                         </tr>
                         <tr>
                             <hc-info-table-td center is-title>备注:</hc-info-table-td>
-                            <hc-info-table-td width="auto" colspan="3">-</hc-info-table-td>
+                            <hc-info-table-td width="auto" colspan="3">{{ infoData?.remark }}</hc-info-table-td>
                         </tr>
                     </hc-info-table>
                     <div class="mt-5">附件列表</div>
                     <div class="mt-3">
-                        <el-check-tag checked class="mr-2">文件名称1.jpg</el-check-tag>
+                        <el-check-tag v-for="item in infoData?.fileList" checked class="mr-2">{{ item.fileName }}</el-check-tag>
                         <el-check-tag checked class="mr-2">文件名称2.jpg</el-check-tag>
                         <el-check-tag checked class="mr-2">文件名称3.jpg</el-check-tag>
                         <el-check-tag checked class="mr-2">文件名称4.jpg</el-check-tag>
@@ -102,30 +104,48 @@
 </template>
 
 <script setup>
-import { onMounted, ref } from 'vue'
+import { onActivated, onMounted, ref } from 'vue'
 import HcDataModal from './components/order/dataModal.vue'
+import mainApi from '~api/debit-pay/material/order.js'
+import periodApi from '~api/debit-pay/material/periods.js'
+import { getArrValue, getObjValue, getYearList } from 'js-fast-way'
+import { useAppStore } from '~src/store'
+const useAppState = useAppStore()
+const contractId = ref(useAppState.getContractId)
+const projectId = ref(useAppState.getProjectId)
 
 defineOptions({
     name: 'DebitPayMaterialOrder',
 })
 
 //渲染完成
+onActivated(() => {
+    getKey1Data()
+})
 onMounted(() => {
-
+    getTableData()
 })
-
 //搜索表单
 const searchForm = ref({
-    key1: null, current: 1, size: 10, total: 0,
+    meterPeriodId: null, current: 1, size: 10, total: 0,
 })
 
 //计量期
-const key1Data = ref([
-    { id: 1, name: '计量期1' },
-    { id: 2, name: '计量期2' },
-])
+const key1Data = ref([])
+const getKey1Data = async ()=>{
+    const { error, code, data } = await periodApi.allPeriod({
+       contractId:contractId.value,
+       type:1,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        key1Data.value = getArrValue(data)
+    } else {
+        key1Data.value = []
+    }
+}
 const searchKey1Click = () => {
-
+    getTableData()
 }
 
 //分页
@@ -137,17 +157,51 @@ const pageChange = ({ current, size }) => {
 //表格数据
 const tableLoading = ref(false)
 const tableColumn = ref([
-    { key: 'key1', name: '合同材料' },
-    { key: 'key2', name: '材料到场编号' },
+    { key: 'contractMaterialId', name: '合同材料' },
+    { key: 'materialArriveNumber', name: '材料到场编号' },
     { key: 'key3', name: '业务日期' },
-    { key: 'key4', name: '计量金额' },
-    { key: 'key5', name: '审核状态' },
+    { key: 'meterMoney', name: '计量金额' },
+    { key: 'approveStatusName', name: '审核状态' },
     { key: 'action', name: '操作', width: 94 },
 ])
 const tableData = ref([
-    { key1: '1111' },
 ])
-
+const getTableData = async () => {
+    tableLoading.value = true
+    console.log(searchForm.value, 'searchForm.value')
+    const { error, code, data } = await mainApi.getPage({
+       ...searchForm.value,
+       contractId:contractId.value,
+    //    meterPeriodId:searchForm.value.key1,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        if (tableData.value.length > 0) {
+            getDetail(tableData.value[0].id)
+          
+         
+        }
+    } else {
+        tableData.value = []
+    }
+}
+const hanleRow = ({ row })=>{
+    getDetail(id)
+}
+//获取详情
+const infoData = ref({})
+const getDetail = async (id)=>{
+    const { error, code, data } = await mainApi.detail({
+       id,
+    })
+    if (!error && code === 200) {
+        infoData.value = getObjValue(data)
+   
+    } else {
+        infoData.value = {}
+    }
+}
 //表格选择
 const tableCheckChange = () => {