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,11 +337,11 @@ 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,223 +1,188 @@
<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" </el-dialog>
:close-on-click-modal="false" <el-dialog title="角色选择" :visible.sync="roleShow" top="50px" width="350px" :before-do-close="roleDoClose"
:z-index="2000" :close-on-click-modal="false" :z-index="5000">
> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <el-form ref="ruleForm" :model="form" label-width="50px">
</el-dialog> <el-form-item label="角色" prop="role">
<el-dialog <el-select v-model="form.role" placeholder="请选择">
title="角色选择" <el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id"
:visible.sync="roleShow" :disabled="checkDisabled(item.role)" />
top="50px" </el-select>
width="350px" </el-form-item>
:before-do-close="roleDoClose" </el-form>
:close-on-click-modal="false" </div>
:z-index="5000" <span slot="footer" class="dialog-footer">
> <el-button @click="roleDoClose"> </el-button>
<div> <el-button type="primary" @click="confirm"> </el-button>
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="50px"> </span>
<el-form-item label="角色" prop="role"> </el-dialog>
<el-select v-model="form.role" placeholder="请选择"> </div>
<el-option
v-for="item in memberList"
:key="item.id"
:label="item.name"
:value="item.id"
:disabled="checkDisabled(item.role)"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="roleDoClose"> </el-button>
<el-button type="primary" @click="confirm"> </el-button>
</span>
</el-dialog>
</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: {
} type: Object,
}, }
detail: { },
type: Object, data() {
default: () => { return {
return {}; show: false,
} roleShow: false,
} mapList: [],
}, pagerConfig: {
data() { pageSize: 'pageSize',
return { pageIndex: 'pageNum'
show: false, },
roleShow: false, row: {},
skinCodeList: [], form: {
pagerConfig: { role: ''
pageSize: 'pageSize', },
pageIndex: 'pageNum' memberList: [],
}, queryForm: {
row: {}, labelWidth: '80px',
memberList: [], reset: false,
form: { show: false,
role: '' queryObject: {
},
rules: {
role: [
{ required: true, message: '请选择', trigger: 'change' }
]
},
queryForm: {
labelWidth: '80px',
reset: false,
show: false,
queryObject: {
} }
}, },
queryList: { queryList: {
query: this.listQuest, query: this.listQuest,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '任务名称', title: '任务名称',
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',
title: '操作', title: '操作',
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '加载剧本', name: '加载任务',
type: 'primary', type: 'primary',
handleClick: this.handleLoad handleClick: this.handleLoad
} },
] ]
} }
], ],
actions: [ actions: [
] ]
}, },
currentModel: {} currentModel: {}
}; }
}, },
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
doShow() { doShow() {
this.show = true; this.show = true;
this.reloadTable(); this.reloadTable();
}, },
doClose() { doClose() {
this.show = false; this.show = false;
}, },
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) {
ToList.length = 0; ToList.length = 0;
FromList.forEach(elem => { FromList.forEach(elem => {
if (ChecktypeFunction(elem)) { if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name }); ToList.push({ value: elem.code, label: elem.name });
} }
}); });
} }
}, },
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];
} }
} }
} }
}, },
async handleLoad(index, row) { async handleLoad(index, row) {
this.row = row; this.row = row;
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;
}, },
reloadTable() { reloadTable() {
if (this.queryList && this.queryList.reload) { if (this.queryList && this.queryList.reload) {
this.queryList.reload(); this.queryList.reload();
} }
}, },
confirm() { confirm() {
this.$refs['ruleForm'].validate((valid) => { this.$emit('selectQuest', this.row, this.form.role);
if (valid) { this.doClose();
this.$emit('selectQuest', this.row, this.form.role); this.roleDoClose();
this.doClose(); },
this.roleDoClose();
}
});
},
roleDoClose() { roleDoClose() {
this.$refs['ruleForm'].resetFields(); this.$refs['ruleForm'].resetFields();
this.roleShow = false; this.roleShow = false;
}, },
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,14 +449,14 @@ 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) {
let mapLocation={"offsetX":res.data.mapLocation.x,"offsetY":res.data.mapLocation.y,"scaleRate":res.data.mapLocation.scale}; let mapLocation={"offsetX":res.data.mapLocation.x,"offsetY":res.data.mapLocation.y,"scaleRate":res.data.mapLocation.scale};
Vue.prototype.$jlmap.setOptions(mapLocation) Vue.prototype.$jlmap.setOptions(mapLocation)
} }
} }
if (this.$refs.menuDemon) { if (this.$refs.menuDemon) {