114 lines
3.3 KiB
Vue
114 lines
3.3 KiB
Vue
<template>
|
|
<el-dialog
|
|
v-dialogDrag
|
|
class="planEdit__tool delete-task"
|
|
:title="title"
|
|
:visible.sync="dialogShow"
|
|
width="400px"
|
|
:before-close="doClose"
|
|
:z-index="2000"
|
|
:modal="false"
|
|
:close-on-click-modal="false"
|
|
>
|
|
<el-row>
|
|
<el-radio v-model="model.deleteBefore" :label="true">{{ $t('planMonitor.deleteAllPreviousTasks') }}</el-radio>
|
|
</el-row>
|
|
<el-row>
|
|
<el-radio v-model="model.deleteBefore" :label="false">{{ $t('planMonitor.deleteAllSubsequentTasks') }}</el-radio>
|
|
</el-row>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
|
|
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { deletePlanTrip } from '@/api/runplan';
|
|
|
|
export default {
|
|
name: 'DeleteTask',
|
|
components: {
|
|
},
|
|
data() {
|
|
return {
|
|
dialogShow: false,
|
|
loading: false,
|
|
isPlan: false,
|
|
model: {
|
|
routingCode: '',
|
|
deleteBefore: false,
|
|
tripNumber: '',
|
|
serviceNumber: ''
|
|
}
|
|
};
|
|
},
|
|
computed: {
|
|
title() {
|
|
return this.$t('planMonitor.deleteTask');
|
|
}
|
|
},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
doShow(params) {
|
|
this.isPlan = params.isPlan;
|
|
this.model.taskIndex = params.taskIndex;
|
|
this.model.tripNumber = params.tripNumber;
|
|
this.model.serviceNumber = params.serviceNumber;
|
|
this.model.routingCode = params.routingCode;
|
|
this.dialogShow = true;
|
|
},
|
|
doClose() {
|
|
this.loading = false;
|
|
this.dialogShow = false;
|
|
},
|
|
handleCommit() {
|
|
if (this.isPlan) {
|
|
// 计划删除任务
|
|
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmDeleteTask', params: this.model });
|
|
} else {
|
|
// 直接删除任务
|
|
const model = {
|
|
planId: this.$route.query.planId,
|
|
SDTNumber: `${this.model.serviceNumber}${this.model.tripNumber}`,
|
|
deleteBefore: this.model.deleteBefore
|
|
};
|
|
|
|
deletePlanTrip(model).then(resp => {
|
|
this.$store.dispatch('runPlan/setSelected', {});
|
|
this.$emit('refresh');
|
|
// this.$emit('dispatchOperate', {
|
|
// dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
|
|
// });
|
|
this.$message.success(this.$t('tip.deleteTaskSuccessfully'));
|
|
}).catch(() => {
|
|
this.$messageBox(this.$t('tip.deleteTaskFailed'));
|
|
});
|
|
}
|
|
this.doClose();
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
@import "src/styles/mixin.scss";
|
|
|
|
/deep/ {
|
|
.el-row {
|
|
margin: 10px;
|
|
}
|
|
}
|
|
.delete-task{
|
|
/deep/ {
|
|
.el-dialog__body{
|
|
padding: 0 20px;
|
|
}
|
|
.dialog-footer{
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
}
|
|
}
|
|
</style>
|