update 角色授权区域

This commit is contained in:
2021-04-30 15:41:14 +08:00
parent 57c8782a18
commit bf3210f861
8 changed files with 235 additions and 191 deletions

View File

@@ -94,6 +94,8 @@ namespace Ewide.Core
new SysDictData{Id="375362c8-d694-40d9-8c55-07669e472460", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="本部门数据", Code="3", Sort=100, Remark="本部门数据", Status=0 },
new SysDictData{Id="70afe4c1-3495-483a-bdd0-3d4ea45136b3", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="仅本人数据", Code="4", Sort=100, Remark="仅本人数据", Status=0 },
new SysDictData{Id="6f395e69-8add-40ae-a378-0881d64a4413", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="自定义数据", Code="5", Sort=100, Remark="自定义数据", Status=0 },
new SysDictData{Id="2285a101-70b3-4492-a5d7-2605448d99b3", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="本部门所在区域及以下区域", Code="6", Sort=100, Remark="本部门所在区域及以下区域", Status=0 },
new SysDictData{Id="0b471624-f9a2-4f0a-9ff5-9cb12414fec0", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="仅本部门所在区域数据", Code="7", Sort=100, Remark="仅本部门所在区域数据", Status=0 },
new SysDictData{Id="a819d549-6107-43a2-99d2-377cf0a5681a", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="app", Code="1", Sort=100, Remark="app", Status=0 },
new SysDictData{Id="b1e821b3-4e7b-4e60-a67f-a40d327ab6d6", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="pc", Code="2", Sort=100, Remark="pc", Status=0 },
new SysDictData{Id="2bce5da0-b386-4412-935d-d081b7cf4391", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="其他", Code="3", Sort=100, Remark="其他", Status=0 },

View File

@@ -143,7 +143,8 @@ namespace Ewide.Core.Service
.Select(u => new
{
u.Code,
u.Value
u.Value,
u.Remark
}).ToListAsync();
}

View File

@@ -1,4 +1,6 @@
@import (reference) '~@/assets/style/extend.less';
.ant-cascader-picker-arrow {
svg {
transform: scaleY(.75);
}
}

View File

@@ -40,6 +40,7 @@
background-color: @white;
@box-shadow-focused: 0 0 0 2px fade(@primary-color, 50%);
@control-background: lighten(@black, 95%) !important;
&::before,
&::after {
content: none;
@@ -60,7 +61,7 @@
color: lighten(@black, 10%);
border: 0;
background-color: lighten(@black, 95%) !important;
background-color: @control-background;
}
.ant-mentions {
textarea {
@@ -103,6 +104,9 @@
z-index: 0;
}
}
.ant-cascader-picker-clear {
background-color: @control-background;
}
}
.ant-form-item-label {
overflow: hidden;

View File

@@ -4,11 +4,11 @@
<a-icon slot="indicator" spin type="loading" />
<div class="yo-form-group">
<!-- 表单控件 -->
<a-form-model-item label="字典值" prop="value">
<a-input placeholder="请输入字典值" v-model="form.value" />
<a-form-model-item label="文本" prop="value">
<a-input placeholder="请输入文本" v-model="form.value" />
</a-form-model-item>
<a-form-model-item label="唯一编码" prop="code">
<a-input placeholder="请输入唯一编码" v-model="form.code" />
<a-form-model-item label="字典值" prop="code">
<a-input placeholder="请输入字典值" v-model="form.code" />
</a-form-model-item>
<a-form-model-item label="排序" prop="sort">
<a-input-number class="w-100-p" placeholder="请输入排序" v-model="form.sort" />

View File

@@ -4,11 +4,11 @@
<div class="yo-query-bar">
<a-form-model :model="query" layout="inline">
<!-- 此处添加查询表单控件 -->
<a-form-model-item label="字典值">
<a-input placeholder="请输入字典值" v-model="query.value" />
<a-form-model-item label="文本">
<a-input placeholder="请输入文本" v-model="query.value" />
</a-form-model-item>
<a-form-model-item label="唯一编码">
<a-input placeholder="请输入唯一编码" v-model="query.code" />
<a-form-model-item label="字典值">
<a-input placeholder="请输入字典值" v-model="query.code" />
</a-form-model-item>
<a-form-model-item>
<a-button-group>
@@ -71,12 +71,12 @@ export default {
},
columns: [
{
title: '字典值',
title: '文本',
dataIndex: 'value',
sorter: true,
},
{
title: '唯一编码',
title: '字典值',
dataIndex: 'code',
sorter: true,
},

View File

@@ -5,13 +5,14 @@
:width="600"
@cancel="onCancel"
@ok="onOk"
class="yo-modal-form"
title="授权数据"
>
<a-spin :spinning="loading">
<a-icon slot="indicator" spin type="loading" />
<a-form-model :model="form" :rules="rules" class="yo-form" ref="form">
<div class="yo-form-group">
<a-form-model-item has-feedback label="授权范围" prop="dataScopeType">
<a-form-model-item label="授权范围" prop="dataScopeType">
<a-select placeholder="请选择授权范围" v-model="form.dataScopeType">
<a-select-option
:key="item.code"
@@ -21,13 +22,23 @@
>{{ item.value }}</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="选择机构" v-show="orgTreeShow">
<a-form-model-item label="选择机构" v-show="isDefine">
<a-tree-select
:show-checked-strategy="SHOW_PARENT"
:tree-data="orgTreeData"
placeholder="请选择机构"
tree-checkable
v-model="checkedKeys"
v-model="orgCheckedKeys"
/>
</a-form-model-item>
<a-form-model-item label="选择区域" v-show="isDefine">
<a-tree-select
:replace-fields="{ title: 'name', value: 'code', children: 'children' }"
:show-checked-strategy="SHOW_PARENT"
:tree-data="areaTreeData"
placeholder="请选择所属区域"
tree-checkable
v-model="areaCheckedKeys"
/>
</a-form-model-item>
</div>
@@ -58,10 +69,13 @@ export default {
SHOW_PARENT,
orgTreeData: [],
orgCheckedKeys: [],
areaTreeData: [],
areaCheckedKeys: [],
checkedKeys: [],
dataScopeTypeData: [],
orgTreeShow: false,
isDefine: false,
replaceFields: {
key: 'id',
},
@@ -97,29 +111,48 @@ export default {
async onChange(value) {
if (value == '5') {
this.loading = true;
this.orgTreeShow = true;
this.isDefine = true;
//
this.orgTreeData = await this.onLoadTreeData();
this.orgTreeData = await this.onLoadOrgTreeData();
//
this.areaTreeData = await this.onLoadAreaTreeData();
//
this.checkedKeys = await this.onLoadRoleOwn();
this.orgCheckedKeys = await this.onLoadRoleOwn();
this.loading = false;
} else {
this.orgTreeShow = false;
this.isDefine = false;
//
this.checkedKeys = [];
this.orgCheckedKeys = [];
}
},
/**
* 获取机构树
*/
onLoadTreeData() {
onLoadOrgTreeData() {
return this.$api.getOrgTree().then(({ data }) => {
return data;
});
},
onLoadAreaTreeData() {
return this.$api.getAreaTree().then(({ data }) => {
// ,children
const clearChiildren = (data) => {
data.forEach((item) => {
if (item.children && item.children.length) {
clearChiildren(item.children);
} else {
delete item.children;
}
});
};
clearChiildren(data);
return data;
});
},
/**
* 此角色已有数据列表
*/
@@ -136,7 +169,8 @@ export default {
this.$api
.sysRoleGrantData({
id: this.record.id,
grantOrgIdList: this.checkedKeys,
grantOrgIdList: this.orgCheckedKeys,
grantAreaCodeList: this.areaCheckedKeys,
dataScopeType: this.form.dataScopeType,
})
.then(({ success }) => {
@@ -157,9 +191,10 @@ export default {
setTimeout(() => {
this.record = {};
this.checkedKeys = [];
this.orgCheckedKeys = [];
this.areaCheckedKeys = [];
this.dataScopeTypeData = [];
this.orgTreeShow = false;
this.isDefine = false;
this.form = {};
this.$refs.form.resetFields();

View File

@@ -50,7 +50,7 @@
</Auth>
<Auth auth="sysRole:grantData">
<a-menu-item>
<a @click="onOpen('org-form', record)">授权数据</a>
<a @click="onOpen('data-form', record)">授权数据</a>
</a-menu-item>
</Auth>
</a-menu>
@@ -64,20 +64,20 @@
<add-form @ok="onReloadData" ref="add-form" />
<edit-form @ok="onReloadData" ref="edit-form" />
<menu-form @ok="onReloadData" ref="menu-form" />
<org-form @ok="onReloadData" ref="org-form" />
<data-form @ok="onReloadData" ref="data-form" />
</container>
</template>
<script>
import AddForm from './addForm';
import editForm from './editForm';
import menuForm from './menuForm';
import orgForm from './orgForm';
import EditForm from './editForm';
import MenuForm from './menuForm';
import DataForm from './dataForm';
export default {
components: {
AddForm,
editForm,
menuForm,
orgForm,
EditForm,
MenuForm,
DataForm,
},
data() {
return {