zouyu
2024-08-08 c263fb316fc23d9db98ce711fda30d81c28d2d9c
src/components/view/b1-inspect-order-plan.vue
@@ -155,6 +155,7 @@
               </el-row>
            </div>
            <ValueTable :tableRowClassName="changeRowClass" class="value-table" ref="insOrderPlan"
                    :isColumnWidth="true"
               :url="$api.insOrderPlan.selectInsOrderPlanList" :upUrl="$api.user.updateUser" :componentData="componentData" @handleInspection="handleInspection"
               :key="upIndex"/>
         </div>
@@ -168,11 +169,24 @@
      </el-dialog>
    <el-dialog title="检验交接" :visible.sync="connectVisible" width="400px">
         <div class="search_thing">
        <div class="search_label" style="width:90px">交接人员:</div>
        <div class="search_label" style="width:90px"><span class="required-span">* </span>交接人员:</div>
        <div class="search_input">
          <el-select v-model="connectPerson" placeholder="请选择" style="width: 100%;" filterable>
          <el-select v-model="connect.connectPerson" placeholder="请选择" style="width: 100%;" filterable>
            <el-option
              v-for="item in personList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label" style="width:90px"><span class="required-span">* </span>试验室:</div>
        <div class="search_input">
          <el-select v-model="connect.sonLaboratory" placeholder="请选择" style="width: 100%;" filterable>
            <el-option
              v-for="item in sonLaboratoryList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
@@ -189,7 +203,13 @@
         <Add :active="activeFace" :currentId="currentId"/>
      </div>
    <Inspection v-if="state>0" @goback="goback" :orderId="orderId" :sonLaboratory="componentData.entity.sonLaboratory" :state="state"/>
   </div>
      <el-dialog title="数据查看" :visible.sync="dataDialogVisible" width="80%">
            <div style="height: 70vh;overflow-y: auto;" v-if="dataDialogVisible">
               <ValueTable ref="ValueTableDataLook" :url="$api.insOrder.selectSampleAndProductByOrderId"
                  :componentData="componentDataDataLook"/>
            </div>
         </el-dialog>
  </div>
</template>
<script>
@@ -199,6 +219,7 @@
      getYearAndMonthAndDays
   } from '../../util/date'
   import Add from '../do/b1-ins-order/add.vue'
import { CellGroup } from 'iview'
   export default {
      components: {
         ValueTable,
@@ -217,6 +238,55 @@
            tabList: [],
            active: 1,
            tabIndex: 0,
        componentDataDataLook: {
               entity: {
                  id: 0,
                  orderBy: {
                     field: 'sampleCode',
                     order: 'asc'
                  }
               },
               isIndex: false,
               showSelect: false,
               select: false,
               do: [],
               tagField: {
                  insState: {
                     select: []
                  },
                  insResult: {
                     select: [{
                        value: 1,
                        label: '合格',
                        type: 'success'
                     },{
                        value: 0,
                        label: '不合格',
                        type: 'danger'
                     }]
                  }
               },
               selectField: {},
          spanConfig:{
            rows:[
              {
                name:'sampleCode',
                index:0
              },
              {
                name:'sample',
                index:1
              },
              {
                name:'model',
                index:5
              }
            ]
          },
               requiredAdd: [],
               requiredUp: []
            },
        dataDialogVisible: false,
            componentData: {
               entity: {
                  sonLaboratory: null,
@@ -226,23 +296,39 @@
               isIndex: true,
               showSelect: false,
               select: false,
               sort: false,
               init: false,
          needSort: ['createTime', 'sendTime', 'type', 'appointed', 'insState'],
               do: [{
                  id: '',
                  font: '数据查看',
                  type: 'text',
                  method: 'handleDataLook',
            //disabFun: (row, index) => {
              //const user = JSON.parse(localStorage.getItem('user'))
             // let currentUserName = ''
             // if(user){
              //  currentUserName = user.name
              //}
                     //return row.userName.indexOf(currentUserName)<0 && row.checkName.indexOf(currentUserName)<0
                  //}
               },{
                     id: '',
                     font: '检验',
                     type: 'text',
                     method: 'handleInspection',
                     disabFun: (row, index) => {
                        return row.userId == null || row.insState == 3 || row.insState == 5
                        return row.userName == null || row.insState == 3 || row.insState == 5||(row.userName&&!row.userName.includes(JSON.parse(localStorage.getItem("user")).name))
                     }
              // disabFun: (row, index) => {
                     //    return row.userId == null || row.insState == 3 || row.insState == 5
                     // }
                  }, {
                     id: '',
                     font: '交接',
                     type: 'text',
                     method: 'handleConnect',
                     disabFun: (row, index) => {
                        return row.userId == null || row.orderUserId == null || row.insState == 5  || row.insState == 3
                        return row.userName == null || row.insState == 5  || row.insState == 3||(row.userName&&!row.userName.includes(JSON.parse(localStorage.getItem("user")).name))
                     }
                  },
                  {
@@ -250,8 +336,8 @@
                     font: '复核',
                     type: 'text',
                     method: 'handleReview',
                     disabFun: (row, index) => {
                        return row.userId == null || row.insState != 3 || row.verifyUser != 1
                     disabFun: (row, userName) => {
                        return row.userName == null || row.insState != 3 ||(row.checkName&&!row.checkName.includes(JSON.parse(localStorage.getItem("user")).name))
                     }
                  }, {
                     id: '',
@@ -259,7 +345,7 @@
                     type: 'text',
                     method: 'claimFun',
                     disabFun: (row, index) => {
                        return row.userId != null
                        return row.userName != null || row.checkName!=null
                     }
                  }
               ],
@@ -305,9 +391,13 @@
            orderId: 0,
        personList:[],
        connectVisible:false,
        connectPerson:'',
        connect:{
          connectPerson:'',
          sonLaboratory:''
        },
        loading:false,
        currentTime: null
        currentTime: null,
        sonLaboratoryList:[]
         }
      },
      created() {
@@ -322,6 +412,11 @@
      this.getPower()
      },
      methods: {
         // 数据查看
         handleDataLook(row) {
            this.componentDataDataLook.entity.id = row.id
            this.dataDialogVisible = true;
         },
      // 权限分配
         getPower(radio) {
            let power = JSON.parse(sessionStorage.getItem('power'))
@@ -372,7 +467,8 @@
            if (row) {
               this.sampleUserForm = {
                  entrustCode: row.entrustCode,
                  insSampleId: row.id
                  insSampleId: row.id,
            sonLaboratory: row.sonLaboratory,
               }
               this.claimVisible = true
            }
@@ -499,14 +595,37 @@
      },
      handleConnect(row){
        this.orderId = row.id
        this.connect = {}
        this.connectVisible=true;
        this.$axios.post(this.$api.insOrderPlan.upPlanUser2, {
            orderId:this.orderId,
          }).then(res => {
               if (res.code === 200&&res.data.length>0) {
            this.sonLaboratoryList = [];
            res.data.forEach(m=>{
              this.sonLaboratoryList.push({
                value:m,
                label:m
              })
            })
            this.connect.sonLaboratory = this.sonLaboratoryList[0].value
               }
            })
      },
      confirmConnect(){
        if(this.connectPerson){
          this.loading = true;
        if(this.connect.connectPerson==null||this.connect.connectPerson==''||this.connect.connectPerson==undefined){
          this.$message.error('未选择交接人员')
          return
        }
        if(this.connect.sonLaboratory==null||this.connect.sonLaboratory==''||this.connect.sonLaboratory==undefined){
          this.$message.error('未选择试验室')
          return
        }
        this.loading = true;
          this.$axios.post(this.$api.insOrderPlan.upPlanUser, {
            orderId:this.orderId,
            userId:this.connectPerson
            userId:this.connect.connectPerson,
            sonLaboratory:this.connect.sonLaboratory,
          }).then(res => {
               if (res.code === 200) {
            this.loading = false;
@@ -518,9 +637,6 @@
               console.error(error)
          this.loading = false;
            })
        }else{
          this.$message.error('未选择交接人员')
        }
      },
      handleReview(row){
        this.state = 2;