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
| <template>
| <div>
| <div class="view-title">
| <span>标准物质验收</span>
| </div>
| <div class="search">
| <el-form :inline="true" :model="form" size="small">
| <el-form-item label="物质名称">
| <el-input v-model="form.search"></el-input>
| </el-form-item>
| <el-form-item>
| <el-button @click="reset">重 置</el-button>
| <el-button type="primary" @click="getTableData">查 询</el-button>
| </el-form-item>
| </el-form>
| <div>
| <el-button type="primary" icon="el-icon-plus" size="small" @click="openDialog">
| 添加验收
| </el-button>
| <el-button type="primary" size="small" @click="exportExcel">导出</el-button>
| </div>
| </div>
| <div class="tables">
| <ZTTable
| :column="columns"
| :table-data="tableData"
| >
| <template slot="action" slot-scope="{ row }">
| <el-button type="text" @click="edit(row)">编辑</el-button>
| </template>
| </ZTTable>
| <div class="pagination">
| <div></div>
| <el-pagination
| :page-sizes="[10, 20, 30, 40]"
| :page-size="pagination.pageSize"
| layout="total, sizes, prev, pager, next, jumper"
| :total="pagination.total"
| @current-change="handleCurrent"
| @size-change="handleSize"
| >
| </el-pagination>
| </div>
| </div>
| <AddRecord ref="addRecordRef" @submit="submit"></AddRecord>
| </div>
| </template>
|
| <script>
| import axios from "axios";
| import { getPageAcceptance, addAcceptance, updateAcceptance, getAcceptanceDetails, exportAcceptance } from "@/assets/api/api";
| import ZTTable from '@/components/caorui/ZTTable/index.vue';
| import AddRecord from './components/AddRecord.vue';
|
| export default {
| components: {
| ZTTable, AddRecord
| },
| data() {
| return {
| form: {
| search: undefined
| },
| columns: [
| {
| label: "出场编号",
| prop: "factoryNum"
| },
| {
| label: "有效期",
| prop: "effectiveDate"
| },
| {
| label: "生产厂家",
| prop: "factoryManufacturer"
| },
| {
| label: "文档编号",
| prop: "fileNum"
| },
| {
| label: "标准物质名称",
| prop: "name"
| },
| {
| label: "规格型号",
| prop: "model"
| },
| {
| label: "管理编号",
| prop: "manageNum"
| },
| {
| label: "存放位置",
| prop: "position"
| },
| // {
| // label: "序列号",
| // prop: "manageNum"
| // },
| {
| label: "提交日期",
| prop: "acquisitionDate"
| },
| {
| label: "数量",
| prop: "quantity"
| },
| {
| fixed: "right",
| label: "操作",
| align: "center",
| dataType: "slot",
| slot: "action",
| },
| ],
| tableData: [],
| pagination: {
| current: 1,
| pageSize: 20,
| total: 0
| },
| }
| },
| mounted() {
| this.getTableData()
| },
| methods: {
| async getTableData() {
| const { code, data } = await axios({
| method: 'get',
| url: getPageAcceptance,
| params: {
| name: this.form.search
| }
| })
| if(code == 200) {
| this.tableData = data.records;
| }
| },
| handleCurrent(val) {
| this.pagination.current = val;
| this.getTableData()
| },
| handleSize(size) {
| this.pagination.pageSize = size;
| this.getTableData()
| },
| openDialog() {
| this.$refs.addRecordRef.openDialog()
| },
| async submit(form) {
| const {code} = await axios({
| method: 'post',
| url: form.acceptance.id ? updateAcceptance:addAcceptance,
| data: form,
| noQs: true
| })
| if(code == 200) {
| this.$message.success(`${form.acceptance.id ? '编辑':'添加'}成功`)
| this.getTableData()
| }
| },
| async edit(row) {
| const res = await this.getDetail(row.id)
| this.$refs.addRecordRef.openDialog({
| acceptance: res.acceptance,
| list: res.list
| })
| },
| async getDetail(id) {
| const { code, data } = await axios({
| method: 'get',
| url: getAcceptanceDetails,
| params: { id }
| })
| if(code == 200) {
| return data;
| }
| },
| reset() {
| this.form.search = undefined
| this.getTableData()
| },
| async exportExcel() {
| const res = await axios({
| method: "get",
| url: `${exportAcceptance}`,
| responseType: "blob"
| })
| this.$message.success('导出成功')
| const blob = new Blob([res], {type: 'application/octet-stream'});
| const url = URL.createObjectURL(blob);
| const link = document.createElement('a');
| link.href = url;
| link.download = '标准物质验收.xlsx';
| link.click();
| }
| }
| }
| </script>
|
| <style scoped>
| .view-title {
| display: flex;
| justify-content: space-between;
| align-items: center;
| height: 60px;
| padding-left: 20px;
| }
| .search {
| display: flex;
| justify-content: space-between;
| padding: 20px 20px 0 20px;
| background: #fff;
| border-radius: 5px;
| }
| .tables {
| margin-top: 20px;
| padding: 18px;
| background: #fff;
| border-radius: 5px;
| }
| .pagination {
| padding-top: 15px;
| padding-right: 10px;
| display: flex;
| justify-content: space-between
| }
| </style>
|
|