ZaiZai vor 10 Monaten
Ursprung
Commit
13bae6c566

+ 13 - 5
src/api/modules/debit-pay/material/contract.js

@@ -57,12 +57,20 @@ export default {
             params: { contractId },
         }, false)
     },
-    //新增日期树表格
-    async addDateTreeTable(form) {
+    //获取同步数据
+    async getSyncData(form) {
         return HcApi({
-            url: '/api/blade-meter/materialValidity/add',
-            method: 'post',
-            data: form,
+            url: '/api/blade-meter/contractMaterial/get-sync-data',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+    //同步材料
+    async syncMaterial(form) {
+        return HcApi({
+            url: '/api/blade-meter/contractMaterial/sync-material',
+            method: 'get',
+            params: form,
         }, false)
     },
 }

+ 3 - 3
src/api/modules/debit-pay/material/material.js

@@ -8,14 +8,14 @@ export default {
             params: { contractId },
         }, false)
     },
-    //计量期
-    async periodMeasurement(contractId) {
+    //计量期,王文龙说不要了,4月26,,16点35
+    /*async periodMeasurement(contractId) {
         return HcApi({
             url: '/api/blade-meter/meterPeriod/approvalPeriod',
             method: 'get',
             params: { contractId, type: 1, notApp: '1' },
         }, false)
-    },
+    },*/
     //材料名称
     async materialName(contractId, meterPeriodId) {
         return HcApi({

+ 3 - 9
src/views/debit-pay/material/components/material/dataModal.vue

@@ -11,7 +11,9 @@
                         <hc-info-table-td>
                             <el-form-item prop="key1">
                                 <el-select v-model="formModel.meterPeriodId" placeholder="选择计量期" filterable block>
-                                    <el-option v-for="item in measurement" :key="item.id" :label="item.periodName" :value="item.id" />
+                                    <template v-for="item in adjustment" :key="item.id">
+                                        <el-option v-if="item.approveStatus === 0" :label="item.periodNumber" :value="item.id" />
+                                    </template>
                                 </el-select>
                             </el-form-item>
                         </hc-info-table-td>
@@ -250,7 +252,6 @@ const formRules = {
 
 //处理数据
 const detailsModalShow = () => {
-    getPeriodMeasurement()
     getPeriodAdjustment()
     getMaterialName()
     //过去数据详情
@@ -280,13 +281,6 @@ const getDetailData = async () => {
     }
 }
 
-//获取计量期
-const measurement = ref([])
-const getPeriodMeasurement = async () => {
-    const { data } = await mainApi.periodMeasurement(contractId.value)
-    measurement.value = getArrValue(data)
-}
-
 //获取调差期
 const adjustment = ref([])
 const getPeriodAdjustment = async () => {

+ 60 - 1
src/views/debit-pay/material/contract.vue

@@ -154,6 +154,14 @@
                 <el-button v-if="!formModel.id" :loading="saveLoaing" hc-btn type="primary" @click="modalSaveClose">提交并关闭</el-button>
             </template>
         </hc-new-dialog>
+        <!-- 同步材料数据 -->
+        <hc-new-dialog v-model="asyncModal" title="同步材料数据" :footer="false" widths="70%" @close="asyncClose">
+            <hc-table :column="asyncColumn" :datas="asyncData" :index-style="{ width: 60 }" :loading="asyncLoading">
+                <template #action="{ row }">
+                    <el-link type="primary" @click="syncRowData(row)">同步到当前合同段</el-link>
+                </template>
+            </hc-table>
+        </hc-new-dialog>
     </hc-new-card>
 </template>
 
@@ -213,7 +221,7 @@ const tableColumn = ref([
     { key: 'quotaRatio', name: '调差限额百分比(%)' },
     { key: 'ownerRatio', name: '业主收益/承担百分比(%)' },
     { key: 'deductionRatio', name: '材料综合抵扣率(%)' },
-    { key: 'action', name: '操作', width: 100, align: 'center' },
+    { key: 'action', name: '操作', width: 120, align: 'center' },
 ])
 
 //获取表格数据
@@ -448,8 +456,59 @@ const priceCancelClick = () => {
 }
 
 //同步
+const asyncColumn = ref([
+    { key: 'contractName', name: '数据来源' },
+    { key: 'materialNumber', name: '材料编号' },
+    { key: 'materialName', name: '材料名称' },
+    { key: 'specification', name: '规格型号' },
+    { key: 'unit', name: '单位' },
+    { key: 'price', name: '单价' },
+    { key: 'wastageRatio', name: '材料损耗率(%)' },
+    { key: 'quotaRatio', name: '调差限额百分比(%)' },
+    { key: 'ownerRatio', name: '业主收益/承担百分比(%)' },
+    { key: 'deductionRatio', name: '材料综合抵扣率(%)' },
+    { key: 'action', name: '操作', width: 140, align: 'center' },
+])
+const asyncData = ref([])
+const asyncLoading = ref(false)
+const asyncInfo = ref({})
+
+//同步
+const asyncModal = ref(false)
 const synchronization = async (row) => {
+    asyncInfo.value = row
+    asyncModal.value = true
+    asyncLoading.value = true
+    const { data } = await mainApi.getSyncData({
+        materialNumber: row.materialNumber,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    asyncData.value = getArrValue(data)
+    asyncLoading.value = false
+}
+
+//同步到当前合同段
+const syncRowData = async (row) => {
+    const { error, code, msg } = await mainApi.syncMaterial({
+        id: asyncInfo.value.id,
+        selectId: row.id,
+    })
+    if (!error && code === 200) {
+        window.$message.success(msg)
+        asyncClose()
+        getTableData().then()
+    } else {
+        window.$message.error(msg ?? '操作失败')
+    }
+}
 
+//关闭同步
+const asyncClose = () => {
+    asyncModal.value = false
+    asyncInfo.value = {}
+    asyncData.value = []
+    asyncLoading.value = false
 }
 </script>
 

+ 1 - 1
src/views/debit-pay/material/material.vue

@@ -47,7 +47,7 @@
 import { onActivated, ref } from 'vue'
 import { useAppStore } from '~src/store'
 import { HcDelMsg } from 'hc-vue3-ui'
-import { getArrValue, getObjValue } from 'js-fast-way'
+import { getArrValue } from 'js-fast-way'
 import mainApi from '~api/debit-pay/material/material'
 import HcdataModal from './components/material/dataModal.vue'