已导入标识

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>
</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> <el-button v-if="!isView" :disabled="isAddRule" type="primary" size="mini" @click="addRule">新增</el-button>
</div> </div>
</div> </div>
<el-card shadow="hover"> <el-card shadow="hover">
<el-table <el-table
class="lc-table"
:data="tableData" :data="tableData"
:stripe="true" :stripe="true"
:cell-style="rowClass" :cell-style="rowClass"
header-align="center" header-align="center"
:header-cell-style="headClass" :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"> <el-table-column prop="id" type="index" label="序号" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isSubject && scope.row.index + 1 }} {{ scope.row.isSubject && scope.row.index + 1 }}
@ -139,6 +146,7 @@ export default {
isAdd: Boolean(this.$route.query.isAdd), // isAdd: Boolean(this.$route.query.isAdd), //
isEdit: Boolean(this.$route.query.isEdit), // isEdit: Boolean(this.$route.query.isEdit), //
isView: Boolean(this.$route.query.isView), // isView: Boolean(this.$route.query.isView), //
multipleSelection: [],
isNameRepeat: false, // isNameRepeat: false, //
formData: { formData: {
points: { points: {
@ -203,6 +211,9 @@ export default {
console.log(err) console.log(err)
}); });
}, },
handleSelectionChange(val){
this.multipleSelection = val
},
// //
setIndex() { setIndex() {
let i = 0 let i = 0
@ -283,12 +294,13 @@ export default {
this.$message.warning(`请添加判分规则`); this.$message.warning(`请添加判分规则`);
return; return;
} else { } else {
for (let i = 0; i < this.tableData.length; i++) { const list = this.tableData
if ((this.tableData[i].isSubject && !this.tableData[i].required) && (this.tableData[i].isSubject && !this.tableData[i].result)) { for (let i = 0; i < list.length; i++) {
this.$message.warning(`${i + 1}项,规则与结果至少填写一个`); if ((list[i].isSubject && !list[i].required) && (list[i].isSubject && !list[i].result)) {
this.$message.warning(`${list[i].index + 1}项,规则与结果至少填写一个`);
return; return;
} else if (this.tableData[i].isSubject && !this.tableData[i].isSave) { } else if (list[i].isSubject && !list[i].isSave) {
this.$message.warning(`${i + 1}项,未保存`); this.$message.warning(`${list[i].index + 1}项,未保存`);
return; return;
} }
} }
@ -433,6 +445,31 @@ export default {
this.setIndex() this.setIndex()
}).catch(() => {}) }).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() { headClass() {
return "text-align: center;"; return "text-align: center;";
@ -548,6 +585,13 @@ export default {
-webkit-box-shadow: inset 0 0 5px #dddddd; -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 { /deep/ ::-webkit-scrollbar-track {
/*滚动条里面轨道*/ /*滚动条里面轨道*/
-webkit-box-shadow: inset 0 0 5px #dddddd; -webkit-box-shadow: inset 0 0 5px #dddddd;

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

Loading…
Cancel
Save