|
|
|
@ -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; |
|
|
|
|