fix: 优化供应商授权弹窗的标签和默认值
- 标签根据类型动态显示"分类"或"商品" - 默认值改为undefined,显示placeholder而非0 - 切换类型时清空选择 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
<el-option value="product" label="商品" />
|
<el-option value="product" label="商品" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关联项">
|
<el-form-item :label="authForm.type === 'category' ? '分类' : '商品'">
|
||||||
<el-select v-model="authForm.ref_id" filterable placeholder="请选择" :loading="loadingOptions">
|
<el-select v-model="authForm.ref_id" filterable placeholder="请选择" :loading="loadingOptions">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in optionsList"
|
v-for="item in optionsList"
|
||||||
@@ -80,7 +80,7 @@ const paginatedSuppliers = computed(() => {
|
|||||||
return suppliers.value.slice(start, start + pageSize)
|
return suppliers.value.slice(start, start + pageSize)
|
||||||
})
|
})
|
||||||
const form = reactive({ username: '', email: '', password: '' })
|
const form = reactive({ username: '', email: '', password: '' })
|
||||||
const authForm = reactive({ type: 'category', ref_id: 0 })
|
const authForm = reactive<{ type: string; ref_id: number | undefined }>({ type: 'category', ref_id: undefined })
|
||||||
const optionsList = ref<{ id: number; name: string }[]>([])
|
const optionsList = ref<{ id: number; name: string }[]>([])
|
||||||
const loadingOptions = ref(false)
|
const loadingOptions = ref(false)
|
||||||
|
|
||||||
@@ -103,13 +103,13 @@ async function addSupplier() {
|
|||||||
async function authorize(id: number) {
|
async function authorize(id: number) {
|
||||||
authSupplierId.value = id
|
authSupplierId.value = id
|
||||||
authForm.type = 'category'
|
authForm.type = 'category'
|
||||||
authForm.ref_id = 0
|
authForm.ref_id = undefined
|
||||||
await loadOptions()
|
await loadOptions()
|
||||||
showAuth.value = true
|
showAuth.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleTypeChange() {
|
async function handleTypeChange() {
|
||||||
authForm.ref_id = 0
|
authForm.ref_id = undefined
|
||||||
await loadOptions()
|
await loadOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user