还原刚提交的修改

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

@ -1,6 +1,8 @@
<template>
<!-- 交易类 -->
<div class="content">
<div class="content" v-loading="loading"
element-loading-text="加载中"
element-loading-spinner="el-icon-loading">
<div class="header">
<div>
<i class="back el-icon-arrow-left" @click="Back()" style="cursor:pointer">
@ -20,7 +22,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"
@ -33,12 +35,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>
@ -50,14 +52,15 @@
<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"
@ -65,7 +68,12 @@
show-checkbox
ref="tree"
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>
</div>
</div>
@ -77,12 +85,21 @@
<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">
@ -90,25 +107,12 @@
<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">
<el-table-column label=" " width="150" align="center">
<template slot-scope="scope">
<el-button
circle
@ -116,7 +120,6 @@
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>
@ -350,7 +353,6 @@
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},
@ -361,7 +363,7 @@ export default {
fromCountIndex: -999,
checkChange: [],
changeArr: [],
multipleSelection: [],
lcId: "", // id
isAdd: Boolean(this.$route.query.isAdd), //
isEdit: Boolean(this.$route.query.isEdit), //
@ -370,7 +372,7 @@ export default {
treeData: [], //
defaultProps: {
children: "children",
label: "name"
label: "label"
}, //
defaultProp: {
children: "children",
@ -396,6 +398,7 @@ export default {
configVisible:false,
SelectedObj:[],
counts:0,
loading:true,
};
},
mounted() {
@ -409,9 +412,6 @@ 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((item, index) => {
this.tableData.forEach(async (item, index) => {
//
let lists = JSON.parse(JSON.stringify(this.treeData))
if (item.operationIds) {
@ -441,22 +441,26 @@ 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.$store.commit('setTreeDataStore', { treeDataStore: this.treeData})
this.setIndex()
this.loading = false
} 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
@ -477,7 +481,7 @@ export default {
this.counts = this.counts+1
let list = []
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){
}else{
@ -489,6 +493,7 @@ export default {
}
}
this.anewPosttingDatas(list)
let i = 0
this.tableData.forEach(async (item, index) => {
//
if (!item.type){
@ -513,6 +518,7 @@ export default {
item.operationIData.push(testObj)
}
});
this.setIndex()
this.configVisible = false
},
anewPosttingDatas(judgmentRuleList){
@ -584,6 +590,11 @@ 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);
@ -624,7 +635,6 @@ export default {
...res.subject,
lcItems: res.items
};
console.log(res)
this.$set(this.tableData, index, item);
}
}).catch(err => {
@ -633,18 +643,11 @@ 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]);
@ -668,26 +671,15 @@ 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 {
@ -696,12 +688,11 @@ 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 {
@ -757,12 +748,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].operationIds) {
this.$message.warning(`${i + 1}项请选择操作点`);
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}项请选择操作点`);
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;
}
}
@ -829,12 +821,26 @@ export default {
});
}
},
//
addRules(){
this.configVisible = true;
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys([]);
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)
})
}
addSuffix(treeData)
this.$refs.tree.setCheckedKeys([])
},
addRule() { //
this.changeArr.splice(0, this.changeArr.length)
@ -887,6 +893,13 @@ 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); //
@ -957,6 +970,7 @@ export default {
}
this.isAddRule = false;
}
this.setIndex()
},
handleDelete(row, index) { //
this.$confirm("此操作将永久删除该规则, 是否继续?", "提示", {
@ -987,6 +1001,37 @@ 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;";
@ -995,11 +1040,6 @@ export default {
rowClass() {
return "text-align: center;";
}
},
computed: {
...mapState({
treeDataStore: state => state.treeDataStore
})
}
};
</script>
@ -1019,18 +1059,15 @@ export default {
border-bottom: 1px dashed #ccc;
height: 45px;
line-height: 45px;
font-size: 14px;
font-size: 12px;
font-weight: 600;
//padding: 0 10px;
display: flex;
justify-content: space-between;
.back {
line-height: 3;
//padding-left: 10px;
span {
font-size: 14px;
font-size: 16px;
font-weight: 600;
padding-left: 5px;
}
@ -1038,6 +1075,7 @@ export default {
.title {
font-weight: bold;
font-size: 14px;
margin-left: 20px;
}
}
@ -1073,6 +1111,9 @@ export default {
padding-right: 20px;
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 {
width: 6px; //
@ -1136,7 +1183,13 @@ 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