Commit d4d6f667aa26f16de3d6039984da8e5dc6446206
1 parent
d0167b3f
fix: dictType edit
Showing
1 changed file
with
14 additions
and
2 deletions
yudao-ui-admin-vue3/src/views/system/dict/index.vue
| ... | ... | @@ -119,7 +119,14 @@ |
| 119 | 119 | :schema="DictTypeSchemas.allSchemas.formSchema" |
| 120 | 120 | :rules="DictTypeSchemas.dictTypeRules" |
| 121 | 121 | ref="typeFormRef" |
| 122 | - /> | |
| 122 | + > | |
| 123 | + <template #type> | |
| 124 | + <template v-if="dictTypeValue"> | |
| 125 | + <el-tag>{{ dictTypeValue }}</el-tag> | |
| 126 | + </template> | |
| 127 | + <template v-else><el-input v-model="dictTypeValue" /> </template> | |
| 128 | + </template> | |
| 129 | + </Form> | |
| 123 | 130 | <Form |
| 124 | 131 | v-if="['dataCreate', 'dataUpdate'].includes(actionType)" |
| 125 | 132 | :schema="DictDataSchemas.allSchemas.formSchema" |
| ... | ... | @@ -152,6 +159,7 @@ import { ref, unref, onMounted } from 'vue' |
| 152 | 159 | import { DICT_TYPE } from '@/utils/dict' |
| 153 | 160 | import { useI18n } from '@/hooks/web/useI18n' |
| 154 | 161 | import { FormExpose } from '@/components/Form' |
| 162 | +import { ElInput, ElTag } from 'element-plus' | |
| 155 | 163 | import * as DictTypeSchemas from './dict.type' |
| 156 | 164 | import * as DictDataSchemas from './dict.data' |
| 157 | 165 | import { useTable } from '@/hooks/web/useTable' |
| ... | ... | @@ -174,15 +182,17 @@ const { |
| 174 | 182 | setSearchParams: setTypeSearchParams, |
| 175 | 183 | delList: delTypeList |
| 176 | 184 | } = typeMethods |
| 177 | - | |
| 185 | +const dictTypeValue = ref('') | |
| 178 | 186 | // 字典分类修改操作 |
| 179 | 187 | const handleTypeCreate = () => { |
| 188 | + dictTypeValue.value = '' | |
| 180 | 189 | setDialogTile('typeCreate') |
| 181 | 190 | } |
| 182 | 191 | const handleTypeUpdate = async (row: DictTypeVO) => { |
| 183 | 192 | setDialogTile('typeUpdate') |
| 184 | 193 | // 设置数据 |
| 185 | 194 | const res = await DictTypeApi.getDictTypeApi(row.id) |
| 195 | + dictTypeValue.value = res.type | |
| 186 | 196 | unref(typeFormRef)?.setValues(res) |
| 187 | 197 | } |
| 188 | 198 | |
| ... | ... | @@ -229,6 +239,7 @@ const actionLoading = ref(false) // 遮罩层 |
| 229 | 239 | const typeFormRef = ref<FormExpose>() // 分类表单 Ref |
| 230 | 240 | const dataFormRef = ref<FormExpose>() // 数据表单 Ref |
| 231 | 241 | const actionType = ref('') // 操作按钮的类型 |
| 242 | + | |
| 232 | 243 | // 设置标题 |
| 233 | 244 | const setDialogTile = (type: string) => { |
| 234 | 245 | dialogTitle.value = t('action.' + type) |
| ... | ... | @@ -246,6 +257,7 @@ const submitTypeForm = async () => { |
| 246 | 257 | try { |
| 247 | 258 | const data = unref(typeFormRef)?.formModel as DictTypeVO |
| 248 | 259 | if (actionType.value === 'typeCreate') { |
| 260 | + data.type = dictTypeValue.value | |
| 249 | 261 | await DictTypeApi.createDictTypeApi(data) |
| 250 | 262 | ElMessage.success(t('common.createSuccess')) |
| 251 | 263 | } else if (actionType.value === 'typeUpdate') { | ... | ... |