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