From 1c004d01b83e124de67540aebd7ae08eb7cd86d9 Mon Sep 17 00:00:00 2001 From: Rain_ <904416525@qq.com> Date: Mon, 1 Dec 2025 14:20:50 +0800 Subject: [PATCH] =?UTF-8?q?flx:=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configManage/personnelAccess.vue | 987 +++++++++++------- 1 file changed, 628 insertions(+), 359 deletions(-) diff --git a/src/views/projectFront/configManage/personnelAccess.vue b/src/views/projectFront/configManage/personnelAccess.vue index 34db113f..089a6b40 100644 --- a/src/views/projectFront/configManage/personnelAccess.vue +++ b/src/views/projectFront/configManage/personnelAccess.vue @@ -28,9 +28,23 @@ --> - - - + + + + @@ -39,17 +53,32 @@ --> - + + - + - {{ $t('message.alarmWarning.query') }} + {{ + $t("message.alarmWarning.query") + }} - {{ $t('message.alarmValueSet.refresh') }} + {{ + $t("message.alarmValueSet.refresh") + }} - {{ $t('message.videoManage.add') }} + {{ + $t("message.videoManage.add") + }} - 人员权限模版下载 + 人员权限模版下载 - 人员权限导入 + 人员权限导入 - 导出账号 批量分配装置单位 - - + + {{ scope.row.projectOrgName }} - + - + + - + - 配置装置 + + 配置装置 + - {{ $t('message.projectInfo.configCompany') }} + {{ $t("message.projectInfo.configCompany") }} - {{ $t('message.projectInfo.configGate') }} + {{ $t("message.projectInfo.configGate") }} - {{ $t('message.projectInfo.configVideo') }} + {{ $t("message.projectInfo.configVideo") }} - {{ $t('message.alarmValueSet.edit') }} + {{ $t("message.alarmValueSet.edit") }} - {{ $t('message.alarmValueSet.delete') }} + {{ $t("message.alarmValueSet.delete") }} @@ -271,25 +351,60 @@ class="dialogFormBox" :rules="formRules" > - - - + + + - + - + - + - - + + - - + + + - - - + + + - - + + - + - + - {{ $t('message.projectInfo.allChoose') }} + {{ $t("message.projectInfo.allChoose") }} @@ -424,10 +614,14 @@ - + - {{ $t('message.projectInfo.allChoose') }} + {{ $t("message.projectInfo.allChoose") }} @@ -443,11 +637,19 @@ @@ -506,19 +708,30 @@ - + - {{ $t('message.projectInfo.allChoose') }} + {{ $t("message.projectInfo.allChoose") }} - + - - {{ - city.devName - }} + + {{ city.devName }} @@ -567,15 +796,23 @@ import { selecAllVideoListApi, getTreeGroupApi, addSystemUserBindDeviceApi, - setSystemUserBatchAuthSubAccountApi -} from '@/assets/js/api/configManage'; -import { getOrgPostPage } from '@/assets/js/api/guidancePartyBuilding'; -import { getEnterpriseInfoList, ufaceDevList, selectHierarchyEnterpriseListApi } from '@/assets/js/api/laborPerson'; -import { deleteSystemUserApi } from '@/assets/js/api/account'; -import { getDeviceUnitTree, bindDeviceUnit, getBindDeviceUnit } from '@/assets/js/api/project'; -import { isJSON } from '@/util/nowDate/index'; -import { getEnterpriseTypeList, getWorkerInfoList } from '@/assets/js/api/laborPerson'; -import { getDictionaryItemApi } from '@/assets/js/api/companyDiagram'; + setSystemUserBatchAuthSubAccountApi, +} from "@/assets/js/api/configManage"; +import { getOrgPostPage } from "@/assets/js/api/guidancePartyBuilding"; +import { + getEnterpriseInfoList, + ufaceDevList, + selectHierarchyEnterpriseListApi, +} from "@/assets/js/api/laborPerson"; +import { deleteSystemUserApi } from "@/assets/js/api/account"; +import { + getDeviceUnitTree, + bindDeviceUnit, + getBindDeviceUnit, +} from "@/assets/js/api/project"; +import { isJSON } from "@/util/nowDate/index"; +import { getEnterpriseTypeList, getWorkerInfoList } from "@/assets/js/api/laborPerson"; +import { getDictionaryItemApi } from "@/assets/js/api/companyDiagram"; export default { created() { // this.getProjectChilderSystemUserPageList(); @@ -593,22 +830,22 @@ export default { this.getEnterpriseType(); this.$nextTick(() => { this.personnelAccessQuery = this.checkPermission({ - key: 'personnelAccess_query', - menuPath: '/project/configManage/personnelAccess' + key: "personnelAccess_query", + menuPath: "/project/configManage/personnelAccess", }); this.personnelAccessAdd = this.checkPermission({ - key: 'personnelAccess_add', - menuPath: '/project/configManage/personnelAccess' + key: "personnelAccess_add", + menuPath: "/project/configManage/personnelAccess", }); this.personnelAccessImport = this.checkPermission({ - key: 'personnelAccess_import', - menuPath: '/project/configManage/personnelAccess' + key: "personnelAccess_import", + menuPath: "/project/configManage/personnelAccess", }); this.personnelAccessDownload = this.checkPermission({ - key: 'personnelAccess_download', - menuPath: '/project/configManage/personnelAccess' + key: "personnelAccess_download", + menuPath: "/project/configManage/personnelAccess", }); - console.log('我是', this.roleManageQuery); + console.log("我是", this.roleManageQuery); }); }, data() { @@ -619,133 +856,135 @@ export default { personnelAccessImport: false, personnelAccessDownload: false, treeDatas: [], - groupName: '', + groupName: "", defaultExpandArr: [], // 树形对应的字段 defaultTreeProps: { - children: 'children', - label: 'enterpriseName' + children: "children", + label: "enterpriseName", }, // 对应的字段 defaultProps: { - children: 'children', - label: 'deptName' + children: "children", + label: "deptName", }, treeList: [], - selectVal: '', + selectVal: "", selectTreeData: {}, - workerName: '', - account: '', - xzProjectOrgId: '', + workerName: "", + account: "", + xzProjectOrgId: "", addEditForm: { - createUserId: '', - account: '', - showPassword: '', - password: '', - xzProjectOrgId: '', - roleId: '', - userType: '', - parentId: '', - postId: '', - userId: '', - externalAccount: '', - attachment: [] + createUserId: "", + account: "", + showPassword: "", + password: "", + xzProjectOrgId: "", + roleId: "", + userType: "", + parentId: "", + postId: "", + userId: "", + externalAccount: "", + attachment: [], }, screen: [ // {id:0,name:" "}, - { id: 1, name: '专业分包' }, - { id: 2, name: '设备分包' }, - { id: 3, name: '材料分包' }, - { id: 4, name: '后勤服务' }, - { id: 5, name: '特殊设备' }, - { id: 6, name: '劳务分包' }, - { id: 7, name: '监理单位' }, - { id: 8, name: '建设单位' }, - { id: 9, name: '总承包单位' }, - { id: 10, name: '勘查单位' }, - { id: 11, name: '设计单位' }, - { id: 12, name: '其他' } + { id: 1, name: "专业分包" }, + { id: 2, name: "设备分包" }, + { id: 3, name: "材料分包" }, + { id: 4, name: "后勤服务" }, + { id: 5, name: "特殊设备" }, + { id: 6, name: "劳务分包" }, + { id: 7, name: "监理单位" }, + { id: 8, name: "建设单位" }, + { id: 9, name: "总承包单位" }, + { id: 10, name: "勘查单位" }, + { id: 11, name: "设计单位" }, + { id: 12, name: "其他" }, ], - screenStr: '', - userType: '', + screenStr: "", + userType: "", formRules: { account: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'blur' - } + message: this.$t("message.personnelPosition.required"), + trigger: "blur", + }, ], password: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'blur' + message: this.$t("message.personnelPosition.required"), + trigger: "blur", }, { pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/, - message: '密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数', - trigger: 'blur' - } + message: + "密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数", + trigger: "blur", + }, ], showPassword: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'blur' + message: this.$t("message.personnelPosition.required"), + trigger: "blur", }, { pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/, - message: '密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数', - trigger: 'blur' - } + message: + "密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数", + trigger: "blur", + }, ], xzProjectOrgId: [ { required: true, - message: '请选择', - trigger: 'blur' - } + message: "请选择", + trigger: "blur", + }, ], userId: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'change' - } + message: this.$t("message.personnelPosition.required"), + trigger: "change", + }, ], roleId: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'change' - } + message: this.$t("message.personnelPosition.required"), + trigger: "change", + }, ], userType: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'change' - } + message: this.$t("message.personnelPosition.required"), + trigger: "change", + }, ], workerId: [ { required: true, - message: this.$t('message.personnelPosition.required'), - trigger: 'change' - } - ] + message: this.$t("message.personnelPosition.required"), + trigger: "change", + }, + ], }, List: [], Popup: { - type: 'add', - show: false + type: "add", + show: false, }, queryInfo: {}, pagInfo: { pageNo: 1, //页数 pageSize: 10, //条数 - total: 0 //总条数 + total: 0, //总条数 }, personList: [], roleList: [], @@ -754,7 +993,7 @@ export default { companyDialog: false, checkAll: false, isIndeterminate: false, - editComapnyDataId: '', + editComapnyDataId: "", //配置可查看或管理的设备相关参数 allUfaceDev: [], allVideoDev: [], @@ -767,27 +1006,27 @@ export default { treeDatas1: [], // 树形对应的字段 defaultTreeProps1: { - children: 'children', - label: 'name' + children: "children", + label: "name", }, orgPostList: [], dictionaryItemList: [], enterpriseTypeList: [], enteringFileList: [], - checkedKeys: false + checkedKeys: false, }; }, watch: { - 'Popup.show': { + "Popup.show": { handler(newName, oldName) { if (newName == true) { this.$refs.addEditForm && this.$refs.addEditForm.clearValidate(); } }, - deep: true + deep: true, // immediate: true - } + }, }, methods: { selectAll() { @@ -795,7 +1034,7 @@ export default { this.selectTreeChange(this.List, this.checkedKeys); }, selectTreeChange(data, flag) { - data.forEach(row => { + data.forEach((row) => { this.$refs.myTable.toggleRowSelection(row, flag); if (row.children != undefined) { this.selectTreeChange(row.children, flag); @@ -803,13 +1042,14 @@ export default { }); }, batchAllocationConfig() { - if (this.$refs.myTable.selection == 0) return this.$message.warning('请选择要配置的账号'); + if (this.$refs.myTable.selection == 0) + return this.$message.warning("请选择要配置的账号"); const params = { projectSn: this.$store.state.projectSn, - userIdList: this.$refs.myTable.selection.map(item => item.userId) + userIdList: this.$refs.myTable.selection.map((item) => item.userId), }; console.log(params); - setSystemUserBatchAuthSubAccountApi(params).then(result => { + setSystemUserBatchAuthSubAccountApi(params).then((result) => { if (result.success) { this.$message.success(result.message); this.getList(); @@ -817,36 +1057,37 @@ export default { }); }, exportBtn() { - if (this.$refs.myTable.selection == 0) return this.$message.warning('请选择要导出的账号'); + if (this.$refs.myTable.selection == 0) + return this.$message.warning("请选择要导出的账号"); const params = { projectSn: this.$store.state.projectSn, - userIdList: this.$refs.myTable.selection.map(item => item.userId) + userIdList: this.$refs.myTable.selection.map((item) => item.userId), }; // console.log(params); // return; - fetch(this.$http.defaults.baseURL + 'xmgl/systemUser/exportSubAccountWord', { - method: 'post', + fetch(this.$http.defaults.baseURL + "xmgl/systemUser/exportSubAccountWord", { + method: "post", headers: { Authorization: this.$store.state.userInfo.token, - 'Content-Type': 'application/json' + "Content-Type": "application/json", }, - body: JSON.stringify(params) + body: JSON.stringify(params), }) - .then(response => { + .then((response) => { // 处理响应 if (!response.ok) { - throw new Error('导出失败'); + throw new Error("导出失败"); } return response.blob(); }) - .then(blob => { - console.log('导出成功'); + .then((blob) => { + console.log("导出成功"); // 创建一个下载链接 const url = window.URL.createObjectURL(blob); // 创建一个元素 - const link = document.createElement('a'); + const link = document.createElement("a"); link.href = url; - link.download = '导出项目子账号.docx'; // 指定下载文件的文件名 + link.download = "导出项目子账号.docx"; // 指定下载文件的文件名 // 模拟点击下载链接 document.body.appendChild(link); link.click(); @@ -856,7 +1097,7 @@ export default { // 处理导出的文件 // 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地 }) - .catch(error => { + .catch((error) => { // 处理错误 console.error(error); }); @@ -871,32 +1112,36 @@ export default { }, downloadFnExport() { const requestData = { - projectSn: this.$store.state.projectSn + projectSn: this.$store.state.projectSn, }; // xmgl/workerAdmission/exportExcelWorkAdmissionTemplate - fetch(this.$http.defaults.baseURL + `xmgl/systemUser/exportExcelUserTemplate?projectSn=${this.$store.state.projectSn}`, { - method: 'get', - headers: { - Authorization: this.$store.state.userInfo.token, - 'Content-Type': 'application/json' // 设置请求头的内容类型为JSON + fetch( + this.$http.defaults.baseURL + + `xmgl/systemUser/exportExcelUserTemplate?projectSn=${this.$store.state.projectSn}`, + { + method: "get", + headers: { + Authorization: this.$store.state.userInfo.token, + "Content-Type": "application/json", // 设置请求头的内容类型为JSON + }, + // body: JSON.stringify(requestData) } - // body: JSON.stringify(requestData) - }) - .then(response => { + ) + .then((response) => { // 处理响应 if (!response.ok) { - throw new Error('导出失败'); + throw new Error("导出失败"); } return response.blob(); }) - .then(blob => { - console.log('导出成功'); + .then((blob) => { + console.log("导出成功"); // 创建一个下载链接 const url = window.URL.createObjectURL(blob); // 创建一个元素 - const link = document.createElement('a'); + const link = document.createElement("a"); link.href = url; - link.download = '人员权限模板.xlsx'; // 指定下载文件的文件名 + link.download = "人员权限模板.xlsx"; // 指定下载文件的文件名 // 模拟点击下载链接 document.body.appendChild(link); link.click(); @@ -906,7 +1151,7 @@ export default { // 处理导出的文件 // 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地 }) - .catch(error => { + .catch((error) => { // 处理错误 console.error(error); }); @@ -914,15 +1159,15 @@ export default { //获取 单位类型 getEnterpriseType() { let data = {}; - getEnterpriseTypeList(data).then(res => { + getEnterpriseTypeList(data).then((res) => { if (res.code == 200) { - console.log('获取企业类型列表', res); + console.log("获取企业类型列表", res); this.enterpriseTypeList = [ // { // id: '', // companyTypeName: '全部' // }, - ...res.result + ...res.result, ]; } }); @@ -931,8 +1176,8 @@ export default { getProjectChilderSystemUserPageListApi({ projectSn: this.$store.state.projectSn, pageNo: 1, - pageSize: -1 - }).then(res => { + pageSize: -1, + }).then((res) => { if (res.code == 200) { console.log(res); } @@ -940,8 +1185,8 @@ export default { }, getDictionaryItem() { getDictionaryItemApi({ - dictionaryEncoding: 'user_type' - }).then(res => { + dictionaryEncoding: "user_type", + }).then((res) => { if (res.success) { this.dictionaryItemList = res.result; } @@ -950,8 +1195,8 @@ export default { // 删除文件 handleRemove(file, fileList, type) { const fileTypeMap = { - 1: 'attachment', - 2: 'internalTestRecordAttachmentList' + 1: "attachment", + 2: "internalTestRecordAttachmentList", }; const key = fileTypeMap[type]; if (key) { @@ -960,26 +1205,26 @@ export default { }, handleSuccess(res, file, type) { console.log(res, file); - if (res.status == 'SUCCESS') { + if (res.status == "SUCCESS") { const fileTypeMap = { - 1: 'attachment', - 2: 'internalTestRecordAttachmentList' + 1: "attachment", + 2: "internalTestRecordAttachmentList", }; const key = fileTypeMap[type]; if (key) { this.addEditForm[key].push({ name: file.name, url: file.response.data[0].imageUrl, - urlATT: file.response.data[0].imageUrl + urlATT: file.response.data[0].imageUrl, // this.$store.state.FILEURL + }); console.log(112233, this.addEditForm[key]); - this.$refs['addEditForm'].clearValidate(key); + this.$refs["addEditForm"].clearValidate(key); } } }, handleExceed() { - this.$message.warning('文件超出最大限制,请删除上份文件!'); + this.$message.warning("文件超出最大限制,请删除上份文件!"); }, getOrgPost() { let data = { @@ -988,13 +1233,13 @@ export default { // idCard: this.formInline.idCard, // partyPosition: this.formInline.partyPosition, pageNo: 1, - pageSize: -1 + pageSize: -1, }; - getOrgPostPage(data).then(res => { + getOrgPostPage(data).then((res) => { if (res.code == 200) { - this.orgPostList = res.result.records.map(item => { + this.orgPostList = res.result.records.map((item) => { return { - ...item + ...item, }; }); } @@ -1004,9 +1249,9 @@ export default { let param = { projectSn: this.$store.state.projectSn, pageNo: 1, - pageSize: -1 + pageSize: -1, }; - getDeviceUnitTree(param).then(res => { + getDeviceUnitTree(param).then((res) => { this.treeDatas1 = res.result; }); }, @@ -1051,7 +1296,7 @@ export default { // } // }, handleTreeCheckAllFn(arr) { - arr.map(item => { + arr.map((item) => { this.$refs.treeRef.setChecked(item.id, true, true); if (item.children && item.children.length) { this.handleTreeCheckAllFn(item.children); @@ -1059,7 +1304,7 @@ export default { }); }, handleTreeCheckAllFn1(arr) { - arr.map(item => { + arr.map((item) => { this.$refs.treeRef1.setChecked(item.id, true, true); if (item.children && item.children.length) { this.handleTreeCheckAllFn1(item.children); @@ -1095,8 +1340,9 @@ export default { // 检查是否有未勾选的节点 hasUncheckedNodes(treeData, treeRef) { const tree = treeRef; - return treeData.some(node => { - const isUnchecked = !tree.getNode(node).checked && !tree.getNode(node).indeterminate; + return treeData.some((node) => { + const isUnchecked = + !tree.getNode(node).checked && !tree.getNode(node).indeterminate; if (isUnchecked) return true; if (node.children && node.children.length) { return this.hasUncheckedNodes(node.children, treeRef); @@ -1107,7 +1353,7 @@ export default { // 检查是否有勾选的节点 hasCheckedNodes(treeData, treeRef) { const tree = treeRef; - return treeData.some(node => { + return treeData.some((node) => { const isChecked = tree.getNode(node).checked; if (isChecked) return true; if (node.children && node.children.length) { @@ -1119,7 +1365,7 @@ export default { // 检查是否有半选中的节点 hasIndeterminateNodes(treeData) { const tree = this.$refs.treeRef; - return treeData.some(node => { + return treeData.some((node) => { if (tree.getNode(node).indeterminate) return true; if (node.children && node.children.length) { return this.hasIndeterminateNodes(node.children); @@ -1200,8 +1446,8 @@ export default { }, getTreeEnterpriseList() { selectHierarchyEnterpriseListApi({ - projectSn: this.$store.state.projectSn - }).then(result => { + projectSn: this.$store.state.projectSn, + }).then((result) => { if (result.success) { this.treeDatas = structuredClone(result.result); // this.treeDatas1 = structuredClone(result.result); @@ -1209,19 +1455,19 @@ export default { }); }, workerSelect() { - let findItem = this.personList.find(item => { + let findItem = this.personList.find((item) => { return item.id == this.addEditForm.workerId; }); if (findItem) { this.addEditForm.personMail = findItem.personMail; } else { - this.addEditForm.personMail = ''; + this.addEditForm.personMail = ""; } }, getTreeList() { getTreeGroupApi({ - projectSn: this.$store.state.projectSn - }).then(result => { + projectSn: this.$store.state.projectSn, + }).then((result) => { if (result.success) { this.treeList = result.result; } @@ -1231,7 +1477,7 @@ export default { treeClick(data) { console.log(data); if (data.status == 1) { - this.$message.warning('无法选中已禁用组织'); + this.$message.warning("无法选中已禁用组织"); } else { this.selectVal = data.deptName; this.selectTreeData = data; @@ -1244,7 +1490,7 @@ export default { configTreeDeviceFn(item) { this.companyDialog1 = true; this.addEditForm = JSON.parse(JSON.stringify(item)); - getBindDeviceUnit({ userId: item.userId }).then(res => { + getBindDeviceUnit({ userId: item.userId }).then((res) => { let arr = []; if (res.result) { this.$nextTick(() => { @@ -1264,12 +1510,12 @@ export default { configTreeFn(item) { this.companyDialog = true; this.addEditForm = JSON.parse(JSON.stringify(item)); - selectUserEnterpriseByUserIdApi({ userId: item.userId }).then(res => { + selectUserEnterpriseByUserIdApi({ userId: item.userId }).then((res) => { let arr = []; if (res.result) { let id = res.result.enterpriseId; - for (let i = 0; i < id.split(',').length; i++) { - arr.push(id.split(',')[i]); + for (let i = 0; i < id.split(",").length; i++) { + arr.push(id.split(",")[i]); } this.$nextTick(() => { this.$refs.treeRef.setCheckedKeys(arr); @@ -1291,7 +1537,7 @@ export default { if (nodes[i].id === id) { return { node: nodes[i], - hasChildren: !!nodes[i].children && nodes[i].children.length > 0 + hasChildren: !!nodes[i].children && nodes[i].children.length > 0, }; } if (nodes[i].children && nodes[i].children.length > 0) { @@ -1305,7 +1551,7 @@ export default { if (!result.hasChildren) { return id; } else { - return ''; + return ""; } }, // configFn(item) { @@ -1344,28 +1590,28 @@ export default { this.addEditForm = JSON.parse(JSON.stringify(item)); selectUserDevAuthorityByUserIdApi({ userId: item.userId, - devType: devType - }).then(res => { + devType: devType, + }).then((res) => { if (res.result) { let id = res.result.devId; console.log(res.result.devId); this.editComapnyDataId = res.result.id; - if (id.indexOf(',') != -1) { + if (id.indexOf(",") != -1) { let arr = []; console.log(this.allUfaceDev, this.allVideoDev); if (this.configDevType == 1) { - this.allUfaceDev.forEach(item => { - for (let i = 0; i < id.split(',').length; i++) { - if (item.id == id.split(',')[i]) { - arr.push(id.split(',')[i]); + this.allUfaceDev.forEach((item) => { + for (let i = 0; i < id.split(",").length; i++) { + if (item.id == id.split(",")[i]) { + arr.push(id.split(",")[i]); } } }); } else { - this.allVideoDev.forEach(item => { - for (let i = 0; i < id.split(',').length; i++) { - if (item.itemId == id.split(',')[i]) { - arr.push(id.split(',')[i]); + this.allVideoDev.forEach((item) => { + for (let i = 0; i < id.split(",").length; i++) { + if (item.itemId == id.split(",")[i]) { + arr.push(id.split(",")[i]); } } }); @@ -1378,7 +1624,7 @@ export default { } } else { this.selectCompanyData = []; - this.editComapnyDataId = ''; + this.editComapnyDataId = ""; } this.$nextTick(() => { this.handleCheckedCompanyChange(); @@ -1386,23 +1632,23 @@ export default { }); }, resetPasswords(row) { - this.$prompt('密码', '重置密码', { - confirmButtonText: '提交', - cancelButtonText: '取消', + this.$prompt("密码", "重置密码", { + confirmButtonText: "提交", + cancelButtonText: "取消", inputPattern: /(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^0-9a-zA-Z]).{8,30}/, - inputErrorMessage: '密码至少一个字母、一个数字、一个特殊字符以及长度至少为8位数', - inputPlaceholder: '请输入新密码' + inputErrorMessage: "密码至少一个字母、一个数字、一个特殊字符以及长度至少为8位数", + inputPlaceholder: "请输入新密码", // inputValue: group.name }).then(({ value }) => { // console.log('value', value, row); resetPwApi({ userId: row.userId, - passWord: value - }).then(res => { + passWord: value, + }).then((res) => { if (res.code == 200) { this.$message({ - type: 'success', - message: '重置成功!' + type: "success", + message: "重置成功!", }); } else { this.$message.error(res.msg); @@ -1413,12 +1659,12 @@ export default { handleCheckAllChange(val) { let arr = []; if (this.companyDialog) { - arr = this.enterpriseListData.map(item => String(item.id)); + arr = this.enterpriseListData.map((item) => String(item.id)); } else { if (this.configDevType == 1) { - arr = this.allUfaceDev.map(item => String(item.id)); + arr = this.allUfaceDev.map((item) => String(item.id)); } else { - arr = this.allVideoDev.map(item => String(item.itemId)); + arr = this.allVideoDev.map((item) => String(item.itemId)); } } this.selectCompanyData = val ? arr : []; @@ -1463,15 +1709,15 @@ export default { const halfChecked = this.$refs.treeRef1.getHalfCheckedNodes(); const concatArr = checked.concat(halfChecked); let ids = []; - concatArr.map(item => { + concatArr.map((item) => { ids.push(item.id); }); bindDeviceUnit({ nodeIdList: ids, - userId: this.addEditForm.userId + userId: this.addEditForm.userId, // id: this.editComapnyDataId - }).then(result => { + }).then((result) => { this.companyDialog1 = false; this.getList(); }); @@ -1481,94 +1727,104 @@ export default { const halfChecked = this.$refs.treeRef.getHalfCheckedNodes(); const concatArr = checked.concat(halfChecked); let ids = []; - concatArr.map(item => { + concatArr.map((item) => { ids.push(item.id); }); addOrEditUserEnterpriseApi({ - enterpriseId: ids.join(','), + enterpriseId: ids.join(","), userId: this.addEditForm.userId, - id: this.editComapnyDataId - }).then(result => { + id: this.editComapnyDataId, + }).then((result) => { this.companyDialog = false; }); }, saveDevConfigDataFn() { - let ids = ''; + let ids = ""; if (this.selectCompanyData.length > 0) { - ids = this.selectCompanyData.join(','); + ids = this.selectCompanyData.join(","); } addOrEditUserDevAuthorityApi({ devId: ids, userId: this.addEditForm.userId, id: this.editComapnyDataId, - devType: this.configDevType - }).then(result => { + devType: this.configDevType, + }).then((result) => { this.configDevDialog = false; }); }, //获取企业 || 劳务公司 列表 getProjectList() { let data = { - projectSn: this.$store.state.projectSn + projectSn: this.$store.state.projectSn, // enterpriseName: this.enterpriseName, }; - getEnterpriseInfoList(data).then(res => { + getEnterpriseInfoList(data).then((res) => { this.enterpriseListData = res.result; // console.log(res.result); }); }, //获取所有的闸机设备 getMachineList() { - ufaceDevList({ projectSn: this.$store.state.projectSn }).then(list => { + ufaceDevList({ projectSn: this.$store.state.projectSn }).then((list) => { this.allUfaceDev = list.result; }); }, //获取所有视频设备 getAllVideo() { - selecAllVideoListApi({ projectSn: this.$store.state.projectSn }).then(result => { + selecAllVideoListApi({ projectSn: this.$store.state.projectSn }).then((result) => { this.allVideoDev = result.result; }); }, onUserTypeChange() { - this.addEditForm.roleId = ''; + this.addEditForm.roleId = ""; this.getRoleList(); }, //获取所有角色 getRoleList() { getBaseRoleListApi({ projectSn: this.$store.state.projectSn, - userType: this.addEditForm.userType - }).then(result => { + userType: this.addEditForm.userType, + }).then((result) => { this.roleList = result.result; }); }, - loadPersonList() { + remoteMethod(query) { + console.log(query); + this.loadPersonList(query); + }, + loadPersonList(query) { // getLaborManagementInfoListApi getWorkerInfoList({ - projectSn: this.$store.state.projectSn - }).then(res => { - this.personList = res.result.records; + projectSn: this.$store.state.projectSn, + workerName: query ? query : "", + }).then((res) => { + this.personList = res.result.records.map((item) => { + return { + ...item, + label: item.workerName + "-" + item.enterpriseName, + }; + }); }); }, handle(type, show) { //打开弹窗前的统一处理 this.Popup = { type: type, - show: show + show: show, }; }, query() { - console.log('查询的参数', this.queryInfo); + console.log("查询的参数", this.queryInfo); this.pagInfo.pageNo = 1; this.getList(); }, getProjectChilderList() { getProjectChilderSystemUserListApi({ projectSn: this.$store.state.projectSn, - createUserId: '0' - }).then(result => { + createUserId: "0", + }).then((result) => { if (result.success) { - console.log('施工人员', result); + console.log("施工人员", result); this.ProjectChilderUserList = result.result; } }); @@ -1577,14 +1833,14 @@ export default { console.log(this.queryInfo.enterpriseTypeId); getProjectChilderSystemUserListApi({ projectSn: this.$store.state.projectSn, - enterpriseTypeId: this.queryInfo.enterpriseTypeId - }).then(res => { - console.log('筛选参数' + res); + enterpriseTypeId: this.queryInfo.enterpriseTypeId, + }).then((res) => { + console.log("筛选参数" + res); }); }, add(row) { - console.log('我是', row); - this.handle('add', true); + console.log("我是", row); + this.handle("add", true); this.initData(); if (this.$store.state.userInfo.accountType == 6) { // this.addEditForm.parentId = row.id; @@ -1597,18 +1853,18 @@ export default { // this.addEditForm.xzProjectOrgId = ''; this.$nextTick(() => { this.selectTreeData = {}; - this.selectVal = ''; + this.selectVal = ""; this.defaultExpandArr = []; - this.$refs.addEditForm.clearValidate('xzProjectOrgId'); - console.log('校验'); + this.$refs.addEditForm.clearValidate("xzProjectOrgId"); + console.log("校验"); // this.$refs.groupTree.setCurrentKey(""); }); }, edit(obj) { - console.log('编辑', obj); + console.log("编辑", obj); this.addEditForm = JSON.parse(JSON.stringify(obj)); - if (typeof obj.alarmPushWorkerId === 'string' && obj.alarmPushWorkerId != '') { - this.addEditForm.alarmPushWorkerId = obj.alarmPushWorkerId.split(',').map(Number); + if (typeof obj.alarmPushWorkerId === "string" && obj.alarmPushWorkerId != "") { + this.addEditForm.alarmPushWorkerId = obj.alarmPushWorkerId.split(",").map(Number); } if (this.addEditForm.xzProjectOrgObj) { this.selectTreeData = JSON.parse(this.addEditForm.xzProjectOrgObj); @@ -1616,15 +1872,17 @@ export default { this.defaultExpandArr = [this.selectTreeData.id]; } else { this.selectTreeData = {}; - this.selectVal = ''; + this.selectVal = ""; this.defaultExpandArr = []; } - this.addEditForm.attachment = obj.electronicSignature instanceof Array ? obj.electronicSignature : []; - this.addEditForm.roleId = obj.roleId.split(','); - this.addEditForm.createUserId = obj.createUserId && obj.createUserId != 0 ? obj.createUserId : ''; + this.addEditForm.attachment = + obj.electronicSignature instanceof Array ? obj.electronicSignature : []; + this.addEditForm.roleId = obj.roleId.split(","); + this.addEditForm.createUserId = + obj.createUserId && obj.createUserId != 0 ? obj.createUserId : ""; this.getOrgPost(); this.getRoleList(); - this.handle('edit', true); + this.handle("edit", true); this.$nextTick(() => { if (this.addEditForm.xzProjectOrgObj) { this.$refs.groupTree.setCurrentKey(this.addEditForm.xzProjectOrgId); @@ -1633,18 +1891,21 @@ export default { }); }, deleteDev(obj) { - console.log('删除', obj); + console.log("删除", obj); this.$confirm( - this.$t('message.personnelPosition.beaconManage.table.confirmText') + '【' + obj.workerName + '】?', - this.$t('message.personnelPosition.beaconManage.table.Tips'), + this.$t("message.personnelPosition.beaconManage.table.confirmText") + + "【" + + obj.workerName + + "】?", + this.$t("message.personnelPosition.beaconManage.table.Tips"), { - confirmButtonText: this.$t('message.personnelPosition.confirmButtonText'), - cancelButtonText: this.$t('message.personnelPosition.cancelButtonText'), - type: 'warning' + confirmButtonText: this.$t("message.personnelPosition.confirmButtonText"), + cancelButtonText: this.$t("message.personnelPosition.cancelButtonText"), + type: "warning", } ) .then(() => { - deleteSystemUserApi({ id: obj.userId }).then(result => { + deleteSystemUserApi({ id: obj.userId }).then((result) => { if (result.success) { this.$message.success(result.message); this.getList(); @@ -1654,36 +1915,40 @@ export default { .catch(() => {}); }, submit() { - this.$refs['addEditForm'].validate(valid => { + this.$refs["addEditForm"].validate((valid) => { if (valid) { let params = { ...this.addEditForm, - createUserId: this.addEditForm.createUserId ? this.addEditForm.createUserId : '' + createUserId: this.addEditForm.createUserId + ? this.addEditForm.createUserId + : "", }; // params.alarmPushWorkerId = this.addEditForm.alarmPushWorkerId.join(','); params.sn = this.$store.state.projectSn; if (this.selectVal) { params.xzProjectOrgObj = JSON.stringify(this.selectTreeData); } - params.roleId = this.addEditForm.roleId.join(','); + params.roleId = this.addEditForm.roleId.join(","); if (this.addEditForm.attachment.length > 0) { - params.electronicSignature = this.addEditForm.attachment[this.addEditForm.attachment.length - 1].urlATT; + params.electronicSignature = this.addEditForm.attachment[ + this.addEditForm.attachment.length - 1 + ].urlATT; } else { - params.electronicSignature = ''; + params.electronicSignature = ""; } delete params.children; - if (this.Popup.type === 'add') { - addProjectUserApi(params).then(result => { + if (this.Popup.type === "add") { + addProjectUserApi(params).then((result) => { if (result.success) { this.$message.success(result.message); this.getList(); this.Popup.show = false; } }); - } else if (this.Popup.type === 'edit') { - console.log('编辑信息', this.addEditForm); - editProjectUserApi(params).then(result => { + } else if (this.Popup.type === "edit") { + console.log("编辑信息", this.addEditForm); + editProjectUserApi(params).then((result) => { if (result.success) { this.$message.success(result.message); this.getList(); @@ -1692,22 +1957,22 @@ export default { }); } } else { - console.log('error submit!!'); + console.log("error submit!!"); return false; } }); }, refresh() { this.pagInfo.pageNo = 1; - this.userType = ''; - this.workerName = ''; - this.account = ''; - this.xzProjectOrgId = ''; - this.screenStr = ''; + this.userType = ""; + this.workerName = ""; + this.account = ""; + this.xzProjectOrgId = ""; + this.screenStr = ""; this.getList(); }, treeChildren(dataList) { - return dataList.map(ele => { + return dataList.map((ele) => { if (ele.children instanceof Array && ele.children.length > 0) { ele.children = this.treeChildren(ele.children); } @@ -1717,11 +1982,13 @@ export default { ? [ { name: ele.electronicSignature, - url: ele.electronicSignature.includes('http://') ? ele.electronicSignature : this.$store.state.FILEURL + ele.electronicSignature, - urlATT: ele.electronicSignature - } + url: ele.electronicSignature.includes("http://") + ? ele.electronicSignature + : this.$store.state.FILEURL + ele.electronicSignature, + urlATT: ele.electronicSignature, + }, ] - : [] + : [], }; }); }, @@ -1735,10 +2002,10 @@ export default { xzProjectOrgId: this.xzProjectOrgId, pageNo: this.pagInfo.pageNo, pageSize: this.pagInfo.pageSize, - notI: 1 - }).then(result => { + notI: 1, + }).then((result) => { if (result.success) { - this.List = result.result.records.map(item => { + this.List = result.result.records.map((item) => { const children = this.treeChildren(item.children); return { ...item, @@ -1747,15 +2014,15 @@ export default { ? [ { name: item.electronicSignature, - url: item.electronicSignature.includes('http://') + url: item.electronicSignature.includes("http://") ? item.electronicSignature - : this.$store.state.FILEURL + item.electronicSignature - } + : this.$store.state.FILEURL + item.electronicSignature, + }, ] - : [] + : [], }; }); - console.log('列表', this.List); + console.log("列表", this.List); this.pagInfo.total = result.result.total; } else { this.$message.error(result.message); @@ -1764,19 +2031,21 @@ export default { }, initData() { this.addEditForm = { - account: '', - showPassword: '', - password: '', - xzProjectOrgId: '', - roleId: '', - userType: '', - parentId: '', - postId: '', - userId: '', - externalAccount: '', - attachment: [] + account: "", + showPassword: "", + password: "", + xzProjectOrgId: "", + roleId: "", + userType: "", + parentId: "", + postId: "", + userId: "", + externalAccount: "", + attachment: [], }; - // this.$refs.addEditForm.clearValidate(); + this.$nextTick(() => { + this.$refs.addEditForm.clearValidate(); + }); }, close() { this.initData(); @@ -1786,7 +2055,7 @@ export default { this.$nextTick(() => { this.$refs.addEditForm.clearValidate(); }); - console.log('移出了'); + console.log("移出了"); this.Popup.show = false; // }); }, @@ -1797,19 +2066,19 @@ export default { CurrentChange(val) { this.pagInfo.pageNo = val; this.getList(); - } + }, }, computed: { headers() { return { - Authorization: this.$store.state.userInfo.token + Authorization: this.$store.state.userInfo.token, }; - } - } + }, + }, };