|
@@ -28,9 +28,9 @@
|
|
|
<el-option
|
|
|
v-for="item in conditionList"
|
|
|
:key="item.id + item.name"
|
|
|
- :label="item.name"
|
|
|
- :value="item.name"
|
|
|
- :title="item.name"
|
|
|
+ :label="item.name + '('+item.conditionLabel + ')'"
|
|
|
+ :value="item.id"
|
|
|
+ :title="item.name + '('+item.conditionLabel + ')'"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -66,9 +66,9 @@
|
|
|
<el-option
|
|
|
v-for="item in conditionList"
|
|
|
:key="item.id + item.name"
|
|
|
- :label="item.name"
|
|
|
- :value="item.name"
|
|
|
- :title="item.name"
|
|
|
+ :label="item.name + '('+item.conditionLabel + ')'"
|
|
|
+ :value="item.id"
|
|
|
+ :title="item.name + '('+item.conditionLabel + ')'"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -90,12 +90,13 @@
|
|
|
ref="compare"
|
|
|
clearable
|
|
|
@clear="handleClear(index)"
|
|
|
+ @change="handleChangeCom(index)"
|
|
|
>
|
|
|
<!-- <el-option
|
|
|
label="大于"
|
|
|
value=">"
|
|
|
:disabled="index=== 0 ? isCompare1==='>' : isCompare2==='>'"
|
|
|
- ></el-option> -->
|
|
|
+ ></el-option>-->
|
|
|
<el-option
|
|
|
label="大于等于"
|
|
|
value=">="
|
|
@@ -105,7 +106,7 @@
|
|
|
label="小于"
|
|
|
value="<"
|
|
|
:disabled="index=== 0 ? isCompare1==='<' : isCompare2==='<'"
|
|
|
- ></el-option> -->
|
|
|
+ ></el-option>-->
|
|
|
<el-option
|
|
|
label="小于等于"
|
|
|
value="<="
|
|
@@ -274,7 +275,7 @@ export default {
|
|
|
if (ruleForm.length != 2) return false;
|
|
|
if (ruleForm[1].compare == '') {
|
|
|
return false;
|
|
|
- } else if ( ruleForm[1].compare == '>=') {
|
|
|
+ } else if (ruleForm[1].compare == '>=') {
|
|
|
return '>=';
|
|
|
} else if (ruleForm[1].compare == '<=') {
|
|
|
return '<=';
|
|
@@ -285,9 +286,9 @@ export default {
|
|
|
if (ruleForm.length != 2) return false;
|
|
|
if (ruleForm[0].compare == '') {
|
|
|
return false;
|
|
|
- } else if ( ruleForm[0].compare == '>=') {
|
|
|
+ } else if (ruleForm[0].compare == '>=') {
|
|
|
return '>=';
|
|
|
- } else if ( ruleForm[0].compare == '<=') {
|
|
|
+ } else if (ruleForm[0].compare == '<=') {
|
|
|
return '<=';
|
|
|
}
|
|
|
}
|
|
@@ -300,6 +301,10 @@ export default {
|
|
|
_initData() {
|
|
|
this.form = { ...this.data };
|
|
|
const { maxValue, minValue, unit } = this.form;
|
|
|
+ // console.log(this.form, 'this.form');
|
|
|
+ this.form.name = this.form.conditionLabel
|
|
|
+ ? `${this.form.name}(${this.form.conditionLabel})`
|
|
|
+ : '';
|
|
|
// console.log(maxValue, 'maxValue', minValue, 'minValue');
|
|
|
if (minValue === null && maxValue === null) {
|
|
|
this.ruleForm.ruleForm = [
|
|
@@ -350,10 +355,34 @@ export default {
|
|
|
},
|
|
|
changeWord(val) {
|
|
|
if (val === '') return;
|
|
|
- let condition = this.conditionList.find(item => item.name == val);
|
|
|
+ let condition = this.conditionList.find(item => item.id == val);
|
|
|
+ // console.log(condition, 'condition');
|
|
|
+ this.form.name = condition.conditionLabel
|
|
|
+ ? `${condition.name}(${condition.conditionLabel})`
|
|
|
+ : '';
|
|
|
this.$emit('split', condition);
|
|
|
},
|
|
|
handleClear(index) {
|
|
|
+ // this.ruleForm.ruleForm[index].value = '';
|
|
|
+ },
|
|
|
+ handleChangeCom(index) {
|
|
|
+ let compare = this.ruleForm.ruleForm[index].compare;
|
|
|
+ if (index === 0 && this.ruleForm.ruleForm.length == 1) {
|
|
|
+ if (compare == '>=') {
|
|
|
+ this.form.maxValue = '';
|
|
|
+ this.$emit('handleInput', {
|
|
|
+ type: 'maxValue',
|
|
|
+ value: this.form.maxValue
|
|
|
+ });
|
|
|
+ } else if (compare == '<=') {
|
|
|
+ this.form.minValue = '';
|
|
|
+ this.$emit('handleInput', {
|
|
|
+ type: 'minValue',
|
|
|
+ value: this.form.minValue
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log(compare);
|
|
|
this.ruleForm.ruleForm[index].value = '';
|
|
|
},
|
|
|
handleUnitClear(index) {
|