|
@@ -17,7 +17,7 @@
|
|
:labelCol="labelCol"
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:wrapperCol="wrapperCol"
|
|
>
|
|
>
|
|
- <a-select v-decorator="['type', {rules: [{required: true, message: '类别不能为空'}]}]" placeholder="请选择">
|
|
|
|
|
|
+ <a-select @change="handleChangeType" v-decorator="['type', {rules: [{required: true, message: '类别不能为空'}]}]" placeholder="请选择">
|
|
<a-select-option
|
|
<a-select-option
|
|
v-for="(value,key) in typeMap"
|
|
v-for="(value,key) in typeMap"
|
|
:key="key"
|
|
:key="key"
|
|
@@ -33,6 +33,21 @@
|
|
<a-input
|
|
<a-input
|
|
v-decorator="['title', {rules: [{required: true, message: '标题不能为空'}]}]" />
|
|
v-decorator="['title', {rules: [{required: true, message: '标题不能为空'}]}]" />
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
|
+ <a-form-item
|
|
|
|
+ label="父文章"
|
|
|
|
+ :labelCol="labelCol"
|
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
|
+ v-show="type==3||type==4||type==5"
|
|
|
|
+ >
|
|
|
|
+ <a-select v-decorator="['parentId']" >
|
|
|
|
+ <a-select-option
|
|
|
|
+ v-for="({id,title}) in pData"
|
|
|
|
+ :key="id"
|
|
|
|
+ :label="title"
|
|
|
|
+ :value="id">{{ title }}
|
|
|
|
+ </a-select-option>
|
|
|
|
+ </a-select>
|
|
|
|
+ </a-form-item>
|
|
<a-form-item
|
|
<a-form-item
|
|
label="简介"
|
|
label="简介"
|
|
:labelCol="labelCol"
|
|
:labelCol="labelCol"
|
|
@@ -115,7 +130,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import pick from 'lodash.pick'
|
|
import pick from 'lodash.pick'
|
|
-import { addArticle, updateArticle } from '@/api/operate/article'
|
|
|
|
|
|
+import { addArticle, updateArticle, queryArticle } from '@/api/operate/article'
|
|
import WangEditor from '@/components/Editor/WangEditor'
|
|
import WangEditor from '@/components/Editor/WangEditor'
|
|
import UploadImg from '@/components/Upload/UploadImg'
|
|
import UploadImg from '@/components/Upload/UploadImg'
|
|
import UploadArticleFile from '@/components/Upload/UploadArticleFile'
|
|
import UploadArticleFile from '@/components/Upload/UploadArticleFile'
|
|
@@ -137,6 +152,7 @@ export default {
|
|
sm: { span: 20 }
|
|
sm: { span: 20 }
|
|
},
|
|
},
|
|
topFlag: 0,
|
|
topFlag: 0,
|
|
|
|
+ pData: [],
|
|
status: 1,
|
|
status: 1,
|
|
confirmLoading: false,
|
|
confirmLoading: false,
|
|
mdl: {},
|
|
mdl: {},
|
|
@@ -145,7 +161,8 @@ export default {
|
|
visible: false,
|
|
visible: false,
|
|
content: '',
|
|
content: '',
|
|
picture: '',
|
|
picture: '',
|
|
- resultContent: ''
|
|
|
|
|
|
+ resultContent: '',
|
|
|
|
+ type: null
|
|
}
|
|
}
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
@@ -154,6 +171,11 @@ export default {
|
|
default: () => ({})
|
|
default: () => ({})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ created () {
|
|
|
|
+ queryArticle({ type: 2 }).then(res => {
|
|
|
|
+ this.pData = res.data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
base (record) {
|
|
base (record) {
|
|
this.visible = true
|
|
this.visible = true
|
|
@@ -165,10 +187,12 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.modalTitle = '编辑'
|
|
this.modalTitle = '编辑'
|
|
|
|
+ this.type = record.type
|
|
const { form: { setFieldsValue } } = this
|
|
const { form: { setFieldsValue } } = this
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
setFieldsValue(Object.assign(pick(record, [
|
|
setFieldsValue(Object.assign(pick(record, [
|
|
'id',
|
|
'id',
|
|
|
|
+ 'parentId',
|
|
'type',
|
|
'type',
|
|
'title',
|
|
'title',
|
|
'sort',
|
|
'sort',
|
|
@@ -196,6 +220,9 @@ export default {
|
|
catchData (content) {
|
|
catchData (content) {
|
|
this.resultContent = content
|
|
this.resultContent = content
|
|
},
|
|
},
|
|
|
|
+ handleChangeType (value) {
|
|
|
|
+ this.type = value
|
|
|
|
+ },
|
|
catchImage (fileList) {
|
|
catchImage (fileList) {
|
|
if (fileList.length !== 0) {
|
|
if (fileList.length !== 0) {
|
|
this.picture = fileList[0].url
|
|
this.picture = fileList[0].url
|
|
@@ -216,6 +243,12 @@ export default {
|
|
status: this.status,
|
|
status: this.status,
|
|
content: this.resultContent ? this.resultContent : this.content
|
|
content: this.resultContent ? this.resultContent : this.content
|
|
}
|
|
}
|
|
|
|
+ if (this.type === 2) {
|
|
|
|
+ if (values.parentId == null) {
|
|
|
|
+ this.$message.error('请选择父文章')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (this.BaseTool.String.isBlank(values.id)) {
|
|
if (this.BaseTool.String.isBlank(values.id)) {
|
|
addArticle(values)
|
|
addArticle(values)
|
|
.then(() => {
|
|
.then(() => {
|