update 用户授权区域
This commit is contained in:
@@ -138,17 +138,6 @@ export default {
|
|||||||
|
|
||||||
onLoadAreaTreeData() {
|
onLoadAreaTreeData() {
|
||||||
return this.$api.getAreaTree().then(({ data }) => {
|
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;
|
return data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,16 +11,27 @@
|
|||||||
<a-spin :spinning="loading">
|
<a-spin :spinning="loading">
|
||||||
<a-icon slot="indicator" spin type="loading" />
|
<a-icon slot="indicator" spin type="loading" />
|
||||||
<div class="yo-form-group">
|
<div class="yo-form-group">
|
||||||
<a-form-model-item class="yo-form--fluid">
|
<a-form-model-item label="选择机构">
|
||||||
<a-tree-select
|
<a-tree-select
|
||||||
:show-checked-strategy="SHOW_PARENT"
|
:show-checked-strategy="SHOW_PARENT"
|
||||||
:tree-data="orgList"
|
:tree-data="orgTreeData"
|
||||||
placeholder="请选择机构"
|
placeholder="请选择机构"
|
||||||
search-placeholder="请检索"
|
search-placeholder="请检索"
|
||||||
tree-checkable
|
tree-checkable
|
||||||
v-model="orgs"
|
v-model="orgs"
|
||||||
/>
|
/>
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
|
<a-form-model-item label="区域">
|
||||||
|
<a-tree-select
|
||||||
|
:replace-fields="{ title: 'name', value: 'code', children: 'children' }"
|
||||||
|
:show-checked-strategy="SHOW_PARENT"
|
||||||
|
:tree-data="arerTreeData"
|
||||||
|
placeholder="请区域"
|
||||||
|
search-placeholder="请检索"
|
||||||
|
tree-checkable
|
||||||
|
v-model="areas"
|
||||||
|
/>
|
||||||
|
</a-form-model-item>
|
||||||
</div>
|
</div>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
@@ -40,7 +51,11 @@ export default {
|
|||||||
|
|
||||||
id: '',
|
id: '',
|
||||||
orgs: [],
|
orgs: [],
|
||||||
orgList: [],
|
orgTreeData: [],
|
||||||
|
|
||||||
|
areas: [],
|
||||||
|
arerTreeData: [],
|
||||||
|
|
||||||
SHOW_PARENT,
|
SHOW_PARENT,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -69,6 +84,7 @@ export default {
|
|||||||
.sysUserGrantData({
|
.sysUserGrantData({
|
||||||
id: this.id,
|
id: this.id,
|
||||||
grantOrgIdList: this.orgs,
|
grantOrgIdList: this.orgs,
|
||||||
|
grantAreaCodeList: this.areas,
|
||||||
})
|
})
|
||||||
.then(({ success }) => {
|
.then(({ success }) => {
|
||||||
if (success) {
|
if (success) {
|
||||||
@@ -90,22 +106,31 @@ export default {
|
|||||||
this.visible = false;
|
this.visible = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.orgs = [];
|
this.orgs = [];
|
||||||
|
this.areas = [];
|
||||||
}, 300);
|
}, 300);
|
||||||
},
|
},
|
||||||
|
|
||||||
async onInit() {
|
async onInit() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.orgList = await this.onLoadOrgList();
|
this.orgTreeData = await this.onLoadOrgTreeData();
|
||||||
this.orgs = await this.onLoadOrg();
|
this.orgs = await this.onLoadOrg();
|
||||||
|
|
||||||
|
this.arerTreeData = await this.onLoadAreaTreeData();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoadOrgList() {
|
onLoadOrgTreeData() {
|
||||||
return this.$api.getOrgTree().then(({ data }) => {
|
return this.$api.getOrgTree().then(({ data }) => {
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLoadAreaTreeData() {
|
||||||
|
return this.$api.getAreaTree().then(({ data }) => {
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onLoadOrg() {
|
onLoadOrg() {
|
||||||
return this.$api.sysUserOwnData({ id: this.id }).then(({ data }) => {
|
return this.$api.sysUserOwnData({ id: this.id }).then(({ data }) => {
|
||||||
return data;
|
return data;
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
</Auth>
|
</Auth>
|
||||||
<Auth auth="sysUser:grantData">
|
<Auth auth="sysUser:grantData">
|
||||||
<a-menu-item>
|
<a-menu-item>
|
||||||
<a @click="onOpen('org-form', record)">授权额外数据</a>
|
<a @click="onOpen('data-form', record)">授权额外数据</a>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</Auth>
|
</Auth>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
<add-form @ok="onReloadData" ref="add-form" />
|
<add-form @ok="onReloadData" ref="add-form" />
|
||||||
<edit-form @ok="onReloadData" ref="edit-form" />
|
<edit-form @ok="onReloadData" ref="edit-form" />
|
||||||
<role-form @ok="onReloadData" ref="role-form" />
|
<role-form @ok="onReloadData" ref="role-form" />
|
||||||
<org-form @ok="onReloadData" ref="org-form" />
|
<data-form @ok="onReloadData" ref="data-form" />
|
||||||
</yo-tree-layout>
|
</yo-tree-layout>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -122,7 +122,7 @@ import YoList from '@/components/yoList';
|
|||||||
import AddForm from './addForm';
|
import AddForm from './addForm';
|
||||||
import EditForm from './editForm';
|
import EditForm from './editForm';
|
||||||
import RoleForm from './roleForm';
|
import RoleForm from './roleForm';
|
||||||
import OrgForm from './orgForm';
|
import DataForm from './dataForm';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -131,7 +131,7 @@ export default {
|
|||||||
AddForm,
|
AddForm,
|
||||||
EditForm,
|
EditForm,
|
||||||
RoleForm,
|
RoleForm,
|
||||||
OrgForm,
|
DataForm,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
Reference in New Issue
Block a user