Browse Source

合同材料

ZaiZai 10 months ago
parent
commit
449d40a99c

+ 37 - 21
src/views/debit-pay/material/components/material/dataModal.vue

@@ -16,7 +16,9 @@
                         <hc-info-table-td>
                             <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" />
+                                    <template v-for="item in adjustment" :key="item.id">
+                                        <el-option v-if="item.approveStatus === 2" :label="item.periodNumber" :value="item.id" />
+                                    </template>
                                 </el-select>
                             </el-form-item>
                         </hc-info-table-td>
@@ -126,8 +128,7 @@
         </div>
         <template #footer>
             <el-button hc-btn @click="modalClose">取消</el-button>
-            <el-button :loading="saveLoaing" hc-btn type="primary" @click="modalSave">提交</el-button>
-            <el-button v-if="!dataId" :loading="saveLoaing" hc-btn type="primary" @click="modalSaveClose">提交并关闭</el-button>
+            <el-button :loading="saveLoaing" hc-btn type="primary" @click="modalSave">保存</el-button>
         </template>
     </hc-new-dialog>
     <!-- 材料实时发布价格 -->
@@ -163,7 +164,7 @@ import { ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { isNumberReg } from '~uti/tools'
 import mainApi from '~api/debit-pay/material/material'
-import { arrToKey, formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
+import { formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
 
 const props = defineProps({
     ids: {
@@ -305,11 +306,11 @@ const realTimePriceClick = () => {
 //选择实时发布价格
 const isAdjusts = ref(1) //0不允许,1允许
 const rowRealTimePrice = async (row) => {
-    const { id, currentPrice, startDate } = row
+    const { id, currentPrice, startDate, materialValidityId } = row
     const { code, msg, data } = await mainApi.getMaterialRangePrice({
         priceId: id,
     })
-    const { isAdjust, rangePriceRatio, adjustCalculation, materialValidityId } = getObjValue(data)
+    const { isAdjust, rangePriceRatio, adjustCalculation } = getObjValue(data)
     if (code !== 200) {
         window.$message.error(msg ?? '操作失败')
         return
@@ -343,21 +344,36 @@ const tableColumn1 = [
 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 {
+        contractPeriodId, contractMaterialId, currentPrice,
+        materialValidityId, materialPrice, rangePriceRatio,
+    } = formModel.value
+    if (isNullES(contractPeriodId)) {
+        window.$message.warning('请先选择调差期')
+    } else if (isNullES(contractMaterialId)) {
+        window.$message.warning('请先选择材料名称')
+    } else if (isNullES(currentPrice) || isNullES(materialValidityId)) {
+        window.$message.warning('请先选择实时价格')
+    } else if (isNullES(materialPrice)) {
+        window.$message.warning('请先选择材料基准价格不为空的')
+    } else if (isNullES(rangePriceRatio)) {
+        window.$message.warning('请先选择价差幅度不为空的')
+    } else {
+        //获取数据
+        const { code, msg, data } = await mainApi.getMaterialDetail({
+            contractMaterialId: contractMaterialId,
+            contractPeriodId: contractPeriodId,
+            projectId: projectId.value,
+            contractId: contractId.value,
+            currentPrice: currentPrice,
+            materialPrice: materialPrice,
+            materialValidityId: materialValidityId,
+            rangePriceRatio: rangePriceRatio,
+        })
+        tableData1.value = getArrValue(data)
+        if (code !== 200 && msg) {
+            window.$message.error(msg)
+        }
     }
 }
 

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

@@ -3,7 +3,9 @@
         <template #header>
             <div class="w-32">
                 <el-select v-model="searchForm.contractPeriodId" placeholder="选择调差期" filterable clearable block>
-                    <el-option v-for="item in adjustment" :key="item.id" :label="item.periodNumber" :value="item.id" />
+                    <template v-for="item in adjustment" :key="item.id">
+                        <el-option v-if="item.approveStatus === 2" :label="item.periodNumber" :value="item.id" />
+                    </template>
                 </el-select>
             </div>
             <div class="ml-3 w-40">