feat: 门禁权限完成

This commit is contained in:
caoqianming 2023-10-10 12:12:39 +08:00
parent a090b463ee
commit 2f30d9c2ee
6 changed files with 235 additions and 201 deletions

View File

@ -57,6 +57,15 @@ export default {
);
}
},
dchannelAuth: {
name: "门禁权限",
req: async function(data){
return await http.post(
`${config.API_URL}/third/tdevice/dchannel_auth/`,
data
);
}
},
},
blt:{
list:{
@ -115,23 +124,15 @@ export default {
);
}
},
doorauth: {
list: {
name: "门禁权限",
dh:{
dchannelAuthDelete: {
name: "删除门禁权限",
req: async function(data){
return await http.get(
`${config.API_URL}/third/doorauth/`,
return await http.post(
`${config.API_URL}/third/dahua/`,
data
);
}
},
delete: {
name: "删除权限",
req: async function(id){
return await http.delete(
`${config.API_URL}/third/doorauth/${id}/`,
);
}
}
}
}

View File

@ -17,9 +17,8 @@
<slot></slot>
<template v-for="(item, index) in userColumn" :key="index">
<el-table-column v-if="!item.hide" :column-key="item.prop" :label="item.label" :prop="item.prop"
:width="item.width" :sortable="item.sortable" :fixed="item.fixed" :filters="item.filters" :filter-method="
remoteFilter || !item.filters ? null : filterHandler
" :show-overflow-tooltip="item.showOverflowTooltip">
:width="item.width" :sortable="item.sortable" :fixed="item.fixed" :filters="item.filters" :filter-method="remoteFilter || !item.filters ? null : filterHandler
" :show-overflow-tooltip="item.showOverflowTooltip">
<template #default="scope">
<slot :name="item.prop" v-bind="scope">
{{ scope.row[item.prop] }}
@ -205,10 +204,10 @@ export default {
// delete reqData[config.request.page]
// delete reqData[config.request.pageSize]
}
Object.assign(reqData, this.tableParams);
var c = Object.assign({}, this.tableParams, reqData)
try {
if (this.apiObj) {
var res = await this.apiObj.req(reqData);
var res = await this.apiObj.req(c);
var response = this.parseData(res);
if (response.total === 0) {
this.emptyText = "暂无数据";

View File

@ -1497,14 +1497,14 @@ const routes = [
"component": "hrm/certificate"
},
{
"name": "doorAuth",
"path": "/hrm/doorauth",
"name": "dchannelAuth",
"path": "/hrm/dchannel_auth",
"meta": {
"title": "门禁权限",
"icon": "el-icon-key",
"perms": ["doorauth"]
"perms": ["dchannel_auth"]
},
"component": "hrm/doorauth"
"component": "hrm/dchannel_auth"
},
]
},

View File

@ -6,24 +6,15 @@
</div>
<div class="right-panel">
<el-select v-model="areaId" placeholder="选择区域">
<el-option
v-for="item in areaoptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
<el-option v-for="item in areaoptions" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" :params="apiParams" :pageStr="pageStr" :data="pageData"
:pageSizeStr="pageSizeStr" :orderStr="orderStr" :parseData="parseData" @selection-change="selectionChange"
stripe @resetQuery="resetQuery">
:pageSizeStr="pageSizeStr" :orderStr="orderStr" :parseData="parseData" @selection-change="selectionChange" stripe
@resetQuery="resetQuery">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="设备编号" prop="deviceCode" min-width="100"></el-table-column>
<el-table-column label="通道编号" prop="channelCode" min-width="150"></el-table-column>
@ -37,7 +28,7 @@
</el-table-column>
<el-table-column label="类型" min-width="50">
<template #default="scope">{{
deviceTypes[scope.row.cameraType]
deviceTypes[scope.row.cameraType]
}}</template>
</el-table-column>
<el-table-column label="是否在线" prop="isOnline" min-width="180">
@ -90,8 +81,9 @@
<el-button @click="viewClose">关闭</el-button>
</template>
</el-dialog>
<channel-view v-if="dialogSave" ref="saveDialog" :channelId="channelId" :channelName="channelName" :channelArea="channelArea" :channelAreas="channelAreas"
:channelLocation="channelLocation" @closed="dialogSave = false" @success="handleQuery"></channel-view>
<channel-view v-if="dialogSave" ref="saveDialog" :channelId="channelId" :channelName="channelName"
:channelArea="channelArea" :channelAreas="channelAreas" :channelLocation="channelLocation"
@closed="dialogSave = false" @success="handleQuery"></channel-view>
</template>
<script>
import channelView from "./vchannel_view";
@ -134,11 +126,11 @@ export default {
},
code: "video_realtime",
},
areaId:'',
areaId: '',
channelCode: '',
channelId: '',
channelArea: '',
pageData:[],
pageData: [],
areaoptions: [],
channelAreas: [],
channelLocation: {},
@ -148,7 +140,7 @@ export default {
2: "球机",
3: "半球",
},
canUseMap:false,
canUseMap: false,
};
},
created() {
@ -158,47 +150,47 @@ export default {
document.head.appendChild(scriptInfo);
this.getAllVchannel();
},
mounted(){
mounted() {
this.getArea();
let that = this;
let host = window.location.host;
let jsUrl = host.indexOf('localhost')>-1?'http://222.222.144.147:6013/jsmap/jsmap.js':host+'/jsmap/jsmap.js';
that.loadScript('mapId',jsUrl, () => {
let jsUrl = host.indexOf('localhost') > -1 ? 'http://222.222.144.147:6013/jsmap/jsmap.js' : host + '/jsmap/jsmap.js';
that.loadScript('mapId', jsUrl, () => {
that.canUseMap = true;
})
},
methods: {
loadScript(id, url, callback) {
debugger;
//idjs
if (document.querySelector(`#${id}`)) {
callback && callback()
return;
}
// script
const script = document.createElement('script');
script.src = url;
//id
script.setAttribute('id', id);
//script
const firstScript = document.getElementsByTagName('script')[0];
//script BODY,bodyscriptjs
firstScript.parentNode.insertBefore(script, firstScript);
//script
script.onload = script.onreadystatechange = function() {
//
if (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') {
callback && callback()
}
};
},
getAllVchannel(){
debugger;
this.$API.am.video.list.req({pageSize:999}).then(res=>{
//idjs
if (document.querySelector(`#${id}`)) {
callback && callback()
return;
}
// script
const script = document.createElement('script');
script.src = url;
//id
script.setAttribute('id', id);
//script
const firstScript = document.getElementsByTagName('script')[0];
//script BODY,bodyscriptjs
firstScript.parentNode.insertBefore(script, firstScript);
//script
script.onload = script.onreadystatechange = function () {
//
if (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') {
callback && callback()
}
};
},
getAllVchannel() {
debugger;
this.$API.am.video.list.req({ pageSize: 999 }).then(res => {
debugger;
console.log(res)
let allVchannel = JSON.stringify(res.pageData);
localStorage.setItem('allVchannel',allVchannel)
localStorage.setItem('allVchannel', allVchannel)
})
},
handleView(row) {
@ -210,8 +202,8 @@ export default {
viewClose() {
this.limitedVisible = false;
},
//
getArea() {
//
getArea() {
this.$API.am.area.list.req({ page: 0 }).then((res) => {
this.areaoptions = res;
});
@ -219,22 +211,22 @@ export default {
handlePosition(row) {
// debugger;
console.log(row)
if(row.my_info.id&&row.my_info.id!==null){
if (row.my_info.id && row.my_info.id !== null) {
this.channelId = row.my_info.id ? row.my_info.id : null;
this.channelArea = row.my_info.area ? row.my_info.area : '';
this.channelAreas = row.my_info.areas ? row.my_info.areas : [];
this.channelLocation = row.my_info.location ? row.my_info.location : {};
this.channelName = row.channelName;
if(this.canUseMap){
if (this.canUseMap) {
this.dialogSave = true;
}else{
} else {
this.$message("地图组件加载中,请稍后")
}
}else{
} else {
this.$message.error("请先完成设备同步");
}
},
//
selectionChange(selection) {
@ -242,7 +234,7 @@ export default {
},
//
handleQuery() {
handleQuery() {
debugger;
let that = this;
let vchannel = localStorage.getItem('allVchannel');
@ -251,14 +243,14 @@ export default {
debugger;
console.log(allVchannel)
console.log(that.areaId)
that.pageData = allVchannel.filter(item=>{
if(item.my_info.area == that.areaId){
that.pageData = allVchannel.filter(item => {
if (item.my_info.area == that.areaId) {
debugger;
}
return item.my_info.area == that.areaId;
})
// console.log(localStorage.getItem('allVchannel'))
// console.log(localStorage.getItem('allVchannel'))
},
resetQuery() {
@ -275,8 +267,8 @@ export default {
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog{
width: 100%!important;
height: 100%!important;
}
::v-deep .el-dialog {
width: 100% !important;
height: 100% !important;
}
</style>

View File

@ -0,0 +1,156 @@
<template>
<el-container>
<el-aside width="300px">
<el-container>
<el-main class="nopadding">
<div style="font-size: 20px; padding: 8px;">门禁通道</div>
<el-tree ref="dchannel" class="menu" node-key="id" :data="dchannelOptions"
@node-click="dchannelClick"></el-tree>
</el-main>
</el-container>
</el-aside>
<el-container>
<el-header>
<div class="left-panel">
<!-- <el-select v-model="query.dchannel" placeholder="门禁通道" @change="handleQuery" clearable
style="margin-left: 2px; width: 220px">
<el-option v-for="item in dchannelOptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
<el-select v-model="query.employee__type" placeholder="人员类型" @change="handleQuery" clearable
style="margin-left: 2px; width: 120px">
<el-option v-for="item in typeOptions" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select> -->
<div style="font-size: 18px;">当前通道: {{ currentDchannel }}</div>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input v-model="query.personName" placeholder="人员姓名" clearable
@keyup.enter="handleQuery"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" :pageStr="pageStr" :pageSizeStr="pageSizeStr"
:orderStr="orderStr" :parseData="parseData" stripe>
<el-table-column label="通道名称" prop="dchannel">
{{ currentDchannel }}
</el-table-column>
<el-table-column label="人员类型">
<template #default="scope">
<span v-if="scope.row.my_info">{{ epOptions[scope.row.my_info.type] }}</span>
</template>
</el-table-column>
<el-table-column label="人员姓名">
<template #default="scope">
<span v-if="scope.row.my_info">{{ scope.row.my_info.name }}</span>
</template>
</el-table-column>
<el-table-column label="部门/单位">
<template #default="scope">
<span v-if="scope.row.my_info">{{ scope.row.my_info.belong_dept_name }}</span>
</template>
</el-table-column>
<el-table-column label="时间范围">
<template #default="scope">
<div v-if="scope.row.my_info">
<p v-if="scope.row.my_info.third_info">{{ scope.row.my_info.third_info.dh_face_card_start }}
</p>
<p v-if="scope.row.my_info.third_info">{{ scope.row.my_info.third_info.dh_face_card_end }}
</p>
</div>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="left">
<template #default="scope">
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button link type="danger" size="small"
v-auth="'dchannel_auth.delete'">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</el-container>
</template>
<script>
export default {
name: "doorauth",
components: {},
data() {
return {
apiObj: null,
pageStr: "pageNum",
pageSizeStr: "pageSize",
orderStr: "sort",
currentDchannel: '',
parseData: (res) => {
return {
data: res, //
rows: res.pageData, //
total: res.totalRows, //
}
},
query: {},
dchannelOptions: [],
typeOptions: [
{ label: "正式员工", value: "employee" },
{ label: "相关方", value: "remployee" },
{ label: "访客", value: "visitor" },
{ label: "货车司机", value: "driver" },
],
epOptions: {
"employee": "正式员工",
"remployee": "相关方",
'visitor': "访客",
"driver": "司机"
},
trigger_: {
"door": "门禁",
"location": "定位",
"panel": "面板机"
},
};
},
mounted() {
this.getDchannels()
},
methods: {
getDchannels() {
this.$API.third.tdevice.list.req({ page: 0, type: 70 }).then(res => {
res.forEach(m => {
m.label = m.name
})
this.dchannelOptions = res
})
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
dchannelClick(data) {
this.apiObj = this.$API.third.tdevice.dchannelAuth
this.query.channelCode = data.code
this.query.pageNum = 1
this.query.pageSize = 20
this.currentDchannel = data.name
this.$refs.table.queryData(this.query);
},
table_del(row) {
var json_data = {
"url": "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/doorAuthority/removeAuthorizeAllCardNumberByChannelCode",
"method": "post",
"json": { "personIdsString": row.my_info.third_info.dh_id, "cardNumberString": row.my_info.third_info.dh_face_card, "channelCode": row.resouceCode }
}
this.$API.third.dh.dchannelAuthDelete.req(json_data).then(() => {
this.$refs.table.refresh();
this.$message.success("删除成功");
});
},
}
}
</script>

View File

@ -1,114 +0,0 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-select v-model="query.dchannel" placeholder="门禁通道" @change="handleQuery" clearable
style="margin-left: 2px; width: 220px">
<el-option v-for="item in dchannelOptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
<el-select v-model="query.employee__type" placeholder="人员类型" @change="handleQuery" clearable
style="margin-left: 2px; width: 120px">
<el-option v-for="item in typeOptions" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input v-model="query.search" placeholder="人员姓名" clearable @keyup.enter="handleQuery"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe>
<el-table-column label="通道名称" prop="dchannel">
<template #default="scope">
<span v-if="scope.row.dchannel_">{{ scope.row.dchannel_.name }}</span>
</template>
</el-table-column>
<el-table-column label="人员类型">
<template #default="scope">
<span v-if="scope.row.employee_">{{ epOptions[scope.row.employee_.type] }}</span>
</template>
</el-table-column>
<el-table-column label="人员姓名">
<template #default="scope">
<span v-if="scope.row.employee_">{{ scope.row.employee_.name }}</span>
</template>
</el-table-column>
<el-table-column label="部门/单位">
<template #default="scope">
<span v-if="scope.row.employee_">{{ scope.row.employee_.belong_dept_name }}</span>
</template>
</el-table-column>
<el-table-column label="时间范围">
<template #default="scope">
<div v-if="scope.row.employee_">
<p>{{ scope.row.employee_.third_info.dh_face_card_start }}</p>
<p>{{ scope.row.employee_.third_info.dh_face_card_end }}</p>
</div>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="left">
<template #default="scope">
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button link type="danger" size="small" v-auth="'doorauth.delete'">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
export default {
name: "doorauth",
components: {},
data() {
return {
apiObj: this.$API.third.doorauth.list,
query: {},
dchannelOptions: [],
typeOptions: [
{ label: "正式员工", value: "employee" },
{ label: "相关方", value: "remployee" },
{ label: "访客", value: "visitor" },
{ label: "货车司机", value: "driver" },
],
epOptions: {
"employee": "正式员工",
"remployee": "相关方",
'visitor': "访客",
"driver": "司机"
},
trigger_: {
"door": "门禁",
"location": "定位",
"panel": "面板机"
},
};
},
mounted() {
this.getDchannels()
},
methods: {
getDchannels() {
this.$API.third.tdevice.list.req({ page: 0, type: 70 }).then(res => {
this.dchannelOptions = res
})
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
table_del(row) {
this.$API.third.doorauth.delete.req(row.id).then(() => {
this.$refs.table.refresh();
this.$message.success("删除成功");
});
},
}
}
</script>