diff --git a/src/views/Program.vue b/src/views/Program.vue
index e455c38..223bd88 100644
--- a/src/views/Program.vue
+++ b/src/views/Program.vue
@@ -57,18 +57,25 @@
判分规则
+ 批量删除
新增
+
+
{{ 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;
diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue
index 4520a62..a8a5d5c 100644
--- a/src/views/Transaction.vue
+++ b/src/views/Transaction.vue
@@ -60,14 +60,20 @@
+ 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">
+
+ {{ node.label }}
+ (已导入)
+
@@ -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; // 横向滚动条