rt-sim-training-client/src/views/planMonitor/detail.vue

317 lines
11 KiB
Vue
Raw Normal View History

2019-07-26 13:32:43 +08:00
<template>
2019-09-30 10:46:29 +08:00
<el-card :style="{height: height+'px'}">
2019-10-22 16:10:39 +08:00
<div class="runPlanHeader" style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;">
2019-10-17 17:11:15 +08:00
<div class="runPlanList">{{$t('planMonitor.openRunPlan.runPlanList')}}</div>
<el-button size="small" type="primary" @click="handleCreate" class="createRunPlan" v-if="isCreate">{{$t('planMonitor.createRunningDiagram')}}</el-button>
2019-09-30 10:46:29 +08:00
</div>
2019-09-30 15:18:34 +08:00
<el-table :data="runPlanList" height="600" stripe
2019-09-30 10:46:29 +08:00
border
style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;">
2019-10-17 17:11:15 +08:00
<el-table-column prop="name" :label="this.$t('planMonitor.runGraphName')" />
2019-10-22 16:10:39 +08:00
<el-table-column :label="this.$t('global.status')" v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))">
2019-10-14 13:04:23 +08:00
<template slot-scope="scope">
<el-tag>{{handlerStatus(scope.row)}}</el-tag>
2019-10-14 13:04:23 +08:00
</template>
</el-table-column>
<el-table-column
prop="explanation"
show-overflow-tooltip
2019-10-22 16:10:39 +08:00
v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))"
2019-10-17 17:56:25 +08:00
:label="this.$t('planMonitor.explanation')">
2019-10-14 13:04:23 +08:00
</el-table-column>
2019-10-17 17:56:25 +08:00
<el-table-column :label="this.$t('planMonitor.creationDate')">
2019-10-14 13:04:23 +08:00
<template slot-scope="scope">
<el-tag type="success">{{handleTime(scope.row.createTime)}}</el-tag>
2019-10-14 13:04:23 +08:00
</template>
</el-table-column>
<el-table-column :label="this.$t('global.operate')" width="400">
2019-09-30 10:46:29 +08:00
<template slot-scope="scope">
<el-button size="mini" class="button_box" type="success" @click="handleConfirm(scope.row)" v-if="scope.row.status !=='1'">{{$t('planMonitor.load')}}</el-button>
<el-button size="mini" class="button_box" type="primary" @click="handleEdit(scope.row)" v-if="isCreate && scope.row.status !=='1'">{{$t('planMonitor.modifyName')}}</el-button>
2019-10-17 17:56:25 +08:00
<el-button size="mini" class="button_box" type="danger" @click="handleDelete(scope.row)" v-if="isCreate && scope.row.status !=='1'">{{$t('global.delete')}}</el-button>
<el-button size="mini" class="button_box" type="primary" @click="handlePublish(scope.row)" v-if="isCreate && scope.row.status ==='0'">{{hasRelease?$t('global.release'):'申请发布'}}</el-button>
2019-10-14 13:54:19 +08:00
<el-button size="mini" class="button_box" type="primary" @click="handlePreview(scope.row)" v-if="scope.row.status === '1'">预览</el-button>
2019-10-14 13:04:23 +08:00
<el-button size="mini" class="button_box" type="danger" @click="handelRevert(scope.row)" v-if="scope.row.status === '1'" >撤销</el-button>
2019-09-30 10:46:29 +08:00
</template>
</el-table-column>
</el-table>
2019-09-30 14:17:20 +08:00
<create-empty-plan ref="createEmptyPlan" :plan-convert="PlanConvert" @dispatchOperate="dispatchOperate" @dispatchDialog="dispatchDialog" @refresh="refresh"/>
2019-09-30 15:18:34 +08:00
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
</el-card>
2019-07-26 13:32:43 +08:00
</template>
<script>
2019-09-30 15:18:34 +08:00
import EditPlanName from './editTool/menus/editPlanName';
2019-09-30 14:17:20 +08:00
import CreateEmptyPlan from './editTool/menus/createEmptyPlan';
2019-10-14 13:54:19 +08:00
import { getRpListByUserMapId, publishRunPlan, releaseOrCancelRunPlan, previewRunPlan} from '@/api/designPlatform';
2019-09-30 10:46:29 +08:00
import { getRpListByMapId, deleteRunPlan } from '@/api/runplan';
2019-10-14 13:54:19 +08:00
import { launchFullscreen } from '@/utils/screen';
2019-09-30 15:18:34 +08:00
import { UrlConfig } from '@/router/index';
export default {
2019-09-30 10:46:29 +08:00
name: 'userRunPlanList',
components: {
2019-09-30 15:18:34 +08:00
CreateEmptyPlan,
EditPlanName
2019-09-30 10:46:29 +08:00
// LimitList
},
filters: {
},
data() {
return {
2019-09-30 10:46:29 +08:00
dialogShow: false,
loading: false,
// height: 260,
// planId: '',
// planName: '',
type: 'add',
// defaultShowKeys: [],
runPlanList: [],
2019-09-30 14:17:20 +08:00
runPlanDict: {},
isCreate:false,
PlanConvert: {}
2019-09-30 10:46:29 +08:00
// defaultProps: {
// label: 'name'
// }
};
},
computed: {
height() {
2019-09-30 10:46:29 +08:00
return this.$store.state.app.height - 50;
2019-09-30 14:17:20 +08:00
},
skinCode() {
return this.$route.query.skinCode || '02';
},
2019-10-14 13:04:23 +08:00
hasRelease() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05');
}
2019-09-30 14:17:20 +08:00
},
created(){
this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode);
},
2019-09-30 10:46:29 +08:00
mounted(){
this.getRunPlanList();
},
2019-09-30 14:17:20 +08:00
watch: {
'$route' () {
this.getRunPlanList();
}
},
2019-09-30 10:46:29 +08:00
methods:{
2019-09-30 14:17:20 +08:00
refresh(){
this.getRunPlanList();
},
2019-09-30 10:46:29 +08:00
getRunPlanList() {
if(/^\/design\/userlist/.test(this.$route.fullPath)){
2019-09-30 14:17:20 +08:00
this.isCreate=false;
2019-09-30 10:46:29 +08:00
getRpListByUserMapId(this.$route.params.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
// this.dialogShow = true;
}).catch(() => {
this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail'));
});
}
2019-09-30 10:46:29 +08:00
else{
2019-09-30 14:17:20 +08:00
this.isCreate=true;
2019-09-30 10:46:29 +08:00
getRpListByMapId(this.$route.params.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
// this.dialogShow = true;
}).catch(() => {
this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail'));
});
}
},
2019-09-30 14:17:20 +08:00
dispatchOperate(){
this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
},
dispatchDialog(){
this.$refs['createEmptyPlan'].doShow();
},
2019-09-30 10:46:29 +08:00
handleCreate(){
2019-09-30 14:17:20 +08:00
this.$refs['createEmptyPlan'].doShow();
},
2019-09-30 15:18:34 +08:00
handleConfirm(row){
this.loadRunPlanData({
planId: row.id,
skinCode: this.$route.query.skinCode,
planName: row.name
});
},
2019-09-30 15:18:34 +08:00
// 修改运行图名称
handleEdit(row) {
if (row.id && row.name) {
this.$refs.editPlan.doShow({id: row.id, name: row.name});
} else {
this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan'));
}
2019-09-30 10:46:29 +08:00
},
2019-09-30 15:18:34 +08:00
loadRunPlanData({ refresh, planId, skinCode, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
} else {
const query = { skinCode: skinCode, mapId: this.$route.params.mapId, planId: planId, planName: planName };
2019-10-08 14:12:53 +08:00
if(/^\/design\/userlist/.test(this.$route.fullPath)){
this.$router.push({ path: `${UrlConfig.plan.usertool}`, query: query });
}
else{
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
2019-09-30 15:18:34 +08:00
}
},
// 删除运行图
handleDelete(row) {
this.$confirm(this.$t('planMonitor.openRunPlan.confirmDeleteRunPlan'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteRunPlan(row.id).then(Response => {
this.$message.success(this.$t('planMonitor.openRunPlan.deleteSuccess'));
// if (row.id === this.$route.query.planId) {
// const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
// this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
// }
this.refresh();
// this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
}).catch(() => { });
2019-10-14 13:04:23 +08:00
},
handlePublish(row) {
this.$confirm(this.hasRelease? '此操作将发布运行图,是否继续?':'此操作将发起运行图发布申请,是否继续?',this.$t('tip.hint'),{
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
if (this.hasRelease){
publishRunPlan(row.id,{runPlanName: name}).then(resp => {
this.$message.success('发布运行图成功!');
this.refresh();
}).catch(() => {
this.$messageBox('发布运行图失败!');
this.refresh();
})
} else {
releaseOrCancelRunPlan(row.id, '1').then(resp => {
this.$message.success('提交运行图发布申请成功!');
this.refresh();
}).catch(() => {
this.$messageBox('提交运行图发布申请失败!');
this.refresh();
})
}
});
},
handelRevert(row) {
this.$confirm('此操作将撤销发布运行图申请,是否继续?',this.$t('tip.hint'),{
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type:'warning'
}).then(() => {
releaseOrCancelRunPlan(row.id,'0').then(resp=> {
this.$message.success('撤销运行图发布申请成功!');
this.refresh();
}).catch(() => {
this.$messageBox('撤销运行图发布申请失败!')
this.refresh();
})
})
},
handlerStatus(row) {
let lessonStatus = '';
switch (row.status){
case '0':
lessonStatus = this.$t('lesson.notRelease');
break;
case '1':
lessonStatus = this.$t('lesson.pendingReview');
break;
case '2':
lessonStatus = this.$t('lesson.published');
break;
case '3':
lessonStatus = this.$t('lesson.rejected');
break;
}
return lessonStatus;
},
handleTime(time) {
let timeList = time.split("T");
return timeList[0] + ' ' +timeList[1];
2019-10-14 13:54:19 +08:00
},
handlePreview(row){
previewRunPlan(row.id).then(resp => {
const query = {
skinCode: row.skinCode, prdType: '01', group: resp.data, mapId: row.mapId, planId: row.id,from:''
};
this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('tip.createSimulationFaild')+this.$t('global.colon')+error.message);
});
2019-10-14 13:04:23 +08:00
}
}
};
2019-07-26 13:32:43 +08:00
</script>
<style scoped>
::-webkit-scrollbar {
width: 3px;
height: 3px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
2019-09-30 10:46:29 +08:00
// .title {
// font-weight: bold
// }
2019-07-26 13:32:43 +08:00
2019-09-30 10:46:29 +08:00
// .time-item {
// font-size: 24px;
// color: black !important;
// }
2019-07-26 13:32:43 +08:00
2019-09-30 10:46:29 +08:00
// .time-label {
// display: -moz-inline-box;
// display: inline-block;
// text-align: right;
// margin-left: 14px;
// }
2019-07-26 13:32:43 +08:00
2019-09-30 10:46:29 +08:00
// .time-elem {
// color: rgb(90, 89, 89) !important;
// }
2019-07-26 13:32:43 +08:00
2019-09-30 10:46:29 +08:00
// .list-item {
// font-size: 16px;
// margin-bottom: 20px;
// }
2019-07-26 13:32:43 +08:00
2019-09-30 10:46:29 +08:00
// .list-label {
// display: -moz-inline-box;
// display: inline-block;
// text-align: right;
// /* width: 160px; */
// }
2019-07-26 13:32:43 +08:00
2019-09-30 10:46:29 +08:00
// .list-elem {
// color: #808080 !important;
// }
.createRunPlan{
display:inline-block;float:right;margin-right:20px;
}
.runPlanHeader{
display:inline-block;margin-top:40px;width: 90%;margin-left:5%;
}
.runPlanList{
display:inline-block;padding:7px 0px
}
</style>