Commit d4d6f667aa26f16de3d6039984da8e5dc6446206

Authored by xingyu4j
1 parent d0167b3f

fix: dictType edit

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