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

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

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