licp
2024-12-19 36a30a262c16b6c37be7d1817c46d6693a324cc4
src/components/do/b1-report-preparation/order.vue
@@ -21,6 +21,14 @@
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable
            v-model="componentData.entity.sampleCode" @keyup.enter.native="refreshTable()"></el-input></div>
      </div>
      <div class="search_thing">
        <div class="search_label">订单类型:</div>
        <div class="search_input">
          <el-select v-model="componentData.entity.formType" size="small"style="width: 100%;" @change="refreshTable()">
            <el-option v-for="(a,ai) in formType" :key="ai" :label="a.label" :value="a.value"></el-option>
          </el-select>
        </div>
      </div>
      <div class="search_thing" style="margin-left: 20px;">
        <el-button size="small" @click="refresh()">重 置</el-button>
        <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
@@ -34,20 +42,65 @@
    <el-dialog
      title="生成报告"
      :visible.sync="dialogVisible"
      width="30%"
      width="60%"
      :append-to-body="true"
      :modal="!dialogVisible0"
      >
      <span>请选择委托编号为 {{currentInfo.entrustCode}} 要生成的数据</span>
      <el-card class="box-card" style="margin-top: 16px;" v-for="(item,index) in historyList" :key="index">
        <div slot="header" style="display: flex;justify-content: space-between;">
          <span>{{ item.laboratory }}</span>
          <!-- <el-checkbox v-model="item.checked"></el-checkbox> -->
        </div>
        <el-radio-group v-model="item.numValue" ref="radio">
          <el-radio :label="m.value" v-for="(m,i) in item.arr" :key="i"><el-link type="primary" @click="lookDetail(item,m.value)">{{ m.label }}</el-link></el-radio>
        </el-radio-group>
      </el-card>
      <span style="font-size: 16px;">请选择委托编号为 <span style="color: #3A7BFA">{{currentInfo.entrustCode}}</span> 要生成的数据</span>
      <div style="max-height: 75vh;overflow-y: auto;">
        <template v-for="(a,b) in sampleList">
          <el-divider></el-divider>
          <p style="margin: 10px 0;font-weight: 700;">样品:<el-tag size="small">{{a.insSample.sample}}</el-tag> &nbsp;&nbsp;&nbsp;&nbsp;样品编号:{{a.insSample.sampleCode}}</p>
          <el-card class="box-card" style="margin-top: 16px;" v-for="(item,index) in a.historyList" :key="index">
            <div slot="header" style="display: flex;justify-content: space-between;">
              <span>{{ item.laboratory }}</span>
            </div>
            <el-table
              :data="item.insOrderUserList"
              border
              style="width: 100%" @selection-change="list=>handleSelectionChange(list,item.insOrderUserList)">
              <el-table-column
                type="selection"
                width="55">
              </el-table-column>
              <el-table-column
                prop="submitTime"
                label="提交日期"
                min-width="150">
              </el-table-column>
              <el-table-column
                prop="submitUserName"
                label="提交人"
                min-width="90">
              </el-table-column>
              <el-table-column
                prop="term"
                label="实验阶段"
                min-width="120">
              </el-table-column>
              <el-table-column
                prop="note"
                label="实验操作"
                min-width="120">
              </el-table-column>
              <el-table-column
                prop="tell"
                label="再次检验原因"
                min-width="120">
              </el-table-column>
              <el-table-column
                fixed="right"
                label="操作"
                min-width="100">
                <template slot-scope="scope">
                  <el-button @click="lookDetail(item,scope.row.num,a.insSample)" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-card>
          <p v-if="a.historyList.length==0" style="text-align: center;">暂无可生成的数据</p>
        </template>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button :loading="loading0" @click="handleNoCreate">不生成</el-button>
        <el-button type="primary" @click="handleCreate" :loading="loading1">生 成</el-button>
@@ -58,7 +111,9 @@
      :visible.sync="dialogVisible0"
      width="100%" :fullscreen="true" :modal="false" :append-to-body="true">
      <Inspection v-if="dialogVisible0"
      :orderId="currentInfo.id"
      :orderId="sampleId"
      :orderId0="orderId0"
      :userInfo="{}"
      :inspectorList="currentItem.inspectorList"
      :sonLaboratory="currentItem.laboratory"
      :state="2"
@@ -89,10 +144,11 @@
          sampleModel: null,
          sampleCode: null,
          outEntrustCode: null,
          state: 1,
          state: 4,
          name:null,
          engineering:null,
          production:null,
          formType:null,
        },
        isIndex: true,
        showSelect: false,
@@ -170,12 +226,17 @@
      currentItem:{},
      loading0:false,
      loading1:false,
      dialogVisible0:false
      dialogVisible0:false,
      sampleList:[],
      sampleId:null,
      orderId0:null,
      formType:[]
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity)
    this.getPower()
    this.selectEnumByCategoryForSampleForm()
  },
  methods:{
    // 权限分配
@@ -202,35 +263,80 @@
    handleCreateReport(row){
      this.currentInfo = row
      this.$axios.get(this.$api.insReport.getInsOrderStateCount+'?id='+row.id).then(res => {
        this.historyList = res.data
        this.historyList.forEach(item => {
          item.arr = []
          this.$set(item,'numValue',1)
          // item.checked = false;
          if(item.num>0){
            for(var i=0;i<item.num;i++){
              item.arr.push({
                label:'记录'+(i+1),
                value:i+1
              })
        this.sampleList = res.data
        this.sampleList.forEach(a=>{
          a.historyList = a.insOrderStates
          a.historyList.forEach(item => {
            item.arr = []
            this.$set(item,'numValue',1)
            if(item.num>0){
              for(var i=0;i<item.num;i++){
                item.arr.push({
                  label:'记录'+(i+1),
                  value:i+1
                })
              }
            }
          }
          })
        })
        // this.historyList = res.data
        // this.historyList.forEach(item => {
        //   item.arr = []
        //   this.$set(item,'numValue',1)
        //   // item.checked = false;
        //   if(item.num>0){
        //     for(var i=0;i<item.num;i++){
        //       item.arr.push({
        //         label:'记录'+(i+1),
        //         value:i+1
        //       })
        //     }
        //   }
        // })
        this.dialogVisible = true
      })
    },
    selectEnumByCategoryForSampleForm() {
        this.$axios.post(this.$api.enums.selectEnumByCategory, {
          category: "订单类型"
        }).then(res => {
          this.formType = res.data
        })
      },
    // 生成报告
    handleCreate(){
      let insReportDto1s = []
      let num = 0;
      this.sampleList.forEach(a => {
        let insReportDto2s = []
        a.historyList.forEach(item => {
          item.insOrderUserList.forEach(item1 => {
            if(item1.state==1){
              let obj0 = {
                laboratory:item.laboratory,
                num:item1.num,
                insOrderUsersId:item1.id
              }
              insReportDto2s.push(obj0)
              num++
            }
          })
        })
        let obj0 = {
          sampleId:a.insSample.id,
          insReportDto2s:insReportDto2s
        }
        insReportDto1s.push(obj0)
      })
      if(num==0){
        this.$message.error("请先选择需要生成的记录!")
        return
      }
      this.loading1 = true
      this.$axios.post(this.$api.insReport.isReport, {
        id:this.currentInfo.id,
        state:1,
        insReportDto1s:this.historyList.map(item => {
          return{
            laboratory:item.laboratory,
            num:item.numValue
          }
        })
        insReportDto1s:insReportDto1s
      },{
        headers: {
          'Content-Type': 'application/json'
@@ -268,17 +374,29 @@
      })
    },
    // 查看检验详情
    lookDetail(row,value){
    lookDetail(row,value,insSample){
      this.dialogVisible0 = true
      let inspectorList = []
      if(row.userName){
        inspectorList = row.userName.split(',')
      }
      this.sampleId = insSample.id
      this.orderId0 = insSample.insOrderId
      this.currentItem = {
        num1:value,
        inspectorList:inspectorList,
        ...row
      }
    },
    handleSelectionChange(list,list0){
      list0.forEach(item => {
        let obj = list.find(item0 => item0.id == item.id)
        if(obj){
          item.state = 1
        }else{
          item.state = 0
        }
      })
    }
  }
}