Bladeren bron

合同材料

ZaiZai 10 maanden geleden
bovenliggende
commit
3bea131e96

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

@@ -1,5 +1,29 @@
 import { HcApi } from '../../../request/index'
 export default {
+    //调差期
+    async periodAdjustment(contractId) {
+        return HcApi({
+            url: '/api/blade-meter/contractMeterPeriod/allPeriod',
+            method: 'get',
+            params: { contractId },
+        }, false)
+    },
+    //计量期
+    async periodMeasurement(contractId) {
+        return HcApi({
+            url: '/api/blade-meter/meterPeriod/approvalPeriod',
+            method: 'get',
+            params: { contractId, type: 1, notApp: '1' },
+        }, false)
+    },
+    //材料名称
+    async materialName(contractId) {
+        return HcApi({
+            url: '/api/blade-meter/contractMaterial/get-all-material2',
+            method: 'post',
+            data: { contractId },
+        }, false)
+    },
     //分页
     async page(form) {
         return HcApi({

+ 89 - 25
src/views/debit-pay/material/components/material/dataModal.vue

@@ -8,17 +8,15 @@
                         <hc-info-table-td>
                             <el-form-item prop="key1">
                                 <el-select v-model="formModel.key1" placeholder="选择计量期" filterable block>
-                                    <el-option label="第一期" value="1" />
-                                    <el-option label="第二期" value="2" />
+                                    <el-option v-for="item in measurement" :key="item.id" :label="item.periodName" :value="item.id" />
                                 </el-select>
                             </el-form-item>
                         </hc-info-table-td>
                         <hc-info-table-td is-title width="10%">调差期:</hc-info-table-td>
                         <hc-info-table-td>
-                            <el-form-item prop="key2">
-                                <el-select v-model="formModel.key2" placeholder="选择调差期" filterable block>
-                                    <el-option label="第一期" value="1" />
-                                    <el-option label="第二期" value="2" />
+                            <el-form-item prop="contractPeriodId">
+                                <el-select v-model="formModel.contractPeriodId" placeholder="选择调差期" filterable block>
+                                    <el-option v-for="item in adjustment" :key="item.id" :label="item.periodNumber" :value="item.id" />
                                 </el-select>
                             </el-form-item>
                         </hc-info-table-td>
@@ -27,15 +25,14 @@
                         <hc-info-table-td is-title width="10%">调差月份:</hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item>
-                                <el-date-picker v-model="formModel.key3" class="block" type="month" format="YYYY-MM" value-format="YYYY-MM" />
+                                <el-date-picker v-model="formModel.adjustMonth" class="block" type="month" format="YYYY-MM" value-format="YYYY-MM" />
                             </el-form-item>
                         </hc-info-table-td>
                         <hc-info-table-td is-title width="10%">材料名称:</hc-info-table-td>
                         <hc-info-table-td>
-                            <el-form-item prop="key4">
-                                <el-select v-model="formModel.key4" placeholder="选择材料名称" filterable block>
-                                    <el-option label="钢筋" value="1" />
-                                    <el-option label="粗砂" value="2" />
+                            <el-form-item prop="contractMaterialId">
+                                <el-select v-model="formModel.contractMaterialId" placeholder="选择材料名称" filterable block>
+                                    <el-option v-for="item in materialName" :key="item.id" :label="item.materialName" :value="item.id" />
                                 </el-select>
                             </el-form-item>
                         </hc-info-table-td>
@@ -44,15 +41,15 @@
                         <hc-info-table-td is-title width="10%">材料基准价格:</hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item>
-                                <el-input v-model="formModel.key5" disabled>
+                                <el-input v-model="formModel.materialPrice" disabled>
                                     <template #suffix>元</template>
                                 </el-input>
                             </el-form-item>
                         </hc-info-table-td>
                         <hc-info-table-td is-title width="10%">施工期市场价格:</hc-info-table-td>
                         <hc-info-table-td>
-                            <el-form-item prop="key6">
-                                <el-input v-model="formModel.key6" disabled>
+                            <el-form-item prop="currentPrice">
+                                <el-input v-model="formModel.currentPrice" disabled>
                                     <template #suffix>元</template>
                                     <template #append>
                                         <el-button type="primary" @click="realTimePriceClick">
@@ -68,13 +65,15 @@
                         <hc-info-table-td is-title width="10%">价差幅度:</hc-info-table-td>
                         <hc-info-table-td>
                             <el-form-item>
-                                <el-input v-model="formModel.key7" disabled />
+                                <el-input v-model="formModel.rangePriceRatio" disabled>
+                                    <template #suffix>%</template>
+                                </el-input>
                             </el-form-item>
                         </hc-info-table-td>
                         <hc-info-table-td is-title width="10%">材料数量:</hc-info-table-td>
                         <hc-info-table-td>
-                            <el-form-item prop="key8">
-                                <el-input v-model="formModel.key8" />
+                            <el-form-item prop="materialTotal">
+                                <el-input v-model="formModel.materialTotal" />
                             </el-form-item>
                         </hc-info-table-td>
                     </tr>
@@ -82,7 +81,7 @@
                         <hc-info-table-td is-title width="10%">调差金额:</hc-info-table-td>
                         <hc-info-table-td width="auto" colspan="3">
                             <el-form-item>
-                                <el-input v-model="formModel.key9" disabled />
+                                <el-input v-model="formModel.adjustMoney" disabled />
                             </el-form-item>
                         </hc-info-table-td>
                     </tr>
@@ -90,7 +89,7 @@
                         <hc-info-table-td is-title width="10%">材料调差计算式:</hc-info-table-td>
                         <hc-info-table-td width="auto" colspan="3">
                             <el-form-item>
-                                <el-input v-model="formModel.key10" type="textarea" :rows="4" resize="none" />
+                                <el-input v-model="formModel.adjustCalculation" type="textarea" :rows="4" resize="none" disabled />
                             </el-form-item>
                         </hc-info-table-td>
                     </tr>
@@ -101,7 +100,7 @@
             <el-divider border-style="dashed">
                 <el-segmented v-model="tab_key" :options="['材料明细', '上传附件']" />
             </el-divider>
-            <div v-if="tab_key === '材料明细'" class="loop-refresh-icon">
+            <div v-if="tab_key === '材料明细'" class="loop-refresh-icon" @click="getMaterialDetail">
                 <hc-icon name="loop-left" />
             </div>
             <div v-if="tab_key === '材料明细'" class="table-body">
@@ -205,13 +204,63 @@ const tab_key = ref('材料明细')
 //表单数据
 const formRef = ref(null)
 const formModel = ref({})
-const formRules = {}
+const formRules = {
+    key1: {
+        required: true,
+        trigger: 'blur',
+        message: '请选择计量期',
+    },
+    contractPeriodId: {
+        required: true,
+        trigger: 'blur',
+        message: '请选择调差期',
+    },
+    contractMaterialId: {
+        required: true,
+        trigger: 'blur',
+        message: '请选择材料名称',
+    },
+    currentPrice: {
+        required: true,
+        trigger: 'blur',
+        message: '请选择实时价格',
+    },
+    materialTotal: {
+        required: true,
+        trigger: 'blur',
+        message: '请填写材料数量',
+    },
+}
 
 //处理数据
 const detailsModalShow = () => {
+    getPeriodMeasurement()
+    getPeriodAdjustment()
+    getMaterialName()
     console.log(dataId.value)
 }
 
+//获取计量期
+const measurement = ref([])
+const getPeriodMeasurement = async () => {
+    const { data } = await mainApi.periodMeasurement(contractId.value)
+    measurement.value = getArrValue(data)
+}
+
+//获取调差期
+const adjustment = ref([])
+const getPeriodAdjustment = async () => {
+    const { data } = await mainApi.periodAdjustment(contractId.value)
+    adjustment.value = getArrValue(data)
+}
+
+//获取材料名称
+const materialName = ref([])
+const getMaterialName = async () => {
+    const { data } = await mainApi.materialName(contractId.value)
+    materialName.value = getArrValue(data)
+}
+
 //材料实时发布价格表格
 const tableColumn3 = [
     { key: 'key1', name: '有效时间' },
@@ -248,11 +297,26 @@ const tableColumn1 = [
     { key: 'key7', name: '调差系数', width: 120, align: 'center' },
     { key: 'key8', name: '调差数量', width: 120, align: 'center' },
 ]
-const tableData1 = ref([
-    {},
-])
+const tableData1 = ref([])
 const tableLoading1 = ref(false)
-
+const getMaterialDetail = async () => {
+    const { contractPeriodId, contractMaterialId } = formModel.value
+    if (isNullES(contractPeriodId) || isNullES(contractMaterialId)) {
+        window.$message.warning('请先选择调差期和材料名称')
+        return
+    }
+    //获取数据
+    const { code, msg, data } = await mainApi.getMaterialDetail({
+        contractMaterialId: contractMaterialId,
+        contractPeriodId: contractPeriodId,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    tableData1.value = getArrValue(data)
+    if (code !== 200 && msg) {
+        window.$message.error(msg)
+    }
+}
 
 //上传附件
 const tableColumn2 = [

+ 22 - 11
src/views/debit-pay/material/material.vue

@@ -3,11 +3,11 @@
         <template #header>
             <div class="w-32">
                 <el-select v-model="searchForm.contractPeriodId" placeholder="选择调差期" filterable clearable block>
-                    <el-option label="第一期" value="1" />
+                    <el-option v-for="item in adjustment" :key="item.id" :label="item.periodNumber" :value="item.id" />
                 </el-select>
             </div>
             <div class="ml-3 w-40">
-                <el-date-picker v-model="searchForm.adjustMonth" class="block" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" placeholder="调差时间" />
+                <el-date-picker v-model="searchForm.adjustMonth" class="block" type="month" format="YYYY-MM" value-format="YYYY-MM" placeholder="调差月份" />
             </div>
             <el-button class="ml-3" type="primary" @click="searchClick">
                 <hc-icon name="search" />
@@ -56,11 +56,22 @@ const contractId = ref(store.getContractId)
 
 //渲染完成
 onActivated(() => {
+    getPeriodAdjustment()
     getTableData()
 })
 
+//获取调差期
+const adjustment = ref([])
+const getPeriodAdjustment = async () => {
+    const { data } = await mainApi.periodAdjustment(contractId.value)
+    adjustment.value = getArrValue(data)
+}
+
 //搜索表单
-const searchForm = ref({ current: 1, size: 20, total: 0 })
+const searchForm = ref({
+    contractPeriodId: null, adjustMonth: null,
+    current: 1, size: 20, total: 0,
+})
 const searchClick = () => {
     searchForm.value.current = 1
     getTableData()
@@ -85,25 +96,25 @@ const tableColumn = [
     { key: 'key8', name: '状态', width: 120, align: 'center' },
     { key: 'action', name: '操作', width: 100, align: 'center' },
 ]
-const tableData = ref([
-    {},
-])
+const tableData = ref([])
 
 //获取表格数据
 const tableLoading = ref(false)
 const getTableData = async () => {
-    /*tableLoading.value = true
-    const { error, code, data } = await mainApi.getAllMaterial({
-        //...searchForm.value,
+    tableLoading.value = true
+    const { error, code, data } = await mainApi.page({
+        ...searchForm.value,
         projectId: projectId.value,
         contractId: contractId.value,
     })
     tableLoading.value = false
     if (!error && code === 200) {
-        tableData.value = getArrValue(data)
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total']
     } else {
         tableData.value = []
-    }*/
+        searchForm.value.total = 0
+    }
 }
 
 //新增