层级数据
This commit is contained in:
@@ -8,26 +8,8 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<!-- <el-form-item label="发布人" prop="publishUserName">-->
|
||||
<!-- <el-input v-model="formData.publishUserName" placeholder="请输入发布人" clearable :style="{width: '100%'}">-->
|
||||
<!-- </el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<!-- <el-col :span="6">-->
|
||||
<!-- <el-form-item label="文章类型" prop="type">-->
|
||||
<!-- <el-select v-model="formData.type" placeholder="请选择文章类型" clearable :style="{width: '100%'}">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in articleTypeOptions"-->
|
||||
<!-- :key="dict.dictValue"-->
|
||||
<!-- :label="dict.dictLabel"-->
|
||||
<!-- :value="dict.dictValue"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否顶置" prop="isTop">
|
||||
<el-radio-group v-model="formData.isTop">
|
||||
@@ -56,57 +38,70 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="sistArticleTypeOption.length>0 && approveShow.sist">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="信息网站">
|
||||
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
|
||||
placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-row v-show="sistArticleTypeOption.length>0 && approveShow.sist">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="信息网站">
|
||||
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
|
||||
placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.sistApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="labArticleTypeOption.length>0 && approveShow.lab">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="实验室网站">
|
||||
<el-select v-model="params.labArticleType" placeholder="请选择文章类型"
|
||||
@change="getLabApprove(params.labArticleType)" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.labApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.sistApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="labArticleTypeOption.length>0 && approveShow.lab">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="实验室网站">
|
||||
<el-select v-model="params.labArticleType" placeholder="请选择文章类型"
|
||||
@change="getLabApprove(params.labArticleType)" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.labApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
<el-col :span="12" v-show="imgurlShow">
|
||||
<el-form-item >
|
||||
<UploadFile v-model="formData.imgurl"
|
||||
file-type="image"
|
||||
:v-public="true"
|
||||
:v-data="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -130,21 +125,25 @@
|
||||
import Editor from '@/components/Editor';
|
||||
import {updateArticle, getArticle, drafts, getArticleType, getArticleApprove} from "@/api/sist/article";
|
||||
import {Message} from "element-ui";
|
||||
import UploadFile from '@/views/utils/uploadFile.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Editor,
|
||||
UploadFile
|
||||
},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
submit: 1,
|
||||
imgurlShow:false,
|
||||
formData: {
|
||||
id: null,
|
||||
title: null,
|
||||
isTop: null,
|
||||
isEnglish: null,
|
||||
content: "",
|
||||
imgurl:null,
|
||||
},
|
||||
approveShow: {
|
||||
sist: true,
|
||||
@@ -186,6 +185,11 @@ export default {
|
||||
message: '请选择是否显示',
|
||||
trigger: 'change'
|
||||
}],
|
||||
imgurl: [{
|
||||
required: true,
|
||||
message: '请选择是否显示',
|
||||
trigger: 'change'
|
||||
}],
|
||||
sitetype: [{
|
||||
required: true,
|
||||
message: '单选框组不能为空',
|
||||
@@ -244,7 +248,6 @@ export default {
|
||||
getArticleType().then(res => {
|
||||
let dictCodes = res.data
|
||||
let articleList = this.articleTypeOptions
|
||||
console.log(articleList, dictCodes);
|
||||
for (let i = 0; i < articleList.length; i++) {
|
||||
for (let j = 0; j < dictCodes.length; j++) {
|
||||
if (articleList[i].dictCode === dictCodes[j]) {
|
||||
@@ -262,58 +265,76 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getSistApprove(dictCode) {
|
||||
this.judgeThumbnail(dictCode)
|
||||
getArticleApprove(dictCode).then(res => {
|
||||
this.sistApproveOption = res.data
|
||||
})
|
||||
|
||||
},
|
||||
getLabApprove(dictCode) {
|
||||
this.judgeThumbnail(dictCode)
|
||||
getArticleApprove(dictCode).then(res => {
|
||||
this.labApproveOption = res.data
|
||||
})
|
||||
},
|
||||
judgeThumbnail(dictCode){
|
||||
let articleList = this.articleTypeOptions
|
||||
for (let article of articleList) {
|
||||
if (dictCode === article.dictCode && article.attribute1 == 1){
|
||||
this.imgurlShow = true
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
let that_ = this
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
if (valid) {
|
||||
if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType === null || this.params.labArticleType === "")) {
|
||||
if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType === null || that_.params.labArticleType === "")) {
|
||||
Message({
|
||||
message: "请至少选择一个网站发布文章",
|
||||
type: "error",
|
||||
})
|
||||
this.msgSuccess("请至少选择一个网站发布文章")
|
||||
return
|
||||
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType !== null || this.params.labArticleType !== "") && (this.formData.sistApprove === null || this.params.sistApprove === "")) {
|
||||
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType !== null || that_.params.labArticleType !== "") && (that_.formData.sistApprove === null || that_.params.sistApprove === "")) {
|
||||
Message({
|
||||
message: "请选择信息网站的审批人",
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType != null || this.params.labArticleType !== "") && (this.params.labApprove === null || this.params.labApprove === "")) {
|
||||
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType != null || that_.params.labArticleType !== "") && (that_.params.labApprove === null || that_.params.labApprove === "")) {
|
||||
Message({
|
||||
message: "请选择实验室网站的审批人",
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
}
|
||||
if (that_.imgurlShow&&(that_.formData.imgurl == ''||that_.formData.imgurl == null)){
|
||||
Message({
|
||||
message: "请选择缩略图",
|
||||
type: "error",
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.formData.params = this.params
|
||||
if (this.submit == 0) {
|
||||
that_.formData.params = that_.params
|
||||
if (that_.submit == 0) {
|
||||
Message({
|
||||
message: "您操作过快",
|
||||
type: "error",
|
||||
})
|
||||
} else {
|
||||
this.submit = 0
|
||||
this.loading = true;
|
||||
updateArticle(this.formData).then(response => {
|
||||
this.loading = false;
|
||||
that_.submit = 0
|
||||
that_.loading = true;
|
||||
// this.formData.imgurl = this.form.imgurl.url
|
||||
updateArticle(that_.formData).then(response => {
|
||||
that_.loading = false;
|
||||
if (response.code == 200) {
|
||||
this.msgSuccess("提交审批成功");
|
||||
this.submit = 1
|
||||
this.close();
|
||||
that_.msgSuccess("提交审批成功");
|
||||
that_.submit = 1
|
||||
that_.close();
|
||||
}
|
||||
}).catch(e => {
|
||||
this.submit = 1
|
||||
that_.submit = 1
|
||||
});
|
||||
}
|
||||
// TODO 提交表单
|
||||
|
||||
Reference in New Issue
Block a user