李林
2024-03-18 2281a3da368d9366e7d97e85719fe0f4a0492f9b
src/components/view/b1-inspection-order.vue
@@ -12,19 +12,19 @@
   }
   .search_thing {
      width: 350px;
      display: flex;
      align-items: center;
      height: 50px;
   }
   .search_label {
      width: 110px;
      width: 120px;
      font-size: 14px;
      text-align: right;
   }
   .search_input {
      width: calc(100% - 110px);
      width: calc(100% - 120px);
   }
   .table {
@@ -75,7 +75,7 @@
            <el-row class="title">
               <el-col :span="12" style="padding-left: 20px;">检验下单</el-col>
               <el-col :span="12" style="text-align: right;">
                  <el-button size="medium" type="primary" @click="playOrder(1)">下单</el-button>
                  <el-button size="medium" type="primary" @click="playOrder(1)" v-if="addPower">下单</el-button>
               </el-col>
            </el-row>
         </div>
@@ -83,12 +83,12 @@
            <div class="search_thing">
               <div class="search_label">委托编号:</div>
               <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                     v-model="componentData.entity.deviceName" @keyup.enter.native="refreshTable()"></el-input></div>
                     v-model="componentData.entity.entrustCode" @keyup.enter.native="refreshTable()"></el-input></div>
            </div>
            <div class="search_thing">
               <div class="search_label">样品名称:</div>
               <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                     v-model="componentData.entity.specificationModel" @keyup.enter.native="refreshTable()"></el-input></div>
                     v-model="componentData.entity.sample" @keyup.enter.native="refreshTable()"></el-input></div>
            </div>
            <div class="search_thing" style="padding-left: 30px;">
               <el-button size="small" @click="refresh()">重 置</el-button>
@@ -99,11 +99,8 @@
            <ul class="tab">
               <li v-for="(m,i) in tabList" :key="i" :class="{active:i==tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
            </ul>
            <!-- 语法 子组件通过 this.$emit +传入方法名 调用父组件方法 例如  this.$emit(selectAllByOne) 就需在父组件声明并传入  @selectAllByOne="selectAllByOne"-->
            <ValueTable ref="ValueTable" :url="$api.insOrder.selectInsOrderParameter" :componentData="componentData"
               :key="upIndex" style="height: calc(100% - 44px)" @selectAllByOne="selectAllByOne"
               @handleDataLook="handleDataLook" @download="download" @handleVerify="handleVerify" @handlEquash="handlEquash"
               @handleIssued="handleIssued" />
               :key="upIndex" style="height: calc(100% - 44px)" />
         </div>
         <!-- 审核 -->
         <el-dialog title="下单审核" :visible.sync="verifyDialogVisible" width="30%" :before-close="handleClose">
@@ -146,22 +143,28 @@
            </span>
         </el-dialog>
         <!-- 下发 -->
         <el-dialog title="检验下发" :visible.sync="issuedDialogVisible" width="30%" :before-close="handleClose">
            <el-form :label-position="labelPosition" :model="formData2" label-width="150px" ref="ruleForm">
               <el-form-item label="约定时间:">
                  <el-date-picker style="width:100%" format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="formData2.appointed2"
                     type="date" size="small" placeholder="选择时间">
                  </el-date-picker>
               </el-form-item>
               <el-form-item >
               </el-form-item>
               <el-form-item label="指派人员:">
                  <el-select v-model="formData2.id" placeholder="请选择" size="small" style="width:100%">
                     <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
                     </el-option>
                  </el-select>
               </el-form-item>
            </el-form>
         <el-dialog title="检验下发" :visible.sync="issuedDialogVisible" width="400px" :before-close="handleClose">
            <div class="body" style="max-height: 60vh;">
               <el-row>
                  <el-col class="search_thing" :span="22">
                     <div class="search_label"><span class="required-span">* </span>约定时间:</div>
                     <div class="search_input">
                        <el-date-picker size="small" v-model="distributeData.appointed" type="date" placeholder="选择日期"
                           value-format="yyyy-MM-dd" style="width: 100%;" format="yyyy-MM-dd">
                        </el-date-picker>
                     </div>
                  </el-col>
                  <el-col class="search_thing" :span="22">
                     <div class="search_label"><span class="required-span">* </span>指派人员:</div>
                     <div class="search_input">
                        <el-select v-model="distributeData.userId" placeholder="请选择" size="small" style="width: 100%;">
                           <el-option v-for="item in personList" :key="item.value" :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>
@@ -177,7 +180,7 @@
         </el-dialog>
      </div>
      <div style="width: 100%;height: 100%;" v-if="active == 1">
         <Add/>
         <Add />
      </div>
   </div>
</template>
@@ -199,21 +202,22 @@
            verifyDialogVisible: false,
            quashDialogVisible: false,
            issuedDialogVisible: false,
            issuedDialogVisible2: false,
            dataDialogVisible: false,
            formData: {},
            formData0:{},
            formData1:{},
            formData2:{
               id:'',
               orderName:'',
               data:'',
            formData0: {},
            formData1: {},
            distributeData: {
               orderId: '',
               sampleId: '',
               appointed: '',
               userId: ''
            },
            // 人员列表
            personList: [],
            labelPosition: 'right',
            componentData: {
               entity: {
                  entrustCode: null,
                  sample: null,
                  state: 1,
                  orderBy: {
                     field: 'id',
@@ -227,28 +231,44 @@
                  id: 'dataLook',
                  font: '数据查看',
                  type: 'text',
                  method: 'handleDataLook'
                  method: 'handleDataLook',
                  disabFun: (row, index) => {
                     return row.state != 1
                  }
               }, {
                  id: 'download',
                  font: '报告下载',
                  type: 'text',
                  method: 'download'
                  method: 'download',
                  disabFun: (row, index) => {
                     return row.state != 1
                  }
               }, {
                  id: 'verify',
                  font: '审核',
                  type: 'text',
                  method: 'handleVerify'
                  method: 'handleVerify',
                  disabFun: (row, index) => {
                     return row.state != 0
                  }
               }, {
                  id: 'quash',
                  font: '撤销',
                  type: 'text',
                  method: 'handlEquash'
               }, {
                  id: 'issued',
                  font: '下发',
                  type: 'text',
                  method: 'handleIssued'
                  method: 'handleIssued',
                  disabFun: (row, index) => {
                     return row.state != 1 || row.sendTime != null
                  }
               }],
               linkEvent:{
                 entrustCode:{
                   method:'selectAllByOne'
                 }
               },
               tagField: {
                  type: {
                     select: [{
@@ -265,16 +285,13 @@
                        label: '紧急'
                     }]
                  },
               },
               linkEvent:{
                 deviceName:{
                   id: 'details',
                   method:'selectAllByOne',
                 }
                  createUser: {
                     select: []
                  }
               },
               selectField: {},
               requiredAdd: ['largeCategory', 'subclass', 'deviceName', 'internalCode', 'specificationModel', 'manufacturer'],
               requiredUp: ['largeCategory', 'subclass', 'deviceName', 'internalCode', 'specificationModel', 'manufacturer']
               requiredAdd: [],
               requiredUp: []
            },
            componentDataDataLook: {
               entity: {
@@ -336,13 +353,14 @@
      mounted() {
         this.entityCopy = this.HaveJson(this.componentData.entity)
         this.getPower()
         this.getUserMenu()
         this.getAuthorizedPerson()
      },
      methods: {
         getAuthorizedPerson(){
           this.$axios.post(this.$api.deviceScope.selectDevicePrincipal).then(res => {
         getAuthorizedPerson() {
            this.$axios.get(this.$api.user.getUserMenu).then(res => {
               let data = []
               res.data.forEach(a=>{
               res.data.forEach(a => {
                  data.push({
                     label: a.name,
                     value: a.id
@@ -350,7 +368,7 @@
               })
               this.personList = data
            })
      },
         },
         refreshTable() {
            this.$refs['ValueTable'].selectList()
         },
@@ -365,21 +383,15 @@
            let del = false
            let add = false
            for (var i = 0; i < power.length; i++) {
               if (power[i].menuMethod == 'upDeviceParameter') {
               if (power[i].menuMethod == 'upInsOrder') {
                  up = true
               }
               if (power[i].menuMethod == 'delDeviceParameter') {
                  del = true
               }
               if (power[i].menuMethod == 'addDeviceParameter') {
               if (power[i].menuMethod == 'addInsOrder') {
                  add = true
               }
            }
            if (!del) {
               this.componentData.do.splice(1, 1)
            }
            if (!up) {
               this.componentData.do.splice(0, 1)
               this.componentData.do.splice(4, 1)
            }
            this.addPower = add
         },
@@ -399,6 +411,7 @@
         },
         // 详情
         selectAllByOne(row) {
            console.log(row);
            //打开弹框
            this.dialogVisible = true;
            //row = 点击对应行值
@@ -411,7 +424,6 @@
         },
         // 下载报告
         download(row) {
         },
         // 审核
         handleVerify(row) {
@@ -424,13 +436,25 @@
         // 下发
         handleIssued(row) {
            this.issuedDialogVisible = true;
            this.$axios.post(this.$api.insOrder.selectOrderManDay,{
               id: row.sampleId
            }).then(res=>{
               this.distributeData.orderId = row.id
               this.distributeData.sampleId = row.sampleId
               this.distributeData.appointed = res.data
            })
         },
         submitForm2(){
         submitForm2() {
            if(this.distributeData.appointed==null||this.distributeData.appointed==''){
               this.$message.error('约定时间未填写')
               return
            }
            this.upLoad = true;
            this.$axios.post(this.$api.insOrder.getDeviceManager, this.formData2, {
               headers: {
                  'Content-Type': 'application/json'
               }
            this.$axios.post(this.$api.insOrder.upInsOrder, {
               orderId: this.distributeData.orderId,
               sampleId: this.distributeData.sampleId,
               appointed: this.distributeData.appointed,
               userId: this.distributeData.userId
            }).then(res => {
               if (res.code === 201) {
                  this.upLoad = false
@@ -438,11 +462,10 @@
               }
               this.$message.success('修改成功')
               this.upLoad = false
               this.issuedDialogVisible = false
               this.refreshTable()
               this.dialogVisible = false
            }).catch(e => {
               this.$message.error('修改失败')
               this.dialogVisible = false
               this.upLoad = false
            })
         },
@@ -454,24 +477,6 @@
            delete this.formData.createUser
            delete this.formData.updateUser
            this.formData.authorizedPerson = authorizedPerson
            this.$axios.post(this.$api.insOrder.getDeviceManager, this.formData, {
               headers: {
                  'Content-Type': 'application/json'
               }
            }).then(res => {
               if (res.code === 201) {
                  this.upLoad = false
                  return
               }
               this.$message.success('修改成功')
               this.upLoad = false
               this.refreshTable()
               this.dialogVisible = false
            }).catch(e => {
               this.$message.error('修改失败')
               this.dialogVisible = false
               this.upLoad = false
            })
         },
         // 下单
         playOrder(num) {
@@ -481,7 +486,19 @@
            this.tabIndex = i;
            this.componentData.entity.state = m.value
            this.refreshTable()
         },
         getUserMenu() {
            this.$axios.get(this.$api.user.getUserMenu).then(res => {
               let data = []
               res.data.forEach(a => {
                  data.push({
                     label: a.name,
                     value: a.id
                  })
               })
               this.componentData.tagField.createUser.select = data
            })
         }
      }
   }
</script>
</script>