已导入标识

master
yujialong 3 years ago
parent 88a1a1369d
commit 722a122ecb
  1. 54
      src/views/Program.vue
  2. 54
      src/views/Transaction.vue

@ -57,18 +57,25 @@
<div>判分规则</div>
</div>
<div>
<el-button v-if="!isView" type="primary" size="mini" @click="batchDel">批量删除</el-button>
<el-button v-if="!isView" :disabled="isAddRule" type="primary" size="mini" @click="addRule">新增</el-button>
</div>
</div>
<el-card shadow="hover">
<el-table
class="lc-table"
:data="tableData"
:stripe="true"
:cell-style="rowClass"
header-align="center"
:header-cell-style="headClass"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column prop="id" type="index" label="序号" width="80">
<template slot-scope="scope">
{{ scope.row.isSubject && scope.row.index + 1 }}
@ -139,6 +146,7 @@ export default {
isAdd: Boolean(this.$route.query.isAdd), //
isEdit: Boolean(this.$route.query.isEdit), //
isView: Boolean(this.$route.query.isView), //
multipleSelection: [],
isNameRepeat: false, //
formData: {
points: {
@ -203,6 +211,9 @@ export default {
console.log(err)
});
},
handleSelectionChange(val){
this.multipleSelection = val
},
//
setIndex() {
let i = 0
@ -283,12 +294,13 @@ export default {
this.$message.warning(`请添加判分规则`);
return;
} else {
for (let i = 0; i < this.tableData.length; i++) {
if ((this.tableData[i].isSubject && !this.tableData[i].required) && (this.tableData[i].isSubject && !this.tableData[i].result)) {
this.$message.warning(`${i + 1}项,规则与结果至少填写一个`);
const list = this.tableData
for (let i = 0; i < list.length; i++) {
if ((list[i].isSubject && !list[i].required) && (list[i].isSubject && !list[i].result)) {
this.$message.warning(`${list[i].index + 1}项,规则与结果至少填写一个`);
return;
} else if (this.tableData[i].isSubject && !this.tableData[i].isSave) {
this.$message.warning(`${i + 1}项,未保存`);
} else if (list[i].isSubject && !list[i].isSave) {
this.$message.warning(`${list[i].index + 1}项,未保存`);
return;
}
}
@ -433,6 +445,31 @@ export default {
this.setIndex()
}).catch(() => {})
},
//
batchDel() {
if(this.multipleSelection.length){
this.$confirm("此操作将永久删除该规则, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true
}).then(() => {
const ids = this.multipleSelection.map(e => e.id)
const list = this.tableData
ids.map((e, i) => {
const index = list.findIndex(j => j.id === e)
if (index !== -1) {
this.tableData.splice(index === this.tableData.length - 1 ? index - 1 : index, 2)
}
})
this.setIndex()
this.itemkey = Math.random()
this.isAddRule = false;
}).catch(() => {})
} else {
this.$message.error('请先选择数据 !')
}
},
//
headClass() {
return "text-align: center;";
@ -548,6 +585,13 @@ export default {
-webkit-box-shadow: inset 0 0 5px #dddddd;
}
/deep/.lc-table {
.el-table__body {
tr:nth-child(even) .el-checkbox {
display: none;
}
}
}
/deep/ ::-webkit-scrollbar-track {
/*滚动条里面轨道*/
-webkit-box-shadow: inset 0 0 5px #dddddd;

@ -60,14 +60,20 @@
<div class="flex-between mgb20">
<div style="width: 100%;height: 400px;overflow: auto;margin: auto;background: #F5F5F5">
<el-tree
style="background: #F5F5F5"
:data="treeData"
@check="currentChecked"
header-align="center"
show-checkbox
ref="tree"
node-key="operationIds"
:props="defaultProps">
class="add-tree"
style="background: #F5F5F5"
:data="treeData"
@check="currentChecked"
header-align="center"
show-checkbox
ref="tree"
node-key="operationIds"
:props="defaultProps"
v-if="configVisible">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<em class="exist" v-if="data.exist">已导入</em>
</span>
</el-tree>
</div>
</div>
@ -742,12 +748,13 @@ export default {
this.$message.warning(`请添加判分规则`);
return;
} else {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].isSubject && !this.tableData[i].operationIds) {
this.$message.warning(`${i + 1}项请选择操作点`);
const list = this.tableData
for (let i = 0; i < list.length; i++) {
if (list[i].isSubject && !list[i].operationIds) {
this.$message.warning(`${list[i].index + 1}项请选择操作点`);
return;
} else if (this.tableData[i].isSubject && !this.tableData[i].isSave) {
this.$message.warning(`${i + 1}项,未保存`);
} else if (list[i].isSubject && !list[i].isSave) {
this.$message.warning(`${list[i].index + 1}项,未保存`);
return;
}
}
@ -826,14 +833,10 @@ export default {
//
const addSuffix = data => {
data.map(e => {
//
if (ids.includes(e.operationIds) && !e.label.endsWith('(已导入)')) {
e.label += '(已导入)'
} else if (!ids.includes(e.operationIds) && e.label.endsWith('(已导入)')) { //
e.label = e.label.replace('(已导入)', '')
} else if (e.children && e.children.length) { //
addSuffix(e.children)
}
//
e.exist = ids.includes(e.operationIds) || (e.children && e.children.length && e.children.every(n => ids.includes(n.operationIds)))
//
if (e.children && e.children.length) addSuffix(e.children)
})
}
addSuffix(treeData)
@ -1009,7 +1012,6 @@ export default {
}).then(() => {
const ids = this.multipleSelection.map(e => e.id)
const list = this.tableData
const len = list.length - 1
ids.map((e, i) => {
const index = list.findIndex(j => j.id === e)
if (index !== -1) {
@ -1138,7 +1140,13 @@ export default {
}
}
/deep/.add-tree {
.exist {
font-size: 12px;
font-style: normal;
color: #b3b3b3;
}
}
//
/deep/ ::-webkit-scrollbar {
width: 6px; //

Loading…
Cancel
Save