tom
2023-12-06 9e968679ed2e6937aeb7b50a6c450d5d19251f42
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
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
<!doctype html>
<html>
    <head>
        <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
        <title>赠药政策备案表</title>
 
        <script src="../../../../jsnew/elementDefault.js?v=20220425"></script>
        <script src="../../../../jsnew/vue/vue.js"></script>
        <script src="../../../../jsnew/vue/element-ui/element-ui_15/index.js"></script>
        <script src="../../../../jsnew/myelement.js?v=20220425"></script>
        <script src="../../../../jsnew/page.js?v=20220425"></script>
        <!-- <script src="../../../../setting.js"></script> -->
        
        <link href="../../../../jsnew/vue/element-ui/element-ui_15/theme-chalk/index.css" rel="stylesheet">
        <link href="../../../../jsnew/myelement.css?v=20220425" rel="stylesheet">
        <link href="../../../../css/iconfont.css" rel="stylesheet">
        <link href="../../../../jsnew/page.css?v=20220425" rel="stylesheet">
        <link href="//at.alicdn.com/t/font_2374495_13ltsxm2eor.css" rel="stylesheet">
    </head>
    
    <body style="margin: 0px;">
        <div v-cloak id="vbody">
            <div id="page_root">
                <div class="topbar">
                    <span>{{title}}</span>
                    
                    <div style="margin-right: 18px;float: right;">
                        <el-button-group style="margin-left: 3px">
                            <el-button @click="exportList">导 出</el-button>
                        </el-button-group>
                    </div>
                </div>
            
                <div class="topbar-line">
                    <div class="query-bar">
                        <h-form-filter ref="form1" 
                            :form-attr="filterAttr" 
                            :table-fields="filterFields" 
                            :form-data="filterObj" 
                            :table-field-click="filterfieldClick"
                            :isdraggableorder="false"
                            
                            v-on:on-query="onQuery"
                            v-on:on-init-query="onInitFilter"
                            v-on:order-fields="orderFilterFields"
                            >
                        </h-form-filter>
                    </div>
                </div>
            
                <div class="h_dialog__body">
                    <h-table
                        v-if="isRefresh"
                        ref="table1"
                        :table-fields="tableFields" 
                        :table-data="tableData" 
                        :is-edit-table-data="isEditTableData"
                        :pagesize="pagesize"
                        :pagenum="pagenum"
                        :total="total"
                        :table-height="tableHeight"
                        :table-field-click="tablefieldClick"
                        :is-show-index="false"
                        :tableloading="tableloading"
                        :isdraggableorder="true"
                        
                        v-on:get-data="getData"
                        v-on:edit-data="editData"
                        v-on:del-data="delData"
                        v-on:order-fields="orderTableFields"
                    >
                    </h-table>
                </div>
            </div>
            
            <el-dialog title="签收协议" :visible.sync="reasonvisible" height="50%">
                <el-form label-width="100px">
                  <el-form-item label="签收协议号">
                    <el-input v-model="textarea2_no" placeholder="输入协议号" style="width: 100%;"></el-input>
                  </el-form-item>
                  <el-form-item label="备注">
                    <el-input
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 10}"
                      placeholder="备注"
                      v-model="textarea2" style="width: 100%;">
                    </el-input>
                  </el-form-item>
                </el-form>
                
                <div  class="dialog-footer" style="float: right;margin-top: 30px;">
                  <el-button type="default" @click="reasonvisible = false">取 消</el-button>
                  <el-button type="primary"  @click="signingAgreement">确 定</el-button>
                </div>
            </el-dialog>
        </div>
        
        <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
            <div class="spinner">
              <div class="cube1"></div>
              <div class="cube2"></div>
            </div>
        </div>
 
        <script type="text/javascript">
            function initVue() {
                new ListVue({
                    el: "#vbody",
                    data: {
                        dataname: "agm_record_zyzc",
                        dataurl: "rootjemin/data/getEntitySet",
                        title: "赠药政策备案表",
                        filterTxt: " type = 'zyzc' ",
                        orderby: "ar.update_time desc",
                        
                        default_filterFields: [
                            {isshow: "T", field: "detail_no", name: "明细编码", filterfield:"", filteroperator: "like", type: ""},
                        ],
                        default_tableFields: [
                            {isshow: "T", field: "apply_date", name: "申请日期", type:"span", required: true},
                            {isshow: "T", field: "employee_code", name: "申请人工号", type:"span", width: "150", required: true },
                            {isshow: "T", field: "apply_name", name: "申请人", type:"span", required: true},
                            {isshow: "T", field: "department", name: "所属部门", type:"span", required: true},
                            {isshow: "T",field: "begin_date", name: "有效期开始", width: "100", type:"date", formatter: "formatter_date", required: true},
                            {isshow: "T",field: "end_date", name: "有效期结束", width: "100", type:"date", formatter: "formatter_date", required: true},
                            {isshow: "T", field: "customer_code", name: "商业编码", width: "150", type: "span", required: true},
                            {isshow: "T", field: "eas_code", name: "EAS编码", width: "150", type:"span", required: true},
                            {isshow: "T", field: "customer_name", name: "商业名称", width: "200", type:"popup", required: true},
                            {isshow: "T", field: "province", name: "省份", width: "100", type: "span", required: true},
                            {isshow: "T", field: "delivery_code", name: "发货主体编号", width: "150", type:"span",},
                            {isshow: "T", field: "delivery_name", name: "发货主体名称", width: "200", type:"span",},
                            {isshow: "T", field: "customer_org_name", name: "客户主体名称", width: "200", type: "span", align: "left", required: true},
                            {isshow: "T", field: "com_attr", name: "商业属性", width: "100", type: "span", align: "left", required: true},
                            {isshow: "T", field: "cus_type", name: "客户身份", width: "100", type: "span", align: "left", required: true},
                            {isshow: "T", field: "customer_person_code", name: "商业操作人编码", width: "150", type:"span", required: true},
                            {isshow: "T", field: "customer_person_name", name: "商业操作人名称", width: "150", type:"span", required: true},
                            {isshow: "T", field: "adjust_person_code", name: "实际划拨人编码", width: "150", type:"span", required: true},
                            {isshow: "T", field: "adjust_person_name", name: "实际划拨人名称", width: "150", type:"popup", required: true},
                            {isshow: "T", field: "product_code", name: "药品编号", width: "150", type:"span", required: true},
                            {isshow: "T", field: "product_name", name: "药品名称", width: "200", type: "popup", align: "left", required: true},
                            {isshow: "T", field: "spec", name: "药品规格", width: "100", type: "span", required: true},
                            {isshow: "T", field: "unit", name: "药品单位", width: "100", type: "span", required: true},
                            {isshow: "T", field: "org_name_code", name: "管理主体编码", width: "150", type: "span", align: "left", required: true},
                            {isshow: "T", field: "org_name", name: "管理主体名称", width: "200", type: "select", align: "left", required: true},
                            {isshow: "T", field: "department_code", name: "业务部门编码", width: "150", type: "span", align: "left", required: true},
                            {isshow: "T", field: "department_name", name: "业务部门名称", width: "200", type: "popup", align: "left", required: true},
                            {isshow: "T", field: "pay_type", name: "业务结算类型", width: "150", type: "select", align: "left", required: true},
                            {isshow: "T", field: "con_type", name: "控制类型", width: "100", type: "select", align: "left", required: false},
                            {isshow: "T", field: "pay_days", name: "付款天数", width: "100", type: "span", align: "left", required: false},
                            {isshow: "T", field: "delivery_days", name: "在途天数", width: "100", type: "span", align: "left", required: false},
                            {isshow: "T", field: "pay_time", name: "账期天数", width: "100", align: "right", type: "span", required: false},
                            {isshow: "T", field: "target_type", name: "中标价类型", width: "100", type: "select", formatter: "formatter_money", align: "right", required: false},
                            {isshow: "T", field: "price_target", name: "中标价", width: "100", type: "span", formatter: "formatter_money", align: "right", required: false},
                            {isshow: "T", field: "price2", name: "开票限价", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "price3", name: "供货价", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "price4", name: "分销价", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "price5", name: "零售价", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "price6", name: "结算价", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "delivery_fee", name: "配送费", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "delivery_rate", name: "配送费率", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "com_rate", name: "商业扣率", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "cash_time", name: "兑付时间", width: "100", type: "select", formatter: "formatter_money", align: "right", required: false},
                            {isshow: "T", field: "return_type", name: "商返类型", width: "100", type: "select", formatter: "formatter_money", align: "right", required: false},
                            {isshow: "T", field: "current_customer_person11", name: "当期票折系数", width: "100", type:"span", required: true},
                            {isshow: "T", field: "current_discount_amount", name: "当期票折金额", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "withdraw_customer_person11", name: "回笼履约系数", width: "100", type:"span", required: true},
                            {isshow: "T", field: "withdraw_discount_amount", name: "回笼履约金额", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "withdraw_customer_person12", name: "回笼履约扣留系数", width: "150", type:"span", required: true},
                            {isshow: "T", field: "customer_person11", name: "基础折让系数", width: "100", type:"span", required: true},
                            {isshow: "T", field: "discount_amount", name: "基础折让金额", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "product_code11", name: "商业规范操作折让系数", width: "150", type:"span", required: true},
                            {isshow: "T", field: "spec11", name: "商业规范操作折让金额", width: "150", type: "span", required: true},
                            {isshow: "T", field: "product_code22", name: "调拨折让系数", width: "100", type:"span", required: true},
                            {isshow: "T", field: "spec22", name: "调拨折让金额", width: "100", type: "span", required: true},
                            {isshow: "T", field: "product_code33", name: "流水折让系数", width: "100", type:"span", required: true},
                            {isshow: "T", field: "spec33", name: "流水折让金额", width: "100", type: "span", required: true},
                            {isshow: "T", field: "net_code11", name: "年度任务数量", width: "100", type: "span",},
                            {isshow: "T", field: "net_name11", name: "年度折让系数", width: "100", type: "span", align: "left", required: true},
                            {isshow: "T", field: "target_price11", name: "年度折让金额", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "origin_price11", name: "库存管理系数", width: "100", type: "span", align: "right", required: true},
                            {isshow: "T", field: "gap_price11", name: "库存管理金额", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "pay_type11", name: "项目折让系数", width: "100", type: "span", required: true},
                            {isshow: "T", field: "gap_rate11", name: "项目折让金额", width: "100", type: "span", required: true},
                            {isshow: "T", field: "gap_rate", name: "补税比率", width: "100", type: "span", required: true},
                            {isshow: "T", field: "gap_tax", name: "补税金额", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "tax_qty", name: "补税票数", width: "100", type: "span", formatter: "formatter_money", align: "right", required: true},
                            {isshow: "T", field: "terminal_code", name: "终端区分", width: "100", type: "select",},
                            {isshow: "T", field: "is_agency11", name: "折让小计", width: "100", type: "span", align: "right", required: true},
                            {isshow: "T", field: "agree_no11", name: "折让小计比率", width: "100", type: "span", align: "right", type: "span", required: true},
                            {isshow: "T", field: "remark11", name: "备注", type: "input", width: "150"}, 
                        ],
                        filterfieldClick: {},
                        tablefieldClick: {},
                        formfieldClick: {},
                        reasonvisible: false,
                        textarea2: '',
                        textarea2_no: '',
                        
                        dataRequest: [
                            {
                                name: "md_province",
                                url: "rootjemin/data/getEntitySet",
                                paramsobj: {dataname: "md_division", filter: "level = '1'"},
                                isnotoption: false, //true:不是选项
                            }
                        ],
                    },
                    created() {
                        
                    },
                    
                    mounted() {
                        var me = this;
                        let re = false
                        if (window.top.vue.userinfo.user.roleList && window.top.vue.userinfo.user.roleList.length > 0) {
                            window.top.vue.userinfo.user.roleList.map(s => {
                                if (s.id && (s.id == "sp071" || s.id == "sp093" || s.id == "sp094" || s.id == "sp096" || s.id == "0")) {
                                    re = true
                                }
                            })
                        }
                        if (!re) {
                            this.filterTxt += " and creator_code = '" + window.top.vue.userinfo.employee.code + "' "
                        }
                        //获取数据
                        if (this.dataRequest && this.dataRequest.length) {
                            var result = {};
                            this.loadRequestData(this.dataRequest, result, function(data) {
                                me.dataRequestObj = data;
                                //预加载数据后给哪些字段设置options或formatterjson
                                
                                //获取数据
                                me.initData();
                            });
                        }
                        else {
                            //获取数据
                            this.initData();
                        }
                        this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
                            hideLoading();
                        });
                    },
                    
                    methods:{
                        signingAgreementOuter() {
                            this.reasonvisible = true;
                        },
                        signingAgreement() {
                            let me = this;
                            var date_ = dateFormat(new Date(),"yyyy-MM-dd");
                            
                            let param_ = {
                                dataname:"agm_record",
                                data: {
                                    id: this.selectedrow.id,
                                    has_sign: 1,
                                    sign_remark: this.textarea2,
                                    sign_no: this.textarea2_no,
                                    sign_time: date_,
                                    sign_operate_code: window.top.userinfo.employee.code,
                                    sign_operate_name: window.top.userinfo.employee.name
                                }
                            }
                            Server.call("rootjemin/data/saveEntity", param_, function(result) {
                                if(result && result.success) {
                                    Root.message({
                                        type:"success",
                                        message:"签收成功"
                                    })
                                    
                                }
                                me.doQuery()
                            })
                            
                            this.reasonvisible = false;
                        },
                        exportList() {
                            this.oldFilterTxt = clone(this.filterTxt)
                            if(this.filterObj && this.filterObj.status == 'close') {
                                this.filterTxt += " and ara.status = 'close' "
                            }
                            else if(this.filterObj && this.filterObj.status == 'freeze') {
                                this.filterTxt += " and ar.freeze = 'T' and ara.status = 'open' "
                            }
                            else if(this.filterObj && this.filterObj.status == 'end') {
                                this.filterTxt += " and ar.freeze <> 'T' and ar.end_date < now() and ara.status = 'open'  and ar.termination_date is null"
                            }
                            else if(this.filterObj && this.filterObj.status == 'termination') {
                                this.filterTxt += " and ar.freeze <> 'T' and ar.termination_date < now() and  ara.status = 'open' "
                            }
                            else if(this.filterObj && this.filterObj.status == 'active') {
                                this.filterTxt += " and ara.status = 'open' and ar.freeze <> 'T' and ar.start_date < now() and ar.end_date > now() and ar.termination_date is null "
                            }
                            else if(this.filterObj && this.filterObj.status == 'notactive') {
                                this.filterTxt += " and ara.status = 'open' and ar.start_date > now() and ar.freeze <> 'T' and ar.termination_date is null "
                            }
                            else if(this.filterObj && this.filterObj.status == 'cancel') {
                                this.filterTxt += " and ara.status = 'open' and ar.freeze <> 'T' and ar.cancel_date is not null "
                            }
                            else {
                                this.filterTxt += " and (ara.status = 'open' or status = 'close') "
                            }
                            
                            exportList('recordZyzcExport', this.getFilterData())
                            
                            this.queryAfter()
                        },
                        getFilterData: function(filter, isnotencode) {
                            var filter_ = filter ? filter : "1=1";
                            for(var k in this.filterObj) {
                                if (k == 'status') {
                                    continue
                                }
                                
                                let k_val = this.filterObj[k];
                                
                                if (k_val && typeof(k_val) == "string") {
                                    //去除两端的空格
                                    this.filterObj[k] = k_val = k_val.replace(/(^\s*)|(\s*$)/g, "");
                                    
                                    //去除两端的Tab
                                    this.filterObj[k] = k_val = k_val.replace(/(^\t*)|(\t*$)/g, "");
                                }
                                
                                let fieldObj_ = this.filterFieldsObj[k];
                                
                                if (!fieldObj_) {
                                    continue
                                }
                                
                                let type_ = fieldObj_.type;
                                let valfield_ = fieldObj_.valfield;
                                if (type_ == "popup" && valfield_) {
                                    k_val = this.filterObj[valfield_];
                                    if (!this.filterObj[valfield_] && this.filterObj[k]) {
                                        k_val = this.filterObj[k];
                                    }
                                }
                                
                                let field_ = fieldObj_.field;
                                let filteroperator_ = "equal";
                                
                                let isnull = false;
                                let ornullval_ = fieldObj_.ornullval;
                                if (ornullval_) {
                                    var nullvals_ = ornullval_.split(";");
                                    nullvals_.map(v=>{
                                        if (v == k_val) {
                                            isnull = true;
                                        }
                                    });
                                }
                                
                                if (fieldObj_.filterfield) {
                                    field_ = fieldObj_.filterfield
                                }
                                if (fieldObj_.filteroperator) {
                                    filteroperator_ = fieldObj_.filteroperator
                                }
                                
                                if (k_val && k_val != "" && k_val.length) { filter_ = getFilterByFilterType(filter_, type_, field_,  k_val, filteroperator_, isnull); }
                            }
                            
                            if (Object.keys(this.filterObjBydefault).length) {
                                for(var k in this.filterObjBydefault) {
                                    let k_val = this.filterObjBydefault[k];
                                    filter_ += " and " + k + " = '" + k_val +"'";
                                }
                            }
                            
                            if (this.filterTxt) {
                                filter_ += " and " + this.filterTxt;
                            }
                            
                            
                            if (isnotencode) {
                                return filter_;
                            }
                            else {
                                return encodeURI(filter_);
                            }
                            
                        },
                        onInitFilter() {
                            //清空
                            this.filterObj = {};
                            this.selectedrow = {};
                            this.initData();
                        },
 
                        // onQuery() {
                        //     this.initData();
                        // },
                        
                        initData() {
                            var me = this;
                            // if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
                            //     me.filterFields = clone(me.default_filterFields);
                            //     me.tableFields = clone(me.default_tableFields);
                                
                            //     //字段数组转字段obj
                            //     me.fieldsToFieldsObj();
                                
                            //     //设置字段事件
                            //     me.tableFieldClick();
                            // }
                            // this.tableDataAfter();
 
                            this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
                                if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
                                    var metas = clone(result.meta[me.dataname].fields);
                                    var filterFields_ = [];
                                    var tableFields_ = [];
                                    
                                    metas.map(f=>{
                                        f.isshow = "T";
                                        
                                        if (f.isfilter) {
                                            if (f.field == 'province_name') {
                                                f.isfilterable = true
                                                me.dataRequestObj.md_province.data.entityset.map(e => {
                                                    e.value = e.name
                                                    e.code = e.name
                                                })
                                                f.options = me.dataRequestObj.md_province.data.entityset
                                            }
                                            
                                            filterFields_.push(clone(f));
                                        }
                                        else {
                                            var filter_f = clone(f);
                                            filter_f.isshow = "F";
                                            filterFields_.push(filter_f);
                                        }
                                        
                                        tableFields_.push(clone(f));
                                    })
                                    var termination_date = {
                                        isshow: "T",field: "termination_date", name: "终止日期", width: "150", type:"date", formatter: "formatter_date"
                                    };
                                    var termination_operate_name = {
                                        isshow: "T",field: "termination_operate_name", name: "终止人", width: "100", type:"", formatter: ""
                                    };
                                    tableFields_.push(termination_date);
                                    tableFields_.push(termination_operate_name);
                                    if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
                                        me.filterFields = clone(filterFields_);
                                        me.tableFields = clone(tableFields_);
                                        
                                        //字段数组转字段obj
                                        me.fieldsToFieldsObj();
                                        
                                        //设置字段事件
                                        me.tableFieldClick();
                                    }
                                }
                                
                                if (callback) {
                                    callback();
                                }
                            });
                        },
                        doQuery: function(callback) {
                            let me = this;
                            this.oldFilterTxt = clone(this.filterTxt)
                            if(this.filterObj && this.filterObj.status == 'close') {
                                this.filterTxt += " and ara.status = 'close' "
                            }
                            else if(this.filterObj && this.filterObj.status == 'freeze') {
                                this.filterTxt += " and ar.freeze = 'T' and ara.status = 'open' "
                            }
                            else if(this.filterObj && this.filterObj.status == 'end') {
                                this.filterTxt += " and ar.freeze <> 'T' and ar.end_date < now() and ara.status = 'open'  and ar.termination_date is null"
                            }
                            else if(this.filterObj && this.filterObj.status == 'termination') {
                                this.filterTxt += " and ar.freeze <> 'T' and ar.termination_date < now() and  ara.status = 'open' "
                            }
                            else if(this.filterObj && this.filterObj.status == 'active') {
                                this.filterTxt += " and ara.status = 'open' and ar.freeze <> 'T' and ar.start_date < now() and ar.end_date > now() and ar.termination_date is null "
                            }
                            else if(this.filterObj && this.filterObj.status == 'notactive') {
                                this.filterTxt += " and ara.status = 'open' and ar.start_date > now() and ar.freeze <> 'T' and ar.termination_date is null "
                            }
                            else if(this.filterObj && this.filterObj.status == 'cancel') {
                                this.filterTxt += " and ara.status = 'open' and ar.freeze <> 'T' and ar.cancel_date is not null "
                            }
                            else {
                                this.filterTxt += " and (ara.status = 'open' or status = 'close') "
                            }
                            let filter_ = "1=1";
                            this.filterList = [];
                            this.selectedrow = {};
                            for(var k in this.filterObj) {
                                if (k == 'status') {
                                    continue
                                }
                                let k_val = this.filterObj[k];
                                /* let fieldObj_ = this.filterFieldsObj[k];
                                
                                let type_ = fieldObj_.type;
                                let field_ = fieldObj_.field; */
                                
                                if (k_val && typeof(k_val) == "string") {
                                    //去除两端的空格
                                    this.filterObj[k] = k_val = k_val.replace(/(^\s*)|(\s*$)/g, "");
                                    
                                    //去除两端的Tab
                                    this.filterObj[k] = k_val = k_val.replace(/(^\t*)|(\t*$)/g, "");
                                }
                                
                                let fieldObj_ = this.filterFieldsObj[k];
                                
                                if (!fieldObj_) {
                                    continue
                                }
                                if (!fieldObj_) {
                                    fieldObj_ = {
                                        field: k
                                    }
                                }
                                
                                let type_ = fieldObj_.type;
                                let valfield_ = fieldObj_.valfield;
                                if (type_ == "popup" && valfield_) {
                                    k_val = this.filterObj[valfield_];
                                }
                                
                                let field_ = fieldObj_.field;
                                
                                let filteroperator_ = "equal";
                                
                                let isnull = false;
                                let ornullval_ = fieldObj_.ornullval;
                                if (ornullval_) {
                                    var nullvals_ = ornullval_.split(";");
                                    nullvals_.map(v=>{
                                        if (v == k_val) {
                                            isnull = true;
                                        }
                                    });
                                }
                                
                                if (fieldObj_.filterfield) {
                                    field_ = fieldObj_.filterfield
                                }
                                if (fieldObj_.filteroperator) {
                                    filteroperator_ = fieldObj_.filteroperator
                                }
                                
                                //传条件数组由后端拼接筛选数据
                                /* let filterListObj_ = {
                                    field: field_,
                                    val: k_val,
                                    type: filteroperator_
                                }
                                
                                this.filterList.push(filterListObj_);
                                 */
                                
                                //传条件数据有前端拼接
                                if (k_val && k_val != "" && k_val.length) { filter_ = getFilterByFilterType(filter_, type_, field_,  k_val, filteroperator_, isnull); }
                            }
                            
                            if (Object.keys(this.filterObjBydefault).length) {
                                for(var k in this.filterObjBydefault) {
                                    let k_val = this.filterObjBydefault[k];
                                    if (k_val.indexOf(',') != -1) {//包含英文","用in
                                        filter_ += " and " + k + " in ('" + k_val +"')";
                                    }
                                    else {
                                        filter_ += " and " + k + " ='" + k_val +"'";
                                    }
                                }
                            }
                            
                            if (this.filterTxt) {
                                filter_ += " and " + this.filterTxt;
                            }
                            
                            var attachmeta_ = false;
                            if (!this.tableFields || (this.tableFields && this.tableFields.length == 0)) {
                                attachmeta_ = true;
                            }
                            
                            let param_ = {
                                
                                dataname: this.dataname,
                                filterList: this.filterList,
                                filter: filter_,
                                orderby: this.orderby,
                                page: {
                                    pageno: this.pagenum,
                                    pagesize: this.pagesize
                                },
                                attachMeta: attachmeta_
                            }
                            
                            if (Object.keys(this.paramObjBydefault).length) {
                                for(var k in this.paramObjBydefault) {
                                    let k_val = this.paramObjBydefault[k];
                                    param_[k] = k_val;
                                }
                            }
                            me.tableData = [];
                            //me.total = 0;                    
                            me.tableloading = true;
                            
                            Server.call(me.dataurl, param_, function(result) {
                                
                                me.tableloading = false;
                                
                                if (result && result.meta) {
                                    me.data_tablename_map = result.meta
                                }
                                if (result && result.data && result.data.entityset) {
                                    if (result.data.page && result.data.page.recordcount && me.pagenum > 1 && result.data.page.recordcount < (me.pagenum - 1) * me.pagesize) {
                                        me.pagenum = 1;
                                        me.doQuery(callback);
                                        return;
                                    }
                                    
                                    var data_ = result.data.entityset;
                                    me.tableData = data_;
                                    me.total = result.data.page ? result.data.page.recordcount : 0;
                                }
                                else {
                                    me.total = 0;
                                }
                                
                                me.queryAfter();
                                
                                if (callback) {
                                    callback(result, function() {
                                        me.tableDataAfter();
                                    });
                                }
                                
                            }, function(){
                                me.tableloading = false;
                            });
                        },
                        
                        queryAfter() {
                            let me = this
                            if (me.tableData.length > 0) {
                                let tableData = clone(me.tableData)
                                tableData.map(s => {
                                    if (s.freeze && s.freeze == 'T') s.freeze = '是'
                                    else s.freeze = '否'
                                })
                                me.tableData = tableData
                            }
                            
                            this.filterTxt = clone(this.oldFilterTxt)
                        },
                        
                        tableFieldClick() {
                            var me = this;
                            //筛选字段事件设置
                            this.filterfieldClick = {
                                
                            };
                            //表格字段事件设置
                            this.tablefieldClick = {
                                status: {//字段事件设置
                                    val: {//有值时的点击事件
                                        onclick: function(obj) {//数据值点击事件
                                            var config = {
                                                totab: false, //true: 以Tab导航的方式打开
                                                width: "900px",
                                                height: "500px",
                                                icon: "icon-product",
                                                text: "",
                                                id: obj.row.id,//totab: true时需设置,用于判断是否已打开此页面
                                                url: "../approval_new/ApprovalList_page_new.html?flow_id=" + obj.row.flow_id,
                                                data: obj.row,
                                                delta: {},
                                                sceneCode: "change",//"refuseedit",//"approval", //"add"//"browse",
                                                callback: function(obj, callback) {
                                                    if (callback) {
                                                        callback();
                                                    }
                                                }
                                            };
                                            me.doPopupByPublic(config);
                                        },
                                    },
                                },
                            };
                        
                            //表单字段事件设置
                            this.formfieldClick = {
                                
                            };
                        },
                        
                        showInfo(obj) {
                            var me = this;
                            
                            var config = {
                                totab: true, //true: 以Tab导航的方式打开
                                width: "900px",
                                height: "900px",
                                icon: "icon-product",
                                text: "赠药政策信息查看",
                                id: "medicine_policy_info" + "browse" + obj.row.id,//totab: true时需设置,用于判断是否已打开此页面
                                url: "../agreement/policy/medicine_policy_info.html",
                                data: obj.row,
                                delta: {},
                                sceneCode: "browse",//"refuseedit",//"approval", //"add"//"browse",
                                callback: function(obj, callback) {
                                    if (callback) {
                                        callback();
                                    }
                                }
                            };
                            
                            me.doPopupByPublic(config);
                        },
                        
                        opentest() {
                            var me = this;
                            Root.message({
                                type: 'success',
                                message: '后缀点击事件'
                            });
                            
                            var config = {
                                totab: false, //true: 以Tab导航的方式打开
                                width: "900px",
                                height: "900px",
                                icon: "icon-product",
                                text: "表单样例页面",
                                id: "test_page",//totab: true时需设置,用于判断是否已打开此页面
                                //url: "module/system/page/coming.html",
                                url: "module/system/page/sample/sample_form.html",
                                data: {},
                                delta: {},
                                sceneCode: "edit", //"add"//"browse",
                                callback: function(obj, callback) {
                                    me.onQuery();
                                    if (callback) {
                                        callback();
                                    }
                                }
                            };
                            me.doPopupByPublic(config);
                        },
                        
                        addData() {
                            let me = this;
                            var config = {
                                totab: false, //true: 以Tab导航的方式打开
                                width: "500px",
                                height: "300px",
                                icon: "icon-product",
                                text: "产品信息",
                                id: "product_edit",//totab: true时需设置,用于判断是否已打开此页面
                                url: "module/md/page/product/page/product_edit.html",
                                data: {},
                                delta: {},
                                sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
                                callback: function(obj, callback) {
                                    me.onQuery();
                                    if (callback) {
                                        callback();
                                    }
                                }
                            };
                            me.doPopupByPublic(config);
                        },
                        onEditData(config, scope) {
                            var me = this;
                            var row = scope.row;
                            
                            //1. empty row
                            if (!row || !row.id) {
                                Root.message({
                                    type: 'warning',
                                    message: '请选择要编辑的数据'
                                });  
                                return false;
                            }
                                
                            //3. popup
                            var config = {
                                totab: false, //true: 以Tab导航的方式打开
                                width: "500px",
                                height: "300px",
                                icon: "icon-product",
                                text: "产品线信息",
                                id: "product_edit" + row.id,//totab: true时需设置,用于判断是否已打开此页面
                                url: "module/md/page/product/page/product_edit.html",
                                data: row,
                                delta: null,
                                sceneCode: "edit",//"refuseedit",//"approval", //"add"//"browse",
                                callback: function(obj, callback) {
                                    me.onQuery();
                                    if (callback) {
                                        callback();
                                    }
                                }
                            };
                            me.doPopupByPublic(config);
                        },
                    }
                });
            };
            
            initVue();
        </script>
        <style>
            /* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
            [v-cloak] {
                display: none !important;
            }
        </style>
    </body>
</html>