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
<template>
  <div class="app-container">
    <el-col :span="6">
      <el-card>
        <!-- 捐献案例列表 -->
        <el-table @row-click="checkidmsg" border :data="jibing">
          <el-table-column label="姓名" align="center" prop="name" />
        </el-table>
        <!-- hide-on-single-page -->
        <pagination
          v-show="total > 0"
          style="margin-left: 100px"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getfundlist"
        />
      </el-card>
    </el-col>
    <el-col :span="18">
      <el-card shadow="never">
        <el-table :data="distributedetaillist" border>
          <el-table-column
            align="center"
            label="人体捐献器官获取专家劳务费支出汇总表"
          >
            <el-table-column label="项目名称" align="center" prop="itemname" />
            <el-table-column label="项目定义" align="center" prop="itemtype" />
            <el-table-column label="案例或次数" align="center" prop="amount" />
            <el-table-column
              label="费用总额"
              align="center"
              prop="totalamount"
            />
          </el-table-column>
          <el-table-column
            label="案例描述"
            align="center"
            prop="casedescribe"
          />
          
          <el-table-column
            label="操作"
            width="130"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                icon="el-icon-copy-document"
                @click="dayin(scope.row)"
                >下载</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </el-card>
    </el-col>
  </div>
</template>
 
<script>
import {
  listExpertexpense,
  getExpertexpense,
  delExpertexpense,
  addExpertexpense,
  updateExpertexpense,
  exportExpertexpense,
} from "@/api/project/expertexpense";
import { listFund, getdownloadHZ } from "@/api/project/fund";
import { getownFundDetail } from "@/api/project/funddetail";
import FundSummary from "@/views/project/components/fundsummary";
export default {
  name: "Expertexpense",
  components: {
    FundSummary,
  },
  data() {
    return {
      distributedetaillist: [],
      jibing: [],
      //单选框vulue
      checkone: [],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 费用申请主表格数据
      expertexpenseList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        infoid: null,
        donorno: null,
        donorname: null,
        userno: null,
        username: null,
        ievaluatecost: null,
        illnessevaluatecost: null,
        deathjudgecost: null,
        ethicsevaluatecost: null,
        oevaluatecost: null,
        departmentno: null,
        departmentname: null,
        recordstatus: null,
        uploadflag: null,
        uploadtime: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      curdonorno: null,
    };
  },
  created() {
    // this.getList();
    this.getfundlist();
  },
  methods: {
    checkidmsg(row) {
      this.curdonorno = row.donorno;
      console.log("checkone:", row);
      getownFundDetail(row.id).then((res) => {
        const data = res.data;
        console.log("劳务汇总", res);
        for (let i = 0; i < data.length; i++) {
          data[i].totalamount = data[i].amount;
        }
        this.distributedetaillist = this.uniqueArrObj(
          data,
          "itemtype",
          "totalamount"
        );
      });
    },
    dayin(row) {
      console.log("wdaw", row);
      // if(this.checkone.length !=0){
      getdownloadHZ(row.fundid).then((res) => {
        console.log("打印:", 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",
          });
        }
      });
      // }
      // else{
      //     this.$alert("请选择捐献者再打印", "提示", {
      //       confirmButtonText: "确定",
      //       type: "warning",
      //     });
      // }
    },
 
    //获取的捐献者信息
    getfundlist() {
      let fundlist = [];
      listFund().then((res) => {
        fundlist = res.rows;
        console.log("wdwadwadaw", res.rows);
        for (let i = 0; i < fundlist.length; i++) {
          this.jibing.push({
            donorno: fundlist[i].donorno,
            name: fundlist[i].donorname,
            id: fundlist[i].id,
          });
        }
        console.log("okokoko", this.jibing);
      });
    },
    uniqueArrObj(arr, unique, addKey) {
      if (!Array.isArray(arr)) return;
      const tempArr = [];
      const tempObj = {};
      arr.forEach((ele, i) => {
        if (!tempObj[arr[i][unique]]) {
          tempArr.push(arr[i]);
          tempObj[arr[i][unique]] = true;
        } else {
          tempArr.forEach((ele) => {
            if (ele[unique] === arr[i][unique]) {
              ele[addKey] += arr[i][addKey];
            }
          });
        }
      });
      return tempArr;
    },
  },
};
</script>