更新字段

feature/0423
Wayne 11 months ago
parent f4fd329cea
commit 4e9470eea1
  1. 9
      src/views/content/article/category/modules/AddForm.vue
  2. 12
      src/views/content/article/category/modules/EditForm.vue

@ -15,6 +15,11 @@
v-decorator="['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" v-decorator="['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="分类图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<SelectImage
v-decorator="['img_id', { rules: [{ required: true, message: '请选择分类图片' }] }]"
/>
</a-form-item>
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端是否展示"> <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端是否展示">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]"> <a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">显示</a-radio> <a-radio :value="1">显示</a-radio>
@ -34,8 +39,12 @@
<script> <script>
import * as Api from '@/api/content/article/category' import * as Api from '@/api/content/article/category'
import { SelectImage } from '@/components'
export default { export default {
components: {
SelectImage
},
data () { data () {
return { return {
// //

@ -16,6 +16,12 @@
v-decorator="['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" v-decorator="['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="分类图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<SelectImage
:defaultList="record.catImg ? [record.catImg] : []"
v-decorator="['img_id', { rules: [{ required: true, message: '请选择分类图片' }] }]"
/>
</a-form-item>
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端是否展示"> <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端是否展示">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]"> <a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">显示</a-radio> <a-radio :value="1">显示</a-radio>
@ -36,8 +42,12 @@
<script> <script>
import pick from 'lodash.pick' import pick from 'lodash.pick'
import * as Api from '@/api/content/article/category' import * as Api from '@/api/content/article/category'
import { SelectImage } from '@/components'
export default { export default {
components: {
SelectImage
},
data () { data () {
return { return {
// //
@ -76,7 +86,7 @@ export default {
setFieldsValue () { setFieldsValue () {
const { $nextTick, form: { setFieldsValue } } = this const { $nextTick, form: { setFieldsValue } } = this
$nextTick(() => { $nextTick(() => {
setFieldsValue(pick(this.record, ['name', 'status', 'sort'])) setFieldsValue(pick(this.record, ['name', 'status', 'sort', 'img_id']))
}) })
}, },

Loading…
Cancel
Save