regError.vue 5.28 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1
<template>
huhaiqing's avatar
huhaiqing committed
2
  <div class="shippingSea-dialog">
huhaiqing's avatar
huhaiqing committed
3
    <el-form ref="errorForm" :model="errorObj" label-width="140px">
4
      <el-form-item :label="$t('操作步骤')">
5
        <el-select v-if="flag=='sea'" v-model="errorObj.opStep" :placeholder="$t('请选择操作步骤')">
6
          <el-option v-for="type in this.getDictDatas(DICT_TYPE.BOX_SHIPPING_PROCESS)" :key="type.value" :label="$l(type, 'label')" :value="type.value"></el-option>
huhaiqing's avatar
huhaiqing committed
7
        </el-select>
8 9 10
        <el-select v-if="flag=='seaAir'" v-model="errorObj.opStep" :placeholder="$t('请选择操作步骤')">
          <el-option v-for="type in this.getDictDatas(DICT_TYPE.BOX_SEA_AIR)" :key="type.value" :label="$l(type, 'label')" :value="type.value"></el-option>
        </el-select>
huhaiqing's avatar
huhaiqing committed
11
      </el-form-item>
12 13 14
      <el-form-item :label="$t('票异常')">
        <el-select v-model="errorObj.billAbnId" :placeholder="$t('请选择票异常')">
          <el-option v-for="type in this.getDictDatas(DICT_TYPE.BOX_SHIPPING_TICKET_EXCEPTION)" :key="type.value" :label="$l(type, 'label')" :value="type.value"></el-option>
huhaiqing's avatar
huhaiqing committed
15 16
        </el-select>
      </el-form-item>
17 18
      <el-form-item :label="$t('异常情况')">
        <el-input v-model="errorObj.abnDetail" type="textarea" rows="2" :placeholder="$t('请输入异常情况')"></el-input>
huhaiqing's avatar
huhaiqing committed
19
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
20
      <el-form-item :label="$t('异常时间')" prop="arrivalTime" class="three-element">
21 22
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="errorObj.abnStartTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="errorObj.abnEndTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
23
        <div class="delayTime">延迟时间:{{delayDay}}</div>
huhaiqing's avatar
huhaiqing committed
24
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
25

huhaiqing's avatar
huhaiqing committed
26 27 28 29 30
      <el-form-item :label="$t('通知人')">
        <userSelect v-model="errorObj.notifyUsers" :placeholder="$t('请选择通知人')" :allUsers="this.$attrs.allUsers" multiple />
      </el-form-item>

      <!-- <el-form-item :label="$t('是否更新订单状态')">
31
        <el-radio-group v-model="errorObj.orderStatus">
huhaiqing's avatar
huhaiqing committed
32 33 34
          <el-radio v-for="item in status" :key="item.value" :label="item.value">{{item.label}}</el-radio>
        </el-radio-group>
      </el-form-item>
35 36
      <el-form-item :label="$t('中文内容')">
        <el-input v-model="errorObj.contentZh" type="textarea" rows="2" :placeholder="$t('请输入中文内容')"></el-input>
huhaiqing's avatar
huhaiqing committed
37
      </el-form-item>
38 39
      <el-form-item :label="$t('英文内容')">
        <el-input v-model="errorObj.contentEn" type="textarea" rows="2" :placeholder="$t('请输入英文内容')"></el-input>
huhaiqing's avatar
huhaiqing committed
40
      </el-form-item> -->
huhaiqing's avatar
huhaiqing committed
41 42 43
    </el-form>

    <el-row class="operate-button">
44 45
      <el-button type="success" @click="onSubmit">{{$t('提交')}}</el-button>
      <el-button @click="$emit('closeDialog')">{{$t('关闭')}}</el-button>
huhaiqing's avatar
huhaiqing committed
46 47 48 49 50
    </el-row>
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
51 52
import { abnormalCreate } from "@/api/ecw/boxSea";
import { serviceMsg } from "./shippingSea/utils";
huhaiqing's avatar
huhaiqing committed
53 54 55
import userSelect from "./shippingSea/nodePage/common/userSelect.vue";
import dayjs from "dayjs";

huhaiqing's avatar
huhaiqing committed
56 57 58 59 60
/**
 * 异常登记
 */
export default {
  name: "regError",
huhaiqing's avatar
huhaiqing committed
61
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
62
  components: { userSelect },
huhaiqing's avatar
huhaiqing committed
63 64 65 66 67 68 69 70
  data() {
    return {
      // 异常对象
      errorObj: {},
      // 是否更新订单动态
      status: [
        {
          value: "1",
71
          label: this.$t(""),
huhaiqing's avatar
huhaiqing committed
72 73 74
        },
        {
          value: "2",
75
          label: this.$t(""),
huhaiqing's avatar
huhaiqing committed
76 77
        },
      ],
huhaiqing's avatar
huhaiqing committed
78 79
      flag: "sea",
      delayDay: 0,
huhaiqing's avatar
huhaiqing committed
80 81
    };
  },
82 83
  created() {
    const { currNode } = this.$attrs;
huhaiqing's avatar
huhaiqing committed
84
    this.errorObj = { opStep: currNode?.dataKey ?? undefined };
huhaiqing's avatar
huhaiqing committed
85 86
    if (this.$attrs.shipmentObj.bosType == "seaAir") {
      this.flag = "seaAir";
87
    }
88
  },
huhaiqing's avatar
huhaiqing committed
89 90 91 92 93 94 95 96 97 98
  watch: {
    // 异常开始时间
    "errorObj.abnStartTime"(val) {
      this.compareDate(val, this.errorObj.abnEndTime);
    },
    // 异常结束时间
    "errorObj.abnEndTime"(val) {
      this.compareDate(this.errorObj.abnStartTime, val);
    },
  },
huhaiqing's avatar
huhaiqing committed
99
  methods: {
huhaiqing's avatar
huhaiqing committed
100 101 102 103 104 105 106 107 108 109 110
    // 时间比较
    compareDate(abnStartTime, abnEndTime) {
      this.delayDay = 0;
      let date1 = null,
        date2 = null;
      if (abnStartTime) date1 = dayjs(abnStartTime);
      if (abnEndTime) date2 = dayjs(abnEndTime);
      if (date1 && date2) {
        this.delayDay = date2.diff(date1, "day");
      }
    },
huhaiqing's avatar
huhaiqing committed
111 112 113 114
    /** 提交 */
    onSubmit() {
      this.$refs["errorForm"].validate((valid) => {
        if (valid) {
115 116
          abnormalCreate({
            ...this.errorObj,
huhaiqing's avatar
huhaiqing committed
117 118
            delayDays: this.delayDay,
            notifyUsers: this.errorObj.notifyUsers?.join(",") ?? "",
119 120 121
            shipmentId: this.$attrs.shipmentObj.id,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
huhaiqing's avatar
huhaiqing committed
122
              this.$emit("closeDialog", "error");
123 124
            });
          });
huhaiqing's avatar
huhaiqing committed
125 126 127 128 129 130 131
        }
      });
    },
  },
};
</script>

huhaiqing's avatar
huhaiqing committed
132 133 134 135 136 137 138 139 140 141 142 143
<style lang="scss">
// 海运操作统一弹窗样式
.shippingSea-dialog {
  // 页面内元素弹窗form控件宽度设置
  .el-form-item__content {
    > div:not(.el-input-number) {
      width: 100%;
    }
  }
  .operate-button {
    text-align: center;
  }
huhaiqing's avatar
huhaiqing committed
144
  .three-element {
huhaiqing's avatar
huhaiqing committed
145 146
    .el-form-item__content {
      display: flex;
huhaiqing's avatar
huhaiqing committed
147 148 149 150 151
      > .el-date-editor {
        margin-right: 10px;
      }
      > .delayTime {
        width: 300px;
huhaiqing's avatar
huhaiqing committed
152 153 154 155
      }
    }
  }
}
huhaiqing's avatar
huhaiqing committed
156
</style>