desc: 调整剧本加载,删除城市注释

This commit is contained in:
zyy 2019-08-01 15:19:24 +08:00
parent 4be4c87327
commit ff9e69585d
9 changed files with 965 additions and 869 deletions

View File

@ -2,39 +2,46 @@ import request from '@/utils/request';
/** 分页查找仿真任务*/
export function getQuestPageList(params) {
return request({
url: `/api/quest/paging`,
method: 'get',
params: params
});
return request({
url: `/api/quest/paging`,
method: 'get',
params: params
});
}
/** 创建任务 */
export function createQuest(data) {
return request({
url: `/api/quest`,
method: 'post',
data
});
return request({
url: `/api/quest`,
method: 'post',
data
});
}
/** 根据任务id删除任务 */
export function deleteQuest(id) {
return request({
url: `/api/quest/${id}`,
method: 'delete'
});
return request({
url: `/api/quest/${id}`,
method: 'delete'
});
}
/** 根据id查询任务基础信息 */
export function getQuestById(id) {
return request({
url: `/api/quest/${id}`,
method: 'get',
});
return request({
url: `/api/quest/${id}`,
method: 'get'
});
}
/** 根据id查询任务基础信息 */
export function getQuestByIdList(id) {
return request({
url: `/api/quest/${id}/detail`,
method: 'get'
});
}
/** 更新任务基本信息 */
export function updateQuest(id, data) {
return request({
url: `/api/quest/${id}`,
method: 'put',
data
});
return request({
url: `/api/quest/${id}`,
method: 'put',
data
});
}

View File

@ -1,8 +1,9 @@
const mapDeviceStyle = {
// '01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'bejing_01',
'04': 'chengdu_03',
'05': 'batong_01'
'05': 'batong_01' // 暂时没有画北京八通线
};
export function selectSkinStyle(code) {

View File

@ -1,14 +1,14 @@
export function getBaseUrl() {
let BASE_API
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'
BASE_API = 'https://test.joylink.club/jlcloud'
// BASE_API = 'http://192.168.3.5:9010' // 袁琪
// BASE_API = 'http://192.168.3.6:9010' // 旭强
// BASE_API = 'http://192.168.3.6:9010'; // 旭强
// BASE_API = 'http://192.168.3.4:9010' // 琰培
} else {
BASE_API = process.env.VUE_APP_BASE_API
BASE_API = process.env.VUE_APP_BASE_API;
}
return BASE_API
return BASE_API;
}

View File

@ -1,137 +1,211 @@
<template>
<el-dialog title="任务列表" :visible.sync="show" top="50px" width="70%" :before-doClose="doClose"
:close-on-click-modal="false">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList">
</QueryListPage>
<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>
<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-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="item.role != 'Dispatcher'"
/>
</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>
<script>
import { getQuestPageList } from '@/api/quest';
import { getSkinStyleList } from '@/api/management/mapskin'
import { getQuestPageList, getQuestByIdList } from '@/api/quest';
import { getSkinStyleList } from '@/api/management/mapskin';
export default {
name: 'addQuest',
props: {
trainings: {
type: Array,
},
detail: {
type: Object,
}
},
data() {
return {
show: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: false,
show: false,
queryObject: {
export default {
name: 'AddQuest',
props: {
trainings: {
type: Array,
default: () => {
return [];
}
},
detail: {
type: Object,
default: () => {
return {};
}
}
},
data() {
return {
show: false,
roleShow: false,
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
row: {},
memberList: [],
form: {
role: ''
},
rules: {
role: [
{ required: true, message: '请选择', trigger: 'change' }
]
},
queryForm: {
labelWidth: '80px',
reset: false,
show: false,
queryObject: {
}
},
queryList: {
query: this.listQuest,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '任务名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => { return this.convertField(row.skinCode, this.skinCodeList, ['code', 'name']) },
tagType: (row) => { return 'success' }
},
{
title: '创建时间',
prop: 'createTime',
},
{
type: 'button',
title: '操作',
width: '250',
buttons: [
{
name: '加载任务',
type: 'primary',
handleClick: this.handleLoad
},
]
}
],
actions: [
]
},
}
},
queryList: {
query: this.listQuest,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '任务名称',
prop: 'name'
},
{
title: '皮肤类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => { return this.convertField(row.skinCode, this.skinCodeList, ['code', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: '创建时间',
prop: 'createTime'
},
{
type: 'button',
title: '操作',
width: '250',
buttons: [
{
name: '加载剧本',
type: 'primary',
handleClick: this.handleLoad
}
]
}
],
actions: [
]
},
currentModel: {}
}
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
listQuest(params) {
params['skinCode'] = this.$route.query.skinStyle;
return getQuestPageList(params);
},
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
async loadInitData() {
//
this.skinCodeList = [];
getSkinStyleList().then(response => {
this.skinCodeList = response.data;
})
},
currentModel: {}
};
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
listQuest(params) {
params['skinCode'] = this.$route.query.skinStyle;
return getQuestPageList(params);
},
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
async loadInitData() {
//
this.skinCodeList = [];
getSkinStyleList().then(response => {
this.skinCodeList = response.data;
});
},
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
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];
}
}
}
},
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++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
async handleLoad(index, row) {
this.row = row;
const res = await getQuestByIdList(row.id);
if (res.code == 200) {
this.memberList = res.data.memberVOList;
this.memberList.unshift({id: '', name: '观众', role: 'Dispatcher'});
}
this.roleShow = true;
},
handleLoad(index, row) {
this.$emit('selectQuest', row);
this.doClose();
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
}
}
</script>
confirm() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.$emit('selectQuest', this.row, this.form.role);
this.doClose();
this.roleDoClose();
}
});
},
roleDoClose() {
this.$refs['ruleForm'].resetFields();
this.roleShow = false;
}
}
};
</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,145 +1,149 @@
<template>
<div class="schema" :style="{top: offset+'px'}">
<el-select size="small" v-model="swch" v-if="isScript" @change="switchMode" placeholder="请选择产品类型">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value">
</el-option>
</el-select>
<div class="schema" :style="{top: offset+'px'}">
<el-select v-if="isScript" v-model="swch" size="small" placeholder="请选择产品类型" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-button-group>
<el-button size="small" @click="viewRunQuest" v-if="isDemon" :disabled="viewDisabled" type="success">加载任务
</el-button>
<el-button size="small" @click="viewRunPlan" v-if="runing" :disabled="viewDisabled">运行图预览</el-button>
<el-button size="small" @click="loadRunPlan" v-if="!runing && !isPlan" :disabled="viewDisabled"
type="warning">运行图加载</el-button>
<el-button size="small" @click="setFault" v-if="mode==OperateMode.FAULT" type="danger">故障设置</el-button>
</el-button-group>
<el-button-group>
<el-button v-if="isDemon" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">加载剧本
</el-button>
<el-button v-if="runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">运行图预览</el-button>
<el-button
v-if="!runing && !isPlan"
size="small"
:disabled="viewDisabled"
type="warning"
@click="loadRunPlan"
>运行图加载</el-button>
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">故障设置</el-button>
</el-button-group>
<el-radio-group size="small" v-model="mode" v-if="!isPlan" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">正常操作</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">故障操作</el-radio-button>
</el-radio-group>
</div>
<el-radio-group v-if="!isPlan" v-model="mode" size="small" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">正常操作</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">故障操作</el-radio-button>
</el-radio-group>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { getStationListBySkinStyle, queryRunPlan } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { getStationListBySkinStyle, queryRunPlan } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation';
export default {
name: 'MenuSchema',
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
}
},
data() {
return {
mode: OperateMode.NORMAL,
OperateMode: OperateMode,
viewDisabled: true,
runing: false,
swch: '02',
swchList: [
{ value: '01', name: '现地' },
{ value: '02', name: '行调' },
]
}
},
computed: {
...mapGetters('runPlan', [
'stations',
]),
isPlan() {
return this.$route.params.mode === 'plan';
},
isScript() {
return this.$route.params.mode === 'script';
},
isDemon() {
return this.$route.params.mode === 'demon';
},
},
watch: {
'$store.state.training.started': function (val) {
this.setRuning(val);
},
'$store.state.training.switchcount': async function () {
if (this.group) {
let started = this.$store.state.training.started;
if (started) {
await this.loadRunData(this.$route.query);
}
}
},
},
async mounted() {
await this.loadRunData(this.$route.query);
},
methods: {
loadRunData(opt) {
this.$store.dispatch('runPlan/clear').then(() => {
if (opt && opt.skinStyle) {
this.viewDisabled = true;
getStationListBySkinStyle(opt.skinStyle).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
if (this.$route.params.mode == 'plan') {
//
queryRunPlan(this.$route.query.planId).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.viewDisabled = false;
}).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []);
this.$messageBox(`获取运行图数据失败`);
})
} else {
getEveryDayRunPlanData(this.group).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.viewDisabled = false;
}).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []);
if (error.code == 30001) {
this.$messageBox(`今日运行图未加载`);
} else {
this.$messageBox(`获取运行图数据失败`);
}
})
}
})
}).catch(error => {
this.$messageBox(`获取车站列表失败`);
});
}
})
},
changeOperateMode(handle) {
this.$store.dispatch('training/changeOperateMode', { mode: handle });
},
setRuning(run) {
this.runing = run;
},
setFault() {
this.$emit('faultChooseShow')
},
loadRunPlan() {
this.$emit('runPlanLoadShow');
},
viewRunPlan() {
this.$emit('runPlanViewShow');
},
viewRunQuest() {
this.$emit('runQuestLoadShow');
},
switchMode(swch) {
this.$emit('switchMode', swch);
}
}
}
export default {
name: 'MenuSchema',
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
}
},
data() {
return {
mode: OperateMode.NORMAL,
OperateMode: OperateMode,
viewDisabled: true,
runing: false,
swch: '02',
swchList: [
{ value: '01', name: '现地' },
{ value: '02', name: '行调' }
]
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
isPlan() {
return this.$route.params.mode === 'plan';
},
isScript() {
return this.$route.params.mode === 'script';
},
isDemon() {
return this.$route.params.mode === 'demon';
}
},
watch: {
'$store.state.training.started': function (val) {
this.setRuning(val);
},
'$store.state.training.switchcount': async function () {
if (this.group) {
const started = this.$store.state.training.started;
if (started) {
await this.loadRunData(this.$route.query);
}
}
}
},
async mounted() {
await this.loadRunData(this.$route.query);
},
methods: {
loadRunData(opt) {
this.$store.dispatch('runPlan/clear').then(() => {
if (opt && opt.skinStyle) {
this.viewDisabled = true;
getStationListBySkinStyle(opt.skinStyle).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
if (this.$route.params.mode == 'plan') {
//
queryRunPlan(this.$route.query.planId).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.viewDisabled = false;
}).catch(() => {
this.$store.dispatch('runPlan/setPlanData', []);
this.$messageBox(`获取运行图数据失败`);
});
} else {
getEveryDayRunPlanData(this.group).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.viewDisabled = false;
}).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []);
if (error.code == 30001) {
this.$messageBox(`今日运行图未加载`);
} else {
this.$messageBox(`获取运行图数据失败`);
}
});
}
});
}).catch(() => {
this.$messageBox(`获取车站列表失败`);
});
}
});
},
changeOperateMode(handle) {
this.$store.dispatch('training/changeOperateMode', { mode: handle });
},
setRuning(run) {
this.runing = run;
},
setFault() {
this.$emit('faultChooseShow');
},
loadRunPlan() {
this.$emit('runPlanLoadShow');
},
viewRunPlan() {
this.$emit('runPlanViewShow');
},
viewRunQuest() {
this.$emit('runQuestLoadShow');
},
switchMode(swch) {
this.$emit('switchMode', swch);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.schema {
@ -152,4 +156,4 @@
/deep/ .el-button+.el-button {
margin-left: 0px;
}
</style>
</style>

View File

@ -1,85 +1,84 @@
<template>
<div class="reminder-drag" v-drag>
<div class="reminder-box" ref="drapBox">
<div class="tip-title">
<i class="icon el-icon-minus" @click="shrink" v-show="isShrink"></i>
<i class="icon el-icon-plus" @click="shrink" v-show="!isShrink"></i>
<p style="color: #fff;" v-if="isShrink">
<span>{{ formModel.name }}</span>
</p>
</div>
<div class="tip-body-box" ref="dragBody">
<div class="tip-body">
<el-scrollbar wrapClass="scrollbar-wrapper">
<p class="list-item">
<span class="list-label">任务描述</span>
<span class="list-elem">{{ formModel.description }}</span>
</p>
</el-scrollbar>
</div>
<div class="drag-right"></div>
<div class="drag-left"></div>
<div class="drag-bottom"></div>
<div class="drag-top"></div>
</div>
<div v-drag class="reminder-drag">
<div ref="drapBox" class="reminder-box">
<div class="tip-title">
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
<p v-if="isShrink" style="color: #fff;">
<span>{{ formModel.name }}</span>
</p>
</div>
<div ref="dragBody" class="tip-body-box">
<div class="tip-body">
<el-scrollbar wrap-class="scrollbar-wrapper">
<p class="list-item">
<span class="list-label">任务描述</span>
<span class="list-elem">{{ formModel.description }}</span>
</p>
</el-scrollbar>
</div>
<div class="drag-right" />
<div class="drag-left" />
<div class="drag-bottom" />
<div class="drag-top" />
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getQuestById } from '@/api/quest';
import { getQuestById } from '@/api/quest';
export default {
name: 'TipQuestDetail',
props: {
questId: {
type: Number,
required: true
}
},
data() {
return {
isShrink: true,
formModel: {
name: '',
description: ''
}
}
},
computed: {
},
watch: {
'questId': function (val) {
this.loadInitData(val);
}
},
mounted() { },
methods: {
loadInitData(questId) {
if (questId) {
getQuestById(questId).then(resp => {
this.formModel = resp.data;
}).catch(error => {
this.$messageBox('获取任务信息失败');
});
}
},
shrink() {
let height = this.$refs.dragBody.offsetHeight + 40;
let top = this.$refs.drapBox.style.top;
if (this.isShrink) {
this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = '';
this.isShrink = false;
} else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true;
}
}
}
}
export default {
name: 'TipQuestDetail',
props: {
questId: {
type: Number,
required: true
}
},
data() {
return {
isShrink: true,
formModel: {
name: '',
description: ''
}
};
},
computed: {
},
watch: {
'questId': function (val) {
this.loadInitData(val);
}
},
mounted() { },
methods: {
loadInitData(questId) {
if (questId) {
getQuestById(questId).then(resp => {
this.formModel = resp.data;
}).catch(() => {
this.$messageBox('获取任务信息失败');
});
}
},
shrink() {
const height = this.$refs.dragBody.offsetHeight + 40;
const top = this.$refs.drapBox.style.top;
if (this.isShrink) {
this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = '';
this.isShrink = false;
} else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true;
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -201,4 +200,4 @@
}
}
}
</style>
</style>

View File

@ -215,11 +215,11 @@ export default {
},
initLoadData() {
this.cityList = [];
// this.$Dictionary.cityType().then(list => {
// this.cityList = list;
// }).catch(() => {
// this.$messageBox('');
// });
this.$Dictionary.cityType().then(list => {
this.cityList = list;
}).catch(() => {
this.$messageBox('加载城市列表失败');
});
this.skinStyleList = [];
getSkinStyleList().then(response => {

View File

@ -1,15 +1,15 @@
'use strict'
;
// import { getBasePathConfig } from '@/utils/baseUrl'
const path = require('path')
const defaultSettings = require('./src/settings.js')
const path = require('path');
const defaultSettings = require('./src/settings.js');
function resolve(dir) {
return path.join(__dirname, dir)
return path.join(__dirname, dir);
}
const name = defaultSettings.title // page title
const port = 9527 // dev port
const name = defaultSettings.title; // page title
const port = 9527; // dev port
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
@ -56,14 +56,14 @@ module.exports = {
}
},
chainWebpack(config) {
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.plugins.delete('preload'); // TODO: need test
config.plugins.delete('prefetch'); // TODO: need test
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
.end();
config.module
.rule('icons')
.test(/\.svg$/)
@ -74,7 +74,7 @@ module.exports = {
.options({
symbolId: 'icon-[name]'
})
.end()
.end();
// set preserveWhitespace
config.module
@ -82,16 +82,16 @@ module.exports = {
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
options.compilerOptions.preserveWhitespace = true;
return options;
})
.end()
.end();
config
// https://webpack.js.org/configuration/devtool/#development
.when(process.env.NODE_ENV === 'development',
config => config.devtool('cheap-source-map')
)
);
config
.when(process.env.NODE_ENV !== 'development',
@ -103,7 +103,7 @@ module.exports = {
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
.end()
.end();
config
.optimization.splitChunks({
chunks: 'all',
@ -127,9 +127,9 @@ module.exports = {
reuseExistingChunk: true
}
}
})
config.optimization.runtimeChunk('single')
});
config.optimization.runtimeChunk('single');
}
)
);
}
}
};