|
@@ -89,7 +89,7 @@
|
|
|
<span>添加清单</span>
|
|
|
</el-button>
|
|
|
</template>
|
|
|
- <hc-table is-new :index-style="{ width: 60 }" :is-stripe="false" :column="addTableColumn" :datas="addTableData" :row-style="addTableRowStyle">
|
|
|
+ <hc-table :key="tableKey" is-new :index-style="{ width: 60 }" :is-stripe="false" :column="addTableColumn" :datas="addTableData" :row-style="addTableRowStyle">
|
|
|
<template #currentPrice="{ row }">
|
|
|
<hc-table-input v-model="row.currentPrice" disabled />
|
|
|
</template>
|
|
@@ -153,7 +153,7 @@ import { nextTick, ref, watch } from 'vue'
|
|
|
import { isNumberReg } from '~uti/tools'
|
|
|
import HcBillBaseModal from './addBillBaseModal.vue'
|
|
|
import qualityRleation from './qualityRleation.vue'
|
|
|
-import { arrDelKey, arrToId, arrToKey, deepClone, getArrValue, getObjValue, getRandom, isArrIndex, isNullES } from 'js-fast-way'
|
|
|
+import { arrDelKey, arrToId, arrToKey, deepClone, getArrValue, getObjValue, getRandom, getUUID, isArrIndex, isNullES } from 'js-fast-way'
|
|
|
import BigNumber from 'bignumber.js'
|
|
|
import { getHeader } from 'hc-vue3-ui'
|
|
|
|
|
@@ -273,9 +273,11 @@ const baseFormRules = {
|
|
|
},
|
|
|
}
|
|
|
const isRelationData = ref(false)//是否管理质检资料
|
|
|
+const tableKey = ref(getUUID())
|
|
|
//监听
|
|
|
watch(() => baseForm.value.fileList, (list) => {
|
|
|
console.log(list, 'list')
|
|
|
+ tableKey.value = getUUID()
|
|
|
// 验证数组中的对象是否包含名为 'selectId' 的字段
|
|
|
const fieldName = 'selectId'
|
|
|
|
|
@@ -289,9 +291,16 @@ if (containsField) {
|
|
|
} else {
|
|
|
isRelationData.value = false
|
|
|
addTableData.value.forEach((ele)=>{
|
|
|
- ele.upPayRatio = ele.oldupPayRatio
|
|
|
+ ele.upPayRatio = ele.oldupPayRatio || '0.00'
|
|
|
})
|
|
|
}
|
|
|
+nextTick(()=>{
|
|
|
+ console.log(isComparedRaVal.value, 'isComparedRaVal.value ')
|
|
|
+ if (isComparedRaVal.value === 1 ) {
|
|
|
+ window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
}, { deep: true })
|
|
|
//获取数据详情
|
|
|
const selectId = ref('')
|
|
@@ -448,7 +457,7 @@ const addTableColumn = ref([
|
|
|
{ key: 'payRatio', name: '支付比例(%)', width: '140' },
|
|
|
{ key: 'containChangeTotal', name: '含变更数量', width: '100' },
|
|
|
{ key: 'currentMeterMoney', name: '本期计量金额', width: '120' },
|
|
|
- { key: 'allMeterTotal', name: '累计计量量', width: '100' },
|
|
|
+ { key: 'allMeterTotal', name: '累计计数量', width: '100' },
|
|
|
{ key: 'otherMeterTotal', name: '基数', width: '80' },
|
|
|
{ key: 'action', name: '操作', fixed: 'right', width: 80, align: 'center' },
|
|
|
])
|
|
@@ -464,7 +473,6 @@ const currentMeterTotalBlur = (row) => {
|
|
|
}
|
|
|
//计算本期计量金额
|
|
|
nextTick(() => {
|
|
|
-
|
|
|
row.currentMeterTotal = currentMeterTotal
|
|
|
row.currentMeterMoney = (BigNumber(currentMeterTotal).multipliedBy(row.currentPrice)).toString()
|
|
|
row.allMeterTotal = (BigNumber(currentMeterTotal).plus(row.otherMeterTotal)).toString()
|
|
@@ -477,34 +485,7 @@ const currentMeterTotalBlur = (row) => {
|
|
|
//计算本期支付比例
|
|
|
//本期支 付比例=本期计量数量/变更后数量
|
|
|
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;'
|
|
|
-
|
|
|
-
|
|
|
- } else {
|
|
|
- isCanSave.value = false
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ compareRowUnpayRatio(row, 1)
|
|
|
|
|
|
})
|
|
|
}
|
|
@@ -520,12 +501,11 @@ const containChangeTotalBlur = (row) => {
|
|
|
row.containChangeTotal = val
|
|
|
})
|
|
|
}
|
|
|
-const unPayRatioBlur = (row)=>{
|
|
|
- nextTick(()=>{
|
|
|
- console.log(row, 'row')
|
|
|
-
|
|
|
- // 计算方式:
|
|
|
+const compareRowUnpayRatio = (row, type)=>{
|
|
|
+ // 计算方式:
|
|
|
//本期支 付比例=本期计量数量/变更后数量
|
|
|
+ //本期支付比例=本期计量数量/变更后数量
|
|
|
+ //本期计量数量=本期支付比例*变更后数量
|
|
|
// 会返回最大支付比例 upPayRatio
|
|
|
// 和其他期支付比例 otherPayRatio
|
|
|
|
|
@@ -533,28 +513,45 @@ const unPayRatioBlur = (row)=>{
|
|
|
// 就去对比:本期支付比例+其他期支付比例
|
|
|
// 是否大于最大支付比例
|
|
|
// 如果大于,则提示
|
|
|
- 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;'
|
|
|
-
|
|
|
+ if (isComparedRa === 1 ) {
|
|
|
+ isCanSave.value = true
|
|
|
+ if (type === 1) {
|
|
|
+ window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
|
|
|
+ } else if (type === 2) {
|
|
|
+ return isComparedRa
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
isCanSave.value = false
|
|
|
|
|
|
}
|
|
|
+}
|
|
|
+const unPayRatioBlur = (row)=>{
|
|
|
+ nextTick(()=>{
|
|
|
+ console.log(row, 'rowzhifubili')
|
|
|
+ let payRatio = new BigNumber(row.payRatio )//本期支付比例
|
|
|
+ let changeTotal = new BigNumber(row.changeTotal )//变更后数量
|
|
|
+ // 本期计量数量=本期支付比例*变更后数量
|
|
|
+ row.currentMeterTotal = (payRatio.dividedBy(100).multipliedBy(changeTotal)).toString()
|
|
|
+ row.currentMeterMoney = (BigNumber(row.currentMeterTotal).multipliedBy(row.currentPrice)).toString()//本期计量金额额
|
|
|
+ row.allMeterTotal = (BigNumber(row.currentMeterTotal).plus(row.otherMeterTotal)).toString()
|
|
|
+ // 就去对比:本期支付比例+其他期支付比例
|
|
|
+ // 是否大于最大支付比例
|
|
|
+ compareRowUnpayRatio(row, 1)
|
|
|
+
|
|
|
+ //计算总计量金额
|
|
|
+ let meterMoney = 0, table = addTableData.value
|
|
|
+ for (let i = 0; i < table.length; i++) {
|
|
|
+ meterMoney = (BigNumber(meterMoney).plus(table[i].currentMeterMoney)).toString()
|
|
|
+ }
|
|
|
+ baseForm.value.meterMoney = meterMoney
|
|
|
|
|
|
|
|
|
})
|
|
@@ -564,9 +561,11 @@ const unPayRatioBlur = (row)=>{
|
|
|
const isCanSave = ref(false)
|
|
|
|
|
|
const addTableRowStyle = ({ row }) => {
|
|
|
+ console.log(row, 'xuan')
|
|
|
//本期支付比例+其他期支付比例
|
|
|
// 是否大于最大支付比例
|
|
|
- if ( isComparedRaVal.value === 1 || isComparedRaVal.value === null) {
|
|
|
+ const isComparedRa = compareRowUnpayRatio(row, 2)
|
|
|
+ if (isComparedRa === 1 ) {
|
|
|
isCanSave.value = true
|
|
|
|
|
|
return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
@@ -748,6 +747,7 @@ const addModalClose = () => {
|
|
|
baseForm.value = { fileList: [], pictureUrl: '' }
|
|
|
addTableData.value = []
|
|
|
selectId.value = ''
|
|
|
+ isComparedRaVal.value = null
|
|
|
setStoreValue('checkRows', [])
|
|
|
emit('close')
|
|
|
}
|
|
@@ -770,10 +770,15 @@ const closeQual = ()=>{
|
|
|
qualityMoadal.value = false
|
|
|
}
|
|
|
const finishModal = (rows, cancelcheck)=>{
|
|
|
+ console.log(rows, 'rows')
|
|
|
let fileList = []
|
|
|
rows.forEach(ele => {
|
|
|
const isPush = isArrIndex( baseForm.value.fileList, 'selectId', ele.selectId)
|
|
|
if (!isPush) {
|
|
|
+ if (!ele.evisaPdfUrl && !ele.pdfUrl) {
|
|
|
+ window.$message.warning('该节点没有资料信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
fileList.push({
|
|
|
fileName:ele.dataName,
|
|
|
filePdfUrl:ele.evisaPdfUrl ? ele.evisaPdfUrl : ele.pdfUrl,
|