单位调整

This commit is contained in:
fan 2020-12-01 15:19:26 +08:00
parent 42e37af6ed
commit ab7ff394ce
5 changed files with 200 additions and 11 deletions

View File

@ -39,3 +39,11 @@ export function getCompanyListPaging(params) {
params
});
}
/** 设定公司管理人员 */
export function setCompanyManager(companyId, data) {
return request({
url: `/api/company/${companyId}/addManager`,
method: 'put',
data
});
}

View File

@ -112,7 +112,7 @@ export default {
actions: [
{ text: '添 加', handler: this.doCreate },
{ text: '导 入', fileType: 'file', handler: this.importQuestionBank },
{ text: '出题规则管理', handler: this.questionsRuleManage},
{ text: '试卷规则管理', handler: this.questionsRuleManage},
{ text: '模板导出', handler: this.exportTemplate}
]
}
@ -274,6 +274,7 @@ export default {
param.optionList.push({content:dataList[option4Index][index], correct: dataList[answerIndex][index].includes('D')});
}
}
param.id = questionList.length;
questionList.push(param);
}
});
@ -284,11 +285,6 @@ export default {
}).catch((e) => {
that.$message.error('导入题库失败!');
});
// importQuestionBand(questionList, 'DRTS').then(resp => {
// this.$message.success('!');
// }).catch(()=>{
// this.$message.error('');
// });
}
};
if (that.rABS) {

View File

@ -9,6 +9,7 @@
</div>
<div style="display: inline-block;">
<el-button
v-loading="loading"
size="mini"
type="primary"
@click="doSave"
@ -75,7 +76,6 @@
import { UrlConfig } from '@/scripts/ConstDic';
import { importQuestionBand } from '@/api/race';
import { getCompanyList } from '@/api/company';
export default {
data() {
return {
@ -83,7 +83,8 @@ export default {
tableData: [],
pageSize: 10,
companyId: '',
companyList: []
companyList: [],
loading: false
};
},
computed: {
@ -96,6 +97,7 @@ export default {
},
mounted() {
this.handlePreDataPaging();
this.loading = false;
getCompanyList().then(resp => {
this.companyList = resp.data;
});
@ -166,12 +168,45 @@ export default {
this.handlePreDataPaging();
},
doSave() {
this.loading = true;
let selectNum = 0;
let judgeNum = 0;
let multiNum = 0;
let fillNum = 0;
let answerNum = 0;
this.$store.state.race.preTheoryData.forEach(item => {
switch (item.type) {
case 'select':
selectNum++;
break;
case 'judge':
judgeNum++;
break;
case 'multi':
multiNum++;
break;
case 'fill':
fillNum++;
break;
case 'answer':
answerNum++;
break;
}
});
importQuestionBand(this.$store.state.race.preTheoryData, this.companyId).then(resp => {
this.$store.dispatch('race/setPreTheoryData', []);
this.$message.success('导入题库成功!');
// this.$message.success('!');
this.$alert(`<strong>本次导入:</strong><br><strong>${judgeNum}道判断题;</strong><br><strong>${selectNum}道选择题;</strong><br><strong>${multiNum}道多选题;</strong><br>`, '导入题库成功!', {
dangerouslyUseHTMLString: true,
type: 'success',
center: true
});
this.$router.go(-1);
this.loading = false;
}).catch(()=>{
this.$message.error('导入题库失败!');
this.loading = false;
});
},
doCancel() {

View File

@ -2,6 +2,7 @@
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-company ref="editCompany" @reloadTable="reloadTable" />
<company-manager ref="companyManager" />
<qr-code ref="qrCode" />
</div>
</template>
@ -10,11 +11,13 @@
import { getCompanyListPaging, deleteCompany } from '@/api/company';
import EditCompany from './add';
import QrCode from '@/components/QrCode';
import CompanyManager from './manager';
export default {
name: 'CompanyManage',
components: {
EditCompany,
QrCode
QrCode,
CompanyManager
},
data() {
return {
@ -45,15 +48,23 @@ export default {
title: '单位地址',
prop: 'address'
},
{
title: '单位管理人员',
prop: ''
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
width: '370',
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.handleUpdate
},
{
name: '绑定管理人员',
handleClick: this.setManager
},
{
name: '生成二维码',
handleClick: this.handleGenerateQrCode
@ -89,6 +100,9 @@ export default {
handleUpdate(index, row) {
this.$refs.editCompany.doShow(row);
},
setManager(index, row) {
this.$refs.companyManager.doShow(row.id);
},
reloadTable() {
this.queryList.reload();
},

View File

@ -0,0 +1,136 @@
<template>
<el-dialog
title="绑定单位管理人员"
:visible.sync="dialogVisible"
width="80%"
:before-close="handleClose"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getUserList } from '@/api/management/user';
import { getCompanyList, setCompanyManager } from '@/api/company';
export default {
name: 'Manager',
data() {
return {
dialogVisible: false,
companyId: '',
companyMap: {},
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: this.$t('system.name')
},
roles: {
type: 'select',
label: this.$t('system.roles'),
config: {
data: this.$ConstSelect.roleList
}
}
}
},
queryList: {
query: getUserList,
beforeQuery: this.addParams,
onSelectionChange: this.handleSelectionChange,
selectAllClick: this.selectAllClick,
selectCheckShow: true,
columns: [
{
title: this.$t('system.name'),
prop: 'name'
},
{
title: this.$t('system.nickname'),
prop: 'nickname'
},
{
title: this.$t('global.mobile'),
prop: 'mobile'
},
{
title: this.$t('global.email'),
prop: 'email'
},
{
title: '单位',
prop: 'companyId',
type: 'tag',
columnValue: (row) => { return this.getCompanyName(row.companyId); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.roles'),
prop: 'roles',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label'], true); },
tagType: (row) => { return 'success'; }
}
]
}
};
},
created() {
this.companyMap = {};
getCompanyList().then(resp => {
if (resp && resp.data && resp.data.length) {
resp.data.forEach(item => {
this.companyMap[item.id] = item.name;
});
}
}).catch((error) => {
console.error(error);
});
},
methods: {
doShow(companyId) {
this.dialogVisible = true;
this.companyId = companyId;
},
handleClose() {
this.dialogVisible = false;
this.companyId = '';
},
getCompanyName(companyId) {
return this.companyMap[companyId];
},
reloadTable() {
this.queryList.reload();
},
addParams(params) {
params.companyId = this.companyId;
return params;
},
handleSelectionChange(val) {
},
selectAllClick(val) {
const userIds = [];
val && val.forEach(item => {
userIds.push(item.id);
});
setCompanyManager(this.companyId, userIds).then(resp => {
this.$message.success('绑定单位管理员成功!');
}).catch(error => {
this.$message.error('绑定单位管理员失败!');
console.error(error);
});
}
}
};
</script>
<style scoped>
</style>