代码调整

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