Browse Source

合同材料

ZaiZai 10 months ago
parent
commit
87a51bcf91
1 changed files with 44 additions and 14 deletions
  1. 44 14
      src/views/debit-pay/material/components/material/dataModal.vue

+ 44 - 14
src/views/debit-pay/material/components/material/dataModal.vue

@@ -132,12 +132,21 @@
     </hc-new-dialog>
     <!-- 材料实时发布价格 -->
     <hc-new-dialog v-model="isRealTimePrice" ui="hc-realTime-price" title="材料实时发布价格" is-table :footer="false" widths="70rem" @close="realTimePriceClose">
-        <hc-table :column="tableColumn3" :datas="tableData3" :index-style="{ width: 60 }" :loading="tableLoading3">
-            <template #action="{ row }">
-                <el-link type="primary">选择</el-link>
-                <el-link type="danger">取消选择</el-link>
-            </template>
-        </hc-table>
+        <div class="h-full">
+            <div class="search-year-month mb-14px">
+                <div class="w-48">
+                    <el-date-picker v-model="yearMonth" class="block" type="month" format="YYYY-MM" value-format="YYYY-MM" placeholder="调差月份" clearable @change="getMaterialCurrentPrice" />
+                </div>
+            </div>
+            <div class="realTime-price-table">
+                <hc-table :column="tableColumn3" :datas="tableData3" :index-style="{ width: 60 }" :loading="tableLoading3">
+                    <template #action="{ row }">
+                        <el-link type="primary">选择</el-link>
+                        <el-link type="danger">取消选择</el-link>
+                    </template>
+                </hc-table>
+            </div>
+        </div>
     </hc-new-dialog>
     <!-- 上传附件 -->
     <hc-new-dialog v-model="isAttachment" title="上传文件" is-footer-center widths="30rem" @close="attachmentClose">
@@ -262,23 +271,40 @@ const getMaterialName = async () => {
 }
 
 //材料实时发布价格表格
+const yearMonth = ref('')
 const tableColumn3 = [
-    { key: 'key1', name: '有效时间' },
-    { key: 'key2', name: '材料编号', width: 100, align: 'center' },
-    { key: 'key3', name: '材料名称' },
-    { key: 'key4', name: '材料单位', width: 100, align: 'center' },
-    { key: 'key5', name: '单价(元)', width: 100, align: 'center' },
+    { key: 'nodeName', name: '有效时间' },
+    { key: 'materialNumber', name: '材料编号', width: 100, align: 'center' },
+    { key: 'materialName', name: '材料名称' },
+    { key: 'unit', name: '材料单位', width: 100, align: 'center' },
+    { key: 'currentPrice', name: '单价(元)', width: 100, align: 'center' },
     { key: 'action', name: '操作', width: 100, align: 'center' },
 ]
-const tableData3 = ref([
-    {},
-])
+const tableData3 = ref([])
 const tableLoading3 = ref(false)
+const getMaterialCurrentPrice = async () => {
+    const { contractMaterialId } = formModel.value
+    //发起请求
+    tableLoading3.value = true
+    const { data } = await mainApi.getMaterialCurrentPrice({
+        yearMonth: yearMonth.value,
+        materialId: contractMaterialId,
+        contractId: contractId.value,
+    })
+    tableData3.value = getArrValue(data)
+    tableLoading3.value = false
+}
 
 //材料实时发布价格
 const isRealTimePrice = ref(false)
 const realTimePriceClick = () => {
+    const { contractMaterialId } = formModel.value
+    if (isNullES(contractMaterialId)) {
+        window.$message.warning('请先选择材料名称')
+        return
+    }
     isRealTimePrice.value = true
+    getMaterialCurrentPrice()
 }
 
 //关闭材料实时发布价格
@@ -454,5 +480,9 @@ const modalClose = () => {
 .el-overlay-dialog .el-dialog.hc-new-dialog.hc-modal-table.hc-realTime-price {
     --el-dialog-margin-top: 100px;
     height: calc(100% - 200px);
+    .realTime-price-table {
+        position: relative;
+        height: calc(100% - 46px);
+    }
 }
 </style>