|
@@ -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,10 +46,10 @@
|
|
|
@change="articleClassParentChange"
|
|
|
>
|
|
|
<a-select-option
|
|
|
- v-for="(item, index) in articalParentClassArr"
|
|
|
+ v-for="(item, index) in articleParentClassArr"
|
|
|
:key="index"
|
|
|
>
|
|
|
- {{ articalParentClassArr[index].name }}
|
|
|
+ {{ articleParentClassArr[index].name }}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
@@ -33,7 +57,7 @@
|
|
|
<!-- 文章分类子类 -->
|
|
|
<a-select
|
|
|
v-decorator="[
|
|
|
- 'articalChildClass',
|
|
|
+ 'articleChildClass',
|
|
|
{
|
|
|
rules: [{ required: true, message: '请选择文章分类子类' }],
|
|
|
},
|
|
@@ -41,10 +65,10 @@
|
|
|
@change="articleClassChildChange"
|
|
|
>
|
|
|
<a-select-option
|
|
|
- v-for="(item, index) in articalChildClassArr"
|
|
|
+ v-for="(item, index) in articleChildClassArr"
|
|
|
:key="index"
|
|
|
>
|
|
|
- {{ articalChildClassArr[index].name }}
|
|
|
+ {{ articleChildClassArr[index].name }}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
@@ -110,11 +134,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 +153,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 +170,8 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 查询文章分类子集
|
|
|
- getArticalChildClass() {
|
|
|
- let pathParamsData = { categoryId: "" };
|
|
|
+ getArticleChildClass() {
|
|
|
+ let pathParamsData = { categoryId: this.articleParentClass.id };
|
|
|
this.$_http
|
|
|
.get(
|
|
|
formatePathParams(
|
|
@@ -155,7 +180,10 @@ export default {
|
|
|
)
|
|
|
)
|
|
|
.then(res => {
|
|
|
- this.articalChildClassArr = res.data;
|
|
|
+ if (res && res.data.length !== 0) {
|
|
|
+ res.data.shift();
|
|
|
+ this.articleChildClassArr = res.data;
|
|
|
+ }
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -173,19 +201,19 @@ export default {
|
|
|
|
|
|
// 文章分类父类变化
|
|
|
articleClassParentChange(value) {
|
|
|
- this.articalParentClass = this.articalParentClassArr[value];
|
|
|
+ this.articleParentClass = this.articleParentClassArr[value];
|
|
|
|
|
|
// 获取子类的值
|
|
|
- this.getArticalChildClass();
|
|
|
+ this.getArticleChildClass();
|
|
|
// 子类选项清空
|
|
|
- this.articalChildClassArr = [];
|
|
|
+ this.articleChildClassArr = [];
|
|
|
this.form.setFieldsValue({
|
|
|
- articalChildClass: ""
|
|
|
+ articleChildClass: ""
|
|
|
});
|
|
|
},
|
|
|
// 文章分类子类变化
|
|
|
articleClassChildChange(value) {
|
|
|
- this.articalChildClass = this.articalChildClassArr[value];
|
|
|
+ this.articleChildClass = this.articleChildClassArr[value];
|
|
|
},
|
|
|
// 工种变化
|
|
|
engineerTypeChange(value) {
|
|
@@ -200,10 +228,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
|
|
@@ -214,8 +242,8 @@ export default {
|
|
|
// 新建文章
|
|
|
console.log("--submit--" + JSON.stringify(values));
|
|
|
let params = {
|
|
|
- name: "test",
|
|
|
- description: "aaa",
|
|
|
+ name: values.name,
|
|
|
+ description: values.description,
|
|
|
type: "ARTICLE",
|
|
|
contents: this.content,
|
|
|
tages: [this.learnDate],
|