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';
/** 分页查找仿真任务*/
/** 分页查找个人录制的仿真任务*/
export function getQuestPageList(params) {
return request({
url: `/api/quest/paging`,
@ -53,3 +53,12 @@ export function updateMapLocation(id, 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({
url: `/api/simulation/${group}/quest/${questId}`,
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
}

View File

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

View File

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

View File

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