多任务评分账号生成

main
wanglei 2 months ago
parent c71e393ae2
commit 2a5f7c0ee7

@ -71,3 +71,13 @@ export function generateResult(data) {
params: data
})
}
// 新增考核评测
export function pcItemVotes(data) {
return request({
url: '/kaohe/template/pcItemVotes',
method: 'post',
data: data
})
}

@ -52,3 +52,12 @@ export function listByConditons(query) {
params: query
})
}
// 首页查询接口新
export function ListByVoteIds(query) {
return request({
url: '/kaohe/vote/ListByVoteIds',
method: 'get',
params: query
})
}

@ -14,6 +14,7 @@ const user = {
avatar: '',
pcId: null,
itemIds: null,
voteIds: null,
roles: [],
permissions: []
},
@ -40,6 +41,9 @@ const user = {
SET_ITEMIDS: (state, itemIds) => {
state.itemIds = itemIds
},
SET_VOTEIDS: (state, voteIds) => {
state.voteIds = voteIds
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
@ -87,6 +91,7 @@ const user = {
commit('SET_AVATAR', avatar)
commit('SET_PCID', user.pcId)
commit('SET_ITEMIDS', user.itemIds)
commit('SET_VOTEIDS', user.voteIds)
/* 初始密码提示 */
/*if(res.isDefaultModifyPwd) {
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {

@ -31,7 +31,7 @@
</template>
<script>
import { listByConditons } from "@/api/kaohe/vote"
import { listByConditons, ListByVoteIds } from "@/api/kaohe/vote"
import { listVote_recard } from "@/api/kaohe/vote_recard"
export default {
@ -42,8 +42,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
itemIds: null,
pingceId: null,
voteIds: null
},
//
total: 0,
@ -51,9 +50,9 @@ export default {
}
},
created() {
console.log(this.$store.state.user.roles);
this.queryParams.pingceId = this.$store.state.user.pcId;
this.queryParams.itemIds = this.$store.state.user.itemIds;
console.log(this.$store.state.user);
// this.queryParams.itemIds = this.$store.state.user.itemIds;
this.queryParams.voteIds= this.$store.state.user.voteIds
if(this.$store.state.user.roles.length===1&&this.$store.state.user.roles[0]==='employee'){
}else {
@ -62,13 +61,16 @@ export default {
},
methods: {
getList(){
listByConditons(this.queryParams).then(response => {
/*listByConditons(this.queryParams).then(response => {
this.voteList = response.rows;
this.total = response.total
})
})*/
ListByVoteIds(this.queryParams).then(response => {
this.voteList = response.rows;
this.total = response.total
});
},
goVotepage(row){
if(this.$store.state.user.roles.indexOf('admin')>0 || this.$store.state.user.roles.indexOf('sysAdmin')>0){
this.$router.push({ path: '/votepage', query: { id: row.id }});
}else {

@ -87,16 +87,16 @@
v-hasPermi="['system:user:remove']"
>清除评分账号</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="2">
<el-button
type="danger"
type="primary"
plain
icon="el-icon-delete"
icon="el-icon-document-add"
size="mini"
:disabled="multiple"
@click="rwAddsUser"
>生成评分账号</el-button>
</el-col>-->
@click="multipleTasksAddsUser"
>多任务评分账号生成</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -558,24 +558,24 @@
</el-dialog>
<!-- 生成评分账号对话框 -->
<el-dialog title="生成评分账号" :visible.sync="scpfzh.open" width="600px" append-to-body>
<el-form ref="scpfzhForm" :model="scpfzh.form" :rules="scpfzh.rules" label-width="110px">
<el-dialog title="生成评分账号" :visible.sync="scpfzhOpen" width="600px" append-to-body>
<el-form ref="scpfzhForm" :model="scpfzhForm" :rules="scpfzhRules" label-width="110px">
<el-form-item label="所属部门" prop="deptId">
<treeselect v-model="scpfzh.form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
<treeselect v-model="scpfzhForm.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
</el-form-item>
<el-form-item label="评分考核项" prop="items">
<el-select v-model="scpfzh.form.items" multiple value-key="id"
<el-form-item label="评分考核项" prop="votes">
<el-select v-model="scpfzhForm.votes" multiple value-key="id"
placeholder="请选择评分考核项" clearable style="width: 100%">
<el-option
v-for="dict in scpfzh.itemsOtions"
v-for="dict in scpfzhItemsOpts"
:key="dict.id"
:label="dict.itemName"
:label="dict.khitemName"
:value="dict"
/>
</el-select>
</el-form-item>
<el-form-item label="生成账号数量" prop="num">
<el-input-number v-model="scpfzh.form.num" :min="1" label="请输入生成账号数量"></el-input-number>
<el-input-number v-model="scpfzhForm.num" :min="1" label="请输入生成账号数量"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -584,11 +584,51 @@
</div>
</el-dialog>
<!-- 多任务评分账号生成对话框 -->
<el-dialog title="多任务评分账号生成" :visible.sync="drwScpfzhOpen" width="600px" append-to-body>
<el-form ref="drwScpfzhForm" :model="drwScpfzhForm" label-width="110px">
<el-form-item label="所属部门" prop="deptId" :rules="[
{ required: true, message: '所属部门不能为空', trigger: 'change' }
]">
<treeselect v-model="drwScpfzhForm.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
</el-form-item>
<div v-for="(item, index) in drwScpfzhForm.itemsOpt" style="padding-top: 10px;margin-bottom: 10px;">
<el-divider content-position="left">考核任务{{ item.pcName }}</el-divider>
<el-form-item label="评分考核项" :prop="'itemsOpt.' + index + '.selectVotes'"
:rules="{required: true, message: '评分考核项不能为空', trigger: 'blur'}">
<el-select v-model="item.selectVotes" multiple value-key="id" placeholder="请选择评分考核项"
clearable style="width: 100%">
<el-option
v-for="dict in item.votes"
:key="dict.id"
:label="dict.khitemName"
:value="dict"
/>
</el-select>
</el-form-item>
</div>
<el-form-item label="生成账号数量" prop="num" :rules="[
{ required: true, message: '生成账号数量不能为空', trigger: 'change' }
]">
<el-input-number v-model="drwScpfzhForm.num" :min="1" label="请输入生成账号数量"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="drwScpfzhSubmit"> </el-button>
<el-button @click="drwScpfzhCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPingce, getPingce, delPingce, addPingce, updatePingce, getItemVote, addsUser, generateResult } from "@/api/kaohe/pingce"
import { listPingce, getPingce, delPingce, addPingce, updatePingce, getItemVote, addsUser, generateResult, pcItemVotes } from "@/api/kaohe/pingce"
import { listKh_result } from "@/api/kaohe/kh_result"
import { deptTreeSelect } from "@/api/system/user";
import { listTemplate } from "@/api/kaohe/template"
@ -625,6 +665,8 @@ export default {
//
loading: true,
//
selectedRows: [],
//
ids: [],
//
single: true,
@ -743,22 +785,25 @@ export default {
//
vote_options: [],
//
scpfzh:{
open: false,
form:{},
rules: {
deptId: [
{ required: true, message: "所属部门不能为空", trigger: "change" }
],
items: [
{ required: true, message: "评分考核项不能为空", trigger: "change" }
],
num: [
{ required: true, message: "生成账号数量不能为空", trigger: "change" }
],
},
itemsOtions: [],
scpfzhOpen: false,
scpfzhForm: {},
scpfzhRules: {
deptId: [
{ required: true, message: "所属部门不能为空", trigger: "change" }
],
votes: [
{ required: true, message: "评分考核项不能为空", trigger: "change" }
],
num: [
{ required: true, message: "生成账号数量不能为空", trigger: "change" }
],
},
//
scpfzhItemsOpts:[],
//
drwScpfzhOpen: false,
//
drwScpfzhForm: []
}
},
watch: {
@ -839,6 +884,7 @@ export default {
},
//
handleSelectionChange(selection) {
this.selectedRows = selection.map(item => item)
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
@ -1397,14 +1443,15 @@ export default {
},
//
handleAddsUser(row){
this.scpfzh.form = {
this.scpfzhForm = {
deptId: null,
pcId: row.id,
items: null,
itemIds: null,
pcNames: row.pcTitle,
voteIds: null,
votes: null,
num: null,
}
this.scpfzh.itemsOtions = []
this.scpfzhItemsOpts = [];
getItemVote({
id: row.templateId,
pingceId: row.id,
@ -1413,11 +1460,12 @@ export default {
response.data.items.forEach( item =>{
if(!item.vote){
flag = false
}else {
this.scpfzhItemsOpts.push(item.vote)
}
})
if(flag){
this.scpfzh.itemsOtions = response.data.items
this.scpfzh.open = true;
this.scpfzhOpen = true;
}else {
this.$alert(`还有未发布评分规则考核项,请发布评分规则都完成后再生成评分账号`, `提示`, {
type: 'Danger'
@ -1429,6 +1477,7 @@ export default {
viewUser(row){
this.$router.push({ path: '/system/user', query: { pcId: row.id}});
},
//
rwAddsUser(){
const ids = row.id || this.ids
this.$modal.confirm('是否确认清除该评分账号数据项?').then(function() {
@ -1446,11 +1495,17 @@ export default {
scpfzhSubmit(){
this.$refs["scpfzhForm"].validate(valid => {
if (valid) {
this.scpfzh.form.itemIds = this.scpfzh.form.items.map(item => item.id).join(",");
this.scpfzh.form.itemNames = this.scpfzh.form.items.map(item => item.itemName).join(",");
console.log(this.scpfzh.form);
addsUser(this.scpfzh.form).then(response => {
this.scpfzh.open = false;
this.scpfzhForm.voteIds = this.scpfzhForm.votes.map(item => item.id).join(",");
let itemNames = this.scpfzhForm.pcNames +''+ this.scpfzhForm.votes.map(item => item.khitemName).join(",");
addsUser({
deptId: this.scpfzhForm.deptId,
voteIds: this.scpfzhForm.voteIds,
pcId: this.scpfzhForm.pcId,
pcNames: this.scpfzhForm.pcNames,
num: this.scpfzhForm.num,
itemNames: itemNames,
}).then(response => {
this.scpfzhOpen = false;
this.$modal.msgSuccess("生成成功")
})
}
@ -1458,7 +1513,7 @@ export default {
},
//
scpfzhCancel(){
this.scpfzh.open = false;
this.scpfzhOpen = false;
},
/** 清除评分账号 */
handleDeleteUsers(row) {
@ -1473,7 +1528,106 @@ export default {
//
khdfExport(){
this.download('kaohe/kh_result/exportById?id='+this.khdf.id, {}, `${ this.khdf.pcName+''+new Date().getTime()}.xlsx`)
}
},
//
multipleTasksAddsUser(){
const ySelectedRows = this.selectedRows;
const selectedRows = [];
let flag = true;
for (let i = 0; i < ySelectedRows.length; i++) {
if (ySelectedRows[i].state==='1') {
selectedRows.push({
id: ySelectedRows[i].id,
pcTitle: ySelectedRows[i].pcTitle,
templateId: ySelectedRows[i].templateId
})
}else {
if (ySelectedRows[i].state==='0'){
this.$alert(`考核任务“${ySelectedRows[i].pcTitle}”是未开始状态,不能进行评分账号生成操作!`, `提示`, {
type: 'Danger'
})
}
if (ySelectedRows[i].state==='2'){
this.$alert(`考核任务“${ySelectedRows[i].pcTitle}”是已完成状态,不能进行评分账号生成操作!`, `提示`, {
type: 'Danger'
})
}
flag = false;
break;
}
}
if(flag){
pcItemVotes(selectedRows).then(response => {
let flag1 = true;
let pingceList = response.data;
let pingceList1=[];
for (let i = 0; i < pingceList.length; i++) {
let flag2 = true;
let Votes = [];
for (let y = 0; y < pingceList[i].items.length; y++) {
if(!pingceList[i].items[y].vote){
flag2 = false
this.$alert(
`考核任务“${pingceList[i].pcName}”中“${pingceList[i].items[y].itemName}”考核项还未发布,不能进行评分账号生成操作!`,
`提示`, {
type: 'Danger'
})
break; //
}else {
Votes.push(pingceList[i].items[y].vote)
}
}
if(!flag2){
flag1 = false
break; //
}else {
pingceList1.push({
pcName:pingceList[i].pcName,
votes: Votes,
selectVotes: null,
})
}
}
if(flag1){
let pcIds = this.ids.join(',')
let pcNames = pingceList1.map(item => item.pcName);
this.drwScpfzhForm = {
deptId: null,
pcIds: pcIds,
pcNames: pcNames.join(','),
num: null,
itemsOpt: pingceList1
}
this.drwScpfzhOpen = true;
}
})
}
},
//
drwScpfzhSubmit(){
this.$refs["drwScpfzhForm"].validate(valid => {
if (valid) {
this.drwScpfzhForm.itemsOpt.forEach(item=>{
item['khrwNames'] = item.pcName +''+ item.selectVotes.map(item1 => item1.khitemName).join('、');
})
let itemNames = this.drwScpfzhForm.itemsOpt.map(item1 => item1.khrwNames).join(';');
addsUser({
deptId: this.drwScpfzhForm.deptId,
pcIds: this.drwScpfzhForm.pcIds,
pcNames: this.drwScpfzhForm.pcNames,
num: this.drwScpfzhForm.num,
itemNames: itemNames,
}).then(response => {
this.drwScpfzhOpen = false;
this.$modal.msgSuccess("生成成功");
})
}
})
},
//
drwScpfzhCancel(){
this.drwScpfzhOpen = false;
},
}
}
</script>

@ -62,7 +62,19 @@
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="考核项" align="center" key="itemNames" prop="itemNames" v-if="columns[4].visible" :show-overflow-tooltip="true" min-width="200"/>
<el-table-column label="考核项" align="center" key="itemNames" prop="itemNames" v-if="columns[4].visible"
:show-overflow-tooltip="true" min-width="240">
<template slot-scope="scope">
<div v-if="scope.row.itemNames">
<div v-if="scope.row.itemNames.split(';').length>0">
<div v-for="item in scope.row.itemNames.split(';')">
{{ item }}
</div>
</div>
<div v-else>{{ scope.row.itemNames }}</div>
</div>
</template>
</el-table-column>
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[5].visible" width="120" />
<el-table-column label="状态" align="center" key="status" v-if="columns[6].visible">
<template slot-scope="scope">

Loading…
Cancel
Save