<template>
  <el-dialog
    v-dialogDrag
    class="chengdou-03__systerm train-set-plan"
    :title="title"
    :visible.sync="show"
    width="560px"
    :before-close="doClose"
    :z-index="2000"
    :modal="false"
    :close-on-click-modal="false"
  >
    {{ 111 }}
    <el-row justify="center" style="margin-top:10px">
      <el-col :span="7" :offset="5">
        <el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
      </el-col>
      <el-col :span="7" :offset="2">
        <el-button :id="domIdCancel" @click="cancel">取 消</el-button>
      </el-col>
    </el-row>
  </el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
    name: 'ModifyTripNumber',
    data() {
        return {
            dialogShow: false,
            loading: false,
            model:{
                // runPlanCode:'', // 新增没有
                stationCode:'', // 车站编码
                // groupNumber:'', // 班别:目前没有
                arriveSectionCode:'', // 到达股道
                arrivePlanTime:'', // 到达计划时间
                arriveTripNumber:'', // 到达车次
                arriveStationCode:'', // 到达车站
                arriveDirectionCode:'', // 到达方向编码（到达口）

                departSectionCode:'', // 发车股道
                departPlanTime:'', // 发车计划时间
                departTripNumber:'', // 发车车次
                departStationCode:'', // 发车车站
                departDirectionCode:'', // 发向方向编码（发车口）

                startRunPlan:false, // 始发计划  true,false
                endRunPlan:false, // 终到计划   true,false

                electrical:false, // 电力   true,false
                passenger:false, // 客运    true,false
                keyTrains:false, // 重点列车   true,false
                military:false, // 是否军用    true,false

                trackDiscordant:false, // 运行股道与基本径路不一致
                entryOutDiscordant:false, // 出入口与基本径路不一致

                transfinite:'NO' // 超限等级   NO：不超限   TRANSFINITE_SUPER：超级超限   TRANSFINITE_ONE_LEVEL：一级超限  TRANSFINITE_TWO_LEVEL：二级超限

            }
        };
    },
    computed: {
        show() {
            return this.dialogShow && !this.$store.state.menuOperation.break;
        },
        domIdCancel() {
            return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
        },
        domIdConfirm() {
            return this.dialogShow ? OperationEvent.CTCCommand.modifyTripNumber.menu.domId : '';
        },
        title() {
            return '增加阶段计划车次';
        }
    },
    methods: {
        doShow(row) {
            this.dialogShow = true;
            this.$nextTick(function () {
                this.$store.dispatch('training/emitTipFresh');
            });
        },
        doClose() {
            this.loading = false;
            this.dialogShow = false;
            this.model = {
                arriveTripNumber:'', // 到达车次
                departTripNumber:'' // 发车车次
            };
            this.$store.dispatch('training/emitTipFresh');
        },
        commit() {
            // this.loading = true;
        },
        cancel() {
            const operate = {
                operation: OperationEvent.Command.cancel.menu.operation
            };
            this.$emit('clearRpRow');
            this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
                if (valid) {
                    this.doClose();
                }
            }).catch(() => { this.doClose(); });
        }

    }
};
</script>
