Commit a597f97d authored by 姬鋆屾's avatar 姬鋆屾

修改ai数据报表显示和到处功能

parent 75de4e66
......@@ -7,38 +7,68 @@
</a-button>
</div>
<span>
<a-checkbox-group :options="checkboxOptions" v-model="checkboxVALUE" @change="checkboxonChange" />
<a-input allowClear v-model="Query.workman_name" placeholder="请输入工作人员姓名查询 ">
<a-checkbox-group
:options="checkboxOptions"
v-model="checkboxVALUE"
@change="checkboxonChange"
/>
<a-input
allowClear
v-model="Query.workman_name"
placeholder="请输入工作人员姓名查询 "
>
<a-icon slot="prefix" type="search" />
</a-input>
<a-select v-model="Query.window_id" placeholder="请选择窗口">
<a-select-option value=""> 全部 </a-select-option>
<a-select-option v-for="(item, index) of windowData" :key="index" :value="item.id">
{{ item.englishName }} - {{item.fromnum}}
<a-select-option
v-for="(item, index) of windowData"
:key="index"
:value="item.id"
>
{{ item.englishName }} - {{ item.fromnum }}
</a-select-option>
</a-select>
<a-select v-model="Query.warn_alert" placeholder="请选择类型">
<a-select-option value=""> 全部 </a-select-option>
<a-select-option v-for="(item,i) in warn_alert" :key="i" :value="i">
<a-select-option v-for="(item, i) in warn_alert" :key="i" :value="i">
{{ item }}
</a-select-option>
</a-select>
<a-range-picker format="YYYY年MM月DD日" valueFormat="yyyy-MM-DD" class="range_picker_style"
v-model="Query.time">
<a-range-picker
format="YYYY年MM月DD日"
valueFormat="yyyy-MM-DD"
class="range_picker_style"
v-model="Query.time"
>
</a-range-picker>
<a-button type="primary" class="addclass" @click="onGetKqalert">搜索</a-button>
<a-button type="primary" class="addclass" @click="onGetKqalert"
>搜索</a-button
>
</span>
</div>
<div class="main">
<a-table size="small" bordered :row-key="(record) => record.id" :row-selection="{
<a-table
size="small"
bordered
:row-key="(record) => record.id"
:row-selection="{
selectedRowKeys: tableSelectedKeys,
onChange: onSelectChange,
}" :scroll="{ y: 590 }" :pagination="tablePagination" @change="changeTablePage" :loading="tableLoading"
:columns="tableHeaders" :dataSource="tableSourceData">
}"
:scroll="{ y: 590 }"
:pagination="tablePagination"
@change="changeTablePage"
:loading="tableLoading"
:columns="tableHeaders"
:dataSource="tableSourceData"
>
<template slot="operation" slot-scope="text, record">
<a-button type="link" @click="openDetails">查看详情{{ record.id }}</a-button>
<a-button type="link" @click="openDetails"
>查看详情{{ record.id }}</a-button
>
</template>
</a-table>
</div>
......@@ -46,25 +76,42 @@
</template>
<script>
import table from "@/mixins/table";
import {
export2Excel
} from "@/utils/js/exportExcel";
import {
getKqalert
} from "@/api/dataAdmin"
import {
windowList
} from "@/api/customer"
import moment from "moment";
const warn_alert = {
1: '离岗',
2: '离开',
4: '玩手机',
5: '扶头',
6: '趴桌',
}
export default {
import table from "@/mixins/table";
import { export2Excel } from "@/utils/js/exportExcel";
import { getKqalert } from "@/api/dataAdmin";
import { windowList } from "@/api/customer";
import moment from "moment";
const warn_alert = {
1: "离岗",
2: "离开",
4: "玩手机",
5: "扶头",
6: "趴桌",
};
const tHeader = [
"序号",
"报警类型",
"发生窗口",
"工作人员",
"所属部门",
"手机号",
"发生时间",
"时长",
"是否准确",
];
const filterVal = [
"index",
"warn_alert",
"window_name",
"workman_name",
"section_name",
"workman_phone",
"out_time",
"duration",
"isaccuracy",
"have_process_name",
];
export default {
mixins: [table],
name: "PortalAdminVueReportForm",
data() {
......@@ -80,11 +127,14 @@
}, //查询条件
checkboxVALUE: [],
BegindAndEndTime: [],
checkboxOptions: [{
checkboxOptions: [
{
label: "只看未处理",
value: "0",
}, ],
tableHeaders: [{
},
],
tableHeaders: [
{
title: "序号",
dataIndex: "index",
width: "60px",
......@@ -95,47 +145,48 @@
{
title: "报警类型",
dataIndex: "warn_alert",
customRender: (text, record) => warn_alert[text]
customRender: (text, record) => warn_alert[text],
},
{
title: "发生窗口",
dataIndex: "window_name",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) => (text ? text : "--"),
},
{
title: "工作人员",
dataIndex: "workman_name",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) => (text ? text : "--"),
},
{
title: "所属部门",
dataIndex: "section_name",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) => (text ? text : "--"),
},
{
title: "手机号",
dataIndex: "workman_phone",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) => (text ? text : "--"),
},
{
title: "发生时间",
dataIndex: "out_time",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) =>
text ? this.timestampToTime(text) : "--",
},
{
title: "时长",
dataIndex: "duration",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) => (text ? text : "--"),
},
{
title: "是否准确",
dataIndex: "isaccuracy",
customRender: (text, record) => text == 1 ? '准确' : '--'
customRender: (text, record) => (text == 1 ? "准确" : "--"),
},
{
title: "是否处理",
dataIndex: "have_process_name",
customRender: (text, record) => text ? text : '--'
customRender: (text, record) => (text ? text : "--"),
},
// {
// title: "操作",
......@@ -152,41 +203,57 @@
},
components: {},
mounted() {
this.onGetKqalert()
this.onGetKqalert();
this.setMoment();
this.getWindowList();
},
methods: {
// 时间戳转换为日期
timestampToTime(timestamp) {
var date = new Date(timestamp*1000);
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h = date.getHours() + ":";
var m = date.getMinutes() + ":";
var s = date.getSeconds();
return Y + M + D + h + m + s;
},
// 导出
async handleExportTable() {
let data = [];
if (this.tableSelectedKeys.length && this.tableSelectedRows.length) {
export2Excel(
this.tHeader,
this.filterVal,
this.tableSelectedRows,
"AI效能监察异常行为数据报表" + this.$moment().format("YYYYMMDDHHmmss")
);
// 深度克隆避免影响页面表格展示
data = this.$_.cloneDeep(this.tableSelectedRows);
} else {
getKqalert({
let datas = this.$_.cloneDeep(
await getKqalert({
...this.Query,
page: 1,
size: -1,
}).then(res => {
const {
code,
data
} = res;
if (code == 1) {
if (!data.data.length) return;
})
);
data = datas.data.data;
data.forEach((text, i) => {
text.index = i + 1;
text.isaccuracy = text.isaccuracy == 1 ? "准确" : "--";
text.out_time = text.out_time
? this.timestampToTime(text.out_time)
: "--";
});
if (!data.length) return;
export2Excel(
this.tHeader,
this.filterVal,
data.data,
tHeader,
filterVal,
data,
"AI效能监察异常行为数据报表" + this.$moment().format("YYYYMMDDHHmmss")
);
}
})
}
},
// 报表接口
onGetKqalert() {
......@@ -194,32 +261,26 @@
...this.Query,
page: this.tablePagination.current,
size: this.tablePagination.pageSize,
}).then(res => {
const {
code,
data
} = res
}).then((res) => {
const { code, data } = res;
if (code == 1) {
this.tableSourceData = data.data
this.tablePagination.total = data.total
this.tableSourceData = data.data;
this.tablePagination.total = data.total;
}
console.log(res)
})
console.log(res);
});
},
getWindowList() {
windowList({
page: 1,
size: -1,
siteId: JSON.parse(localStorage.getItem("siteId"))
}).then(res => {
const {
code,
data
} = res
siteId: JSON.parse(localStorage.getItem("siteId")),
}).then((res) => {
const { code, data } = res;
if (code == 1) {
this.windowData = data.data
this.windowData = data.data;
}
})
});
},
openDetails() {
console.log("跳转网页");
......@@ -231,9 +292,9 @@
},
checkboxonChange(val) {
if (val.length == 0) {
this.Query.have_process = ""
this.Query.have_process = "";
} else {
this.Query.have_process = "0"
this.Query.have_process = "0";
}
},
QueueState(type) {
......@@ -248,19 +309,19 @@
}
},
},
};
};
</script>
<style lang="less" scoped>
/deep/.ant-spin-container {
/deep/.ant-spin-container {
display: block;
}
}
/deep/.ant-checkbox-group {
/deep/.ant-checkbox-group {
width: 250px;
}
}
.range_picker_style {
.range_picker_style {
margin-right: 20px;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment