Merge branch 'master' into dev

This commit is contained in:
fan 2019-08-12 20:17:53 +08:00
commit e1c6d00a18
5 changed files with 194 additions and 220 deletions

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
/** 分页查找仿真任务*/ /** 分页查找个人录制的仿真任务*/
export function getQuestPageList(params) { export function getQuestPageList(params) {
return request({ return request({
url: `/api/quest/paging`, url: `/api/quest/paging`,
@ -53,3 +53,12 @@ export function updateMapLocation(id, data) {
data data
}); });
} }
/** 分页查找上线的仿真任务*/
export function getQuestPageListOnline(params) {
return request({
url: `/api/quest/paging/online`,
method: 'get',
params: params
});
}

View File

@ -337,9 +337,9 @@ export function getQuestRecord(group) {
} }
/** 加载任务*/ /** 加载任务*/
export function loadQuest(questId, group) { export function loadQuest(questId, memberId, group) {
return request({ return request({
url: `/api/simulation/${group}/quest/${questId}`, url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post' method: 'post'
}); });
} }

View File

@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
require('script-loader!file-saver'); require('script-loader!file-saver');
require('script-loader!@/utils/Blob'); require('@/utils/Blob');
import XLSX from 'xlsx'; import XLSX from 'xlsx';
import { translate } from '@/scripts/translate'; import { translate } from '@/scripts/translate';

View File

@ -1,36 +1,19 @@
<template> <template>
<div> <div>
<el-dialog <el-dialog title="剧本列表" :visible.sync="show" top="50px" width="70%" :before-doClose="doClose"
title="任务列表" :close-on-click-modal="false" :z-index="2000">
:visible.sync="show" <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm"
top="50px" :query-list="queryList">
width="70%" </QueryListPage>
:before-do-close="doClose"
:close-on-click-modal="false"
:z-index="2000"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog> </el-dialog>
<el-dialog <el-dialog title="角色选择" :visible.sync="roleShow" top="50px" width="350px" :before-do-close="roleDoClose"
title="角色选择" :close-on-click-modal="false" :z-index="5000">
:visible.sync="roleShow"
top="50px"
width="350px"
:before-do-close="roleDoClose"
:close-on-click-modal="false"
:z-index="5000"
>
<div> <div>
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="50px"> <el-form ref="ruleForm" :model="form" label-width="50px">
<el-form-item label="角色" prop="role"> <el-form-item label="角色" prop="role">
<el-select v-model="form.role" placeholder="请选择"> <el-select v-model="form.role" placeholder="请选择">
<el-option <el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id"
v-for="item in memberList" :disabled="checkDisabled(item.role)" />
:key="item.id"
:label="item.name"
:value="item.id"
:disabled="checkDisabled(item.role)"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -41,48 +24,36 @@
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getQuestPageList, getQuestByIdList } from '@/api/quest'; import { getQuestPageListOnline, getQuestByIdList } from '@/api/quest';
import { getSkinStyleList } from '@/api/management/mapskin'; import { listPublishMap } from '@/api/jmap/map';
export default { export default {
name: 'AddQuest', name: 'addQuest',
props: { props: {
trainings: { trainings: {
type: Array, type: Array,
default: () => {
return [];
}
}, },
detail: { detail: {
type: Object, type: Object,
default: () => {
return {};
}
} }
}, },
data() { data() {
return { return {
show: false, show: false,
roleShow: false, roleShow: false,
skinCodeList: [], mapList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
row: {}, row: {},
memberList: [],
form: { form: {
role: '' role: ''
}, },
rules: { memberList: [],
role: [
{ required: true, message: '请选择', trigger: 'change' }
]
},
queryForm: { queryForm: {
labelWidth: '80px', labelWidth: '80px',
reset: false, reset: false,
@ -101,15 +72,15 @@ export default {
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '地图',
prop: 'skinCode', prop: 'mapId',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['id', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '创建时间', title: '创建时间',
prop: 'createTime' prop: 'createTime',
}, },
{ {
type: 'button', type: 'button',
@ -117,10 +88,10 @@ export default {
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '加载剧本', name: '加载任务',
type: 'primary', type: 'primary',
handleClick: this.handleLoad handleClick: this.handleLoad
} },
] ]
} }
], ],
@ -129,7 +100,7 @@ export default {
}, },
currentModel: {} currentModel: {}
}; }
}, },
created() { created() {
this.loadInitData(); this.loadInitData();
@ -144,7 +115,7 @@ export default {
}, },
listQuest(params) { listQuest(params) {
params['skinCode'] = this.$route.query.skinStyle; params['skinCode'] = this.$route.query.skinStyle;
return getQuestPageList(params); return getQuestPageListOnline(params);
}, },
convertList(FromList, ToList, ChecktypeFunction) { convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) { if (FromList) {
@ -158,17 +129,17 @@ export default {
}, },
async loadInitData() { async loadInitData() {
// //
this.skinCodeList = []; this.mapList = [];
getSkinStyleList().then(response => { listPublishMap().then(response => {
this.skinCodeList = response.data; this.mapList = response.data;
}); })
}, },
convertField(fieldValue, enumList, converFormat) { convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) { if (converFormat && converFormat.length >= 2) {
const value = converFormat[0]; let value = converFormat[0];
const label = converFormat[1]; let label = converFormat[1];
for (let i = 0; i < enumList.length; i++) { for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) { if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label]; return enumList[i][label];
} }
@ -181,7 +152,7 @@ export default {
const res = await getQuestByIdList(row.id); const res = await getQuestByIdList(row.id);
if (res.code == 200) { if (res.code == 200) {
this.memberList = res.data.memberVOList; this.memberList = res.data.memberVOList;
this.memberList.unshift({id: '', name: '观众', role: 'Dispatcher'}); this.memberList.unshift({ id: '', name: '', role: 'Dispatcher' });
} }
this.roleShow = true; this.roleShow = true;
}, },
@ -193,13 +164,9 @@ export default {
}, },
confirm() { confirm() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.$emit('selectQuest', this.row, this.form.role); this.$emit('selectQuest', this.row, this.form.role);
this.doClose(); this.doClose();
this.roleDoClose(); this.roleDoClose();
}
});
}, },
roleDoClose() { roleDoClose() {
@ -209,15 +176,13 @@ export default {
checkDisabled(role) { checkDisabled(role) {
if(this.$route.query.prdType == '01'){ if(this.$route.query.prdType == '01'){
return role != 'Attendant'; return role !== 'Attendant';
} else if (this.$route.query.prdType == '02'){ } else if (this.$route.query.prdType == '02'){
return role != 'Dispatcher'; return role !== 'Dispatcher';
}else if (this.$route.query.prdType == '04'){ }else if (this.$route.query.prdType == '04'){
return role !== 'Driver'; return role !== 'Driver';
}else {
return false;
} }
} }
} }
}; }
</script> </script>

View File

@ -449,8 +449,8 @@ export default {
this.$refs.addQuest.doShow(); this.$refs.addQuest.doShow();
}, },
// //
async selectQuest(row, role) { async selectQuest(row, id) {
const res = await loadQuest(row.id, this.group); let res = await loadQuest(row.id, id, this.group);
if (res && res.code == 200) { if (res && res.code == 200) {
this.questId = parseInt(row.id); this.questId = parseInt(row.id);
if(res.data && res.data.mapLocation) { if(res.data && res.data.mapLocation) {