delay.vue 8.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<template>
  <div class="app-container">
    <el-card>
      <el-form :model="handlerParams" ref="queryForms" size="small" :inline="true"  label-width="180px" class="card">

        <el-row>
          <el-form-item :label="$t('客户名称')+':'">
              <span style="margin-left: 8px;">{{handlerParams.customerName}}</span>
          </el-form-item>
        </el-row>
        <el-row >
12
          <el-form-item :label="$t('原计划掉入公海池时间')+':'">
13 14 15 16 17 18 19 20
            <span style="margin-left: 8px;">{{handlerParams.orgEstimateEnterOpenSeaTime}}</span>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item :label="$t('申请延期后掉入时间')+':'">
              <el-date-picker
                v-model="handlerParams.estimateEnterOpenSeaTime"
                type="date"
21
                :picker-options="pickerOptions"
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
                value-format="timestamp"
                :placeholder="$t('请输入申请延期后掉入时间')">
              </el-date-picker>
          </el-form-item>

        </el-row>
        <el-row :span="8">
          <el-form-item :label="$t('凭证')+':'" size="medium" :require="true">
            <upload v-model="handlerParams.voucher" :limit="1"></upload>
          </el-form-item>
        </el-row>
        <el-row :span="8">
          <el-form-item :label="$t('申请理由')+':'" size="medium">
            <el-input style="width: 500px;"  type="textarea" v-model="handlerParams.reason"  />
          </el-form-item>
        </el-row>
      </el-form>
    </el-card>
    <!-- 只有不需要预付才需要审核 -->
    <template>
      <div class="page-title">{{$t('审批流程')}}</div>
43
      <work-flow xmlkey="quotation_customer_delay_public" v-model="ccIdArr" />
44 45 46 47 48 49 50
    </template>
    <div slot="footer" class="dialog-footer">
      <!-- bpmStatus
      异常流程状态,1处理中2通过3不通过4已取消
      待审核可能没有bpmStatus字段
      -->
      <template v-if="handlerParams.status == 1">
我在何方's avatar
我在何方 committed
51
        <el-button type="primary" @click="$router.push(`/bpm/process-instance/detail?id=`+handlerParams.formId)">{{$t('审核中')}}</el-button>
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
        <el-button plain type="primary" @click="cancelAudit">{{$t('取消审核')}}</el-button>
        <el-button plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('返回')}}</el-button>
      </template>
      <template v-else>
        <el-button  type="primary" @click="submitForm">{{$t('提交')}}</el-button>
        <el-button plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('取消')}}</el-button>
      </template>
    </div>
  </div>
</template>

<script>
  import upload from '@/components/ImageUpload'
  import {getDictData, getDictDatas} from  '@/utils/dict'
  import {getCustomer,getDelayInfo,creatDelayApproval,cancelDelayApproval} from '@/api/ecw/customer'
  import WorkFlow from '@/components/WorkFlow'
  import {cancelProcessInstance} from '@/api/bpm/processInstance'
  export default {
    name: "Delay",
    components: {
      upload, WorkFlow
    },
    data() {
      return {
        // 遮罩层
        loading: false,
        handlerParams:{
        },
        customerData:{},
        showWorkFlow: false, // 是否显示工作流
82 83
        dateRangeCreateTime:[],
        pickerOptions: {
84 85
        },
        ccIdArr:[]
86 87
      };
    },
88 89 90 91 92
  watch:{
    ccIdArr(){
      this.$set(this.handlerParams, 'ccIds', this.ccIdArr.join(','))
    }
  },
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
    created() {
      if(this.$route.query.id){
        this.getData(this.$route.query.id)
      }
    },
    methods: {
       getData(id){
         getCustomer(id).then(response => {
            this.customerData = response.data
            this.getDely(id)
         });
      },
      getDely(id){
        console.log(this.customerData)
        let that = this
        getDelayInfo({customerId:id}).then(res=>{
          if(res.data){
              that.handlerParams = res.data
              if(!that.handlerParams.orgEstimateEnterOpenSeaTime){
                that.handlerParams.orgEstimateEnterOpenSeaTime = that.getNowDate(that.customerData.enterOpenSeaTime)
              }
114 115
              if(that.handlerParams.estimateEnterOpenSeaTime){
                that.handlerParams.estimateEnterOpenSeaTime = that.getTime(that.handlerParams.estimateEnterOpenSeaTime)
我在何方's avatar
我在何方 committed
116
              }else{
我在何方's avatar
我在何方 committed
117
                that.$set(that.handlerParams,'estimateEnterOpenSeaTime',that.customerData.estimateEnterOpenSeaTime)
118 119 120 121 122 123
              }
              if(that.handlerParams.ccIds){
                var ids = that.handlerParams.ccIds.split(',')
                ids.map(v=>{
                  that.ccIdArr.push(parseInt(v))
                })
我在何方's avatar
我在何方 committed
124

125
              }
我在何方's avatar
我在何方 committed
126
              console.log(that.ccIdArr)
127 128 129 130 131 132 133
            }else{
              that.handlerParams = {
                  customerId:that.customerData.id,
                  customerName:that.customerData.name,
                  orgEstimateEnterOpenSeaTime: that.getNowDate(that.customerData.enterOpenSeaTime)
              }
            }
134 135 136 137 138 139 140 141
            that.pickerOptions = {
              disabledDate: (time) => {
                var date = new Date(that.handlerParams.orgEstimateEnterOpenSeaTime);
                  return (
                    time.getTime() < date.getTime()
                  );
                },
              }
142 143 144 145 146 147 148 149 150 151 152 153
        })
      },
      submitForm(){
          // if(!this.handlerParams.orderExceptionHandlerResult){
          //   this.$modal.msgError(this.$t('请选择处理结果'));
          //   return
          // }

            // if(!this.handlerParams.fileList||this.handlerParams.fileList.length==0){
            //   this.$modal.msgError(this.$t('请上传报关资料'));
            //   return
            // }
我在何方's avatar
我在何方 committed
154
            this.$set(this.handlerParams,'createTime',this.formatDate())
155
            var params = Object.assign({},this.handlerParams)
156 157
            // var ccIds = Array.isArray(this.handlerParams.ccIds) ? this.handlerParams.ccIds.join(',') : this.handlerParams.ccIds
            // params.ccIds = ccIds
158
            params.voucher = Array.isArray(this.handlerParams.voucher) ? this.handlerParams.voucher.join(',') : this.handlerParams.voucher
我在何方's avatar
我在何方 committed
159

160 161
            params.estimateEnterOpenSeaTime = this.getNowDate(this.handlerParams.estimateEnterOpenSeaTime)
          creatDelayApproval(params).then(res=>{
162 163 164 165
              this.$modal.msgSuccess(this.$t('提交成功'));
              this.$store.dispatch('tagsView/delCurrentView')
          })
      },
166 167 168 169
      getTime(dateTime){
        var date = new Date(dateTime);
        return date.getTime()
      },
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
      getNowDate(time) {
            if(time){
              var date = new Date(time);
            }else{
              var date = new Date();
            }

             var year = date.getFullYear() // 年
             var month = date.getMonth() + 1; // 月
             var day = date.getDate(); // 日
              // 给一位数的数据前面加 “0”
             if (month >= 1 && month <= 9) {
                  month = "0" + month;
             }
              if (day >= 0 && day <= 9) {
                  day = "0" + day;
              }
        return year + "-" + month + "-" + day

       },
       formatDate() {
         var date = new Date()
         var year = date.getFullYear()
         var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
         var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
         var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
         var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
         var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
         return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
       },
      // 取消审核
      cancelAudit(){
        this.$prompt("请输入取消原因", {
          inputPattern: /[\S]+/,
Marcus's avatar
Marcus committed
204
          inputErrorMessage: this.$t('不能为空')
205
        }).then(({value}) => {
我在何方's avatar
我在何方 committed
206 207
          console.log(this.handlerParams.approvalId)
          return cancelDelayApproval({approveId:this.handlerParams.approvalId,reason:value})
208 209
        })
        .then(res => {
我在何方's avatar
我在何方 committed
210
          this.$store.dispatch('tagsView/delCurrentView')
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
        })
      }
    }
  };
</script>

<style scoped>
  .card-title{
      font-size: 18px;
      font-weight: bold;
       margin-top: 10px;
  }
  .header{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .card{
    margin-top: 20px;
  }
  .dialog-footer{
    padding: 40px;
    width: 60%;
    align-items: center;
    display: flex;
    /* justify-content: space-between; */
  }
</style>