qinxianzhangyao
2024-03-15 ac6766c11f8a2b8de903b58c13a8f206fa01dccd
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="cusName">
        <el-input v-model="queryParams.cusName" placeholder="请输入姓名" clearable style="width:120px"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="性别" prop="cusSex">
        <el-select v-model="queryParams.cusSex" placeholder="请选择性别" clearable style="width:120px">
          <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value"/>
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item label="出生日期" prop="cusBrithday">
        <el-date-picker clearable v-model="queryParams.cusBrithday" type="date" value-format="yyyy-MM-dd" placeholder="请选择出生日期"></el-date-picker>
      </el-form-item> -->
      <!-- <el-form-item label="现住址" prop="cusAddr">
        <el-input v-model="queryParams.cusAddr" placeholder="请输入现居住地址" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item> -->
      <el-form-item label="联系电话" prop="cusPhone">
        <el-input v-model="queryParams.cusPhone" placeholder="请输入联系电话" style="width:140px" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="邮政编码" prop="cusPostcode">
        <el-input v-model="queryParams.cusPostcode" placeholder="请输入邮政编码" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item> -->
      <!-- <el-form-item label="邮箱" prop="cusEmail">
        <el-input v-model="queryParams.cusEmail" placeholder="请输入邮箱" clearable @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="索引卡号" prop="indexCard">
        <el-input
          v-model="queryParams.indexCard"
          placeholder="请输入索引卡号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="民族" prop="cusNational">
        <el-select v-model="queryParams.cusNational" placeholder="请选择民族" clearable>
          <el-option
            v-for="dict in dict.type.dict_user_national"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item label="婚姻状况" prop="cusMarryStatus">
        <el-select v-model="queryParams.cusMarryStatus" placeholder="请选择婚姻状况" clearable>
          <el-option
            v-for="dict in dict.type.dict_user_marry"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item> -->
      <el-form-item label="身份证号" prop="cusIdcard">
        <el-input v-model="queryParams.cusIdcard" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="介绍人" prop="cusIntroduce">
        <el-input v-model="queryParams.cusIntroduce" placeholder="请输入介绍人" clearable style="width:140px"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="体检次数" prop="cusNumber">
        <el-input
          v-model="queryParams.cusNumber"
          placeholder="请输入体检次数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item label="体检次数" prop="cusNumber">
        <el-input v-model="queryParams.cusNumber" placeholder="输入整数" clearable style="width:100px"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="是否VIP" prop="cusIsvip">
        <el-select v-model="queryParams.cusIsvip" placeholder="选择VIP" clearable style="width:100px">
          <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
 
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['hosp:customer:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['hosp:customer:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['hosp:customer:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['hosp:customer:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
 
    <el-table border v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="40px" align="center" fixed="left" />
      <el-table-column label="序号" align="center" prop="newID" fixed="left" :show-overflow-tooltip="true" width="50px" />
      <el-table-column label="姓名" align="center" prop="cusName" width="90px" fixed="left"
        :show-overflow-tooltip="true" />
      <el-table-column label="性别" align="center" prop="cusSex" :show-overflow-tooltip="true" width="60px">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.cusSex" />
        </template>
      </el-table-column>
      <el-table-column label="出生日期" align="center" prop="cusBrithday" width="100px" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.cusBrithday, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="身份证号" align="center" prop="cusIdcard" width="170px" :show-overflow-tooltip="true" />
      <el-table-column label="联系电话" align="center" prop="cusPhone" width="110px" :show-overflow-tooltip="true" />
      <el-table-column label="现住址" align="center" prop="cusAddr" width="180px" :show-overflow-tooltip="true" />
 
      <el-table-column label="邮政编码" align="center" prop="cusPostcode" width="80px" :show-overflow-tooltip="true" />
      <el-table-column label="邮箱" align="center" prop="cusEmail" width="170px" :show-overflow-tooltip="true" />
      <el-table-column label="民族" align="center" prop="cusNational" width="80px" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.dict_user_national" :value="scope.row.cusNational" />
        </template>
      </el-table-column>
      <el-table-column label="婚姻状况" align="center" prop="cusMarryStatus" :show-overflow-tooltip="true" width="80px">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.dict_user_marry" :value="scope.row.cusMarryStatus" />
        </template>
      </el-table-column>
 
      <el-table-column label="介绍人" align="center" prop="cusIntroduce" width="90px" :show-overflow-tooltip="true" />
      <el-table-column label="次数" align="center" prop="cusNumber" width="55px" :show-overflow-tooltip="true" />
      <el-table-column label="VIP" align="center" prop="cusIsvip" width="55px" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.cusIsvip" />
        </template>
      </el-table-column>
      <el-table-column label="索引卡号" align="center" prop="indexCard" :show-overflow-tooltip="true" />
      <el-table-column fixed="right" label="操作" align="center" width="90px" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['hosp:customer:edit']" title="修改"></el-button>
          <el-button size="mini" type="text" icon="el-icon-share" @click="handleDetails(scope.row)"
            v-hasPermi="['hosp:customer:edit']" title="详情"></el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['hosp:customer:remove']" title="删除"></el-button>
        </template>
      </el-table-column>
    </el-table>
 
    <div class="pag">
      <div class="pag1">
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize" @pagination="getList" />
      </div>
    </div>
 
    <!-- 添加或修改信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px" :inline="true">
        <el-form-item label="姓名" prop="cusName">
          <el-input v-model="form.cusName" placeholder="请输入姓名" style="width: 200px" />
        </el-form-item>
        <el-form-item label="性别" prop="cusSex">
          <el-select v-model="form.cusSex" placeholder="请选择性别" style="width: 200px">
            <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
              :value="parseInt(dict.value)"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="身份证号" prop="cusIdcard">
          <el-input v-model="form.cusIdcard" placeholder="请输入身份证号" style="width: 200px" />
        </el-form-item>
        <el-form-item label="出生日期" prop="cusBrithday">
          <el-date-picker clearable v-model="form.cusBrithday" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择出生日期" style="width: 200px">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="现住址" prop="cusAddr">
          <el-input v-model="form.cusAddr" placeholder="请输入现居住地址" style="width: 200px" />
        </el-form-item>
        <el-form-item label="联系电话" prop="cusPhone">
          <el-input v-model="form.cusPhone" placeholder="请输入联系电话" style="width: 200px" />
        </el-form-item>
        <!-- <el-form-item label="账号密码" prop="cusPassword">
          <el-input v-model="form.cusPassword" placeholder="请输入账号密码" style="width: 220px" />
        </el-form-item> -->
        <!-- <el-form-item label="邮政编码" prop="cusPostcode">
          <el-input v-model="form.cusPostcode" placeholder="请输入邮政编码"  />
        </el-form-item> -->
        <el-form-item label="邮箱" prop="cusEmail">
          <el-input v-model="form.cusEmail" placeholder="请输入邮箱" style="width: 200px" />
        </el-form-item>
        <!-- <el-form-item label="索引卡号" prop="indexCard">
          <el-input v-model="form.indexCard" placeholder="请输入索引卡号" style="width: 220px" />
        </el-form-item> -->
        <el-form-item label="民族" prop="cusNational">
          <el-select v-model="form.cusNational" placeholder="请选择民族" style="width: 200px" filterable>
            <el-option v-for="dict in dict.type.dict_user_national" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="婚姻状况" prop="cusMarryStatus">
          <el-select v-model="form.cusMarryStatus" placeholder="请选择婚姻状况" style="width: 200px">
            <el-option v-for="dict in dict.type.dict_user_marry" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
 
        <el-form-item label="介绍人" prop="cusIntroduce">
          <el-input v-model="form.cusIntroduce" placeholder="请输入介绍人" style="width: 200px" />
        </el-form-item>
        <el-form-item label="是否VIP" prop="cusIsvip">
          <el-select v-model="form.cusIsvip" placeholder="请选择是否VIP" style="width: 200px">
            <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
 
    <!-- 点击右边弹出层 -->
    <el-drawer :visible.sync="drawer" :with-header="false" size="70%" :before-close="handleClose">
      <div style="text-align: center;margin: 10px 0;">
        <span>健康记录</span>
      </div>
      <template>
        <el-tabs v-model="activeName" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px;">
          <el-tab-pane label="体检记录" name="first">
            <el-row>
              <el-col :span="14">
                <el-table ref="selectChargeRuleRef" v-loading="loading" :data="detailsList" border height="680px"
                  style="width: 96%; margin: 10px 10px" @selection-change="selectChargeRule">
                  <el-table-column type="selection" width="40px" align="center" fixed="left" />
                  <!-- <el-table-column prop="tjNum" label="体检号" width="155" align="center"></el-table-column> -->
                  <el-table-column prop="tjTime" label="体检时间" width="155" align="center"></el-table-column>
                  <el-table-column prop="tjProName" label="体检项目" align="center"></el-table-column>
                  <el-table-column prop="userName" label="总检医师" width="75" align="center"></el-table-column>
                  <el-table-column prop="paidIn" label="体检费用" width="75" align="center"></el-table-column>
                </el-table>
              </el-col>
              <el-col :span="10">
                <div>
                  <iframe id="printIframe" :src="url" frameborder="0" style="width: 100%;height: 680px;"></iframe>
                </div>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="门诊记录" name="second">
            <el-row>
              <el-col :span="14">
                <el-table ref="selectChargeRuleRef" v-loading="loading" :data="detailsList" border height="680px"
                  style="width: 96%; margin: 10px 10px" @selection-change="selectChargeRule">
                  <el-table-column type="selection" width="40px" align="center" />
                  <el-table-column prop="project.proScope" label="序号"></el-table-column>
                  <el-table-column prop="project.proScope" label="就诊时间" align="center"></el-table-column>
                  <el-table-column prop="project.proScope" label="就诊科室" align="center"></el-table-column>
                  <el-table-column prop="project.proScope" label="接诊医师" align="center"></el-table-column>
                  <el-table-column prop="project.proScope" label="就诊总费用" align="center"></el-table-column>
                </el-table>
              </el-col>
              <el-col :span="10">
                <quill-editor v-model="form.content" :options="editorOption" style="height:680px;width:96%">
                </quill-editor>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="住院记录" name="third">
            <el-row>
              <el-col :span="14">
            <el-table ref="selectChargeRuleRef" v-loading="loading" :data="detailsList" border height="680px"
              style="width: 96%; margin: 10px 10px" @selection-change="selectChargeRule">
              <el-table-column type="selection" width="40px" align="center" />
              <el-table-column prop="project.proScope" label="序号" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="入院时间" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="出院时间" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="住院天数" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="住院科室" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="主治医师" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="主要诊断" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="是否手术" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="离院方式" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="住院总费用" align="center"></el-table-column>
            </el-table>
          </el-col>
              <el-col :span="10">
                <quill-editor v-model="form.content" :options="editorOption" style="height:680px;width:96%">
                </quill-editor>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="手术记录" name="fourth">
            <el-table v-loading="loading" :data="detailsList" border height="460px"
              style="width: 96%; margin: 10px 10px">
              <el-table-column prop="project.proScope" label="序号" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="开始时间" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="结束时间" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="手术名称" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="手术编码" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="手术级别" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="术者" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="一助" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="二助" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="麻醉方式" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="麻醉开始时间" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="麻醉结束时间" align="center"></el-table-column>
              <el-table-column prop="project.proScope" label="麻醉医师" align="center"></el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </template>
 
    </el-drawer>
  </div>
</template>
 
<script>
import { quillEditor } from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
 
import {
  listCustomer,
  getCustomer,
  delCustomer,
  addCustomer,
  updateCustomer,
  getHistryTjOrderByCusIdCard
} from "@/api/hosp/customer";
import { getPdf } from "@/api/hosp/order";
 
export default {
  name: "Customer",
  components: { quillEditor },
  dicts: [
    "dict_user_national",
    "dict_user_marry",
    "sys_yes_no",
    "sys_user_sex",
  ],
  data() {
    let checkPhoneNum = (rule, value, callback) => {
      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
      if (value == "" && value == undefined && !value) {
        return callback('');
      } else if (value != undefined && value != "") {
        return callback();
      } else if (!patter.test(value)) {
        return callback('');
      }
    };
    return {
      editorOption: {
        placeholder: '请在这里输入',
        modules: {
          toolbar: [
            ['bold', 'italic', 'underline', 'strike'], //加粗,斜体,下划线,删除线
            ['blockquote', 'code-block'], //引用,代码块
            [{ header: 1 }, { header: 2 }], // 标题,键值对的形式;1、2表示字体大小
            [{ list: 'ordered' }, { list: 'bullet' }], //列表
            [{ script: 'sub' }, { script: 'super' }], // 上下标
            [{ indent: '-1' }, { indent: '+1' }], // 缩进
            [{ direction: 'rtl' }], // 文本方向
            [{ size: ['small', false, 'large', 'huge'] }], // 字体大小
            [{ header: [1, 2, 3, 4, 5, 6, false] }], //几级标题
            [{ color: [] }, { background: [] }], // 字体颜色,字体背景颜色
            [{ font: [] }], //字体
            [{ align: [] }], //对齐方式
            ['clean'], //清除字体样式
            ['image', 'video'], //上传图片、上传视频
          ],
        },
      },
 
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      drawer: false,
      detailsList: [],
      activeName: 'first',
      // 非多个禁用
      multiple: true,
      url: "",
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 信息表格数据
      customerList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cusName: null,
        cusSex: null,
        cusBrithday: null,
        cusAddr: null,
        cusPhone: null,
        cusPostcode: null,
        cusEmail: null,
        indexCard: null,
        cusNational: null,
        cusMarryStatus: null,
        cusIdcard: null,
        cusIntroduce: null,
        cusNumber: null,
        cusIsvip: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        cusName: [{ required: true, validator: checkPhoneNum, trigger: "blur" }],
        cusSex: [
          { required: true, validator: checkPhoneNum, trigger: "change" },
        ],
        cusBrithday: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        cusAddr: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        cusPhone: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        cusPassword: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        // cusNational: [
        //   { required: true, message: "民族不能为空", trigger: "change" }
        // ],
        cusIdcard: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        deleted: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询信息列表 */
    getList() {
      this.loading = true;
      listCustomer(this.queryParams).then((response) => {
        this.customerList = response.rows;
        response.rows.forEach((item, index) => {
          item.newID =
            (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
            index +
            1;
        });
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        cusId: null,
        cusName: null,
        cusSex: null,
        cusBrithday: null,
        cusAddr: null,
        cusPhone: null,
        cusPassword: null,
        cusPostcode: null,
        cusEmail: null,
        indexCard: null,
        cusNational: null,
        cusMarryStatus: null,
        cusIdcard: null,
        cusIntroduce: null,
        cusNumber: null,
        cusIsvip: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        deleted: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.cusId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "客户信息维护";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const cusId = row.cusId || this.ids;
      getCustomer(cusId).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "客户信息维护";
      });
    },
 
    // 详情
    handleDetails(row) {
      this.drawer = true
      let cusId = row.cusId
      getHistryTjOrderByCusIdCard(cusId).then(res => {
        this.detailsList = res.data
      })
    },
 
    selectChargeRule(val) {
      if (val.length > 1) {
        this.$refs.selectChargeRuleRef.clearSelection()
        this.$refs.selectChargeRuleRef.toggleRowSelection(val[val.length - 1])
      }
      let selectedRule = val[val.length - 1]
      if (this.activeName == "first") {
        const flag = true;
        let tjNumber = selectedRule.tjNum
        // let tjNumber = "10001240305100029"
        getPdf(tjNumber, flag).then((response) => {
          if (response.size === 0) {
            const loading = this.$loading({
              lock: true,
              text: "Loading",
              spinner: "el-icon-loading",
              background: "rgba(0, 0, 0, 0.7)",
            });
            setTimeout(() => {
              loading.close();
            }, 3000);
            // this.$message.msgSuccess("报告正在生成,请两分钟后预览!");
            this.$message({
              message: "报告正在生成,请两分钟后预览!",
              type: "warning",
            });
          } else {
            this.dialogVisible = true;
            this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
          }
        });
      } else if (this.activeName == "second") {
 
      } else if (this.activeName == "third") {
 
      }
 
    },
 
 
    handleClose() {
      this.$tab.refreshPage();
    },
    handleTabClick() {
      console.log(this.activeName)
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.cusId != null) {
            updateCustomer(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addCustomer(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const cusIds = row.cusId || this.ids;
      this.$modal
        .confirm('是否确认删除信息编号为"' + cusIds + '"的数据项?')
        .then(function () {
          return delCustomer(cusIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "hosp/order/export",
        {
          ...this.queryParams,
        },
        `customer_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style scoped>
.pag {
  width: 100%;
  display: flex;
  justify-content: center;
}
 
.pag1 {
  width: 30%;
}
 
.dialog-footer {
  display: flex;
  justify-content: center;
}
</style>