代码调整

This commit is contained in:
dong 2022-09-09 14:35:46 +08:00
parent 8bf8b0b742
commit 83736869c3

View File

@ -17,15 +17,12 @@
>
<el-table-column label="条件关系">
<template slot-scope="scope">
<div v-if="!scope.row.valuables[0]" class="nullDiv" @click.stop="editValue(scope.row, '0')"></div>
<div v-else>
<ExpressionValue ref="ExpressionValue" :materials-list="materialsList" :get-device-list="getDeviceList" :value-obj="scope.row" :index-path="scope.$index + ''" :active-index-path="activeIndexPath" @editValue="editValue" />
</div>
<ExpressionValue ref="ExpressionValue" :materials-list="materialsList" :get-device-list="getDeviceList" :value-obj="scope.row" :index-path="scope.$index + ''" :active-index-path="activeIndexPath" @editValue="editValue" />
</template>
</el-table-column>
</el-table>
<div class="conditionBtn">
<!-- <el-button size="small" @click="addExp">新增条件关系</el-button> -->
<!-- <el-button size="small" @click="addExp()">新增条件关系</el-button> -->
<el-button size="small" :disabled="deleteDisabled" @click="deleteExp">删除条件关系</el-button>
<el-button size="small" :disabled="clearDisabled" @click="clearExp">清空条件关系</el-button>
</div>
@ -152,14 +149,14 @@ export default {
},
deleteDisabled() {
let s = false;
if (!this.tableData[0] || !this.tableData[0].valuables || !this.tableData[0].valuables[0] || !this.activeIndexPath) {
if (!this.tableData[0] || !this.tableData[0].valuables || !this.activeIndexPath) {
s = true;
}
return s;
},
clearDisabled() {
let s = false;
if (!this.tableData[0] || !this.tableData[0].valuables || !this.tableData[0].valuables[0]) {
if (!this.tableData[0] || !this.tableData[0].valuables) {
s = true;
}
return s;
@ -172,11 +169,14 @@ export default {
if (obj) {
addData = obj;
}
const data = {
let data = {
t: 'E',
operator: 'AND',
valuables: [this.tableData[0], addData]
};
if (this.clearDisabled) {
data = addData;
}
this.tableData.splice(0, 1, data);
},
deleteExp() {
@ -201,12 +201,7 @@ export default {
}
},
clearExp() {
const data = {
t: 'E',
operator: 'EQ',
valuables: []
};
this.tableData.splice(0, 1, data);
this.tableData = [];
},
editValue(data, indexPath) {
this.activeIndexPath = indexPath;
@ -282,13 +277,7 @@ export default {
if (data) {
this.tableData = [data];
} else {
this.tableData = [
{
t: 'E',
operator: 'EQ',
valuables: []
}
];
this.tableData = [];
}
this.rowIndex = rowIndex;
this.conditionKey = conditionKey;
@ -330,13 +319,13 @@ export default {
// cursor: pointer;
// top:-28px;
// }
.nullDiv {
width: 100%;
height: 28px;
line-height: 28px;
cursor: pointer;
color: #ccc;
}
// .nullDiv {
// width: 100%;
// height: 28px;
// line-height: 28px;
// cursor: pointer;
// color: #ccc;
// }
.conditionBtn {
height: 50px;
line-height: 50px;