update 新增机构类型
This commit is contained in:
@@ -17,6 +17,15 @@
|
||||
<a-form-model-item label="唯一编码" prop="code">
|
||||
<a-input placeholder="请输入唯一编码" v-model="form.code" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="机构类型" prop="type">
|
||||
<a-select placeholder="请选择机构类型" v-model="form.type">
|
||||
<a-select-option
|
||||
:key="item.code"
|
||||
:value="+item.code"
|
||||
v-for="item in codes.type"
|
||||
>{{ item.value }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="上级机构" prop="pid">
|
||||
<a-tree-select
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
@@ -68,8 +77,9 @@ export default {
|
||||
form: {},
|
||||
/** 验证格式 */
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入机构名称' }],
|
||||
code: [{ required: true, message: '请输入唯一编码' }],
|
||||
name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入唯一编码', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '请选择机构类型' }],
|
||||
pid: [{ required: true, message: '请选择上级机构' }],
|
||||
areaCode: [{ required: true, message: '请选择所属区域' }],
|
||||
/* ... */
|
||||
@@ -77,6 +87,11 @@ export default {
|
||||
|
||||
/** 加载异步数据状态 */
|
||||
loading: false,
|
||||
|
||||
codes: {
|
||||
type: [],
|
||||
},
|
||||
|
||||
orgData: [],
|
||||
areaData: [],
|
||||
/** 其他成员属性 */
|
||||
@@ -176,6 +191,7 @@ export default {
|
||||
async onInit(params) {
|
||||
this.loading = true;
|
||||
/** 可以在这里await获取一些异步数据 */
|
||||
await this.onLoadCodes();
|
||||
await this.onLoadOrgData();
|
||||
await this.onLoadAreaData();
|
||||
/* ... */
|
||||
@@ -184,6 +200,17 @@ export default {
|
||||
|
||||
/** 当前组件的其他方法 */
|
||||
/* ... */
|
||||
onLoadCodes() {
|
||||
this.$api
|
||||
.$queue([
|
||||
this.$api.sysDictTypeDropDownAwait({ code: 'org_type' }),
|
||||
/* ... */
|
||||
])
|
||||
.then(([org_type]) => {
|
||||
this.codes.type = org_type.data;
|
||||
/* ... */
|
||||
});
|
||||
},
|
||||
onLoadOrgData() {
|
||||
return this.$api.getOrgTree().then(({ data }) => {
|
||||
this.orgData = [
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
</Auth>
|
||||
<!-- 格式化字段内容 -->
|
||||
<!-- ... -->
|
||||
<template slot="type" slot-scope="text">
|
||||
<span>{{ bindCodeValue(text, 'type') }}</span>
|
||||
</template>
|
||||
<!-- 添加操作控件 -->
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<yo-table-actions>
|
||||
@@ -109,6 +112,12 @@ export default {
|
||||
dataIndex: 'code',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '机构类型',
|
||||
dataIndex: 'type',
|
||||
sorter: true,
|
||||
scopedSlots: { customRender: 'type' },
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
width: '80px',
|
||||
@@ -123,15 +132,14 @@ export default {
|
||||
],
|
||||
|
||||
/* 字典编码储存格式 */
|
||||
// codes: {
|
||||
// code1: [],
|
||||
// code2: [],
|
||||
// },
|
||||
codes: {
|
||||
type: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
/** 按需加载字典编码 */
|
||||
//this.onLoadCodes();
|
||||
this.onLoadCodes();
|
||||
|
||||
/** 根据权限添加操作列 */
|
||||
const flag = this.$auth(/* ... */);
|
||||
@@ -193,19 +201,17 @@ export default {
|
||||
* 加载字典数据
|
||||
* 如果不需要获取相应的字典数据,此方法内容可空
|
||||
*/
|
||||
//onLoadCodes() {
|
||||
// this.$api
|
||||
// .$queue([
|
||||
// this.$api.sysDictTypeDropDownAwait({ code: 'code1' }),
|
||||
// this.$api.sysDictTypeDropDownAwait({ code: 'code2' }),
|
||||
// /* ... */
|
||||
// ])
|
||||
// .then(([code1, code2]) => {
|
||||
// this.codes.code1 = code1.data;
|
||||
// this.codes.code2 = code2.data;
|
||||
// /* ... */
|
||||
// });
|
||||
// },
|
||||
onLoadCodes() {
|
||||
this.$api
|
||||
.$queue([
|
||||
this.$api.sysDictTypeDropDownAwait({ code: 'org_type' }),
|
||||
/* ... */
|
||||
])
|
||||
.then(([org_type]) => {
|
||||
this.codes.type = org_type.data;
|
||||
/* ... */
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
|
||||
Reference in New Issue
Block a user