zouyu
3 天以前 12c8999bab7206bc652fd69ac4f364d84c9e7153
src/views/business/unpass/components/unPassDialog.vue
@@ -1,65 +1,99 @@
<template>
  <div>
    <el-dialog :title="type==='view'?'不合格处理详情':'不合格处理提交'" :visible.sync="isShow" width="740px" :show-close="false" :close-on-click-modal="false"
      :close-on-press-escape="false">
      <div class="search">
        <el-form :inline="true" :model="unPassForm" :rules="unPassFormRules" ref="unPassForm" class="form-inline"
    <el-dialog :title="type==='view'?'不合格处理详情':'不合格处理提交'" :visible.sync="isShow" width="40%" :show-close="false" :close-on-click-modal="false"
      :close-on-press-escape="false" append-to-body>
      <div>
        <el-form :model="unPassForm" :rules="unPassFormRules" ref="unPassForm"
          label-width="120px">
          <div>
            <el-form-item class="headLine" label="标题:" style="width: 100%" prop="headline">
              <el-input clearable v-model="unPassForm.headline" size="small" :disabled="type === 'view'" type="textarea"
                placeholder="请输入"></el-input>
            </el-form-item>
          </div>
          <el-form-item label="供应商名称:">
            <el-input clearable v-model="unPassForm.supplierName" disabled size="small" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="物料名称:" prop="materialName">
            <el-tooltip class="item" effect="dark" placement="top" :content="unPassForm.materialName">
              <el-input clearable v-model="unPassForm.materialName" :disabled="type==='view'" size="small" placeholder="请输入"></el-input>
            </el-tooltip>
          </el-form-item>
          <el-form-item label="生产批次:">
            <el-input clearable v-model="unPassForm.productionBatch" disabled size="small" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="到货数量:">
            <el-input clearable v-model="unPassForm.cargoQuantity" disabled size="small" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="规格型号:">
            <el-input clearable v-model="unPassForm.specsModels" disabled size="small" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="报检时间:">
            <el-date-picker v-model="unPassForm.inspectTime" format="yyyy-MM-dd" value-format="yyyy-MM-dd" size="small"
              disabled style="width: 175px" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="反馈人:">
            <el-input clearable v-model="unPassForm.feedbackUser" disabled size="small" placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="反馈时间:" prop="feedbackTime">
            <el-date-picker  :picker-options="{ disabledDate: this.disabledDate }" v-model="unPassForm.feedbackTime" :disabled="type === 'view'" format="yyyy-MM-dd"
              value-format="yyyy-MM-dd" size="small" style="width: 175px" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="分类:" prop="classification">
            <el-select v-model="unPassForm.classification" :disabled="type === 'view' || !unPassForm.id" size="small" placeholder="请选择">
              <el-option v-for="item in classificationOptions" :key="item.value" :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="不合格归属:" prop="offGradeAscription">
            <el-select v-model="unPassForm.offGradeAscription" :disabled="type === 'view'" size="small"
              placeholder="请选择">
              <el-option v-for="item in offGradeAscriptionOptions" :key="item.value" :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="不合格情况描述:" prop="unqualifiedDesc">
            <el-input clearable type="textarea" v-model="unPassForm.unqualifiedDesc" :disabled="type === 'view'"
              style="width: 484px" size="small" placeholder="请输入"></el-input>
          </el-form-item>
          <el-row >
            <el-col :span="24">
              <el-form-item label="标题" prop="headline">
                <el-input style="width:100%" clearable v-model="unPassForm.headline" size="small" :disabled="type === 'view'" type="textarea"
                          placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="12">
              <el-form-item label="供应商名称">
                <el-input style="width:100%" clearable v-model="unPassForm.supplierName" disabled size="small" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="物料名称" prop="materialName">
                <el-input style="width:100%" clearable v-model="unPassForm.materialName" :disabled="type==='view'" size="small" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="12">
              <el-form-item label="生产批次">
                <el-input style="width:100%" clearable v-model="unPassForm.productionBatch" disabled size="small" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="到货数量">
                <el-input style="width:100%" clearable v-model="unPassForm.cargoQuantity" disabled size="small" placeholder="请输入" >
                  <template slot="append">{{unPassForm.buyUnitMeas}}</template>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="12">
              <el-form-item label="规格型号">
                <el-input style="width:100%" clearable v-model="unPassForm.specsModels" disabled size="small" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="报检时间">
                <el-date-picker style="width:100%" v-model="unPassForm.inspectTime" format="yyyy-MM-dd" value-format="yyyy-MM-dd" size="small"
                                disabled type="date" placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="12">
              <el-form-item label="反馈人">
                <el-input style="width:100%" clearable v-model="unPassForm.feedbackUser" disabled size="small" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="反馈时间" prop="feedbackTime">
                <el-date-picker style="width:100%" :picker-options="{ disabledDate: this.disabledDate }" v-model="unPassForm.feedbackTime" :disabled="type === 'view'" format="yyyy-MM-dd"
                                 value-format="yyyy-MM-dd" size="small" type="date" placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="12">
              <el-form-item label="分类" prop="classification">
                <el-select style="width:100%" v-model="unPassForm.classification" :disabled="type === 'view' || !unPassForm.id" size="small" placeholder="请选择">
                  <el-option v-for="item in classificationOptions" :key="item.value" :label="item.label"
                             :value="item.value"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="不合格归属" prop="offGradeAscription">
                <el-select style="width:100%" v-model="unPassForm.offGradeAscription" :disabled="type === 'view'" size="small"
                           placeholder="请选择">
                  <el-option v-for="item in offGradeAscriptionOptions" :key="item.value" :label="item.label"
                             :value="item.value"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="24">
              <el-form-item label="不合格情况描述" prop="unqualifiedDesc">
                <el-input style="width:100%" clearable type="textarea" v-model="unPassForm.unqualifiedDesc" :disabled="type === 'view'"
                           size="small" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <el-upload v-if="type !== 'view'" ref="upload" :action="action2" :on-change="beforeUpload" :on-error="onError"
          :on-remove="handleRemoveFile" :on-success="getUnpassUrl" :headers="uploadHeader" :file-list="unPassFilesList">
@@ -84,7 +118,7 @@
</template>
<script>
import { getInsOrder, getUnqualifiedHandler, downFile, addUnqualifiedHandler,reSubmitPushOa } from '@/api/business/unpass.js'
import { getInsOrder,getInsOrderList, getUnqualifiedHandler, downFile, addUnqualifiedHandler,reSubmitPushOa } from '@/api/business/unpass.js'
import {mapGetters} from "vuex";
export default {
  name: "unPassDialog",
@@ -95,9 +129,11 @@
      type: Boolean,
      default: () => false
    },
    orderId: {
      type: String,
      default: () => null
    selectOrderIds: {
      type: Array,
      default: () => {
        return []
      }
    },
  },
  data() {
@@ -152,21 +188,22 @@
      this.type = type
      if (type === 'add') {
        // 赋值默认数据
        getInsOrder({
          orderId: this.orderId
        getInsOrderList({
          selectOrderIds: this.selectOrderIds
        }).then(res => {
          if (res.code === 200) {
            this.unPassForm.feedbackTime = new Date().toISOString().substring(0, 10) // 报检时间
            this.unPassForm.headline = `No.0020-中天耐丝-供应商质量异常反馈流程-${res.data.insOrderTemplate.supplierName}-${this.unPassForm.feedbackTime}` // 标题
            this.unPassForm.headline = `No.0020-中天耐丝-供应商质量异常反馈流程-${res.data.supplierName}-${this.unPassForm.feedbackTime}` // 标题
            this.unPassForm.feedbackUser = this.nickName // 反馈人
            this.unPassForm.insOrderId = res.data.insOrder.id // 订单id
            this.unPassForm.materialName = res.data.insOrder.sampleType // 物料名称
            this.unPassForm.specsModels = res.data.insOrder.partDetail // 规格型号
            this.unPassForm.inventoryQuantityId = res.data.insOrderTemplate.inventoryQuantityId // 原材料id
            this.unPassForm.supplierName = res.data.insOrderTemplate.supplierName // 供应商名称
            this.unPassForm.productionBatch = res.data.insOrderTemplate.updateBatchNo // 生产批次
            this.unPassForm.cargoQuantity = res.data.insOrderTemplate.qtyArrived + res.data.insOrderTemplate.buyUnitMeas // 到货数量
            this.unPassForm.inspectTime = res.data.insOrderTemplate.sendTime.substring(0, 10)  // 报检时间
            // this.unPassForm.insOrderId = res.data.insOrder.id // 订单id
            this.unPassForm.materialName = res.data.sampleType // 物料名称
            this.unPassForm.specsModels = res.data.partDetail // 规格型号
            // this.unPassForm.inventoryQuantityId = res.data.inventoryQuantityId // 原材料id
            this.unPassForm.supplierName = res.data.supplierName // 供应商名称
            this.unPassForm.productionBatch = res.data.updateBatchNo // 生产批次
            this.unPassForm.cargoQuantity = res.data.qtyArrived // 到货数量
            this.unPassForm.buyUnitMeas = res.data.buyUnitMeas // 采购单位
            this.unPassForm.inspectTime = res.data.sendTime  // 报检时间
          }
        })
      } else {
@@ -201,7 +238,10 @@
            delete item.orderBy
          })
          this.handlunPassLoading = true
          addUnqualifiedHandler(this.unPassForm).then(res => {
          addUnqualifiedHandler({
            ...this.unPassForm,
            selectOrderIds: this.selectOrderIds
          }).then(res => {
            if (res.code === 200) {
              this.$message.success('提交成功')
              this.$emit('resetForm')
@@ -288,7 +328,4 @@
</script>
<style scoped>
.headLine>>>.el-form-item__content {
  width: 68%;
}
</style>