src/views/business/productOrder/index.vue
@@ -43,17 +43,16 @@
      <div class="table-tab">
        <div>
          <ul class="tab">
            <li :class="{ active: tabIndex === 0 }" v-if="checkPermi(['get:insOrder:reviewed'])" @click="handleTab(0)">待审核</li>
            <li :class="{ active: tabIndex === 7 }" v-if="checkPermi(['get:insOrder:all'])" @click="handleTab(7)">全部</li>
            <li :class="{ active: tabIndex === 1 }" v-if="checkPermi(['get:insOrder:checkout'])" @click="handleTab(1)">检验中</li>
            <li :class="{ active: tabIndex === 2 }" v-if="checkPermi(['get:insOrder:customerOrdered'])" @click="handleTab(2)">委托已检</li>
            <li :class="{ active: tabIndex === 3 }" v-if="checkPermi(['get:insOrder:spotCheck'])" @click="handleTab(3)">抽样已检</li>
            <li :class="{ active: tabIndex === 4 }" v-if="checkPermi(['get:insOrder:sendBack'])" @click="handleTab(4)">退回</li>
            <li :class="{ active: tabIndex === 5 }" v-if="checkPermi(['get:insOrder:revocation'])" @click="handleTab(5)">撤销</li>
            <li :class="{ active: tabIndex === 6 }" v-if="checkPermi(['get:insOrder:all'])" @click="handleTab(6)">全部</li>
            <li :class="{ active: tabIndex === 6 }" v-if="checkPermi(['get:insOrder:revocation'])" @click="handleTab(6)">作废</li>
          </ul>
        </div>
        <div>
          <el-button v-if="tabIndex === 2 || tabIndex === 3 || tabIndex === 6" size="small"
          <el-button v-if="tabIndex === 2 || tabIndex === 3 || tabIndex === 7" size="small"
                     @click="downLoad">导出</el-button>
          <el-button size="small" type="primary" @click="openPrint">标签打印</el-button>
          <el-button v-if="checkPermi(['add:insOrder'])" size="small" type="primary" @click="playOrder(1)">下单</el-button>
@@ -105,55 +104,6 @@
            <el-button :loading="upLoad" type="primary" @click="submitForm">确 定</el-button>
          </el-row>
        </span>
      </el-dialog>
      <!-- 下发 -->
      <el-dialog :before-close="handleClose" :visible.sync="issuedDialogVisible" title="检验分配" width="400px">
        <div class="body" style="max-height: 60vh;">
          <el-row>
            <el-col class="search_thing" style="width: 95%;">
              <div class="search_label"><span class="required-span">* </span>约定时间:</div>
              <div class="search_input">
                <el-date-picker v-model="distributeData.appointed" format="yyyy-MM-dd" placeholder="选择日期" size="small"
                  style="width: 100%;" type="date" value-format="yyyy-MM-dd">
                </el-date-picker>
              </div>
            </el-col>
            <el-col class="search_thing" style="width: 95%;">
              <div class="search_label"><span class="required-span">* </span>指派人员:</div>
              <div class="search_input">
                <el-select v-model="distributeData.userId" clearable filterable placeholder="请选择" size="small"
                  style="width: 100%;" @change="changeUser">
                  <el-option v-for="(item, i) in personList" :key="i + 'gbnm.'" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </div>
            </el-col>
            <el-col class="search_thing" style="width: 95%;">
              <div class="search_label">试验室:</div>
              <div class="search_input">
                <el-select v-model="distributeData.sonLaboratory" clearable filterable placeholder="请选择" size="small"
                  style="width: 100%;">
                  <el-option v-for="(item, i) in newJuLaboratoryList" :key="i + 'oooo'" :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </div>
            </el-col>
          </el-row>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-row>
            <el-button @click="handleClose2">取 消</el-button>
            <el-button :loading="upLoad" type="primary" @click="submitForm2">确 定</el-button>
          </el-row>
        </span>
      </el-dialog>
      <el-dialog :visible.sync="dataDialogVisible" title="数据查看" width="80%" @close="closeDia">
        <div v-if="dataDialogVisible">
          <lims-table :tableData="tableDataLook" :column="tableDataLookColumn" @pagination="tableDataLookPagination"
            height="500px" key="tableDataLook" :page="tableDataLookPage"
            :tableLoading="tableDataLookTableLoading"></lims-table>
        </div>
      </el-dialog>
      <el-dialog :visible.sync="filesDialogVisible" title="附件查看" width="80%">
        <div v-if="filesDialogVisible">
@@ -329,12 +279,10 @@
  selectInsOrderParameter,
  selectNoProducts,
  getRevocationInsProductList,
  selectOrderManDay,
  updateInspected,
  updateOrderEntrustCode, updateSampleModel, updateStatus, upInsOrder
  updateOrderEntrustCode, updateSampleModel, updateStatus
} from "@/api/business/productOrder";
import { selectUserCondition } from "@/api/performance/class";
import { downFile, getFileList, selectSampleAndProductByOrderId } from "@/api/business/rawMaterialOrder";
import { downFile, getFileList } from "@/api/business/rawMaterialOrder";
import {mapGetters} from "vuex";
export default {
  name: 'ProductOrder',
@@ -386,6 +334,7 @@
        { label: '下单时间', prop: 'createTime' },
        { label: '下发时间', prop: 'sendTime' },
        { label: '退回理由', prop: 'tell' },
        { label: '拒收原因', prop: 'sampleRejectRemark' },
        { label: '委托人', prop: 'prepareUser' },
        {
          dataType: 'action',
@@ -400,29 +349,16 @@
              }
            },
            {
              name: '数据查看',
              type: 'text',
              clickFun: (row) => {
                this.handleDataLook(row);
              },
              disabled: (row, index) => {
                return row.state != 1 && row.state != 4
              },
              showHide: (row) => {
                return this.tabIndex === 1 || this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 6
              }
            },
            {
              name: '附件查看',
              type: 'text',
              clickFun: (row) => {
                this.handleFileLook(row);
              },
              disabled: (row, index) => {
                return row.state != 1 && row.state != 4
                return row.state != 1 && row.state != 4 && row.state != 5
              },
              showHide: (row) => {
                return this.tabIndex === 1 || this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 6
                return this.tabIndex === 1 || this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 6 || this.tabIndex === 7
              }
            },
            {
@@ -432,7 +368,7 @@
                this.download(row);
              },
              showHide: (row) => {
                return this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 6
                return this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 7
              }
            },
            {
@@ -475,19 +411,6 @@
              }
            },
            {
              name: '分配',
              type: 'text',
              clickFun: (row) => {
                this.handleIssued(row);
              },
              disabled: (row, index) => {
                return row.state != 1 || !!row.assign
              },
              showHide: (row) => {
                return this.tabIndex === 1
              }
            },
            {
              name: '删除',
              type: 'text',
              clickFun: (row) => {
@@ -504,7 +427,7 @@
                this.viewInspectInfo(row);
              },
              showHide: (row) => {
                return this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 6
                return this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 7
              }
            },
          ]
@@ -534,56 +457,6 @@
      isQuash: false,
      verifyDialogVisible: false,
      quashDialogVisible: false,
      issuedDialogVisible: false,
      dataDialogVisible: false, // 数据查看弹框
      currentRow: {}, // 数据查看弹框
      tableDataLookTableLoading: false, // 数据查看弹框
      tableDataLook: [],
      tableDataLookPage: {
        total: 0,
        size: 20,
        current: 1
      },
      tableDataLookColumn: [
        { label: '样品编号', prop: 'sampleCode', width: '160px' },
        { label: '样品名称', prop: 'sample' },
        { label: '检验项分类', prop: 'inspectionItemClass' },
        { label: '检验项', prop: 'inspectionItem' },
        { label: '检验子项', prop: 'inspectionItemSubclass' },
        { label: '单位', prop: 'unit' },
        { label: '样品型号', prop: 'model' },
        { label: '条件', prop: 'radius' },
        { label: '电缆标识', prop: 'cableTag' },
        { label: '试验要求', prop: 'tell' },
        { label: '检验结果', prop: 'lastValue' },
        {
          dataType: 'tag',
          label: '结果判定',
          prop: 'insResult',
          formatData: (params) => {
            if (params == 1) {
              return '合格'
            } else if (params == 0) {
              return '不合格'
            } else if (params == 3) {
              return '不判定'
            } else {
              return ''
            }
          },
          formatType: (params) => {
            if (params == 1) {
              return 'success'
            } else if (params == 0) {
              return 'danger'
            } else if (params == 3) {
              return ''
            } else {
              return ''
            }
          }
        },
      ],
      filesDialogVisible: false, // 附件查看弹框
      tableDataFile: [],
      tableLoadingFile: false,
@@ -638,18 +511,9 @@
      formData: {},
      formData0: {},
      formData1: {},
      distributeData: {
        orderId: '',
        sampleId: '',
        appointed: '',
        userId: '',
        sonLaboratory: ''
      },
      entrustCodeVisible: false, // 修改委托编号弹框
      entrustCodeInfo: {},
      submitCodeLoading: false,
      // 人员列表
      personList: [],
      orderId: '',
      revocationInsProductIds: '',
      componentDataDelete: [],
@@ -699,11 +563,15 @@
          value: 3
        },
        {
          label: '作废',
          value: 5
        },
        {
          label: '全部',
          value: -2
        }
      ],
      tabIndex: 0,
      tabIndex: 7,
      active: 0, //1:下单,2:查看,3:审核,4:光纤配置,默认为0
      currentId: null,
      more: false,
@@ -732,21 +600,13 @@
      }
    }
  },
  dicts: ['sys_sub_lab'],
  computed: {
    ...mapGetters(["nickName"]),
    newJuLaboratoryList() {
      return (this.dict.type.sys_sub_lab || []).filter(item => item.label === '新聚')
    },
  },
  mounted() {
    if (this.checkPermi(['get:raw:await'])) {
      this.tabIndex = 0
    } else {
      this.tabIndex = 2
    }
    // 免审核后没有待审核页签,默认进入全部
    this.tabIndex = this.checkPermi(['get:insOrder:all']) ? 7 : 1
    this.refreshTable()
    this.getAuthorizedPerson()
  },
  activated() {
    this.refreshTable()
@@ -897,31 +757,9 @@
    closePrintDialog() {
      this.printDialog = false
    },
    // 获取指派人员下拉列表
    getAuthorizedPerson() {
      selectUserCondition({ type: 1 }).then(res => {
        let data = []
        res.data.forEach(a => {
          data.push({
            label: a.name,
            value: a.id
          })
        })
        this.personList = data
      })
    },
    handleClose() {
      this.verifyDialogVisible = false;
      this.quashDialogVisible = false;
      this.issuedDialogVisible = false;
      this.dataDialogVisible = false;
      this.upLoad = false;
    },
    handleClose2() {
      this.verifyDialogVisible = false;
      this.quashDialogVisible = false;
      this.issuedDialogVisible = false;
      this.dataDialogVisible = false;
      this.upLoad = false;
    },
    // 点击样品名称
@@ -972,37 +810,6 @@
      }).catch(err => {
        this.submitListLoad = false
      })
    },
    // 数据查看
    handleDataLook(row) {
      this.dataDialogVisible = true;
      this.currentRow = row;
      this.getDataTableList(this.currentRow)
    },
    // 查询数据查看列表数据
    getDataTableList(row) {
      this.tableDataLookTableLoading = true
      selectSampleAndProductByOrderId({ id: row.id, ...this.tableDataLookPage }).then(res => {
        this.tableDataLookTableLoading = false
        if (res.code === 200) {
          this.tableDataLook = res.data.records
          this.tableDataLookPage.total = res.data.total
        }
      }).catch(err => {
        this.tableDataLookTableLoading = false
      })
    },
    tableDataLookPagination(page) {
      this.tableDataLookPage.size = page.limit
      this.getDataTableList(this.currentRow)
    },
    closeDia () {
      this.tableDataLookPage = {
        total: 0,
        size: 20,
        current: 1
      }
      this.dataDialogVisible = false
    },
    // 附件查看
    handleFileLook(row) {
@@ -1137,46 +944,6 @@
        })
      }
    },
    // 下发
    handleIssued(row) {
      this.issuedDialogVisible = true;
      this.distributeData.sonLaboratory = this.newJuLaboratoryList.length > 0 ? this.newJuLaboratoryList[0].value : ''
      selectOrderManDay({
        id: row.id
      }).then(res => {
        this.distributeData.orderId = row.id
        this.distributeData.sampleId = row.sampleId
        this.distributeData.appointed = res.data
        this.distributeData.type = row.type
      })
    },
    submitForm2() {
      if (this.distributeData.appointed == null || this.distributeData.appointed == '') {
        this.$message.error('约定时间未填写')
        return
      }
      //
      if (this.distributeData.userId == null || this.distributeData.userId == '') {
        this.$message.error('指派人员未填写')
        return
      }
      this.upLoad = true;
      upInsOrder({
        orderId: this.distributeData.orderId,
        sampleId: this.distributeData.sampleId,
        appointed: this.distributeData.appointed,
        userId: this.distributeData.userId,
        sonLaboratory: this.distributeData.sonLaboratory,
      }).then(res => {
        this.$message.success('修改成功')
        this.upLoad = false
        this.issuedDialogVisible = false
        this.refreshTable()
      }).catch(e => {
        this.$message.error('修改失败')
        this.upLoad = false
      })
    },
    submitForm() {
      this.upLoad = true;
      if (this.tabIndex == 1) {
@@ -1230,7 +997,7 @@
        this.$router.push({
          name: "InspectionView",
          query: {
            sonLaboratory: row.sonLaboratory,
            sonLaboratory: null,
            state: 3,
            typeSource: row.typeSource,
            orderId: row.id,
@@ -1241,7 +1008,7 @@
        this.$router.push({
          path: "/inspectionTask/inspection",
          query: {
            sonLaboratory: row.sonLaboratory,
            sonLaboratory: null,
            state: 3,
            typeSource: row.typeSource,
            orderId: row.id,
@@ -1257,11 +1024,6 @@
    // 刷新页面
    refreshView() {
      this.InspectionKey++
    },
    changeUser() {
      if (this.newJuLaboratoryList.length > 0) {
        this.distributeData.sonLaboratory = this.newJuLaboratoryList[0].value
      }
    },
    handleDelete(row) {
      this.$confirm('是否删除当前数据?', "警告", {