desc: 修改代码

This commit is contained in:
zyy 2019-11-15 16:31:48 +08:00
parent 1b564c2958
commit 9bfad2fdeb
17 changed files with 1489 additions and 1140 deletions

View File

@ -61,3 +61,20 @@ export function getDetailList(code) {
} }
}); });
} }
// 根据线路code分页查询指令
export function getCommandList(parmas) {
return request({
url: '/api/cmd',
method: 'get',
params: parmas
});
}
// 根据线路code分页查询指令
export function delCommand(id) {
return request({
url: `/api/cmd/${id}`,
method: 'delete'
});
}

View File

@ -68,5 +68,6 @@ export default {
scriptReleaseApplication: 'Script release application', scriptReleaseApplication: 'Script release application',
runGraphReleaseApplication: 'Run graph release application', runGraphReleaseApplication: 'Run graph release application',
subsystemGeneration: 'Subsystem generation', subsystemGeneration: 'Subsystem generation',
newsBulletin: 'New bulletin' newsBulletin: 'New bulletin',
commandDictionary: 'Command dictionary'
}; };

View File

@ -53,5 +53,13 @@ export default {
newsHeadlines: 'News headlines:', newsHeadlines: 'News headlines:',
newsContent: 'News content:', newsContent: 'News content:',
whetherTheNewsCanBeClosed: 'Whether the news can be closed:', whetherTheNewsCanBeClosed: 'Whether the news can be closed:',
push: 'Push' push: 'Push',
controlMode: 'Control mode',
deviceType: 'Device type',
lineCode: 'Line code',
simulationRole: 'Simulation role',
instructionType: 'type of instruction',
paramDetail: 'Check Parameters',
createDirective: '新增指令',
editDirective: '修改指令'
}; };

View File

@ -69,5 +69,6 @@ export default {
scriptReleaseApplication: '剧本发布申请', scriptReleaseApplication: '剧本发布申请',
runGraphReleaseApplication: '运行图发布申请', runGraphReleaseApplication: '运行图发布申请',
subsystemGeneration: '子系统生成', subsystemGeneration: '子系统生成',
newsBulletin: '消息公告' newsBulletin: '消息公告',
commandDictionary: '命令字典'
}; };

View File

@ -53,5 +53,13 @@ export default {
newsHeadlines: '消息标题:', newsHeadlines: '消息标题:',
newsContent: '消息内容:', newsContent: '消息内容:',
whetherTheNewsCanBeClosed: '消息是否可关闭:', whetherTheNewsCanBeClosed: '消息是否可关闭:',
push: '推送' push: '推送',
controlMode: '控制模式',
deviceType: '设备类型',
lineCode: '线路编号',
simulationRole: '仿真角色',
instructionType: '指令类型',
paramDetail: '查看参数',
createDirective: '新增指令',
editDirective: '修改指令'
}; };

View File

@ -107,6 +107,10 @@ class Jlmap {
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); } if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); }
} }
setMapDevice(mapDevice) {
this.mapDevice = mapDevice;
}
setDefaultState() { setDefaultState() {
const list = []; const list = [];

View File

@ -31,6 +31,7 @@ const CacheControl = () => import('@/views/system/cacheControl/index');
const SystemGenerate = () => import('@/views/system/systemGenerate/index'); const SystemGenerate = () => import('@/views/system/systemGenerate/index');
const IbpDraw = () => import('@/views/system/ibpDraw/index'); const IbpDraw = () => import('@/views/system/ibpDraw/index');
const News = () => import('@/views/system/news/index'); const News = () => import('@/views/system/news/index');
const CommandDictionary = () => import('@/views/system/commandDictionary/index');
const Mapedit = () => import('@/views/mapdraft/index'); const Mapedit = () => import('@/views/mapdraft/index');
@ -806,12 +807,19 @@ export const asyncRouter = [
i18n: 'router.productEdit' i18n: 'router.productEdit'
} }
}, },
{ { // 消息公告
path: 'news', path: 'news',
component: News, component: News,
meta: { meta: {
i18n: 'router.newsBulletin' i18n: 'router.newsBulletin'
} }
},
{ // 命令管理
path: 'commands',
component: CommandDictionary,
meta: {
i18n: 'router.commandDictionary'
}
} }
] ]
}, },

View File

@ -4,6 +4,7 @@ const exam = {
namespaced: true, namespaced: true,
state: { state: {
deviceCode: '', // 考试目标code
started: false, // 考试状态 started: false, // 考试状态
usedTime: 0, // 考试当前所用时间 usedTime: 0, // 考试当前所用时间
totalTime: 0, // 考试总时间 totalTime: 0, // 考试总时间
@ -65,6 +66,9 @@ const exam = {
}, },
setCourse: (state, courseList) => { setCourse: (state, courseList) => {
state.courseList = courseList; state.courseList = courseList;
},
setCenter: (state, deviceCode) => {
state.deviceCode = deviceCode;
} }
}, },
actions: { actions: {
@ -93,15 +97,11 @@ const exam = {
setSuspend({ commit }, suspend) { setSuspend({ commit }, suspend) {
commit('setSuspend', suspend); commit('setSuspend', suspend);
}, },
setUsedTime({ state }, usedTime) { setUsedTime({ commit }, usedTime) {
if (usedTime) { commit('setUsedTime', usedTime || 0);
state.usedTime = usedTime;
}
}, },
setTotalTime({ commit }, totalTime) { setTotalTime({ commit }, totalTime) {
if (totalTime) { commit('setTotalTime', totalTime || 0);
commit('setTotalTime', totalTime);
}
}, },
countUsedTime({ commit }) { countUsedTime({ commit }) {
commit('countUsedTime'); commit('countUsedTime');
@ -114,6 +114,9 @@ const exam = {
}, },
setCourse({ commit }, course) { setCourse({ commit }, course) {
commit('setCourse', course); commit('setCourse', course);
},
setCenter({ commit }, deviceCode) {
commit('setCenter', deviceCode);
} }
} }
}; };

View File

@ -530,6 +530,7 @@ const map = {
if (map && map.skinVO) { if (map && map.skinVO) {
state.map = map; state.map = map;
state.mapDevice = parser(map, map.skinVO.code); state.mapDevice = parser(map, map.skinVO.code);
Vue.prototype.$jlmap.setMapDevice(state.mapDevice);
} else { } else {
state.mapDevice = {}; state.mapDevice = {};
} }

View File

@ -3,11 +3,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 杜闪 // BASE_API = 'http://192.168.3.41:9000'; // 杜闪
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;
} }

View File

@ -20,7 +20,7 @@
import TipExamList from './tipExamList'; import TipExamList from './tipExamList';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { startTraining } from '@/api/jmap/training'; import { startTraining } from '@/api/jmap/training';
import { exitFullscreen } from '@/utils/screen'; // import { exitFullscreen } from '@/utils/screen';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam'; import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';

View File

@ -148,7 +148,7 @@ export default {
} }
}); });
if (obj) { if (obj) {
getTrainingDetail(obj.trainingId ).then(res => { getTrainingDetail(obj.trainingId).then(res => {
this.courseModel = { this.courseModel = {
id: res.data.id, id: res.data.id,
name: res.data.name, name: res.data.name,
@ -157,6 +157,7 @@ export default {
minDuration: res.data.minDuration, minDuration: res.data.minDuration,
updateTime: res.data.updateTime updateTime: res.data.updateTime
}; };
this.$store.dispatch('exam/setCenter ', res.data.locateDeviceCode);
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message); this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
}); });

View File

@ -89,6 +89,9 @@ export default {
'$store.state.training.rezoomCount': function (val, old) { '$store.state.training.rezoomCount': function (val, old) {
this.setCenter(this.$store.state.training.offsetStationCode); this.setCenter(this.$store.state.training.offsetStationCode);
}, },
'$store.state.exam.deviceCode': function (val) {
val && this.setCenter(val);
},
'$store.state.config.canvasSizeCount': function (val) { '$store.state.config.canvasSizeCount': function (val) {
this.resetSize(); this.resetSize();
}, },

View File

@ -0,0 +1,131 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { create, getData, update } from '@/api/management/dictionary';
export default {
name: 'DictionaryEdit',
props: {
type: {
type: String,
required: true
}
},
data() {
return {
dialogVisible: false,
formModel: {
code: '',
name: '',
status: '1',
remarks: ''
}
};
},
computed: {
form() {
const isAdd = this.type === 'ADD';
const form = {
labelWidth: '120px',
items: [
{ prop: 'controlMode', label: this.$t('system.controlMode'), type: 'text', required: true, disabled: !isAdd },
{ prop: 'deviceType', label: this.$t('system.deviceType'), type: 'select', required: true, options: this.$ConstSelect.Status },
{ prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', required: true, options: this.$ConstSelect.Status },
{ prop: 'role', label: this.$t('system.simulationRole'), type: 'select', required: true, options: this.$ConstSelect.Status },
{ prop: 'type', label: this.$t('system.instructionType'), type: 'select', required: true, options: this.$ConstSelect.Status }
]
};
return form;
},
rules() {
return {
controlMode: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
deviceType: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
lineCode: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
role: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
type: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
]
};
},
title() {
if (this.type === 'ADD') {
return this.$t('system.createDirective');
} else {
return this.$t('system.editDirective');
}
}
},
methods: {
show(id) {
this.dialogVisible = true;
if (id) {
getData(id).then(response => {
this.formModel = response.data;
this.$refs.dataform.resetForm();
});
}
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') {
self.create();
} else {
self.update();
}
});
},
create() {
const self = this;
create(this.formModel).then(response => {
self.$message.success(this.$t('system.createSuccess'));
self.handleClose();
self.$emit('reloadTable');
}).catch(error => {
self.$message.error(`${this.$t('error.createDictionaryFailed')}:${error.message}`);
});
},
update() {
const self = this;
update(this.formModel).then(response => {
self.$message.success(this.$t('system.updateSuccess'));
self.handleClose();
self.$emit('reloadTable');
}).catch(error => {
self.$message.error(`${this.$t('error.updateDictionaryFailed')}:${error.message}`);
});
},
handleClose(done) {
this.formModel = {
code: '',
name: '',
status: '1',
remarks: ''
};
this.$refs.dataform.resetForm();
if (done) {
done();
} else {
this.dialogVisible = false;
}
}
}
};
</script>

View File

@ -0,0 +1,163 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" />
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getCommandList, delCommand } from '@/api/management/dictionary';
import { listPublishMap } from '@/api/jmap/map';
import DictionaryEdit from './edit';
export default {
name: 'CommandDictionary',
components: {
DictionaryEdit
},
data() {
return {
taskStatusList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
lineCode: {
type: 'select',
label: this.$t('system.lineCode'),
config: {
data: []
}
},
deviceType: {
type: 'select',
label: this.$t('system.deviceType'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.controlMode'), //
prop: 'controlMode'
},
{
title: this.$t('system.deviceType'), //
prop: 'deviceType'
},
{
title: this.$t('system.lineCode'), // 线
prop: 'lineCode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.lineCode, this.taskStatusList, ['lineCode', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.simulationRole'), // 仿
prop: 'role'
},
{
title: this.$t('system.instructionType'), //
prop: 'type'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('system.paramDetail'),
handleClick: this.handleDetail
},
{
name: this.$t('global.edit'),
handleClick: this.handleEdit
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.handleAdd }
]
},
currentModel: {}
};
},
mounted () {
this.loadInitData();
},
methods: {
async loadInitData() {
try {
this.taskStatusList = [];
this.mapList = [];
const list = await listPublishMap();
this.taskStatusList = list.data;
list.data.forEach(elem => {
this.queryForm.queryObject.lineCode.config.data.push({ value: elem.lineCode, label: elem.name });
});
} catch (error) {
console.log(error);
}
},
queryFunction(params) {
if (!params['lineCode']) {
params['lineCode'] = '';
}
return getCommandList(params);
},
handleDetail(index, row) {
console.log(index, row);
},
handleEdit(index, row) {
console.log(index, row);
// this.$refs.edit.show(row.id);
},
handleAdd() {
this.$refs.create.show();
},
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delCommand(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>