11
WXL
2024-08-14 0ac2d43fce4d74f6eea5a51a2e16af4e6a536c7c
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
<!--  -->
<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      label-width="70px"
    >
      <el-row align="left">
        <el-col :span="5">
          <el-form-item label="审批状态" prop="CHECKFLAG" style="float: left">
            <el-select
              v-model="queryParams.CHECKFLAG"
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option
                v-for="item in checkFlagOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="申请金额" prop="money" style="float: left">
            <el-input
              v-model="queryParams.money"
              placeholder="请输入申请人金额"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="经办人" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入经办人"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label="申请日期" prop="applyTime">
            <el-date-picker
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              v-model="queryParams.value1"
              type="daterange"
              range-separator="至"
              start-placeholder="报销申请开始日期"
              end-placeholder="报销申请结束日期"
              @keyup.enter.native="handleQuery"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <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-col>
      </el-row>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          >新增</el-button
        >
        <!-- v-hasPermi="['project:medicalfund:add']" -->
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          >导出</el-button
        >
      </el-col>
      <!-- v-hasPermi="['project:medicalfund:export']" -->
      <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
    </el-row>
    <el-table
      v-loading="loading"
      border
      :data="donateconsolationfundList"
      :row-class-name="rowClassName"
    >
      <el-table-column
        label="申请日期"
        align="center"
        prop="applyTime"
        width="180px"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.applyTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="申请人"
        align="center"
        prop="username"
        width="150px"
      />
      <el-table-column
        label="申请金额"
        align="center"
        prop="pretaxcost"
        width="150px"
      />
 
      <el-table-column
        label="审核状态"
        width="150"
        align="center"
        prop="recordstatus"
      >
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.sys_recordstatus"
            :value="scope.row.recordstatus"
          />
        </template>
      </el-table-column>
      <el-table-column
        label="申请材料状态"
        width="140"
        align="center"
        prop="checkstatus"
      >
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.sys_stage_type"
            :value="scope.row.checkstatus"
          />
        </template>
      </el-table-column>
      <el-table-column
        label="绩效类型"
        width="150"
        align="center"
        prop="performancetype"
      >
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.sys_performance_type"
            :value="scope.row.performancetype"
          />
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column
        label="操作"
        fixed="right"
        align="center"
        class-name="small-padding fixed-width"
        width="280px"
      >
        <template slot-scope="scope">
          <el-button
            v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleup(scope.row)"
            >上报</el-button
          >
          <el-button
            v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['project:medicalfund:edit']"
            >修改</el-button
          >
 
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleDetail(scope.row)"
            >查看</el-button
          >
          <el-button
            v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1"
            size="mini"
            type="text"
            @click="handleDelete(scope.row)"
            v-hasPermi="['project:medicalfund:delete']"
            ><span class="button-delete"
              ><i class="el-icon-delete"></i>删除</span
            ></el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-download"
            @click="mixExport(scope.row.id)"
            v-hasPermi="['project:medicalfund:download']"
            >下载</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="duplicationfn(scope.row)"
            >复制</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
 
<script>
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
//例如:import 《组件名称》 from '《组件路径》';
import {
  onelistFund,
  listFund,
  getFund,
  delFund,
  addFund,
  updateFund,
  getdownloadYX,
  getdownloadBX
} from "@/api/project/fund";
import {
  delFunddetail,
  addFunddetail,
  getownFundDetail
} from "@/api/project/funddetail";
 
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import { getToken } from "@/utils/auth";
 
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
    Li_area_select,
    OrgSelecter
  },
  name: "fundApply",
  dicts: [
    "sys_recordstatus",
    "sys_OrganizationType",
    "sys_DonationStatus",
    "sys_depositbank",
    "sys_FamilyRelation",
    "sys_IDType",
    "sys_ConsolationType",
    "sys_fund_type",
    "sys_finsubject",
    "sys_financeitemtype",
    "sys_expensetype",
    "sys_performance_type",
    "sys_stage_type"
  ],
  data() {
    //这里存放数据
    return {
      businesstype: "4",
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      total: 0,
      queryParams: {
        organizationname: null,
        organizationtype: null,
        pageNum: 1,
        pageSize: 10,
        name: null,
        idcardno: null,
        residenceprovince: null,
        residencecity: null,
        residencetown: null,
        recordstate: null,
        treatmenthospitalname: null,
        donorno: null,
        reportername: null,
        reporttime: null
      },
      checkFlagOptions: [
        {
          value: 0,
          label: "已审批"
        },
        {
          value: 1,
          label: "待审批"
        },
        {
          value: 2,
          label: "全部"
        }
      ],
      fundQueryParam: {
        infoid: null,
        applytype: "5",
        createBy: null,
        organizationname: null,
        organizationtype: null,
        pageNum: 1,
        pageSize: 10,
        name: null,
        idcardno: null,
        residenceprovince: null,
        residencecity: null,
        residencetown: null,
        recordstate: null,
        treatmenthospitalname: null,
        donorno: null,
        reportername: null,
        reporttime: null
      },
      // 表单参数
      form: {},
      //捐献案例列表数据
      donatebaseinfoList: [],
      //是否显示费用申请弹窗
      dialogOpen: false,
      //费用申请表单title
      applyFormTitle: "",
 
      // 捐献人道慰问金表格数据
      donateconsolationfundList: [],
 
      //明细记录
      fundDetails: [],
 
      // 弹出层标题
      title: "",
      itemArr: [],
      //用户
      userlist: [],
      //银行账号
      bankaccountlist: [],
      //机构单位
      unitList: [],
      //费用类型数组
      fundtypeArr: [],
      defaultperson: {},
      fundblock: [],
      fundtypeArrAll: [],
      dialogType: "edit",
 
      detailInfoDialogShow: false,
      detailInfoDialogShowType: "",
      funddetailForm: {
        beneficiaryname: null,
        beneficiaryno: null,
        unitno: null,
        unitname: null,
        index: null
      },
 
      //附件列表
      fileList: [],
      //上传附件路径
      uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload",
      headers: {
        Authorization: "Bearer " + getToken()
      }
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    handleup(row) {
      console.log(row);
      this.$confirm("是否确认将登记记录上报?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          //查找是否存在登记完成记录
          //判断是否存在上报记录
          row.recordstatus = 0;
          var currenttime = new Date();
          row.applyTime =
            currenttime.getFullYear() +
            "-" +
            (currenttime.getMonth() + 1) +
            "-" +
            currenttime.getDate() +
            " " +
            currenttime.getHours() +
            ":" +
            currenttime.getMinutes() +
            ":" +
            currenttime.getSeconds();
          updateFund(row).then(response => {
            if (response.code == 200) {
              this.$message({
                type: "success",
                message: "申请成功"
              });
            } else {
              this.$message({
                type: "error",
                message: "申请失败"
              });
            }
            this.loading = false;
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消申请"
          });
        });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeReporttime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
 
    /** 新增按钮操作 */
    handleAdd() {
      this.$router.push({
        path: "/finance/performancedetails/",
        query: { id: 0, businessType: "5", operationType: "add" }
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({
        path: "/finance/performancedetails/",
        query: { id: row.id, businessType: "5", operationType: "update" }
      });
    },
    /** 复制按钮操作 */
    duplicationfn(row) {
      this.$router.push({
        path: "/finance/performancedetails/",
        query: {
          id: row.id,
          businessType: "5",
          operationType: "copy"
        }
      });
    },
 
    /** 查看按钮操作 */
    handleDetail(row) {
      this.$router.push({
        path: "/finance/performancedetails/",
        query: { id: row.id, businessType: "5", operationType: "detail" }
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$modal
        .confirm("是否确认导出所有报销申请数据项?")
        .then(() => {
          this.exportLoading = true;
          return exportReimbursement(queryParams);
        })
        .then(response => {
          this.$download.name(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },
 
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm("是否确认删除该记录?")
        .then(function() {
          return delFund(ids);
        })
        .then(() => {
          getownFundDetail(ids).then(res => {
            let listdetails = res.data;
            for (let i = 0; i < listdetails.length; i++) {
              delFunddetail(listdetails[i].id);
            }
          });
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
 
    /** 查询列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      console.log(21);
      listFund(this.fundQueryParam).then(response => {
        console.log(11);
        this.loading = false;
        this.donateconsolationfundList = response.rows;
        this.total=response.total;
      });
    },
    // 捐献者医学统计打印
    dayin2(id) {
      getdownloadYX(id).then(res => {
        var fileUrl = res;
        //获取当前网址
        var urlBase = process.env.VUE_APP_BASE_API;
        var curWWWPath = window.document.location.href;
        var pos = curWWWPath.indexOf(window.document.location.pathname);
        // 创建a标签
        var aEle = document.createElement("a");
        aEle.href =
          curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
        console.log(aEle.href);
        // 添加Authorization头部
        fetch(aEle.href, {
          headers: this.headers
        })
          .then(response => {
            // 将文件下载链接作为blob对象进行下载
            return response.blob();
          })
          .then(blob => {
            const url = window.URL.createObjectURL(new Blob([blob]));
            console.log(url);
            const link = document.createElement("a");
            link.href = url;
            const name = fileUrl["downloadName"];
            link.setAttribute("download", name); // 替换file.pdf为实际的文件名
            document.body.appendChild(link);
            link.click();
            link.parentNode.removeChild(link);
          });
      });
    },
 
    //汇总打印
    totaldayin(e) {
      // const id =this.row.id
      getdownloadBX(e).then(res => {
        if (res.downloadUrl) {
          var fileUrl = res;
          //获取当前网址
          var urlBase = process.env.VUE_APP_BASE_API;
          var curWWWPath = window.document.location.href;
          var pos = curWWWPath.indexOf(window.document.location.pathname);
          // 创建a标签
          var aEle = document.createElement("a");
          aEle.href =
            curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
          aEle.click();
          this.$alert("下载成功", "提示", {
            confirmButtonText: "确定",
            type: "success"
          });
        }
      });
    },
    // 下载按钮
    mixExport(id) {
      this.dayin2(id);
      //this.totaldayin(id);
    },
    rowClassName({ row, column, rowIndex, columnIndex }) {
      if (row.recordstatus == -1 && row.backflowlevel != null) {
        return "error-row";
      }
      return "";
    }
  },
  //生命周期 - 创建完成(可以访问当前this实例)
  created() {
    this.getList();
  },
 
  //生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {},
 
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
};
</script>
<style lang="scss" scoped>
/* @import url(); 引入公共css类 */
.button-delete {
  color: rgb(236, 69, 69);
}
::v-deep.el-table .error-row {
  background: #fcebeb;
}
</style>