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
341
342
343
344
345
346
347
348
349
350
351
352
353
| <template>
| <div class="capacity-scope">
| <div class="search">
| <div>
| <el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
| <el-form-item label="标准物质名称" prop="name">
| <el-input size="small" placeholder="请输入" clearable v-model="searchForm.name"
| @keyup.enter.native="searchList"></el-input>
| </el-form-item>
| <el-form-item label="生产厂家" prop="factoryManufacturer">
| <el-input size="small" placeholder="请输入" clearable v-model="searchForm.factoryManufacturer"
| @keyup.enter.native="searchList"></el-input>
| </el-form-item>
| <el-form-item>
| <el-button type="primary" size="mini" @click="searchList">查询</el-button>
| <el-button size="mini" @click="resetSearchForm">重置</el-button>
| </el-form-item>
| </el-form>
| </div>
| <div>
| <el-button size="small" @click="exportFun">导 出</el-button>
| <el-button size="small" type="primary" @click="importVisible = true">导 入</el-button>
| <el-button size="small" type="primary" @click="openFormDia('add')">新 增</el-button>
| </div>
| </div>
| <div class="table">
| <lims-table :tableData="tableData" :column="tableColumn" :height="'calc(100vh - 250px)'" @pagination="pagination"
| :page="page" :tableLoading="tableLoading"></lims-table>
| </div>
| <form-dia v-if="formDia" ref="formDia" @closeYearDia="closeYearDia"></form-dia>
| <borrow-dia v-if="borrowDia" ref="borrowDia" @closeYearDia="closeBorrowDia"></borrow-dia>
| <return-dia v-if="returnDia" ref="returnDia" @closeYearDia="closeReturnDia"></return-dia>
| <el-dialog title="标准物质导入" :visible.sync="importVisible" width="500px" @closed="resetImport">
| <div style="margin-bottom: 12px;">
| 请使用标准物质导入模板填写数据,单个文件不超过10MB。
| <el-button type="text" @click="downloadTemplate">下载导入模板</el-button>
| </div>
| <el-upload ref="standardSubstanceUpload" drag name="file" accept=".xlsx" :action="importAction"
| :headers="uploadHeader" :auto-upload="false" :limit="1" :file-list="importFiles"
| :before-upload="beforeImport" :on-success="importSuccess" :on-error="importError">
| <i class="el-icon-upload"></i>
| <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
| </el-upload>
| <span slot="footer" class="dialog-footer">
| <el-button @click="importVisible = false">取消</el-button>
| <el-button type="primary" :loading="importing" @click="submitImport">导入</el-button>
| </span>
| </el-dialog>
| </div>
|
| </template>
|
| <script>
|
| import limsTable from '@/components/Table/lims-table.vue'
| import {
| getPageStandardSubstance,
| removeStandardSubstance,
| exportOfStandardSubstanceList,
| downloadStandardSubstanceImportTemplate
| } from '@/api/cnas/resourceDemand/standardMaterial/standardMaterial'
| import FormDia from '../standardMaterial/component/formDia.vue';
| import BorrowDia from '../standardMaterial/component/borrowDia.vue';
| import ReturnDia from '../standardMaterial/component/returnDia.vue';
| export default {
| name: 'StandardMaterial',
| components: {
| limsTable,
| FormDia,
| BorrowDia,
| ReturnDia
| },
| data() {
| return {
| searchForm: {
| name: '',
| factoryManufacturer: '',
| },
| tableColumn: [
| {
| label: '标准物质名称',
| prop: 'name',
| minWidth: '120'
| },
| {
| label: '规格型号',
| prop: 'model',
| minWidth: '100'
| },
| {
| label: '生产厂家',
| prop: 'factoryManufacturer',
| minWidth: '100'
| },
| {
| label: '出厂编号',
| prop: 'factoryNum',
| minWidth: '100'
| },
| {
| label: '管理编号',
| prop: 'manageNum',
| minWidth: '100'
| },
| {
| label: '不确定度',
| prop: 'uncertainty',
| minWidth: '100'
| },
| {
| label: '数量',
| prop: 'quantity',
| minWidth: '100'
| },
| {
| label: '购置日期',
| prop: 'acquisitionDate',
| minWidth: '150'
| },
| {
| label: '有效期',
| prop: 'effectiveDate',
| minWidth: '150'
| },
| {
| label: '档案编号',
| prop: 'fileNum',
| minWidth: '100'
| },
| {
| label: '存放位置',
| prop: 'position',
| minWidth: '100'
| },
| {
| label: '备注',
| prop: 'remark',
| minWidth: '100'
| },
| {
| label: '创建时间',
| prop: 'createTime',
| minWidth: '150'
| },
| {
| dataType: 'action',
| fixed: 'right',
| minWidth: '180',
| label: '操作',
| operation: [
| {
| name: '编辑',
| type: 'text',
| clickFun: (row) => {
| this.openFormDia('edit', row);
| },
| },
| {
| name: '借用',
| type: 'text',
| clickFun: (row) => {
| this.borrow(row);
| },
| },
| {
| name: '归还',
| type: 'text',
| clickFun: (row) => {
| this.return(row);
| }
| },
| {
| name: '删除',
| type: 'text',
| color: '#f56c6c',
| clickFun: (row) => {
| this.delPlan(row)
| },
| }
| ]
| }
| ],
| tableData: [],
| tableLoading: false,
| page: {
| total: 0,
| size: 10,
| current: 1
| },
| total: 0,
| formDia: false,
| borrowDia: false,
| returnDia: false,
| importVisible: false,
| importing: false,
| importFiles: [],
| }
| },
| computed: {
| importAction() {
| return this.javaApi + '/feStandardSubstance/importStandardSubstance'
| }
| },
| mounted() {
| this.searchList()
| },
| methods: {
| downloadTemplate() {
| downloadStandardSubstanceImportTemplate().then(res => {
| this.$download.saveAs(new Blob([res]), '标准物质导入模板.xlsx')
| })
| },
| submitImport() {
| if (!this.$refs.standardSubstanceUpload.uploadFiles.length) {
| this.$message.warning('请选择需要导入的Excel文件')
| return
| }
| this.$refs.standardSubstanceUpload.submit()
| },
| beforeImport(file) {
| if (!file.name.toLowerCase().endsWith('.xlsx')) {
| this.$message.error('仅支持.xlsx格式文件')
| return false
| }
| if (file.size > 10 * 1024 * 1024) {
| this.$message.error('导入文件不能超过10MB')
| return false
| }
| this.importing = true
| return true
| },
| importSuccess(response) {
| this.importing = false
| if (response.code !== 200) {
| this.$message.error(response.message || response.msg || '导入失败')
| return
| }
| this.$message.success(`成功导入${response.data}条标准物质`)
| this.importVisible = false
| this.searchList()
| },
| importError() {
| this.importing = false
| this.$message.error('导入失败')
| },
| resetImport() {
| this.importing = false
| this.importFiles = []
| if (this.$refs.standardSubstanceUpload) {
| this.$refs.standardSubstanceUpload.clearFiles()
| }
| },
| exportFun() {
| this.outLoading = true
| exportOfStandardSubstanceList(this.searchForm).then(res => {
| this.outLoading = false
| const blob = new Blob([res], { type: 'application/octet-stream' }, false);
| this.$download.saveAs(blob, '标准物质清单.xlsx')
| })
| },
| // 查询列表
| searchList() {
| this.tableLoading = true
| getPageStandardSubstance({
| ...this.page,
| ...this.searchForm
| }).then(res => {
| this.tableLoading = false
| if (res.code === 200) {
| this.tableData = res.data.records
| this.page.total = res.data.total
| }
| })
| },
| // 删除
| delPlan(row) {
| this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
| confirmButtonText: '确定',
| cancelButtonText: '取消',
| type: 'warning'
| }).then(() => {
| this.tableLoading = true
| removeStandardSubstance({ id: row.id }).then(res => {
| this.tableLoading = false
| if (res.code === 200) {
| this.$message.success('删除成功')
| this.searchList()
| }
| }).catch(err => {
| this.tableLoading = false
| })
| }).catch(() => {
| this.$message({
| type: 'info',
| message: '已取消删除'
| });
| });
| },
| // 新增,编辑,批准弹框
| openFormDia(type, row) {
| this.formDia = true
| this.$nextTick(() => {
| this.$refs.formDia.openDia(type, row)
| })
| },
| closeYearDia() {
| this.formDia = false
| this.searchList()
| },
| // 借用
| borrow(row) {
| this.borrowDia = true
| this.$nextTick(() => {
| this.$refs.borrowDia.openDia(row)
| })
| },
| closeBorrowDia() {
| this.borrowDia = false
| this.searchList()
| },
| // 归还
| return(row) {
| this.returnDia = true
| this.$nextTick(() => {
| this.$refs.returnDia.openDia(row)
| })
| },
| closeReturnDia() {
| this.returnDia = false
| this.searchList()
| },
| // 重置查询条件
| resetSearchForm() {
| this.searchForm.name = '';
| this.searchForm.factoryManufacturer = '';
| this.searchList()
| },
| // 分页切换
| pagination(page) {
| this.page.size = page.limit
| this.searchList();
| },
| // 分页
| }
| }
| </script>
| <style scoped>
| .search {
| height: 46px;
| display: flex;
| justify-content: space-between;
| }
| </style>
|
|