给客户和仓库增加权限控制

This commit is contained in:
季圣华
2021-04-30 17:49:03 +08:00
parent 831b13fee1
commit ccf9739210
10 changed files with 60 additions and 67 deletions

View File

@@ -139,6 +139,7 @@ const checkFunction = (params)=>getAction("/function/checkIsNameExist",params);
const addSystemConfig = (params)=>postAction("/systemConfig/add",params);
const editSystemConfig = (params)=>putAction("/systemConfig/update",params);
const checkSystemConfig = (params)=>getAction("/systemConfig/checkIsNameExist",params);
const getCurrentSystemConfig = (params)=>getAction("/systemConfig/getCurrentInfo",params);
//用户|角色|模块关系
const addUserBusiness = (params)=>postAction("/userBusiness/add",params);
const editUserBusiness = (params)=>putAction("/userBusiness/update",params);
@@ -254,6 +255,7 @@ export {
addSystemConfig,
editSystemConfig,
checkSystemConfig,
getCurrentSystemConfig,
addUserBusiness,
editUserBusiness,
checkUserBusiness,

View File

@@ -260,9 +260,9 @@
},
getDepotList() {
let that = this;
getAction('/depot/findDepotByUserId?UBType=UserDepot&UBKeyId=').then((res) => {
if (res) {
that.depotList = res
getAction('/depot/findDepotByCurrentUser').then((res) => {
if(res.code === 200){
that.depotList = res.data
}
})
},

View File

@@ -111,13 +111,14 @@ export const BillModalMixin = {
},
initDepot() {
let that = this;
getAction('/depot/findDepotByUserId?UBType=UserDepot&UBKeyId=').then((res) => {
if (res) {
for(let i=0; i<res.length; i++) {
getAction('/depot/findDepotByCurrentUser').then((res) => {
if(res.code === 200){
let arr = res.data
for(let i=0; i<arr.length; i++) {
let depotInfo = {};
depotInfo.value = res[i].id+'' //注意-此处value必须为字符串格式
depotInfo.text = res[i].depotName
depotInfo.title = res[i].depotName
depotInfo.value = arr[i].id+'' //注意-此处value必须为字符串格式
depotInfo.text = arr[i].depotName
depotInfo.title = arr[i].depotName
for(let item of that.materialTable.columns){
if(item.key == 'depotId' || item.key == 'anotherDepotId') {
item.options.push(depotInfo)

View File

@@ -20,7 +20,7 @@
placeholder="请选择仓库"
v-model="queryParam.depotId">
<a-select-option v-for="(depot,index) in depotList" :value="depot.id">
{{ depot.name }}
{{ depot.depotName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -169,15 +169,9 @@
});
},
getDepotData() {
getAction('/depot/getAllList').then((res)=>{
getAction('/depot/findDepotByCurrentUser').then((res)=>{
if(res.code === 200){
let arr=res.data;
for(let i=0;i<arr.length;i++){
let obj={};
obj.id=arr[i].id;
obj.name=arr[i].name;
this.depotList.push(obj);
}
this.depotList = res.data;
}else{
this.$message.info(res.data);
}

View File

@@ -20,7 +20,7 @@
placeholder="请选择仓库"
v-model="queryParam.depotId">
<a-select-option v-for="(depot,index) in depotList" :value="depot.id">
{{ depot.name }}
{{ depot.depotName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -155,15 +155,9 @@
});
},
getDepotData() {
getAction('/depot/getAllList').then((res)=>{
getAction('/depot/findDepotByCurrentUser').then((res)=>{
if(res.code === 200){
let arr=res.data;
for(let i=0;i<arr.length;i++){
let obj={};
obj.id=arr[i].id;
obj.name=arr[i].name;
this.depotList.push(obj);
}
this.depotList = res.data;
}else{
this.$message.info(res.data);
}

View File

@@ -12,7 +12,7 @@
placeholder="请选择仓库"
v-model="queryParam.depotId">
<a-select-option v-for="(depot,index) in depotList" :value="depot.id">
{{ depot.name }}
{{ depot.depotName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -137,15 +137,9 @@
return param;
},
getDepotData() {
getAction('/depot/getAllList').then((res)=>{
getAction('/depot/findDepotByCurrentUser').then((res)=>{
if(res.code === 200){
let arr=res.data;
for(let i=0;i<arr.length;i++){
let obj={};
obj.id=arr[i].id;
obj.name=arr[i].name;
this.depotList.push(obj);
}
this.depotList = res.data;
}else{
this.$message.info(res.data);
}

View File

@@ -20,7 +20,7 @@
placeholder="请选择仓库"
v-model="queryParam.depotId">
<a-select-option v-for="(depot,index) in depotList" :value="depot.id">
{{ depot.name }}
{{ depot.depotName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -169,15 +169,9 @@
});
},
getDepotData() {
getAction('/depot/getAllList').then((res)=>{
getAction('/depot/findDepotByCurrentUser').then((res)=>{
if(res.code === 200){
let arr=res.data;
for(let i=0;i<arr.length;i++){
let obj={};
obj.id=arr[i].id;
obj.name=arr[i].name;
this.depotList.push(obj);
}
this.depotList = res.data;
}else{
this.$message.info(res.data);
}

View File

@@ -20,7 +20,7 @@
placeholder="请选择仓库"
v-model="queryParam.depotId">
<a-select-option v-for="(depot,index) in depotList" :value="depot.id">
{{ depot.name }}
{{ depot.depotName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -155,15 +155,9 @@
});
},
getDepotData() {
getAction('/depot/getAllList').then((res)=>{
getAction('/depot/findDepotByCurrentUser').then((res)=>{
if(res.code === 200){
let arr=res.data;
for(let i=0;i<arr.length;i++){
let obj={};
obj.id=arr[i].id;
obj.name=arr[i].name;
this.depotList.push(obj);
}
this.depotList = res.data;
}else{
this.$message.info(res.data);
}

View File

@@ -11,7 +11,7 @@
placeholder="请选择仓库"
v-model="queryParam.depotId">
<a-select-option v-for="(depot,index) in depotList" :value="depot.id">
{{ depot.name }}
{{ depot.depotName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -114,15 +114,9 @@
return param;
},
getDepotData() {
getAction('/depot/getAllList').then((res)=>{
getAction('/depot/findDepotByCurrentUser').then((res)=>{
if(res.code === 200){
let arr=res.data;
for(let i=0;i<arr.length;i++){
let obj={};
obj.id=arr[i].id;
obj.name=arr[i].name;
this.depotList.push(obj);
}
this.depotList = res.data;
}else{
this.$message.info(res.data);
}

View File

@@ -53,10 +53,10 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="btnSetDepot(record)">分配仓库</a>
<a-divider type="vertical" />
<a @click="btnSetCustomer(record)">分配客户</a>
<a-divider type="vertical" />
<a v-if="depotFlag === '1'" @click="btnSetDepot(record)">分配仓库</a>
<a-divider v-if="depotFlag === '1'" type="vertical" />
<a v-if="customerFlag === '1'" @click="btnSetCustomer(record)">分配客户</a>
<a-divider v-if="customerFlag === '1'" type="vertical" />
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
@@ -81,6 +81,7 @@
import UserDepotModal from './modules/UserDepotModal'
import UserCustomerModal from './modules/UserCustomerModal'
import {postAction} from '@/api/manage';
import {getCurrentSystemConfig} from '@/api/api'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import JInput from '@/components/jeecg/JInput'
export default {
@@ -95,6 +96,8 @@
data() {
return {
queryParam: {},
depotFlag: '0',
customerFlag: '0',
columns: [
{
title: '#',
@@ -129,7 +132,30 @@
},
}
},
created () {
this.getSystemConfig()
},
methods: {
getSystemConfig() {
getCurrentSystemConfig().then((res) => {
if(res.code === 200){
let systemConfig = res.data
this.depotFlag = systemConfig.depotFlag
this.customerFlag = systemConfig.customerFlag
} else {
this.$message.warning(res.data);
}
})
},
searchQuery() {
this.loadData(1);
this.getSystemConfig();
},
searchReset() {
this.queryParam = {}
this.loadData(1);
this.getSystemConfig();
},
handleReset(id) {
let that = this;
postAction(that.url.resetPwd, {id: id}).then((res) => {