Merge branch 'build' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_webapp into build
This commit is contained in:
@@ -3,7 +3,7 @@ const {chalkTag, findApp, fs} = require("./tools");
|
||||
const compiler = require('vue-template-compiler')
|
||||
const saveApps = app => {
|
||||
if (app.list.length > 0) {
|
||||
return axios.post("http://dvcp.sinoecare.net/node/wechatapps/addOrUpdate", app, {timeout: 1000}).then(res => {
|
||||
return axios.post("http://192.168.1.87:12525/node/wechatapps/addOrUpdate", app, {timeout: 1000}).then(res => {
|
||||
if (res.data.code == 0) chalkTag.done("产品库目录已同步至后台数据库...")
|
||||
}).catch(() => 0)
|
||||
} else return Promise.reject("没有应用")
|
||||
|
||||
@@ -4,13 +4,21 @@
|
||||
<ai-title slot="title" :title="$options.label" isShowBottomBorder/>
|
||||
<template #blank>
|
||||
<el-row type="flex">
|
||||
<ai-card title="接口异常分布"></ai-card>
|
||||
<ai-card title="接口异常分布">
|
||||
<ai-echart/>
|
||||
</ai-card>
|
||||
<ai-card class="fill mar-l16" title="接口异常TOP10"></ai-card>
|
||||
</el-row>
|
||||
<ai-card title="所有异常接口">
|
||||
<ai-table :tableData="tableData" :colConfigs="columns">
|
||||
|
||||
</ai-table>
|
||||
<ai-card panel>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<ai-select placeholder="状态码" v-model="search.status" :selectList="networkStatus" @change="page.current=1,getTableData()"/>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-input v-model="search.name" size="small" placeholder="搜索接口" clearable @change="page.current=1,getTableData()"/>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table :tableData="tableData" :colConfigs="columns" :pageConfig.sync="page" @getList="getTableData" :dict="dict"/>
|
||||
</ai-card>
|
||||
</template>
|
||||
</ai-list>
|
||||
@@ -19,26 +27,57 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AiSearchBar from "dui/packages/layout/AiSearchBar";
|
||||
import AiSelect from "dui/packages/basic/AiSelect";
|
||||
|
||||
export default {
|
||||
name: "AppApiMonitor",
|
||||
components: {AiSelect, AiSearchBar},
|
||||
label: "接口监控",
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
page: {current: 1},
|
||||
search: {},
|
||||
columns: [
|
||||
{label: "状态码", prop: "status"},
|
||||
{label: "接口地址", prop: "status"},
|
||||
{label: "错误信息", prop: "status"},
|
||||
{label: "终端", prop: "status"},
|
||||
{label: "页面", prop: "status"},
|
||||
{label: "用户", prop: "status"},
|
||||
{label: "环境", prop: "status"},
|
||||
{label: "事件", prop: "status"},
|
||||
{label: "接口地址", prop: "path"},
|
||||
{label: "错误信息", prop: "error"},
|
||||
{label: "终端", prop: "device"},
|
||||
{label: "页面", prop: "url"},
|
||||
{label: "用户", prop: "userName"},
|
||||
{label: "环境", prop: "nodeProcess"},
|
||||
{label: "创建时间", prop: "createTime"},
|
||||
],
|
||||
networkStatus: [
|
||||
{dictValue: 200, dictName: '200:成功'},
|
||||
{dictValue: 500, dictName: '500:接口失败'},
|
||||
{dictValue: 401, dictName: '401:token失效'},
|
||||
{dictValue: 403, dictName: '403:未授权访问'},
|
||||
{dictValue: 404, dictName: '404:无法找到接口'},
|
||||
{dictValue: 504, dictName: '504:接口超时'},
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
methods: {
|
||||
getTableData() {
|
||||
this.instance.post("/node/monitorApi/list", null, {
|
||||
params: {...this.page, ...this.search}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.tableData = res.data.records
|
||||
this.page.total = res.data.total
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableData()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
281
project/tongren/AppAccountTr/AppAccountTr.vue
Normal file
281
project/tongren/AppAccountTr/AppAccountTr.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<section class="AppAccountTr">
|
||||
<ai-list>
|
||||
<ai-title slot="title" title="账号管理" isShowBottomBorder>
|
||||
<template #rightBtn>
|
||||
<el-button size="small" type="primary" icon="iconfont iconUpdate_Files" @click="syncDept">同步部门</el-button>
|
||||
</template>
|
||||
</ai-title>
|
||||
<template #left>
|
||||
<ai-address-book-menu :instance="instance" @select="handleSelect"/>
|
||||
</template>
|
||||
<template #content>
|
||||
<ai-title :title="tableTitle"/>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-button type="primary" :disabled="!ids.toString()" @click="batchAllot">功能分配</el-button>
|
||||
<el-button size="small" icon="iconfont iconUpdate_Files" @click="syncMembers">同步成员</el-button>
|
||||
<ai-select placeholder="账号角色" v-model="search.roleId" :instance="instance"
|
||||
action="/admin/role-acc/list-all" :prop="{label:'name'}" @change="page.current=1,getTableData()"/>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-input size="small" placeholder="搜索姓名、手机号" v-model="search.name" clearable
|
||||
v-throttle="() => {page.current = 1, getTableData()}"/>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
|
||||
@getList="getTableData" :col-configs="colConfigs" :dict="dict"
|
||||
@selection-change="v=>ids=v.filter(e=>e.sysUserId).map(e=>e.sysUserId)">
|
||||
<el-table-column slot="name" label="姓名" width="180px">
|
||||
<el-row type="flex" align="middle" slot-scope="{row}">
|
||||
<el-image class="avatar" :src="row.avatar" :preview-src-list="[row.avatar]">
|
||||
<el-image slot="error" src="https://cdn.cunwuyun.cn/dvcp/h5/defaultAvatar.png" alt=""/>
|
||||
</el-image>
|
||||
<div>{{ row.name }}</div>
|
||||
</el-row>
|
||||
</el-table-column>
|
||||
<el-table-column slot="options" align="center" label="操作" fixed="right" width="160px">
|
||||
<el-row type="flex" justify="center" align="middle" slot-scope="{row}">
|
||||
<el-button v-if="$permissions('admin_sysuser_distribute')&&!!row.sysUserId"
|
||||
type="text" @click="appAllot(row)">功能分配
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</template>
|
||||
</ai-list>
|
||||
<!--功能分配-->
|
||||
<ai-dialog title="功能分配" :visible.sync="dialog" width="800px" @open="initDialogData" @onConfirm="updateAccount">
|
||||
<el-form ref="updateAccountForm" :model="dialogForm" :rules="rules" size="small"
|
||||
label-width="120px">
|
||||
<el-form-item required label="角色" prop="roleId">
|
||||
<ai-select placeholder="请选择角色" v-model="dialogForm.roleId" :instance="instance" action="/admin/role-acc/list-all" :prop="{label:'name'}"/>
|
||||
</el-form-item>
|
||||
<el-form-item required label="主部门" prop="wxMainDepartmentId">
|
||||
<ai-select v-model="dialogForm.wxMainDepartmentId" placeholder="请选择主部门" :instance="instance" action="/app/wxcp/wxdepartment/listAll"
|
||||
:prop="{label:'fullName'}"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="行政地区" prop="areaId">
|
||||
<ai-area-select v-model="dialogForm.areaId" always-show :instance="instance"
|
||||
clearable @fullname="v=>dialogForm.areaFullName=v"
|
||||
@name="v=>dialogForm.areaName=v"
|
||||
:disabledLevel="disabledLevel"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="党组织" prop="organizationId" v-if="user.info.organizationId">
|
||||
<el-cascader :options="partyOrgOps" v-model="dialogForm.organizationId"
|
||||
:props="cascaderProps" :show-all-levels="false" clearable/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="职务" prop="position">-->
|
||||
<!-- <el-input placeholder="请输入职务" v-model="dialogForm.position" clearable/>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "AppAccountTr",
|
||||
label: "账号管理",
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
cascaderProps() {
|
||||
return {
|
||||
value: 'id',
|
||||
checkStrictly: true,
|
||||
emitPath: false
|
||||
}
|
||||
},
|
||||
partyOrgOps() {
|
||||
let initData = JSON.parse(JSON.stringify(this.optionsParty)),
|
||||
ops = initData.filter(e => !e.parentId)
|
||||
ops.map(e => this.addChild(e, initData))
|
||||
return ops
|
||||
},
|
||||
colConfigs() {
|
||||
return [
|
||||
{type: 'selection', align: 'center'},
|
||||
{label: "姓名", slot: "name"},
|
||||
{label: "职务", prop: "position", align: 'center', width: "120px"},
|
||||
{label: "部门", prop: "departmentNames", align: 'center', width: "120px"},
|
||||
{label: "联系方式", prop: "mobile", align: 'center', width: "120px"},
|
||||
{label: "账号状态", prop: "status", dict: "wxUserStatus", width: "120px"},
|
||||
{label: "账号角色", prop: "roleName", width: "120px", align: '120px'},
|
||||
{label: "地区", prop: "areaName", width: "120px"},
|
||||
{label: "党组织", prop: "organizationName", align: 'center', width: "120px"},
|
||||
{slot: "options"}
|
||||
]
|
||||
},
|
||||
tableTitle() {
|
||||
return this.condition ? this.condition + `(${this.page.total})` : '请选择组织或标签'
|
||||
},
|
||||
rules() {
|
||||
return {
|
||||
name: [{required: true, message: "请填写姓名"}],
|
||||
// organizationId: [{required: true, message: "请选择党组织"}],
|
||||
// unitId: [{required: true, message: "请选择单位"}],
|
||||
areaId: [{required: true, message: '请选择地区', trigger: 'change'}],
|
||||
roleId: [{required: true, message: "请选择角色"}],
|
||||
phone: [{required: true, message: "请输入手机号码"}],
|
||||
wxMainDepartmentId: [{required: true, message: "请选择主部门"}],
|
||||
}
|
||||
},
|
||||
disabledLevel() {
|
||||
return this.user.info.areaList?.length || 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
condition: "",
|
||||
page: {current: 1, size: 10, total: 0},
|
||||
dialog: false,
|
||||
dialogForm: {},
|
||||
optionsParty: [],
|
||||
tableData: [],
|
||||
search: {name: ""},
|
||||
ids: [],
|
||||
lock: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTableData() {
|
||||
this.instance.post("/app/wxcp/wxuser/list", null, {
|
||||
params: {...this.page, ...this.search}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.tableData = res.data?.records
|
||||
this.page.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSelect(v) {
|
||||
if (v.type == 0) {
|
||||
//选择部门
|
||||
let {id: departmentId, name} = v
|
||||
this.condition = name
|
||||
this.search = {departmentId}
|
||||
} else if (v.type == 1) {
|
||||
//选择标签
|
||||
let {id: tagIds, tagname: name} = v
|
||||
this.condition = name
|
||||
this.search = {tagIds}
|
||||
}
|
||||
this.page.current = 1
|
||||
this.getTableData()
|
||||
},
|
||||
initDialogData() {
|
||||
//用于优化初始化数据
|
||||
this.searchSysAll()
|
||||
},
|
||||
batchAllot() {
|
||||
this.dialog = true
|
||||
this.dialogForm = {areaId: this.user.info.areaId, sysUserIds: this.ids}
|
||||
},
|
||||
appAllot(row) {
|
||||
this.dialog = true
|
||||
this.dialogForm = JSON.parse(JSON.stringify({
|
||||
...row,
|
||||
sysUserIds: [row.sysUserId],
|
||||
areaId: row.areaId || this.user.info.areaId
|
||||
}));
|
||||
},
|
||||
// 获取党组织树形
|
||||
searchSysAll() {
|
||||
if (this.user.info.organizationId && this.optionsParty.length == 0) {
|
||||
this.instance.post('/app/partyOrganization/queryPartyOrganizationServiceList').then((res) => {
|
||||
if (res?.data) {
|
||||
res.data = res.data.map(a => {
|
||||
return {...a, label: a.name}
|
||||
});
|
||||
this.optionsParty = res.data.filter(e => !e.parentId)
|
||||
this.optionsParty.map(t => this.addChild(t, res.data));
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 修改
|
||||
updateAccount() {
|
||||
this.$refs.updateAccountForm.validate(v => {
|
||||
if (v) {
|
||||
if (this.lock) return this.$message.error("请勿多次提交!")
|
||||
this.lock = true
|
||||
this.instance.post("/app/wxcp/wxuser/empower", this.dialogForm).then(res => {
|
||||
this.lock = false
|
||||
if (res?.code == 0) {
|
||||
this.dialog = false;
|
||||
this.$message.success("修改成功")
|
||||
this.getTableData();
|
||||
} else {
|
||||
this.$message.error(res?.msg)
|
||||
}
|
||||
}).catch(() => {
|
||||
this.lock = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
syncMembers() {
|
||||
const {departmentId = 1} = this.search;
|
||||
let loading = this.$loading({
|
||||
text: "正在同步成员...",
|
||||
spinner: 'el-icon-loading',
|
||||
background: "rgba(0,0,0,.8)"
|
||||
})
|
||||
this.instance.post(`/app/wxcp/wxdepartment/syncUser`, null, {
|
||||
timeout: 1000000,
|
||||
params: {departmentId}
|
||||
}).then(res => {
|
||||
if (res?.code == 0) {
|
||||
this.$message.success('同步成功')
|
||||
this.getList()
|
||||
}
|
||||
}).finally(() => loading.close())
|
||||
},
|
||||
syncDept() {
|
||||
let loading = this.$loading({
|
||||
text: "正在同步部门...",
|
||||
spinner: 'el-icon-loading',
|
||||
background: "rgba(0,0,0,.8)"
|
||||
})
|
||||
this.instance.post(`/app/wxcp/wxdepartment/syncDepart`).then(res => {
|
||||
if (res?.code == 0) {
|
||||
this.$message.success('同步成功')
|
||||
this.getTree()
|
||||
}
|
||||
}).finally(() => loading.close())
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.dict.load('wxUserStatus')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AppAccountTr {
|
||||
height: 100%;
|
||||
|
||||
:deep( .avatar ) {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
:deep( .ai-list__content--left ) {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
:deep( .el-form ) {
|
||||
.el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
34
project/tongren/AppSignInfo/AppSignInfo.vue
Normal file
34
project/tongren/AppSignInfo/AppSignInfo.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<section class="AppSignInfo">
|
||||
<component :is="currentPage" v-bind="$props"/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from "./list";
|
||||
|
||||
export default {
|
||||
name: "AppSignInfo",
|
||||
components: {List},
|
||||
label: "打卡管理",
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function
|
||||
},
|
||||
computed: {
|
||||
currentPage() {
|
||||
return List
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.dict.load('wxSignStatus')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AppSignInfo {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
158
project/tongren/AppSignInfo/list.vue
Normal file
158
project/tongren/AppSignInfo/list.vue
Normal file
@@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<section class="list">
|
||||
<ai-list>
|
||||
<ai-title slot="title" title="打卡管理" isShowBottomBorder>
|
||||
<template #rightBtn>
|
||||
<div flex>
|
||||
<ai-download url="/app/appwechatsigninfo/export" :params="{...search}" :instance="instance" fileName="打卡导出文件"/>
|
||||
<ai-dialog-btn dialogTitle="打卡提醒设置" width="500px" :submit="submit" @close="form={}" @open="getSetting">
|
||||
<el-button slot="btn" type="primary">设置</el-button>
|
||||
<el-form size="small" label-width="120px" ref="SettingForm" :model="form">
|
||||
<el-form-item label="早提醒时间">
|
||||
<el-time-picker v-model="form.morningTime" placeholder="请选择" value-format="HH:mm:ss"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="晚提醒时间">
|
||||
<el-time-picker v-model="form.nightTime" placeholder="请选择" value-format="HH:mm:ss"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="打卡间隔时间">
|
||||
<el-input type="number" v-model="form.doInterval" placeholder="打卡间隔时间(单位:小时)"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ai-dialog-btn>
|
||||
</div>
|
||||
</template>
|
||||
</ai-title>
|
||||
<template #left>
|
||||
<ai-tree-menu title="组织部门" @search="handleSearchTree">
|
||||
<el-tree ref="DeptTree" :data="treeData" :props="{label:'name'}" :filter-node-method="(v,data)=>data.name.indexOf(v)>-1"
|
||||
@node-click="handleSelectDept"/>
|
||||
</ai-tree-menu>
|
||||
</template>
|
||||
<template #blank>
|
||||
<div flex class="gap-16">
|
||||
<ai-bar v-for="(v,key) in sta" :key="key" card class="fill" :title="key"><b class="staNum" v-text="v"/></ai-bar>
|
||||
</div>
|
||||
<ai-card panel>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<ai-search label="打卡时间">
|
||||
<el-date-picker v-model="search.createDateStart" size="small" placeholder="开始时间" value-format="yyyy-MM-dd" @change="reloadTable"/>
|
||||
<el-date-picker v-model="search.createDateEnd" size="small" placeholder="结束时间" value-format="yyyy-MM-dd" @change="reloadTable"/>
|
||||
</ai-search>
|
||||
<ai-select placeholder="打卡状态" v-model="search.status" :selectList="dict.getDict('wxSignStatus')" @change="reloadTable"/>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-input size="small" placeholder="搜索用户" v-model="search.wxUserName" clearable @change="page.current=1,getTableData()"/>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
|
||||
@getList="getTableData" :col-configs="colConfigs" :dict="dict"/>
|
||||
</ai-card>
|
||||
</template>
|
||||
</ai-list>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AiTreeMenu from "dui/packages/layout/AiTreeMenu";
|
||||
|
||||
export default {
|
||||
name: "list",
|
||||
components: {AiTreeMenu},
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
search: {name: "", createDateStart: "", createDateEnd: "", departmentId: ""},
|
||||
page: {current: 1, size: 10, total: 0},
|
||||
tableData: [],
|
||||
colConfigs: [
|
||||
{prop: "wxUserName", label: "用户"},
|
||||
{prop: "departmentName", label: "部门"},
|
||||
{prop: "createDate", label: "打卡日期"},
|
||||
{prop: "createTime", label: "打卡时间"},
|
||||
{prop: "times", label: "打卡次数"},
|
||||
{prop: "status", label: "状态", dict: "wxSignStatus"}
|
||||
],
|
||||
treeData: [],
|
||||
form: {},
|
||||
sta: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTableData() {
|
||||
this.instance.post("/app/appwechatsigninfo/list", null, {
|
||||
params: {...this.page, ...this.search}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.tableData = res.data.records
|
||||
this.page.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
getDepartments() {
|
||||
this.instance.post("/app/wxcp/wxdepartment/listByUser").then(res => {
|
||||
if (res?.data) {
|
||||
this.treeData = this.$arr2tree(res.data, {parent: 'parentid'})
|
||||
}
|
||||
})
|
||||
},
|
||||
getSetting() {
|
||||
this.instance.post("/app/appwechatsignconfig/queryDetailById").then(res => {
|
||||
if (res?.data) {
|
||||
this.form = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getStaData() {
|
||||
const {departmentId} = this.search
|
||||
this.instance.post("/app/appwechatsigninfo/querySignStatistic", null, {
|
||||
params: {departmentId}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.sta = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSearchTree(name) {
|
||||
this.$refs.DeptTree.filter(name)
|
||||
},
|
||||
reloadTable() {
|
||||
this.page.current = 1
|
||||
this.getTableData()
|
||||
},
|
||||
handleSelectDept(data) {
|
||||
this.search.departmentId = data.id
|
||||
this.reloadTable()
|
||||
this.getStaData()
|
||||
},
|
||||
submit() {
|
||||
return this.$refs.SettingForm.validate()
|
||||
.then(() => this.instance.post("/app/appwechatsignconfig/addOrUpdate", this.form))
|
||||
.then(res => {
|
||||
if (res?.code == 0) {
|
||||
return this.$message.success("提交成功")
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableData()
|
||||
this.getDepartments()
|
||||
this.getStaData()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
height: 100%;
|
||||
|
||||
.staNum {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
39
ui/lib/js/observer.js
Normal file
39
ui/lib/js/observer.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 获取符合要求的请求
|
||||
* @param entries 监测的请求对象
|
||||
* @param type 设置满足条件的请求类型
|
||||
* @returns {PerformanceEntry[]}
|
||||
*/
|
||||
const getRequests = (entries = performance.getEntriesByType('resource'), type = ['xmlhttprequest']) =>
|
||||
entries?.filter(e => type.includes(e.initiatorType)) || []
|
||||
|
||||
/**
|
||||
* 观察者工具对象,用于前端接口监测
|
||||
*/
|
||||
class Observer {
|
||||
constructor() {
|
||||
this.saveLogs(getRequests())
|
||||
this.ins = new PerformanceObserver((list, ob) => {
|
||||
const watchLogs = getRequests(list.getEntriesByType("resource"))
|
||||
this.saveLogs(watchLogs)
|
||||
})
|
||||
this.ins.observe({entryTypes: ["resource"]})
|
||||
}
|
||||
|
||||
saveLogs(list = []) {
|
||||
list.map(e => {
|
||||
if (!/sockjs/.test(e.name)) {
|
||||
const api = {
|
||||
status: e.responseStatus,
|
||||
path: e.name,
|
||||
url: location.href,
|
||||
nodeProcess: process.env.NODE_ENV,
|
||||
}
|
||||
console.log(api)
|
||||
// http.post("/node/monitorApi/addOrUpdate", api)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default Observer
|
||||
Reference in New Issue
Block a user