提交 | 用户 | 时间
|
5cc1d9
|
1 |
<template> |
D |
2 |
<el-card shadow="never" class="aui-card--fill"> |
|
3 |
<div class="mod-app"> |
|
4 |
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|
5 |
<el-form-item> |
|
6 |
<span>统计日期:</span> |
|
7 |
<el-date-picker |
|
8 |
v-model="dataForm.rq" |
|
9 |
type="date" |
|
10 |
:clearable="true" |
|
11 |
value-format="yyyy-MM-dd" |
|
12 |
placeholder="日期"> |
|
13 |
</el-date-picker> |
|
14 |
</el-form-item> |
|
15 |
<el-form-item> |
|
16 |
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|
17 |
</el-form-item> |
|
18 |
<el-form-item> |
|
19 |
<el-button type="primary" @click="openForm()">{{ $t('add') }}</el-button> |
|
20 |
</el-form-item> |
|
21 |
<el-form-item> |
|
22 |
<el-button @click="exportExcel()">导出</el-button> |
|
23 |
</el-form-item> |
|
24 |
<div style="float: right"> |
|
25 |
<el-form-item> |
|
26 |
<span>月初:</span> |
|
27 |
<el-date-picker |
|
28 |
v-model="dataForm.monthStart" |
|
29 |
type="date" |
|
30 |
readonly |
|
31 |
value-format="yyyy-MM-dd"> |
|
32 |
</el-date-picker> |
|
33 |
</el-form-item> |
|
34 |
<el-form-item> |
|
35 |
<span>年初:</span> |
|
36 |
<el-date-picker |
|
37 |
v-model="dataForm.yearStart" |
|
38 |
type="date" |
|
39 |
readonly |
|
40 |
value-format="yyyy-MM-dd"> |
|
41 |
</el-date-picker> |
|
42 |
</el-form-item> |
|
43 |
</div> |
|
44 |
</el-form> |
|
45 |
<el-table |
|
46 |
ref="table" |
|
47 |
v-loading="dataListLoading" |
|
48 |
:data="dataList" |
|
49 |
border |
|
50 |
style="width: 100%;" |
|
51 |
show-summary |
|
52 |
:summary-method="getSummaries"> |
|
53 |
<el-table-column type="index" header-align="center" align="center" min-width="50" label="序号"></el-table-column> |
|
54 |
<el-table-column prop="lsh" header-align="center" align="center" label="流水号" min-width="200"></el-table-column> |
|
55 |
<el-table-column prop="rq" header-align="center" align="center" label="日期" min-width="100"></el-table-column> |
|
56 |
<el-table-column prop="bcName" header-align="center" align="center" label="班次" min-width="100"></el-table-column> |
|
57 |
<el-table-column prop="drlyName" header-align="center" align="center" label="调入来源" min-width="200"></el-table-column> |
|
58 |
<el-table-column header-align="center" align="center" label="内报量(吨)"> |
|
59 |
<el-table-column prop="nbdrl" header-align="center" align="center" label="当日" min-width="150"> |
|
60 |
<template slot-scope="scope"> |
|
61 |
<span style="color: red">{{scope.row.nbdrl}}</span> |
|
62 |
</template> |
|
63 |
</el-table-column> |
|
64 |
<el-table-column prop="nbtzl" header-align="center" align="center" label="累计调整量" min-width="150"></el-table-column> |
|
65 |
</el-table-column> |
|
66 |
<el-table-column header-align="center" align="center" label="外报量(吨)"> |
|
67 |
<el-table-column prop="wbdrl" header-align="center" align="center" label="当日" min-width="150"> |
|
68 |
<template slot-scope="scope"> |
|
69 |
<span style="color: red">{{scope.row.wbdrl}}</span> |
|
70 |
</template> |
|
71 |
</el-table-column> |
|
72 |
<el-table-column prop="wbtzl" header-align="center" align="center" label="累计调整量" min-width="150"></el-table-column> |
|
73 |
</el-table-column> |
|
74 |
<el-table-column show-overflow-tooltip prop="bz" header-align="center" align="center" label="备注" min-width="287"></el-table-column> |
|
75 |
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" min-width="100"> |
|
76 |
<template slot-scope="scope"> |
|
77 |
<el-button type="text" size="small" @click="openForm(scope.row.id)">修改</el-button> |
|
78 |
<el-button type="text" size="small" @click="handleDelete(scope.row.id)">删除</el-button> |
|
79 |
</template> |
|
80 |
</el-table-column> |
|
81 |
</el-table> |
|
82 |
<el-row style="margin-top: 6px"> |
|
83 |
<el-col :span="4"> |
|
84 |
<el-button @click="exportStatisticsExcel()">导出</el-button> |
|
85 |
</el-col> |
|
86 |
<el-col :span="20"> |
|
87 |
<el-pagination |
|
88 |
:current-page="page" |
|
89 |
:page-sizes="[10, 20, 50, 100]" |
|
90 |
:page-size="limit" |
|
91 |
:total="total" |
|
92 |
layout="total, sizes, prev, pager, next, jumper" |
|
93 |
@size-change="pageSizeChangeHandle" |
|
94 |
@current-change="pageCurrentChangeHandle"> |
|
95 |
</el-pagination> |
|
96 |
</el-col> |
|
97 |
</el-row> |
|
98 |
<el-table |
|
99 |
ref="statisticsTable" |
|
100 |
v-loading="dataListLoading" |
|
101 |
:data="statisticsList" |
|
102 |
border |
|
103 |
show-summary |
|
104 |
:summary-method="getStatisticsSummaries"> |
|
105 |
<el-table-column prop="drlyName" header-align="center" align="center" label="调入来源"></el-table-column> |
|
106 |
<el-table-column header-align="center" align="center" label="内报量(吨)"> |
|
107 |
<el-table-column prop="nbDaySum" header-align="center" align="center" label="当日"> |
|
108 |
<template slot-scope="scope"> |
|
109 |
<span style="color: red">{{scope.row.nbDaySum}}</span> |
|
110 |
</template> |
|
111 |
</el-table-column> |
|
112 |
<el-table-column prop="nbMonthSum" header-align="center" align="center" label="月累计"></el-table-column> |
|
113 |
<el-table-column prop="nbYearSum" header-align="center" align="center" label="年累计"></el-table-column> |
|
114 |
</el-table-column> |
|
115 |
<el-table-column header-align="center" align="center" label="外报量(吨)"> |
|
116 |
<el-table-column prop="wbDaySum" header-align="center" align="center" label="当日"> |
|
117 |
<template slot-scope="scope"> |
|
118 |
<span style="color: red">{{scope.row.wbDaySum}}</span> |
|
119 |
</template> |
|
120 |
</el-table-column> |
|
121 |
<el-table-column prop="wbMonthSum" header-align="center" align="center" label="月累计"></el-table-column> |
|
122 |
<el-table-column prop="wbYearSum" header-align="center" align="center" label="年累计"></el-table-column> |
|
123 |
</el-table-column> |
|
124 |
</el-table> |
|
125 |
<!-- 弹窗, 新增 / 修改 --> |
|
126 |
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|
127 |
</div> |
|
128 |
</el-card> |
|
129 |
</template> |
|
130 |
|
|
131 |
<script> |
|
132 |
import mixinViewModule from '@/mixins/view-module' |
|
133 |
import AddOrUpdate from './list-add-or-update' |
|
134 |
import {exportByDom} from "../../../../../utils/exportUtil"; |
|
135 |
export default { |
|
136 |
mixins: [mixinViewModule], |
|
137 |
data () { |
|
138 |
return { |
|
139 |
mixinViewModuleOptions: { |
|
140 |
getDataListURL: '/iailab-iems-coal-proddisp/wash/transfer-in/list', |
|
141 |
getDataListIsPage: true, |
|
142 |
deleteURL: '/iailab-iems-coal-proddisp/wash/transfer-in', |
|
143 |
deleteIsBatch: true, |
|
144 |
}, |
|
145 |
dataForm: { |
|
146 |
rq: (new Date()).Format('yyyy-MM-dd'), |
|
147 |
monthStart: '', |
|
148 |
yearStart: '' |
|
149 |
}, |
|
150 |
statisticsList: [] |
|
151 |
} |
|
152 |
}, |
|
153 |
components: { |
|
154 |
AddOrUpdate |
|
155 |
}, |
|
156 |
created () { |
|
157 |
if (this.mixinViewModuleOptions.createdIsNeed) { |
|
158 |
this.query() |
|
159 |
this.statisticsInit() |
|
160 |
} |
|
161 |
}, |
|
162 |
methods: { |
|
163 |
getDataList: function () { |
|
164 |
this.page = 1 |
|
165 |
this.query() |
|
166 |
this.statisticsInit() |
|
167 |
}, |
|
168 |
statisticsInit () { |
|
169 |
this.$http.get( |
|
170 |
'/iailab-iems-coal-proddisp/wash/transfer-in/statistics').then(({ data: res }) => { |
|
171 |
if (res.code !== 0) { |
|
172 |
return this.$message.error(res.msg) |
|
173 |
} |
|
174 |
this.statisticsList = res.list |
|
175 |
this.dataForm.monthStart = res.monthStart |
|
176 |
this.dataForm.yearStart = res.yearStart |
|
177 |
}).catch(() => {}) |
|
178 |
}, |
|
179 |
getSummaries(param) { |
|
180 |
const { columns, data } = param; |
|
181 |
const sums = []; |
|
182 |
columns.forEach((column, index) => { |
|
183 |
if (index === 0) { |
|
184 |
sums[index] = '合计'; |
|
185 |
return; |
|
186 |
} |
|
187 |
if (index === 1 || index === 2 || index === 3 || index === 4 || index === 9) { |
|
188 |
sums[index] = ''; |
|
189 |
return; |
|
190 |
} |
|
191 |
const values = data.map(item => Number(item[column.property])); |
|
192 |
if (!values.every(value => isNaN(value))) { |
|
193 |
sums[index] = values.reduce((prev, curr) => { |
|
194 |
const value = Number(curr); |
|
195 |
if (!isNaN(value)) { |
|
196 |
return prev + curr; |
|
197 |
} else { |
|
198 |
return prev; |
|
199 |
} |
|
200 |
}, 0); |
|
201 |
sums[index] = sums[index].toFixed(2); |
|
202 |
} else { |
|
203 |
sums[index] = ''; |
|
204 |
} |
|
205 |
}); |
|
206 |
|
|
207 |
return sums; |
|
208 |
}, |
|
209 |
getStatisticsSummaries(param) { |
|
210 |
const { columns, data } = param; |
|
211 |
const sums = []; |
|
212 |
columns.forEach((column, index) => { |
|
213 |
if (index === 0) { |
|
214 |
sums[index] = '合计'; |
|
215 |
return; |
|
216 |
} |
|
217 |
const values = data.map(item => Number(item[column.property])); |
|
218 |
if (!values.every(value => isNaN(value))) { |
|
219 |
sums[index] = values.reduce((prev, curr) => { |
|
220 |
const value = Number(curr); |
|
221 |
if (!isNaN(value)) { |
|
222 |
return prev + curr; |
|
223 |
} else { |
|
224 |
return prev; |
|
225 |
} |
|
226 |
}, 0); |
|
227 |
sums[index] = sums[index].toFixed(2); |
|
228 |
} else { |
|
229 |
sums[index] = ''; |
|
230 |
} |
|
231 |
}); |
|
232 |
|
|
233 |
return sums; |
|
234 |
}, |
|
235 |
exportExcel () { |
|
236 |
let dom = this.$refs.table |
|
237 |
exportByDom(dom, undefined, '调入量统计') |
|
238 |
}, |
|
239 |
exportStatisticsExcel () { |
|
240 |
let dom = this.$refs.statisticsTable |
|
241 |
exportByDom(dom, undefined, '调入量合计统计') |
|
242 |
} |
|
243 |
} |
|
244 |
} |
|
245 |
</script> |
|
246 |
|
|
247 |
<style scoped> |
|
248 |
|
|
249 |
/deep/ .el-table__footer-wrapper tbody td, |
|
250 |
.el-table__header-wrapper tbody td { |
|
251 |
background-color: #e3f3ff !important; |
|
252 |
} |
|
253 |
/deep/ .el-table__footer-wrapper .is-leaf { |
|
254 |
background-color: #e3f3ff !important; |
|
255 |
} |
|
256 |
/deep/ .el-table__fixed-footer-wrapper tbody td { |
|
257 |
border-top: 1px solid #ebeef5; |
|
258 |
background-color: #e3f3ff; |
|
259 |
font-weight: bold; |
|
260 |
color: #f50b0b; |
|
261 |
text-align: center !important; |
|
262 |
} |
|
263 |
/deep/ .has-gutter tr td .cell { |
|
264 |
text-align: center; |
|
265 |
font-weight: bold; |
|
266 |
color: blue; |
|
267 |
} |
|
268 |
</style> |