master
luoJunYong.123 3 years ago
parent 5db85f775f
commit 6b2f389502
  1. 3
      src/store/State.js
  2. 3
      src/store/mutations.js
  3. 203
      src/views/Transaction.vue

@ -1,5 +1,6 @@
export default { export default {
token: '', token: '',
referrer: '' referrer: '',
treeDataStore: []
} }

@ -6,4 +6,7 @@ export default {
state.token = payload.token state.token = payload.token
state.referrer = payload.referrer state.referrer = payload.referrer
}, },
setTreeDataStore(state, { treeDataStore }) {
state.treeDataStore = treeDataStore
}
} }

@ -1,8 +1,6 @@
<template> <template>
<!-- 交易类 --> <!-- 交易类 -->
<div class="content" v-loading="loading" <div class="content">
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">
@ -22,7 +20,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"
@ -35,12 +33,12 @@
<div class="item"> <div class="item">
<div class="label">实验要求</div> <div class="label">实验要求</div>
<quill <quill
class="quill"
v-model="formData.lcJudgmentPoint.experimentalRequirements" v-model="formData.lcJudgmentPoint.experimentalRequirements"
:readonly="isView" :readonly="isView"
:border="true" :border="true"
:minHeight="150" :minHeight="150"
:height="150" :height="150"
style="width: 100%"
/> />
</div> </div>
</div> </div>
@ -52,15 +50,14 @@
<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
class="add-tree"
style="background: #F5F5F5" style="background: #F5F5F5"
:data="treeData" :data="treeData"
@check="currentChecked" @check="currentChecked"
@ -68,12 +65,7 @@
show-checkbox show-checkbox
ref="tree" ref="tree"
node-key="operationIds" node-key="operationIds"
:props="defaultProps" :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>
@ -85,21 +77,12 @@
<el-card shadow="hover"> <el-card shadow="hover">
<el-table <el-table
class="lc-table"
:data="tableData" :data="tableData"
:stripe="true" :stripe="true"
:key="itemkey" :key="itemkey"
header-align="center" 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">
@ -107,12 +90,25 @@
<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" align="center"> <el-table-column label=" " width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
circle circle
@ -120,6 +116,7 @@
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>
@ -353,6 +350,7 @@
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},
@ -363,7 +361,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), //
@ -372,7 +370,7 @@ export default {
treeData: [], // treeData: [], //
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label" label: "name"
}, // }, //
defaultProp: { defaultProp: {
children: "children", children: "children",
@ -398,7 +396,6 @@ export default {
configVisible:false, configVisible:false,
SelectedObj:[], SelectedObj:[],
counts:0, counts:0,
loading:true,
}; };
}, },
mounted() { mounted() {
@ -412,6 +409,9 @@ 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(async (item, index) => { this.tableData.forEach((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,26 +441,22 @@ 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.setIndex() this.$store.commit('setTreeDataStore', { treeDataStore: this.treeData})
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
@ -481,7 +477,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 (let i=0;i<this.SelectedObj.checkedNodes.length;i++){ for (var 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{
@ -493,7 +489,6 @@ 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){
@ -518,7 +513,6 @@ export default {
item.operationIData.push(testObj) item.operationIData.push(testObj)
} }
}); });
this.setIndex()
this.configVisible = false this.configVisible = false
}, },
anewPosttingDatas(judgmentRuleList){ anewPosttingDatas(judgmentRuleList){
@ -590,11 +584,6 @@ 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);
@ -635,6 +624,7 @@ 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 => {
@ -643,11 +633,18 @@ 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]);
@ -671,15 +668,26 @@ export default {
} }
}, },
getTreeData() { // getTreeData() { //
// .length
if(this.treeDataStore.length) {
console.log('what?')
console.log(this.treeDataStore)
const tmp = [...this.treeDataStore]
this.treeData = this.toTreeId(tmp, this.treeDataStore[0].parentId);
if (this.$route.query.lcId) {
this.lcId = this.$route.query.lcId;
this.getInfoData(this.$route.query.lcId);
}
}else {
this.$get(this.api.getLcRecord).then(res => { this.$get(this.api.getLcRecord).then(res => {
if (res.status == 200 && res.list.length>0) { if (res.status == 200 && res.list.length>0) {
if (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); this.treeData = this.toTreeId(res.list, res.list[0].parentId);
if (this.$route.query.lcId) { if (this.$route.query.lcId) {
this.lcId = this.$route.query.lcId; this.lcId = this.$route.query.lcId;
this.getInfoData(this.$route.query.lcId); this.getInfoData(this.$route.query.lcId);
} else {
this.loading = false
} }
} }
} else { } else {
@ -688,11 +696,12 @@ export default {
}).catch(err => { }).catch(err => {
// console.log(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 {
@ -748,13 +757,12 @@ export default {
this.$message.warning(`请添加判分规则`); this.$message.warning(`请添加判分规则`);
return; return;
} else { } else {
const list = this.tableData for (let i = 0; i < this.tableData.length; i++) {
for (let i = 0; i < list.length; i++) { if (this.tableData[i].isSubject && !this.tableData[i].operationIds) {
if (list[i].isSubject && !list[i].operationIds) { this.$message.warning(`${i + 1}项请选择操作点`);
this.$message.warning(`${list[i].index + 1}项请选择操作点`);
return; return;
} else if (list[i].isSubject && !list[i].isSave) { } else if (this.tableData[i].isSubject && !this.tableData[i].isSave) {
this.$message.warning(`${list[i].index + 1}项,未保存`); this.$message.warning(`${i + 1}项,未保存`);
return; return;
} }
} }
@ -821,26 +829,12 @@ export default {
}); });
} }
}, },
//
addRules(){ addRules(){
this.configVisible = TextTrackCue this.configVisible = true;
const ids = [] this.$nextTick(() => {
const treeData = this.treeData this.$refs.tree.setCheckedKeys([]);
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)
@ -893,13 +887,6 @@ 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); //
@ -970,7 +957,6 @@ export default {
} }
this.isAddRule = false; this.isAddRule = false;
} }
this.setIndex()
}, },
handleDelete(row, index) { // handleDelete(row, index) { //
this.$confirm("此操作将永久删除该规则, 是否继续?", "提示", { this.$confirm("此操作将永久删除该规则, 是否继续?", "提示", {
@ -1001,37 +987,6 @@ 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;";
@ -1040,6 +995,11 @@ export default {
rowClass() { rowClass() {
return "text-align: center;"; return "text-align: center;";
} }
},
computed: {
...mapState({
treeDataStore: state => state.treeDataStore
})
} }
}; };
</script> </script>
@ -1059,15 +1019,18 @@ export default {
border-bottom: 1px dashed #ccc; border-bottom: 1px dashed #ccc;
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;
font-size: 12px; font-size: 14px;
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: 16px; font-size: 14px;
font-weight: 600; font-weight: 600;
padding-left: 5px; padding-left: 5px;
} }
@ -1075,7 +1038,6 @@ export default {
.title { .title {
font-weight: bold; font-weight: bold;
font-size: 14px;
margin-left: 20px; margin-left: 20px;
} }
} }
@ -1111,9 +1073,6 @@ export default {
padding-right: 20px; padding-right: 20px;
line-height: 35px; line-height: 35px;
} }
.quill {
width: calc(100% - 240px);
}
} }
} }
@ -1141,13 +1100,7 @@ export default {
} }
} }
/deep/.add-tree {
.exist {
font-size: 12px;
font-style: normal;
color: #b3b3b3;
}
}
// //
/deep/ ::-webkit-scrollbar { /deep/ ::-webkit-scrollbar {
width: 6px; // width: 6px; //
@ -1183,13 +1136,7 @@ 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