|
|
@@ -968,13 +968,46 @@ export default {
|
|
|
{ pattern: /^\d+(\.\d+)?$/, message: this.$t('请输入有效的数值'), trigger: 'blur' }
|
|
|
],
|
|
|
z1: [
|
|
|
- { pattern: /^-?\d+(\.\d+)?$/, message: this.$t('请输入有效的数值'), trigger: 'blur' }
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (this.basicInfo.purpose === '水库引水' && (!value || value === '')) {
|
|
|
+ callback(new Error(this.$t('起点高程为必填项')))
|
|
|
+ } else if (value && !/^-?\d+(\.\d+)?$/.test(value)) {
|
|
|
+ callback(new Error(this.$t('请输入有效的数值')))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
zv: [
|
|
|
- { pattern: /^-?\d+(\.\d+)?$/, message: this.$t('请输入有效的数值'), trigger: 'blur' }
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (this.basicInfo.purpose === '水库引水' && (!value || value === '')) {
|
|
|
+ callback(new Error(this.$t('阀中心高程为必填项')))
|
|
|
+ } else if (value && !/^-?\d+(\.\d+)?$/.test(value)) {
|
|
|
+ callback(new Error(this.$t('请输入有效的数值')))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
z2: [
|
|
|
- { pattern: /^-?\d+(\.\d+)?$/, message: this.$t('请输入有效的数值'), trigger: 'blur' }
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (this.basicInfo.purpose === '水库引水' && (!value || value === '')) {
|
|
|
+ callback(new Error(this.$t('末点高程为必填项')))
|
|
|
+ } else if (value && !/^-?\d+(\.\d+)?$/.test(value)) {
|
|
|
+ callback(new Error(this.$t('请输入有效的数值')))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
|
|
|
@@ -1157,6 +1190,15 @@ export default {
|
|
|
this.calculatePa(newVal)
|
|
|
},
|
|
|
immediate: true
|
|
|
+ },
|
|
|
+ 'basicInfo.purpose': {
|
|
|
+ handler() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.$refs.basicForm) {
|
|
|
+ this.$refs.basicForm.clearValidate(['z1', 'z2', 'zv'])
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -1415,14 +1457,16 @@ export default {
|
|
|
p2: parseFloat(this.workingCondition.maxCondition.afterPressure),
|
|
|
p2_unit: this.workingCondition.in_p
|
|
|
}, //最大流量
|
|
|
- "normal": {
|
|
|
- q: parseFloat(this.workingCondition.normalCondition.flow),
|
|
|
- q_unit: this.workingCondition.in_q,
|
|
|
- p1: parseFloat(this.workingCondition.normalCondition.beforePressure),
|
|
|
- p1_unit: this.workingCondition.in_p,
|
|
|
- p2: parseFloat(this.workingCondition.normalCondition.afterPressure),
|
|
|
- p2_unit: this.workingCondition.in_p
|
|
|
- },
|
|
|
+ ...(this.workingCondition.normalCondition.flow ? {
|
|
|
+ "normal": {
|
|
|
+ q: parseFloat(this.workingCondition.normalCondition.flow),
|
|
|
+ q_unit: this.workingCondition.in_q,
|
|
|
+ p1: parseFloat(this.workingCondition.normalCondition.beforePressure),
|
|
|
+ p1_unit: this.workingCondition.in_p,
|
|
|
+ p2: parseFloat(this.workingCondition.normalCondition.afterPressure),
|
|
|
+ p2_unit: this.workingCondition.in_p
|
|
|
+ }
|
|
|
+ } : {}),
|
|
|
"maxli": {
|
|
|
"q_unit": this.workingCondition.in_q,
|
|
|
"p1_unit": this.workingCondition.in_p,
|
|
|
@@ -1453,14 +1497,16 @@ export default {
|
|
|
p2: parseFloat(this.workingCondition.minCondition.afterPressure),
|
|
|
p2_unit: this.workingCondition.in_p
|
|
|
}, //最小流量
|
|
|
- "normal": {
|
|
|
- q: parseFloat(this.workingCondition.normalCondition.flow),
|
|
|
- q_unit: this.workingCondition.in_q,
|
|
|
- p1: parseFloat(this.workingCondition.normalCondition.beforePressure),
|
|
|
- p1_unit: this.workingCondition.in_p,
|
|
|
- p2: parseFloat(this.workingCondition.normalCondition.afterPressure),
|
|
|
- p2_unit: this.workingCondition.in_p
|
|
|
- },
|
|
|
+ ...(this.workingCondition.normalCondition.flow ? {
|
|
|
+ "normal": {
|
|
|
+ q: parseFloat(this.workingCondition.normalCondition.flow),
|
|
|
+ q_unit: this.workingCondition.in_q,
|
|
|
+ p1: parseFloat(this.workingCondition.normalCondition.beforePressure),
|
|
|
+ p1_unit: this.workingCondition.in_p,
|
|
|
+ p2: parseFloat(this.workingCondition.normalCondition.afterPressure),
|
|
|
+ p2_unit: this.workingCondition.in_p
|
|
|
+ }
|
|
|
+ } : {}),
|
|
|
"max": {
|
|
|
q: parseFloat(this.workingCondition.maxCondition.flow),
|
|
|
q_unit: this.workingCondition.in_q,
|
|
|
@@ -1493,11 +1539,13 @@ export default {
|
|
|
p1: parseFloat(this.workingCondition2.minCondition.beforePressure),
|
|
|
p2: parseFloat(this.workingCondition2.minCondition.afterPressure),
|
|
|
}, //最小流量
|
|
|
- "normal": {
|
|
|
- q: parseFloat(this.workingCondition2.normalCondition.flow),
|
|
|
- p1: parseFloat(this.workingCondition2.normalCondition.beforePressure),
|
|
|
- p2: parseFloat(this.workingCondition2.normalCondition.afterPressure),
|
|
|
- },
|
|
|
+ ...(this.workingCondition2.normalCondition.flow ? {
|
|
|
+ "normal": {
|
|
|
+ q: parseFloat(this.workingCondition2.normalCondition.flow),
|
|
|
+ p1: parseFloat(this.workingCondition2.normalCondition.beforePressure),
|
|
|
+ p2: parseFloat(this.workingCondition2.normalCondition.afterPressure),
|
|
|
+ }
|
|
|
+ } : {}),
|
|
|
"max": {
|
|
|
q: parseFloat(this.workingCondition2.maxCondition.flow),
|
|
|
p1: parseFloat(this.workingCondition2.maxCondition.beforePressure),
|
|
|
@@ -1536,9 +1584,9 @@ export default {
|
|
|
"purpose": this.basicInfo.purpose, //用途(必填,自定义选项:通用、水库引水,默认通用)
|
|
|
"mediatype": this.basicInfo.mediatype, //介质类型(必填,自定义选项,默认为水)
|
|
|
"p": parseFloat(this.basicInfo.p), //液体密度ρ(根据介质类型自动带出)
|
|
|
- "z1": parseFloat(this.basicInfo.z1), //起点高程(Z1)
|
|
|
- "zv": parseFloat(this.basicInfo.zv), //阀中心高程(Zv)
|
|
|
- "z2": parseFloat(this.basicInfo.z2), //末点高程(Z2),
|
|
|
+ "z1": this.basicInfo.z1 ? parseFloat(this.basicInfo.z1) : 0, //起点高程(Z1)
|
|
|
+ "zv": this.basicInfo.zv ? parseFloat(this.basicInfo.zv) : 0, //阀中心高程(Zv)
|
|
|
+ "z2": this.basicInfo.z2 ? parseFloat(this.basicInfo.z2) : 0, //末点高程(Z2),
|
|
|
in_p: this.workingCondition.in_p, //入口压力(kPa)
|
|
|
in_q:this.workingCondition.in_q,
|
|
|
out_p: this.valveSelection.out_p, //出口压力(kPa)
|
|
|
@@ -1576,11 +1624,15 @@ export default {
|
|
|
workingCondition: this.$t('通用'),
|
|
|
conditionName: this.$t('最小流量')
|
|
|
}
|
|
|
- const normalData = {
|
|
|
- ...res.data.condition1.normal,
|
|
|
- li: (res.data.condition1.normal.li * 100).toFixed(2),
|
|
|
- workingCondition: this.$t('通用'),
|
|
|
- conditionName: this.$t('正常流量')
|
|
|
+ const tableData = [minData]
|
|
|
+ if (res.data.condition1.normal) {
|
|
|
+ const normalData = {
|
|
|
+ ...res.data.condition1.normal,
|
|
|
+ li: (res.data.condition1.normal.li * 100).toFixed(2),
|
|
|
+ workingCondition: this.$t('通用'),
|
|
|
+ conditionName: this.$t('正常流量')
|
|
|
+ }
|
|
|
+ tableData.push(normalData)
|
|
|
}
|
|
|
const maxData = {
|
|
|
...res.data.condition1.max,
|
|
|
@@ -1588,7 +1640,8 @@ export default {
|
|
|
workingCondition: this.$t('通用'),
|
|
|
conditionName: this.$t('最大流量')
|
|
|
}
|
|
|
- this.tableData = [minData,normalData, maxData]
|
|
|
+ tableData.push(maxData)
|
|
|
+ this.tableData = tableData
|
|
|
this.resultMessages = {
|
|
|
conditiontype1:res.data.condition1.conditiontype,
|
|
|
conditiontype2:res.data.condition2?.conditiontype || '',
|
|
|
@@ -1610,11 +1663,15 @@ export default {
|
|
|
workingCondition: this.$t('水库低液位'),
|
|
|
conditionName: this.$t('最小流量')
|
|
|
}
|
|
|
- const normalData = {
|
|
|
- ...res.data.condition2.normal,
|
|
|
- li: (res.data.condition2.normal.li * 100).toFixed(2),
|
|
|
- workingCondition: this.$t('水库低液位'),
|
|
|
- conditionName: this.$t('正常流量')
|
|
|
+ const tableData2 = [minData]
|
|
|
+ if (res.data.condition2.normal) {
|
|
|
+ const normalData = {
|
|
|
+ ...res.data.condition2.normal,
|
|
|
+ li: (res.data.condition2.normal.li * 100).toFixed(2),
|
|
|
+ workingCondition: this.$t('水库低液位'),
|
|
|
+ conditionName: this.$t('正常流量')
|
|
|
+ }
|
|
|
+ tableData2.push(normalData)
|
|
|
}
|
|
|
const maxData = {
|
|
|
...res.data.condition2.max,
|
|
|
@@ -1622,7 +1679,8 @@ export default {
|
|
|
workingCondition: this.$t('水库低液位'),
|
|
|
conditionName: this.$t('最大流量')
|
|
|
}
|
|
|
- this.tableData2 = [minData,normalData, maxData]
|
|
|
+ tableData2.push(maxData)
|
|
|
+ this.tableData2 = tableData2
|
|
|
},
|
|
|
// 重置Step3数据
|
|
|
resetAllData() {
|