update 进行了一系列优化
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
<a-modal
|
||||
:confirmLoading="confirmLoading"
|
||||
:visible="visible"
|
||||
@close="onCancel"
|
||||
@cancel="onCancel"
|
||||
@ok="onOk"
|
||||
class="yo-modal-form"
|
||||
title="编辑XX"
|
||||
>
|
||||
|
||||
@@ -166,7 +166,6 @@ export default {
|
||||
this.$message.success(successMessage);
|
||||
this.onReloadData();
|
||||
}
|
||||
this.$refs.table.onLoaded();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -180,6 +179,9 @@ export default {
|
||||
.testDeleteApi(record)
|
||||
.then(({ success }) => {
|
||||
this.onResult(success, '删除成功');
|
||||
})
|
||||
.finally(() => {
|
||||
this.$refs.table.onLoaded();
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
@cancel="onCancel"
|
||||
@ok="onOk"
|
||||
class="yo-modal-form"
|
||||
title="编辑XX"
|
||||
title="编辑字典数据"
|
||||
>
|
||||
<FormBody ref="form-body" />
|
||||
</a-modal>
|
||||
|
||||
@@ -42,9 +42,7 @@ export default {
|
||||
await this.formBody.onInit();
|
||||
|
||||
// 获取外部选中的部门id
|
||||
this.formBody.onFillData({
|
||||
pid: orgId,
|
||||
});
|
||||
this.formBody.onFillData(record, orgId);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="上级机构" prop="pid">
|
||||
<a-tree-select
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
:tree-data="orgData"
|
||||
placeholder="请选择上级机构"
|
||||
tree-default-expand-all
|
||||
@@ -26,7 +27,7 @@
|
||||
v-model="form.sort"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="备注">
|
||||
<a-form-model-item label="备注" prop="remark">
|
||||
<a-textarea placeholder="请输入备注" v-model="form.remark" />
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
@@ -39,7 +40,10 @@ import { EMPTY_ID } from '@/util/global';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
form: {
|
||||
pid: undefined,
|
||||
sort: 100,
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入机构名称' }],
|
||||
code: [{ required: true, message: '请输入唯一编码' }],
|
||||
@@ -56,8 +60,12 @@ export default {
|
||||
* 必要的方法
|
||||
* 在打开编辑页时允许填充数据
|
||||
*/
|
||||
onFillData(record) {
|
||||
this.form = this.$_.cloneDeep(record);
|
||||
onFillData(record, orgId) {
|
||||
if (orgId) {
|
||||
this.form.pid = orgId;
|
||||
} else if (record) {
|
||||
this.form = this.$_.cloneDeep(record);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -98,10 +106,6 @@ export default {
|
||||
];
|
||||
});
|
||||
},
|
||||
|
||||
onChangeExtData(value, record, type) {
|
||||
record[type] = value;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -6,7 +6,6 @@
|
||||
ref="tree-layout"
|
||||
>
|
||||
<container>
|
||||
<br />
|
||||
<a-card :bordered="false">
|
||||
<Auth auth="sysOrg:page">
|
||||
<div class="yo-query-bar">
|
||||
|
||||
@@ -43,11 +43,7 @@ export default {
|
||||
await this.formBody.onInit();
|
||||
|
||||
// 获取外部选中的部门id
|
||||
this.formBody.onFillData({
|
||||
sysEmpParam: {
|
||||
orgId: id,
|
||||
},
|
||||
});
|
||||
this.formBody.onFillData(record, id);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -57,9 +57,10 @@
|
||||
<div class="yo-form-group">
|
||||
<a-form-model-item label="所属组织机构" prop="sysEmpParam.orgId">
|
||||
<a-tree-select
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
:tree-data="orgData"
|
||||
placeholder="请选择所属组织机构"
|
||||
treeDefaultExpandAll
|
||||
tree-default-expand-all
|
||||
v-model="form.sysEmpParam.orgId"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -89,6 +90,7 @@
|
||||
<template slot="orgId" slot-scope="text, record">
|
||||
<a-tree-select
|
||||
:default-value="text"
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
:tree-data="orgData"
|
||||
@change="value => onChangeExtData(value, record, 'orgId')"
|
||||
placeholder="请选择附加组织机构"
|
||||
@@ -183,8 +185,8 @@ export default {
|
||||
* 必要的方法
|
||||
* 在打开编辑页时允许填充数据
|
||||
*/
|
||||
onFillData(record) {
|
||||
const form = this.$_.cloneDeep(record);
|
||||
onFillData(record, orgId) {
|
||||
const form = this.$_.cloneDeep(record || {});
|
||||
// 日期特殊处理
|
||||
if (form.birthday) {
|
||||
form.birthday = moment(form.birthday).format('YYYY-MM-DD');
|
||||
@@ -212,6 +214,10 @@ export default {
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (orgId) {
|
||||
form.sysEmpParam.orgId = orgId;
|
||||
}
|
||||
this.form = form;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<yo-tree-layout :load-data="loadTreeData" @select="onSelect" default-expanded-keys>
|
||||
<container>
|
||||
<br />
|
||||
<a-alert closable type="error">
|
||||
<template slot="message">
|
||||
后端bug:生日不填写,在保存时会默认写入0001-01-01
|
||||
@@ -9,10 +8,6 @@
|
||||
</template>
|
||||
</a-alert>
|
||||
<br />
|
||||
<a-alert closable type="warning">
|
||||
<template slot="message">缺授权的两块功能</template>
|
||||
</a-alert>
|
||||
<br />
|
||||
<a-card :bordered="false">
|
||||
<Auth auth="sysUser:page">
|
||||
<div class="yo-query-bar">
|
||||
|
||||
Reference in New Issue
Block a user