Crunchy
2025-04-29 e5454b769d44a34af423bf87ac8a740bf8c20341
src/views/business/productOrder/index.vue
@@ -8,7 +8,7 @@
          </el-input>
        </el-form-item>
        <el-form-item label="样品名称" prop="sampleName">
          <el-input v-model="entity.partNo" clearable placeholder="请输入" size="small"
          <el-input v-model="entity.sampleName" clearable placeholder="请输入" size="small"
            @keyup.enter.native="refreshTable"></el-input>
        </el-form-item>
        <el-form-item label="样品型号" prop="sampleModel">
@@ -17,6 +17,7 @@
        </el-form-item>
        <el-form-item label="下单时间" prop="createTime" v-if="more">
          <el-date-picker v-model="entity.createTime" clearable format="yyyy-MM-dd" placeholder="选择日期" size="small"
                          @change="refreshTable"
            style="width:100%" type="date" value-format="yyyy-MM-dd HH:mm:ss">
          </el-date-picker>
        </el-form-item>
@@ -33,35 +34,37 @@
        <el-form-item>
          <el-button :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" @click="refresh()">重 置</el-button>
          <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
          <el-button size="mini" type="primary" @click="refreshTable()">查询</el-button>
          <el-button size="mini" @click="refresh()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <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 === 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>
        </ul>
    <div class="container" v-loading="isLoading">
      <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 === 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>
          </ul>
        </div>
        <div>
          <el-button v-if="tabIndex === 2 || tabIndex === 3 || tabIndex === 6" size="small"
                     @click="downLoad">导出</el-button>
          <el-button v-if="tabIndex === 1" size="small" type="primary" @click="openAddIns">添加检验项</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>
        </div>
      </div>
      <div>
        <el-button v-if="tabIndex === 2 || tabIndex === 3 || tabIndex === 6" size="small"
          @click="downLoad">导出</el-button>
        <el-button v-if="tabIndex === 1" size="small" type="primary" @click="openAddIns">添加检验项</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>
      <div class="table">
        <lims-table :tableData="tableData" :column="column" :isSelection="true" :handleSelectionChange="selectMethod"
                    @pagination="pagination" :height="'calc(100vh - 280px)'" :key="upIndex" :page="page"
                    :tableLoading="tableLoading"></lims-table>
      </div>
    </div>
    <div class="table">
      <lims-table :tableData="tableData" :column="column" :isSelection="true" :handleSelectionChange="selectMethod"
        @pagination="pagination" :height="'calc(100vh - 280px)'" :key="upIndex" :page="page"
        :tableLoading="tableLoading"></lims-table>
    </div>
    <div>
      <!-- 审核 -->
@@ -293,9 +296,28 @@
      @closePrintDialog="closePrintDialog"></print-dialog>
    <!--添加遗漏检验项弹框-->
    <add-inspection-dia v-if="addInspectionDia" ref="addInspectionDia"></add-inspection-dia>
    <!--    <Inspection v-if="state>0" :key="InspectionKey" :inspectorList="inspectorList" :orderId="orderId"-->
    <!--                :sonLaboratory="sonLaboratory" :state="state"-->
    <!--                :typeSource="typeSource" @goback="goback" @refreshView="refreshView"/>-->
    <!--修改样品型号弹框-->
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false"
               :visible.sync="dialogVisible" title="修改样品型号" width="80%">
      <el-table ref="sampleTable" :data="sampleList" border highlight-current-row
                :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"
                max-height="400px" tooltip-effect="dark">
        <el-table-column align="center" label="序号" type="index" width="65"></el-table-column>
        <el-table-column align="center" label="样品名称" min-width="100" prop="sample"> </el-table-column>
        <el-table-column align="center" label="样品编号" min-width="100" prop="sampleCode"></el-table-column>
        <el-table-column align="center" label="样品型号" min-width="60" prop="model">
          <template slot-scope="scope">
            <el-input v-model="scope.row.model" clearable placeholder="不填写则系统自动生成"
                      size="small"></el-input>
          </template>
        </el-table-column>
        <el-table-column align="center" label="检验标准" min-width="100" prop="standardMethodName"></el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button :loading="submitListLoad" type="primary" @click="submitList">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -306,11 +328,11 @@
import AddInspectionDia from "@/views/business/productOrder/components/addInspectionDia.vue";
import limsTable from "@/components/Table/lims-table.vue";
import {
  checkUpdate, delInsOrder,
  checkUpdate, delInsOrder, getSampleByOrderId,
  rawAllInsOrderExport,
  selectInsOrderParameter, selectNoProducts, selectOrderManDay,
  updateInspected,
  updateOrderEntrustCode, updateStatus, upInsOrder, upPlanUser2
  updateOrderEntrustCode, updateSampleModel, updateStatus, upInsOrder, upPlanUser2
} from "@/api/business/productOrder";
import { selectUserCondition } from "@/api/performance/class";
import { downFile, getFileList, selectSampleAndProductByOrderId } from "@/api/business/rawMaterialOrder";
@@ -325,6 +347,7 @@
  },
  data() {
    return {
      isLoading: false, // 控制加载状态
      entity: {
        orderType: '',
        state: '',
@@ -348,7 +371,13 @@
          dataType: "link",
          linkMethod: "selectAllByOne",
        },
        { label: '样品型号', prop: 'sampleModel' },
        {
          label: "样品型号",
          prop: "sampleModel",
          width: "160px",
          dataType: "link",
          linkMethod: "editSampleModel",
        },
        { label: '样品数量', prop: 'sampleNum' },
        { label: '检验人', prop: 'testingName' },
        {
@@ -735,7 +764,10 @@
      multipleSelection: [],
      sonLaboratoryList: [],
      printDialog: false,
      addInspectionDia: false
      addInspectionDia: false,
      dialogVisible: false,
      submitListLoad: false,
      sampleList: []
    }
  },
  watch: {
@@ -752,6 +784,11 @@
    ...mapGetters(["nickName"]),
  },
  mounted() {
    if (this.checkPermi(['get:raw:await'])) {
      this.tabIndex = 0
    } else {
      this.tabIndex = 2
    }
    this.refreshTable()
    this.getAuthorizedPerson()
  },
@@ -771,8 +808,9 @@
        }
      }
      const params = { ...this.entity, state: this.tabList[this.tabIndex].value }
      this.tableLoading = true
      this.isLoading = true; // 开始加载
      selectInsOrderParameter({...this.page,...params}).then(res => {
        this.isLoading = false; // 结束加载
        this.upIndex++
        this.tableLoading = false
        if (res.code === 200) {
@@ -780,7 +818,7 @@
          this.page.total = res.data.total
        }
      }).catch(err => {
        this.tableLoading = false
        this.isLoading = false; // 结束加载
      })
    },
    refresh() {
@@ -889,7 +927,12 @@
    },
    // 导出记录
    downLoad() {
      const params = { ...this.entity, state: this.tabList[this.tabIndex].value }
      let params = {}
      if (this.multipleSelection.length > 0) {
        params.ids = this.multipleSelection.map(item => item.id).join(',');
      } else {
        params = { ...this.entity, state: this.tabList[this.tabIndex].value }
      }
      rawAllInsOrderExport({ ...params }).then(res => {
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '委托检测信息导出.xlsx');
@@ -940,15 +983,42 @@
      this.dataDialogVisible = false;
      this.upLoad = false;
    },
    // 详情
    // 点击样品名称
    selectAllByOne(row) {
      this.$router.push({
        path: "/productOrder/add", query: {
        path: "/productOrder/addView", query: {
          examine: 1,
          active: 2,
          currentId: row.id
          currentId: row.id,
          tabIndex: this.tabIndex,
        }
      });
    },
    // 修改样品型号
    editSampleModel (row) {
      if (this.tabIndex !== 1) {
        return
      }
      this.dialogVisible = true
      this.getDataList(row)
    },
    getDataList(row) {
      this.dialogVisible = true
      getSampleByOrderId({insOrderId: row.id}).then(res => {
        this.sampleList = res.data
      })
    },
    // 提交样品型号修改
    submitList () {
      this.submitListLoad = true
      updateSampleModel(this.sampleList).then(res => {
        this.submitListLoad = false
        this.dialogVisible = false
        this.$message.success('修改成功')
        this.refreshTable()
      }).catch(err => {
        this.submitListLoad = false
      })
    },
    // 数据查看
    handleDataLook(row) {
@@ -1039,7 +1109,7 @@
    },
    getDeleteList() {
      this.tableLoadingDelete = true
      selectNoProducts({ orderId: this.orderId, revocationInsProductIds: this.revocationInsProductIds }).then(res => {
      selectNoProducts({ orderId: this.orderId, revocationInsProductIds: this.revocationInsProductIds, ...this.pageDelete }).then(res => {
        this.tableLoadingDelete = false
        this.componentDataDelete = res.data.records
        this.pageDelete.total = res.data.total
@@ -1187,14 +1257,15 @@
    },
    // 下单
    playOrder(num) {
      this.$router.push({ path: "/productOrder/add", query: { examine: 0, active: num, tabIndex: this.tabIndex } });
      this.$router.push({ path: "/productOrder/addOrder", query: { examine: 0, active: num, tabIndex: this.tabIndex } });
    },
    // 审核
    handleVerify(row) {
      this.$router.push({ path: "/productOrder/add", query: { examine: 1, active: 3, currentId: row.id } });
      this.$router.push({ path: "/productOrder/addView", query: { examine: 1, active: 3, currentId: row.id } });
    },
    handleTab(i) {
      this.tabIndex = i;
      this.multipleSelection = []
      this.refreshTable()
    },
    // 查看检验数据
@@ -1205,16 +1276,29 @@
        inspectorList = row.userName.split(',')
      }
      inspectorList.push(this.nickName)
      this.$router.push({
        path: "/inspectionTask/inspection",
        query: {
          sonLaboratory: row.sonLaboratory,
          state: 3,
          typeSource: row.typeSource,
          orderId: row.id,
          inspectorList: inspectorList,
        },
      })
      if (this.checkPermi(['business:inspectionView'])) {
        this.$router.push({
          name: "InspectionView",
          query: {
            sonLaboratory: row.sonLaboratory,
            state: 3,
            typeSource: row.typeSource,
            orderId: row.id,
            inspectorList: inspectorList,
          },
        })
      } else {
        this.$router.push({
          path: "/inspectionTask/inspection",
          query: {
            sonLaboratory: row.sonLaboratory,
            state: 3,
            typeSource: row.typeSource,
            orderId: row.id,
            inspectorList: inspectorList,
          },
        })
      }
    },
    goback() {
      this.state = 0