fix: 项目电价合同 阶梯计价 渲染问题
This commit is contained in:
parent
6c9a1f83c2
commit
64f8a09543
|
@ -164,11 +164,11 @@
|
|||
|
||||
<el-form-item label="合同规则:" prop>
|
||||
<el-button size="mini" type="primary" @click="handelAddRule">添加规则</el-button>
|
||||
<div class="contract-gz-wrap" v-for="(item, index) in form.priceContractRuleList" :key="item.guid">
|
||||
<div class="contract-gz-wrap" v-for="(item, index) in form.priceContractRuleList" :key="item.ruleId">
|
||||
<time-picker-wrap
|
||||
:priceList="item"
|
||||
:contractType="form.contractType"
|
||||
:tempIndex="item.guid"
|
||||
:tempIndex="item.ruleId"
|
||||
:delshow="form.priceContractRuleList.length >= 2"
|
||||
:nodeMaxTime="returnMinTime(index)"
|
||||
:nodeMaxVal="returnMaxVal(index)"
|
||||
|
@ -297,8 +297,9 @@ export default {
|
|||
return row.status === "0" ? "启用" : "禁用";
|
||||
},
|
||||
resultEvent(data) {
|
||||
console.log('resultEvent--', JSON.stringify(data))
|
||||
for (var i = 0; i < this.form.priceContractRuleList.length; i++) {
|
||||
if (this.form.priceContractRuleList[i]["guid"] === data.index) {
|
||||
if (this.form.priceContractRuleList[i]["ruleId"] === data.index) {
|
||||
this.form.priceContractRuleList[i] = data.result;
|
||||
this.$forceUpdate();
|
||||
}
|
||||
|
@ -320,7 +321,7 @@ export default {
|
|||
},
|
||||
delEvent(data) {
|
||||
for (var i = 0; i < this.form.priceContractRuleList.length; i++) {
|
||||
if (this.form.priceContractRuleList[i]["guid"] === data.index) {
|
||||
if (this.form.priceContractRuleList[i]["ruleId"] === data.index) {
|
||||
this.form.priceContractRuleList.splice(i, 1);
|
||||
this.$forceUpdate();
|
||||
break;
|
||||
|
@ -336,7 +337,7 @@ export default {
|
|||
ruleName: "",
|
||||
ruleNum: null,
|
||||
unitPrice: "",
|
||||
guid: this.getGuid()
|
||||
ruleId: this.getGuid()
|
||||
});
|
||||
},
|
||||
contractTypeChange(val) {
|
||||
|
@ -349,7 +350,7 @@ export default {
|
|||
ruleName: "",
|
||||
ruleNum: null,
|
||||
unitPrice: "",
|
||||
guid: this.getGuid()
|
||||
ruleId: this.getGuid()
|
||||
});
|
||||
},
|
||||
indexFormatter(val) {
|
||||
|
@ -415,7 +416,7 @@ export default {
|
|||
ruleName: "",
|
||||
ruleNum: null,
|
||||
unitPrice: "",
|
||||
guid: this.getGuid()
|
||||
ruleId: this.getGuid()
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
|
@ -424,14 +425,10 @@ export default {
|
|||
const contractId = row.contractId || this.ids;
|
||||
getContract(contractId).then(response => {
|
||||
this.form = response.data;
|
||||
var arr = [];
|
||||
response.data.priceContractRuleList.forEach(v => {
|
||||
arr.push(Object.assign(v, { guid: this.getGuid() }));
|
||||
});
|
||||
this.form.priceContractRuleList = arr || [];
|
||||
this.open = true;
|
||||
this.tempType = 'update'
|
||||
this.title = "修改电价合同";
|
||||
this.$forceUpdate();
|
||||
});
|
||||
},
|
||||
handleDestail(row) {
|
||||
|
@ -439,11 +436,6 @@ export default {
|
|||
const contractId = row.contractId || this.ids;
|
||||
getContract(contractId).then(response => {
|
||||
this.form = response.data;
|
||||
var arr = [];
|
||||
response.data.priceContractRuleList.forEach(v => {
|
||||
arr.push(Object.assign(v, { guid: this.getGuid() }));
|
||||
});
|
||||
this.form.priceContractRuleList = arr || [];
|
||||
this.tempType = 'destail'
|
||||
this.open = true;
|
||||
this.title = "电价合同详情";
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
v-model="form.maxVal"
|
||||
:precision="2"
|
||||
class="form-input"
|
||||
:min="form.minVal"
|
||||
label="最大值"
|
||||
></el-input-number>
|
||||
</el-col>
|
||||
|
@ -88,7 +87,7 @@ export default {
|
|||
created() {
|
||||
this.form = this.priceList;
|
||||
if (this.contractType === "LADDER") {
|
||||
this.valSet(this.nodeMaxVal);
|
||||
this.handleUpdateValue(this.nodeMaxVal);
|
||||
} else {
|
||||
this.timtSet(this.nodeMaxTime);
|
||||
}
|
||||
|
@ -96,13 +95,13 @@ export default {
|
|||
watch: {
|
||||
form: {
|
||||
handler(val, oldVal) {
|
||||
this.reultEventFu();
|
||||
if (
|
||||
this.contractType === "LADDER" &&
|
||||
this.form.minVal >= this.form.maxVal
|
||||
) {
|
||||
this.form.maxVal = this.form.minVal;
|
||||
}
|
||||
this.reultEventFu();
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
|
@ -113,13 +112,13 @@ export default {
|
|||
},
|
||||
nodeMaxVal(val) {
|
||||
if (val || val === 0) {
|
||||
this.valSet(val);
|
||||
this.handleUpdateValue(val);
|
||||
}
|
||||
},
|
||||
contractType(val) {
|
||||
this.form = this.priceList;
|
||||
if (val === "LADDER") {
|
||||
this.valSet(this.nodeMaxVal);
|
||||
this.handleUpdateValue(this.nodeMaxVal);
|
||||
} else {
|
||||
this.timtSet(this.nodeMaxTime);
|
||||
}
|
||||
|
@ -140,11 +139,13 @@ export default {
|
|||
this.times = [this.form.minTime, this.form.maxTime];
|
||||
this.$forceUpdate();
|
||||
},
|
||||
valSet(val) {
|
||||
handleUpdateValue(val) {
|
||||
this.form.minVal = this.priceList.minVal || 0;
|
||||
if (val === "" || val === 0) {
|
||||
this.form.minVal = 0;
|
||||
this.form.maxVal = this.form.minVal + 1;
|
||||
this.form.maxVal = this.priceList.maxVal
|
||||
if ((val === "" || val === 0)) {
|
||||
this.form.minVal = this.priceList.minVal || 0;
|
||||
this.form.maxVal = this.priceList.maxVal || this.form.minVal + 1;
|
||||
|
||||
} else {
|
||||
this.form.minVal = val;
|
||||
if (this.form.minVal >= this.form.maxVal) {
|
||||
|
|
Loading…
Reference in New Issue