|
@@ -103,7 +103,7 @@
|
|
|
<hc-table-input v-model="row.containChangeTotal" :disabled="isView" @blur="containChangeTotalBlur(row)" />
|
|
|
</template>
|
|
|
<template #payRatio="{ row }">
|
|
|
- <hc-table-input v-model="row.payRatio" :disabled="isView" />
|
|
|
+ <hc-table-input v-model="row.payRatio" :disabled="isView" @blur="unPayRatioBlur(row)" />
|
|
|
</template>
|
|
|
<template #currentMeterMoney="{ row }">
|
|
|
<hc-table-input v-model="row.currentMeterMoney" disabled />
|
|
@@ -272,7 +272,27 @@ const baseFormRules = {
|
|
|
message: '请选择业务日期',
|
|
|
},
|
|
|
}
|
|
|
-
|
|
|
+const isRelationData = ref(false)//是否管理质检资料
|
|
|
+//监听
|
|
|
+watch(() => baseForm.value.fileList, (list) => {
|
|
|
+ console.log(list, 'list')
|
|
|
+ // 验证数组中的对象是否包含名为 'selectId' 的字段
|
|
|
+const fieldName = 'selectId'
|
|
|
+
|
|
|
+const containsField = list.some(obj => obj.hasOwnProperty(fieldName))
|
|
|
+
|
|
|
+if (containsField) {
|
|
|
+ isRelationData.value = true//关联质检资料后最大支付比例变为100
|
|
|
+ addTableData.value.forEach((ele)=>{
|
|
|
+ ele.upPayRatio = 100
|
|
|
+ })
|
|
|
+} else {
|
|
|
+ isRelationData.value = false
|
|
|
+ addTableData.value.forEach((ele)=>{
|
|
|
+ ele.upPayRatio = ele.oldupPayRatio
|
|
|
+ })
|
|
|
+}
|
|
|
+}, { deep: true })
|
|
|
//获取数据详情
|
|
|
const selectId = ref('')
|
|
|
const getDataDetail = async () => {
|
|
@@ -290,6 +310,9 @@ const getDataDetail = async () => {
|
|
|
baseForm.value = res
|
|
|
addTableData.value = getArrValue(res.formList)
|
|
|
selectId.value = arrToKey(res.fileList, 'selectId', ',')
|
|
|
+ addTableData.value.forEach((ele)=>{
|
|
|
+ ele.oldupPayRatio = ele.upPayRatio
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//数据格式
|
|
@@ -422,7 +445,7 @@ const addTableColumn = ref([
|
|
|
{ key: 'resolveTotal', name: '分解数量', width: '100' },
|
|
|
{ key: 'changeTotal', name: '变更后数量', width: '100' },
|
|
|
{ key: 'currentMeterTotal', name: '本期计量数量', width: '140' },
|
|
|
- { key: 'payRatio', name: '支付比例', width: '140' },
|
|
|
+ { key: 'payRatio', name: '支付比例(%)', width: '140' },
|
|
|
{ key: 'containChangeTotal', name: '含变更数量', width: '100' },
|
|
|
{ key: 'currentMeterMoney', name: '本期计量金额', width: '120' },
|
|
|
{ key: 'allMeterTotal', name: '累计计量量', width: '100' },
|
|
@@ -430,7 +453,7 @@ const addTableColumn = ref([
|
|
|
{ key: 'action', name: '操作', fixed: 'right', width: 80, align: 'center' },
|
|
|
])
|
|
|
const addTableData = ref([])
|
|
|
-
|
|
|
+const isComparedRaVal = ref(-1)
|
|
|
//计算本期计量金额
|
|
|
const currentMeterTotalBlur = (row) => {
|
|
|
//如果为空
|
|
@@ -441,6 +464,7 @@ const currentMeterTotalBlur = (row) => {
|
|
|
}
|
|
|
//计算本期计量金额
|
|
|
nextTick(() => {
|
|
|
+
|
|
|
row.currentMeterTotal = currentMeterTotal
|
|
|
row.currentMeterMoney = (BigNumber(currentMeterTotal).multipliedBy(row.currentPrice)).toString()
|
|
|
row.allMeterTotal = (BigNumber(currentMeterTotal).plus(row.otherMeterTotal)).toString()
|
|
@@ -450,31 +474,38 @@ const currentMeterTotalBlur = (row) => {
|
|
|
meterMoney = (BigNumber(meterMoney).plus(table[i].currentMeterMoney)).toString()
|
|
|
}
|
|
|
baseForm.value.meterMoney = meterMoney
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 累计计量金额 > 最高支付金额 变红
|
|
|
- // 当前行多返回一个字段otherPayMoney 代表其他期计量金额
|
|
|
- // 累计计量金额 = 其他期计量金额+(本期计量金额*支付比例)
|
|
|
- // 当前行多返回一个字段upPayMoney 代表最高支付金额
|
|
|
- // let otherPayMoney = new BigNumber(row.otherPayMoney )//其他期计量金额
|
|
|
- // let currentMeterMoney = new BigNumber(row.currentMeterMoney )//本期计量金额
|
|
|
- // let upPayRatio = new BigNumber(row.upPayRatio ).dividedBy(100)//支付比例
|
|
|
- // let upPayRatioMoney = (otherPayMoney.plus((currentMeterMoney.multipliedBy(upPayRatio)).toNumber()))//累计计量金额
|
|
|
- // let upPayMoney = new BigNumber(row.upPayMoney)//最高支付金额
|
|
|
- // const isComparedmoney = upPayRatioMoney.comparedTo(upPayMoney)
|
|
|
- // //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
|
|
|
- // if (isComparedmoney === 1 || isComparedmoney === null) {
|
|
|
- // isCanSave.value = true
|
|
|
+ //计算本期支付比例
|
|
|
+ //本期支 付比例=本期计量数量/变更后数量
|
|
|
+ row.payRatio = BigNumber(currentMeterTotal).dividedBy(row.changeTotal).toString() * 100
|
|
|
+
|
|
|
+ // 每次填写完 本期计量数量或者支付比例后
|
|
|
+ // 就去对比:本期支付比例+其他期支付比例
|
|
|
+ // 是否大于最大支付比例
|
|
|
+ // 如果大于,则提示
|
|
|
+
|
|
|
+ let payRatio = new BigNumber(row.payRatio )//本期支付比例
|
|
|
+ let upPayRatio = new BigNumber(row.upPayRatio )//最大支付比例
|
|
|
+ let otherPayRatio = new BigNumber(row.otherPayRatio )//其他期支付比例
|
|
|
+ let result = BigNumber(payRatio).plus(otherPayRatio)//本期支付比例+其他期支付比例
|
|
|
+ const isComparedRa = result.comparedTo(upPayRatio)
|
|
|
+ console.log(isComparedRa, 'isCompared3333333')
|
|
|
+ isComparedRaVal.value = isComparedRa
|
|
|
+ // //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
|
|
|
+ if (isComparedRa === 1 || isComparedRa === null) {
|
|
|
+ isCanSave.value = true
|
|
|
|
|
|
- // window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
|
|
|
- // return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
|
+ window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
|
|
|
+ // return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
|
|
|
|
|
|
|
- // } else {
|
|
|
- // isCanSave.value = false
|
|
|
+ } else {
|
|
|
+ isCanSave.value = false
|
|
|
|
|
|
- // }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -491,29 +522,41 @@ const containChangeTotalBlur = (row) => {
|
|
|
}
|
|
|
const unPayRatioBlur = (row)=>{
|
|
|
nextTick(()=>{
|
|
|
-
|
|
|
- // 累计计量金额 > 最高支付金额 变红
|
|
|
- // 当前行多返回一个字段otherPayMoney 代表其他期计量金额
|
|
|
- // 累计计量金额 = 其他期计量金额+(本期计量金额*支付比例)
|
|
|
- // 当前行多返回一个字段upPayMoney 代表最高支付金额
|
|
|
- let otherPayMoney = new BigNumber(row.otherPayMoney )//其他期计量金额
|
|
|
- let currentMeterMoney = new BigNumber(row.currentMeterMoney )//本期计量金额
|
|
|
- let upPayRatio = new BigNumber(row.upPayRatio ).dividedBy(100)//支付比例
|
|
|
- let upPayRatioMoney = (otherPayMoney.plus((currentMeterMoney.multipliedBy(upPayRatio)).toNumber()))//累计计量金额
|
|
|
- let upPayMoney = new BigNumber(row.upPayMoney)//最高支付金额
|
|
|
- const isComparedmoney = upPayRatioMoney.comparedTo(upPayMoney)
|
|
|
- //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
|
|
|
- if (isComparedmoney === 1 || isComparedmoney === null) {
|
|
|
+ console.log(row, 'row')
|
|
|
+
|
|
|
+ // 计算方式:
|
|
|
+ //本期支 付比例=本期计量数量/变更后数量
|
|
|
+ // 会返回最大支付比例 upPayRatio
|
|
|
+ // 和其他期支付比例 otherPayRatio
|
|
|
+
|
|
|
+ // 每次填写完 本期计量数量或者支付比例后
|
|
|
+ // 就去对比:本期支付比例+其他期支付比例
|
|
|
+ // 是否大于最大支付比例
|
|
|
+ // 如果大于,则提示
|
|
|
+ let changeTotal = new BigNumber(row.changeTotal )//变更后数量
|
|
|
+ let payRatio = new BigNumber(row.payRatio )//本期支付比例
|
|
|
+ let upPayRatio = new BigNumber(row.upPayRatio )//最大支付比例
|
|
|
+ let otherPayRatio = new BigNumber(row.otherPayRatio )//其他期支付比例
|
|
|
+ let result = BigNumber(payRatio).plus(otherPayRatio)//本期支付比例+其他期支付比例
|
|
|
+ // 本期计量数量=本期支付比例*变更后数量
|
|
|
+ row.currentMeterTotal = (payRatio.dividedBy(100).multipliedBy(changeTotal)).toString()
|
|
|
+ const isComparedRa = result.comparedTo(upPayRatio)
|
|
|
+ isComparedRaVal.value = isComparedRa
|
|
|
+ console.log(isComparedRa, 'isComparedRa')
|
|
|
+ // //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
|
|
|
+ if (isComparedRa === 1 || isComparedRa === null) {
|
|
|
isCanSave.value = true
|
|
|
|
|
|
window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
|
|
|
- return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
|
+ // return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
|
|
|
|
|
|
|
} else {
|
|
|
isCanSave.value = false
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
|
|
|
}
|
|
@@ -521,7 +564,18 @@ const unPayRatioBlur = (row)=>{
|
|
|
const isCanSave = ref(false)
|
|
|
|
|
|
const addTableRowStyle = ({ row }) => {
|
|
|
-
|
|
|
+ //本期支付比例+其他期支付比例
|
|
|
+ // 是否大于最大支付比例
|
|
|
+ if ( isComparedRaVal.value === 1 || isComparedRaVal.value === null) {
|
|
|
+ isCanSave.value = true
|
|
|
+
|
|
|
+ return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ isCanSave.value = false
|
|
|
+
|
|
|
+ }
|
|
|
// 判断施工图数量是否大于合同数据
|
|
|
// 大于:如果超计= 1并且 划分=1
|
|
|
// 不显示红色,否则显示
|