index.vue
10.6 KB
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
<template>
<div class="NCC-common-layout systemLogs">
<div class="NCC-common-layout-center">
<el-row class="NCC-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="4">
<el-form-item label="拒收原因">
<el-select v-model="query.unqualifiedreason" placeholder="下拉选择" clearable>
<el-option label="全部" value="全部" />
<el-option v-for="(item, index) in unqualifiedreasonOptions" :key="index" :label="item.OPTIONNAME" :value="item.OPTIONNAME" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="日期选择">
<el-date-picker
v-model="query.receivingtime"
type="daterange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
clearable
:editable="false"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"
>查询</el-button
>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="NCC-common-layout-main NCC-flex-main">
<el-tabs v-model="activeName" type="border-card" class="logTabs">
<!-- <div class="NCC-common-head">
<div class="NCC-common-head-right">
<el-tooltip effect="dark" content="刷新" placement="top">
<el-link
icon="icon-ym icon-ym-Refresh NCC-common-head-icon"
:underline="false"
@click="reset()"
/>
</el-tooltip>
<screenfull isContainer />
</div>
</div> -->
<el-tab-pane label="数据列表" name="1" style="padding: 5px">
<NCC-table v-loading="listLoading" :data="list">
<el-table-column prop="reason" label="拒收原因" align="left" />
<el-table-column prop="sl" label="标本数量" align="left" />
<el-table-column prop="bl" label="百分率" align="left" />
</NCC-table>
</el-tab-pane>
<el-tab-pane label="统计图表" name="5">
<div class="chart-container app-container nohead">
<div id="container" style="min-width:400px;height:400px"></div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import { Chart } from "highcharts-vue";
import Highcharts from "highcharts";
//import echarts from "echarts";
//import resize from "../graphDemo/mixins/resize";
import request from "@/utils/request";
import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { previewDataInterface } from "@/api/systemData/dataInterface";
export default {
components: { highcharts: Chart },
name: "extend-graphDemo-highchartsPie",
data() {
return {
chartOptions: {},
query: {
sectiontime: undefined,
},
list: [],
chartlist:[],
activeName: "1",
listLoading: true,
multipleSelection: [],
total: 0,
listQuery: {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
exportBoxVisible: false,
// columnList: [
// { prop: "tasksource", label: "单行输入" },
// { prop: "status", label: "单行输入" },
// { prop: "verifier", label: "单行输入" },
// { prop: "archiveman", label: "单行输入" },
// { prop: "hospitalname", label: "单行输入" },
// { prop: "areagroup", label: "单行输入" },
// { prop: "sectiontime", label: "日期选择" },
// ],
unqualifiedreasonOptions : [],
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]);
},
},
],
},
};
},
computed: {},
mounted() {
//this.init();
//this.query.unqualifiedreason = this.unqualifiedreasonOptions[0].id;
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
created() {
this.defaultDate();
this.getunqualifiedreasonOptions();
this.initData();
this.query.unqualifiedreason = "全部";
//this.query.sectiontime=this.timeDefault;
//console.log("xxx:"+this.timeDefault);
},
timeDefault() {
let date = new Date();
// 通过时间戳计算
let defalutStartTime = date.getTime() - 7 * 24 * 3600 * 1000; // 转化为时间戳
let defalutEndTime = date.getTime();
let startDateNs = new Date(defalutStartTime);
let endDateNs = new Date(defalutEndTime);
// 月,日 不够10补0
defalutStartTime =
startDateNs.getFullYear() +
"-" +
(startDateNs.getMonth() + 1 >= 10
? startDateNs.getMonth() + 1
: "0" + (startDateNs.getMonth() + 1)) +
"-" +
(startDateNs.getDate() >= 10
? startDateNs.getDate()
: "0" + startDateNs.getDate());
defalutEndTime =
endDateNs.getFullYear() +
"-" +
(endDateNs.getMonth() + 1 >= 10
? endDateNs.getMonth() + 1
: "0" + (endDateNs.getMonth() + 1)) +
"-" +
(endDateNs.getDate() >= 10
? endDateNs.getDate()
: "0" + endDateNs.getDate());
return [defalutStartTime, defalutEndTime];
},
methods: {
getunqualifiedreasonOptions(){
previewDataInterface('218574423215572229').then(res => {
this.unqualifiedreasonOptions = res.data;
console.log("xxx:"+this.unqualifiedreasonOptions);
});
},
init() {
console.log("list:"+this.list);
this.list.forEach(element => {
this.chartlist.push({name:element.reason,y:element.sl});
console.log(element.sl);
});
Highcharts.chart("container", {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: "pie",
},
title: {
text: "图表统计",
},
tooltip: {
pointFormat: "{series.name}: <b>{point.percentage:.1f}%</b>",
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: "pointer",
dataLabels: {
enabled: true,
format: "<b>{point.name}</b>: {point.percentage:.1f} %",
style: {
color:
(Highcharts.theme && Highcharts.theme.contrastTextColor) ||
"black",
},
},
},
},
series: [
{
name: "百分率",
colorByPoint: true,
data: this.chartlist,
},
],
});
},
initData() {
const activeId = this.activeName;
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
};
let query = {};
for (let key in _query) {
if (Array.isArray(_query[key])) {
query[key] = _query[key].join();
} else {
query[key] = _query[key];
}
}
request({
url: `/api/SubDev/Specimens`,
method: "GET",
data: query,
}).then((res) => {
//console.log(res);
this.list = res.data;
this.chartlist=[];
this.init();
this.listLoading = false;
});
},
handleTabClick() {
this.reset();
},
reset() {},
defaultDate() {
//获取新的时间(2019.4.12)
let date = new Date();
//获取当前时间的年份转为字符串
let year = date.getFullYear().toString(); //'2019'
//获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
let month =
date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1).toString()
: (date.getMonth() + 1).toString(); //'04'
//获取天,判断是否小于10,如果是在字符串前面拼接'0'
let da =
date.getDate() < 10
? "0" + date.getDate().toString()
: date.getDate().toString(); //'12'
//字符串拼接,开始时间,结束时间
let end = year + "-" + month + "-" + da; //当天'2019-04-12'
let beg = year + "-" + month + "-01"; //当月第一天'2019-04-01'
this.query.sectiontime = [beg, end]; //将值设置给插件绑定的数据
//this.startTime =beg;
//this.endTime=end;
},
addOrUpdateHandle(id, isDetail) {
this.formVisible = true;
this.$nextTick(() => {
this.$refs.NCCForm.init(id, isDetail);
});
},
search() {
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
};
this.initData();
},
refresh(isrRefresh) {
this.defaultDate();
this.formVisible = false;
if (isrRefresh) this.reset();
},
reset() {
for (let key in this.query) {
this.query[key] = undefined;
}
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
};
this.initData();
},
},
};
</script>
<style lang="scss" scoped>
.systemLogs {
.NCC-common-layout-main {
padding: 0;
}
.logTabs {
height: 100%;
}
.line1 {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
>>> .el-tabs__content {
height: calc(100% - 40px);
padding: 0;
.el-tab-pane {
height: calc(100% - 10px);
overflow: hidden;
}
}
}
</style>