qinxianzhangyao
2023-09-12 bb6bfe4bbe0ec84c15cd1eaebf7a55cbd11b4094
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
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="交款员" prop="tollCollectorName">
        <el-select v-model="queryParams.tollCollectorName" filterable style="width: 200px" placeholder="请选择交款员" clearable @clear="getCompanyList" @change="idFn">
          <el-option v-for="dict in CompanyList" :key="dict.userId" :label="dict.nickName" :value="dict.userId"/>
        </el-select>
      </el-form-item>
      <el-form-item label="交账时间" prop="tollCollectorName">
        <el-date-picker v-model="value1" type="datetimerange" :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="起止日期" end-placeholder="终止日期" :default-time="['12:00:00']">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button>
      </el-form-item>
    </el-form>
 
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button icon="el-icon-edit" size="mini" @click="handleDelete" v-hasPermi="['hosp:water:edit']">撤销</el-button>
      </el-col>
    </el-row>
 
    <el-table :row-class-name="tableRowClassName" style="width: 80%" :data="tableData" @selection-change="handleSelect" ref="multipleTable" border>
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column label="交款员" align="center" prop="tollCollector" :show-overflow-tooltip="true"/>
      <el-table-column label="收费金额" align="center" prop="amountReceived" :show-overflow-tooltip="true"/>
      <el-table-column label="退费金额" align="center" prop="refundAmount" :show-overflow-tooltip="true"/>
      <el-table-column label="应交款" align="center" prop="payable" :show-overflow-tooltip="true"/>
      <el-table-column label="交账时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
      <el-table-column label="起止日期" align="center" prop="accountBeginTime" :show-overflow-tooltip="true"/>
      <el-table-column label="终止日期" align="center" prop="accountEndTime" :show-overflow-tooltip="true"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-s-order" title="详情" @click="handleUpdate(scope.row)" v-hasPermi="['hosp:water:edit']"></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-table :data="allList" style="margin-top: 60px; width: 80%" show-summary border>
      <el-table-column label="付款方式" align="center" prop="payType" />
      <el-table-column label="收费金额" align="center" prop="amountReceived">
      </el-table-column>
      <el-table-column label="退费金额" align="center" prop="refundAmount" />
      <el-table-column label="应交款" align="center" prop="payable" />
    </el-table>
  </div>
</template>
  
<script>
import { getcolllist, getdatalist, delById } from "@/api/hosp/water";
import { getInfo } from "@/api/login";
import moment from "moment";
 
export default {
  name: "Water",
  data() {
    return {
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      // 遮罩层
      loading: true,
      tableData: [],
      selectList: [],
      allList: [],
      disabled: true,
      value1: [],
      CompanyList: [],
      // 选中数组
      dataList: [],
      time: "",
      id: "",
      tollCollectorId: "",
      // 非单个禁用
      single: true,
      closeList: 0,
      tollCollectorId: "",
      machiningTimeList: 0,
      debugTimeList: 0,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      userId: "",
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        tollCollectorName: null,
        payStasus: null,
        payType: null,
        deleted: null,
        customer: {
          cusName: null,
        },
        tollCollectorId: null,
        accountBeginTime: null,
        accountEndTime: null,
      },
      // 表单参数
      form: {},
    };
  },
  created() {
    this.getList();
    this.getCompanyList();
    
  },
  methods: {
    /** 查询体检流水列表 */
    getList() {
      getInfo().then((response) => {
        this.userId = response.user.userId;
        this.queryParams.tollCollectorName = response.user.nickName;
      });
      let data = {
        tollCollectorId: this.tollCollectorId,
        accountBeginTime: this.value1[0],
        accountEndTime: new Date(new Date().getTime() + 8 * 3600 * 1000)
          .toJSON()
          .substr(0, 19)
          .replace("T", " "),
        pageNum: this.queryParams.pageNum,
        pageSize: this.queryParams.pageSize,
      };
      getcolllist(data).then((res) => {
        this.tableData = res.data.list;
        if(this.tableData.length === 0){
          this.$message({
          message: '请搜索要撤销数据的时间段哦~',
          type: 'warning'
        });
        }
        if (res.code === 200) {
          if (this.tableData.length != 0) {
            this.$nextTick(() => {
              this.$refs.multipleTable.toggleRowSelection(
                this.tableData[0],
                true
              );
            });
          } else {
            this.$refs.multipleTable.clearSelection();
          }
        }
 
        // this.tableData.forEach(item => {
        //   this.allList = item.tjTollCollectorDetailList
        // })
        this.total = res.data.total;
      });
    },
    // 选中下拉框Id
    idFn(value) {
      this.tollCollectorId = value;
    },
    // 下拉框显示
    getCompanyList() {
      this.loading = true;
      getdatalist().then((response) => {
        this.CompanyList = response.data;
        this.loading = false;
      });
    },
 
    // 搜索
    handleQuery() {
      let data = {
        tollCollectorId: this.tollCollectorId,
        accountBeginTime: this.value1[0],
        accountEndTime: new Date(new Date().getTime() + 8 * 3600 * 1000)
          .toJSON()
          .substr(0, 19)
          .replace("T", " "),
        pageNum: this.queryParams.pageNum,
        pageSize: this.queryParams.pageSize,
      };
      getcolllist(data).then((res) => {
        this.tableData = res.data.list;
        if (this.tableData.length != 0) {
          this.$nextTick(() => {
            this.$refs.multipleTable.toggleRowSelection(
              this.tableData[0],
              true
            );
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
        // if (this.tableData.length > 0) {
        //   this.tableData.forEach(item => {
        //     this.allList = item.tjTollCollectorDetailList
        //   })
        // }else{
        //   this.allList = []
        // }
        this.total = res.data.total;
      });
    },
    handleUpdate() {},
 
    // 表格单选
    handleSelect(selection, val) {
      this.selectList = selection;
      this.dataList = this.$refs.multipleTable.selection;
      this.dataList.forEach((item) => {
        this.allList = item.tjTollCollectorDetailList;
        this.id = item.id;
        this.tollCollectorId = item.tollCollectorId;
      });
      if (selection.length > 1) {
        let del_row = selection.shift();
        this.$refs.multipleTable.toggleRowSelection(del_row, false);
      }
    },
    tableRowClassName({ row, rowIndex }) {
      for (let i = 0; i < this.selectList.length; i++) {
        if (row === this.selectList[i]) {
          return "warning-row";
        }
      }
    },
    handleDelete() {
      let data = {
        id: this.id,
        tollCollectorId: this.tollCollectorId,
      };
      delById(data).then((res) => {
        this.$message({
          showClose: true,
          message: "该账单已成功撤销",
          type: "success",
        });
        this.getList();
      });
    },
  },
};
</script>
 
<style>
.el-table__header-wrapper .el-checkbox {
  display: none;
}
.pag {
  width: 100%;
  display: flex;
  justify-content: center;
}
 
.pag1 {
  width: 30%;
}
.el-table__body tr.current-row > td {
  background-color: #f19944 !important;
  /* color: #f19944; */ /* 设置文字颜色,可以选择不设置 */
}
.el-table .warning-row {
  background: #e5f3ff !important;
}
</style>