fix: 优化user新增修改
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<baseTitle :title="'用户信息录入'"></baseTitle>
|
||||
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
|
||||
<div class="oper-page-btn">
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button type="primary" @click="handleBack">返回</el-button>
|
||||
<div v-loading="loading">
|
||||
<baseTitle :title="'用户信息录入'"></baseTitle>
|
||||
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
|
||||
<div class="oper-page-btn">
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button type="primary" @click="handleBack">返回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -21,6 +23,7 @@ const cacheStore = useCacheStore();
|
||||
const route = useRoute()
|
||||
|
||||
const form = ref(null)
|
||||
const loading = ref(false)
|
||||
|
||||
const localData = reactive({
|
||||
subCompanyIdOpt: [],
|
||||
@@ -185,6 +188,10 @@ const getInfo = async () => {
|
||||
if(!route.query.id) return
|
||||
// 获取详情数据
|
||||
const { data } = await getUserDetail(route.query.id)
|
||||
if(data.subCompanyId) {
|
||||
const res = await getDeptOpt({subCompanyId: data.subCompanyId})
|
||||
localData.departmentIdOpt = res.data
|
||||
}
|
||||
form.value.setValues(data)
|
||||
|
||||
}
|
||||
@@ -221,11 +228,13 @@ const handleBack = () => {
|
||||
history.back()
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
onMounted(async ()=>{
|
||||
loading.value = true
|
||||
await init()
|
||||
if(!route.query.isAdd) {
|
||||
getInfo()
|
||||
await getInfo()
|
||||
}
|
||||
init()
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user