Browse Source

日志优化+员工使用统计+设备管理

newStyle
风继续吹 1 year ago
parent
commit
162e8f9912
8 changed files with 803 additions and 26 deletions
  1. +4
    -1
      src/api/modules/api.js
  2. +50
    -0
      src/api/modules/http.js
  3. +3
    -1
      src/const/crud/admin/log.js
  4. +283
    -22
      src/views/Equipment/state.vue
  5. +452
    -0
      src/views/Statistics/employeeUsageStatistics.vue
  6. +2
    -2
      src/views/Statistics/intelligentReporting.vue
  7. +1
    -0
      src/views/Statistics/reportDetail.vue
  8. +8
    -0
      src/views/admin/log/log.vue

+ 4
- 1
src/api/modules/api.js View File

@@ -1102,7 +1102,10 @@ export function addLoginCount(data) {
return request({
url: 'admin/log/addLoginCount',
method:'post',
data
data: {
...data,
houseName: localStorage.getItem('topName') || ''
}
})
}
export function targetAnalysis(query) {


+ 50
- 0
src/api/modules/http.js View File

@@ -1226,3 +1226,53 @@ export function addOperatingLog(params) {
})
}


// 获取员工使用统计
export function employeeUsageStatistics(data) {
return request({
url: 'autoSR/cusStageStatistics/employeeUsageStatistics',
method: 'post',
data
})
}


// 操作类型
export function findOperationType(params) {
return request({
url: 'admin/log/findOperationType',
method: 'get',
params
})
}


// 重启设备&下载录音文件&删除录音文件
export function updateEquipmentStatus(data) {
return request({
url: 'autoSR/zk/equipment/updateEquipmentStatus',
method: 'post',
data
})
}




// 查看debug日志
export function findFileByPage(params) {
return request({
url: 'autoSR/zk/equipment/findFileByPage',
method: 'get',
params
})
}

// 查看debug日志
export function deleteDebugRecord(params) {
return request({
url: 'autoSR/zk/equipment/deleteDebugRecord',
method: 'get',
params
})
}

+ 3
- 1
src/const/crud/admin/log.js View File

@@ -43,7 +43,9 @@ export const tableOption = {
},
{
label: "操作类型",
prop: "type",
prop: "operationType",
search: true,
type: 'select',
dicData: [{
label: '新增管理',
value: "0"


+ 283
- 22
src/views/Equipment/state.vue View File

@@ -346,6 +346,27 @@
<el-dropdown-item v-if="equ_state_equlog" command="equlog"
>设备日志</el-dropdown-item
>
<el-dropdown-item
v-if="permissions['equ_state_restart']"
command="rebootDevice"
>重启设备</el-dropdown-item
>

<el-dropdown-item
v-if="permissions['equ_state_downDeBug']"
command="changeDownLoad"
>修改下载状态</el-dropdown-item
>

<el-dropdown-item
v-if="permissions['equ_state_delete_recording_files']"
command="deleteRecordingFiles"
>删除录音文件</el-dropdown-item
>
<!-- v-if="permissions['equ_state_watch_debug']" -->
<el-dropdown-item command="showDeBugLog"
>查看debug日志</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</template>
@@ -534,6 +555,112 @@
</el-form-item>
</el-form>
</el-dialog>

<!-- 删除设备录音文件 -->
<el-dialog
title="提示"
:visible.sync="deleteRecordingShow"
@close="$refs.deleteRecordingShow.resetFields()"
width="30%"
>
<el-form
:model="deleteHour"
label-width="100px"
ref="deleteRecordingShow"
:rules="deleteHourRule"
>
<el-form-item label="删除时段:" prop="delTimeHorizonFile">
<el-time-picker
is-range
v-model="deleteHour.delTimeHorizonFile"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
format="HH:mm"
value-format="HH:mm"
>
</el-time-picker>
</el-form-item>
</el-form>
<div style="display: flex; justify-content: flex-end">
<el-button @click="deleteRecordingShow = false">取 消</el-button>
<el-button type="primary" @click="secondDelete">确 定</el-button>
</div>
</el-dialog>

<!-- 修改下载状态 -->
<el-dialog
title="提示"
:visible.sync="downLoadDeviceShow"
@close="$refs.downLoadDeviceShow.resetFields()"
width="30%"
>
<el-form
:model="downLoadDevice"
label-width="150px"
ref="downLoadDeviceShow"
:rules="downLoadDeviceRules"
>
<el-form-item label="下载文件类型:" prop="uploadDebugFile">
<el-radio-group v-model="downLoadDevice.uploadDebugFile" size="small">
<el-radio :label="1">debug文件</el-radio>
<el-radio :label="2">debug备份文件</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div style="display: flex; justify-content: flex-end">
<el-button @click="downLoadDeviceShow = false">取 消</el-button>
<el-button type="primary" @click="updateEquipmentStatus(downLoadDevice)"
>确 定</el-button
>
</div>
</el-dialog>

<el-dialog
title="debug日志"
:visible.sync="debugLogShow"
:close-on-click-modal="false"
>
<el-table :data="debugLogList" height="400px">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="createDate" label="生成时间"></el-table-column>
<el-table-column prop="createName" label="生成人"> </el-table-column>
<el-table-column label="操作">
<template slot-scope="{ row }">
<template v-if="row.status == 0">
<el-button type="text">生成中</el-button>
</template>
<template v-else>
<el-button @click="exportMethodPost(row)" type="text"
>下载</el-button
>
</template>

<el-button @click="deleteLogBug(row)" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
<div
style="
padding: 10px 0;
width: 100%;
display: flex;
justify-content: flex-end;
"
>
<el-pagination
@size-change="handleSizeChangeLog"
@current-change="handleCurrentChangeLog"
:current-page="debugParams.current"
:page-sizes="[10, 50, 100]"
:page-size="debugParams.size"
layout="total, sizes, prev, pager, next, jumper"
:total="debugParams.total"
>
</el-pagination>
</div>
</el-dialog>
</div>
</template>

@@ -553,7 +680,6 @@ export default {
currentPage: 1, // 当前页数
pageSize: 30, // 每页显示多少条
},

isOpen: false,
options: [
{
@@ -739,6 +865,43 @@ export default {
},
],
houseTypes: "0,1",

deleteRecordingShow: false, // 删除设备录音文件
deleteHour: {
delTimeHorizonFile: "", // 删除时间段
imei: "", // 需要删除的设备
},
deleteHourRule: {
delTimeHorizonFile: [
{ required: true, message: "请选择要删除的时间段", trigger: "blur" },
],
},

// 改变下载的
downLoadDevice: {
imei: "", // 需要下载的设备
uploadDebugFile: 1, // 1debug文件 2debug备份文件
}, //
downLoadDeviceShow: false, // 下载提示框
downLoadDeviceRules: {
uploadDebugFile: [
{
required: true,
message: "请选择要下载的文件类型",
trigger: "blur",
},
],
},

// debug
debugLogShow: false, //
debugLogList: [], // debug日志列表
debugParams: {
imei: "", //
size: 10, //
current: 1, // 分页
total: 0, // 总条数
}, // debug参数
};
},
computed: {
@@ -754,18 +917,18 @@ export default {
this.$db.upDate(params);
},
selValue(val) {
console.log(val, 'selValue')
console.log(val, "selValue");
},
choicValue(val) {
console.log(val, 'choicValue')
console.log(val, "choicValue");
},
dataList(val) {
console.log(val, 'dataList')
}
console.log(val, "dataList");
},
},
created() {
// 添加日志
this.addOperatingLog()
this.addOperatingLog();
// 获取缓存的页面数据
this.getFiltterOption();
// 获取显隐的列表
@@ -804,6 +967,101 @@ export default {
this.setFiltterOption();
},
methods: {
deleteLogBug(data) {
console.log(data);
this.$confirm(
`确定要删除生成时间是${data.createDate}的记录吗?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
).then(() => {
this.$api.http.deleteDebugRecord({ id: data.id }).then((res) => {
if (res.code == 10000) {
this.$message.success(res.message);
this.findFileByPage();
} else {
this.$message.error(res.message);
}
});
});
},

handleSizeChangeLog(val) {
this.debugParams.current = val;
this.findFileByPage();
},
handleCurrentChangeLog(val) {
this.debugParams.size = val;
this.findFileByPage();
},
// 查看debug日志
showDeBugLog(row) {
this.debugLogShow = true;
this.debugParams.imei = row.imei;
this.findFileByPage();
},
findFileByPage() {
this.$api.http.findFileByPage(this.debugParams).then((res) => {
console.log(res);
if (res.code == 10000) {
this.debugLogList = res.data.records;
this.debugParams.total = res.data.total;
}
});
},
secondDelete() {
if (!this.deleteHour.delTimeHorizonFile) {
this.$message.error("请选择删除时段");
return;
}
let obj = {
delTimeHorizonFile: this.deleteHour.delTimeHorizonFile.join("-"),
imei: this.deleteHour.imei,
};
this.updateEquipmentStatus(obj);
},
// 重启设备&下载录音文件&删除录音文件
updateEquipmentStatus(obj) {
this.$api.http.updateEquipmentStatus(obj).then((res) => {
if (res.code == 10000) {
this.$message.success(res.message);
this.zkhousePage();
this.downLoadDeviceShow = false;
this.deleteRecordingShow = false;
} else {
this.$message.error(res.message);
}
});
},

deleteRecordingFiles(row) {
this.deleteHour.imei = row.imei;
this.deleteRecordingShow = true;
},

changeDownLoad(row) {
this.downLoadDevice.imei = row.imei;
this.downLoadDeviceShow = true;
},

// 重启设备
rebootDevice(row) {
let obj = {
imei: row.imei,
restartEquipment: 1,
};
this.$confirm(`确定要重启${row.imei}设备吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.updateEquipmentStatus(obj);
});
},

// 添加日志
addOperatingLog() {
this.$api.http.addOperatingLog({ logType: 12 });
@@ -820,7 +1078,7 @@ export default {
changeValue: this.changeValue,
searchForm: this.searchForm,
dataList: this.dataList,
isOpen: this.isOpen
isOpen: this.isOpen,
},
};
console.log(this.dataList, this.selValue);
@@ -830,21 +1088,24 @@ export default {
},
// 获取当前页面筛选条件
getFiltterOption() {
this.$db.getDataByKey(this.filtterOptionName).then((res) => {
console.log(res.optionData.dataList);
this.searchForm = res.optionData.searchForm;
this.houseTypes = res.optionData.houseTypes;
this.selValue = res.optionData.selValue;
this.choicValue = res.optionData.choicValue;
this.time = res.optionData.time;
this.changeValue = res.optionData.changeValue;
this.dataList = res.optionData.dataList;
this.isOpen = res.optionData.isOpen;
this.getTableList();
}).catch(e => {
// 获取不到本地存储的数据在调用获取详细列表
this.getList();
});
this.$db
.getDataByKey(this.filtterOptionName)
.then((res) => {
console.log(res.optionData.dataList);
this.searchForm = res.optionData.searchForm;
this.houseTypes = res.optionData.houseTypes;
this.selValue = res.optionData.selValue;
this.choicValue = res.optionData.choicValue;
this.time = res.optionData.time;
this.changeValue = res.optionData.changeValue;
this.dataList = res.optionData.dataList;
this.isOpen = res.optionData.isOpen;
this.getTableList();
})
.catch((e) => {
// 获取不到本地存储的数据在调用获取详细列表
this.getList();
});
},
// 获取当前页面的显隐
setTableOption() {


+ 452
- 0
src/views/Statistics/employeeUsageStatistics.vue View File

@@ -0,0 +1,452 @@
<template>
<div class="pages">
<div class="app-titel" style="height: auto; padding: 26px 0">
<div class="screeningbox">
<div class="screeningboxlebl">添加时间:</div>
<el-radio-group
v-model="pageParams.dateType"
size="small"
@change="tabtimetap"
>
<el-radio-button :label="4">近7天</el-radio-button>
<el-radio-button :label="5">近15天</el-radio-button>
<el-radio-button :label="6">近30天</el-radio-button>
</el-radio-group>
<div style="margin-left: 26px">
<el-date-picker
style="width: 250px; height: 32px; line-height: 32px"
@change="confirmtime()"
v-model="customtime"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</div>

<div class="screeningboxlebl" style="margin-left: 20px">员工身份:</div>
<div style="height: 32px">
<el-select
v-model="pageParams.identity"
clearable
filterable
placeholder="请选择"
@change="changeIdentity"
>
<el-option label="项目总" :value="2"></el-option>
<el-option label="客服" :value="3"></el-option>
<el-option label="策划" :value="4"></el-option>
<el-option label="经理" :value="5"></el-option>
<el-option label="置业顾问" :value="6"></el-option>
</el-select>
</div>

<div class="screeningboxlebl" style="margin-left: 20px">项目:</div>
<div style="height: 32px">
<el-select
v-model="pageParams.houseId"
clearable
filterable
placeholder="请选择"
@change="changeHouse"
>
<el-option
v-for="(data, index) in houstList"
:key="index"
:label="data.propertyName"
:value="data.id"
></el-option>
</el-select>
</div>
</div>
</div>
<div class="screeningbox" style="margin-top: 20px; background: #fff">
<button class="button1" @click="employeeUsageStatistics()">筛选</button>
<button
style="background: #ffffff; color: #606775"
class="button1"
@click="Emptycondition()"
>
清空筛选条件
</button>
<button class="button1" @click="daochu()">导出</button>
</div>
<div class="app-box">
<el-table
:data="tableData"
stripe
:load="loading"
:header-cell-style="{
background: '#F7F8FA',
borderColor: '#E0E0E0',
color: '#606775',
}"
style="width: 100%"
>
<el-table-column
width="180"
prop="accountName"
label="姓名"
align="center"
>
</el-table-column>
<el-table-column prop="identityName" label="身份" align="center">
</el-table-column>
<el-table-column prop="houseName" label="项目名称" align="center">
</el-table-column>
<el-table-column
prop="loginCount"
width="100"
label="登录次数"
align="center"
>
</el-table-column>
<el-table-column
prop="lookingReceptionCount"
width="100"
label="查看接待"
align="center"
>
</el-table-column>
<el-table-column
prop="setViolatedCount"
width="100"
label="违禁处理"
align="center"
>
</el-table-column>
<el-table-column
prop="lookingDailyAndWeekly"
width="100"
label="查看周报日报"
align="center"
>
</el-table-column>
<el-table-column
prop="shareDailyAndWeekly"
width="100"
label="分享周报日报"
align="center"
>
</el-table-column>
<el-table-column
prop="auditReceptionCount"
label="无效审核"
width="180"
align="center"
>
</el-table-column>
</el-table>

<div class="block">
<div class="blockbox">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageParams.pageNum"
:page-sizes="[10, 20, 30, 40, 50, 100]"
:page-size="pageParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
</div>
</div>
</div>
</template>

<script>
export default {
data() {
return {
pageParams: {
dateType: 5, // 4 近七天 5 十五天 6 三十天
statDateStart: "", // 开始时间
statDateEnd: "", // 结束时间
houseId: "", // 项目id
identity: null, // 身份标识 2:项目总、3:客服、4:策划、5:经理、6:置业顾问
pageNum: 1, // 当前页面
pageSize: 10, // 页面数量
},
total: 0, // 总条数
tableData: [], // 员工分析列表
loading: false,
customtime: [], // 时间段选择
houstList: [], // 项目列表
};
},

mounted() {
// 员工使用统计
this.employeeUsageStatistics();
// 获取项目列表
this.getHouse();
},

methods: {
// 获取项目列表
getHouse() {
this.$api.http.InvalidFindHouseListByAccount().then((res) => {
this.houstList = res.data;
});
},
// 获取员工使用统计
employeeUsageStatistics() {
this.$api.http.employeeUsageStatistics(this.pageParams).then((res) => {
console.log(res);
if (res.data.records) {
this.tableData = res.data.records;
this.total = res.data.total;
}
});
},

daochu() {
let obj = {
...this.pageParams,
orgType: localStorage.getItem('orgType')
}

this.exportMethodPost('autoSR/cusStageStatistics/employeeUsageStatisticsExport', '员工使用统计', obj)
// let str = "?";
// for (let i in this.pageParams) {
// str += i + "=" + (this.pageParams[i] || "") + "&";
// }

// window.location.href =
// "${jypath}/cusStageStatistics/employeeUsageStatisticsExport" +
// str.substr(0, str.length - 1);
},

// 导出.Excel公用方法
exportMethodPost(url, name, data = {}) {
axios({
method: "get",
url: url,
params: data,
responseType: "blob",
})
.then((res) => {
if (!res) {
this.$message.error("获取数据失败,请稍候再试");
return;
}
let blob = new Blob([res], { type: "application/vnd.ms-excel" });
let date = new Date();
let time = date.toLocaleDateString();
// console.log(time, "时间");
if ("download" in document.createElement("a")) {
const link = document.createElement("a");
link.style.display = "none";
link.href = URL.createObjectURL(blob);
// link.download = res.headers['content-disposition'] //下载后文件名
link.download = (name || "导出文件") + time + ".xlsx"; //下载的文件名
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
// console.log("--------------------jingla")
let fileName = (name || "导出文件") + time + ".xlsx"; //下载的文件名
navigator.msSaveBlob(blob, fileName);
}
})
.catch((error) => {
// Message.error({
// message: '网络连接错误'
// })
console.log(error);
});
},

//清空筛选条件
Emptycondition() {
this.pageParams = {
dateType: 5, // 4 近七天 5 十五天 6 三十天
statDateStart: "", // 开始时间
statDateEnd: "", // 结束时间
houseId: "", // 项目id
identity: null, // 身份标识 2:项目总、3:客服、4:策划、5:经理、6:置业顾问
pageNum: 1, // 当前页面
pageSize: 10, // 页面数量
};
this.customtime = [];
this.employeeUsageStatistics();
},
resetParamsTime() {
this.tableData = [];
this.pageParams.pageNum = 1;
this.pageParams.pageSize = 10;
this.pageParams.statDateStart = "";
this.pageParams.statDateEnd = "";
},
//时间tab切换
tabtimetap() {
this.resetParamsTime();
this.employeeUsageStatistics();
},

changeIdentity() {
this.employeeUsageStatistics();
},
changeHouse() {
this.employeeUsageStatistics();
},

//时间选择
confirmtime() {
if (this.customtime.length) {
this.pageParams.dateType = null;
this.pageParams.statDateStart = this.customtime[0];
this.pageParams.statDateEnd = this.customtime[1];
this.employeeUsageStatistics();
}
},
handleSizeChange(val) {
console.log("每页条" + val);
this.pageParams.pageSize = val;
this.employeeUsageStatistics();
},
handleCurrentChange(val) {
console.log("当前页" + val);
this.pageParams.pageNum = val;
this.employeeUsageStatistics();
},
},
};
</script>

<style lang="scss" scoped>
.pages {
margin: 0 auto;
width: 98%;
height: 90%;
padding: 15px;
background: #fff;
border-radius: 16px;
}
.app-titel {
width: 100%;
height: 180px;
background: #ffffff;
padding-top: 26px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
border-radius: 8px;
}

.screeningbox {
width: 100%;
height: 32px;
display: flex;
align-items: center;
}

.screeningboxlebl {
min-width: 104px;
text-align: right;
font-size: 16px;
color: #32363d;
}

.inputbox {
width: 160px;
height: 32px;
background: #ffffff;
}

.el-input__inner {
height: 32px;
}

.el-input__suffix {
top: 6px;
}

.el-date-editor .el-range__icon {
line-height: 25px;
}

.el-date-editor .el-range-separator {
line-height: 25px;
}

.button1 {
padding-left: 16px;
padding-right: 16px;
height: 32px;
line-height: 32px;
background: #2671e2;
border-radius: 2px;
color: #ffffff;
font-size: 16px;
border: none;
cursor: pointer;
}

.app-box {
width: 100%;
min-height: 300px;
background: #ffffff;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
border-radius: 8px;
padding: 20px 20px 40px;
margin-top: 20px;
}

.el-table thead {
background: #e0e0e0;
}

.block {
width: 100%;
margin-top: 5px;
display: flex;
}

.blockbox {
margin-left: auto;
}

.el-date-editor .el-range-input,
.el-date-editor .el-range-separator {
margin: 3px;
}

.screeningbox .el-select .el-select__tags {
flex-wrap: unset !important;
overflow: auto !important;
}

.screeningbox .el-select .el-select__tags::-webkit-scrollbar {
/*滚动条整体样式*/
width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
height: 4px;
scrollbar-arrow-color: red;
}

.screeningbox .el-select .el-select__tags::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: rgba(0, 0, 0, 0.2);
scrollbar-arrow-color: red;
}

.screeningbox .el-select .el-select__tags::-webkit-scrollbar-track {
/*滚动条里面轨道*/
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
background: rgba(0, 0, 0, 0.1);
}

.el-radio-button__orig-radio:checked + .el-radio-button__inner {
color: #fff;
background-color: #2671e2;
border-color: #2671e2;
-webkit-box-shadow: -1px 0 0 0 #2671e2;
box-shadow: -1px 0 0 0 #2671e2;
}
</style>

+ 2
- 2
src/views/Statistics/intelligentReporting.vue View File

@@ -392,7 +392,8 @@ export default {
this.$api.http.monthlyGetProjectList({
orgCode: row.orgCode,
}).then((res) => {
this.projectList = res.data.data;
console.log(res)
this.projectList = res.data;
});
},

@@ -602,7 +603,6 @@ export default {
} else {
this.$message.error(res.data.message);
}
location.reload();
})
.catch((e) => {
this.$message.error("操作失败");


+ 1
- 0
src/views/Statistics/reportDetail.vue View File

@@ -1377,6 +1377,7 @@
<script>
import html2canvas from "html2canvas";
import jsPDF from "jspdf";
import * as echarts from "echarts";
export default {
data() {
return {


+ 8
- 0
src/views/admin/log/log.vue View File

@@ -62,10 +62,17 @@ export default {
},
},
created() {
this.findOperationType()
this.addOperatingLog()
this.admin_log_downLoad = this.permissions["admin_log_downLoad"];
},
methods: {
findOperationType() {
this.$api.http.findOperationType().then(res => {
console.log(res)
this.tableOption.column[4].dicData = res.data
})
},
// 添加日志
addOperatingLog() {
this.$api.http.addOperatingLog({logType: 3})
@@ -142,6 +149,7 @@ export default {
descs: "create_time",
current: page.currentPage,
size: page.pageSize,
operationType: page.operationType,
orgType: localStorage.getItem("orgType"),
orgCode: localStorage.getItem("orgCode"),
agentId: localStorage.getItem("agentId"),


Loading…
Cancel
Save