案例新增 指标部分

zqqdev
CherrysChang 5 years ago
parent 67ff9dad4c
commit 5292c26b5c
  1. 100
      src/views/train/case-detail.vue

@ -24,8 +24,7 @@
<el-row :gutter="20" type="flex"> <el-row :gutter="20" type="flex">
<el-col :span="1" style="text-align:center;padding-top: 182px;width: 88px;" class="item-required">量化指标</el-col> <el-col :span="1" style="text-align:center;padding-top: 182px;width: 88px;" class="item-required">量化指标</el-col>
<el-col :span="7"> <el-col :span="7">
<el-table ref="leftTable" :data="leftDictTargetList.filter(data => !searchName || data.name.toLowerCase().includes(searchName.toLowerCase()))" <el-table ref="leftTable" :data="getFilterDataBySearchName" height="400" border highlight-current-row tooltip-effect="dark" @selection-change="leftSelectionChange">
height="400" border highlight-current-row tooltip-effect="dark" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column header-align="right" label="未选择 10/10"> <el-table-column header-align="right" label="未选择 10/10">
<el-table-column prop="name" label="名称" show-overflow-tooltip> <el-table-column prop="name" label="名称" show-overflow-tooltip>
@ -37,23 +36,26 @@
</el-table> </el-table>
</el-col> </el-col>
<el-col :span="1" style="text-align:center;padding: 160px 0 0 0;width: 24px;"> <el-col :span="1" style="text-align:center;padding: 160px 0 0 0;width: 24px;">
<el-button @click="addStaff" size="mini" type="primary" icon="el-icon-arrow-right" circle></el-button> <!--:disabled="leftSelectedRows.length==0"-->
<el-button @click="removeStaff" size="mini" type="primary" icon="el-icon-arrow-left" circle style="margin:10px 0 0 0;"></el-button> <el-button @click="addToRight" size="mini" type="primary" icon="el-icon-arrow-right" circle :disabled="isDisable"></el-button>
<el-button @click="removeToLeft" size="mini" type="primary" icon="el-icon-arrow-left" circle style="margin:10px 0 0 0;"></el-button>
</el-col> </el-col>
<el-col :span="14" class="rightTable"> <el-col :span="14" class="rightTable">
<el-table ref="rightTable" :data="tableData" height="400" border highlight-current-row tooltip-effect="dark" :summary-method="getScoreSummaries" show-summary @selection-change="handleSelectionChange"> <el-table ref="rightTable" :data="dataForm.taskList" height="400" border highlight-current-row tooltip-effect="dark" :summary-method="getScoreSummaries" show-summary @selection-change="rightSelectionChange">
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column header-align="right" label="已选择 0/10,剩余可配置分数 90 分"> <el-table-column header-align="right" label="已选择 0/10,剩余可配置分数 90 分">
<el-table-column prop="name" label="名称"></el-table-column> <el-table-column prop="name" label="名称"></el-table-column>
<el-table-column prop="target" label="任务目标" width="226"> <el-table-column prop="target" label="任务目标" width="226">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop="'tradeList.'+scope.$index+'.score'" :rules="dataRule.score" class="score-input" > <el-form-item :prop="'taskList.'+scope.$index+'.taskOperate'" :rules="dataRule.score" class="score-input" >
<el-select size="small" style="width: 100px;"> <el-select v-model="scope.row.taskOperate" size="small" style="width: 100px;">
<el-option label="大于" value="1"></el-option> <el-option label="大于" value="1"></el-option>
<el-option label="等于" value="2"></el-option> <el-option label="等于" value="2"></el-option>
<el-option label="小于" value="3"></el-option> <el-option label="小于" value="3"></el-option>
</el-select> </el-select>
<el-input size="small" v-model.trim="scope.row.score" :disabled="formAction == 2" style="width: 100px;"> </el-form-item>
<el-form-item :prop="'taskList.'+scope.$index+'.taskRate'" :rules="dataRule.score" class="score-input" >
<el-input size="small" v-model.trim="scope.row.taskRate" :disabled="formAction == 2" style="width: 100px;">
<i slot="suffix">%</i> <i slot="suffix">%</i>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -61,14 +63,14 @@
</el-table-column> </el-table-column>
<el-table-column prop="score" label="分数" width="120"> <el-table-column prop="score" label="分数" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop="'tradeList.'+scope.$index+'.score'" :rules="dataRule.score" class="score-input"> <el-form-item :prop="'taskList.'+scope.$index+'.score'" :rules="dataRule.score" class="score-input">
<el-input size="small" v-model.trim="scope.row.score" :disabled="formAction == 2" style="width: 100px;"><i slot="suffix"></i></el-input> <el-input size="small" v-model.trim="scope.row.score" :disabled="formAction == 2" style="width: 100px;"><i slot="suffix"></i></el-input>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" width="50"> <el-table-column fixed="right" label="操作" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text" size="small">移除</el-button> <el-button @click.native.prevent="rightDeleteRow(scope.$index, tableData)" type="text" size="small">移除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
@ -113,30 +115,6 @@
} }
}; };
return { return {
leftDictTargetList: [],
tableData: [{
name: '王小虎',
}, {
name: '王小虎',
}, {
name: '王小虎',
}, {
name: '王小虎',
}, {
name: '王小虎',
}],
searchName: '',
tableData2: [{
name: '王小虎',
}, {
name: '王小虎',
}, {
name: '王小虎',
}, {
name: '王小虎',
}, {
name: '王小虎',
}],
formAction: 0, // 0add,1:edit,2:view formAction: 0, // 0add,1:edit,2:view
dataForm: { dataForm: {
id: '', id: '',
@ -157,10 +135,14 @@
// content: [ // content: [
// {validator: validateContent, trigger: 'blur'} // {validator: validateContent, trigger: 'blur'}
// ], // ],
// score: [ score: [
// {validator: validateScore, trigger: 'blur'} {validator: validateScore, trigger: 'blur'}
// ], ],
}, },
leftDictTargetList: [],//
searchName: '',
leftSelectedRows: [],//
rightTargetList:[],//
selectedItemRows: [], selectedItemRows: [],
selectedTradeItems: [], selectedTradeItems: [],
} }
@ -184,6 +166,18 @@
// //
this.initTargetList(); this.initTargetList();
}, },
computed: {
isDisable: function() { // truefalse
if(this.leftSelectedRows && this.leftSelectedRows.length >0) {
return false;
}
return true;
},
getFilterDataBySearchName: function () {//
let searchName = this.searchName;
return this.leftDictTargetList.filter(data => !searchName || data.name.toLowerCase().includes(searchName.toLowerCase()))
}
},
methods: { methods: {
goBackList() { goBackList() {
// this.$router.push({name: 'CaseList'}); // this.$router.push({name: 'CaseList'});
@ -198,6 +192,38 @@
console.info(error) console.info(error)
}); });
}, },
leftSelectionChange(selection) {
debugger;
//ZqqTODO
this.leftSelectedRows = selection;
let searchData = this.getFilterDataBySearchName;
searchData.forEach(item => {
if (selection.filter(itemTmp => {return itemTmp.id == item.id;}).length > 0) {
item._checked = true;
}else{
item._checked = false;
}
})
this.leftDictTargetList.forEach(item2 => {
for (let i = 0; i < searchData.length; i++) {
if (searchData[i].id==item2.id){
item2._checked = searchData[i]._checked; //searchData[i]._checked,true
}
}
})
},
addToRight() {
console.info("addToRight")
},
removeToLeft() {
console.info("removeToLeft")
},
rightDeleteRow() {
console.info("rightDeleteRow")
},
rightSelectionChange(val) {
// this.leftSelectedRows = val;
},
getScoreSummaries(param) { // getScoreSummaries(param) { //
const { columns, data } = param; const { columns, data } = param;
const sums = []; const sums = [];

Loading…
Cancel
Save