文章审批加保存
This commit is contained in:
@@ -118,7 +118,8 @@
|
||||
<el-row>
|
||||
<el-col :span="24" class="submitForm">
|
||||
<el-form-item size="large">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button type="success" @click="saveDrafts">保存草稿</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交审核</el-button>
|
||||
<el-button @click="resetForm">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -128,7 +129,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import Editor from '@/components/Editor';
|
||||
import {updateArticle, getArticle, addArticle, getArticleType, getArticleApprove} from "@/api/sist/article";
|
||||
import {updateArticle, getArticle, drafts, getArticleType, getArticleApprove} from "@/api/sist/article";
|
||||
import {Message} from "element-ui";
|
||||
|
||||
export default {
|
||||
@@ -160,28 +161,6 @@ export default {
|
||||
isViewOptions: [],
|
||||
isEnglishOptions: [],
|
||||
sitetypeOptions: [],
|
||||
pickerOptions: {
|
||||
shortcuts: [{
|
||||
text: '今天',
|
||||
onClick(picker) {
|
||||
picker.$emit('pick', new Date());
|
||||
}
|
||||
}, {
|
||||
text: '昨天',
|
||||
onClick(picker) {
|
||||
const date = new Date();
|
||||
date.setTime(date.getTime() - 3600 * 1000 * 24);
|
||||
picker.$emit('pick', date);
|
||||
}
|
||||
}, {
|
||||
text: '一周前',
|
||||
onClick(picker) {
|
||||
const date = new Date();
|
||||
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
|
||||
picker.$emit('pick', date);
|
||||
}
|
||||
}]
|
||||
},
|
||||
rules: {
|
||||
title: [{
|
||||
required: true,
|
||||
@@ -276,9 +255,7 @@ export default {
|
||||
this.labApproveOption = res.data
|
||||
})
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
console.log(this.formData);
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
if (valid) {
|
||||
if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType === null || this.params.labArticleType === "")) {
|
||||
@@ -288,13 +265,13 @@ export default {
|
||||
})
|
||||
return
|
||||
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType !== null || this.params.labArticleType !== "") && (this.formData.sistApprove === null || this.params.sistApprove === "")) {
|
||||
Message({
|
||||
this.msgSuccess({
|
||||
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 === "")) {
|
||||
Message({
|
||||
this.msgSuccess({
|
||||
message: "请选择实验室网站的审批人",
|
||||
type: 'error'
|
||||
})
|
||||
@@ -304,18 +281,28 @@ export default {
|
||||
this.formData.params = this.params
|
||||
if (this.formData.id != null) {
|
||||
updateArticle(this.formData).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.$router.push("/sist/article");
|
||||
});
|
||||
} else {
|
||||
addArticle(this.formData).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.msgSuccess("提交审批成功");
|
||||
this.$router.push("/sist/article");
|
||||
});
|
||||
// } else {
|
||||
// addArticle(this.formData).then(response => {
|
||||
// this.msgSuccess("新增成功");
|
||||
// this.$router.push("/sist/article");
|
||||
// });
|
||||
}
|
||||
// TODO 提交表单
|
||||
})
|
||||
},
|
||||
saveDrafts() {
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
drafts(this.formData).then(res=>{
|
||||
if (this.formData.id === null || this.formData.id === ""){
|
||||
this.formData.id = res.data
|
||||
}
|
||||
this.msgSuccess('保存成功');
|
||||
})
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs['elForm'].resetFields()
|
||||
},
|
||||
@@ -330,5 +317,6 @@ export default {
|
||||
|
||||
.submitForm {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user