|
@@ -0,0 +1,345 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="main-contain">
|
|
3
|
+ <div class=" sign-and-weigh-box" style="background: white">
|
|
4
|
+ <!--<manufacturer-or-dealer-dialog-->
|
|
5
|
+ <!--ref="dialog"-->
|
|
6
|
+ <!--:titles="manufacturerDialog.titles"-->
|
|
7
|
+ <!--:formValue="manufacturerDialog.formValue"-->
|
|
8
|
+ <!--:visibility="manufacturerDialog.isVisibility"-->
|
|
9
|
+ <!--:type="manufacturerDialog.type"-->
|
|
10
|
+ <!--:isCreated="manufacturerDialog.isCreated"-->
|
|
11
|
+ <!--v-on:dialog-comfirm="manufacturerDialogComfirm"-->
|
|
12
|
+ <!--v-on:dialog-cancle="manufacturerDialogCancle"-->
|
|
13
|
+ <!--></manufacturer-or-dealer-dialog>-->
|
|
14
|
+ <addition-dialog
|
|
15
|
+ ref="dialog"
|
|
16
|
+ :titles="Dialog.titles"
|
|
17
|
+ :formValue="Dialog.formValue"
|
|
18
|
+ :visibility="Dialog.isVisibility"
|
|
19
|
+ :type="Dialog.type"
|
|
20
|
+ :isCreated="Dialog.isCreated"
|
|
21
|
+ v-on:dialog-comfirm="dialogComfirm"
|
|
22
|
+ v-on:dialog-cancle="dialogCancle"
|
|
23
|
+
|
|
24
|
+ ></addition-dialog>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+ <el-row :gutter="15">
|
|
28
|
+ <el-col>
|
|
29
|
+ <div>
|
|
30
|
+ <el-button
|
|
31
|
+ size="small"
|
|
32
|
+ icon="el-icon-circle-plus-outline"
|
|
33
|
+ style="float: right;margin-bottom: 15px"
|
|
34
|
+ type="primary"
|
|
35
|
+ @click="showDialog"
|
|
36
|
+ >新增
|
|
37
|
+ </el-button>
|
|
38
|
+ </div>
|
|
39
|
+
|
|
40
|
+ <el-table
|
|
41
|
+ :row-style="{ color: '#303133' }"
|
|
42
|
+ :header-cell-style="{
|
|
43
|
+ backgroundColor: 'rgb(245, 247, 250)',
|
|
44
|
+ color: '#606266'
|
|
45
|
+ }"
|
|
46
|
+ :data="manufacturerData"
|
|
47
|
+ style="width: 100%"
|
|
48
|
+ border
|
|
49
|
+ v-loading="loading"
|
|
50
|
+ >
|
|
51
|
+ <el-table-column label="国家编码" align="center">
|
|
52
|
+ <template slot-scope="scope">
|
|
53
|
+ {{ scope.row.code }}
|
|
54
|
+ </template>
|
|
55
|
+ </el-table-column>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+ <el-table-column label="费用名称" align="center">
|
|
60
|
+ <template slot-scope="scope">
|
|
61
|
+ {{ scope.row.name }}
|
|
62
|
+ </template>
|
|
63
|
+ </el-table-column>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+ <el-table-column label="金额" align="center">
|
|
67
|
+ <template slot-scope="scope">
|
|
68
|
+ {{ scope.row.price }}元
|
|
69
|
+ </template>
|
|
70
|
+ </el-table-column>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+ <el-table-column label="操作" align="center">
|
|
75
|
+ <template slot-scope="scope">
|
|
76
|
+ <el-tooltip
|
|
77
|
+ class="item"
|
|
78
|
+ effect="dark"
|
|
79
|
+ content="编辑"
|
|
80
|
+ placement="top"
|
|
81
|
+ >
|
|
82
|
+ <el-button
|
|
83
|
+ size="small"
|
|
84
|
+ type="primary"
|
|
85
|
+ icon="el-icon-edit-outline"
|
|
86
|
+ @click="handleEdit(scope.$index, scope.row)"
|
|
87
|
+ >
|
|
88
|
+ </el-button>
|
|
89
|
+ </el-tooltip>
|
|
90
|
+ <el-tooltip
|
|
91
|
+ class="item"
|
|
92
|
+ effect="dark"
|
|
93
|
+ content="删除"
|
|
94
|
+ placement="top"
|
|
95
|
+ >
|
|
96
|
+ <el-button
|
|
97
|
+ size="small"
|
|
98
|
+ type="danger"
|
|
99
|
+ icon="el-icon-delete"
|
|
100
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
101
|
+ >
|
|
102
|
+ </el-button>
|
|
103
|
+ </el-tooltip>
|
|
104
|
+
|
|
105
|
+ </template>
|
|
106
|
+ </el-table-column>
|
|
107
|
+ </el-table>
|
|
108
|
+
|
|
109
|
+ <el-pagination
|
|
110
|
+ @size-change="handleSizeChange"
|
|
111
|
+ @current-change="handleCurrentChange"
|
|
112
|
+ :page-sizes="[10, 50, 100]"
|
|
113
|
+ :page-size="10"
|
|
114
|
+ background
|
|
115
|
+ align="right"
|
|
116
|
+ style="margin-top:20px;"
|
|
117
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
118
|
+ :total="total"
|
|
119
|
+ >
|
|
120
|
+ </el-pagination>
|
|
121
|
+ </el-col>
|
|
122
|
+ </el-row>
|
|
123
|
+ </div>
|
|
124
|
+ </div>
|
|
125
|
+</template>
|
|
126
|
+
|
|
127
|
+<script>
|
|
128
|
+ import {
|
|
129
|
+ createAddition,
|
|
130
|
+ modifyAddition,
|
|
131
|
+ getAdditionList,
|
|
132
|
+ deleteAddition,
|
|
133
|
+ GetAddition
|
|
134
|
+ } from '@/api/data'
|
|
135
|
+ import AdditionDialog from './additionDialog'
|
|
136
|
+
|
|
137
|
+ export default {
|
|
138
|
+ components: {
|
|
139
|
+ AdditionDialog,
|
|
140
|
+ },
|
|
141
|
+ name: 'addtion',
|
|
142
|
+ data() {
|
|
143
|
+ return {
|
|
144
|
+ signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
|
|
145
|
+ manufacturerData: [],
|
|
146
|
+ total: 0,
|
|
147
|
+ pageTotal: 0,
|
|
148
|
+ pageSelect: 0,
|
|
149
|
+
|
|
150
|
+ page: 1,
|
|
151
|
+ limit: 10,
|
|
152
|
+ loading: false,
|
|
153
|
+
|
|
154
|
+ manufacturer_code: '',
|
|
155
|
+ editId: '',
|
|
156
|
+ editIndex: '',
|
|
157
|
+ Dialog: {
|
|
158
|
+ titles: '新增',
|
|
159
|
+ isVisibility: false,
|
|
160
|
+ isCreated: 1, //1.创建 2.编辑 3.查看详情
|
|
161
|
+ formValue: {
|
|
162
|
+ name: '',
|
|
163
|
+ code: '',
|
|
164
|
+ price: '',
|
|
165
|
+
|
|
166
|
+ },
|
|
167
|
+ resetForm: {
|
|
168
|
+ name: '',
|
|
169
|
+ code: '',
|
|
170
|
+ price: '',
|
|
171
|
+ }
|
|
172
|
+ }
|
|
173
|
+ }
|
|
174
|
+ },
|
|
175
|
+ methods: {
|
|
176
|
+ handleEdit: function(index, row) {
|
|
177
|
+ this.editId = row.id
|
|
178
|
+ this.editIndex = index
|
|
179
|
+ let params = {
|
|
180
|
+ id: row.id
|
|
181
|
+ }
|
|
182
|
+ GetAddition(params).then(response => {
|
|
183
|
+ if (response.data.state == 0) {
|
|
184
|
+ this.$message.error(response.data.msg)
|
|
185
|
+ return false
|
|
186
|
+ } else {
|
|
187
|
+ this.Dialog.formValue.class_name =
|
|
188
|
+ response.data.data.addition.name
|
|
189
|
+ this.Dialog.formValue.content_code =
|
|
190
|
+ response.data.data.addition.code
|
|
191
|
+ this.Dialog.formValue.price =
|
|
192
|
+ response.data.data.addition.price
|
|
193
|
+
|
|
194
|
+ this.Dialog.isCreated = 2
|
|
195
|
+ this.$refs.dialog.show()
|
|
196
|
+
|
|
197
|
+ }
|
|
198
|
+ })
|
|
199
|
+ },
|
|
200
|
+ handleDelete: function(index, row) {
|
|
201
|
+ this.$confirm('确认删除这条记录?', '删除记录', {
|
|
202
|
+ confirmButtonText: '确定',
|
|
203
|
+ cancelButtonText: '取消',
|
|
204
|
+ type: 'warning'
|
|
205
|
+ })
|
|
206
|
+ .then(() => {
|
|
207
|
+ let params = {
|
|
208
|
+ id: row.id
|
|
209
|
+ }
|
|
210
|
+ deleteAddition(params).then(response => {
|
|
211
|
+ if (response.data.state == 0) {
|
|
212
|
+ this.$message.error(response.data.msg)
|
|
213
|
+ return false
|
|
214
|
+ } else {
|
|
215
|
+ this.manufacturerData.splice(index, 1)
|
|
216
|
+ this.$message.success('厂家已经删除')
|
|
217
|
+ }
|
|
218
|
+ })
|
|
219
|
+ })
|
|
220
|
+ .catch(() => {
|
|
221
|
+ })
|
|
222
|
+ },
|
|
223
|
+ showDetails: function(index, row) {
|
|
224
|
+ let params = {
|
|
225
|
+ id: row.id
|
|
226
|
+ }
|
|
227
|
+ GetAddition(params).then(response => {
|
|
228
|
+ if (response.data.state == 0) {
|
|
229
|
+ this.$message.error(response.data.msg)
|
|
230
|
+ return false
|
|
231
|
+ } else {
|
|
232
|
+ this.Dialog.formValue.name =
|
|
233
|
+ response.data.data.addition.name
|
|
234
|
+ this.Dialog.formValue.code =
|
|
235
|
+ response.data.data.addition.code
|
|
236
|
+ this.Dialog.formValue.price =
|
|
237
|
+ response.data.data.addition.price
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+ this.Dialog.isCreated = 3
|
|
241
|
+ this.Dialog.isVisibility = true
|
|
242
|
+ }
|
|
243
|
+ })
|
|
244
|
+ },
|
|
245
|
+ dialogComfirm: function(val) {
|
|
246
|
+ // this.manufacturerDialog.isVisibility = false
|
|
247
|
+ this.$refs.dialog.hide()
|
|
248
|
+ if (val.isCreated == 2) {
|
|
249
|
+ //修改
|
|
250
|
+ let params = {
|
|
251
|
+ name: val.name,
|
|
252
|
+ code: val.code,
|
|
253
|
+ price: val.price,
|
|
254
|
+ id: this.editId,
|
|
255
|
+
|
|
256
|
+ }
|
|
257
|
+ modifyAddition(params).then(response => {
|
|
258
|
+ if (response.data.state == 0) {
|
|
259
|
+ this.$message.error(response.data.msg)
|
|
260
|
+ return false
|
|
261
|
+ } else {
|
|
262
|
+ this.manufacturerData[this.editIndex].name =
|
|
263
|
+ response.data.data.addition.name
|
|
264
|
+ this.manufacturerData[this.editIndex].code =
|
|
265
|
+ response.data.data.addition.code
|
|
266
|
+ this.manufacturerData[this.editIndex].price =
|
|
267
|
+ response.data.data.addition.price
|
|
268
|
+ this.$message.success('修改成功')
|
|
269
|
+ }
|
|
270
|
+ })
|
|
271
|
+ } else if (val.isCreated == 1) {
|
|
272
|
+ //新增
|
|
273
|
+ createAddition(val).then(response => {
|
|
274
|
+ if (response.data.state == 0) {
|
|
275
|
+ this.$message.error(response.data.msg)
|
|
276
|
+ return false
|
|
277
|
+ } else {
|
|
278
|
+ this.manufacturerData.unshift(response.data.data.addition)
|
|
279
|
+
|
|
280
|
+ this.$message.success('新增成功')
|
|
281
|
+ }
|
|
282
|
+ })
|
|
283
|
+ }
|
|
284
|
+ },
|
|
285
|
+ dialogCancle: function() {
|
|
286
|
+ this.$refs.dialog.hide()
|
|
287
|
+ },
|
|
288
|
+ showDialog: function() {
|
|
289
|
+ this.Dialog.formValue = Object.assign(
|
|
290
|
+ {},
|
|
291
|
+ this.Dialog.resetForm
|
|
292
|
+ )
|
|
293
|
+ this.$refs.dialog.show()
|
|
294
|
+ this.Dialog.isCreated = 1
|
|
295
|
+ },
|
|
296
|
+ handleSizeChange(val) {
|
|
297
|
+ this.limit = val
|
|
298
|
+ this.getList()
|
|
299
|
+ },
|
|
300
|
+ handleCurrentChange(val) {
|
|
301
|
+ this.page = val
|
|
302
|
+ this.getList()
|
|
303
|
+ },
|
|
304
|
+ getList() {
|
|
305
|
+ let params = {
|
|
306
|
+ page: this.page,
|
|
307
|
+ limit: this.limit
|
|
308
|
+ }
|
|
309
|
+ this.loading = true
|
|
310
|
+ getAdditionList(params).then(response => {
|
|
311
|
+ if (response.data.state == 0) {
|
|
312
|
+ this.loading = false
|
|
313
|
+ this.$message.error(response.data.msg)
|
|
314
|
+ return false
|
|
315
|
+ } else {
|
|
316
|
+ this.loading = false
|
|
317
|
+ this.total = response.data.data.total
|
|
318
|
+ this.manufacturerData = []
|
|
319
|
+ for (let i = 0; i < response.data.data.addition.length; i++) {
|
|
320
|
+ this.manufacturerData.push(response.data.data.addition[i])
|
|
321
|
+ }
|
|
322
|
+ }
|
|
323
|
+ })
|
|
324
|
+ }
|
|
325
|
+ },
|
|
326
|
+ created() {
|
|
327
|
+ this.getList()
|
|
328
|
+ }
|
|
329
|
+ }
|
|
330
|
+</script>
|
|
331
|
+
|
|
332
|
+<style lang="scss">
|
|
333
|
+ .el-table td,
|
|
334
|
+ .el-table th.is-leaf,
|
|
335
|
+ .el-table--border,
|
|
336
|
+ .el-table--group {
|
|
337
|
+ border-color: #d0d3da;
|
|
338
|
+ }
|
|
339
|
+
|
|
340
|
+ .el-table--border::after,
|
|
341
|
+ .el-table--group::after,
|
|
342
|
+ .el-table::before {
|
|
343
|
+ background-color: #d0d3da;
|
|
344
|
+ }
|
|
345
|
+</style>
|