zouyu
2026-05-07 b0d4df5f39525ae7fe252e8ee65d85fd71dca721
src/views/business/unpass/index-manage.vue
@@ -60,13 +60,14 @@
            <el-button type="primary" size="mini" @click="refreshTable">查询</el-button>
            <el-button size="mini" @click="refresh">重置</el-button>
            <el-button :loading="exportLoading" type="success" size="mini" @click="exportUnqualifiedHandler">导出</el-button>
            <el-button type="primary" size="mini" @click="openInsOrderDialog">新增不合格处理</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div>
      <lims-table :tableData="tableData" :column="column"
                  :height="'calc(100vh - 250px)'" @pagination="pagination"
                  :more="true" @pagination="pagination"
                  :page="page" :tableLoading="tableLoading"></lims-table>
    </div>
    <el-dialog
@@ -95,6 +96,38 @@
        <el-button type="primary" @click="cancelOA" :loading="cancelOALoading">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="选择不合格订单"
      :show-close="false"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      :visible.sync="insOrderVisible"
      width="50%">
      <el-row :gutter="20" style="margin-bottom:10px">
        <el-col :span="12">
          <el-input clearable size="small" v-model="lotBatchNo" placeholder="请输入批次号"></el-input>
        </el-col>
        <el-col :span="12">
          <el-button size="small" type="primary" @click="searchInsOrderList">搜索</el-button>
        </el-col>
      </el-row>
      <lims-table ref="insOrderTable"
                  :tableData="insOrderDataList"
                  :column="insOrderTableDataColumn"
                  :isSelection="true"
                  :selectionSelectable="insOrderSelectable"
                  :handleSelectionChange="selectMethod"
                  :rowClassName="insOrderRowClassName"
                  @pagination="insOrderPageination"
                  :height="500"
                  :page="insOrderPage"
                  :tableLoading="insOrderTableLoading">
      </lims-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="resetInsOrderForm">取 消</el-button>
        <el-button type="primary" @click="openAddUnqualifiedHandlerView">确 定</el-button>
      </span>
    </el-dialog>
    <UnPassDialog ref="unPassDialog" v-if="unPassDialog"
                  :orderId="orderId"
                  @resetForm="resetForm1"
@@ -107,6 +140,7 @@
</template>
<script>
import {getIfsByAll} from "@/api/business/rawMaterialOrder";
import UnPassDialog from "./components/unPassDialog.vue";
import OAProcess from "./components/OAProcess.vue";
import limsTable from "@/components/Table/lims-table.vue";
@@ -121,7 +155,145 @@
  dicts: ['material_prop_type','oa_workflow_state'],
  data() {
    return {
      lotBatchNo:null,
      insOrderVisible:false,
      insOrderTableLoading:false,
      insOrderDataList:[],
      insOrderTableDataColumn:[
        {
          label: 'IFS域',
          prop: 'contract',
          width: '120px',
          dataType: 'tag',
          formatData: (params) => {
            return params
          },
          formatType: (params) => {
            if (params === 'ZTNS') {
              return ''
            } else if (params === 'KJNS') {
              return 'success'
            }else {
              return null
            }
          }
        },
        { label: '委托编号', prop: 'entrustCode', width: "160px", },
        {
          dataType: 'tag',
          label: '检验状态',
          prop: 'inspectStatus',
          formatData: (params) => {
            if (params == 0) {
              return '检验中'
            } else if (params == 1) {
              return '合格'
            } else if (params == 2) {
              return '不合格'
            } else if (params == 3) {
              return '未下单'
            } else if (params == 4) {
              return '让步放行'
            } else {
              return null
            }
          },
          formatType: (params) => {
            if (params == 0) {
              return 'warning'
            } else if (params == 1) {
              return 'success'
            } else if (params == 2) {
              return 'danger'
            } else if (params == 3) {
              return 'info'
            } else if (params == 4) {
              return ''
            } else {
              return null
            }
          }
        },
        { label: '订单号', prop: 'orderNo' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' ,width:'160' },
        { label: '下发时间', prop: 'sendTime',width:'160' },
        { label: '批号', prop: 'updateBatchNo',width:'160' },
        { label: '零件号', prop: 'partNo',width:'140' },
        { label: '零件描述', prop: 'partDesc' },
        { label: '供应商名称', prop: 'supplierName' },
        { label: '不合格描述', prop: 'unqualifiedDesc',width:'160' },
        {
          dataType: 'tag',
          label: '免检',
          prop: 'isExemption',
          formatData: (params) => {
            if (params == 1) {
              return '免检'
            } else {
              return null
            }
          },
          formatType: (params) => {
            if (params == 1) {
              return 'success'
            } else {
              return null
            }
          }
        },
        {
          label: '样品名称',
          prop: 'sampleName',
          width: "160px"
        },
        { label: '样品型号', prop: 'sampleModel' },
        { label: '检验人', prop: 'userName' },
        {
          label: '物料属性',
          prop: 'materialProp',
          formatData: (params) => {
            if (!params) return null
            for (let i = 0; i < this.dict.type.material_prop_type.length; i++) {
              const item = this.dict.type.material_prop_type[i]
              if (item.value == params) {
                return item.label
              }
            }
            return null
          }
        },
        {
          dataType: 'tag',
          label: '物料类型',
          prop: 'isExpire',
          formatData: (params) => {
            if (params == 1) {
              return '过期物料'
            } else {
              return null
            }
          },
          formatType: (params) => {
            if (params == 1) {
              return 'info'
            } else {
              return null
            }
          }
        },
        { label: '单位', prop: 'buyUnitMeas' },
        { label: '接收时间', prop: 'receiverDate',width:'160' },
        { label: '报检时间', prop: 'declareDate',width:'160' },
      ],
      insOrderPage:{
        total: 0,
        size: 20,
        current: 1
      },
      handlerId: null,
      contract:null,
      entity: {
        contract: null,
        sample: null,
@@ -238,18 +410,18 @@
          dataType: "tag",
          formatData: (params) => {
            if (params == 0) {
              return "生产反馈不合格";
            } else if(params == 1) {
              return "检测不合格";
            } else if(params == 1) {
              return "生产反馈不合格";
            } else {
              return null
            }
          },
          formatType: (params) => {
            if (params == 0) {
              return "warning";
              return "danger";
            } else if(params == 1) {
              return "info";
              return "warning";
            } else {
              return "null";
            }
@@ -260,16 +432,18 @@
          dataType: 'action',
          fixed: 'right',
          label: '操作',
          width: '180px',
          width: '220px',
          operation: [
            {
              name: '提交OA',
              name: (row)=>{
                return row.requestId !== null && row.operation==='退回' ? '重新提交' : '提交OA'
              },
              type: 'text',
              clickFun: (row) => {
                this.openOA(row);
              },
              disabled: (row, index) => {
                return row.requestId !== null  // 有requestId说明已经提交过OA,不可再次提交
                return row.requestId !== null && row.operation!=='退回'  // 有requestId说明已经提交过OA,不可再次提交
              }
            },
            {
@@ -286,7 +460,7 @@
                this.deleteOA(row);
              },
              disabled: (row, index) => {
                return row.requestId !== null  // 有requestId说明已经提交过OA,不可再次提交
                return row.requestId !== null && row.operation!=='退回'  // 有requestId说明已经提交过OA,不可再次提交
              }
            },
          ]
@@ -294,7 +468,7 @@
      ],
      page: {
        total: 0,
        size: 10,
        size: 20,
        current: 1
      },
      statusList: [],
@@ -312,6 +486,95 @@
    this.refreshTable()
  },
  methods: {
    getInsOrderRowId(row) {
      if (!row) {
        return ''
      }
      const currentId = row.enterOrderId || row.insOrderId || row.orderId || row.id
      return currentId ? String(currentId) : ''
    },
    getExistingInsOrderIds() {
      const ids = new Set()
      this.tableData.forEach(row => {
        ['insOrderId'].forEach(key => {
          if (row[key] !== undefined && row[key] !== null && row[key] !== '') {
            ids.add(String(row[key]))
          }
        })
      })
      return ids
    },
    isDisabledInsOrderRow(row) {
      const currentId = this.getInsOrderRowId(row)
      if (!currentId) {
        return false
      }
      return this.getExistingInsOrderIds().has(currentId)
    },
    insOrderSelectable(row) {
      return !this.isDisabledInsOrderRow(row)
    },
    insOrderRowClassName({ row }) {
      return this.isDisabledInsOrderRow(row) ? 'disabled-selection-row' : ''
    },
    resetInsOrderForm(){
      this.insOrderDataList = []
      this.lotBatchNo = null
      this.orderId = ''
      this.$nextTick(()=>{
        this.insOrderVisible = false
      })
    },
    openInsOrderDialog(){
      this.insOrderVisible = true
    },
    searchInsOrderList(){
      this.insOrderTableLoading = true
      const params = {
        updateBatchNo: this.lotBatchNo,
        isInspect: 1,
        ...this.insOrderPage
      }
      getIfsByAll(params).then(res => {
        this.insOrderTableLoading = false
        if (res.code === 200) {
          this.insOrderDataList = res.data.records
          this.insOrderPage.total = res.data.total
        }
      }).catch(err => {
        this.insOrderTableLoading = false
      })
    },
    insOrderPageination(page){
      this.insOrderPage.size = page.limit
      this.searchInsOrderList()
    },
    selectMethod(val){
      if (!val || val.length === 0) {
        this.orderId = ''
        return
      }
      const currentRow = val[val.length - 1]
      this.orderId = this.getInsOrderRowId(currentRow)
      if (val.length > 1 && this.$refs.insOrderTable && this.$refs.insOrderTable.$refs.multipleTable) {
        this.$refs.insOrderTable.$refs.multipleTable.clearSelection()
        this.$refs.insOrderTable.$refs.multipleTable.toggleRowSelection(currentRow, true)
      }
    },
    //打开新增不合格处理弹框
    openAddUnqualifiedHandlerView(){
      if(!this.orderId){
        this.$message.warning("请选择一条订单记录")
        return;
      }
      this.insOrderVisible = false
      this.unPassDialog = true;
      this.$nextTick(() => {
        this.$refs.unPassDialog.getInsOrder('add');
      });
    },
    exportUnqualifiedHandler(){
      this.exportLoading = true
      const newEntity = { ...this.entity }
@@ -362,6 +625,9 @@
    resetForm1 () {
      this.$refs.unPassDialog.$refs['unPassForm'].resetFields();
      this.unPassDialog = false
      this.$nextTick(()=>{
        this.refreshTable('page')
      })
    },
    // 打开删除OA确认弹框
    deleteOA (row) {
@@ -386,7 +652,16 @@
    // 查看提交OA的数据
    openOA (row) {
      this.handlerId = row.handlerId
      this.dialogVisible = true
      this.contract = row.contract
      if(row && row.requestId !== null  ){
        // 重新提交OA,打开编辑弹框
        this.unPassDialog = true
        this.$nextTick(() => {
          this.$refs.unPassDialog.getInsOrder('resubmit', row)
        })
      }else{
        this.dialogVisible = true
      }
    },
    // 查看OA流程
    OAView (row) {
@@ -403,7 +678,7 @@
    submitOA(row) {
      // 提交OA
      this.submitOALoading = true
      pushOA({handlerId: this.handlerId,}).then(res => {
      pushOA({handlerId: this.handlerId,contract:this.contract}).then(res => {
        this.submitOALoading = false
        if (res.code === 200) {
          this.dialogVisible = false
@@ -418,3 +693,10 @@
  }
};
</script>
<style scoped>
.capacity-scope >>> .disabled-selection-row td {
  background-color: #f5f7fa !important;
  color: #c0c4cc;
}
</style>