updateReleaseLimit.vue 8.25 KB
Newer Older
1 2
<template>
  <el-dialog :visible="show" @close="handleClose" :title="$t('收货人限制修改申请')" width="1000px">
3
    <el-form label-position="left" label-width="150px" :model="form" :disabled="applyStatus === 1">
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
      <el-row :gutter="20">
        <!-- 订单号 -->
        <el-col :span="8">
          <el-form-item :label="$t('订单号')">
            <span>{{ order.orderNo }}</span>
          </el-form-item>
        </el-col>
        <!-- 总箱数 -->
        <el-col :span="8">
          <el-form-item :label="$t('总箱数')">
            <span>{{ order.sumNum }}</span>
          </el-form-item>
        </el-col>
        <!-- 体积 -->
        <el-col :span="8">
          <el-form-item :label="$t('体积')">
            <span>{{ order.sumVolume }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <!-- 重量 -->
        <el-col :span="8">
          <el-form-item :label="$t('重量')">
            <span>{{ order.sumWeight }}Kg</span>
          </el-form-item>
        </el-col>
        <!-- 总控箱数 -->
        <el-col :span="8">
          <el-form-item :label="$t('总控货箱数')">
            <span>{{ order.sumNum }}</span>
          </el-form-item>
        </el-col>
        <!-- 剩余放货箱数 -->
        <el-col :span="8">
          <el-form-item :label="$t('剩余放货箱数')">
            <span>{{order.sumNum - order.releaseNum	}}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <!-- 邮库/到仓时间 -->
        <el-col :span="8">
          <el-form-item :label="$t('卸柜/到仓时间')">
            <span>{{ order.unloadTime }}</span>
          </el-form-item>
        </el-col>
        <!-- 订单限制修改收货人 -->
        <el-col :span="8">
          <el-form-item :label="$t('订单限制修改收货人')">
            <span>{{ order.isLimitUpdateConsignee ? $t('') : $t('') }}</span>
          </el-form-item>
        </el-col>
        <!-- 订单锁定收货人天数 -->
        <el-col :span="8" v-if="order.isLimitUpdateConsignee">
          <el-form-item :label="$t('订单锁定收货人天数')">
            <span>{{ order.lockConsigneeDay }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20" v-if="order.isLimitUpdateConsignee">
        <!-- 放货锁定收货人到期时间 -->
        <el-col :span="12">
          <el-form-item :label="$t('放货锁定收货人到期时间')" label-width="180px">
            <span>{{ order.lockConsigneeTime }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider>{{$t('修改信息')}}</el-divider>

      <el-row :gutter="20">
        <!-- 订单限制修改收货人 -->
        <el-col :span="8">
          <el-form-item :label="$t('订单限制修改收货人')">
            <el-radio-group v-model="form.newIsLimitUpdateConsignee">
              <el-radio :label="true">{{$t('')}}</el-radio>
              <el-radio :label="false">{{$t('')}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <!-- 订单锁定收货人天数 -->
        <el-col :span="8">
          <el-form-item :label="$t('订单锁定收货人天数')" required>
            <el-input-number :min="0" v-model="form.newLockConsigneeDay" :disabled="!form.newIsLimitUpdateConsignee"></el-input-number>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <!-- 放货锁定收货人到期时间 -->
        <el-col :span="12">
          <el-form-item :label="$t('放货锁定收货人到期时间')" label-width="180px">
            <span>{{ newLockConsigneeTime }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <!-- 修改原因 -->
        <el-col :span="24">
          <el-form-item :label="$t('修改原因')">
            <el-input type="textarea" v-model="form.reasonZh"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <!-- 附件 -->
        <el-col :span="24">
          <el-form-item :label="$t('附件')">
            <file-upload v-model="form.annex" :fileType="fileType"></file-upload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
123
        <work-flow xmlkey="order_consignee_limit_change" v-model="form.ccIds"></work-flow>
124 125 126 127
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">{{$t('取消')}}</el-button>
128 129
      <el-button v-if="applyStatus === 1" type="primary" @click="handleGoBpm">{{$t('审批中')}}</el-button>
      <el-button v-else type="primary" @click="handleSubmit">{{$t('确定')}}</el-button>
130 131 132 133 134 135 136
    </span>
  </el-dialog>
</template>

<script>
import WorkFlow from '@/components/WorkFlow/index.vue'
import FileUpload from '@/components/FileUpload/index.vue'
137 138 139
import { applyCargoControlApproval, getLimitUpdateInfo } from '@/api/ecw/orderCargoControl'
import dayjs from 'dayjs'
import { getApproval } from '@/api/ecw/order'
140 141 142 143 144 145 146 147 148 149 150 151 152
export default {
  components:{
    FileUpload,
    WorkFlow
  },
  props:{
    order: Object
  },
  data() {
    return {
      // 是否显示弹窗
      show: true,
      fileType: ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf", 'jpg', 'jpeg', 'png', 'mp4', 'mov', 'avi', 'mp3'],
153
      applyStatus: 0, // 审批状态: 1 处理中 2 通过 3 不通过 4 已取消
154
      bpmId: null, // 审批流程ID
155 156 157 158 159 160 161 162 163 164 165 166
      form: {
        // 申请类型:此处应该是 61 放货限制修改申请 62 海外仓修改申请
        applyType: 61,
        // 新的是否限制修改收货人
        newIsLimitUpdateConsignee: false,
        // 新的放货锁定收货人天数
        newLockConsigneeDay: '',
        // 修改原因
        reasonZh: '',
        // 附件
        annex: '',
        ccIds: []
167 168 169
      },
      // 审批信息
      approvalDetail: null
170 171 172 173 174 175 176 177
    }
  },
  computed:{
    // 当订单已卸柜/到仓,则时间为卸柜/到仓时间 + 锁定收货人天数,否则为空
    newLockConsigneeTime(){
      if(!this.order.unloadTime || !this.form.newIsLimitUpdateConsignee || !this.form.newLockConsigneeDay){
        return '-'
      }
178
      return dayjs(this.order.unloadTime).add(this.form.newLockConsigneeDay, "day").format('YYYY-MM-DD HH:mm:ss')
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    }
  },
  watch:{
    // 不限制则天数清空
    'form.newIsLimitUpdateConsignee'(val){
      if(!val){
        this.form.newLockConsigneeDay = ''
      }
    }
  },
  mounted() {
    this.form.newIsLimitUpdateConsignee = !!this.order.isLimitUpdateConsignee
    if(this.form.newIsLimitUpdateConsignee){
      this.form.newLockConsigneeDay = this.order.lockConsigneeDay
    }
194 195
    // 根据订单获取审批详情
    this.getApply()
196 197
  },
  methods:{
198 199 200 201 202
    getApply(){
      // 先重置
      this.applyStatus = 0
      getLimitUpdateInfo(this.order.orderId).then(res => {
        const data = res.data
203
        console.log({data})
204
        if(data.applyType === this.form.applyType){
205 206 207 208 209
          this.form.newIsLimitUpdateConsignee = data.newIsLimitUpdateConsignee
          this.form.newLockConsigneeDay = data.newLockConsigneeDay
          this.form.reasonZh = data.reasonZh
          this.form.annex = data.annex
          this.form.ccIds = data.ccIds?.split(",").filter(item => !!item).map(item => Number(item)) || []
210 211

          this.applyStatus = data.applyStatus
212 213
          this.bpmId = data.formId
          /* // 如果是申请中,则需要查询审批数据
214 215
          if(this.applyStatus === 1){
            this.getApproval()
216
          } */
217 218 219
        }
      })
    },
220
    /* getApproval(){
221 222 223
      getApproval(this.id).then(res => {
        this.approvalDetail = res.data
      })
224
    }, */
225 226
    handleGoBpm(){
      console.log("跳转审批页面,待完善")
227 228 229 230 231 232 233
      this.handleClose()
      this.$router.push({
        path: "/bpm/process-instance/detail",
        query: {
          id: this.bpmId
        }
      })
234
    },
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
    handleClose(){
      this.show = false
      this.$emit("close")
    },
    handleSubmit(){
      const data = {
        ...this.form,
        ccIds: this.form.ccIds.join(','),
        orderId: this.order.orderId
      }
      applyCargoControlApproval(data).then(res => {
        this.$message.success(this.$t('操作成功'))
        this.$emit('success')
      })
    }
  }
}
</script>