fix: 优化user新增修改

This commit is contained in:
lilinyuan
2024-03-27 14:20:23 +08:00
parent 462c2e2110
commit e1f5c48a6e

View File

@@ -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>