diff --git a/src/api/factory/site.js b/src/api/factory/site.js index 32c42c4..f4e3a7c 100644 --- a/src/api/factory/site.js +++ b/src/api/factory/site.js @@ -32,3 +32,10 @@ export const addUserBusinessRole = data => createAPI(`/site/addUserBusinessRole` export const delUserBusinessRole = data => createAPI(`/site/delUserBusinessRole`,'post',data) export const getBusinessRole = data => createAPI(`/site/getBusinessRole`,'post',data) + +// 机台授权相关API +export const getMachineResourceList = data => createAPI(`/site/getMachineResourceList`,'post',data) + +export const addUserMachineResource = data => createAPI(`/site/addUserMachineResource`,'post',data) + +export const delUserMachineResource = data => createAPI(`/site/delUserMachineResource`,'post',data) \ No newline at end of file diff --git a/src/views/modules/sys/user.vue b/src/views/modules/sys/user.vue index 181e424..eaa9bfa 100644 --- a/src/views/modules/sys/user.vue +++ b/src/views/modules/sys/user.vue @@ -14,6 +14,7 @@ {{ buttons.buAuthorization || 'BU授权' }} {{ buttons.deptAuthorization || '部门授权' }} {{ buttons.businessRoleAuthorization || '岗位角色' }} + {{ buttons.machineResourceAuthorization || '机台授权' }} @@ -508,6 +509,105 @@ 关闭 + + + +
+ + + + + + + + + + + + 查询 + + +
+ + + 可选机台 + + + + + + + + + + +
+ 添加>> +
+
+ 删除<< +
+
+ + 已有机台 + + + + + + + + + +
+ + 关闭 + +
@@ -529,6 +629,9 @@ import { getBusinessRoleList, addUserBusinessRole, delUserBusinessRole, + getMachineResourceList, + addUserMachineResource, + delUserMachineResource, } from '@/api/factory/site.js' import AddOrUpdate from './user-add-or-update' import {throttle} from "../../../utils/common"; @@ -557,6 +660,7 @@ export default { buAuthorization: 'BU授权', deptAuthorization: '部门授权', businessRoleAuthorization: '岗位角色', + machineResourceAuthorization: '机台授权', createTime: '创建时间', username: '用户账号', userDisplay: '用户名', @@ -606,6 +710,13 @@ export default { active: '', username: '' }, + machineResourceData: { + site: '', + buNo: '', + resourceID: '', + resourceDesc: '', + username: '' + }, siteList1:[], siteList2:[], buList1:[], @@ -614,6 +725,8 @@ export default { deptList2:[], businessRoleList1:[], businessRoleList2:[], + machineResourceList1:[], + machineResourceList2:[], siteSelections1: [], siteSelections2: [], buSelections1: [], @@ -622,10 +735,13 @@ export default { deptSelections2: [], businessRoleSelections1: [], businessRoleSelections2: [], + machineResourceSelections1: [], + machineResourceSelections2: [], siteAddModal: false, buAddModal: false, deptAddModal: false, businessRoleAddModal: false, + machineResourceAddModal: false, } }, components: { @@ -1131,6 +1247,104 @@ export default { }) }, + // ========================== 机台授权 ========================== + + // 机台授权 + machineResourceAuthorize () { + this.machineResourceData = { + site: '', + buNo: '', + resourceID: '', + resourceDesc: '', + username: '' + } + this.machineResourceSelections1 = null + this.machineResourceSelections2 = null + getMachineResourceList(this.selectUser).then(({data}) => { + this.machineResourceList1 = data.row1 + this.machineResourceList2 = data.row2 + }) + this.machineResourceAddModal = true + }, + + // 查询可用机台 + getMachineResource () { + this.machineResourceData.username = this.selectUser.username + getMachineResourceList(this.machineResourceData).then(({data}) => { + if (data.code === 0) { + this.machineResourceList1 = data.row1 + } + }) + }, + + // 可选机台 + machineResourceClickRow1 (row) { + this.$refs.machineResourceTable1.toggleRowSelection(row) + }, + + // 已有机台 + machineResourceClickRow2 (row) { + this.$refs.machineResourceTable2.toggleRowSelection(row) + }, + + selectionMachineResource1 (val) { + this.machineResourceSelections1 = val + }, + + selectionMachineResource2 (val) { + this.machineResourceSelections2 = val + }, + + // 添加机台 + addMachineResource () { + if (this.machineResourceSelections1 == null || this.machineResourceSelections1.length === 0) { + this.$message.warning('请选择可选机台!') + return + } + let inData = { + username: this.selectUser.username, + resourceList: this.machineResourceSelections1 + } + addUserMachineResource(inData).then(({data}) => { + if (data && data.code === 0) { + getMachineResourceList(this.selectUser).then(({data}) => { + this.machineResourceList1 = data.row1 + this.machineResourceList2 = data.row2 + }) + this.machineResourceSelections1 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 删除机台 + deleteMachineResource () { + if (this.machineResourceSelections2 == null || this.machineResourceSelections2.length === 0) { + this.$message.warning('请选择已有机台!') + return + } + let inData = { + username: this.selectUser.username, + resourceList: this.machineResourceSelections2 + } + delUserMachineResource(inData).then(({data}) => { + if (data && data.code === 0) { + getMachineResourceList(this.selectUser).then(({data}) => { + this.machineResourceList1 = data.row1 + this.machineResourceList2 = data.row2 + }) + this.machineResourceSelections2 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + }, created() { // this.getFunctionButtonList()