gaoluyang
2025-02-11 17b36c3c68aa864d122cd767662f344dbacf0be0
原材料报检页面迁移
已修改2个文件
已添加4个文件
1167 ■■■■■ 文件已修改
src/api/business/materialInspection.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/value-table.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/rawMaterialInspection/dataLookVisible.vue 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/rawMaterialInspection/unPassRetestResult.vue 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/rawMaterialInspection/index.vue 929 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/materialInspection.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
import request from '@/utils/request'
// æŸ¥è¯¢ç”¨æˆ·åˆ—表
export function getWarehouseSubmit(query) {
  return request({
    url: '/rawMaterialOrder/getWarehouseSubmit',
    method: 'get',
    params: query
  })
}
src/components/Table/value-table.vue
@@ -118,7 +118,7 @@
    <div :style="data.isPage!=undefined&&data.isPage!=true?'height:100%':''" class="table">
      <el-table :key="specialKey" ref="eltable" v-loading="loading" :current-row-key="data.currentId" :data="tableData" :highlight-current-row="data.highlight===undefined||data.highlight"
        :row-class-name="tableRowClassName" :row-key="record=>record[rowKey]" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0" :span-method="spanMethod"
        :summary-method="getSummaries" border
        :summary-method="getSummaries"
        height="100%" style="width: 100%;" tooltip-effect="dark"
        @select="select" @selection-change="selectChange"
        @sort-change="sortChange" @row-click="rowClick">
@@ -607,7 +607,7 @@
      selectList(val) {
        // console.log('val---', val)
        // console.log('this.page---', this.page)
        this.loading = true
        // this.loading = true
        if(val===undefined){
          this.page.current = 1;
        }
src/components/rawMaterialInspection/dataLookVisible.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,162 @@
<template>
  <div>
    <el-dialog title="数据查看" :visible.sync="isShow" width="80%" @closed="$emit('closeDataLook')">
      <ul class="tab">
        <li v-for="(m,i) in dataVisibleTitle" :key="i" :class="{active:i===dataVisibleIndex}" @click="handleDataVisibleTab(m,i)">{{m.label}}</li>
      </ul>
      <div style="height: 70vh;overflow-y: auto;">
        <ValueTable ref="ValueTableDataLook" :url="$api.insOrder.selectSampleAndProductByOrderId"
                    :key="upIndex"
                    :componentData="componentDataDataLook"/>
      </div>
    </el-dialog>
    <un-pass-retest-result :retestVisible="retestVisible" :retestInfo="retestInfo" @closeRetestLook="closeRetestLook" v-if="retestVisible"></un-pass-retest-result>
  </div>
</template>
<script>
import ValueTable from "@/components/Table/value-table.vue";
import UnPassRetestResult from "./unPassRetestResult.vue";
export default {
  name: "dataLookVisible",
  // import å¼•入的组件需要注入到对象中才能使用
  components: {UnPassRetestResult, ValueTable},
  props: {
    dataDialogVisible: {
      type: Boolean,
      default: () => false
    },
    dataLookInfo: {
      type: Object,
      default: () => {}
    },
  },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      upIndex: 0,
      isShow: this.dataDialogVisible,
      dataVisibleTitle: [
        {
          label: '进厂检验',
          value: 0
        },
        {
          label: '季度检验',
          value: 1
        },
      ],
      dataVisibleIndex: 0, // æ•°æ®æŸ¥çœ‹tab栏选择值
      // è¡¨æ ¼æ•°æ®
      componentDataDataLook: { // æ•°ç»„查看的table数据
        entity: {
          id: null,
        },
        isIndex: false,
        showSelect: false,
        select: false,
        do: [
          {
            id: '',
            font: '不合格复测查看',
            type: 'text',
            method: 'getRetestResult',
            disabFun: (row, index) =>  {
              return row.insResult!=0
            }
          }
        ],
        tagField: {
          insState: {
            select: []
          },
          insResult: {
            select: [{
              value: 1,
              label: '合格',
              type: 'success'
            },{
              value: 0,
              label: '不合格',
              type: 'danger'
            },{
              value: 3,
              label: '不判定',
              type: ''
            }]
          }
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: []
      },
      retestVisible: false,
      retestInfo: []
    }
  },
  mounted() {
    this.refreshTable()
  },
  // æ–¹æ³•集合
  methods: {
    // åˆ‡æ¢æ•°æ®æŸ¥çœ‹tab栏
    handleDataVisibleTab (m, i) {
      this.dataVisibleIndex = i
      this.refreshTable()
    },
    // æŸ¥è¯¢å›žè°ƒ
    refreshTable(e) {
      if (this.dataVisibleIndex === 0) {
        this.componentDataDataLook.entity.id = this.dataLookInfo.enterOrderId
      } else {
        this.componentDataDataLook.entity.id = this.dataLookInfo.quarterOrderId
      }
      this.$nextTick(() => {
        this.$refs['ValueTableDataLook'].selectList(e)
      })
    },
    // æŸ¥çœ‹ä¸åˆæ ¼å¤æµ‹ç»“æžœ
    getRetestResult (row) {
      this.$axios.get(this.$api.insOrder.getRetestResult+'?insProductId='+row.insProductId).then(res => {
        if (res.code == 201) return
        this.retestVisible = true
        this.retestInfo = res.data
      })
    },
    closeRetestLook () {
      this.retestVisible = false
    },
  },
}
</script>
<style scoped>
.tab {
  list-style-type: none;
  display: flex;
  margin-bottom: 12px;
}
.tab li {
  line-height: 24px;
  padding: 6px 14px;
  font-size: 14px;
  color: #333333;
  border: 1px solid #EEEEEE;
  cursor: pointer;
}
.tab li:nth-child(1) {
  border-radius: 8px 0 0 8px;
}
.tab li:nth-child(2) {
  border-radius: 0 8px 8px 0;
}
.tab li.active {
  border-color: #3A7BFA;
  color: #3A7BFA;
}
</style>
src/components/rawMaterialInspection/unPassRetestResult.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
<template>
  <div>
    <el-dialog
      title="不合格复测查看"
      :visible.sync="isShow"
      @closed="$emit('closeRetestLook')"
      width="40%">
      <el-table
        :data="retestInfo"
        border
        style="width: 100%">
        <el-table-column type="index" label="复测次数" align="center" width="100">
        </el-table-column>
        <el-table-column prop="tell" label="试验要求" width="120">
        </el-table-column>
        <el-table-column prop="lastValue" label="检验结果" width="120">
        </el-table-column>
        <el-table-column prop="insResult" label="结果判定">
          <template slot-scope="scope">
            <el-tag type="danger" v-if="scope.row.insResult === 0" disable-transitions>不合格</el-tag>
            <el-tag type="success" v-if="scope.row.insResult === 1" disable-transitions>合格</el-tag>
            <el-tag v-if="scope.row.insResult === 3" disable-transitions>不判定</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: "unPassRetestResult",
  // import å¼•入的组件需要注入到对象中才能使用
  components: {},
  props: {
    retestVisible: {
      type: Boolean,
      default: () => false
    },
    retestInfo: {
      type: Array,
      default: () => []
    }
  },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      isShow: this.retestVisible,
    }
  },
  // æ–¹æ³•集合
  methods: {},
}
</script>
<style scoped>
</style>
src/router/index.js
@@ -93,6 +93,11 @@
// åŠ¨æ€è·¯ç”±ï¼ŒåŸºäºŽç”¨æˆ·æƒé™åŠ¨æ€åŽ»åŠ è½½
export const dynamicRoutes = [
  {
    path: '/business/rawMaterialInspection',
    component: Layout,
    hidden: true,
  },
  {
    path: '/system/user-auth',
    component: Layout,
    hidden: true,
src/views/business/rawMaterialInspection/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,929 @@
<template>
  <div class="app-container">
    <div>
      <el-row class="title">
        <el-col :span="12" style="text-align: left;">原材料报检</el-col>
        <el-col :span="12" style="text-align: right;">
          <el-button v-show="tabIndex === 4" :loading="outLoading" size="medium" type="primary" @click="handleDown">导出</el-button>
          <el-button v-if="isShowIFS && tabIndex === 0" :loading="btnLoading" size="small" type="primary" @click="openIFS">获取IFS订单</el-button>
          <el-button v-if="tabIndex === 0" size="small" type="primary" @click="declareS">报检</el-button>
          <el-button v-if="tabIndex === 0" size="small" type="primary" @click="addDeclare">新增报检信息</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="search">
      <el-form :model="componentData" ref="componentData" size="small" :inline="true">
        <el-row>
          <el-form-item label="批号" prop="menuName">
            <el-input v-model="componentData.entity.updateBatchNo" clearable placeholder="请输入"
                      size="small"
                      @keyup.enter.native="refreshTable"></el-input>
          </el-form-item>
          <el-form-item label="零件号" prop="menuName">
            <el-input v-model="componentData.entity.partNo" clearable placeholder="请输入"
                      size="small"
                      @keyup.enter.native="refreshTable">
            </el-input>
          </el-form-item>
          <el-form-item label="零件描述" prop="menuName">
            <el-input v-model="componentData.entity.partDesc" clearable placeholder="请输入"
                      size="small"
                      @keyup.enter.native="refreshTable">
            </el-input>
          </el-form-item>
          <el-form-item label="供应商" prop="menuName" v-if="(tabIndex === 3 || tabIndex === 4)">
            <el-input v-model="componentData.entity.supplierName" clearable placeholder="请输入"
                      size="small"
                      @keyup.enter.native="refreshTable">
            </el-input>
          </el-form-item>
<!--          <div class="search_thing" style="padding-left: 30px;">-->
            <el-button v-if="tabIndex === 3 || tabIndex === 4" :icon="!more?'el-icon-arrow-down':'el-icon-arrow-up'" style="color: #3A7BFA;" type="text" @click="more=!more">{{!more?'更多':'收起'}}</el-button>
          <el-button size="small" icon="el-icon-search" type="primary" @click="refreshTable()">查 è¯¢</el-button>
          <el-button size="small" @click="refresh()" icon="el-icon-refresh">重 ç½®</el-button>
<!--          </div>-->
        </el-row>
        <el-row>
          <el-form-item label="检验状态" prop="menuName" v-if="(tabIndex === 3 || tabIndex === 4) && more">
            <el-select v-model="componentData4.entity.inspectStatus" clearable
                       size="small" style="width: 100%;" @change="refreshTable()">
              <el-option v-for="(a, i) in queryStatusList" :key="i" :label="a.label" :value="a.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="下发时间" prop="menuName" v-if="(tabIndex === 3 || tabIndex === 4) && more">
            <el-date-picker
              v-model="entity.date"
              end-placeholder="结束日期"
              format="yyyy-MM-dd"
              placeholder="选择日期"
              range-separator="至"
              size="small"
              start-placeholder="开始日期"
              style="width: 100%;"
              type="daterange"
              value-format="yyyy-MM-dd">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="委托编号" prop="menuName" v-if="(tabIndex === 3 || tabIndex === 4) && more">
            <el-input v-model="componentData4.entity.entrustCode" clearable placeholder="请输入"
                      size="small"
                      @keyup.enter.native="refreshTable">
            </el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </div>
    <div class="table">
      <ul class="tab">
        <li v-for="(m,i) in tabList" :key="m.value" :class="{active:m.value===tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
      </ul>
      <!--      å¾…报检-->
      <ValueTable v-show="tabIndex === 0" :key="'a'+ upIndex"
                  ref="ValueTable"
                  :componentData="componentData"
                  :style="getStyle()"
                  :tableRowClassName="changeRowClass"
                  :url="getWarehouseSubmitApi()" />
      <!--      å¾…下单-->
      <ValueTable v-show="tabIndex === 1" :key="'b'+ upIndex"
                  ref="ValueTable1"
                  :componentData="componentData1"
                  :style="getStyle()"
                  :tableRowClassName="changeRowClass"
                  :url="getWarehouseSubmitApi()" />
      <!--      å·²å®Œæˆåˆ—表-->
<!--      <ValueTable v-show="tabIndex === 3" :key="'c'+ upIndex"-->
<!--                  ref="ValueTable2"-->
<!--                  :componentData="componentData2"-->
<!--                  :style="getStyle()"-->
<!--                  :url="$api.materialInspection.getIfsByFinish" />-->
<!--      &lt;!&ndash;      å…¨éƒ¨&ndash;&gt;-->
<!--      <ValueTable v-show="tabIndex === 4" :key="'d'+ upIndex"-->
<!--                  ref="ValueTable4"-->
<!--                  :componentData="componentData4"-->
<!--                  :style="getStyle()"-->
<!--                  :url="$api.materialInspection.getIfsByAll" />-->
    </div>
    <!-- æ‰¹é‡æŠ¥æ£€ -->
    <el-dialog :visible.sync="declareDialogSVisible" title="确认报检" width="30%">
      <p style="font-size:16px;color:#333333">是否确认报检选择的数据?</p>
      <span slot="footer" class="dialog-footer">
                    <el-row>
                        <el-button @click="declareDialogSVisible = false">取 æ¶ˆ</el-button>
                        <el-button :loading="submitDeclareLoading" type="primary" @click="submitDeclareS">ç¡® å®š</el-button>
                    </el-row>
                </span>
    </el-dialog>
    <!-- ç¡®è®¤æŠ¥æ£€ -->
    <el-dialog :close-on-click-modal="false" :title="declareType === 'add' ? '新增报检信息' : '原材料报检'"
               :visible.sync="declareDialogVisible"
               width="62%" @close="resetForm">
      <el-form ref="declareObj" :inline="true" :model="declareObj" :rules="declareObjRules" label-width="130px" style="display: flex;flex-wrap: wrap;">
        <el-form-item class="declareObj-form-item" label="订单号:" prop="orderNo">
          <el-input v-model="declareObj.orderNo" :disabled="declareType !== 'add'" class="addObj-info" clearable placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="零件号:" prop="partNo">
          <el-input v-model="declareObj.partNo" :disabled="declareType !== 'add'" class="addObj-info" clearable placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="零件描述:" prop="partDesc">
          <el-input v-model="declareObj.partDesc" :disabled="declareType !== 'add'" class="addObj-info" clearable placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="抵达的采购数量:" prop="qtyArrived">
          <el-input v-model="declareObj.qtyArrived" :disabled="declareType !== 'add'" class="addObj-info" clearable placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="declareType !== 'add'" class="declareObj-form-item" label="供应商编号:" prop="supplierId">
          <el-input v-model="declareObj.supplierId" :disabled="declareType !== 'add'" class="addObj-info" clearable placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="供应商名称:" prop="supplierName">
          <el-input v-model="declareObj.supplierName" :disabled="declareType !== 'add'" class="addObj-info" clearable placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="批号:" prop="updateBatchNo">
          <el-input v-model="declareObj.updateBatchNo" class="addObj-info" clearable size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="declareType !== 'add'" class="declareObj-form-item" label="库位号:" prop="locationNo">
          <el-input v-model="declareObj.locationNo" :disabled="declareType !== 'add'" class="addObj-info" clearable size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="declareType !== 'add'" class="declareObj-form-item" label="接收时间:" prop="receiverDate">
          <el-input v-model="declareObj.receiverDate" class="addObj-info" clearable disabled size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="单位:" prop="buyUnitMeas">
          <el-input v-model="declareObj.buyUnitMeas" :disabled="declareType !== 'add'" class="addObj-info" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="物料类型:" prop="isExpire">
          <el-select v-model="declareObj.isExpire" prop="isExpire"
                     :disabled="declareType !== 'add'"
                     clearable size="small">
            <el-option :value="1" label="过期物料"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-row>
          <el-button @click="resetForm">取 æ¶ˆ</el-button>
          <el-button :loading="submitDeclareLoading" type="primary" @click="submitDeclare">ç¡® å®š</el-button>
        </el-row>
      </span>
    </el-dialog>
    <!-- åˆ é™¤æŠ¥æ£€ -->
    <el-dialog :visible.sync="deleteVisible" title="确认删除" width="30%">
      <p style="font-size:16px;color:#333333">是否确认删除?</p>
      <span slot="footer" class="dialog-footer">
                    <el-row>
                        <el-button @click="deleteVisible = false">取 æ¶ˆ</el-button>
                        <el-button :loading="deleteLoading" type="primary" @click="submitDelete">ç¡® å®š</el-button>
                    </el-row>
                </span>
    </el-dialog>
    <!-- æ’¤é”€æŠ¥æ£€ -->
    <el-dialog :visible.sync="declareDialogVisible1" title="报检撤销" width="30%">
      <p style="font-size:16px;color:#333333">批号<span
        style="color:#34BD66">{{insOrderRow.updateBatchNo}}</span>的信息是否<span style="color: #FF4902">撤销报检</span></p>
      <span slot="footer" class="dialog-footer">
                    <el-row>
                        <el-button @click="declareDialogVisible1 = false">取 æ¶ˆ</el-button>
                        <el-button :loading="upLoad" type="primary" @click="submitDeclare1">ç¡® å®š</el-button>
                    </el-row>
                </span>
    </el-dialog>
    <!--数据查看弹框-->
    <data-look-visible v-if="dataDialogVisible" ref="dataDialogVisible"
                       :dataDialogVisible="dataDialogVisible"
                       :dataLookInfo="dataLookInfo" @closeDataLook="closeDataLook"></data-look-visible>
  </div>
</template>
<script>
import ValueTable from "@/components/Table/value-table.vue";
import DataLookVisible from "@/components/rawMaterialInspection/dataLookVisible.vue";
import {getUser} from "@/api/system/user";
import {getWarehouseSubmit} from '@/api/business/materialInspection'
export default {
  // import å¼•入的组件需要注入到对象中才能使用
  components: {DataLookVisible, ValueTable},
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      entity: {
        date: null
      },
      more:false,
      isShowIFS: false,
      declareObj: {
        id: null,
        orderNo: '', // è®¢å•号
        partNo: '', // é›¶ä»¶å·
        partDesc: '', // é›¶ä»¶æè¿°
        qtyArrived: '', // æŠµè¾¾çš„采购数量
        supplierId: '', // ä¾›åº”商编号
        supplierName: '', // ä¾›åº”商名称
        updateBatchNo: '', // æ‰¹å·
        locationNo: '', // åº“位号
        receiverDate: '', // æŽ¥æ”¶æ—¶é—´
        buyUnitMeas: '', // å•位
        isExpire: '', // å•位
      },
      componentData: { // è¡¨æ ¼æ•°æ®
        entity: {
          updateBatchNo: null,
          partNo: null,
          partDesc: null,
          supplierName: null,
          isInspect: 0,
        },
        isIndex: true,
        showSelect: true,
        select: true,
        selectMethod: 'selectMethod',
        do: [
          {
            font: '报检',
            type: 'text',
            method: 'declare'
          },
          {
            font: '删除',
            type: 'text',
            method: 'deleteMaterial'
          }
        ],
        tagField: {
          isExpire: {
            select: [{
              value: 1,
              label: '过期物料',
              type: 'warning'
            }]
          }
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: []
      },
      declareDialogVisible1: false,
      upLoad: false,
      componentData1: {
        entity: {
          updateBatchNo: null,
          partDesc: null,
          state: 0,
          isInspect: 1,
          partNo: null,
          supplierName: null,
        },
        isIndex: true,
        showSelect: false,
        select: false,
        selectMethod:'selectMethod',
        do: [
          {
            font: '撤销报检',
            type: 'text',
            method: 'cancelDeclare',
          },
        ],
        tagField: {
          isExpire: {
            select: [{
              value: 1,
              label: '过期物料',
              type: 'warning'
            }]
          },
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: []
      },
      componentData2: {
        entity: {
          orderBy: {
            field: 'sendTime',
            order: 'desc'
          },
          updateBatchNo: null,
          partNo: null,
          partDesc: null,
          supplierName: null,
          beginDeclareDate: null,
          endDeclareDate: null,
        },
        isIndex: true,
        showSelect: true,
        select: true,
        selectMethod:'selectMethod',
        do: [
          {
            id: 'dataLook',
            font: '数据查看',
            type: 'text',
            method: 'handleDataLook',
          }
        ],
        tagField: {
          inspectStatus: {
            select: [{
              value: 0,
              label: '检验中',
              type: 'warning'
            },{
              value: 1,
              label: '合格',
              type: 'success'
            },{
              value: 2,
              label: '不合格',
              type: 'danger'
            },{
              value: 3,
              label: '未下单',
              type: 'info'
            },{
              value: 3,
              label: '让步放行',
              type: ''
            }]
          },
          isExemption: {
            select: [{
              value: 1,
              label: '免检',
              type: 'success'
            }]
          },
          isExpire: {
            select: [{
              value: 1,
              label: '过期物料',
              type: 'warning'
            }]
          },
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: [],
        needSort: ['sendTime', 'receiverDate', 'declareDate']
      },
      componentData4: {
        entity: {
          orderBy: {
            field: 'id',
            order: 'desc'
          },
          updateBatchNo: null,
          partNo: null,
          partDesc: null,
          supplierName: null,
          inspectStatus: null,
          beginDeclareDate: null,
          endDeclareDate: null,
        },
        isIndex: true,
        showSelect: true,
        select: true,
        selectMethod:'selectMethod',
        do: [
          {
            id: 'dataLook',
            font: '数据查看',
            type: 'text',
            method: 'handleDataLook',
          },
          {
            id: '',
            font: '放行',
            type: 'text',
            method: 'goPass',
            disabFun: (row, index) => {
              return row.inspectStatus != 2
            }
          },
          {
            id: '',
            font: '提前入库',
            type: 'text',
            method: 'advancedGodown',
            disabFun: (row, index) => {
              return row.inspectStatus != 0 && row.inspectStatus != 3
            }
          }
        ],
        tagField: {
          inspectStatus: {
            select: [{
              value: 0,
              label: '检验中',
              type: 'warning'
            },{
              value: 1,
              label: '合格',
              type: 'success'
            },{
              value: 2,
              label: '不合格',
              type: 'danger'
            },{
              value: 3,
              label: '未下单',
              type: 'info'
            },{
              value: 4,
              label: '让步放行',
              type: ''
            }]
          },
          isExemption: {
            select: [{
              value: 1,
              label: '免检',
              type: 'success'
            }]
          },
          isExpire: {
            select: [{
              value: 1,
              label: '过期物料',
              type: 'warning'
            }]
          },
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: [],
        needSort: ['sendTime', 'receiverDate', 'declareDate']
      },
      upIndex: 0,
      multipleSelection: [],
      entityCopy: {},
      currentId: null,
      btnLoading: false, // èŽ·å–IFS订单按钮loading
      insOrderRow: {},
      declareDialogVisible: false, // ç¡®è®¤æŠ¥æ£€å¼¹æ¡†
      submitDeclareLoading: false, // æäº¤æŠ¥æ£€å¼¹æ¡†æŒ‰é’®loading
      declareDialogSVisible: false,
      declareObjRules: {
        orderNo: [
          { required: false, message: '请填写订单号', trigger: 'blur' }
        ],
        partNo: [
          { required: true, message: '请填写零件号', trigger: 'blur' }
        ],
        partDesc: [
          { required: true, message: '请填写零件描述', trigger: 'blur' }
        ],
        qtyArrived: [
          { required: false, message: '请填写抵达的采购数量', trigger: 'blur' }
        ],
        supplierName: [
          { required: true, message: '请填写供应商名称', trigger: 'blur' }
        ],
        updateBatchNo: [
          { required: true, message: '请填写批号', trigger: 'blur' }
        ],
        locationNo: [
          { required: false, message: '请填写库位号', trigger: 'blur' }
        ],
        buyUnitMeas: [
          { required: false, message: '请填写单位', trigger: 'blur' }
        ],
      },
      tabList: [
        {
          label: '待报检',
          value: 0
        },
        {
          label: '待下单',
          value: 1
        },
        {
          label: '已完成',
          value: 3
        },
        {
          label: '全部',
          value: 4
        }
      ],
      tabIndex: 0,
      deleteVisible: false, // åˆ é™¤æŠ¥æ£€å¼¹æ¡†
      deleteLoading: false, // åˆ é™¤æŠ¥æ£€æŒ‰é’®
      entityCopy1: {},
      entityCopy2: {},
      entityCopy4: {},
      dataDialogVisible: false, // æ•°æ®æŸ¥çœ‹å¼¹æ¡†
      dataLookInfo: {}, // æ•°æ®æŸ¥çœ‹å¼¹æ¡†æ•°æ®
      declareType: '', // æ“ä½œæŠ¥æ£€çš„类型
      queryStatusList: [
        {label: '检验中', value: 0},
        {label: '合格', value: 1},
        {label: '不合格', value: 2},
        {label: '未下单', value: 3},
        {label: '让步放行', value: 4},
      ],
      outLoading:false
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity)
    this.entityCopy1 = this.HaveJson(this.componentData1.entity)
    this.entityCopy2 = this.HaveJson(this.componentData2.entity)
    this.entityCopy4 = this.HaveJson(this.componentData4.entity)
    this.getPower()
  },
  // æ–¹æ³•集合
  methods: {
    // æ‰“开撤销报检弹框
    cancelDeclare (row) {
      this.declareDialogVisible1 = true
      this.insOrderRow = row
    },
    // æäº¤æ’¤é”€æŠ¥æ£€ç”³è¯·
    submitDeclare1 () {
      this.$axios.post(this.$api.rawMaterialOrder.revokeInspectionReport, {
        id: this.insOrderRow.id
      }).then(res => {
        if (res.code === 200) {
          this.declareDialogVisible1 = false
          this.refreshTable('page')
          this.$message.success("撤销报检成功")
        }
      }).catch(err => {
        console.log(err)
      })
    },
    // åˆ‡æ¢tab表格
    handleTab(m, i) {
      this.tabIndex = m.value;
      this.componentData.entity.isInspect = this.tabIndex
      if (this.tabIndex === 0) {
        this.componentData.do = [
          {
            font: '报检',
            type: 'text',
            method: 'declare'
          },
          {
            font: '删除',
            type: 'text',
            method: 'deleteMaterial'
          }
        ]
      } else if (this.tabIndex === 1) {
        this.componentData.do = []
      }
      this.refreshTable()
    },
    // èŽ·å–æƒé™
    getPower() {
      let power = JSON.parse(sessionStorage.getItem('power'))
      let getIFS = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'getIfsOrder') { // èŽ·å–IFS的权限
          getIFS = true
        }
      }
      this.isShowIFS = getIFS
    },
    // æŸ¥è¯¢å›žè°ƒ
    refreshTable(e) {
      if (this.tabIndex === 0) {
        this.componentData.entity.isInspect = this.tabIndex
        this.$refs.ValueTable.selectList(e)
      } else if (this.tabIndex === 1) {
        this.componentData1.entity.updateBatchNo = this.componentData.entity.updateBatchNo
        this.componentData1.entity.partNo = this.componentData.entity.partNo
        this.componentData1.entity.partDesc = this.componentData.entity.partDesc
        this.componentData1.entity.supplierName = this.componentData.entity.supplierName
        this.$refs['ValueTable1'].selectList(e)
      } else if (this.tabIndex === 3) {
        this.componentData2.entity.updateBatchNo = this.componentData.entity.updateBatchNo
        this.componentData2.entity.partNo = this.componentData.entity.partNo
        this.componentData2.entity.partDesc = this.componentData.entity.partDesc
        this.componentData2.entity.supplierName = this.componentData.entity.supplierName
        this.componentData2.entity.inspectStatus = this.componentData4.entity.inspectStatus
        if (this.entity.date !== null) {
          this.componentData2.entity.beginDeclareDate = this.entity.date[0] + ' 00:00:00'
          this.componentData2.entity.endDeclareDate = this.entity.date[1] + ' 23:59:59'
        } else {
          this.componentData2.entity.beginDeclareDate = ''
          this.componentData2.entity.endDeclareDate = ''
        }
        this.$refs['ValueTable2'].selectList(e)
      }else {
        this.componentData4.entity.updateBatchNo = this.componentData.entity.updateBatchNo
        this.componentData4.entity.partNo = this.componentData.entity.partNo
        this.componentData4.entity.partDesc = this.componentData.entity.partDesc
        this.componentData4.entity.supplierName = this.componentData.entity.supplierName
        if (this.entity.date !== null) {
          this.componentData4.entity.beginDeclareDate = this.entity.date[0] + ' 00:00:00'
          this.componentData4.entity.endDeclareDate = this.entity.date[1] + ' 23:59:59'
        } else {
          this.componentData4.entity.beginDeclareDate = ''
          this.componentData4.entity.endDeclareDate = ''
        }
        this.$refs['ValueTable4'].selectList(e)
      }
    },
    // é‡ç½®
    refresh() {
      this.entity.date = null
      this.componentData.entity = this.HaveJson(this.entityCopy)
      if (this.tabIndex === 0) {
        this.componentData.entity = this.HaveJson(this.entityCopy)
      } else if (this.tabIndex === 1) {
        this.componentData1.entity = this.HaveJson(this.entityCopy1)
      } else if (this.tabIndex === 3) {
        this.componentData2.entity = this.HaveJson(this.entityCopy2)
        this.componentData4.entity = this.HaveJson(this.entityCopy4)
      } else {
        this.componentData4.entity = this.HaveJson(this.entityCopy4)
      }
      this.refreshTable()
    },
    // æ•°æ®æŸ¥çœ‹
    handleDataLook(row) {
      this.dataDialogVisible = true;
      this.dataLookInfo = row
    },
    // ç›´æŽ¥æ”¾è¡Œ
    goPass (row) {
      this.$confirm('是否放行当前数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.post(this.$api.materialInspection.concessionRelease+'?ifsInventoryId='+row.id).then(res => {
          if (res.code === 200) {
            this.$message({
              type: 'success',
              message: '放行成功!'
            });
            this.refresh()
          }
        })
      }).catch(() => {
        this.$message({
          type: 'error',
          message: '放行失败'
        });
      });
    },
    // æå‰å…¥åº“
    advancedGodown (row) {
      this.$confirm('当前原材料是否提前入库?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.post(this.$api.materialInspection.advancedGodown+'?ifsInventoryId='+row.id).then(res => {
          if (res.code === 200) {
            this.$message({
              type: 'success',
              message: '操作成功!'
            });
            this.refresh()
          }
        })
      }).catch(() => {
        this.$message({
          type: 'error',
          message: '操作失败'
        });
      });
    },
    // å…³é—­æ•°æ®æŸ¥çœ‹å¼¹æ¡†
    closeDataLook () {
      this.dataDialogVisible = false
    },
    // æ‰‹åŠ¨æŠ¥æ£€
    addDeclare () {
      this.clear()
      this.declareDialogVisible = true
      this.declareType = 'add'
    },
    declareS () {
      if (this.multipleSelection.length > 0) {
        this.declareDialogSVisible = true
      } else {
        this.$message.error('请选择需要报检的数据')
      }
    },
    submitDeclareS () {
      let ids = []
      this.multipleSelection.forEach(item => {
        ids.push(item.id)
      })
      this.declareDialogSVisible = true
      this.$axios.post(this.$api.rawMaterialOrder.inspectionReport, {
        ids: ids
      }, {
        headers: {
          'Content-Type': 'application/json'
        }
      }).then(res => {
        if (res.code === 200) {
          this.declareDialogSVisible = false
          this.$message.success('报检成功')
          this.refresh()
        }
        this.submitDeclareLoading = false
      }).catch(err => {
        this.submitDeclareLoading = false
        console.log(err)
      })
    },
    // æ‰“开报检确认弹框
    declare(row) {
      this.declareObj = {...row}
      this.declareDialogVisible = true
      this.declareType = 'edit'
    },
    // æäº¤æŠ¥æ£€
    submitDeclare () {
      if (this.declareType === 'add') {
        this.$refs['declareObj'].validate((valid) => {
          if (valid) {
            this.$axios.post(this.$api.rawMaterialOrder.addIfsInventoryQuantity,
              this.declareObj
              , {
                headers: {
                  'Content-Type': 'application/json'
                }
              }).then(res => {
              if (res.code === 200) {
                this.declareDialogVisible = false
                this.$message.success('报检成功')
                this.refresh()
              }
            }).catch(err => {
              console.log(err)
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      } else {
        this.$refs['declareObj'].validate((valid) => {
          if (valid) {
            this.$axios.post(this.$api.rawMaterialOrder.inspectionReportOne, {
              id: this.declareObj.id,
              updateBatchNo: this.declareObj.updateBatchNo
            }, {
              headers: {
                'Content-Type': 'application/json'
              }
            }).then(res => {
              if (res.code === 200) {
                this.declareDialogVisible = false
                this.$message.success('报检成功')
                this.refresh()
              }
            }).catch(err => {
              console.log(err)
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      }
    },
    resetForm () {
      this.$refs['declareObj'].resetFields();
      this.declareDialogVisible = false
    },
    // æ‰“开删除弹框
    deleteMaterial (row) {
      this.deleteVisible = true
      this.deleteInfo = row
    },
    // ç¡®è®¤åˆ é™¤
    submitDelete () {
      this.deleteLoading = true
      this.$axios.post(this.$api.rawMaterialOrder.delIfsInventory + '?id=' + this.deleteInfo.id).then(res => {
        if (res.code === 200) {
          this.deleteVisible = false
          this.$message.success('删除成功')
          this.refresh()
        }
        this.deleteLoading = false
      }).catch(err => {
        console.log(err)
        this.deleteLoading = false
      })
    },
    // è¡¨æ ¼é€‰æ‹©æ–¹æ³•
    selectMethod(val) {
      this.multipleSelection = val
    },
    // èŽ·å–IFS按钮回调
    openIFS() {
      this.btnLoading = true
      this.$axios.post(this.$api.materialInspection.getIfsOrder).then(res => {
        if (res.code === 200) {
          this.refresh()
        }
        this.btnLoading = false
      }).catch(err => {
        this.btnLoading = false
        console.log(err)
      })
    },
    changeRowClass({row, rowIndex}) {
      if (row.isFirst == 1) {
        return 'highlight-danger-row-border'
      }
      return ''
    },
    getStyle() {
      return 'height: calc(100% - ' + (this.more ? '94' : '44') + 'px)'
    },
    getWarehouseSubmitApi () {
      const row = {}
      getWarehouseSubmit(row).then(response => {
      })
    },
    // å…¨éƒ¨å¯¼å‡º
    handleDown(){
      let entity = {...this.componentData4.entity}
      delete entity.orderBy
      this.outLoading = true
      this.$axios.post(this.$api.rawMaterialOrder.rawAllExport,{
        entity:entity
      },{
        headers: {
          'Content-Type': 'application/json'
        }
        ,responseType: "blob"}).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        const blob = new Blob([res],{ type: 'application/octet-stream' });
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = '原材料检测信息导出.xlsx';
        link.click();
      })
    },
    clear() {
      this.declareObj = {
        id: null,
        orderNo: '', // è®¢å•号
        partNo: '', // é›¶ä»¶å·
        partDesc: '', // é›¶ä»¶æè¿°
        qtyArrived: '', // æŠµè¾¾çš„采购数量
        supplierId: '', // ä¾›åº”商编号
        supplierName: '', // ä¾›åº”商名称
        updateBatchNo: '', // æ‰¹å·
        locationNo: '', // åº“位号
        receiverDate: '', // æŽ¥æ”¶æ—¶é—´
        buyUnitMeas: '', // å•位
        isExpire: '', // å•位
      }
    }
  },
}
</script>
<style scoped lang="scss">
.app-container {
  padding-top: 0;
}
.title {
  height: 60px;
  line-height: 60px;
}
.tab {
  list-style-type: none;
  display: flex;
  margin-bottom: 12px;
  margin-top: 0;
  padding-left: 0;
}
.tab li {
  line-height: 24px;
  padding: 6px 14px;
  font-size: 14px;
  color: #333333;
  border: 1px solid #EEEEEE;
  cursor: pointer;
}
.tab li:nth-child(1) {
  border-radius: 8px 0 0 8px;
}
.tab li:nth-child(4) {
  border-radius: 0 8px 8px 0;
}
.tab li.active {
  border-color: #3A7BFA;
  color: #3A7BFA;
}
</style>