修改接口:/api/runPlan/template/skin/{mapId} 改为 /api/runPlan/template/{mapId}/list
This commit is contained in:
parent
0f778f94c6
commit
36c33ed416
@ -53,9 +53,9 @@ export function queryRunPlan(planId) {
|
||||
}
|
||||
|
||||
// 根据skinCode查询发布运行图列表
|
||||
export function queryRunPlanList(skinCode) {
|
||||
export function queryRunPlanList(mapId) {
|
||||
return request({
|
||||
url: `/api/runPlan/template/skin/${skinCode}`,
|
||||
url: `/api/runPlan/template/${mapId}/list`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
@ -1,43 +1,47 @@
|
||||
<template>
|
||||
<el-card :style="{height: height+'px'}" style="overflow-y:scroll;padding-bottom:20px;">
|
||||
<div class="runPlanHeader" style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;">
|
||||
<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>
|
||||
</div>
|
||||
<el-table :data="runPlanList" height="500" stripe
|
||||
border
|
||||
style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;">
|
||||
<el-table-column prop="name" :label="this.$t('planMonitor.runGraphName')" />
|
||||
<el-table-column :label="this.$t('global.status')" v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))">
|
||||
<template slot-scope="scope">
|
||||
<el-tag>{{handlerStatus(scope.row)}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="explanation"
|
||||
show-overflow-tooltip
|
||||
v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))"
|
||||
:label="this.$t('planMonitor.explanation')">
|
||||
</el-table-column>
|
||||
<el-table-column :label="this.$t('planMonitor.creationDate')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success">{{handleTime(scope.row.createTime)}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="this.$t('global.operate')" width="400">
|
||||
<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>
|
||||
<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'):$t('planMonitor.applyRelease')}}</el-button>
|
||||
<el-button size="mini" class="button_box" type="primary" @click="handlePreview(scope.row)" v-if="scope.row.status === '1'">{{$t('planMonitor.preview')}}</el-button>
|
||||
<el-button size="mini" class="button_box" type="danger" @click="handelRevert(scope.row)" v-if="scope.row.status === '1'" >{{$t('planMonitor.revoke')}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<create-empty-plan ref="createEmptyPlan" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" @refresh="refresh"/>
|
||||
<!-- @dispatchOperate="dispatchOperate" -->
|
||||
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
|
||||
<div class="runPlanHeader" style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;">
|
||||
<div class="runPlanList">{{ $t('planMonitor.openRunPlan.runPlanList') }}</div>
|
||||
<el-button v-if="isCreate" size="small" type="primary" class="createRunPlan" @click="handleCreate">{{ $t('planMonitor.createRunningDiagram') }}</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
:data="runPlanList"
|
||||
height="500"
|
||||
stripe
|
||||
border
|
||||
style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;"
|
||||
>
|
||||
<el-table-column prop="name" :label="this.$t('planMonitor.runGraphName')" />
|
||||
<el-table-column v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))" :label="this.$t('global.status')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag>{{ handlerStatus(scope.row) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))"
|
||||
prop="explanation"
|
||||
show-overflow-tooltip
|
||||
:label="this.$t('planMonitor.explanation')"
|
||||
/>
|
||||
<el-table-column :label="this.$t('planMonitor.creationDate')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success">{{ handleTime(scope.row.createTime) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="this.$t('global.operate')" width="400">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.status !=='1'" size="mini" class="button_box" type="success" @click="handleConfirm(scope.row)">{{ $t('planMonitor.load') }}</el-button>
|
||||
<el-button v-if="isCreate && scope.row.status !=='1'" size="mini" class="button_box" type="primary" @click="handleEdit(scope.row)">{{ $t('planMonitor.modifyName') }}</el-button>
|
||||
<el-button v-if="isCreate && scope.row.status !=='1'" size="mini" class="button_box" type="danger" @click="handleDelete(scope.row)">{{ $t('global.delete') }}</el-button>
|
||||
<el-button v-if="isCreate && scope.row.status ==='0'" size="mini" class="button_box" type="primary" @click="handlePublish(scope.row)">{{ hasRelease?$t('global.release'):$t('planMonitor.applyRelease') }}</el-button>
|
||||
<el-button v-if="scope.row.status === '1'" size="mini" class="button_box" type="primary" @click="handlePreview(scope.row)">{{ $t('planMonitor.preview') }}</el-button>
|
||||
<el-button v-if="scope.row.status === '1'" size="mini" class="button_box" type="danger" @click="handelRevert(scope.row)">{{ $t('planMonitor.revoke') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<create-empty-plan ref="createEmptyPlan" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" @refresh="refresh" />
|
||||
<!-- @dispatchOperate="dispatchOperate" -->
|
||||
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
@ -48,156 +52,154 @@ import { getRpListByMapId, deleteRunPlan } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
export default {
|
||||
name: 'userRunPlanList',
|
||||
components: {
|
||||
CreateEmptyPlan,
|
||||
EditPlanName
|
||||
// LimitList
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
// height: 260,
|
||||
// planId: '',
|
||||
// planName: '',
|
||||
type: 'add',
|
||||
// defaultShowKeys: [],
|
||||
runPlanList: [],
|
||||
runPlanDict: {},
|
||||
isCreate:false,
|
||||
PlanConvert: {}
|
||||
// defaultProps: {
|
||||
// label: 'name'
|
||||
// }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 60 -30;
|
||||
},
|
||||
skinCode() {
|
||||
return this.$route.query.skinCode || '02';
|
||||
},
|
||||
name: 'UserRunPlanList',
|
||||
components: {
|
||||
CreateEmptyPlan,
|
||||
EditPlanName
|
||||
// LimitList
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
// height: 260,
|
||||
// planId: '',
|
||||
// planName: '',
|
||||
type: 'add',
|
||||
// defaultShowKeys: [],
|
||||
runPlanList: [],
|
||||
runPlanDict: {},
|
||||
isCreate:false,
|
||||
PlanConvert: {}
|
||||
// defaultProps: {
|
||||
// label: 'name'
|
||||
// }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 60 - 30;
|
||||
},
|
||||
skinCode() {
|
||||
return this.$route.query.skinCode || '02';
|
||||
},
|
||||
hasRelease() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
this.$store.state.user.roles.includes('05');
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode);
|
||||
},
|
||||
mounted(){
|
||||
this.getRunPlanList();
|
||||
},
|
||||
watch: {
|
||||
'$route' () {
|
||||
this.getRunPlanList();
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
refresh(){
|
||||
this.getRunPlanList();
|
||||
},
|
||||
getRunPlanList() {
|
||||
if(/^\/design\/userlist/.test(this.$route.fullPath)){
|
||||
this.isCreate=false;
|
||||
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'));
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.isCreate=true;
|
||||
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'));
|
||||
});
|
||||
}
|
||||
},
|
||||
// dispatchOperate(){
|
||||
// this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
|
||||
// },
|
||||
dispatchDialog(){
|
||||
this.$refs['createEmptyPlan'].doShow();
|
||||
},
|
||||
handleCreate(){
|
||||
this.$refs['createEmptyPlan'].doShow();
|
||||
},
|
||||
handleConfirm(row){
|
||||
this.loadRunPlanData({
|
||||
planId: row.id,
|
||||
skinCode: this.$route.query.skinCode,
|
||||
planName: row.name
|
||||
});
|
||||
},
|
||||
// 修改运行图名称
|
||||
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'));
|
||||
}
|
||||
},
|
||||
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 };
|
||||
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 });
|
||||
}
|
||||
}
|
||||
},
|
||||
// 删除运行图
|
||||
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(() => { });
|
||||
},
|
||||
handlePublish(row) {
|
||||
this.$confirm(this.hasRelease? this.$t('tip.publishRunPlanTips'):this.$t('tip.applyRunPlanTips'),this.$t('tip.hint'),{
|
||||
},
|
||||
watch: {
|
||||
'$route' () {
|
||||
this.getRunPlanList();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode);
|
||||
},
|
||||
mounted() {
|
||||
this.getRunPlanList();
|
||||
},
|
||||
methods:{
|
||||
refresh() {
|
||||
this.getRunPlanList();
|
||||
},
|
||||
getRunPlanList() {
|
||||
if (/^\/design\/userlist/.test(this.$route.fullPath)) {
|
||||
this.isCreate = false;
|
||||
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'));
|
||||
});
|
||||
} else {
|
||||
this.isCreate = true;
|
||||
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'));
|
||||
});
|
||||
}
|
||||
},
|
||||
// dispatchOperate(){
|
||||
// this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
|
||||
// },
|
||||
dispatchDialog() {
|
||||
this.$refs['createEmptyPlan'].doShow();
|
||||
},
|
||||
handleCreate() {
|
||||
this.$refs['createEmptyPlan'].doShow();
|
||||
},
|
||||
handleConfirm(row) {
|
||||
this.loadRunPlanData({
|
||||
planId: row.id,
|
||||
skinCode: this.$route.query.skinCode,
|
||||
planName: row.name
|
||||
});
|
||||
},
|
||||
// 修改运行图名称
|
||||
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'));
|
||||
}
|
||||
},
|
||||
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 };
|
||||
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 });
|
||||
}
|
||||
}
|
||||
},
|
||||
// 删除运行图
|
||||
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(() => {
|
||||
if (this.hasRelease){
|
||||
publishRunPlan(row.id,{runPlanName: name}).then(resp => {
|
||||
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(() => { });
|
||||
},
|
||||
handlePublish(row) {
|
||||
this.$confirm(this.hasRelease ? this.$t('tip.publishRunPlanTips') : this.$t('tip.applyRunPlanTips'), 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.$t('tip.publishRunPlanSuccess'));
|
||||
this.refresh();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.publishRunPlanFail'));
|
||||
this.refresh();
|
||||
})
|
||||
});
|
||||
} else {
|
||||
releaseOrCancelRunPlan(row.id, '1').then(resp => {
|
||||
this.$message.success(this.$t('tip.applyRunPlanSuccess'));
|
||||
@ -205,58 +207,58 @@ export default {
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.applyRunPlanFail'));
|
||||
this.refresh();
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handelRevert(row) {
|
||||
this.$confirm(this.$t('tip.cancelRunPlanTips'),this.$t('tip.hint'),{
|
||||
this.$confirm(this.$t('tip.cancelRunPlanTips'), this.$t('tip.hint'), {
|
||||
confirmButtonText: this.$t('tip.confirm'),
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type:'warning'
|
||||
}).then(() => {
|
||||
releaseOrCancelRunPlan(row.id,'0').then(resp=> {
|
||||
releaseOrCancelRunPlan(row.id, '0').then(resp=> {
|
||||
this.$message.success(this.$t('tip.cancelRunPlanSuccess'));
|
||||
this.refresh();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.cancelRunPlanFail'))
|
||||
this.$messageBox(this.$t('tip.cancelRunPlanFail'));
|
||||
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;
|
||||
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) {
|
||||
return time.replace("T"," ");
|
||||
return time.replace('T', ' ');
|
||||
},
|
||||
handlePreview(row){
|
||||
handlePreview(row) {
|
||||
previewRunPlan(row.id).then(resp => {
|
||||
const query = {
|
||||
skinCode: row.skinCode, prdType: '01', group: resp.data, mapId: row.mapId, planId: row.id,from:''
|
||||
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);
|
||||
this.$messageBox(this.$t('tip.createSimulationFaild') + this.$t('global.colon') + error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
@ -12,7 +12,7 @@
|
||||
>
|
||||
<div>
|
||||
<el-tabs v-model="activeTab" type="card">
|
||||
<el-tab-pane :label="this.$t('planMonitor.normalNew')" name="first">
|
||||
<el-tab-pane :label="this.$t('planMonitor.normalNew')" name="first">
|
||||
<el-row>
|
||||
<el-form ref="form" :model="newModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
|
||||
<el-form-item :label="this.$t('planMonitor.runGraphName')+this.$t('global.colon')" prop="name">
|
||||
@ -69,196 +69,196 @@ import { UrlConfig } from '@/router/index';
|
||||
import XLSX from 'xlsx';
|
||||
|
||||
export default {
|
||||
name: 'CreateEmptyPlan',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
planConvert: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return { };
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'second',
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
loadingDig: null,
|
||||
publishMapList: [],
|
||||
newModel: {
|
||||
name: '',
|
||||
skinCode: this.$route.query.skinCode
|
||||
},
|
||||
pullModel: {
|
||||
templateId: '',
|
||||
name: '',
|
||||
skinCode: this.$route.query.skinCode
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.$t('planMonitor.newRunGraph');
|
||||
},
|
||||
rules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
},
|
||||
pullRules() {
|
||||
return {
|
||||
templateId: [
|
||||
{ required: true, message: this.$t('rules.chooseToPublishTheRunGraph'), trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
name: 'CreateEmptyPlan',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
planConvert: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return { };
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'second',
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
loadingDig: null,
|
||||
publishMapList: [],
|
||||
newModel: {
|
||||
name: '',
|
||||
skinCode: this.$route.query.skinCode
|
||||
},
|
||||
pullModel: {
|
||||
templateId: '',
|
||||
name: '',
|
||||
skinCode: this.$route.query.skinCode
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.$t('planMonitor.newRunGraph');
|
||||
},
|
||||
rules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
},
|
||||
pullRules() {
|
||||
return {
|
||||
templateId: [
|
||||
{ required: true, message: this.$t('rules.chooseToPublishTheRunGraph'), trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
async initLoad() {
|
||||
const res = await queryRunPlanList(this.$route.query.skinCode);
|
||||
if (res.code == 200 && res.data.length) {
|
||||
this.publishMapList = res.data;
|
||||
}
|
||||
},
|
||||
doShow() {
|
||||
this.dialogShow = true;
|
||||
this.initLoad();
|
||||
},
|
||||
doClose() {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.newModel.name = '';
|
||||
this.pullModel.templateId = '';
|
||||
this.pullModel.name = '';
|
||||
if (this.$refs.form) {
|
||||
this.$refs.form.resetFields();
|
||||
}
|
||||
if (this.$refs.pullForm) {
|
||||
this.$refs.pullForm.resetFields();
|
||||
}
|
||||
},
|
||||
handleCommit() {
|
||||
if (this.activeTab === 'first') {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
createEmptyPlan(this.newModel).then(resp => {
|
||||
const params = {
|
||||
dialogName: 'openRunPlan',
|
||||
operate: 'loadRunPlanData',
|
||||
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.newModel.name, refresh: true }
|
||||
};
|
||||
this.$emit('refresh');
|
||||
// this.$emit('dispatchOperate', params);
|
||||
this.$message.success(this.$t('tip.createAnEmptyRunGraphSuccessfully'));
|
||||
// this.jump(resp.data, this.newModel.name);
|
||||
this.doClose();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('error.createOperationGraphFailed')+ this.$t('global.colon') + error.message);
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs['pullForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
postCreatePlan(this.pullModel).then(resp => {
|
||||
this.$message.success(this.$t('tip.createARunGraphSuccessfully'));
|
||||
// this.jump(resp.data, this.pullModel.name);
|
||||
this.$emit('refresh');
|
||||
this.doClose();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('error.createOperationGraphFailed')+ this.$t('global.colon') + error.message);
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
importf(item) {
|
||||
const obj = this.$refs.files;
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
this.handleImportRunPlan(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
loadingScreen() {
|
||||
this.loadingDig = this.$loading({
|
||||
lock: true,
|
||||
text: this.$t('tip.underImport'),
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
},
|
||||
// 导入运行图
|
||||
handleImportRunPlan(file) {
|
||||
if (file) {
|
||||
this.loadingScreen();
|
||||
setTimeout(() => {
|
||||
const that = this;
|
||||
const reader = new FileReader();
|
||||
if (reader) {
|
||||
reader.onload = function (e) {
|
||||
let wb;
|
||||
const data = e.target.result;
|
||||
if (that.rABS) {
|
||||
wb = XLSX.read(btoa(that.fixdata(data)), { // 手动转化
|
||||
type: 'base64'
|
||||
});
|
||||
} else {
|
||||
wb = XLSX.read(data, {
|
||||
type: 'binary'
|
||||
});
|
||||
}
|
||||
if (wb) {
|
||||
try {
|
||||
let jsonData = [];
|
||||
for (const index in wb.Sheets) {
|
||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async initLoad() {
|
||||
const res = await queryRunPlanList(this.$route.params.mapId);
|
||||
if (res.code == 200 && res.data.length) {
|
||||
this.publishMapList = res.data;
|
||||
}
|
||||
},
|
||||
doShow() {
|
||||
this.dialogShow = true;
|
||||
this.initLoad();
|
||||
},
|
||||
doClose() {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.newModel.name = '';
|
||||
this.pullModel.templateId = '';
|
||||
this.pullModel.name = '';
|
||||
if (this.$refs.form) {
|
||||
this.$refs.form.resetFields();
|
||||
}
|
||||
if (this.$refs.pullForm) {
|
||||
this.$refs.pullForm.resetFields();
|
||||
}
|
||||
},
|
||||
handleCommit() {
|
||||
if (this.activeTab === 'first') {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
createEmptyPlan(this.newModel).then(resp => {
|
||||
const params = {
|
||||
dialogName: 'openRunPlan',
|
||||
operate: 'loadRunPlanData',
|
||||
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.newModel.name, refresh: true }
|
||||
};
|
||||
this.$emit('refresh');
|
||||
// this.$emit('dispatchOperate', params);
|
||||
this.$message.success(this.$t('tip.createAnEmptyRunGraphSuccessfully'));
|
||||
// this.jump(resp.data, this.newModel.name);
|
||||
this.doClose();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('error.createOperationGraphFailed') + this.$t('global.colon') + error.message);
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs['pullForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
postCreatePlan(this.pullModel).then(resp => {
|
||||
this.$message.success(this.$t('tip.createARunGraphSuccessfully'));
|
||||
// this.jump(resp.data, this.pullModel.name);
|
||||
this.$emit('refresh');
|
||||
this.doClose();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('error.createOperationGraphFailed') + this.$t('global.colon') + error.message);
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
importf(item) {
|
||||
const obj = this.$refs.files;
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
this.handleImportRunPlan(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
loadingScreen() {
|
||||
this.loadingDig = this.$loading({
|
||||
lock: true,
|
||||
text: this.$t('tip.underImport'),
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
},
|
||||
// 导入运行图
|
||||
handleImportRunPlan(file) {
|
||||
if (file) {
|
||||
this.loadingScreen();
|
||||
setTimeout(() => {
|
||||
const that = this;
|
||||
const reader = new FileReader();
|
||||
if (reader) {
|
||||
reader.onload = function (e) {
|
||||
let wb;
|
||||
const data = e.target.result;
|
||||
if (that.rABS) {
|
||||
wb = XLSX.read(btoa(that.fixdata(data)), { // 手动转化
|
||||
type: 'base64'
|
||||
});
|
||||
} else {
|
||||
wb = XLSX.read(data, {
|
||||
type: 'binary'
|
||||
});
|
||||
}
|
||||
if (wb) {
|
||||
try {
|
||||
let jsonData = [];
|
||||
for (const index in wb.Sheets) {
|
||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
|
||||
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
|
||||
that.loadingDig.close();
|
||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
}).catch(error => {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
||||
});
|
||||
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
|
||||
that.loadingDig.close();
|
||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
}).catch(error => {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (that.rABS) {
|
||||
reader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
reader.readAsBinaryString(file);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
this.doClose();
|
||||
},
|
||||
jump(planId, planName) {
|
||||
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
|
||||
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
that.loadingDig.close();
|
||||
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (that.rABS) {
|
||||
reader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
reader.readAsBinaryString(file);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
this.doClose();
|
||||
},
|
||||
jump(planId, planName) {
|
||||
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
|
||||
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -28,22 +28,22 @@ import home2 from '@/assets/home/plan2.png';
|
||||
import home3 from '@/assets/home/plan3.png';
|
||||
|
||||
export default {
|
||||
name: 'Home',
|
||||
data() {
|
||||
return {
|
||||
listImg: [
|
||||
{ src: home1 },
|
||||
{ src: home2 },
|
||||
{ src: home3 }
|
||||
],
|
||||
logo: logo
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
}
|
||||
name: 'Home',
|
||||
data() {
|
||||
return {
|
||||
listImg: [
|
||||
{ src: home1 },
|
||||
{ src: home2 },
|
||||
{ src: home3 }
|
||||
],
|
||||
logo: logo
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -19,38 +19,38 @@ import drapLeft from '@/views/components/drapLeft/index';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
name: 'Exam',
|
||||
components: {
|
||||
planList,
|
||||
drapLeft
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listShow: true,
|
||||
widthLeft: Number(localStore.get('LeftWidth')) || 450
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'lessonbar'
|
||||
]),
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'lessonbar.opened': function (val) {
|
||||
this.listShow = val;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.$refs && this.$refs.planList && this.$refs.planList.refresh();
|
||||
},
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
}
|
||||
}
|
||||
name: 'Exam',
|
||||
components: {
|
||||
planList,
|
||||
drapLeft
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listShow: true,
|
||||
widthLeft: Number(localStore.get('LeftWidth')) || 450
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'lessonbar'
|
||||
]),
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'lessonbar.opened': function (val) {
|
||||
this.listShow = val;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.$refs && this.$refs.planList && this.$refs.planList.refresh();
|
||||
},
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user