|
@@ -10,11 +10,35 @@
|
|
|
:wrapper-col="{ span: 5 }"
|
|
|
@submit="handleSubmit"
|
|
|
>
|
|
|
+ <a-form-item label="文章标题">
|
|
|
+ <a-input
|
|
|
+ placeholder="请输入文章标题"
|
|
|
+ :maxLength="100"
|
|
|
+ v-decorator="[
|
|
|
+ 'name',
|
|
|
+ {
|
|
|
+ rules: [{ required: true, message: '请输入文章标题' }],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="文章描述">
|
|
|
+ <a-input
|
|
|
+ placeholder="请输入文章描述"
|
|
|
+ :maxLength="100"
|
|
|
+ v-decorator="[
|
|
|
+ 'description',
|
|
|
+ {
|
|
|
+ rules: [{ required: true, message: '请输入文章描述' }],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
<a-form-item label="文章分类">
|
|
|
<!-- 文章分类父类 -->
|
|
|
<a-select
|
|
|
v-decorator="[
|
|
|
- 'articalParentClass',
|
|
|
+ 'articleParentClass',
|
|
|
{
|
|
|
rules: [{ required: true, message: '请选择文章分类父类' }],
|
|
|
},
|
|
@@ -22,18 +46,17 @@
|
|
|
@change="articleClassParentChange"
|
|
|
>
|
|
|
<a-select-option
|
|
|
- v-for="(item, index) in articalParentClassArr"
|
|
|
+ v-for="(item, index) in articleParentClassArr"
|
|
|
:key="index"
|
|
|
+ >{{ articleParentClassArr[index].name }}</a-select-option
|
|
|
>
|
|
|
- {{ articalParentClassArr[index].name }}
|
|
|
- </a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
<a-form-item label="文章子类">
|
|
|
<!-- 文章分类子类 -->
|
|
|
<a-select
|
|
|
v-decorator="[
|
|
|
- 'articalChildClass',
|
|
|
+ 'articleChildClass',
|
|
|
{
|
|
|
rules: [{ required: true, message: '请选择文章分类子类' }],
|
|
|
},
|
|
@@ -41,11 +64,10 @@
|
|
|
@change="articleClassChildChange"
|
|
|
>
|
|
|
<a-select-option
|
|
|
- v-for="(item, index) in articalChildClassArr"
|
|
|
+ v-for="(item, index) in articleChildClassArr"
|
|
|
:key="index"
|
|
|
+ >{{ articleChildClassArr[index].name }}</a-select-option
|
|
|
>
|
|
|
- {{ articalChildClassArr[index].name }}
|
|
|
- </a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
|
|
@@ -62,9 +84,8 @@
|
|
|
<a-select-option
|
|
|
v-for="(item, index) in engineerTypeArray"
|
|
|
:key="index"
|
|
|
+ >{{ engineerTypeArray[index].name }}</a-select-option
|
|
|
>
|
|
|
- {{ engineerTypeArray[index].name }}
|
|
|
- </a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
|
|
@@ -73,16 +94,16 @@
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item :wrapper-col="{ span: 20, offset: 10 }">
|
|
|
- <a-button type="primary" html-type="submit"> 提交 </a-button>
|
|
|
- <a-button :style="{ marginLeft: '160px' }" @click="preview">
|
|
|
- 预览
|
|
|
- </a-button>
|
|
|
+ <a-button type="primary" html-type="submit">提交</a-button>
|
|
|
+ <a-button :style="{ marginLeft: '160px' }" @click="preview"
|
|
|
+ >预览</a-button
|
|
|
+ >
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
<!-- 预览弹出框 -->
|
|
|
<a-drawer
|
|
|
- title=""
|
|
|
+ title
|
|
|
placement="left"
|
|
|
:closable="true"
|
|
|
:visible="previewVisible"
|
|
@@ -110,11 +131,11 @@ export default {
|
|
|
// 展示预览
|
|
|
previewVisible: false,
|
|
|
form: this.$form.createForm(this, { name: 'articleCreate' }),
|
|
|
- articalParentClassArr: [],
|
|
|
- articalChildClassArr: [],
|
|
|
+ articleParentClassArr: [],
|
|
|
+ articleChildClassArr: [],
|
|
|
engineerTypeArray: [],
|
|
|
- articalParentClass: {},
|
|
|
- articalChildClass: {},
|
|
|
+ articleParentClass: {},
|
|
|
+ articleChildClass: {},
|
|
|
engineerType: '',
|
|
|
learnDate: '',
|
|
|
};
|
|
@@ -129,15 +150,16 @@ export default {
|
|
|
methods: {
|
|
|
//初始化数据
|
|
|
initDataFun() {
|
|
|
- this.getArticalParentClass();
|
|
|
+ this.getArticleParentClass();
|
|
|
this.getEngineersWork();
|
|
|
},
|
|
|
// 查询文章分类父级
|
|
|
- getArticalParentClass() {
|
|
|
+ getArticleParentClass() {
|
|
|
this.$_http
|
|
|
.get(this.$_API.INTERFACE_GET_CATEGORIES)
|
|
|
.then((res) => {
|
|
|
- this.articalParentClassArr = res.data;
|
|
|
+ console.log('--parent--' + JSON.stringify(res));
|
|
|
+ this.articleParentClassArr = res.data;
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -145,8 +167,8 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 查询文章分类子集
|
|
|
- getArticalChildClass() {
|
|
|
- let pathParamsData = { categoryId: '' };
|
|
|
+ getArticleChildClass() {
|
|
|
+ let pathParamsData = { categoryId: this.articleParentClass.id };
|
|
|
this.$_http
|
|
|
.get(
|
|
|
formatePathParams(
|
|
@@ -155,7 +177,7 @@ export default {
|
|
|
)
|
|
|
)
|
|
|
.then((res) => {
|
|
|
- this.articalChildClassArr = res.data;
|
|
|
+ this.articleChildClassArr = res.data;
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -173,19 +195,18 @@ export default {
|
|
|
|
|
|
// 文章分类父类变化
|
|
|
articleClassParentChange(value) {
|
|
|
- this.articalParentClass = this.articalParentClassArr[value];
|
|
|
-
|
|
|
- // 获取子类的值
|
|
|
- this.getArticalChildClass();
|
|
|
+ this.articleParentClass = this.articleParentClassArr[value];
|
|
|
// 子类选项清空
|
|
|
- this.articalChildClassArr = [];
|
|
|
+ this.articleChildClassArr = [];
|
|
|
this.form.setFieldsValue({
|
|
|
- articalChildClass: '',
|
|
|
+ articleChildClass: '',
|
|
|
});
|
|
|
+ // 获取子类的值
|
|
|
+ this.getArticleChildClass();
|
|
|
},
|
|
|
// 文章分类子类变化
|
|
|
articleClassChildChange(value) {
|
|
|
- this.articalChildClass = this.articalChildClassArr[value];
|
|
|
+ this.articleChildClass = this.articleChildClassArr[value];
|
|
|
},
|
|
|
// 工种变化
|
|
|
engineerTypeChange(value) {
|
|
@@ -200,10 +221,10 @@ export default {
|
|
|
e.preventDefault();
|
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
- articalParentClass: this.articalParentClass.name,
|
|
|
+ articleParentClass: this.articleParentClass.name,
|
|
|
});
|
|
|
this.form.setFieldsValue({
|
|
|
- articalChildClass: this.articalChildClass.name,
|
|
|
+ articleChildClass: this.articleChildClass.name,
|
|
|
});
|
|
|
this.form.setFieldsValue({
|
|
|
engineerType: this.engineerType.name,
|
|
@@ -222,8 +243,8 @@ export default {
|
|
|
onOk() {
|
|
|
that.loading = true;
|
|
|
let params = {
|
|
|
- name: 'test',
|
|
|
- description: 'aaa',
|
|
|
+ name: values.name,
|
|
|
+ description: values.description,
|
|
|
type: 'ARTICLE',
|
|
|
contents: that.content,
|
|
|
tages: [that.learnDate],
|