zhuo
2025-04-22 00d9d8d47463c1ecc7d2218593a6efb313d084a2
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<template>
  <div class="capacity-scope">
    <div style="display: flex;justify-content: space-between;align-items: flex-start">
      <el-form :model="queryParams0" ref="queryParams0" size="small" :inline="true">
        <el-form-item label="收样日期" prop="receiveDate">
          <el-date-picker v-model="queryParams0.receiveDate" type="date" placeholder="选择日期" format="yyyy-MM-dd"
                          value-format="yyyy-MM-dd" size="small" @change="refreshTable()">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="mini" @click="refreshTable">查询</el-button>
          <el-button size="mini" @click="refresh">重置</el-button>
        </el-form-item>
      </el-form>
      <el-button size="small" @click="handleDown0">导出</el-button>
    </div>
 
    <div class="table">
      <lims-table :tableData="tableData0" :column="column0" :tableLoading="tableLoading0"
                  key="tableData0"
                  :height="'calc(100vh - 240px)'" :page="page0" @pagination="pagination0">
        <div slot="action" slot-scope="scope">
          <el-button type="text" @click="handleAdd(scope.row)">编辑</el-button>
          <el-button type="text" @click="delRow(scope.row)">
            <span style="color: #F56C6C">删除</span>
          </el-button>
        </div>
      </lims-table>
    </div>
    <!-- 新增样品 -->
    <el-dialog :title="title" :visible.sync="addDialogVisible" width="400px">
      <el-row>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">收样日期:</div>
            <div class="search_input">
              <el-date-picker v-model="addInfo.receiveDate" type="date" size="small" placeholder="选择日期" format="yyyy-MM-dd"
                              value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">样品名称:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                                                v-model="addInfo.sampleName"></el-input></div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">样品编号:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                                                v-model="addInfo.sampleCode"></el-input></div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">数量:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                                                v-model="addInfo.num"></el-input>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">来样单位:</div>
            <div class="search_input">
              <el-select v-model="addInfo.sampleSupplier" size="small">
                <el-option :label="item.company" :value="item.company" v-for="(item, index) in customPageList"
                           :key="item.id"></el-option>
              </el-select>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">留样日期:</div>
            <div class="search_input">
              <el-date-picker v-model="addInfo.leaveDate" type="date" size="small" placeholder="选择日期" format="yyyy-MM-dd"
                              value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">样品状态:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                                                v-model="addInfo.sampleState"></el-input></div>
          </div>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
        <div class="search_thing">
          <div class="search_label">处理日期:</div>
          <div class="search_input">
            <el-date-picker v-model="addInfo.dealTime" type="date" size="small" placeholder="选择日期" format="yyyy-MM-dd"
                            value-format="yyyy-MM-dd" style="width: 100%;">
            </el-date-picker>
          </div>
        </div>
      </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitAdd" :loading="addLoading">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 详情/下载/审核/批准 -->
    <el-dialog :title="title0" :visible.sync="lookDialogVisible" width="800px" :class="{ downPdf: title0 == '下载' }"
               :modal="title0 != '下载'" top="5vh">
      <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}"
                   style="max-height: 70vh;overflow-y: auto;" />
      <span slot="footer" class="dialog-footer" v-if="title0 == '审核' || title0 == '批准'">
        <el-button @click="submitCheck('不通过')" :loading="noCheckLoading">不通过</el-button>
        <el-button type="primary" @click="submitCheck('通过')" :loading="checkLoading">通 过</el-button>
      </span>
    </el-dialog>
  </div>
</template>
 
<script>
import limsTable from "@/components/Table/lims-table.vue";
import filePreview from "@/components/Preview/filePreview.vue";
import { selectCustomPageList } from "@/api/system/customer";
import {
  pageProcessSample,
  delProcessSample,
  addProcessSample,
  exportProcessSample
} from "@/api/cnas/process/sampleDisposal";
export default {
  name: 'SampleReceipt',
  components: {
    limsTable,
    filePreview,
  },
  data() {
    return {
      activeName: '填写',
      title: '新增',
      addDialogVisible: false,
      addLoading: false,
      outLoading: false,
      editDialogVisible: false,
      lookDialogVisible: false,
      title0: '查看',
      noCheckLoading: false,
      checkLoading: false,
      // 历史列表
      addInfo: {},//新增样品
      customPageList: [],
      currentInfo: {
        arr: []
      },//查看的详情
      queryParams0: {
        receiveDate: ''
      },
      tableLoading0: false,
      tableData0: [],
      column0: [
        {
          label: "收样日期",
          prop: "receiveDate",
        },
        {
          label: "样品编号",
          prop: "sampleCode",
        },
        {
          label: "样品名称",
          prop: "sampleName",
        },
        {
          label: "样品数量",
          prop: "num",
        },
        {
          label: "来样单位",
          prop: "sampleSupplier",
        },
        {
          label: "留样日期",
          prop: "leaveDate",
        },
        {
          label: "样品状态",
          prop: "sampleState",
        },
        {
          label: "退样签收/处理日期",
          prop: "dealTime",
        },
        {
          dataType: "slot",
          slot: "action",
          label: "操作",
        }
      ],
      page0: {
        total: 0,
        size: 10,
        current: 0,
      },
    };
  },
  mounted() {
    this.getList0()
  },
  methods: {
    // 获取送样单位列表
    getCustomPageList() {
      selectCustomPageList({
        current: -1,
        size: -1
      }).then(res => {
        this.customPageList = res.data.records
      }).catch(err => { });
    },
    refresh() {
      this.queryParams0 = {};
      this.page0.current = 1;
      this.getList0();
    },
    refreshTable() {
      this.page0.current = 1;
      this.getList0();
    },
    // 查询表格数据
    getList0() {
      this.tableLoading0 = true;
      let param = { ...this.queryParams0, ...this.page0 };
      delete param.total;
      pageProcessSample({ ...param })
        .then((res) => {
          this.tableLoading0 = false;
          if (res.code === 200) {
            this.tableData0 = res.data.records;
            this.page0.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading0 = false;
        });
    },
    pagination0({ page, limit }) {
      this.page0.current = page;
      this.page0.size = limit;
      this.getList0();
    },
    // 打开编辑弹框
    handleAdd(row) {
      this.addInfo = this.HaveJson(row)
      this.title = '编辑'
      this.addDialogVisible = true
      this.getCustomPageList()
    },
    delRow(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          delProcessSample({ id: row.id }).then(res => {
            if (res.code == 200) {
              this.$message.success("删除成功");
              this.refreshTable();
            }
          }).catch(err => { });
        })
        .catch(() => { });
    },
    // 提交新增
    submitAdd() {
      // 编辑
      this.addLoading = true
      addProcessSample({
        ...this.addInfo
      }).then(res => {
        this.addLoading = false
        this.addDialogVisible = false
        this.$message({
          type: 'success',
          message: '编辑成功!'
        });
        this.page0.current = 1;
        this.refreshTable();
      }).catch(err => { });
    },
    // 导出详情
    handleDown0() {
      exportProcessSample({ receiveDate: this.queryParams0.receiveDate }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, '样品接收' + '.docx');
      })
    },
  },
}
</script>
 
<style scoped>
.search_thing {
  width: 350px;
  display: flex;
  align-items: center;
}
 
.search_label {
  width: 110px;
  font-size: 14px;
  text-align: right;
}
 
.search_input {
  width: calc(100% - 110px);
}
 
.downPdf {
  opacity: 0 !important;
}
 
.tables td {
  height: 40px;
  width: 100px;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
}
 
.user-info .el-button {
  margin: 0;
}
 
>>>.el-tabs__content {
  height: 100%;
}
</style>