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> <template>
<baseTitle :title="'用户信息录入'"></baseTitle> <div v-loading="loading">
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm> <baseTitle :title="'用户信息录入'"></baseTitle>
<div class="oper-page-btn"> <fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
<el-button type="primary" @click="handleSubmit">提交</el-button> <div class="oper-page-btn">
<el-button type="primary" @click="handleBack">返回</el-button> <el-button type="primary" @click="handleSubmit">提交</el-button>
<el-button type="primary" @click="handleBack">返回</el-button>
</div>
</div> </div>
</template> </template>
@@ -21,6 +23,7 @@ const cacheStore = useCacheStore();
const route = useRoute() const route = useRoute()
const form = ref(null) const form = ref(null)
const loading = ref(false)
const localData = reactive({ const localData = reactive({
subCompanyIdOpt: [], subCompanyIdOpt: [],
@@ -185,6 +188,10 @@ const getInfo = async () => {
if(!route.query.id) return if(!route.query.id) return
// 获取详情数据 // 获取详情数据
const { data } = await getUserDetail(route.query.id) 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) form.value.setValues(data)
} }
@@ -221,11 +228,13 @@ const handleBack = () => {
history.back() history.back()
} }
onMounted(()=>{ onMounted(async ()=>{
loading.value = true
await init()
if(!route.query.isAdd) { if(!route.query.isAdd) {
getInfo() await getInfo()
} }
init() loading.value = false
}) })
</script> </script>