diff --git a/src/views/modules/srmBaseInformation/srmPartFamily.vue b/src/views/modules/srmBaseInformation/srmPartFamily.vue index e240a04..01f9301 100644 --- a/src/views/modules/srmBaseInformation/srmPartFamily.vue +++ b/src/views/modules/srmBaseInformation/srmPartFamily.vue @@ -127,7 +127,7 @@ | 删除 - | SOP上传 + diff --git a/src/views/modules/srmBaseInformation/srmPartFamily1.vue b/src/views/modules/srmBaseInformation/srmPartFamily1.vue new file mode 100644 index 0000000..756489c --- /dev/null +++ b/src/views/modules/srmBaseInformation/srmPartFamily1.vue @@ -0,0 +1,1649 @@ + + + + + + + + + + + diff --git a/src/views/modules/sys/role.vue b/src/views/modules/sys/role.vue index 1f34542..ba76c81 100644 --- a/src/views/modules/sys/role.vue +++ b/src/views/modules/sys/role.vue @@ -51,13 +51,13 @@ {{ buttons.edit || '修改' }} {{ buttons.edit || '修改' }} - {{ buttons.delete || '删除' }} - {{ buttons.delete || '删除' }} + {{ buttons.delete || '删除' }} + {{ buttons.delete || '删除' }} {{buttons.edit||'修改'}} - {{buttons.delete|| '删除'}} + {{buttons.delete|| '删除'}} @@ -202,6 +202,10 @@ import row from "element-ui/packages/row"; } }, methods: { + // 系统内置角色,不允许删除(供应商/客户仍允许修改) + isProtectedRole (roleName) { + return roleName === '系统管理员' || roleName === '供应商' || roleName === '客户' + }, // 校验用户是否收藏 favoriteIsOk() { let userFavorite = { diff --git a/src/views/modules/sys/user-add-or-update.vue b/src/views/modules/sys/user-add-or-update.vue index c3b12d3..e5a5b59 100644 --- a/src/views/modules/sys/user-add-or-update.vue +++ b/src/views/modules/sys/user-add-or-update.vue @@ -41,6 +41,16 @@ + + + + + + @@ -60,7 +70,7 @@ {{role.roleName}} @@ -117,6 +127,7 @@ export default { roleIdList: [], status: 1, site: '', + type: '', userDisplay: '', workShopId:'', supplierNo: '', @@ -140,6 +151,11 @@ export default { }, workShopList:[], siteOptions: [], + typeOptions: [ + { label: '员工', value: 'EMPLOYEE' }, + { label: '供应商', value: 'SUPPLIER' }, + { label: '客户', value: 'CUSTOMER' } + ], showSupplierPicker: false, } }, @@ -154,6 +170,41 @@ export default { this.dataForm.supplierNo = '' } this.showSupplierPicker = hasSupplier + }, + // 切换类型时,移除不在当前类型可选范围内的已选角色;选供应商时默认勾选“供应商”角色 + 'dataForm.type'() { + const visibleIds = this.filteredRoleList.map(r => r.roleId) + let selected = Array.isArray(this.dataForm.roleIdList) ? this.dataForm.roleIdList.filter(id => visibleIds.includes(id)) : [] + if (this.dataForm.type === 'SUPPLIER') { + // 默认将供应商角色选上 + visibleIds.forEach(id => { + if (!selected.includes(id)) { + selected.push(id) + } + }) + } + this.dataForm.roleIdList = selected + } + }, + computed: { + // 根据“类型”过滤可选角色:员工不显示供应商/客户角色,供应商只显示供应商角色,客户只显示客户角色 + filteredRoleList() { + const type = this.dataForm.type + const isSupplierRole = (role) => role.roleName && role.roleName.indexOf('供应商') !== -1 + const isCustomerRole = (role) => role.roleName && role.roleName.indexOf('客户') !== -1 + return this.roleList.filter(role => { + if (type === 'SUPPLIER') { + return isSupplierRole(role) + } + if (type === 'CUSTOMER') { + return isCustomerRole(role) + } + if (type === 'EMPLOYEE') { + return !isSupplierRole(role) && !isCustomerRole(role) + } + // 未选择类型时展示全部角色 + return true + }) } }, methods: { @@ -219,9 +270,10 @@ export default { init(id) { this.dataForm.id = id || 0 - // 新增用户时,工厂默认设置为 1 + // 新增用户时,工厂默认设置为 1,类型默认为员工 if (!id) { this.dataForm.site = '1' + this.dataForm.type = 'EMPLOYEE' } this.loadSiteOptions() this.getLanguageList(); @@ -252,6 +304,7 @@ export default { this.dataForm.status = data.user.status this.dataForm.languageDefault = data.user.languageDefault this.dataForm.site = data.user.site == null ? '' : data.user.site.toString() + this.dataForm.type = data.user.type == null ? '' : data.user.type this.dataForm.userDisplay = data.user.userDisplay this.dataForm.workShopId = data.user.workShopId this.dataForm.supplierNo = data.user.supplierNo @@ -271,6 +324,10 @@ export default { this.$message.warning('请选择工厂') return } + if (!this.dataForm.type) { + this.$message.warning('请选择类型') + return + } if (!this.dataForm.userDisplay || !String(this.dataForm.userDisplay).trim()) { this.$message.warning('用户名不能为空') return @@ -295,6 +352,7 @@ export default { 'roleIdList': this.dataForm.roleIdList, 'languageDefault': this.dataForm.languageDefault, 'site': this.dataForm.site, + 'type': this.dataForm.type, 'userDisplay': this.dataForm.userDisplay, 'workShopId': this.dataForm.workShopId, 'supplierNo': this.dataForm.supplierNo, @@ -321,6 +379,7 @@ export default { this.dataForm.roleIdList = [] this.dataForm.status = 1 this.dataForm.site = '' + this.dataForm.type = '' this.dataForm.userDisplay = '' } }, diff --git a/src/views/modules/sys/user.vue b/src/views/modules/sys/user.vue index 6529506..dd9e3b6 100644 --- a/src/views/modules/sys/user.vue +++ b/src/views/modules/sys/user.vue @@ -7,6 +7,16 @@ + + + + + + {{ buttons.search || '查询' }} {{ buttons.add || '新增' }} @@ -40,6 +50,15 @@ align="center" :label="buttons.userDisplay||'用户名'"> + + + t.value === val) + return item ? item.label : '' + }, // 校验用户是否收藏 favoriteIsOk () { let userFavorite = { @@ -1530,7 +1560,8 @@ export default { 'page': this.pageIndex, 'limit': this.pageSize, 'username': this.dataForm.userName, - 'userDisplay': this.dataForm.userDisplay + 'userDisplay': this.dataForm.userDisplay, + 'type': this.dataForm.type }) }).then(({data}) => { if (data && data.code === 0) {