update 组织架构新增时增加虚拟顶级
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
<a-spin :spinning="loading">
|
||||
<a-icon slot="indicator" spin type="loading" />
|
||||
<div class="yo-form-group">
|
||||
<a-form-model-item has-feedback label="机构名称" prop="name">
|
||||
<a-form-model-item label="机构名称" prop="name">
|
||||
<a-input placeholder="请输入机构名称" v-model="form.name" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item has-feedback label="唯一编码" prop="code">
|
||||
<a-form-model-item label="唯一编码" prop="code">
|
||||
<a-input placeholder="请输入唯一编码" v-model="form.code" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item has-feedback label="上级机构" prop="pid">
|
||||
<a-form-model-item label="上级机构" prop="pid">
|
||||
<a-tree-select
|
||||
:tree-data="orgData"
|
||||
placeholder="请选择上级机构"
|
||||
@@ -34,6 +34,8 @@
|
||||
</a-form-model>
|
||||
</template>
|
||||
<script>
|
||||
import { EMPTY_ID } from '@/util/global';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -78,13 +80,22 @@ export default {
|
||||
|
||||
async onInit() {
|
||||
this.loading = true;
|
||||
this.orgData = await this.onLoadOrgData();
|
||||
await this.onLoadOrgData();
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
onLoadOrgData() {
|
||||
return this.$api.getOrgTree().then(({ data }) => {
|
||||
return data;
|
||||
this.orgData = [
|
||||
{
|
||||
id: EMPTY_ID,
|
||||
parentId: undefined,
|
||||
title: '顶级',
|
||||
value: EMPTY_ID,
|
||||
pid: undefined,
|
||||
children: data,
|
||||
},
|
||||
];
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user