zouyu
2024-03-15 c91ea4d8cda53c0f319c9f4306ff03e7c774bca0
业务管理:检验任务(update)
已修改3个文件
140 ■■■■ 文件已修改
src/assets/api/controller.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/tool/value-table.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b1-inspect-order-plan.vue 138 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -117,6 +117,7 @@
const insOrderPlan = {
    selectInsOrderPlanList: "/insOrderPlan/selectInsOrderPlanList", //查询检验任务
  claimInsOrderPlan: "/insOrderPlan/claimInsOrderPlan",//认领检验任务
}
src/components/tool/value-table.vue
@@ -92,6 +92,7 @@
                    v-if="data.do.length > 0">
                    <template slot-scope="scope">
                        <el-button v-for="(a, ai) in data.do" :key="ai" :type="a.type"
              :disabled="a.disabFun ? a.disabFun(scope.row,scope.$index) : false"
                            @click="main(scope.row, a)">{{a.font}}</el-button>
                    </template>
                </el-table-column>
src/components/view/b1-inspect-order-plan.vue
@@ -1,6 +1,7 @@
<style scoped>
.ins-order-plan-main{
  padding-top: 60px;
ins-order-plan-main .title{
  font-size:20px;
  color:#3A7BFA
}
.ins-order-plan-main .search{
  width: 100%;
@@ -57,17 +58,20 @@
.center .center-options .center-title {
  width:85%;
  padding-top: 20px;
  text-align: right;
  text-align: left;
}
.center .center-options .center-title span:last-child{
  color: #3A7BFA;
  font-size: 23px;
  font-weight: 400;
}
.view-self-checkbox{
margin-left: 20px;
}
</style>
<template>
  <div class="ins-order-plan-main">
    <p style="font-size: 16px;padding:19.5px 0px">检验任务</p>
    <div class="search">
      <el-form :inline="true" :model="searchForm" class="form-inline">
        <el-form-item label="样品名称:">
@@ -88,12 +92,15 @@
    <div class="center">
      <div class="center-options">
        <el-row>
          <el-col :span="20">
            <ul class="tab">
              <li v-for="(m,i) in tabList" :key="i" :class="{active:i==tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
            </ul>
          <el-col :span="21">
            <div style="display: flex;align-items: center;">
              <ul class="tab">
                <li v-for="(m,i) in tabList" :key="i" :class="{active:i==tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
              </ul>
              <el-checkbox @change="changeCheckBox" class="view-self-checkbox" v-model="viewSelf"/><span>&nbsp;我的任务</span>
            </div>
          </el-col>
          <el-col :span="4">
          <el-col :span="3">
            <div class="center-title">
              <span>总计任务数量:</span>
              <span v-if="$refs.insOrderPlan != undefined">{{$refs.insOrderPlan.total}}</span>
@@ -103,6 +110,16 @@
      </div>
      <ValueTable :tableRowClassName="changeRowClass" class="value-table" ref="insOrderPlan" :url="$api.insOrderPlan.selectInsOrderPlanList" :upUrl="$api.user.updateUser" :componentData="componentData" :key="upIndex" @upUser="upUser"/>
    </div>
    <el-dialog
      title="提示"
      :visible.sync="claimVisible"
      width="40%">
      是否认领委托编号<span style="color:#33C130">{{sampleUserForm.entrustCode}}</span>的任务
      <span slot="footer" class="dialog-footer">
        <el-button @click="claimVisible = false">取 消</el-button>
        <el-button type="primary" @click="confirmClaim">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -115,31 +132,27 @@
  },
  data(){
    return {
      viewSelf: false,
      sampleUserForm:{
        entrustCode: null,
        insSampleId: null,
        userId: null
      },
      claimVisible: false,
      searchForm:{
        sampleName: null,
        state: null
      },
      tabList: [
        {
          label: '实验室1',
          value: 1
        },
        {
          label: '实验室2',
          value: 2
        },
        {
          label: '实验室3',
          value: 3
        }
      ],
      tabList: [],
      active: 1,
      tabIndex: 0,
      componentData: {
                    entity: {
            viewSelf: false,
            state: 1,
            childrenLaboratory: null,
            insState: null,
            sample: null,
            sampleName: null,
                        orderBy: {
                            field: 'type',
                            order: 'desc'
@@ -169,7 +182,8 @@
                        id: '',
                        font: '认领',
                        type: 'text',
                        method: ''
                        method: 'claimFun',
            disabFun: (row,index)=>{return row.sampleUserId!=null}
                    }],
                    tagField: {
            type:{
@@ -191,23 +205,65 @@
  created(){
    this.getTypeDicts()
    this.getInsStateDicts()
    this.refreshTable()
    this.getLaboratoryDicts()
    this.$nextTick(()=>{
      this.refreshTable()
    })
  },
  watch:{
    tabList(newVal){
      if(newVal && newVal.length>0){
        this.componentData.entity.childrenLaboratory = newVal[0].value
        this.$nextTick(()=>{
          this.refreshTable()
        })
      }
    }
  },
  methods:{
    upUser(){
    },
    refreshTable() {
      this.$refs.insOrderPlan.selectList()
    changeCheckBox(val){
      this.componentData.entity.viewSelf = val
      this.$nextTick(()=>{
        this.planTotal = this.$refs.insOrderPlan.total
        this.refreshTable()
      })
    },
    changeRowClass(obj,rowIndex){
    claimFun(row){
      console.log(row)
      if(row){
        this.sampleUserForm = {
          entrustCode : row.entrustCode,
          insSampleId: row.id
        }
        this.claimVisible = true
      }
    },
    confirmClaim(){
      this.$axios.post(this.$api.insOrderPlan.claimInsOrderPlan, this.sampleUserForm,{
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then(res=>{
        if(res.code===200 && res.data){
          this.$message.success("认领成功")
          this.claimVisible = false
          this.refreshTable()
        }
      }).catch(error=>{
        console.error(error)
      })
    },
    refreshTable() {
      this.$refs.insOrderPlan.selectList()
    },
    changeRowClass({row,rowIndex}){
      let currentTime = getYearAndMonthAndDays()
      if(obj.row.sendTime && currentTime===obj.row.sendTime){
      if(row.sendTime && currentTime===row.sendTime){
        return 'highlight-warning-row-border'
      }else if(obj.row.sendTime && currentTime>obj.row.sendTime){
      }else if(row.sendTime && currentTime>row.sendTime){
        return 'highlight-danger-row-border'
      }
      return ''
@@ -218,20 +274,20 @@
        state: null,
      }
      this.componentData.entity.insState = null
      this.componentData.entity.sample = null
      this.componentData.entity.sampleName = null
      this.refreshTable()
    },
    onSubmit(){
      this.componentData.entity.insState = this.searchForm.state
      this.componentData.entity.sample = this.searchForm.sampleName
      this.componentData.entity.sampleName = this.searchForm.sampleName
      this.$nextTick(()=>{
        this.refreshTable()
      })
    },
    handleTab(m, i) {
      this.tabIndex = i;
      //this.componentData.entity.state = m.value
      //this.refreshTable()
      this.componentData.entity.childrenLaboratory = m.value
      this.refreshTable()
    },
    getTypeDicts() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
@@ -269,6 +325,16 @@
        this.componentData.tagField.insState.select = data
      })
    },
    getLaboratoryDicts(){
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "子实验室"
      }).then(res => {
        this.tabList = res.data.map(ele=>{return {label:ele.label,value:ele.value}})
        this.$nextTick(()=>{
          this.componentData.entity.childrenLaboratory = this.tabList[0].value
        })
      })
    }
  }
}
</script>