desc: 增加琏计划运行图修改
This commit is contained in:
parent
6b9047c919
commit
118ed1296c
@ -89,9 +89,7 @@ export function postCreatePlan(data) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运行图
|
||||
*/
|
||||
// 删除运行图
|
||||
export function deleteRunPlan(planId) {
|
||||
return request({
|
||||
url: `/api/runPlan/draft/${planId}`,
|
||||
@ -99,6 +97,15 @@ export function deleteRunPlan(planId) {
|
||||
});
|
||||
}
|
||||
|
||||
// 修改运行图内容
|
||||
export function putRunPlanDetail(data) {
|
||||
return request({
|
||||
url: `/api/runPlan/draft/${data.planId}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布运行图
|
||||
*/
|
||||
@ -221,15 +228,6 @@ export function duplicateService(data) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 修改计划*/
|
||||
// export function updatePlanService(data) {
|
||||
// return request({
|
||||
// url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`,
|
||||
// method: 'put',
|
||||
// data: data
|
||||
// })
|
||||
// }
|
||||
|
||||
/** 增加任务*/
|
||||
export function addPlanTrip(data) {
|
||||
return request({
|
||||
|
@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<el-dialog :title="this.$t('map.operationGraphPublished')" :visible.sync="dialogShow" width="30%" :before-close="handleClose">
|
||||
<div>
|
||||
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini">
|
||||
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini" :rules="rules">
|
||||
<el-form-item :label="this.$t('map.operationGraphName')" prop="name">
|
||||
<el-input v-model="editModel.name" :disabled="true" />
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@ -34,6 +34,11 @@ export default {
|
||||
editModel: {
|
||||
planId: '',
|
||||
name: ''
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
|
@ -155,18 +155,22 @@ export default {
|
||||
// title: '导入运行图',
|
||||
// click: this.handleImportRunPlan
|
||||
// },
|
||||
{
|
||||
title: '删除运行图',
|
||||
click: this.handledeleteRunPlan
|
||||
},
|
||||
{
|
||||
title: '新建运行图',
|
||||
click: this.handleCreateEmptyPlan
|
||||
},
|
||||
{
|
||||
title: '修改运行图名称',
|
||||
click: this.handleEditPlan
|
||||
},
|
||||
{
|
||||
title: '修改站间运行时间',
|
||||
click: this.handleModifyingStationIntervalTime
|
||||
// disabledCallback: () => { return !this.$route.query.planId },
|
||||
},
|
||||
{
|
||||
title: '删除运行图',
|
||||
click: this.handledeleteRunPlan
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -398,6 +402,10 @@ export default {
|
||||
handledeleteRunPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'delete'} });
|
||||
},
|
||||
// 修改运行图名称
|
||||
handleEditPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'edit'} });
|
||||
},
|
||||
loadingScreen() {
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
|
@ -51,6 +51,7 @@
|
||||
|
||||
<script>
|
||||
import { createEmptyPlan, queryRunPlanList, postCreatePlan } from '@/api/runplan';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'CreateEmptyPlan',
|
||||
@ -135,8 +136,9 @@ export default {
|
||||
};
|
||||
|
||||
this.$emit('dispatchOperate', params);
|
||||
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
this.$message.success('创建空运行图成功!');
|
||||
this.jump(resp.data, this.newModel.name);
|
||||
this.doClose();
|
||||
}).catch(() => {
|
||||
this.$messageBox('创建空运行图失败');
|
||||
@ -149,8 +151,9 @@ export default {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
postCreatePlan(this.pullModel).then(resp => {
|
||||
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
this.$message.success('创建运行图成功!');
|
||||
this.jump(resp.data, this.pullModel.name);
|
||||
this.doClose();
|
||||
}).catch(() => {
|
||||
this.$messageBox('创建运行图失败');
|
||||
@ -159,7 +162,10 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
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 });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
116
src/views/planMonitor/editTool/menus/editPlanName.vue
Normal file
116
src/views/planMonitor/editTool/menus/editPlanName.vue
Normal file
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
class="planEdit__tool create-empty-plan"
|
||||
:title="title"
|
||||
:visible.sync="dialogShow"
|
||||
width="30%"
|
||||
:before-close="doClose"
|
||||
:z-index="3000"
|
||||
:modal="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-form ref="form" :model="editModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
|
||||
<el-form-item label="运行图名称:" prop="name">
|
||||
<el-input v-model="editModel.name" autofocus />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" :loading="loading" @click="handleEdit">修改</el-button>
|
||||
<el-button @click="doClose">{{ $t('map.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { putRunPlanDetail } from '@/api/runplan';
|
||||
|
||||
export default {
|
||||
name: 'CreateEmptyPlan',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'first',
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
publishMapList: [],
|
||||
editModel: {
|
||||
planId: '',
|
||||
name: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return '新建运行图';
|
||||
},
|
||||
rules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
doShow(data) {
|
||||
this.dialogShow = true;
|
||||
if (data && data.name) {
|
||||
this.editModel.name = data.name;
|
||||
this.editModel.planId = data.id;
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.editModel.name = '';
|
||||
if (this.$refs.form) {
|
||||
this.$refs.form.resetFields();
|
||||
}
|
||||
},
|
||||
handleEdit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
putRunPlanDetail(this.editModel).then(resp => {
|
||||
const params = {
|
||||
dialogName: 'openRunPlan',
|
||||
operate: 'loadRunPlanData',
|
||||
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.editModel.name, refresh: true }
|
||||
};
|
||||
|
||||
this.$emit('dispatchOperate', params);
|
||||
this.$message.success('修改运行图名称成功!');
|
||||
this.$emit('renewal');
|
||||
this.doClose();
|
||||
}).catch(() => {
|
||||
this.$messageBox('修改运行图名称失败');
|
||||
this.doClose();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
/deep/ {
|
||||
.el-input {
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
width: 120px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
class="planEdit__tool open-runplan"
|
||||
@ -7,7 +8,7 @@
|
||||
width="640px"
|
||||
:before-close="doClose"
|
||||
:z-index="2000"
|
||||
:modal="false"
|
||||
:modal="true"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
|
||||
@ -16,29 +17,33 @@
|
||||
class="filter-tree"
|
||||
:data="runPlanList"
|
||||
:props="defaultProps"
|
||||
highlight-current
|
||||
default-expand-all
|
||||
:style="{height: height-20+'px'}"
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<!-- <span slot-scope="{ node, data }">
|
||||
<el-radio v-model="planId" :label="data.id"><span>{{ data.name }}</span></el-radio>
|
||||
</span> -->
|
||||
</el-tree>
|
||||
/>
|
||||
</el-scrollbar>
|
||||
<el-row type="flex" justify="center" class="button-group">
|
||||
<el-button v-if="type == 'add'" type="primary" @click="handleConfirm">选择运行图</el-button>
|
||||
<el-button v-if="type == 'delete'" type="primary" @click="handleDelete">删除</el-button>
|
||||
<el-button v-if="type == 'edit'" type="primary" @click="handleEdit">修改</el-button>
|
||||
<el-button @click="dialogShow = false">取 消</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRpListByMapId, deleteRunPlan } from '@/api/runplan';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import EditPlanName from './editPlanName';
|
||||
|
||||
export default {
|
||||
name: 'OpenRunPlan',
|
||||
components: {
|
||||
EditPlanName
|
||||
},
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
@ -53,6 +58,7 @@ export default {
|
||||
planId: '',
|
||||
planName: '',
|
||||
type: 'add',
|
||||
// defaultShowKeys: [],
|
||||
runPlanList: [],
|
||||
runPlanDict: {},
|
||||
defaultProps: {
|
||||
@ -88,21 +94,28 @@ export default {
|
||||
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
|
||||
}
|
||||
},
|
||||
doShow(data) {
|
||||
this.type = data.type || 'add';
|
||||
getRunPlanList() {
|
||||
getRpListByMapId(this.$route.query.mapId).then((resp) => {
|
||||
this.runPlanList = resp.data;
|
||||
this.runPlanList.forEach(elem => {
|
||||
this.runPlanDict[elem.id] = elem.name;
|
||||
});
|
||||
// this.defaultShowKeys = [this.planId];
|
||||
this.dialogShow = true;
|
||||
}).catch(() => {
|
||||
this.$messageBox('获取运行图列表失败');
|
||||
});
|
||||
},
|
||||
doShow(data) {
|
||||
this.type = data.type || 'add';
|
||||
this.getRunPlanList();
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
this.planId = '';
|
||||
this.planName = '';
|
||||
},
|
||||
// 跳转到对应运行图
|
||||
handleConfirm() {
|
||||
this.loadRunPlanData({
|
||||
planId: this.planId,
|
||||
@ -111,6 +124,7 @@ export default {
|
||||
});
|
||||
this.doClose();
|
||||
},
|
||||
// 删除运行图
|
||||
handleDelete() {
|
||||
deleteRunPlan(this.planId).then(Response => {
|
||||
this.$message.success(`删除成功!`);
|
||||
@ -122,6 +136,14 @@ export default {
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
|
||||
});
|
||||
},
|
||||
// 修改运行图名称
|
||||
handleEdit() {
|
||||
if (this.planId && this.planName) {
|
||||
this.$refs.editPlan.doShow({id: this.planId, name: this.planName});
|
||||
} else {
|
||||
this.$message.info('请选择运行图');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user