Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test_ls
This commit is contained in:
commit
a2b5b7bdda
58
src/api/trainingManage.js
Normal file
58
src/api/trainingManage.js
Normal file
@ -0,0 +1,58 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 获取当前用户的所有实训草稿数据 */
|
||||
export function getAllTrainingList(params) {
|
||||
return request({
|
||||
url: `/api/v2/draft/training/all`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
/** 分页获取当前用户的实训草稿数据 */
|
||||
export function getTrainingList(data) {
|
||||
return request({
|
||||
url: `/api/v2/draft/training/info/page`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 创建实训草稿 */
|
||||
export function createTraining(data) {
|
||||
return request({
|
||||
url: `/api/v2/draft/training/create`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 更新当前用户的某个实训草稿 */
|
||||
export function updateTraining(data) {
|
||||
return request({
|
||||
url: `/api/v2/draft/training`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 修改实训所有步骤 */
|
||||
export function updateTrainingStep(id, data) {
|
||||
return request({
|
||||
url: ` /api/v2/draft/training/${id}/step/update`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
/** 删除当前用户的实训草稿 */
|
||||
export function deleteTraining(data) {
|
||||
return request({
|
||||
url: `/api/v2/draft/training`,
|
||||
method: 'delete',
|
||||
data: {trainingDraftIds: data}
|
||||
});
|
||||
}
|
||||
/** 当前用户发布自己的实训草稿 */
|
||||
export function publishTraining(data) {
|
||||
return request({
|
||||
url: `/api/v2/draft/training/publish`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
@ -771,6 +771,12 @@ export const menuOperate = {
|
||||
operation: OperationEvent.CTCCommand.releaseTrainFixedPath.menu.operation,
|
||||
cmdType: CMD.CTC.CTC_RELEASE_RUN_PLAN_TO_SIMULATION
|
||||
},
|
||||
// 获取股道列表
|
||||
getStationTrack:{
|
||||
operation: OperationEvent.CTCCommand.getStationTrack.menu.operation,
|
||||
cmdType: CMD.CTC.CTC_STATION_DETAIL_LIST // TODO
|
||||
},
|
||||
|
||||
setRoute: {
|
||||
operation: OperationEvent.CTCCommand.setRoute.menu.operation,
|
||||
cmdType: CMD.CTC.CTC_SET_ROUTE
|
||||
|
@ -253,6 +253,10 @@ export default {
|
||||
{ label: 'S', value: 'S' },
|
||||
{ label: 'SF', value: 'SF' },
|
||||
{ label: 'SD', value: 'SD' }
|
||||
],
|
||||
trainingType: [ // 实训类型
|
||||
{ enlabel: 'single operation', label: '单操', value: 'single'},
|
||||
{ enlabel: 'scene operation', label: '场景', value: 'scene'}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
@ -446,6 +446,8 @@ export default {
|
||||
CTC_COVER_RUN_PLAN_LIST_TO_EDIT_AREA:{value: 'CTC_COVER_RUN_PLAN_LIST_TO_EDIT_AREA', label: '导入列车固定径路'},
|
||||
CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA:{value: 'CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA', label: '删除列车固定径路'},
|
||||
CTC_RELEASE_RUN_PLAN_TO_SIMULATION:{value: 'CTC_RELEASE_RUN_PLAN_TO_SIMULATION', label: '运行计划发布至CTC'},
|
||||
CTC_STATION_DETAIL_LIST:{value: 'station_detail_list', label: ' 获取股道列表'}, // TODO
|
||||
|
||||
CTC_SET_ROUTE:{value: 'CTC_SET_ROUTE', label: 'CTC办理进路'},
|
||||
|
||||
CTC_STATION_SIGN_RUN_PLAN:{value:'CTC_STATION_SIGN_RUN_PLAN', label: '车站签收阶段计划'},
|
||||
|
@ -3958,8 +3958,14 @@ export const OperationEvent = {
|
||||
operation: '1149',
|
||||
domId: '_Tips-CTC-logSaveRunplan-Menu{TOP}'
|
||||
}
|
||||
},
|
||||
// 获取股道列表
|
||||
getStationTrack:{
|
||||
menu: {
|
||||
operation: '1150',
|
||||
domId: 'getStationTrackTerminalStationTree'
|
||||
}
|
||||
}
|
||||
//
|
||||
// CTC_ZONE_SAVE_TRIP_NUMBER
|
||||
// CTC_ZONE_SAVE_STATION
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="stationTrack" :style="{ height: height+'px' }">
|
||||
<!-- {{ '车站股道' }} -->
|
||||
<div class="stationTrackL">
|
||||
<terminal-station-list ref="terminalStationList" @loadStationData="loadStationData" />
|
||||
<terminal-station-list ref="terminalStationList" :currentid="'getStationTrack'" @loadStationData="loadStationData" />
|
||||
</div>
|
||||
<div class="stationTrackR">
|
||||
<div class="stationTrackRMenu">
|
||||
@ -37,18 +37,24 @@
|
||||
label="序号"
|
||||
width="100"
|
||||
/>
|
||||
<!-- trackSectionCode -->
|
||||
<el-table-column
|
||||
prop="trackName"
|
||||
prop="code"
|
||||
label="股道名称"
|
||||
width="100"
|
||||
/>
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ filterSectionMap[scope.row.code]?filterSectionMap[scope.row.code].name:'' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- lineType -->
|
||||
<el-table-column
|
||||
prop="lineType"
|
||||
prop="trackNature"
|
||||
label="线路性质"
|
||||
width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ lineTypeMap[scope.row.lineType] }}
|
||||
{{ lineTypeMap[scope.row.trackNature] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -60,22 +66,24 @@
|
||||
{{ directionMap[scope.row.direction] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- type -->
|
||||
<el-table-column
|
||||
prop="type"
|
||||
prop="trainType"
|
||||
label="接发车类型"
|
||||
width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ typeMap[scope.row.type] }}
|
||||
{{ typeMap[scope.row.trainType] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- transfiniteType -->
|
||||
<el-table-column
|
||||
prop="transfiniteType"
|
||||
prop="transfinite"
|
||||
label="超限类型"
|
||||
width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ transfiniteTypeMap[scope.row.transfiniteType] }}
|
||||
{{ transfiniteTypeMap[scope.row.transfinite] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -87,31 +95,34 @@
|
||||
{{ standTypeMap[scope.row.standType] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- allowEmu -->
|
||||
<el-table-column
|
||||
prop="allowEmu"
|
||||
prop="motorCar"
|
||||
label="允许动车组"
|
||||
width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ allowEmuMap[scope.row.allowEmu] }}
|
||||
{{ allowEmuMap[scope.row.motorCar] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- addWaterEqu -->
|
||||
<el-table-column
|
||||
prop="addWaterEqu"
|
||||
prop="waterSupply"
|
||||
label="上水设备"
|
||||
width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ addWaterEquMap[scope.row.addWaterEqu] }}
|
||||
{{ addWaterEquMap[scope.row.waterSupply] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- sewageEqu -->
|
||||
<el-table-column
|
||||
prop="sewageEqu"
|
||||
prop="sewageAbsorption"
|
||||
label="排污设备"
|
||||
width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ sewageEquMap[scope.row.sewageEqu] }}
|
||||
{{ sewageEquMap[scope.row.sewageAbsorption] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -134,6 +145,7 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import TerminalStationList from './terminalStationList';
|
||||
import TrackInformation from './trackInformation';
|
||||
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
|
||||
export default {
|
||||
name:'StationTrack',
|
||||
components: {
|
||||
@ -188,10 +200,6 @@ export default {
|
||||
2:'否'
|
||||
},
|
||||
tableData:[
|
||||
{trackName:'IG', lineType:'1', direction:'1', type:'2', transfiniteType:'2', standType:'1', allowEmu:'2', addWaterEqu:'1',
|
||||
sewageEqu:'1', military:'1'},
|
||||
{trackName:'IIG', lineType:'2', direction:'1', type:'2', transfiniteType:'2', standType:'1', allowEmu:'2', addWaterEqu:'1',
|
||||
sewageEqu:'1', military:'1' }
|
||||
]
|
||||
};
|
||||
},
|
||||
@ -212,15 +220,21 @@ export default {
|
||||
this.filterSectionMap[section.code] = {code:section.code, name:section.name};
|
||||
}
|
||||
});
|
||||
this.handleData();
|
||||
this.handleData(stationCode);
|
||||
},
|
||||
handleData() {
|
||||
this.tableData = [
|
||||
{trackName:'IG', lineType:'1', direction:'1', type:'2', transfiniteType:'2', standType:'1', allowEmu:'2', addWaterEqu:'1',
|
||||
sewageEqu:'1', military:'1'},
|
||||
{trackName:'IIG', lineType:'2', direction:'1', type:'2', transfiniteType:'2', standType:'1', allowEmu:'2', addWaterEqu:'1',
|
||||
sewageEqu:'1', military:'1' }
|
||||
];
|
||||
handleData(stationCode) {
|
||||
commitOperate(menuOperate.CTC.getStationTrack, { stationCode: stationCode }, 3).then(({valid, response}) => {
|
||||
if (valid) {
|
||||
this.tableData = response.data;
|
||||
}
|
||||
});
|
||||
// getStationTrackTerminalStationTree
|
||||
// this.tableData = [
|
||||
// {trackSectionCode:'T97', lineType:'1', direction:'1', type:'2', transfiniteType:'2', standType:'1', allowEmu:'2', addWaterEqu:'1',
|
||||
// sewageEqu:'1', military:'1'},
|
||||
// {trackSectionCode:'T105', lineType:'2', direction:'1', type:'2', transfiniteType:'2', standType:'1', allowEmu:'2', addWaterEqu:'1',
|
||||
// sewageEqu:'1', military:'1' }
|
||||
// ];
|
||||
},
|
||||
rowDbClick(row, column, event) {
|
||||
this.currentRow = row;
|
||||
|
@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="terminalStationListB">
|
||||
<el-tree
|
||||
id="terminalStationTree"
|
||||
:id="currentid+'TerminalStationTree'"
|
||||
ref="terminalStationTree"
|
||||
:data="treeList"
|
||||
:props="defaultProps"
|
||||
@ -32,6 +32,12 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
name:'TerminalStationList',
|
||||
props: {
|
||||
currentid: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
treeList:[{
|
||||
|
@ -14,6 +14,16 @@
|
||||
<!-- 111 -->
|
||||
<!-- form -->
|
||||
<el-form ref="form" :model="model" label-width="85px" :rules="rules">
|
||||
<el-form-item label="股道:" prop="trackSectionCode">
|
||||
<el-select v-model="model.trackSectionCode" placeholder="" style="width:135px;margin-right:200px">
|
||||
<el-option
|
||||
v-for="item in filterSectionList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="线路性质:" prop="lineType">
|
||||
<el-select v-model="model.lineType" placeholder="" style="width:145px">
|
||||
<el-option
|
||||
@ -125,7 +135,8 @@ export default {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
trackSectionCode:'',
|
||||
filterSectionList:[],
|
||||
// trackSectionCode:'',
|
||||
lineTypeList:[
|
||||
{label:'正线', value:'1'},
|
||||
{label:'到发线', value:'2'}
|
||||
@ -168,6 +179,7 @@ export default {
|
||||
{label:'否', value:'2'}
|
||||
],
|
||||
model:{
|
||||
trackSectionCode:'',
|
||||
lineType:'', // 线路性质 正线/到发线
|
||||
direction:'', // 接发车方向 上行、下行、 上下行
|
||||
type:'', // 接发车类型 客车/货车/客货车
|
||||
@ -200,6 +212,7 @@ export default {
|
||||
methods:{
|
||||
doShow({row, filterSectionMap}) {
|
||||
this.filterSectionList = Object.values(filterSectionMap);
|
||||
debugger;
|
||||
this.dialogShow = true;
|
||||
this.$nextTick(function () {
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
|
@ -444,7 +444,7 @@ export default {
|
||||
data.arriveTime = this.coverTime(data.arriveTime);
|
||||
data.departTime = this.coverTime(data.departTime);
|
||||
return data.stationCode == this.currentStationCode;
|
||||
|
||||
|
||||
});
|
||||
// stationCode 车站编码
|
||||
// trackSectionCode 运行计划的默认股道
|
||||
|
@ -2,6 +2,7 @@
|
||||
<div class="train">
|
||||
<div v-show="maskOpen" class="trainMask" />
|
||||
<jlmap-visual ref="jlmapVisual" />
|
||||
<menu-demon ref="menuDemon" />
|
||||
<voice-chat-box v-if="$route.query.lineCode == '16'" ref="chatbox" :group="group" :user-role="userRole" />
|
||||
<chat-box v-else ref="chatbox" :group="group" :user-role="userRole" />
|
||||
<div class="trainBack">
|
||||
@ -19,11 +20,12 @@ import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import chatBox from '@/views/newMap/chatView/chatBox.vue';
|
||||
import VoiceChatBox from '@/views/newMap/chatView/voiceChatBox.vue';
|
||||
|
||||
import MenuDemon from '@/views/trainingManage/demonMenu.vue';
|
||||
export default {
|
||||
name: 'TrainingDesign',
|
||||
components: {
|
||||
JlmapVisual,
|
||||
MenuDemon,
|
||||
chatBox,
|
||||
VoiceChatBox
|
||||
},
|
||||
|
122
src/views/trainingManage/create.vue
Normal file
122
src/views/trainingManage/create.vue
Normal file
@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :modal="false" :before-close="doClose" center>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createTraining, updateTraining } from '@/api/trainingManage';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
|
||||
export default {
|
||||
name: 'Create',
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
isCreate: true,
|
||||
formModel: {
|
||||
name: '',
|
||||
mapId: '',
|
||||
description:'',
|
||||
type: '',
|
||||
labelJson: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
let t = '新建实训';
|
||||
if (!this.isCreate) {
|
||||
t = '编辑实训';
|
||||
}
|
||||
return t;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '60px',
|
||||
items: [
|
||||
{ prop: 'name', label: '名称', type: 'text' },
|
||||
{ prop: 'description', label: '描述', type: 'textarea' },
|
||||
{ prop: 'type', label: '类型', type: 'select', options: ConstConfig.ConstSelect.trainingType },
|
||||
{ prop: 'labelJson', label: '标签', type: 'text' }
|
||||
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
name: [
|
||||
{ required: true, validator: this.validateName, trigger: 'blur' }
|
||||
],
|
||||
description: [
|
||||
{ required: true, validator: this.validateDescription, trigger: 'blur' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '请选择实训类型', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
validateName(rule, value, callback) {
|
||||
if (value.trim().length == 0) {
|
||||
this.formModel.name = this.formModel.name.replace(/\s/g, '');
|
||||
return callback(new Error('请输入实训名称'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
},
|
||||
validateDescription(rule, value, callback) {
|
||||
if (value.trim().length == 0) {
|
||||
this.formModel.description = this.formModel.description.replace(/\s/g, '');
|
||||
return callback(new Error('请输入实训描述'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
},
|
||||
doShow(data) {
|
||||
if (data) {
|
||||
this.isCreate = false;
|
||||
this.formModel = {...data};
|
||||
} else {
|
||||
this.isCreate = true;
|
||||
this.formModel = {
|
||||
name: '',
|
||||
mapId: this.$route.query.mapId,
|
||||
description:'',
|
||||
type: '',
|
||||
labelJson: ''
|
||||
};
|
||||
}
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
doCreate() {
|
||||
this.$refs.dataform.validateForm(async() => {
|
||||
if (this.isCreate) {
|
||||
await createTraining(this.formModel);
|
||||
} else {
|
||||
await updateTraining(this.formModel);
|
||||
}
|
||||
this.$emit('edit');
|
||||
this.doClose();
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
this.$refs.dataform.resetForm();
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .el-dialog--center .el-dialog__body{
|
||||
padding: 25px 65px 30px 10px;
|
||||
}
|
||||
</style>
|
86
src/views/trainingManage/demonMenu.vue
Normal file
86
src/views/trainingManage/demonMenu.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="display_top_draft">
|
||||
<div class="btn_hover" @click="menuClick">菜单</div>
|
||||
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:${btnWidth}px`">
|
||||
<el-button size="small" @click="showList">实训列表</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<TrainingList ref="trainingList" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import TrainingList from './trainingList.vue';
|
||||
export default {
|
||||
name:'DemonMenu',
|
||||
components:{
|
||||
TrainingList
|
||||
},
|
||||
props:{
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
hoverBtn: false,
|
||||
btnWidth: -600
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
mapId() {
|
||||
return this.$route.query.mapId;
|
||||
},
|
||||
lineCode() {
|
||||
return this.$route.query.lineCode;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods:{
|
||||
menuClick() {
|
||||
this.hoverBtn = !this.hoverBtn;
|
||||
if (this.hoverBtn) {
|
||||
this.btnWidth = 0; // 默认宽度
|
||||
} else {
|
||||
this.btnWidth = -600;
|
||||
}
|
||||
},
|
||||
showList() {
|
||||
this.$refs.trainingList.doShow();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.display_top_draft{
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: 15px;
|
||||
height: 32px;
|
||||
overflow: hidden;
|
||||
padding-left: 44px;
|
||||
z-index: 35;
|
||||
.btn_hover{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
color: #4e4d4d;
|
||||
font-size: 14px;
|
||||
background: #fff;
|
||||
padding: 8px;
|
||||
border-radius: 5px;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
height: 32px;
|
||||
}
|
||||
.button_group_box{
|
||||
float: left;
|
||||
transition: all 0.5s;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
183
src/views/trainingManage/trainingList.vue
Normal file
183
src/views/trainingManage/trainingList.vue
Normal file
@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag title="实训管理" :visible.sync="dialogVisible" width="1000px" :before-close="doClose" center>
|
||||
<div>
|
||||
<div class="scriptHeader">
|
||||
<div class="scriptList">实训草稿列表</div>
|
||||
<div class="flexNull" />
|
||||
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
|
||||
</div>
|
||||
<QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<Create ref="create" v-dialogDrag @edit="getListData" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTrainingList} from '@/api/trainingManage';
|
||||
import Cookies from 'js-cookie';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Create from './create.vue';
|
||||
import { deleteTraining, publishTraining } from '@/api/trainingManage';
|
||||
import { admin, superAdmin} from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'TrainingList',
|
||||
components:{
|
||||
Create
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '100px',
|
||||
reset: true,
|
||||
show:false
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: '实训名称',
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: '描述',
|
||||
prop: 'description'
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
prop: 'type',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.covertData(row); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: '标签',
|
||||
prop: 'labelJson'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('scriptRecord.operate'),
|
||||
width: '450',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('scriptRecord.scriptRecord'),
|
||||
handleClick: this.drawUp,
|
||||
type: 'success',
|
||||
showControl:(row) => { return row.id; }
|
||||
},
|
||||
{
|
||||
name: this.$t('scriptRecord.scriptModify'),
|
||||
handleClick: this.handleModify,
|
||||
type: 'primary',
|
||||
showControl:(row) => { return row.id; }
|
||||
},
|
||||
{
|
||||
name: this.$t('scriptRecord.scriptDelete'),
|
||||
handleClick: this.deleteScript,
|
||||
type: 'danger',
|
||||
showControl:(row) => { return row.id; }
|
||||
},
|
||||
{
|
||||
name: this.$t('scriptRecord.publish'),
|
||||
handleClick: this.publishScript,
|
||||
type: 'primary',
|
||||
showControl:(row) => { return row.id; }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
queryFunction(params) {
|
||||
return getTrainingList(params);
|
||||
},
|
||||
doShow() {
|
||||
this.getListData();
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
doClose() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
handleCreate() {
|
||||
this.$refs.create.doShow(null);
|
||||
},
|
||||
covertData(row) {
|
||||
const releaseReview = ConstConfig.ConstSelect.trainingType;
|
||||
const lastData = Object.assign({}, row);
|
||||
if (Cookies.get('user_lang') == 'en') {
|
||||
releaseReview.forEach(function(element) {
|
||||
const rolename = element.value;
|
||||
if (lastData.type == rolename) {
|
||||
lastData.type = element.enlabel;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
releaseReview.forEach(function(element) {
|
||||
const rolename = element.value;
|
||||
if (lastData.type == rolename) {
|
||||
lastData.type = element.label;
|
||||
}
|
||||
});
|
||||
}
|
||||
return lastData.type;
|
||||
},
|
||||
drawUp(index, row) {
|
||||
console.log('编辑', index, row);
|
||||
},
|
||||
handleModify(index, row) {
|
||||
console.log('修改', index, row);
|
||||
if (!row.id) { return; }
|
||||
this.$refs.create.doShow(row);
|
||||
},
|
||||
deleteScript(index, row) {
|
||||
console.log('删除', index, row);
|
||||
if (!row.id) { return; }
|
||||
deleteTraining([row.id]).then(res => {
|
||||
console.log('删除实训成功', res);
|
||||
this.getListData();
|
||||
}).catch(err => {
|
||||
console.log('删除实训失败', err);
|
||||
this.getListData();
|
||||
});
|
||||
},
|
||||
publishScript(index, row) {
|
||||
console.log('发布', index, row);
|
||||
if (!row.id) { return; }
|
||||
publishTraining({draftId: row.id}).then(res => {
|
||||
console.log('发布实训成功', res);
|
||||
}).catch(err => {
|
||||
console.log('发布实训失败', err);
|
||||
});
|
||||
},
|
||||
getListData() {
|
||||
this.$refs.queryListPage && this.$refs.queryListPage.commitQuery();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .el-dialog--center .el-dialog__body{
|
||||
padding: 10px 25px 10px 25px;
|
||||
}
|
||||
.scriptHeader {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 5px;
|
||||
.flexNull {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user