licp
2024-09-13 a5433bd3d438817794f6506fe4954ee223b0edcf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<template>
  <div style="height: calc(100vh - 280px);">
    <div class="search">
      <div class="search_thing">
        <div class="search_label">委托编号:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable
            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.sampleName" @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.sampleModel" @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.sampleCode" @keyup.enter.native="refreshTable()"></el-input></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>
      </div>
    </div>
    <div class="table">
      <ValueTable ref="ValueTable"
        :url="$api.insOrder.selectInsOrderParameter" :componentData="componentData"
        :upIndex="upIndex"  />
    </div>
    <el-dialog
      title="生成报告"
      :visible.sync="dialogVisible"
      width="30%"
      :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 slot="footer" class="dialog-footer">
        <el-button :loading="loading0" @click="handleNoCreate">不生成</el-button>
        <el-button type="primary" @click="handleCreate" :loading="loading1">生 成</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="检验详情"
      :visible.sync="dialogVisible0"
      width="100%" :fullscreen="true" :modal="false" :append-to-body="true">
      <Inspection v-if="dialogVisible0"
      :orderId="currentInfo.id"
      :inspectorList="currentItem.inspectorList"
      :sonLaboratory="currentItem.laboratory"
      :state="2"
      :orderStateId="currentItem.orderStateId"
      :version="currentItem.version"
      :isLook="true"
      :num1="currentItem.num1"
      :noBack="true"/>
    </el-dialog>
  </div>
</template>
 
<script>
import ValueTable from '../../tool/value-table.vue'
import Inspection from '../b1-inspect-order-plan/Inspection.vue'
export default {
  components: {
            ValueTable,
      Inspection,
        },
  data() {
    return {
      componentData: {
        entity: {
          entrustCode: null,
          sample: null,
          sampleName: null,
          sampleModel: null,
          sampleCode: null,
          outEntrustCode: null,
          state: 1,
          name:null,
          engineering:null,
          production:null,
        },
        isIndex: true,
        showSelect: false,
        select: false,
        // selectMethod:'selectMethod',
        do: [{
          id: 'handleCreateReport',
          font: '生成报告',
          type: 'text',
          method: 'handleCreateReport',
          disabFun: (row, index) => {
            return row.insState == 5
          }
        }],
        tagField: {
          type: {
            select: [{
              value: 0,
              type: 'success',
              label: '普通'
            }, {
              value: 1,
              type: 'warning',
              label: '优先'
            }, {
              value: 2,
              type: 'danger',
              label: '紧急'
            }]
          },
          createUser: {
            select: []
          },
          orderType: {
            select: []
          },
          processing: {
            select: [{
              value: 1,
              label: '实验室处理'
            },{
              value: 0,
              label: '委托单位取回'
            }]
          },
          isLeave: {
            select: [{
              value: 1,
              label: '留样'
            },{
              value: 0,
              label: '不留样'
            }]
          },
          send: {
            select: [{
              value: 1,
              label: '自取'
            },{
              value: 0,
              label: '其他'
            }]
          }
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: [],
        needSort: ['createTime', 'sendTime', 'type', 'appointed']
      },
      upIndex: 0,
      entityCopy: {},
      dialogVisible:false,
      historyList:[],
      currentInfo:{},
      currentItem:{},
      loading0:false,
      loading1:false,
      dialogVisible0:false
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity)
    this.getPower()
  },
  methods:{
    // 权限分配
    getPower(radio) {
      let power = JSON.parse(sessionStorage.getItem('power'))
      let isReport = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'isReport') {
          isReport = true
        }
      }
      if (!isReport) {
        this.componentData.do.splice(0, 1)
      }
    },
    refreshTable(e) {
      this.$refs['ValueTable'].selectList(e)
    },
    refresh() {
      this.componentData.entity = this.HaveJson(this.entityCopy)
      this.upIndex++
      this.refreshTable()
    },
    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.dialogVisible = true
      })
    },
    // 生成报告
    handleCreate(){
      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
          }
        })
      },{
        headers: {
          'Content-Type': 'application/json'
        }}).then(res => {
        this.loading1 = false
        if (res.code === 201) {
          return
        }
        this.$message.success("已生成")
        this.refreshTable()
        this.dialogVisible = false
      }).catch(err => {
        console.log(err)
      })
    },
    // 不生成
    handleNoCreate(){
      this.loading0 = true
      this.$axios.post(this.$api.insReport.isReport, {
            id:this.currentInfo.id,
            state:0
      },{
        headers: {
          'Content-Type': 'application/json'
        }}).then(res => {
          this.loading0 = false;
        if (res.code === 201) {
          return
        }
        this.refreshTable()
        this.$message.success("已取消生成")
        this.dialogVisible = false
      }).catch(err => {
        console.log(err)
      })
    },
    // 查看检验详情
    lookDetail(row,value){
      this.dialogVisible0 = true
      let inspectorList = []
      if(row.userName){
        inspectorList = row.userName.split(',')
      }
      this.currentItem = {
        num1:value,
        inspectorList:inspectorList,
        ...row
      }
    }
  }
}
</script>
 
<style scoped>
.search {
        background-color: #fff;
        height: 80px;
        display: flex;
        align-items: center;
    overflow: hidden;
    }
 
    .search_thing {
        display: flex;
        align-items: center;
        height: 50px;
    width: 230px;
    }
 
    .search_label {
        width: 90px;
        font-size: 14px;
        text-align: right;
    }
 
    .search_input {
        width: calc(100% - 90px);
    }
 
    .table {
        margin-top: 10px;
        background-color: #fff;
        height: 100%;
        padding: 20px;
    }
  >>>.el-card__header,>>>.el-card__body{
    padding-top: 10px;
    padding-bottom: 10px;
  }
</style>