diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index 42d75ea..952bae7 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -3,10 +3,12 @@
-
设备列表
- - 同步识别记录 - 设备数据初始化 +
设备列表
+ + 同步虹膜识别记录 + 人脸识别设备记录订阅 + 下发全部虹膜数据 + 下发全部人脸数据 删除 新增 @@ -52,7 +54,8 @@ import detailDevice from '@/views/deviceManage/detailDevice' import syncRecord from '@/views/deviceManage/syncRecord' import selectTree from '@/components/SelectTree/singleSelect' -import { getDeviceList, delDevice, updateDB } from '@/api/device' +import { getDeviceList, delDevice, updateDB, initSubscribe } from '@/api/device' +import { updateAllFace } from '@/api/face' import DownloadTemplate from '@/components/DownloadTemplate' import DeptSelect from '@/components/DeptSelect/index' @@ -137,6 +140,22 @@ return true } }, + checkIrisDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') >= 0) { + return false + } + } + return true + }, + checkFaceDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') < 0) { + return false + } + } + return true + }, // 新增设备 add() { this.dialogFormVisible = true @@ -177,9 +196,12 @@ this.$message.error('至少选中一项') } }, - // 删除设备 + // 下发全部虹膜数据 updateData() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -200,12 +222,80 @@ } }) }) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') + } + }, + // 下发全部人脸数据 + updateFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要将数据下发到所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + updateAllFace(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('下发成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') + } + }, + initFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要订阅所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + initSubscribe(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('订阅成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') } }, syncRecords() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -214,8 +304,10 @@ this.dialogFormVisible = true this.syncRecordShow = true this.$refs.syncRecord.initDialog(this.dialogFormVisible, deviceIds) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') } }, // 查询数据 diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index 42d75ea..952bae7 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -3,10 +3,12 @@
-
设备列表
- - 同步识别记录 - 设备数据初始化 +
设备列表
+ + 同步虹膜识别记录 + 人脸识别设备记录订阅 + 下发全部虹膜数据 + 下发全部人脸数据 删除 新增 @@ -52,7 +54,8 @@ import detailDevice from '@/views/deviceManage/detailDevice' import syncRecord from '@/views/deviceManage/syncRecord' import selectTree from '@/components/SelectTree/singleSelect' -import { getDeviceList, delDevice, updateDB } from '@/api/device' +import { getDeviceList, delDevice, updateDB, initSubscribe } from '@/api/device' +import { updateAllFace } from '@/api/face' import DownloadTemplate from '@/components/DownloadTemplate' import DeptSelect from '@/components/DeptSelect/index' @@ -137,6 +140,22 @@ return true } }, + checkIrisDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') >= 0) { + return false + } + } + return true + }, + checkFaceDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') < 0) { + return false + } + } + return true + }, // 新增设备 add() { this.dialogFormVisible = true @@ -177,9 +196,12 @@ this.$message.error('至少选中一项') } }, - // 删除设备 + // 下发全部虹膜数据 updateData() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -200,12 +222,80 @@ } }) }) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') + } + }, + // 下发全部人脸数据 + updateFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要将数据下发到所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + updateAllFace(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('下发成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') + } + }, + initFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要订阅所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + initSubscribe(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('订阅成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') } }, syncRecords() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -214,8 +304,10 @@ this.dialogFormVisible = true this.syncRecordShow = true this.$refs.syncRecord.initDialog(this.dialogFormVisible, deviceIds) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') } }, // 查询数据 diff --git a/src/views/memberManage/addPerson.vue b/src/views/memberManage/addPerson.vue index dd7ab9b..eaa5620 100644 --- a/src/views/memberManage/addPerson.vue +++ b/src/views/memberManage/addPerson.vue @@ -155,7 +155,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片
@@ -621,24 +621,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index 42d75ea..952bae7 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -3,10 +3,12 @@
-
设备列表
- - 同步识别记录 - 设备数据初始化 +
设备列表
+ + 同步虹膜识别记录 + 人脸识别设备记录订阅 + 下发全部虹膜数据 + 下发全部人脸数据 删除 新增 @@ -52,7 +54,8 @@ import detailDevice from '@/views/deviceManage/detailDevice' import syncRecord from '@/views/deviceManage/syncRecord' import selectTree from '@/components/SelectTree/singleSelect' -import { getDeviceList, delDevice, updateDB } from '@/api/device' +import { getDeviceList, delDevice, updateDB, initSubscribe } from '@/api/device' +import { updateAllFace } from '@/api/face' import DownloadTemplate from '@/components/DownloadTemplate' import DeptSelect from '@/components/DeptSelect/index' @@ -137,6 +140,22 @@ return true } }, + checkIrisDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') >= 0) { + return false + } + } + return true + }, + checkFaceDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') < 0) { + return false + } + } + return true + }, // 新增设备 add() { this.dialogFormVisible = true @@ -177,9 +196,12 @@ this.$message.error('至少选中一项') } }, - // 删除设备 + // 下发全部虹膜数据 updateData() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -200,12 +222,80 @@ } }) }) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') + } + }, + // 下发全部人脸数据 + updateFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要将数据下发到所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + updateAllFace(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('下发成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') + } + }, + initFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要订阅所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + initSubscribe(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('订阅成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') } }, syncRecords() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -214,8 +304,10 @@ this.dialogFormVisible = true this.syncRecordShow = true this.$refs.syncRecord.initDialog(this.dialogFormVisible, deviceIds) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') } }, // 查询数据 diff --git a/src/views/memberManage/addPerson.vue b/src/views/memberManage/addPerson.vue index dd7ab9b..eaa5620 100644 --- a/src/views/memberManage/addPerson.vue +++ b/src/views/memberManage/addPerson.vue @@ -155,7 +155,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片
@@ -621,24 +621,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/addPersonIris.vue b/src/views/memberManage/addPersonIris.vue index 3c1c0a7..83860f0 100644 --- a/src/views/memberManage/addPersonIris.vue +++ b/src/views/memberManage/addPersonIris.vue @@ -156,7 +156,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片 @@ -721,24 +721,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index 42d75ea..952bae7 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -3,10 +3,12 @@
-
设备列表
- - 同步识别记录 - 设备数据初始化 +
设备列表
+ + 同步虹膜识别记录 + 人脸识别设备记录订阅 + 下发全部虹膜数据 + 下发全部人脸数据 删除 新增 @@ -52,7 +54,8 @@ import detailDevice from '@/views/deviceManage/detailDevice' import syncRecord from '@/views/deviceManage/syncRecord' import selectTree from '@/components/SelectTree/singleSelect' -import { getDeviceList, delDevice, updateDB } from '@/api/device' +import { getDeviceList, delDevice, updateDB, initSubscribe } from '@/api/device' +import { updateAllFace } from '@/api/face' import DownloadTemplate from '@/components/DownloadTemplate' import DeptSelect from '@/components/DeptSelect/index' @@ -137,6 +140,22 @@ return true } }, + checkIrisDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') >= 0) { + return false + } + } + return true + }, + checkFaceDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') < 0) { + return false + } + } + return true + }, // 新增设备 add() { this.dialogFormVisible = true @@ -177,9 +196,12 @@ this.$message.error('至少选中一项') } }, - // 删除设备 + // 下发全部虹膜数据 updateData() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -200,12 +222,80 @@ } }) }) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') + } + }, + // 下发全部人脸数据 + updateFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要将数据下发到所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + updateAllFace(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('下发成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') + } + }, + initFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要订阅所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + initSubscribe(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('订阅成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') } }, syncRecords() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -214,8 +304,10 @@ this.dialogFormVisible = true this.syncRecordShow = true this.$refs.syncRecord.initDialog(this.dialogFormVisible, deviceIds) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') } }, // 查询数据 diff --git a/src/views/memberManage/addPerson.vue b/src/views/memberManage/addPerson.vue index dd7ab9b..eaa5620 100644 --- a/src/views/memberManage/addPerson.vue +++ b/src/views/memberManage/addPerson.vue @@ -155,7 +155,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片
@@ -621,24 +621,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/addPersonIris.vue b/src/views/memberManage/addPersonIris.vue index 3c1c0a7..83860f0 100644 --- a/src/views/memberManage/addPersonIris.vue +++ b/src/views/memberManage/addPersonIris.vue @@ -156,7 +156,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片 @@ -721,24 +721,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/listStaff.vue b/src/views/memberManage/listStaff.vue index 77818ed..8c4665c 100644 --- a/src/views/memberManage/listStaff.vue +++ b/src/views/memberManage/listStaff.vue @@ -29,8 +29,8 @@
-
数据列表
- +
数据列表
+ 初始化剩余年假 导出记录 - 人员数据下发 + + 人脸数据下发 删除 新增 @@ -85,6 +86,7 @@
+
+ + diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index 42d75ea..952bae7 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -3,10 +3,12 @@
-
设备列表
- - 同步识别记录 - 设备数据初始化 +
设备列表
+ + 同步虹膜识别记录 + 人脸识别设备记录订阅 + 下发全部虹膜数据 + 下发全部人脸数据 删除 新增 @@ -52,7 +54,8 @@ import detailDevice from '@/views/deviceManage/detailDevice' import syncRecord from '@/views/deviceManage/syncRecord' import selectTree from '@/components/SelectTree/singleSelect' -import { getDeviceList, delDevice, updateDB } from '@/api/device' +import { getDeviceList, delDevice, updateDB, initSubscribe } from '@/api/device' +import { updateAllFace } from '@/api/face' import DownloadTemplate from '@/components/DownloadTemplate' import DeptSelect from '@/components/DeptSelect/index' @@ -137,6 +140,22 @@ return true } }, + checkIrisDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') >= 0) { + return false + } + } + return true + }, + checkFaceDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') < 0) { + return false + } + } + return true + }, // 新增设备 add() { this.dialogFormVisible = true @@ -177,9 +196,12 @@ this.$message.error('至少选中一项') } }, - // 删除设备 + // 下发全部虹膜数据 updateData() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -200,12 +222,80 @@ } }) }) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') + } + }, + // 下发全部人脸数据 + updateFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要将数据下发到所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + updateAllFace(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('下发成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') + } + }, + initFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要订阅所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + initSubscribe(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('订阅成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') } }, syncRecords() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -214,8 +304,10 @@ this.dialogFormVisible = true this.syncRecordShow = true this.$refs.syncRecord.initDialog(this.dialogFormVisible, deviceIds) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') } }, // 查询数据 diff --git a/src/views/memberManage/addPerson.vue b/src/views/memberManage/addPerson.vue index dd7ab9b..eaa5620 100644 --- a/src/views/memberManage/addPerson.vue +++ b/src/views/memberManage/addPerson.vue @@ -155,7 +155,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片
@@ -621,24 +621,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/addPersonIris.vue b/src/views/memberManage/addPersonIris.vue index 3c1c0a7..83860f0 100644 --- a/src/views/memberManage/addPersonIris.vue +++ b/src/views/memberManage/addPersonIris.vue @@ -156,7 +156,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片 @@ -721,24 +721,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/listStaff.vue b/src/views/memberManage/listStaff.vue index 77818ed..8c4665c 100644 --- a/src/views/memberManage/listStaff.vue +++ b/src/views/memberManage/listStaff.vue @@ -29,8 +29,8 @@
-
数据列表
- +
数据列表
+ 初始化剩余年假 导出记录 - 人员数据下发 + + 人脸数据下发 删除 新增 @@ -85,6 +86,7 @@
+
+ + diff --git a/src/views/query/listRecord.vue b/src/views/query/listRecord.vue index be5ad57..3f04020 100644 --- a/src/views/query/listRecord.vue +++ b/src/views/query/listRecord.vue @@ -249,7 +249,7 @@ this.listQuery.offset = 1 } getRecordList(this.listQuery).then(response => { - debugger + //debugger this.list = response.data.rows this.total = parseInt(response.data.total) this.listLoading = false diff --git a/config/dev.env.js b/config/dev.env.js index 568bd50..1e6a233 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,7 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11802"' + // BASE_API: '"http://111.198.10.15:11802"' // BASE_API: '"http://192.168.0.18:8095"' - // BASE_API: '"http://192.168.0.166:20005"' + BASE_API: '"http://127.0.0.1:20005"' }) diff --git a/src/api/device.js b/src/api/device.js index c9ba415..46c8462 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -131,3 +131,18 @@ method: 'get' }) } + + +// 批量下发更新数据库指令 +export function initSubscribe(ids) { + return request({ + url: '/subsrcibe/init', + method: 'post', + params: { + deviceIds: ids + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/api/face.js b/src/api/face.js new file mode 100644 index 0000000..485edc0 --- /dev/null +++ b/src/api/face.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 人员数据下发 +export function updatePersonFace(personIds, deviceIds,personType) { + return request({ + url: 'face/upload', + method: 'post', + timeout: 1800000, // 30min + params: { + personIds: personIds, + deviceIds: deviceIds, + personType: personType + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} + +// 人员数据下发 +export function updateAllFace(deviceIds) { + return request({ + url: '/face/uploadAll', + method: 'post', + timeout: 1800000, // 30min + params: { + deviceIds: deviceIds + }, + paramsSerializer: params => { + return qs.stringify(params, { indices: false }) + } + }) +} diff --git a/src/router/index.js b/src/router/index.js index 733af54..57555ea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,7 +57,7 @@ children: [{ path: 'dashboard', name: 'Dashboard', - component: () => import('@/views/dashboard/index'), + component: () => import('@/views/dashboard/indexPro'), meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } }] } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index 42d75ea..952bae7 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -3,10 +3,12 @@
-
设备列表
- - 同步识别记录 - 设备数据初始化 +
设备列表
+ + 同步虹膜识别记录 + 人脸识别设备记录订阅 + 下发全部虹膜数据 + 下发全部人脸数据 删除 新增 @@ -52,7 +54,8 @@ import detailDevice from '@/views/deviceManage/detailDevice' import syncRecord from '@/views/deviceManage/syncRecord' import selectTree from '@/components/SelectTree/singleSelect' -import { getDeviceList, delDevice, updateDB } from '@/api/device' +import { getDeviceList, delDevice, updateDB, initSubscribe } from '@/api/device' +import { updateAllFace } from '@/api/face' import DownloadTemplate from '@/components/DownloadTemplate' import DeptSelect from '@/components/DeptSelect/index' @@ -137,6 +140,22 @@ return true } }, + checkIrisDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') >= 0) { + return false + } + } + return true + }, + checkFaceDevice() { + for (var value of this.multipleSelection) { + if (value.devType.indexOf('5') < 0) { + return false + } + } + return true + }, // 新增设备 add() { this.dialogFormVisible = true @@ -177,9 +196,12 @@ this.$message.error('至少选中一项') } }, - // 删除设备 + // 下发全部虹膜数据 updateData() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -200,12 +222,80 @@ } }) }) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') + } + }, + // 下发全部人脸数据 + updateFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要将数据下发到所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + updateAllFace(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('下发成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') + } + }, + initFace() { + const selectCheck = this.checkSelection() + const typeCheck = this.checkFaceDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { + const deviceIds = [] + this.multipleSelection.forEach(function(value, index) { + deviceIds.push(value.id) + }) + this.$confirm( + '确定要订阅所选设备吗?', + '确认操作', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + initSubscribe(deviceIds).then(response => { + if (response.code === 200) { + this.$message.success('订阅成功') + this.fetchData() + } + }) + }) + } else if (!selectCheck) { + this.$message.error('至少选中一项') + } else { + this.$message.error('请选择人脸识别设备') } }, syncRecords() { - if (this.checkSelection()) { + const selectCheck = this.checkSelection() + const typeCheck = this.checkIrisDevice() + console.log(selectCheck, typeCheck) + if (selectCheck && typeCheck) { const deviceIds = [] this.multipleSelection.forEach(function(value, index) { deviceIds.push(value.id) @@ -214,8 +304,10 @@ this.dialogFormVisible = true this.syncRecordShow = true this.$refs.syncRecord.initDialog(this.dialogFormVisible, deviceIds) - } else { + } else if (!selectCheck) { this.$message.error('至少选中一项') + } else { + this.$message.error('请选择虹膜设备') } }, // 查询数据 diff --git a/src/views/memberManage/addPerson.vue b/src/views/memberManage/addPerson.vue index dd7ab9b..eaa5620 100644 --- a/src/views/memberManage/addPerson.vue +++ b/src/views/memberManage/addPerson.vue @@ -155,7 +155,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片
@@ -621,24 +621,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/addPersonIris.vue b/src/views/memberManage/addPersonIris.vue index 3c1c0a7..83860f0 100644 --- a/src/views/memberManage/addPersonIris.vue +++ b/src/views/memberManage/addPersonIris.vue @@ -156,7 +156,7 @@ :show-file-list="false" class="avatar-uploader" action="string" - accept=".jpg,.jpeg,.png"> + accept=".jpg"> 点击上传照片 @@ -721,24 +721,29 @@ // }) // 转base64 this.getBase64(file.file).then(resBase64 => { - this.photo = 'data:image/png;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 + this.photo = 'data:image/jpg;base64,' + resBase64.split(',')[1] // 直接拿到base64信息 console.log(this.photo) }) }, // 上传前判断文件格式及大小 handleBeforeUpload(file) { - const isJPG = (file.type === 'image/jpeg') || (file.type === 'image/png') + const isJPG = (file.type === 'image/jpeg') let res = true console.log(file.size) const isLt2M = file.size / 1024 < 200 + const isLt20K = file.size / 1024 > 20 if (!isJPG) { - this.$message.error('上传图片只能是 JPG 或 PNG 格式!') + this.$message.error('上传图片只能是 JPG 格式!') res = false } if (!isLt2M) { this.$message.error('上传图片大小不能超过 200KB!') res = false } + if (!isLt20K) { + this.$message.error('上传图片大小必须大于 20KB!') + res = false + } return res }, // 上传成功后回显 diff --git a/src/views/memberManage/listStaff.vue b/src/views/memberManage/listStaff.vue index 77818ed..8c4665c 100644 --- a/src/views/memberManage/listStaff.vue +++ b/src/views/memberManage/listStaff.vue @@ -29,8 +29,8 @@
-
数据列表
- +
数据列表
+ 初始化剩余年假 导出记录 - 人员数据下发 + + 人脸数据下发 删除 新增 @@ -85,6 +86,7 @@
+
+ + diff --git a/src/views/query/listRecord.vue b/src/views/query/listRecord.vue index be5ad57..3f04020 100644 --- a/src/views/query/listRecord.vue +++ b/src/views/query/listRecord.vue @@ -249,7 +249,7 @@ this.listQuery.offset = 1 } getRecordList(this.listQuery).then(response => { - debugger + //debugger this.list = response.data.rows this.total = parseInt(response.data.total) this.listLoading = false diff --git a/src/views/query/queryStaff.vue b/src/views/query/queryStaff.vue index 033712f..5d6da27 100644 --- a/src/views/query/queryStaff.vue +++ b/src/views/query/queryStaff.vue @@ -222,7 +222,7 @@ this.listQuery.offset = 1 } getStaffList(this.listQuery).then(response => { - debugger + //debugger this.list = response.data.rows this.total = parseInt(response.data.total) this.listLoading = false