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 {
token: '',
referrer: ''
referrer: '',
treeDataStore: []
}

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

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

Loading…
Cancel
Save