add categoty

This commit is contained in:
sdaduanbilei-d1581 2026-01-09 11:57:20 +08:00
parent 211f4a0586
commit e4da41c85d

View File

@ -2,14 +2,14 @@
<div>
<a-button type="text" @click="show = true">{{
type === 'add' ? '新增' : '编辑'
}}</a-button>
}}</a-button>
<a-modal v-model:visible="show" @before-ok="submit" @close="this.$refs.form.resetFields()">
<a-form :model="form" auto-label-width ref="form">
<a-form-item label="徽章类别" field="categoryId" required>
<a-select placeholder="请选择徽章类型" v-model="form.categoryId">
<a-option v-for="item in options" :value="item.id">{{
item.name
}}</a-option>
}}</a-option>
</a-select>
</a-form-item>
<a-form-item label="徽章名称" field="name" required>
@ -87,8 +87,6 @@ export default {
submit(done) {
this.$refs.form.validate(err => {
if (err === undefined) {
const keyword = this.options.find(e => e.id === this.form.categoryId).desc
this.form.keyword = keyword
if (this.form.id) {
this.$api.badge.update(this.form).then(res => {
if (res.code === 200) {
@ -101,6 +99,8 @@ export default {
}
})
} else {
const keyword = this.options.find(e => e.id === this.form.categoryId).desc
this.form.keyword = keyword
this.$api.badge.save(this.form).then(res => {
if (res.code === 200) {
this.$emit('ok')