还原刚提交的修改

master
yujialong 3 years ago
parent 6b2f389502
commit 00eef97493
  1. 261
      src/views/Transaction.vue

@ -1,6 +1,8 @@
<template> <template>
<!-- 交易类 --> <!-- 交易类 -->
<div class="content"> <div class="content" v-loading="loading"
element-loading-text="加载中"
element-loading-spinner="el-icon-loading">
<div class="header"> <div class="header">
<div> <div>
<i class="back el-icon-arrow-left" @click="Back()" style="cursor:pointer"> <i class="back el-icon-arrow-left" @click="Back()" style="cursor:pointer">
@ -20,7 +22,7 @@
<div>基本信息</div> <div>基本信息</div>
</div> </div>
<div class="item"> <div class="item">
<div class="label">判分点名称</div> <div class="label">判分点</div>
<el-input <el-input
v-model.trim="formData.lcJudgmentPoint.name" v-model.trim="formData.lcJudgmentPoint.name"
:readonly="isView" :readonly="isView"
@ -33,12 +35,12 @@
<div class="item"> <div class="item">
<div class="label">实验要求</div> <div class="label">实验要求</div>
<quill <quill
v-model="formData.lcJudgmentPoint.experimentalRequirements" class="quill"
:readonly="isView" v-model="formData.lcJudgmentPoint.experimentalRequirements"
:border="true" :readonly="isView"
:minHeight="150" :border="true"
:height="150" :minHeight="150"
style="width: 100%" :height="150"
/> />
</div> </div>
</div> </div>
@ -50,22 +52,28 @@
<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" type="primary" size="mini" @click="addRules">新增</el-button> <el-button v-if="!isView" type="primary" size="mini" @click="addRules">新增</el-button>
<!-- <el-button v-if="!isView" type="primary" size="mini" @click="addRule">新增</el-button>-->
</div> </div>
</div> </div>
<el-dialog :visible.sync="configVisible" width="25%" title="批量新增判分点" center :append-to-body="false"> <el-dialog :visible.sync="configVisible" width="25%" title="批量新增判分点" center :append-to-body="false">
<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>
@ -77,12 +85,21 @@
<el-card shadow="hover"> <el-card shadow="hover">
<el-table <el-table
:data="tableData" class="lc-table"
:stripe="true" :data="tableData"
:key="itemkey" :stripe="true"
header-align="center" :key="itemkey"
header-align="center"
@selection-change="handleSelectionChange"
> >
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column prop="indexNo" type="index" label="序号" width="80"> <el-table-column prop="indexNo" type="index" label="序号" width="80">
<template slot-scope="scope">
{{ scope.row.isSubject && scope.row.index + 1 }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="流程类考核点"> <el-table-column label="流程类考核点">
<template slot-scope="scope" v-if="scope.row.isSubject"> <template slot-scope="scope" v-if="scope.row.isSubject">
@ -90,25 +107,12 @@
<div class="tree-con"> <div class="tree-con">
<div class="block1" :id="'divTree'+scope.$index"> <div class="block1" :id="'divTree'+scope.$index">
<el-tree :data="scope.row.operationIData" :props="defaultProp" :default-expand-all="true"></el-tree> <el-tree :data="scope.row.operationIData" :props="defaultProp" :default-expand-all="true"></el-tree>
<!-- <my-tree-->
<!-- :id="'depTree'+scope.$index"-->
<!-- class="action"-->
<!-- :ref="'tree-'+scope.$index"-->
<!-- :data="treeData"-->
<!-- :props="defaultProps"-->
<!-- default-expand-all-->
<!-- node-key="operationIds"-->
<!-- show-checkbox-->
<!-- @check-change="(data, checked, indeterminate) => {-->
<!-- handleCheckChange(data, checked, indeterminate, scope.row, scope.$index);-->
<!-- }"-->
<!-- ></my-tree>-->
</div> </div>
<div v-show="scope.row.isDisabled" class="mask"></div> <div v-show="scope.row.isDisabled" class="mask"></div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label=" " width="150"> <el-table-column label=" " width="150" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
circle circle
@ -116,7 +120,6 @@
v-if="scope.row.isSubject" v-if="scope.row.isSubject"
:disabled="isView || scope.row.isDisabled" :disabled="isView || scope.row.isDisabled"
@click="changeResult(scope.row)" @click="changeResult(scope.row)"
style="position: absolute; right: 55px"
> >
{{ scope.row.resultOperation === 0 ? "且" : "或" }} {{ scope.row.resultOperation === 0 ? "且" : "或" }}
</el-button> </el-button>
@ -350,7 +353,6 @@
import quill from "@/components/quill"; import quill from "@/components/quill";
import MyTree from "@/components/myTree/src/tree"; import MyTree from "@/components/myTree/src/tree";
import {deepCopy} from "@/utils/deepCopy"; import {deepCopy} from "@/utils/deepCopy";
import { mapMutation, mapState } from 'vuex';
export default { export default {
components: {quill, MyTree}, components: {quill, MyTree},
@ -361,7 +363,7 @@ export default {
fromCountIndex: -999, fromCountIndex: -999,
checkChange: [], checkChange: [],
changeArr: [], changeArr: [],
multipleSelection: [],
lcId: "", // id lcId: "", // id
isAdd: Boolean(this.$route.query.isAdd), // isAdd: Boolean(this.$route.query.isAdd), //
isEdit: Boolean(this.$route.query.isEdit), // isEdit: Boolean(this.$route.query.isEdit), //
@ -370,7 +372,7 @@ export default {
treeData: [], // treeData: [], //
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "name" label: "label"
}, // }, //
defaultProp: { defaultProp: {
children: "children", children: "children",
@ -396,6 +398,7 @@ export default {
configVisible:false, configVisible:false,
SelectedObj:[], SelectedObj:[],
counts:0, counts:0,
loading:true,
}; };
}, },
mounted() { mounted() {
@ -409,9 +412,6 @@ export default {
} }
}, },
methods: { methods: {
// ...mapMutation({
// setTreeData: 'setTreeData' setTreeData
// }),
getInfoData(lcId) { // getInfoData(lcId) { //
this.counts = 0 this.counts = 0
this.$get(`${this.api.queryJudgmentPointDetails}?lcId=${lcId}`).then(res => { this.$get(`${this.api.queryJudgmentPointDetails}?lcId=${lcId}`).then(res => {
@ -422,7 +422,7 @@ export default {
lcJudgmentRuleList: judgmentRuleList lcJudgmentRuleList: judgmentRuleList
}; };
this.anewPosttingData(judgmentRuleList) this.anewPosttingData(judgmentRuleList)
this.tableData.forEach((item, index) => { this.tableData.forEach(async (item, index) => {
// //
let lists = JSON.parse(JSON.stringify(this.treeData)) let lists = JSON.parse(JSON.stringify(this.treeData))
if (item.operationIds) { if (item.operationIds) {
@ -441,22 +441,26 @@ export default {
} }
} }
item.operationIData.push(testObj) item.operationIData.push(testObj)
console.log('-====-')
console.log(testObj)
} }
// id, // id,
if (item.isSubject && item.type && item.type != 4 && item.emptyOne) { if (item.isSubject && item.type && item.type != 4 && item.emptyOne) {
// await this.getSubjectData(item.emptyOne, index); // await this.getSubjectData(item.emptyOne, index);
} }
}); });
this.$store.commit('setTreeDataStore', { treeDataStore: this.treeData}) this.setIndex()
this.loading = false
} else { } else {
this.$message.warning(res.message); this.$message.warning(res.message);
this.loading = false
} }
}).catch(err => { }).catch(err => {
this.loading = false
// console.log(err); // console.log(err);
}); });
}, },
handleSelectionChange(val){
this.multipleSelection = val
},
cxk(arr, obj, needObj) { cxk(arr, obj, needObj) {
if(arr.length === 0) { if(arr.length === 0) {
return obj return obj
@ -477,7 +481,7 @@ export default {
this.counts = this.counts+1 this.counts = this.counts+1
let list = [] let list = []
if (this.SelectedObj.checkedNodes.length > 0){ if (this.SelectedObj.checkedNodes.length > 0){
for (var i=0;i<this.SelectedObj.checkedNodes.length;i++){ for (let i=0;i<this.SelectedObj.checkedNodes.length;i++){
if(this.SelectedObj.checkedNodes[i].children.length > 0){ if(this.SelectedObj.checkedNodes[i].children.length > 0){
}else{ }else{
@ -489,6 +493,7 @@ export default {
} }
} }
this.anewPosttingDatas(list) this.anewPosttingDatas(list)
let i = 0
this.tableData.forEach(async (item, index) => { this.tableData.forEach(async (item, index) => {
// //
if (!item.type){ if (!item.type){
@ -513,6 +518,7 @@ export default {
item.operationIData.push(testObj) item.operationIData.push(testObj)
} }
}); });
this.setIndex()
this.configVisible = false this.configVisible = false
}, },
anewPosttingDatas(judgmentRuleList){ anewPosttingDatas(judgmentRuleList){
@ -584,6 +590,11 @@ export default {
isDisabled: true, // isDisabled: true, //
isSave: true // isSave: true //
}; };
if(item.type == undefined || item.type == ''){
obj.type = null
}else{
obj.type = item.type
}
//(1 2 3 4 5) //(1 2 3 4 5)
if (item.type == 1 || item.type == 2) { if (item.type == 1 || item.type == 2) {
obj.subjectId = Number(item.emptyOne); obj.subjectId = Number(item.emptyOne);
@ -624,7 +635,6 @@ export default {
...res.subject, ...res.subject,
lcItems: res.items lcItems: res.items
}; };
console.log(res)
this.$set(this.tableData, index, item); this.$set(this.tableData, index, item);
} }
}).catch(err => { }).catch(err => {
@ -633,18 +643,11 @@ export default {
} }
}, },
handleCheckChange(data, checked, indeterminate, row, index) { // handleCheckChange(data, checked, indeterminate, row, index) { //
if (checked && data.isNode === 1) { if (checked && data.isNode === 1) {
console.log(data)
if (!data.type){ if (!data.type){
this.getSubjectData(data.subjectId, index); this.getSubjectData(data.subjectId, index);
} }
this.tableData[index].operationIds = data.operationIds; // id this.tableData[index].operationIds = data.operationIds; // id
// row.value1 = "";
// row.value2 = "";
// row.value3 = "";
// row.value4 = "";
// row.value5 = "";
if (data.subjectId) { // id if (data.subjectId) { // id
this.currentNodeData = data; this.currentNodeData = data;
this.$refs[`tree-${index}`].setCheckedNodes([data]); this.$refs[`tree-${index}`].setCheckedNodes([data]);
@ -668,40 +671,28 @@ export default {
} }
}, },
getTreeData() { // getTreeData() { //
this.$get(this.api.getLcRecord).then(res => {
// .length if (res.status == 200 && res.list.length>0) {
if(this.treeDataStore.length) { if (res.list.length>0) {
console.log('what?') this.treeData = this.toTreeId(res.list, res.list[0].parentId);
console.log(this.treeDataStore) if (this.$route.query.lcId) {
const tmp = [...this.treeDataStore] this.lcId = this.$route.query.lcId;
this.treeData = this.toTreeId(tmp, this.treeDataStore[0].parentId); this.getInfoData(this.$route.query.lcId);
if (this.$route.query.lcId) { } else {
this.lcId = this.$route.query.lcId; this.loading = false
this.getInfoData(this.$route.query.lcId);
}
}else {
this.$get(this.api.getLcRecord).then(res => {
if (res.status == 200 && res.list.length>0) {
if (res.list.length>0) {
this.$store.commit('setTreeDataStore', { treeDataStore: res.list})
this.treeData = this.toTreeId(res.list, res.list[0].parentId);
if (this.$route.query.lcId) {
this.lcId = this.$route.query.lcId;
this.getInfoData(this.$route.query.lcId);
}
} }
} else {
this.$message.warning(res.message);
} }
}).catch(err => { } else {
// console.log(err); this.$message.warning(res.message);
}); }
} }).catch(err => {
// console.log(err);
});
}, },
toTreeId(data, parentId) { // id++,便key,id toTreeId(data, parentId) { // id++,便key,id
let result = []; let result = [];
data.forEach(item => { data.forEach(item => {
item.label = item.name
if (item.isNode === 0) { if (item.isNode === 0) {
item.showCheckbox = false; item.showCheckbox = false;
} else { } else {
@ -757,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;
} }
} }
@ -829,12 +821,26 @@ export default {
}); });
} }
}, },
//
addRules(){ addRules(){
this.configVisible = true; this.configVisible = TextTrackCue
this.$nextTick(() => { const ids = []
this.$refs.tree.setCheckedKeys([]); const treeData = this.treeData
const list = this.tableData
list.map(e => {
e.operationIds && ids.push(e.operationIds) // id
}) })
//
const addSuffix = data => {
data.map(e => {
//
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)
this.$refs.tree.setCheckedKeys([])
}, },
addRule() { // addRule() { //
this.changeArr.splice(0, this.changeArr.length) this.changeArr.splice(0, this.changeArr.length)
@ -887,6 +893,13 @@ export default {
row.ruleOperation = row.ruleOperation === 0 ? 1 : 0; row.ruleOperation = row.ruleOperation === 0 ? 1 : 0;
this.tableData[index - 1].ruleOperation = row.ruleOperation; this.tableData[index - 1].ruleOperation = row.ruleOperation;
}, },
//
setIndex() {
let i = 0
this.tableData.map(e => {
if (e.isSubject) e.index = i++
})
},
handleEdit(row) { // handleEdit(row) { //
this.judgePoints = true this.judgePoints = true
this.tableDataCopy = deepCopy(this.tableData); // this.tableDataCopy = deepCopy(this.tableData); //
@ -957,6 +970,7 @@ export default {
} }
this.isAddRule = false; this.isAddRule = false;
} }
this.setIndex()
}, },
handleDelete(row, index) { // handleDelete(row, index) { //
this.$confirm("此操作将永久删除该规则, 是否继续?", "提示", { this.$confirm("此操作将永久删除该规则, 是否继续?", "提示", {
@ -987,6 +1001,37 @@ export default {
}).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.tableData.forEach(async (item, index) => {
// id,
if (item.isSubject && item.type && item.type != 4 && item.emptyOne) {
await this.getSubjectData(item.emptyOne, index);
}
});
this.isAddRule = false;
}).catch(() => {})
} else {
this.$message.error('请先选择数据 !')
}
},
// //
headClass() { headClass() {
return "text-align: center;"; return "text-align: center;";
@ -995,11 +1040,6 @@ export default {
rowClass() { rowClass() {
return "text-align: center;"; return "text-align: center;";
} }
},
computed: {
...mapState({
treeDataStore: state => state.treeDataStore
})
} }
}; };
</script> </script>
@ -1019,18 +1059,15 @@ export default {
border-bottom: 1px dashed #ccc; border-bottom: 1px dashed #ccc;
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;
font-size: 14px; font-size: 12px;
font-weight: 600; font-weight: 600;
//padding: 0 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.back { .back {
line-height: 3; line-height: 3;
//padding-left: 10px;
span { span {
font-size: 14px; font-size: 16px;
font-weight: 600; font-weight: 600;
padding-left: 5px; padding-left: 5px;
} }
@ -1038,6 +1075,7 @@ export default {
.title { .title {
font-weight: bold; font-weight: bold;
font-size: 14px;
margin-left: 20px; margin-left: 20px;
} }
} }
@ -1073,6 +1111,9 @@ export default {
padding-right: 20px; padding-right: 20px;
line-height: 35px; line-height: 35px;
} }
.quill {
width: calc(100% - 240px);
}
} }
} }
@ -1100,7 +1141,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; //
@ -1136,7 +1183,13 @@ export default {
z-index: 99999; z-index: 99999;
} }
} }
/deep/.lc-table {
.el-table__body {
tr:nth-child(even) .el-checkbox {
display: none;
}
}
}
@mixin block { @mixin block {
padding: 10px; padding: 10px;
border: 1px solid #e4e7ed; border: 1px solid #e4e7ed;

Loading…
Cancel
Save