瀏覽代碼

修改bug

csx 6 年之前
父節點
當前提交
344fbd6614

+ 5 - 4
src/xt_pages/device/components/device_info/device_info_form.vue 查看文件

@@ -374,7 +374,7 @@ export default {
374 374
         }
375 375
     },
376 376
     created() {
377
-        
377
+
378 378
     },
379 379
     methods: {
380 380
         clear() {
@@ -405,7 +405,8 @@ export default {
405 405
             this.form.reverse_osmosis_mode = ''
406 406
         },
407 407
         set_device_id: function(device_id) {
408
-            if (device_id > 0) {
408
+
409
+          if (device_id > 0) {
409 410
                 this.device_id = device_id
410 411
                 getDeviceBaseInfo(device_id).then(rs => {
411 412
                     var resp = rs.data
@@ -436,7 +437,7 @@ export default {
436 437
                         this.form.working_time = device_info.working_time == 0 ? '' : device_info.working_time
437 438
                         if (this.form.device_type == 1) {
438 439
                             // treatment_mode: []
439
-                            
440
+
440 441
                         } else if (this.form.device_type == 2) {
441 442
                             // reverse_osmosis_mode: ''
442 443
                         }
@@ -445,7 +446,7 @@ export default {
445 446
                         this.$message.error(resp.msg)
446 447
                     }
447 448
                 })
448
-                
449
+
449 450
             } else {
450 451
                 this.clear()
451 452
             }

+ 5 - 5
src/xt_pages/device/components/device_info/device_info_pane.vue 查看文件

@@ -1,8 +1,8 @@
1 1
 <template>
2 2
     <div>
3
-        <div style="padding-top: 10px;">
4
-            <device-info-form ref="device_info_form" :device_numbers="device_numbers" @did_update="did_update_device"></device-info-form>
5
-        </div>
3
+      <div style="padding-top: 10px;">
4
+         <device-info-form ref="device_info_form" :device_numbers="device_numbers" @did_update="did_update_device"></device-info-form>
5
+      </div>
6 6
         <div style="text-align: right; padding-right: 25px; padding-top: 10px; padding-bottom: 10px;">
7 7
             <el-button type="primary" :disabled="$store.getters.xt_user.subscibe.state==3?true:false" @click="modify_submit">保 存</el-button>
8 8
         </div>
@@ -25,7 +25,7 @@ export default {
25 25
     },
26 26
     methods: {
27 27
         set_device_id: function(device_id) {
28
-            this.$refs.device_info_form.set_device_id(device_id)
28
+          this.$refs.device_info_form.set_device_id(device_id)
29 29
         },
30 30
         modify_submit: function() {
31 31
             this.$refs.device_info_form.update_device_submit()
@@ -58,7 +58,7 @@ export default {
58 58
     height: 32px;
59 59
     line-height: 32px;
60 60
     display: block;
61
-    
61
+
62 62
 }
63 63
 .required_span {
64 64
     color: red;

+ 599 - 0
src/xt_pages/device/components/device_info/edit_device_info_form.vue 查看文件

@@ -0,0 +1,599 @@
1
+<template>
2
+  <div class="main">
3
+    <!-- 第一行 -->
4
+    <el-row>
5
+      <el-col :span="8">
6
+        <div class="col_div">
7
+          <el-col :span="layout.first_line_label">
8
+            <span class="col_label_span"><span class="required_span">*&nbsp;</span>序列号:</span>
9
+          </el-col>
10
+          <el-col :span="layout.first_line_content">
11
+            <el-input size="small" v-model="form.serial_number"></el-input>
12
+          </el-col>
13
+        </div>
14
+      </el-col>
15
+      <el-col :span="8">
16
+        <div class="col_div">
17
+          <el-col :span="layout.second_line_label">
18
+            <span class="col_label_span"><span class="required_span">*&nbsp;</span>设备类型:</span>
19
+          </el-col>
20
+          <el-col :span="layout.second_line_content" >
21
+            <el-select v-model="form.device_type" size="small" :disabled="device_id != 0" style="width:100%;">
22
+              <el-option v-for="item in device_types" :key="item.id" :label="item.name" :value="item.id"></el-option>
23
+            </el-select>
24
+          </el-col>
25
+        </div>
26
+      </el-col>
27
+      <el-col :span="8">
28
+        <div class="col_div">
29
+          <el-col :span="layout.third_line_label">
30
+            <span class="col_label_span">床位号:</span>
31
+          </el-col>
32
+          <el-col :span="layout.third_line_content">
33
+            <el-select v-model="form.device_number_id" clearable size="small" style="width:100%;">
34
+              <el-option v-for="item in device_numbers" :key="item.id" :label="item.number" :value="item.id"></el-option>
35
+            </el-select>
36
+          </el-col>
37
+        </div>
38
+      </el-col>
39
+    </el-row>
40
+    <!-- 第二行 -->
41
+    <el-row>
42
+      <el-col :span="8">
43
+        <div class="col_div">
44
+          <el-col :span="layout.first_line_label">
45
+            <span class="col_label_span"><span class="required_span">*&nbsp;</span>设备名称:</span>
46
+          </el-col>
47
+          <el-col :span="layout.first_line_content">
48
+            <el-input size="small" v-model="form.name"></el-input>
49
+          </el-col>
50
+        </div>
51
+      </el-col>
52
+      <el-col :span="8">
53
+        <div class="col_div">
54
+          <el-col :span="layout.second_line_label">
55
+            <span class="col_label_span">生产厂家:</span>
56
+          </el-col>
57
+          <el-col :span="layout.second_line_content">
58
+            <el-input size="small" v-model="form.manufacturer"></el-input>
59
+          </el-col>
60
+        </div>
61
+      </el-col>
62
+      <el-col :span="8">
63
+        <div class="col_div">
64
+          <el-col :span="layout.third_line_label">
65
+            <span class="col_label_span">维修厂家:</span>
66
+          </el-col>
67
+          <el-col :span="layout.third_line_content">
68
+            <el-input size="small" v-model="form.repair_factory"></el-input>
69
+          </el-col>
70
+        </div>
71
+      </el-col>
72
+    </el-row>
73
+    <!-- 第三行 -->
74
+    <el-row>
75
+      <el-col :span="8">
76
+        <div class="col_div">
77
+          <el-col :span="layout.first_line_label">
78
+            <span class="col_label_span">设备型号:</span>
79
+          </el-col>
80
+          <el-col :span="layout.first_line_content">
81
+            <el-input size="small" v-model="form.model"></el-input>
82
+          </el-col>
83
+        </div>
84
+      </el-col>
85
+      <el-col :span="8">
86
+        <div class="col_div">
87
+          <el-col :span="layout.second_line_label">
88
+            <span class="col_label_span">使用科室:</span>
89
+          </el-col>
90
+          <el-col :span="layout.second_line_content">
91
+            <el-input size="small" v-model="form.department"></el-input>
92
+          </el-col>
93
+        </div>
94
+      </el-col>
95
+      <el-col :span="8">
96
+        <div class="col_div">
97
+          <el-col :span="layout.third_line_label">
98
+            <span class="col_label_span">科室编号:</span>
99
+          </el-col>
100
+          <el-col :span="layout.third_line_content">
101
+            <el-input size="small" v-model="form.department_number"></el-input>
102
+          </el-col>
103
+        </div>
104
+      </el-col>
105
+    </el-row>
106
+    <!-- 第四行 -->
107
+    <el-row>
108
+      <el-col :span="8">
109
+        <div class="col_div">
110
+          <el-col :span="layout.first_line_label">
111
+            <span class="col_label_span">购买日期:</span>
112
+          </el-col>
113
+          <el-col :span="layout.first_line_content">
114
+            <el-date-picker v-model="form.purchase_date" type="date" value-format="timestamp" size="small" style="width: 100%;"></el-date-picker>
115
+          </el-col>
116
+        </div>
117
+      </el-col>
118
+      <el-col :span="8">
119
+        <div class="col_div">
120
+          <el-col :span="layout.second_line_label">
121
+            <span class="col_label_span">安装日期:</span>
122
+          </el-col>
123
+          <el-col :span="layout.second_line_content">
124
+            <el-date-picker v-model="form.install_date" type="date" value-format="timestamp" size="small" style="width: 100%;"></el-date-picker>
125
+          </el-col>
126
+        </div>
127
+      </el-col>
128
+      <el-col :span="8">
129
+        <div class="col_div">
130
+          <el-col :span="layout.third_line_label">
131
+            <span class="col_label_span">启用日期:</span>
132
+          </el-col>
133
+          <el-col :span="layout.third_line_content">
134
+            <el-date-picker v-model="form.commissioning_date" value-format="timestamp" type="date" size="small" style="width: 100%;"></el-date-picker>
135
+          </el-col>
136
+        </div>
137
+      </el-col>
138
+    </el-row>
139
+    <!-- 第五行 -->
140
+    <el-row>
141
+      <el-col :span="8">
142
+        <div class="col_div">
143
+          <el-col :span="layout.first_line_label">
144
+            <span class="col_label_span">维修工程师:</span>
145
+          </el-col>
146
+          <el-col :span="layout.first_line_content">
147
+            <el-input size="small" v-model="form.maintainer"></el-input>
148
+          </el-col>
149
+        </div>
150
+      </el-col>
151
+      <el-col :span="8">
152
+        <div class="col_div">
153
+          <el-col :span="layout.second_line_label">
154
+            <span class="col_label_span">联系电话:</span>
155
+          </el-col>
156
+          <el-col :span="layout.second_line_content">
157
+            <el-input size="small" v-model="form.maintenance_call"></el-input>
158
+          </el-col>
159
+        </div>
160
+      </el-col>
161
+      <el-col :span="8">
162
+        <div class="col_div">
163
+          <el-col :span="layout.third_line_label">
164
+            <span class="col_label_span">保修期限:</span>
165
+          </el-col>
166
+          <el-col :span="layout.third_line_content">
167
+            <el-input size="small" v-model="form.warranty_period"></el-input>
168
+          </el-col>
169
+        </div>
170
+      </el-col>
171
+    </el-row>
172
+    <!-- 第六行 -->
173
+    <!-- <el-row>
174
+        <el-col :span="8">
175
+            <div class="col_div">
176
+                <el-col :span="9">
177
+                    <span class="col_label_span">机器状态:</span>
178
+                </el-col>
179
+                <el-col :span="15">
180
+                    <el-select v-model="form.device_status" clearable size="small">
181
+                        <el-option v-for="item in device_states" :key="item.state" :label="item.name" :value="item.state"></el-option>
182
+                    </el-select>
183
+                </el-col>
184
+            </div>
185
+        </el-col>
186
+        <el-col :span="8">
187
+            <div class="col_div">
188
+                <el-col :span="10">
189
+                    <span class="col_label_span">初始使用次数:</span>
190
+                </el-col>
191
+                <el-col :span="14">
192
+                    <el-input v-model="form.initial_use_times" style="width: 100%;"></el-input>
193
+                </el-col>
194
+            </div>
195
+        </el-col>
196
+        <el-col :span="8">
197
+            <div class="col_div">
198
+                <el-col :span="7">
199
+                    <span class="col_label_span">备&nbsp;&nbsp;&nbsp;注:</span>
200
+                </el-col>
201
+                <el-col :span="17">
202
+                    <el-input size="small" v-model="form.mark"></el-input>
203
+                </el-col>
204
+            </div>
205
+        </el-col>
206
+    </el-row> -->
207
+    <!-- 第七行 -->
208
+    <!-- <el-row>
209
+        <el-col :span="7">
210
+            <div class="col_div">
211
+                <el-col :span="8">
212
+                    <span class="col_label_span">报废日期:</span>
213
+                </el-col>
214
+                <el-col :span="16">
215
+                    <el-date-picker v-model="form.retirement_date" type="date" value-format="timestamp" size="small" style="width: 140px;"></el-date-picker>
216
+                </el-col>
217
+            </div>
218
+        </el-col>
219
+        <el-col :span="7">
220
+            <div class="col_div">
221
+                <el-col :span="8">
222
+                    <span class="col_label_span">报废原因:</span>
223
+                </el-col>
224
+                <el-col :span="16">
225
+                    <el-select v-model="form.retirement_reason" clearable size="small">
226
+                        <el-option v-for="item in retirement_reasons" :key="item.id" :label="item.reason" :value="item.reason"></el-option>
227
+                    </el-select>
228
+                </el-col>
229
+            </div>
230
+        </el-col>
231
+        <el-col :span="5">
232
+            <div class="col_div">
233
+                <el-col :span="15">
234
+                    <span class="col_label_span">使用年限(年):</span>
235
+                </el-col>
236
+                <el-col :span="9">
237
+                    <el-input size="small" v-model="form.service_life"></el-input>
238
+                </el-col>
239
+            </div>
240
+        </el-col>
241
+        <el-col :span="5">
242
+            <div class="col_div">
243
+                <el-col :span="14">
244
+                    <span class="col_label_span">工作时长(h):</span>
245
+                </el-col>
246
+                <el-col :span="10">
247
+                    <el-input size="small" v-model="form.working_time"></el-input>
248
+                </el-col>
249
+            </div>
250
+        </el-col>
251
+    </el-row> -->
252
+    <!-- 治疗模式 -->
253
+    <el-row v-show="false && form.device_type === 1">
254
+      <el-col :span="24">
255
+        <div class="col_div">
256
+          <el-col :span="3">
257
+            <div style="padding-left: 5px;">
258
+              <span class="col_label_span" style="line-height: auto; padding-left: 0; text-align: left;">治疗模式:</span>
259
+              <el-checkbox label="全选"></el-checkbox>
260
+            </div>
261
+          </el-col>
262
+          <el-col :span="21">
263
+            <div style="margin-top: 6px;"></div>
264
+            <el-checkbox-group v-model="form.treatment_mode">
265
+              <el-checkbox v-for="item in cure_types" :label="item.id" :key="item.id" :value="item.id">{{ item.name }}</el-checkbox>
266
+            </el-checkbox-group>
267
+          </el-col>
268
+        </div>
269
+      </el-col>
270
+    </el-row>
271
+    <!-- 反渗模式 -->
272
+    <el-row v-show="false && form.device_type === 2">
273
+      <el-col :span="8">
274
+        <div class="col_div">
275
+          <el-col :span="layout.first_line_label">
276
+            <span class="col_label_span">反渗模式:</span>
277
+          </el-col>
278
+          <el-col :span="layout.first_line_content">
279
+            <el-select v-model="form.reverse_osmosis_mode" clearable size="small">
280
+              <el-option v-for="item in reverse_osmosises" :key="item.id" :label="item.name" :value="item.id"></el-option>
281
+            </el-select>
282
+          </el-col>
283
+        </div>
284
+      </el-col>
285
+    </el-row>
286
+  </div>
287
+</template>
288
+
289
+<script>
290
+  import {getDeviceBaseInfo, createDevice, modifyDeviceBaseInfo} from '@/api/device/device'
291
+
292
+  export default {
293
+    name: "EditDeviceInfoForm",
294
+    data() {
295
+      return {
296
+        layout: {
297
+          first_line_label: 8,
298
+          first_line_content: 16,
299
+          second_line_label: 8,
300
+          second_line_content: 16,
301
+          third_line_label: 8,
302
+          third_line_content: 16,
303
+        },
304
+        device_id: 0,
305
+        form: {
306
+          device_type: 1,
307
+          serial_number: '',
308
+          name: '',
309
+          device_number_id: '',
310
+          manufacturer: '',
311
+          repair_factory: '',
312
+          model: '',
313
+          department: '',
314
+          department_number: '',
315
+          purchase_date: '',
316
+          install_date: '',
317
+          commissioning_date: '',
318
+          maintainer: '',
319
+          maintenance_call: '',
320
+          warranty_period: '',
321
+          device_status: '',
322
+          initial_use_times: '',
323
+          mark: '',
324
+          retirement_date: '',
325
+          retirement_reason: '',
326
+          service_life: '',
327
+          working_time: '',
328
+          treatment_mode: [], // 治疗模式
329
+          reverse_osmosis_mode: '', // 反渗模式
330
+        },
331
+        device_types: [
332
+          { id: 1, name: "透析机" },
333
+          // { id: 2, name: "水处理机" },
334
+        ],
335
+        cure_types: [ // 治疗模式
336
+          // { id:1, name: "HD" },
337
+          // { id:2, name: "HDF" },
338
+          // { id:3, name: "HD+HP" },
339
+          // { id:4, name: "HP" },
340
+          // { id:5, name: "HF" },
341
+          // { id:10, name: "HD" },
342
+          // { id:20, name: "HDF" },
343
+          // { id:30, name: "HD+HP" },
344
+          // { id:40, name: "HP" },
345
+          // { id:50, name: "HF" },
346
+          // { id:300, name: "HD+HP" },
347
+        ],
348
+        reverse_osmosises: [ // 反渗模式
349
+          // { id:1, name: "单级反渗" }
350
+        ],
351
+        device_states: [
352
+          { state: 1, name: '使用机' },
353
+          { state: 2, name: '备用机' },
354
+          { state: 3, name: '急诊机' },
355
+          { state: 4, name: '报废机' },
356
+        ],
357
+        retirement_reasons: [
358
+          { id: 1, reason: '报废原因1' },
359
+          { id: 2, reason: '报废原因2' },
360
+          { id: 3, reason: '报废原因3' },
361
+          { id: 4, reason: '报废原因4' },
362
+          { id: 5, reason: '其他' },
363
+        ]
364
+      }
365
+    },
366
+    props: {
367
+      // device_id: {
368
+      //     type: Number,
369
+      //     require: false,
370
+      // },
371
+      device_numbers: {
372
+        type: Array,
373
+        require: true,
374
+      }
375
+    },
376
+    created() {
377
+
378
+    },
379
+    methods: {
380
+      clear() {
381
+        this.device_id = 0
382
+        this.form.device_type = 1
383
+        this.form.serial_number = ''
384
+        this.form.name = ''
385
+        this.form.device_number_id = ''
386
+        this.form.manufacturer = ''
387
+        this.form.repair_factory = ''
388
+        this.form.model = ''
389
+        this.form.department = ''
390
+        this.form.department_number = ''
391
+        this.form.purchase_date = 0
392
+        this.form.install_date = 0
393
+        this.form.commissioning_date = 0
394
+        this.form.maintainer = ''
395
+        this.form.maintenance_call = ''
396
+        this.form.warranty_period = ''
397
+        this.form.device_status = ''
398
+        this.form.initial_use_times = ''
399
+        this.form.mark = ''
400
+        this.form.retirement_date = 0
401
+        this.form.retirement_reason = ''
402
+        this.form.service_life = ''
403
+        this.form.working_time = ''
404
+        this.form.treatment_mode = []
405
+        this.form.reverse_osmosis_mode = ''
406
+      },
407
+      set_device_id: function(device_id) {
408
+        console.log(device_id+"-----")
409
+        if (device_id > 0) {
410
+          this.device_id = device_id
411
+          getDeviceBaseInfo(device_id).then(rs => {
412
+            var resp = rs.data
413
+            if (resp.state === 1) {
414
+              this.form.device_type = resp.data.device_type
415
+              this.form.device_number_id = resp.data.device_number_id == 0 ? '' : resp.data.device_number_id
416
+
417
+              var device_info = resp.data.device_info
418
+              this.form.serial_number = device_info.serial_number
419
+              this.form.name = device_info.name
420
+              this.form.manufacturer = device_info.manufacturer
421
+              this.form.repair_factory = device_info.repair_factory
422
+              this.form.model = device_info.model
423
+              this.form.department = device_info.department
424
+              this.form.department_number = device_info.department_number
425
+              this.form.purchase_date = device_info.purchase_date == 0 ? '' : (device_info.purchase_date * 1000)
426
+              this.form.install_date = device_info.install_date == 0 ? '' : (device_info.install_date * 1000)
427
+              this.form.commissioning_date = device_info.commissioning_date == 0 ? '' : (device_info.commissioning_date * 1000)
428
+              this.form.maintainer = device_info.maintainer
429
+              this.form.maintenance_call = device_info.maintenance_call
430
+              this.form.warranty_period = device_info.warranty_period
431
+              this.form.device_status = device_info.device_status == 0 ? '' : device_info.device_status
432
+              this.form.initial_use_times = device_info.initial_use_times == 0 ? '' : device_info.initial_use_times
433
+              this.form.mark = device_info.mark
434
+              this.form.retirement_date = device_info.retirement_date == 0 ? '' : (device_info.retirement_date * 1000)
435
+              this.form.retirement_reason = device_info.retirement_reason
436
+              this.form.service_life = device_info.service_life == 0 ? '' : device_info.service_life
437
+              this.form.working_time = device_info.working_time == 0 ? '' : device_info.working_time
438
+              if (this.form.device_type == 1) {
439
+                // treatment_mode: []
440
+
441
+              } else if (this.form.device_type == 2) {
442
+                // reverse_osmosis_mode: ''
443
+              }
444
+
445
+            } else {
446
+              this.$message.error(resp.msg)
447
+            }
448
+          })
449
+
450
+        } else {
451
+          this.clear()
452
+        }
453
+      },
454
+      create_device_submit() {
455
+        var checkErr = this._check_submit()
456
+        if (checkErr.length > 0) {
457
+          this.$message.error(checkErr)
458
+          return
459
+        }
460
+
461
+        var params = new Object()
462
+        params.type = this.form.device_type
463
+        params.serial_number = this.form.serial_number
464
+        params.name = this.form.name
465
+        params.device_number_id = this.form.device_number_id
466
+        params.manufacturer = this.form.manufacturer
467
+        params.repair_factory = this.form.repair_factory
468
+        params.model = this.form.model
469
+        params.department = this.form.department
470
+        params.department_number = this.form.department_number
471
+        params.purchase_date = typeof this.form.purchase_date == 'string' ? 0 : (this.form.purchase_date / 1000)
472
+        params.install_date = typeof this.form.install_date == 'string' ? 0 : (this.form.install_date / 1000)
473
+        params.commissioning_date = typeof this.form.commissioning_date == 'string' ? 0 : (this.form.commissioning_date / 1000)
474
+        params.maintainer = this.form.maintainer
475
+        params.maintenance_call = this.form.maintenance_call
476
+        params.warranty_period = this.form.warranty_period
477
+        params.device_status = this.form.device_status
478
+        params.initial_use_times = this.form.initial_use_times
479
+        params.mark = this.form.mark
480
+        params.retirement_date = typeof this.form.retirement_date == 'string' ? 0 : (this.form.retirement_date / 1000)
481
+        params.retirement_reason = this.form.retirement_reason
482
+        params.service_life = this.form.service_life
483
+        params.working_time = this.form.working_time
484
+        // params.treatment_mode = this.form.treatment_mode
485
+        // params.reverse_osmosis_mode = this.form.reverse_osmosis_mode
486
+        createDevice(params).then(rs => {
487
+          var resp = rs.data
488
+          if (resp.state === 1) {
489
+            var device = resp.data.device
490
+            this.$emit('did_create', device)
491
+            this.$message({message: "创建成功", type: "success"})
492
+
493
+          } else {
494
+            this.$message.error(resp.msg)
495
+          }
496
+        })
497
+      },
498
+      update_device_submit() {
499
+        var checkErr = this._check_submit()
500
+        if (checkErr.length > 0) {
501
+          this.$message.error(checkErr)
502
+          return
503
+        }
504
+
505
+        var params = new Object()
506
+        params.device_id = this.device_id
507
+        params.serial_number = this.form.serial_number
508
+        params.name = this.form.name
509
+        params.device_number_id = this.form.device_number_id
510
+        params.manufacturer = this.form.manufacturer
511
+        params.repair_factory = this.form.repair_factory
512
+        params.model = this.form.model
513
+        params.department = this.form.department
514
+        params.department_number = this.form.department_number
515
+        params.purchase_date = typeof this.form.purchase_date == 'string' ? 0 : (this.form.purchase_date / 1000)
516
+        params.install_date = typeof this.form.install_date == 'string' ? 0 : (this.form.install_date / 1000)
517
+        params.commissioning_date = typeof this.form.commissioning_date == 'string' ? 0 : (this.form.commissioning_date / 1000)
518
+        params.maintainer = this.form.maintainer
519
+        params.maintenance_call = this.form.maintenance_call
520
+        params.warranty_period = this.form.warranty_period
521
+        params.device_status = this.form.device_status
522
+        params.initial_use_times = this.form.initial_use_times
523
+        params.mark = this.form.mark
524
+        params.retirement_date = typeof this.form.retirement_date == 'string' ? 0 : (this.form.retirement_date / 1000)
525
+        params.retirement_reason = this.form.retirement_reason
526
+        params.service_life = this.form.service_life
527
+        params.working_time = this.form.working_time
528
+        // params.treatment_mode = this.form.treatment_mode
529
+        // params.reverse_osmosis_mode = this.form.reverse_osmosis_mode
530
+        modifyDeviceBaseInfo(params).then(rs => {
531
+          var resp = rs.data
532
+          if (resp.state === 1) {
533
+            var device = resp.data.device
534
+            this.$emit('did_update', device)
535
+            this.$message({message: "保存成功", type: "success"})
536
+
537
+          } else {
538
+            this.$message.error(resp.msg)
539
+          }
540
+        })
541
+      },
542
+      _check_submit() {
543
+        if (this.form.serial_number.length == 0) {
544
+          return "请填写设备序列号"
545
+        }
546
+        if (this.form.device_type !== 1 && this.form.device_type !== 2) {
547
+          return "请选择设备类型"
548
+        }
549
+        if (this.form.name.length == 0) {
550
+          return "请填写设备名"
551
+        }
552
+        if (this.form.maintenance_call.length > 0) {
553
+          if (/^(0\d{2,3}-?\d{7,8}$)|(1\d{10}$)/.test(this.form.maintenance_call) == false) {
554
+            return "联系电话格式错误"
555
+          }
556
+        }
557
+        return ""
558
+      }
559
+    }
560
+  }
561
+</script>
562
+
563
+<style scoped>
564
+  .main {
565
+    width: 100%;
566
+  }
567
+  .main .el-row {
568
+    /* border-bottom: 1px solid rgb(233, 233, 233); */
569
+    /* padding-left: 5px; */
570
+    padding-right: 5px;
571
+    padding-top: 10px;
572
+    padding-bottom: 10px;
573
+  }
574
+  .col_div {
575
+    width: 100%;
576
+  }
577
+  .col_label_span {
578
+    padding-left: 0px;
579
+    padding-right: 5px;
580
+    font-size: 14px;
581
+    height: 32px;
582
+    line-height: 32px;
583
+    /* display: block; */
584
+    display: inline-block;
585
+    width: 100%;
586
+    text-align: right;
587
+    /* padding-right: 5px; */
588
+  }
589
+  .required_span {
590
+    color: red;
591
+  }
592
+
593
+  .el-checkbox {
594
+    margin-bottom: 5px;
595
+  }
596
+  .el-checkbox+.el-checkbox {
597
+    margin-left: 15px;
598
+  }
599
+</style>

+ 163 - 132
src/xt_pages/device/components/device_list.vue 查看文件

@@ -1,154 +1,182 @@
1 1
 <template>
2
-    <div>
3
-        <el-row>
4
-            <el-col :span="24">
5
-                    <el-button size="small" icon="el-icon-circle-plus-outline" :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary" @click="add_device_action">新增</el-button>
6
-                    <el-button size="small" icon="el-icon-delete" :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="danger" @click="delete_device_action">删除</el-button>
7
-            </el-col>
8
-        </el-row>
2
+  <div>
3
+    <el-row>
4
+      <el-col :span="24">
5
+        <el-table :data="devices" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
6
+                  :highlight-current-row="true">
7
+          <el-table-column label="序列号" prop="serial_number" align="center" header-align="center"></el-table-column>
8
+          <el-table-column label="设备名" prop="name" align="center" header-align="center"></el-table-column>
9
+          <el-table-column label="型号" prop="model" align="center" header-align="center"></el-table-column>
10
+          <el-table-column label="操作" align="center" fixed="right" width="150">
11
+            <template slot-scope="scope">
12
+              <el-tooltip class="item" effect="dark" content="编辑" placement="top">
13
+                <el-button
14
+                  size="small"
15
+                  type="primary"
16
+                  icon="el-icon-edit-outline"
17
+                  @click="handleEdit(scope.$index, scope.row)">
18
+                </el-button>
19
+              </el-tooltip>
20
+              <el-tooltip class="item" effect="dark" content="删除" placement="top">
21
+                <el-button
22
+                  size="small"
23
+                  type="danger"
24
+                  icon="el-icon-delete"
25
+                  @click="delete_device_action(scope.$index, scope.row)">
26
+                </el-button>
27
+              </el-tooltip>
28
+            </template>
29
+          </el-table-column>
30
+        </el-table>
31
+      </el-col>
32
+    </el-row>
9 33
 
10
-        <el-row>
11
-            <el-col :span="24">
12
-                <el-table :data="devices" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :highlight-current-row="true" @row-click="select_row">
13
-                    <el-table-column label="序列号" prop="serial_number" align="center" header-align="center"></el-table-column>
14
-                    <el-table-column label="设备名" prop="name" align="center" header-align="center"></el-table-column>
15
-                    <el-table-column label="型号" prop="model" align="center" header-align="center"></el-table-column>
16
-                </el-table>
17
-            </el-col>
18
-        </el-row>
34
+    <add-device-dialog ref="new_device_dialog" :device_numbers="device_numbers"
35
+                       @did_create_device="didCreateDevice"></add-device-dialog>
36
+    <edit-device-dialog ref="edit_device_dialog" :device_numbers="device_numbers"
37
+                        @did_update="update_device"></edit-device-dialog>
38
+    <partition-dialog ref="new_partition_dialog" :zones="zones" :device_numbers="device_numbers"
39
+                      :groups="groups"></partition-dialog>
40
+  </div>
19 41
 
20
-        <add-device-dialog ref="new_device_dialog" :device_numbers="device_numbers" @did_create_device="didCreateDevice"></add-device-dialog> 
21
-        <partition-dialog ref="new_partition_dialog" :zones="zones" :device_numbers="device_numbers" :groups="groups"></partition-dialog> 
22
-    </div>
23
- 
24 42
 </template>
25 43
 
26 44
 <script>
27
-import AddDeviceDialog from "./add_device_dialog"
28
-import PartitionDialog from "./partition_dialog"
29
-import { getDevices, disableDevice } from '@/api/device/device'
45
+  import AddDeviceDialog from './add_device_dialog'
46
+  import PartitionDialog from './partition_dialog'
47
+  import { disableDevice, getDevices } from '@/api/device/device'
48
+  import EditDeviceDialog from './edit_device_dialog'
30 49
 
31
-export default {
50
+  export default {
32 51
     name: 'DeviceList',
33 52
     components: {
34
-        AddDeviceDialog,
35
-        PartitionDialog,
53
+      EditDeviceDialog,
54
+      AddDeviceDialog,
55
+      PartitionDialog
36 56
     },
37 57
     data() {
38
-        return {
39
-            filter_form: {
40
-                zone: '',
41
-                schedule: '',
42
-                device_type: '',
43
-            },
44
-            schedules: [
45
-                { id:1, name:'上午' },
46
-                { id:2, name:'下午' },
47
-                { id:3, name:'晚上' },
48
-            ],
49
-            device_types: [
50
-                { id:1, name:'透析机' },
51
-                { id:2, name:'水处理机' },
52
-            ],
53
-            devices: [],
58
+      return {
59
+        edit_device_numbers: [],
60
+        filter_form: {
61
+          zone: '',
62
+          schedule: '',
63
+          device_type: ''
64
+        },
65
+        schedules: [
66
+          { id: 1, name: '上午' },
67
+          { id: 2, name: '下午' },
68
+          { id: 3, name: '晚上' }
69
+        ],
70
+        device_types: [
71
+          { id: 1, name: '透析机' },
72
+          { id: 2, name: '水处理机' }
73
+        ],
74
+        devices: [],
54 75
 
55
-            current_select_device: null,
56
-        }
76
+        current_select_device: null
77
+      }
57 78
     },
58 79
     props: {
59
-        zones: {
60
-            type: Array,
61
-            require: true,
62
-        },
63
-        groups: {
64
-            type: Array,
65
-            require: true,
66
-        },
67
-        device_numbers: {
68
-            type: Array,
69
-            require: true,
70
-        },
80
+      zones: {
81
+        type: Array,
82
+        require: true
83
+      },
84
+      groups: {
85
+        type: Array,
86
+        require: true
87
+      },
88
+      device_numbers: {
89
+        type: Array,
90
+        require: true
91
+      }
71 92
     },
72 93
     created() {
73
-        this._get_devices()
94
+      this._get_devices()
74 95
     },
75 96
     methods: {
76
-        add_device_action: function() {
77
-            this.$refs.new_device_dialog.show()
78
-        },
79
-        partition_dialog_action: function() {
80
-            this.$refs.new_partition_dialog.show()
81
-        },
82
-        filter_devices: function() {
83
-            this.$emit("did_select_device", null)
84
-            this._get_devices()
85
-        },
86
-        _get_devices: function() {
87
-            getDevices(this.filter_form.device_type, this.filter_form.zone).then(rs => {
97
+      handleEdit: function(index, row) {
98
+        this.$refs.edit_device_dialog.show()
99
+        this.$refs.edit_device_dialog.set_device_id(row.id)
100
+      },
101
+      add_device_action: function() {
102
+        this.$refs.new_device_dialog.show()
103
+      },
104
+      partition_dialog_action: function() {
105
+        this.$refs.new_partition_dialog.show()
106
+      },
107
+      filter_devices: function() {
108
+        this.$emit('did_select_device', null)
109
+        this._get_devices()
110
+      },
111
+      _get_devices: function() {
112
+        getDevices(this.filter_form.device_type, this.filter_form.zone).then(rs => {
113
+          var resp = rs.data
114
+          if (resp.state === 1) {
115
+            // console.log(resp)
116
+            this.devices.splice(0, this.devices.length)
117
+            this.devices.push(...resp.data.devices)
118
+
119
+          } else {
120
+            this.$message.error(resp.msg)
121
+          }
122
+        })
123
+      }, didCreateDevice: function(newDevice) {
124
+        this.$refs.new_device_dialog.hide()
125
+        this.devices.push(newDevice)
126
+      },
127
+      select_row: function(row, event, column) {
128
+        // console.log(row)
129
+        this.current_select_device = row
130
+        this.$emit('did_select_device', row)
131
+      },
132
+      update_device: function(device) {
133
+        if (device !== undefined) {
134
+          for (let index = 0; index < this.devices.length; index++) {
135
+            const _device = this.devices[index]
136
+            if (_device.id == device.id) {
137
+              _device.name = device.name
138
+              _device.model = device.model
139
+              _device.serial_number = device.serial_number
140
+              _device.device_group_id = device.device_group_id
141
+              _device.device_number = device.device_number
142
+              _device.device_number_id = device.device_number_id
143
+              _device.device_zone_id = device.device_zone_id
144
+              break
145
+            }
146
+          }
147
+        }
148
+        this.$refs.edit_device_dialog.hide()
149
+
150
+      },
151
+      delete_device_action: function(index, row) {
152
+        this.current_select_device = row
153
+        console.log(this.current_select_device)
154
+        if (this.current_select_device != null) {
155
+          this.$confirm('删除后将无法恢复,确定继续删除吗', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
156
+            .then(() => {
157
+              disableDevice(this.current_select_device.id).then(rs => {
88 158
                 var resp = rs.data
89
-                if (resp.state === 1) {
90
-                    // console.log(resp)
91
-                    this.devices.splice(0, this.devices.length)
92
-                    this.devices.push(...resp.data.devices)
93
-                    
159
+                if (resp.state == 1) {
160
+                  var index = this.devices.indexOf(this.current_select_device)
161
+                  if (index > -1) {
162
+                    this.devices.splice(index, 1)
163
+                  }
164
+                  this.current_select_device = null
165
+                  this.$emit('did_select_device', null)
166
+
94 167
                 } else {
95
-                    this.$message.error(resp.msg)
168
+                  this.$message.error(resp.msg)
96 169
                 }
170
+              })
97 171
             })
98
-        },
99
-        didCreateDevice: function(newDevice) {
100
-            this.$refs.new_device_dialog.hide()
101
-            this.devices.push(newDevice)
102
-        },
103
-        select_row: function(row, event, column) {
104
-            // console.log(row)
105
-            this.current_select_device = row
106
-            this.$emit("did_select_device", row)
107
-        },
108
-        update_device: function(device) {
109
-            if (device !== undefined) {
110
-                for (let index = 0; index < this.devices.length; index++) {
111
-                    const _device = this.devices[index];
112
-                    if (_device.id == device.id) {
113
-                        _device.name = device.name
114
-                        _device.model = device.model
115
-                        _device.serial_number = device.serial_number
116
-                        _device.device_group_id = device.device_group_id
117
-                        _device.device_number = device.device_number
118
-                        _device.device_number_id = device.device_number_id
119
-                        _device.device_zone_id = device.device_zone_id
120
-                        break
121
-                    }
122
-                }
123
-            }
124
-        },
125
-        delete_device_action: function() {
126
-            if (this.current_select_device != null) {
127
-                this.$confirm("删除后将无法恢复,确定继续删除吗", '提示', {confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'})
128
-                .then(() => {
129
-                    disableDevice(this.current_select_device.id).then(rs => {
130
-                        var resp = rs.data
131
-                        if (resp.state == 1) {
132
-                            var index = this.devices.indexOf(this.current_select_device)
133
-                            if (index > -1) {
134
-                                this.devices.splice(index, 1)
135
-                            }
136
-                            this.current_select_device = null
137
-                            this.$emit("did_select_device", null)
138
-                            
139
-                        } else {
140
-                            this.$message.error(resp.msg)
141
-                        }
142
-                    })
143
-                })
144
-            }
145
-        },
172
+        }
173
+      }
146 174
     }
147
-}
175
+  }
148 176
 </script>
149 177
 
150 178
 <style scoped>
151
-.header {
179
+  .header {
152 180
     /* background-color: rgb(223, 249, 255); */
153 181
     background-color: rgb(236, 245, 255);
154 182
     border-style: solid;
@@ -157,14 +185,17 @@ export default {
157 185
     border-width: 1px;
158 186
     padding: 20px 20px 0px 20px;
159 187
     margin-bottom: 10px;
160
-}
161
-.el-row {
188
+  }
189
+
190
+  .el-row {
162 191
     margin-bottom: 15px;
163
-}
164
-.el-form-item {
192
+  }
193
+
194
+  .el-form-item {
165 195
     margin-bottom: 5px;
166
-}
167
-.header .item_title {
196
+  }
197
+
198
+  .header .item_title {
168 199
     font-size: 14px;
169
-}
200
+  }
170 201
 </style>

+ 628 - 0
src/xt_pages/device/components/edit_device_dialog.vue 查看文件

@@ -0,0 +1,628 @@
1
+<template>
2
+  <el-dialog title="编辑设备" width="854px" top="15vh" :visible.sync="visible" :before-close="_close">
3
+    <div>
4
+      <div class="main">
5
+        <!-- 第一行 -->
6
+        <el-row>
7
+          <el-col :span="8">
8
+            <div class="col_div">
9
+              <el-col :span="layout.first_line_label">
10
+                <span class="col_label_span"><span class="required_span">*&nbsp;</span>序列号:</span>
11
+              </el-col>
12
+              <el-col :span="layout.first_line_content">
13
+                <el-input size="small" v-model="form.serial_number"></el-input>
14
+              </el-col>
15
+            </div>
16
+          </el-col>
17
+          <el-col :span="8">
18
+            <div class="col_div">
19
+              <el-col :span="layout.second_line_label">
20
+                <span class="col_label_span"><span class="required_span">*&nbsp;</span>设备类型:</span>
21
+              </el-col>
22
+              <el-col :span="layout.second_line_content" >
23
+                <el-select v-model="form.device_type" size="small" :disabled="device_id != 0" style="width:100%;">
24
+                  <el-option v-for="item in device_types" :key="item.id" :label="item.name" :value="item.id"></el-option>
25
+                </el-select>
26
+              </el-col>
27
+            </div>
28
+          </el-col>
29
+          <el-col :span="8">
30
+            <div class="col_div">
31
+              <el-col :span="layout.third_line_label">
32
+                <span class="col_label_span">床位号:</span>
33
+              </el-col>
34
+              <el-col :span="layout.third_line_content">
35
+                <el-select v-model="form.device_number_id" clearable size="small" style="width:100%;">
36
+                  <el-option v-for="item in device_numbers" :key="item.id" :label="item.number" :value="item.id"></el-option>
37
+                </el-select>
38
+              </el-col>
39
+            </div>
40
+          </el-col>
41
+        </el-row>
42
+        <!-- 第二行 -->
43
+        <el-row>
44
+          <el-col :span="8">
45
+            <div class="col_div">
46
+              <el-col :span="layout.first_line_label">
47
+                <span class="col_label_span"><span class="required_span">*&nbsp;</span>设备名称:</span>
48
+              </el-col>
49
+              <el-col :span="layout.first_line_content">
50
+                <el-input size="small" v-model="form.name"></el-input>
51
+              </el-col>
52
+            </div>
53
+          </el-col>
54
+          <el-col :span="8">
55
+            <div class="col_div">
56
+              <el-col :span="layout.second_line_label">
57
+                <span class="col_label_span">生产厂家:</span>
58
+              </el-col>
59
+              <el-col :span="layout.second_line_content">
60
+                <el-input size="small" v-model="form.manufacturer"></el-input>
61
+              </el-col>
62
+            </div>
63
+          </el-col>
64
+          <el-col :span="8">
65
+            <div class="col_div">
66
+              <el-col :span="layout.third_line_label">
67
+                <span class="col_label_span">维修厂家:</span>
68
+              </el-col>
69
+              <el-col :span="layout.third_line_content">
70
+                <el-input size="small" v-model="form.repair_factory"></el-input>
71
+              </el-col>
72
+            </div>
73
+          </el-col>
74
+        </el-row>
75
+        <!-- 第三行 -->
76
+        <el-row>
77
+          <el-col :span="8">
78
+            <div class="col_div">
79
+              <el-col :span="layout.first_line_label">
80
+                <span class="col_label_span">设备型号:</span>
81
+              </el-col>
82
+              <el-col :span="layout.first_line_content">
83
+                <el-input size="small" v-model="form.model"></el-input>
84
+              </el-col>
85
+            </div>
86
+          </el-col>
87
+          <el-col :span="8">
88
+            <div class="col_div">
89
+              <el-col :span="layout.second_line_label">
90
+                <span class="col_label_span">使用科室:</span>
91
+              </el-col>
92
+              <el-col :span="layout.second_line_content">
93
+                <el-input size="small" v-model="form.department"></el-input>
94
+              </el-col>
95
+            </div>
96
+          </el-col>
97
+          <el-col :span="8">
98
+            <div class="col_div">
99
+              <el-col :span="layout.third_line_label">
100
+                <span class="col_label_span">科室编号:</span>
101
+              </el-col>
102
+              <el-col :span="layout.third_line_content">
103
+                <el-input size="small" v-model="form.department_number"></el-input>
104
+              </el-col>
105
+            </div>
106
+          </el-col>
107
+        </el-row>
108
+        <!-- 第四行 -->
109
+        <el-row>
110
+          <el-col :span="8">
111
+            <div class="col_div">
112
+              <el-col :span="layout.first_line_label">
113
+                <span class="col_label_span">购买日期:</span>
114
+              </el-col>
115
+              <el-col :span="layout.first_line_content">
116
+                <el-date-picker v-model="form.purchase_date" type="date" value-format="timestamp" size="small" style="width: 100%;"></el-date-picker>
117
+              </el-col>
118
+            </div>
119
+          </el-col>
120
+          <el-col :span="8">
121
+            <div class="col_div">
122
+              <el-col :span="layout.second_line_label">
123
+                <span class="col_label_span">安装日期:</span>
124
+              </el-col>
125
+              <el-col :span="layout.second_line_content">
126
+                <el-date-picker v-model="form.install_date" type="date" value-format="timestamp" size="small" style="width: 100%;"></el-date-picker>
127
+              </el-col>
128
+            </div>
129
+          </el-col>
130
+          <el-col :span="8">
131
+            <div class="col_div">
132
+              <el-col :span="layout.third_line_label">
133
+                <span class="col_label_span">启用日期:</span>
134
+              </el-col>
135
+              <el-col :span="layout.third_line_content">
136
+                <el-date-picker v-model="form.commissioning_date" value-format="timestamp" type="date" size="small" style="width: 100%;"></el-date-picker>
137
+              </el-col>
138
+            </div>
139
+          </el-col>
140
+        </el-row>
141
+        <!-- 第五行 -->
142
+        <el-row>
143
+          <el-col :span="8">
144
+            <div class="col_div">
145
+              <el-col :span="layout.first_line_label">
146
+                <span class="col_label_span">维修工程师:</span>
147
+              </el-col>
148
+              <el-col :span="layout.first_line_content">
149
+                <el-input size="small" v-model="form.maintainer"></el-input>
150
+              </el-col>
151
+            </div>
152
+          </el-col>
153
+          <el-col :span="8">
154
+            <div class="col_div">
155
+              <el-col :span="layout.second_line_label">
156
+                <span class="col_label_span">联系电话:</span>
157
+              </el-col>
158
+              <el-col :span="layout.second_line_content">
159
+                <el-input size="small" v-model="form.maintenance_call"></el-input>
160
+              </el-col>
161
+            </div>
162
+          </el-col>
163
+          <el-col :span="8">
164
+            <div class="col_div">
165
+              <el-col :span="layout.third_line_label">
166
+                <span class="col_label_span">保修期限:</span>
167
+              </el-col>
168
+              <el-col :span="layout.third_line_content">
169
+                <el-input size="small" v-model="form.warranty_period"></el-input>
170
+              </el-col>
171
+            </div>
172
+          </el-col>
173
+        </el-row>
174
+        <!-- 第六行 -->
175
+        <!-- <el-row>
176
+            <el-col :span="8">
177
+                <div class="col_div">
178
+                    <el-col :span="9">
179
+                        <span class="col_label_span">机器状态:</span>
180
+                    </el-col>
181
+                    <el-col :span="15">
182
+                        <el-select v-model="form.device_status" clearable size="small">
183
+                            <el-option v-for="item in device_states" :key="item.state" :label="item.name" :value="item.state"></el-option>
184
+                        </el-select>
185
+                    </el-col>
186
+                </div>
187
+            </el-col>
188
+            <el-col :span="8">
189
+                <div class="col_div">
190
+                    <el-col :span="10">
191
+                        <span class="col_label_span">初始使用次数:</span>
192
+                    </el-col>
193
+                    <el-col :span="14">
194
+                        <el-input v-model="form.initial_use_times" style="width: 100%;"></el-input>
195
+                    </el-col>
196
+                </div>
197
+            </el-col>
198
+            <el-col :span="8">
199
+                <div class="col_div">
200
+                    <el-col :span="7">
201
+                        <span class="col_label_span">备&nbsp;&nbsp;&nbsp;注:</span>
202
+                    </el-col>
203
+                    <el-col :span="17">
204
+                        <el-input size="small" v-model="form.mark"></el-input>
205
+                    </el-col>
206
+                </div>
207
+            </el-col>
208
+        </el-row> -->
209
+        <!-- 第七行 -->
210
+        <!-- <el-row>
211
+            <el-col :span="7">
212
+                <div class="col_div">
213
+                    <el-col :span="8">
214
+                        <span class="col_label_span">报废日期:</span>
215
+                    </el-col>
216
+                    <el-col :span="16">
217
+                        <el-date-picker v-model="form.retirement_date" type="date" value-format="timestamp" size="small" style="width: 140px;"></el-date-picker>
218
+                    </el-col>
219
+                </div>
220
+            </el-col>
221
+            <el-col :span="7">
222
+                <div class="col_div">
223
+                    <el-col :span="8">
224
+                        <span class="col_label_span">报废原因:</span>
225
+                    </el-col>
226
+                    <el-col :span="16">
227
+                        <el-select v-model="form.retirement_reason" clearable size="small">
228
+                            <el-option v-for="item in retirement_reasons" :key="item.id" :label="item.reason" :value="item.reason"></el-option>
229
+                        </el-select>
230
+                    </el-col>
231
+                </div>
232
+            </el-col>
233
+            <el-col :span="5">
234
+                <div class="col_div">
235
+                    <el-col :span="15">
236
+                        <span class="col_label_span">使用年限(年):</span>
237
+                    </el-col>
238
+                    <el-col :span="9">
239
+                        <el-input size="small" v-model="form.service_life"></el-input>
240
+                    </el-col>
241
+                </div>
242
+            </el-col>
243
+            <el-col :span="5">
244
+                <div class="col_div">
245
+                    <el-col :span="14">
246
+                        <span class="col_label_span">工作时长(h):</span>
247
+                    </el-col>
248
+                    <el-col :span="10">
249
+                        <el-input size="small" v-model="form.working_time"></el-input>
250
+                    </el-col>
251
+                </div>
252
+            </el-col>
253
+        </el-row> -->
254
+        <!-- 治疗模式 -->
255
+        <el-row v-show="false && form.device_type === 1">
256
+          <el-col :span="24">
257
+            <div class="col_div">
258
+              <el-col :span="3">
259
+                <div style="padding-left: 5px;">
260
+                  <span class="col_label_span" style="line-height: auto; padding-left: 0; text-align: left;">治疗模式:</span>
261
+                  <el-checkbox label="全选"></el-checkbox>
262
+                </div>
263
+              </el-col>
264
+              <el-col :span="21">
265
+                <div style="margin-top: 6px;"></div>
266
+                <el-checkbox-group v-model="form.treatment_mode">
267
+                  <el-checkbox v-for="item in cure_types" :label="item.id" :key="item.id" :value="item.id">{{ item.name }}</el-checkbox>
268
+                </el-checkbox-group>
269
+              </el-col>
270
+            </div>
271
+          </el-col>
272
+        </el-row>
273
+        <!-- 反渗模式 -->
274
+        <el-row v-show="false && form.device_type === 2">
275
+          <el-col :span="8">
276
+            <div class="col_div">
277
+              <el-col :span="layout.first_line_label">
278
+                <span class="col_label_span">反渗模式:</span>
279
+              </el-col>
280
+              <el-col :span="layout.first_line_content">
281
+                <el-select v-model="form.reverse_osmosis_mode" clearable size="small">
282
+                  <el-option v-for="item in reverse_osmosises" :key="item.id" :label="item.name" :value="item.id"></el-option>
283
+                </el-select>
284
+              </el-col>
285
+            </div>
286
+          </el-col>
287
+        </el-row>
288
+      </div>
289
+
290
+
291
+
292
+
293
+      <div style="text-align: right; padding-right: 25px; padding-top: 10px; padding-bottom: 10px;">
294
+        <el-button type="primary" :disabled="$store.getters.xt_user.subscibe.state==3?true:false" @click="update_device_submit">保 存</el-button>
295
+      </div>
296
+    </div>
297
+  </el-dialog>
298
+</template>
299
+
300
+<script>
301
+  import DeviceInfoPane from './device_info/device_info_pane'
302
+  import DeviceInfoForm from './device_info/device_info_form'
303
+  import EditDeviceInfoForm from './device_info/edit_device_info_form'
304
+  import {getDeviceBaseInfo, createDevice, modifyDeviceBaseInfo} from '@/api/device/device'
305
+
306
+  export default {
307
+    name: "EditDeviceDialog",
308
+    components: {
309
+      EditDeviceInfoForm,
310
+      DeviceInfoForm,
311
+      DeviceInfoPane
312
+
313
+    },
314
+    data() {
315
+      return {
316
+        visible: false,
317
+        layout: {
318
+          first_line_label: 8,
319
+          first_line_content: 16,
320
+          second_line_label: 8,
321
+          second_line_content: 16,
322
+          third_line_label: 8,
323
+          third_line_content: 16,
324
+        },
325
+        device_id: 0,
326
+        form: {
327
+          device_type: 1,
328
+          serial_number: '',
329
+          name: '',
330
+          device_number_id: '',
331
+          manufacturer: '',
332
+          repair_factory: '',
333
+          model: '',
334
+          department: '',
335
+          department_number: '',
336
+          purchase_date: '',
337
+          install_date: '',
338
+          commissioning_date: '',
339
+          maintainer: '',
340
+          maintenance_call: '',
341
+          warranty_period: '',
342
+          device_status: '',
343
+          initial_use_times: '',
344
+          mark: '',
345
+          retirement_date: '',
346
+          retirement_reason: '',
347
+          service_life: '',
348
+          working_time: '',
349
+          treatment_mode: [], // 治疗模式
350
+          reverse_osmosis_mode: '', // 反渗模式
351
+        },
352
+        device_types: [
353
+          { id: 1, name: "透析机" },
354
+          // { id: 2, name: "水处理机" },
355
+        ],
356
+        cure_types: [ // 治疗模式
357
+          // { id:1, name: "HD" },
358
+          // { id:2, name: "HDF" },
359
+          // { id:3, name: "HD+HP" },
360
+          // { id:4, name: "HP" },
361
+          // { id:5, name: "HF" },
362
+          // { id:10, name: "HD" },
363
+          // { id:20, name: "HDF" },
364
+          // { id:30, name: "HD+HP" },
365
+          // { id:40, name: "HP" },
366
+          // { id:50, name: "HF" },
367
+          // { id:300, name: "HD+HP" },
368
+        ],
369
+        reverse_osmosises: [ // 反渗模式
370
+          // { id:1, name: "单级反渗" }
371
+        ],
372
+        device_states: [
373
+          { state: 1, name: '使用机' },
374
+          { state: 2, name: '备用机' },
375
+          { state: 3, name: '急诊机' },
376
+          { state: 4, name: '报废机' },
377
+        ],
378
+        retirement_reasons: [
379
+          { id: 1, reason: '报废原因1' },
380
+          { id: 2, reason: '报废原因2' },
381
+          { id: 3, reason: '报废原因3' },
382
+          { id: 4, reason: '报废原因4' },
383
+          { id: 5, reason: '其他' },
384
+        ]
385
+      }
386
+    },
387
+    props: {
388
+      device_numbers: {
389
+        type: Array,
390
+        require: true,
391
+      }
392
+    },
393
+    methods: {
394
+      _close: function(done) {
395
+        this.clear()
396
+        done()
397
+      },
398
+      clear: function() {
399
+
400
+      },
401
+      show() {
402
+        this.clear()
403
+        this.visible = true
404
+      },
405
+      hide() {
406
+        this.clear()
407
+        this.visible = false
408
+      },  clear() {
409
+        this.device_id = 0
410
+        this.form.device_type = 1
411
+        this.form.serial_number = ''
412
+        this.form.name = ''
413
+        this.form.device_number_id = ''
414
+        this.form.manufacturer = ''
415
+        this.form.repair_factory = ''
416
+        this.form.model = ''
417
+        this.form.department = ''
418
+        this.form.department_number = ''
419
+        this.form.purchase_date = 0
420
+        this.form.install_date = 0
421
+        this.form.commissioning_date = 0
422
+        this.form.maintainer = ''
423
+        this.form.maintenance_call = ''
424
+        this.form.warranty_period = ''
425
+        this.form.device_status = ''
426
+        this.form.initial_use_times = ''
427
+        this.form.mark = ''
428
+        this.form.retirement_date = 0
429
+        this.form.retirement_reason = ''
430
+        this.form.service_life = ''
431
+        this.form.working_time = ''
432
+        this.form.treatment_mode = []
433
+        this.form.reverse_osmosis_mode = ''
434
+      },
435
+      set_device_id: function(device_id) {
436
+        if (device_id > 0) {
437
+          this.device_id = device_id
438
+          getDeviceBaseInfo(device_id).then(rs => {
439
+            var resp = rs.data
440
+            if (resp.state === 1) {
441
+              this.form.device_type = resp.data.device_type
442
+              this.form.device_number_id = resp.data.device_number_id == 0 ? '' : resp.data.device_number_id
443
+
444
+              var device_info = resp.data.device_info
445
+              this.form.serial_number = device_info.serial_number
446
+              this.form.name = device_info.name
447
+              this.form.manufacturer = device_info.manufacturer
448
+              this.form.repair_factory = device_info.repair_factory
449
+              this.form.model = device_info.model
450
+              this.form.department = device_info.department
451
+              this.form.department_number = device_info.department_number
452
+              this.form.purchase_date = device_info.purchase_date == 0 ? '' : (device_info.purchase_date * 1000)
453
+              this.form.install_date = device_info.install_date == 0 ? '' : (device_info.install_date * 1000)
454
+              this.form.commissioning_date = device_info.commissioning_date == 0 ? '' : (device_info.commissioning_date * 1000)
455
+              this.form.maintainer = device_info.maintainer
456
+              this.form.maintenance_call = device_info.maintenance_call
457
+              this.form.warranty_period = device_info.warranty_period
458
+              this.form.device_status = device_info.device_status == 0 ? '' : device_info.device_status
459
+              this.form.initial_use_times = device_info.initial_use_times == 0 ? '' : device_info.initial_use_times
460
+              this.form.mark = device_info.mark
461
+              this.form.retirement_date = device_info.retirement_date == 0 ? '' : (device_info.retirement_date * 1000)
462
+              this.form.retirement_reason = device_info.retirement_reason
463
+              this.form.service_life = device_info.service_life == 0 ? '' : device_info.service_life
464
+              this.form.working_time = device_info.working_time == 0 ? '' : device_info.working_time
465
+              if (this.form.device_type == 1) {
466
+                // treatment_mode: []
467
+
468
+              } else if (this.form.device_type == 2) {
469
+                // reverse_osmosis_mode: ''
470
+              }
471
+
472
+            } else {
473
+              this.$message.error(resp.msg)
474
+            }
475
+          })
476
+
477
+        } else {
478
+          this.clear()
479
+        }
480
+      },
481
+      create_device_submit() {
482
+        var checkErr = this._check_submit()
483
+        if (checkErr.length > 0) {
484
+          this.$message.error(checkErr)
485
+          return
486
+        }
487
+
488
+        var params = new Object()
489
+        params.type = this.form.device_type
490
+        params.serial_number = this.form.serial_number
491
+        params.name = this.form.name
492
+        params.device_number_id = this.form.device_number_id
493
+        params.manufacturer = this.form.manufacturer
494
+        params.repair_factory = this.form.repair_factory
495
+        params.model = this.form.model
496
+        params.department = this.form.department
497
+        params.department_number = this.form.department_number
498
+        params.purchase_date = typeof this.form.purchase_date == 'string' ? 0 : (this.form.purchase_date / 1000)
499
+        params.install_date = typeof this.form.install_date == 'string' ? 0 : (this.form.install_date / 1000)
500
+        params.commissioning_date = typeof this.form.commissioning_date == 'string' ? 0 : (this.form.commissioning_date / 1000)
501
+        params.maintainer = this.form.maintainer
502
+        params.maintenance_call = this.form.maintenance_call
503
+        params.warranty_period = this.form.warranty_period
504
+        params.device_status = this.form.device_status
505
+        params.initial_use_times = this.form.initial_use_times
506
+        params.mark = this.form.mark
507
+        params.retirement_date = typeof this.form.retirement_date == 'string' ? 0 : (this.form.retirement_date / 1000)
508
+        params.retirement_reason = this.form.retirement_reason
509
+        params.service_life = this.form.service_life
510
+        params.working_time = this.form.working_time
511
+        // params.treatment_mode = this.form.treatment_mode
512
+        // params.reverse_osmosis_mode = this.form.reverse_osmosis_mode
513
+        createDevice(params).then(rs => {
514
+          var resp = rs.data
515
+          if (resp.state === 1) {
516
+            var device = resp.data.device
517
+            this.$emit('did_create', device)
518
+            this.$message({message: "创建成功", type: "success"})
519
+
520
+          } else {
521
+            this.$message.error(resp.msg)
522
+          }
523
+        })
524
+      },
525
+      update_device_submit() {
526
+        var checkErr = this._check_submit()
527
+        if (checkErr.length > 0) {
528
+          this.$message.error(checkErr)
529
+          return
530
+        }
531
+
532
+        var params = new Object()
533
+        params.device_id = this.device_id
534
+        params.serial_number = this.form.serial_number
535
+        params.name = this.form.name
536
+        params.device_number_id = this.form.device_number_id
537
+        params.manufacturer = this.form.manufacturer
538
+        params.repair_factory = this.form.repair_factory
539
+        params.model = this.form.model
540
+        params.department = this.form.department
541
+        params.department_number = this.form.department_number
542
+        params.purchase_date = typeof this.form.purchase_date == 'string' ? 0 : (this.form.purchase_date / 1000)
543
+        params.install_date = typeof this.form.install_date == 'string' ? 0 : (this.form.install_date / 1000)
544
+        params.commissioning_date = typeof this.form.commissioning_date == 'string' ? 0 : (this.form.commissioning_date / 1000)
545
+        params.maintainer = this.form.maintainer
546
+        params.maintenance_call = this.form.maintenance_call
547
+        params.warranty_period = this.form.warranty_period
548
+        params.device_status = this.form.device_status
549
+        params.initial_use_times = this.form.initial_use_times
550
+        params.mark = this.form.mark
551
+        params.retirement_date = typeof this.form.retirement_date == 'string' ? 0 : (this.form.retirement_date / 1000)
552
+        params.retirement_reason = this.form.retirement_reason
553
+        params.service_life = this.form.service_life
554
+        params.working_time = this.form.working_time
555
+        // params.treatment_mode = this.form.treatment_mode
556
+        // params.reverse_osmosis_mode = this.form.reverse_osmosis_mode
557
+        modifyDeviceBaseInfo(params).then(rs => {
558
+          var resp = rs.data
559
+          if (resp.state === 1) {
560
+            var device = resp.data.device
561
+            this.$emit('did_update', device)
562
+            this.$message({message: "保存成功", type: "success"})
563
+
564
+          } else {
565
+            this.$message.error(resp.msg)
566
+          }
567
+        })
568
+      },
569
+      _check_submit() {
570
+        if (this.form.serial_number.length == 0) {
571
+          return "请填写设备序列号"
572
+        }
573
+        if (this.form.device_type !== 1 && this.form.device_type !== 2) {
574
+          return "请选择设备类型"
575
+        }
576
+        if (this.form.name.length == 0) {
577
+          return "请填写设备名"
578
+        }
579
+        if (this.form.maintenance_call.length > 0) {
580
+          if (/^(0\d{2,3}-?\d{7,8}$)|(1\d{10}$)/.test(this.form.maintenance_call) == false) {
581
+            return "联系电话格式错误"
582
+          }
583
+        }
584
+        return ""
585
+      }
586
+
587
+    }
588
+  }
589
+
590
+</script>
591
+
592
+<style scoped>
593
+  .main {
594
+    width: 100%;
595
+  }
596
+  .main .el-row {
597
+    /* border-bottom: 1px solid rgb(233, 233, 233); */
598
+    /* padding-left: 5px; */
599
+    padding-right: 5px;
600
+    padding-top: 10px;
601
+    padding-bottom: 10px;
602
+  }
603
+  .col_div {
604
+    width: 100%;
605
+  }
606
+  .col_label_span {
607
+    padding-left: 0px;
608
+    padding-right: 5px;
609
+    font-size: 14px;
610
+    height: 32px;
611
+    line-height: 32px;
612
+    /* display: block; */
613
+    display: inline-block;
614
+    width: 100%;
615
+    text-align: right;
616
+    /* padding-right: 5px; */
617
+  }
618
+  .required_span {
619
+    color: red;
620
+  }
621
+
622
+  .el-checkbox {
623
+    margin-bottom: 5px;
624
+  }
625
+  .el-checkbox+.el-checkbox {
626
+    margin-left: 15px;
627
+  }
628
+</style>

+ 57 - 53
src/xt_pages/device/main.vue 查看文件

@@ -1,73 +1,77 @@
1 1
 <template>
2
-<div class="main-contain">
3
-     <div class="position">
4
-       <bread-crumb :crumbs='crumbs'></bread-crumb>
2
+  <div class="main-contain">
3
+    <div class="position">
4
+      <bread-crumb :crumbs='crumbs'></bread-crumb>
5
+      <el-button size="small" icon="el-icon-circle-plus-outline"
6
+                 :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
7
+                 @click="add_device_action">新增
8
+      </el-button>
5 9
 
6
-     </div>
10
+
11
+    </div>
7 12
     <div class="app-container">
8
-        <el-row :gutter="15">
9
-            <el-col :span="7">
10
-                <device-list ref="device_list" :zones="zones" :groups="groups" :device_numbers="device_numbers" @did_select_device="did_select_device"></device-list>
11
-            </el-col>
12
-            <el-col :span="17">
13
-                <device-detail ref="device_detail" :device_numbers="device_numbers" @did_update_device="did_update_device"></device-detail>
14
-            </el-col>
15
-        </el-row>
13
+      <device-list ref="device_list" :zones="zones" :groups="groups" :device_numbers="device_numbers"
14
+                   @did_select_device="did_select_device"></device-list>
15
+      <!--<el-col :span="17">-->
16
+      <!--<device-detail ref="device_detail" :device_numbers="device_numbers" @did_update_device="did_update_device"></device-detail>-->
17
+      <!--</el-col>-->
16 18
     </div>
17
-</div>
19
+  </div>
18 20
 
19 21
 </template>
20 22
 
21 23
 <script>
22
-import DeviceList from './components/device_list'
23
-import DeviceDetail from './components/device_detail'
24
-import {getDeviceInitData} from '@/api/device/device'
25
-import BreadCrumb from "@/xt_pages/components/bread-crumb";
24
+  import DeviceList from './components/device_list'
25
+  import DeviceDetail from './components/device_detail'
26
+  import { getDeviceInitData } from '@/api/device/device'
27
+  import BreadCrumb from '@/xt_pages/components/bread-crumb'
26 28
 
27
-export default {
28
-    name: "DeviceManage",
29
+  export default {
30
+    name: 'DeviceManage',
29 31
     components: {
30
-        DeviceList,
31
-        DeviceDetail,
32
-        BreadCrumb
32
+      DeviceList,
33
+      DeviceDetail,
34
+      BreadCrumb
33 35
     },
34 36
     data() {
35
-        return {
36
-          crumbs: [
37
-            { path: false, name: '设备管理' },
38
-            { path: '/device/main', name: '透析机管理' },
39
-          ],
40
-            zones: [],
41
-            groups: [],
42
-            device_numbers: [],
43
-        }
37
+      return {
38
+        crumbs: [
39
+          { path: false, name: '设备管理' },
40
+          { path: '/device/main', name: '透析机管理' }
41
+        ],
42
+        zones: [],
43
+        groups: [],
44
+        device_numbers: []
45
+      }
44 46
     },
45 47
     created() {
46
-        getDeviceInitData().then(rs => {
47
-            var resp = rs.data
48
-            if (resp.state === 1) {
49
-                // console.log(resp)
50
-                this.zones.push(...resp.data.zones)
51
-                this.groups.push(...resp.data.groups)
52
-                this.device_numbers.push(...resp.data.numbers)
48
+      getDeviceInitData().then(rs => {
49
+        var resp = rs.data
50
+        if (resp.state === 1) {
51
+          // console.log(resp)
52
+          this.zones.push(...resp.data.zones)
53
+          this.groups.push(...resp.data.groups)
54
+          this.device_numbers.push(...resp.data.numbers)
53 55
 
54
-            } else {
55
-                this.$message.error(resp.msg)
56
-            }
57
-        })
56
+        } else {
57
+          this.$message.error(resp.msg)
58
+        }
59
+      })
58 60
     },
59 61
     methods: {
60
-        did_select_device: function(device) {
61
-            if (device) {
62
-                this.$refs.device_detail.set_device(device.id, device.device_type)
63
-            } else {
64
-                this.$refs.device_detail.set_device(0, 1)
65
-            }
66
-
67
-        },
68
-        did_update_device: function(device) {
69
-            this.$refs.device_list.update_device(device)
62
+      did_select_device: function(device) {
63
+        if (device) {
64
+          this.$refs.device_detail.set_device(device.id, device.device_type)
65
+        } else {
66
+          this.$refs.device_detail.set_device(0, 1)
70 67
         }
68
+
69
+      },
70
+      did_update_device: function(device) {
71
+        this.$refs.device_list.update_device(device)
72
+      }, add_device_action: function() {
73
+        this.$refs.device_list.add_device_action()
74
+      }
71 75
     }
72
-}
76
+  }
73 77
 </script>