CCL_QMS检验
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1332 lines
42 KiB

<template>
<div class="mod-user">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.userName" :placeholder="$t('sys.user.userAccount')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.userNo" :placeholder="$t('sys.user.userNo')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.userDisplay" :placeholder="$t('sys.user.userName')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.domainControlAccount" :placeholder="$t('sys.user.domainControlAccount')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()" type="primary">{{ buttons.search || $t('sys.common.search') }}</el-button>
<el-button v-if="isAuth('sys:user:save')" type="primary" @click="addOrUpdateHandle()">{{ buttons.add || $t('sys.common.add') }}</el-button>
<el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="siteAuthorize()"> {{ buttons.factoryAuthorization || $t('sys.user.factoryAuthorization') }}</el-button>
<el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="buAuthorize()">{{ buttons.buAuthorization || $t('sys.user.buAuthorization') }}</el-button>
<el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="deptAuthorize()">{{ buttons.deptAuthorization || $t('sys.user.deptAuthorization') }}</el-button>
<el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="roleAuthorize()">{{ buttons.roleAuthorization || '岗位授权' }}</el-button>
<!-- <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="machineResourceAuthorize()">{{ buttons.machineResourceAuthorization || $t('sys.user.machineResourceAuthorization') }}</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
:height="height"
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
highlight-current-row
@current-change="handleCurrentChange"
style="width: 100%;">
<el-table-column
prop="username"
header-align="center"
align="center"
:label="buttons.username||$t('sys.user.userAccount')">
</el-table-column>
<el-table-column
prop="userNo"
header-align="center"
align="center"
:label="buttons.userNo||$t('sys.user.userNo')">
</el-table-column>
<el-table-column
prop="userDisplay"
header-align="center"
align="center"
:label="buttons.userDisplay||$t('sys.user.userName')">
</el-table-column>
<el-table-column
prop="domainControlAccount"
header-align="center"
align="center"
:label="$t('sys.user.domainControlAccount')">
</el-table-column>
<el-table-column
prop="isDomainControl"
header-align="center"
align="center"
width="110"
:label="$t('sys.user.isDomainControl')">
<template slot-scope="scope">
<span>{{ scope.row.isDomainControl === 1 ? $t('sys.common.yes') : $t('sys.common.no') }}</span>
</template>
</el-table-column>
<el-table-column
prop="ifsUsername"
header-align="center"
align="center"
:label="$t('sys.user.ifsUsername')">
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
:label="buttons.email||$t('sys.user.email')">
</el-table-column>
<el-table-column
prop="mobile"
header-align="center"
align="center"
:label="buttons.mobile||$t('sys.user.mobile')">
</el-table-column>
<el-table-column
prop="languageDefault"
header-align="center"
align="center"
width="100"
:label="$t('sys.user.defaultLanguage')">
<template slot-scope="scope">
{{ formatLanguageDefault(scope.row.languageDefault) }}
</template>
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
:label="buttons.status||$t('sys.user.status')">
<template slot-scope="scope">
<el-link v-if="scope.row.status === 0" type="success">{{ buttons.disable || $t('sys.user.disabled') }}</el-link>
<el-link v-else type="danger">{{ buttons.normal || $t('sys.user.normal') }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
:label="buttons.createTime||$t('sys.common.createTime')">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="110"
:label="buttons.cz||$t('sys.common.operation')">
<template slot-scope="scope">
<a v-if="isAuth('sys:user:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">{{ buttons.edit || $t('sys.common.edit') }}</a>
<a v-if="isAuth('sys:user:delete')" type="text" size="small" @click="deleteHandle(scope.row.userId)">{{ buttons.delete || $t('sys.common.delete') }}</a>
</template>
</el-table-column>
</el-table>
<el-pagination
style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200,500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @close="closeDialog"></add-or-update>
<!-- 新增用户site -->
<el-dialog :title="$t('sys.user.factory')" :close-on-click-modal="false" v-drag :visible.sync="siteAddModal" width="900px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="siteData">
<el-form-item :label="$t('sys.user.factoryCode')">
<el-input v-model="siteData.siteid" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="$t('sys.user.factoryName')">
<el-input v-model="siteData.sitename" clearable style="width: 200px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getSite()">{{ $t('sys.common.search') }}</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 400px; padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.availableFactory') }}</span>
<el-table
height="400px"
:data="siteList1"
border
ref="siteTable1"
@row-click="siteClickRow1"
@selection-change="selectionSite1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="siteid"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.factoryCode')">
</el-table-column>
<el-table-column
prop="sitename"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.factoryName')">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: 1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addSite()">{{ $t('sys.user.addToRight') }}</el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteSite()">{{ $t('sys.user.removeToLeft') }}</el-button>
</div>
</el-main>
<el-main style="width: 400px;padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.existingFactory') }}</span>
<el-table
height="400px"
:data="siteList2"
border
ref="siteTable2"
@row-click="siteClickRow2"
@selection-change="selectionSite2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="siteid"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.factoryCode')">
</el-table-column>
<el-table-column
prop="sitename"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.factoryName')">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="siteAddModal = false">{{ $t('sys.common.close') }}</el-button>
</el-footer>
</el-dialog>
<!-- 新增用户bu -->
<el-dialog title="BU" :close-on-click-modal="false" v-drag :visible.sync="buAddModal" width="900px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="buData">
<el-form-item :label="$t('sys.user.factoryCode')">
<el-input v-model="buData.site" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="$t('sys.user.buCode')">
<el-input v-model="buData.buNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="$t('sys.user.buName')">
<el-input v-model="buData.buDesc" clearable style="width: 200px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getBu()">{{ $t('sys.common.search') }}</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 400px; padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.availableBu') }}</span>
<el-table
height="400px"
:data="buList1"
border
ref="buTable1"
@row-click="buClickRow1"
@selection-change="selectionBu1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="site"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.factoryCode')">
</el-table-column>
<el-table-column
prop="buNo"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.buCode')">
</el-table-column>
<el-table-column
prop="buDesc"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.buName')">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: 1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addBu()">{{ $t('sys.user.addToRight') }}</el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteBu()">{{ $t('sys.user.removeToLeft') }}</el-button>
</div>
</el-main>
<el-main style="width: 400px;padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.existingBu') }}</span>
<el-table
height="400px"
:data="buList2"
border
ref="buTable2"
@row-click="buClickRow2"
@selection-change="selectionBu2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="site"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.factoryCode')">
</el-table-column>
<el-table-column
prop="buNo"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.buCode')">
</el-table-column>
<el-table-column
prop="buDesc"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.buName')">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="buAddModal = false">{{ $t('sys.common.close') }}</el-button>
</el-footer>
</el-dialog>
<!-- 新增用户部门 -->
<el-dialog :title="$t('sys.user.dept')" :close-on-click-modal="false" v-drag :visible.sync="deptAddModal" width="900px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="deptData">
<el-form-item :label="$t('sys.user.deptCode')">
<el-input v-model="deptData.departmentId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="$t('sys.user.deptName')">
<el-input v-model="deptData.departmentName" clearable style="width: 200px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getDept()">{{ $t('sys.common.search') }}</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 400px; padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.availableDept') }}</span>
<el-table
height="400px"
:data="deptList1"
border
ref="deptTable1"
@row-click="deptClickRow1"
@selection-change="selectionDept1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="buDesc"
header-align="center"
align="center"
min-width="80"
label="BU">
</el-table-column>
<el-table-column
prop="departmentId"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.deptCode')">
</el-table-column>
<el-table-column
prop="departmentName"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.deptName')">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: 1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addDept()">{{ $t('sys.user.addToRight') }}</el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteDept()">{{ $t('sys.user.removeToLeft') }}</el-button>
</div>
</el-main>
<el-main style="width: 400px;padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.existingDept') }}</span>
<el-table
height="400px"
:data="deptList2"
border
ref="deptTable2"
@row-click="deptClickRow2"
@selection-change="selectionDept2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="buDesc"
header-align="center"
align="center"
min-width="80"
label="BU">
</el-table-column>
<el-table-column
prop="departmentId"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.deptCode')">
</el-table-column>
<el-table-column
prop="departmentName"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.deptName')">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="deptAddModal = false">{{ $t('sys.common.close') }}</el-button>
</el-footer>
</el-dialog>
<!-- 岗位授权 -->
<el-dialog
style="font-size: 12px"
v-drag
:title="'岗位授权'"
:visible.sync="roleVisible"
width="680px"
:append-to-body="true">
<el-transfer class="rq" filterable v-model="selectRoleList" :props="{
key: 'roleKey',
label: 'roleLabel'
}" :data="roleList" :titles="['未授权岗位', '已授权岗位']"></el-transfer>
<span slot="footer" class="dialog-footer">
<div style="margin-top: 5px">
<el-button type="primary" @click="saveRoleAssessSite()">确定</el-button>
<el-button @click="roleVisible = false" type="primary">取消</el-button>
</div>
</span>
</el-dialog>
<!-- 机台授权弹窗 -->
<el-dialog :title="$t('sys.user.machineResourceAuthorization')" :close-on-click-modal="false" v-drag :visible.sync="machineResourceAddModal" width="900px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="machineResourceData">
<el-form-item :label="$t('sys.user.factoryCode')">
<el-input v-model="machineResourceData.site" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="$t('sys.user.machineCode')">
<el-input v-model="machineResourceData.resourceID" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="$t('sys.user.machineDesc')">
<el-input v-model="machineResourceData.resourceDesc" clearable style="width: 200px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getMachineResource()">{{ $t('sys.common.search') }}</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 400px; padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.availableMachine') }}</span>
<el-table
height="400px"
:data="machineResourceList1"
border
ref="machineResourceTable1"
@row-click="machineResourceClickRow1"
@selection-change="selectionMachineResource1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="resourceID"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.machineCode')">
</el-table-column>
<el-table-column
prop="resourceDesc"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.machineDesc')">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: 1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addMachineResource()">{{ $t('sys.user.addToRight') }}</el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteMachineResource()">{{ $t('sys.user.removeToLeft') }}</el-button>
</div>
</el-main>
<el-main style="width: 400px;padding: 1px">
<span style="font-size: 12px" >{{ $t('sys.user.existingMachine') }}</span>
<el-table
height="400px"
:data="machineResourceList2"
border
ref="machineResourceTable2"
@row-click="machineResourceClickRow2"
@selection-change="selectionMachineResource2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="resourceID"
header-align="center"
align="center"
min-width="80"
:label="$t('sys.user.machineCode')">
</el-table-column>
<el-table-column
prop="resourceDesc"
header-align="center"
align="center"
min-width="120"
:label="$t('sys.user.machineDesc')">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="machineResourceAddModal = false">{{ $t('sys.common.close') }}</el-button>
</el-footer>
</el-dialog>
</div>
</template>
<script>
import {
getSiteList,
addUserSite,
delUserSite,
getSite,
getBuList,
addUserBu,
delUserBu,
getBu,
getDeptList,
addUserDept,
delUserDept,
getDept,
getMachineResourceList,
addUserMachineResource,
delUserMachineResource,
} from '@/api/factory/site.js'
import {searchAccessRoleList, saveAccessRole} from '@/api/base/site.js'
import AddOrUpdate from './user-add-or-update'
import {throttle} from "../../../utils/common";
import {
searchFunctionButtonList,
} from "@/api/sysLanguage.js"
import { normalizeLocale } from '@/i18n/i18n'
export default {
data() {
return {
showButton: true,
height: 200,
currentData: {},
userId: this.$store.state.user.name,
dataForm: {
userName: '',
userNo: '',
userDisplay: '',
domainControlAccount: ''
},
buttons: {
cz: this.$t('sys.common.operation'),
search: this.$t('sys.common.search'),
add: this.$t('sys.common.add'),
edit: this.$t('sys.common.edit'),
delete: this.$t('sys.common.delete'),
specialCompetencies: this.$t('sys.role.authorize'),
factoryAuthorization: this.$t('sys.user.factoryAuthorization'),
buAuthorization: this.$t('sys.user.buAuthorization'),
deptAuthorization: this.$t('sys.user.deptAuthorization'),
roleAuthorization: '岗位授权',
machineResourceAuthorization: this.$t('sys.user.machineResourceAuthorization'),
createTime: this.$t('sys.common.createTime'),
username: this.$t('sys.user.userAccount'),
userNo: this.$t('sys.user.userNo'),
userDisplay: this.$t('sys.user.userName'),
email: this.$t('sys.user.email'),
mobile: this.$t('sys.user.mobile'),
status: this.$t('sys.user.status'),
disable: this.$t('sys.user.disabled'),
normal: this.$t('sys.user.normal'),
auth: this.$t('sys.role.authorize'),
allAuth: this.$t('sys.role.authorize'),
currentAuth: this.$t('sys.role.authorize')
},
dataList: [],
selectUser: {},
pageIndex: 1,
pageSize: 50,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
siteData: {
username: '',
siteid: '',
sitename: '',
active: ''
},
buData: {
site: '',
buNo: '',
buDesc: '',
active: '',
username: ''
},
deptData: {
site: '',
buNo: '',
departmentId: '',
departmentName: '',
active: '',
username: ''
},
machineResourceData: {
site: '',
buNo: '',
resourceID: '',
resourceDesc: '',
username: ''
},
roleVisible: false,
selectRoleList: [],
roleList: [],
siteList1:[],
siteList2:[],
buList1:[],
buList2:[],
deptList1:[],
deptList2:[],
machineResourceList1:[],
machineResourceList2:[],
siteSelections1: [],
siteSelections2: [],
buSelections1: [],
buSelections2: [],
deptSelections1: [],
deptSelections2: [],
machineResourceSelections1: [],
machineResourceSelections2: [],
siteAddModal: false,
buAddModal: false,
deptAddModal: false,
machineResourceAddModal: false,
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 155;
})
},
methods: {
formatLanguageDefault (languageDefault) {
const lang = normalizeLocale(languageDefault || 'cn')
return this.$t(`main.languageName.${lang}`)
},
// 获取button的词典
getFunctionButtonList() {
let queryButton = {
functionId: this.$route.meta.menuId,
tableId: '*',
languageCode: this.$i18n.locale,
objectType: 'button'
}
searchFunctionButtonList(queryButton).then(({data}) => {
if (data.code == 0 && data.data) {
this.buttons = data.data
}
})
},
// 选中行
handleCurrentChange (val) {
this.selectUser = val
this.showButton = false
},
// 获取数据列表
getDataList: throttle(function () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/user/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'username': this.dataForm.userName,
'userNo': this.dataForm.userNo,
'userDisplay': this.dataForm.userDisplay,
'domainControlAccount': this.dataForm.domainControlAccount
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
}, 1000),
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
let userIds = id ? [id] : this.dataListSelections.map(item => {
return item.userId
})
this.$confirm(this.$t('sys.user.confirmDelete', { ids: userIds.join(','), action: id ? this.$t('sys.common.delete') : this.$t('sys.user.batchDelete') }), this.$t('sys.common.tip'), {
confirmButtonText: this.$t('sys.common.confirm'),
cancelButtonText: this.$t('sys.common.cancel'),
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/user/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success(this.$t('sys.common.operationSuccess'))
this.getDataList()
} else {
this.$message.error(data.msg)
}
})
})
},
closeDialog() {
this.$refs.addOrUpdate.closeDialog()
},
// ========================== 授权工厂 ==========================
// 授权工厂
siteAuthorize () {
this.siteData = {
siteid: '',
sitename: '',
active: ''
}
this.siteSelections1 = null
this.siteSelections2 = null
getSiteList(this.selectUser).then(({data}) => {
this.siteList1 = data.row1
this.siteList2 = data.row2
})
this.siteAddModal = true
},
// 查询可用site
getSite () {
this.siteData.username = this.selectUser.username
getSite(this.siteData).then(({data}) => {
if (data.code === 0) {
this.siteList1 = data.rows
}
})
},
// 可选site
siteClickRow1 (row) {
this.$refs.siteTable1.toggleRowSelection(row)
},
// 已有site
siteClickRow2 (row) {
this.$refs.siteTable2.toggleRowSelection(row)
},
selectionSite1 (val) {
this.siteSelections1 = val
},
selectionSite2 (val) {
this.siteSelections2 = val
},
// 添加site
addSite () {
if(this.siteSelections1 == null || this.siteSelections1.length === 0){
this.$message.warning(this.$t('sys.user.selectAvailableFactory'))
return
}
let inData = {
username: this.selectUser.username,
siteList: this.siteSelections1
}
addUserSite(inData).then(({data}) => {
if (data && data.code === 0) {
getSiteList(this.selectUser).then(({data}) => {
this.siteList1 = data.row1
this.siteList2 = data.row2
})
this.siteSelections1 = []
} else {
this.$alert(data.msg, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// 删除site
deleteSite () {
if(this.siteSelections2 == null || this.siteSelections2.length === 0){
this.$message.warning(this.$t('sys.user.selectExistingFactory'))
return
}
let inData = {
username: this.selectUser.username,
siteList: this.siteSelections2
}
delUserSite(inData).then(({data}) => {
if (data && data.code === 0) {
getSiteList(this.selectUser).then(({data}) => {
this.siteList1 = data.row1
this.siteList2 = data.row2
})
this.siteSelections2 = []
} else {
this.$alert(data.msg, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// ========================== 授权BU ==========================
// 授权BU
buAuthorize () {
this.buData = {
site: '',
buNo: '',
buDesc: '',
active: '',
username: ''
}
this.buSelections1 = null
this.buSelections2 = null
getBuList(this.selectUser).then(({data}) => {
this.buList1 = data.row1
this.buList2 = data.row2
})
this.buAddModal = true
},
// 查询可用bu
getBu () {
this.buData.username = this.selectUser.username
getBu(this.buData).then(({data}) => {
if (data.code === 0) {
this.buList1 = data.rows
}
})
},
// 可选bu
buClickRow1 (row) {
this.$refs.buTable1.toggleRowSelection(row)
},
// 已有bu
buClickRow2 (row) {
this.$refs.buTable2.toggleRowSelection(row)
},
selectionBu1 (val) {
this.buSelections1 = val
},
selectionBu2 (val) {
this.buSelections2 = val
},
// 添加bu
addBu () {
if (this.buSelections1 == null || this.buSelections1.length === 0) {
this.$message.warning(this.$t('sys.user.selectAvailableBu'))
return
}
let inData = {
username: this.selectUser.username,
buList: this.buSelections1
}
addUserBu(inData).then(({data}) => {
if (data && data.code === 0) {
getBuList(this.selectUser).then(({data}) => {
this.buList1 = data.row1
this.buList2 = data.row2
})
this.buSelections1 = []
} else {
this.$alert(data.msg, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// 删除bu
deleteBu () {
if (this.buSelections2 == null || this.buSelections2.length === 0) {
this.$message.warning(this.$t('sys.user.selectExistingBu'))
return
}
let inData = {
username: this.selectUser.username,
buList: this.buSelections2
}
delUserBu(inData).then(({data}) => {
if (data && data.code === 0) {
getBuList(this.selectUser).then(({data}) => {
this.buList1 = data.row1
this.buList2 = data.row2
})
this.buSelections2 = []
} else {
this.$alert(data.msg, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// ========================== 授权部门 ==========================
// 授权部门
deptAuthorize () {
this.deptData = {
site: '',
buNo: '',
departmentId: '',
departmentName: '',
active: '',
username: ''
}
this.deptSelections1 = null
this.deptSelections2 = null
getDeptList(this.selectUser).then(({data}) => {
this.deptList1 = data.row1
this.deptList2 = data.row2
})
this.deptAddModal = true
},
// 查询可用部门
getDept () {
this.deptData.username = this.selectUser.username
getDept(this.deptData).then(({data}) => {
if (data.code === 0) {
this.deptList1 = data.rows
}
})
},
// 可选部门
deptClickRow1 (row) {
this.$refs.deptTable1.toggleRowSelection(row)
},
// 已有部门
deptClickRow2 (row) {
this.$refs.deptTable2.toggleRowSelection(row)
},
selectionDept1 (val) {
this.deptSelections1 = val
},
selectionDept2 (val) {
this.deptSelections2 = val
},
// 添加部门
addDept () {
if (this.deptSelections1 == null || this.deptSelections1.length === 0) {
this.$message.warning(this.$t('sys.user.selectAvailableDept'))
return
}
let inData = {
username: this.selectUser.username,
deptList: this.deptSelections1
}
addUserDept(inData).then(({data}) => {
if (data && data.code === 0) {
getDeptList(this.selectUser).then(({data}) => {
this.deptList1 = data.row1
this.deptList2 = data.row2
})
this.deptSelections1 = []
} else {
this.$alert(data.msg, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// 删除部门
deleteDept () {
if (this.deptSelections2 == null || this.deptSelections2.length === 0) {
this.$message.warning(this.$t('sys.user.selectExistingDept'))
return
}
let inData = {
username: this.selectUser.username,
deptList: this.deptSelections2
}
delUserDept(inData).then(({data}) => {
if (data && data.code === 0) {
getDeptList(this.selectUser).then(({data}) => {
this.deptList1 = data.row1
this.deptList2 = data.row2
})
this.deptSelections2 = []
} else {
this.$alert(data.msg, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// ========================== 岗位授权 ==========================
roleAuthorize () {
this.roleVisible = true
this.searchRoleList()
},
searchRoleList () {
searchAccessRoleList({
username: this.selectUser.username,
active: 'Y'
}).then(({data}) => {
this.selectRoleList = data.selectRoleList || []
this.roleList = (data.roleList || []).map(item => {
const site = String((item && item.site) || '').trim()
const roleNo = String((item && item.roleNo) || '').trim()
const roleDesc = String((item && item.roleDesc) || '').trim()
return Object.assign({}, item, {
roleKey: item.roleKey || (site + '|' + roleNo),
roleLabel: item.roleLabel || (site + ' - ' + roleDesc)
})
})
})
},
parseRoleKey (roleKey) {
const rawKey = String(roleKey || '')
const splitIndex = rawKey.indexOf('|')
if (splitIndex < 0) {
return {
site: '',
roleNo: rawKey
}
}
return {
site: rawKey.substring(0, splitIndex),
roleNo: rawKey.substring(splitIndex + 1)
}
},
saveRoleAssessSite () {
if (this.selectRoleList.length === 0) {
this.$message.warning('请选择角色')
return false
}
let inList = []
for (let i = 0; i < this.selectRoleList.length; i++) {
const roleInfo = this.parseRoleKey(this.selectRoleList[i])
let inData = {
site: roleInfo.site,
username: this.selectUser.username,
roleNo: roleInfo.roleNo
}
inList.push(inData)
}
saveAccessRole(inList).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('操作成功')
this.roleVisible = false
} else {
this.$message.error(data.msg)
}
})
},
// ========================== 机台授权 ==========================
// 机台授权
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(this.$t('sys.user.selectAvailableMachine'))
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, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
// 删除机台
deleteMachineResource () {
if (this.machineResourceSelections2 == null || this.machineResourceSelections2.length === 0) {
this.$message.warning(this.$t('sys.user.selectExistingMachine'))
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, this.$t('sys.user.error'), {
confirmButtonText: this.$t('sys.common.confirm')
})
}
})
},
},
created() {
// this.getFunctionButtonList()
}
}
</script>
<style>
.rq .el-transfer-panel {
width: 260px;
}
.el-transfer-panel {
border: 2px solid #17b3a3;
border-radius: 4px;
overflow: hidden;
background: #fff;
display: inline-block;
vertical-align: middle;
width: 200px;
max-height: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: relative;
}
.el-transfer-panel .el-transfer-panel__header {
height: 40px;
line-height: 40px;
background: #17b3a3;
margin: 0;
padding-left: 15px;
border-bottom: 1px solid #17b3a3;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #000;
}
.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
font-size: 14px;
color: #303133;
font-weight: 400;
}
.el-dialog__title {
line-height: 24px;
font-size: 16px;
color: #303133;
}
</style>