|
@@ -13,19 +13,29 @@
|
|
<el-table-column prop="publish_unit" label="发布单位" align="center"> </el-table-column>
|
|
<el-table-column prop="publish_unit" label="发布单位" align="center"> </el-table-column>
|
|
<el-table-column label="状态" align="center">
|
|
<el-table-column label="状态" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>{{ scope.row.status == '0' ? '草稿' : scope.row.status == '1' ? '审核中' : scope.row.status == '2' ? '审核通过' : '未识别' }}</span>
|
|
|
|
|
|
+ <span>{{
|
|
|
|
+ scope.row.status == '0'
|
|
|
|
+ ? '草稿'
|
|
|
|
+ : scope.row.status == '1'
|
|
|
|
+ ? '审核中'
|
|
|
|
+ : scope.row.status == '2'
|
|
|
|
+ ? '审核通过'
|
|
|
|
+ : scope.row.status == '3'
|
|
|
|
+ ? '审核拒绝'
|
|
|
|
+ : '未识别'
|
|
|
|
+ }}</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" width="220">
|
|
<el-table-column label="操作" align="center" width="220">
|
|
- <template slot-scope="">
|
|
|
|
- <el-button size="mini" type="primary">编辑</el-button>
|
|
|
|
- <el-button size="mini" type="success">发布</el-button>
|
|
|
|
- <el-button size="mini" type="danger">删除</el-button>
|
|
|
|
- <!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
|
|
|
- <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button> -->
|
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button size="mini" type="primary" @click="examineBtn(scope.row)" v-if="user.type == '0' || user.type == '1'">审核</el-button>
|
|
|
|
+ <el-button size="mini" type="primary" v-if="scope.row.status == '0'" @click="examineBtn(scope.row)">编辑</el-button>
|
|
|
|
+ <el-button size="mini" type="success" v-if="scope.row.status == '0'" @click="submitInfo(scope.row)">发布</el-button>
|
|
|
|
+ <el-button size="mini" type="danger" @click="deleteBtn(scope.row.id)">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
|
|
+ <page :total="total" position="right" @query="searchInfo"></page>
|
|
</el-col>
|
|
</el-col>
|
|
</span>
|
|
</span>
|
|
<span v-else>
|
|
<span v-else>
|
|
@@ -55,9 +65,9 @@
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="链接地址" prop="url" v-if="form.type == '1'">
|
|
<el-form-item label="链接地址" prop="url" v-if="form.type == '1'">
|
|
- <el-input v-model="form.url" placeholder="请输入链接地址"></el-input>
|
|
|
|
|
|
+ <el-input v-model="form.url" placeholder="请输入链接地址(https://)"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="发布单位" prop="publish_unit" v-if="form.type == '0'">
|
|
|
|
|
|
+ <el-form-item label="发布单位" prop="publish_unit">
|
|
<el-input v-model="form.publish_unit" placeholder="请输入发布单位"></el-input>
|
|
<el-input v-model="form.publish_unit" placeholder="请输入发布单位"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="图片" prop="img_url" v-if="form.type == '0'">
|
|
<el-form-item label="图片" prop="img_url" v-if="form.type == '0'">
|
|
@@ -83,13 +93,6 @@
|
|
<el-radio label="1">推荐</el-radio>
|
|
<el-radio label="1">推荐</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="状态" prop="status" v-if="user.type == '0' || user.type == '1'">
|
|
|
|
- <el-radio-group v-model="form.status">
|
|
|
|
- <el-radio label="0">草稿</el-radio>
|
|
|
|
- <el-radio label="1">审核中</el-radio>
|
|
|
|
- <el-radio label="2">审核通过</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
<el-col :span="24" style="text-align:center;">
|
|
<el-col :span="24" style="text-align:center;">
|
|
<el-button type="success" v-if="user.type == '0' || user.type == '1'" @click="examineIn()">审核通过</el-button>
|
|
<el-button type="success" v-if="user.type == '0' || user.type == '1'" @click="examineIn()">审核通过</el-button>
|
|
<el-button type="danger" v-if="user.type == '0' || user.type == '1'" @click="examineOut()">审核拒绝</el-button>
|
|
<el-button type="danger" v-if="user.type == '0' || user.type == '1'" @click="examineOut()">审核拒绝</el-button>
|
|
@@ -108,6 +111,7 @@
|
|
<script>
|
|
<script>
|
|
import upload from '@/components/upload.vue';
|
|
import upload from '@/components/upload.vue';
|
|
import wangEditor from '@/components/wang-editor.vue';
|
|
import wangEditor from '@/components/wang-editor.vue';
|
|
|
|
+import page from '@/components/pagination.vue';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
const { mapActions: news } = createNamespacedHelpers('news');
|
|
const { mapActions: news } = createNamespacedHelpers('news');
|
|
export default {
|
|
export default {
|
|
@@ -116,12 +120,14 @@ export default {
|
|
components: {
|
|
components: {
|
|
upload,
|
|
upload,
|
|
wangEditor,
|
|
wangEditor,
|
|
|
|
+ page,
|
|
},
|
|
},
|
|
data: function() {
|
|
data: function() {
|
|
return {
|
|
return {
|
|
display: 'list',
|
|
display: 'list',
|
|
// 列表
|
|
// 列表
|
|
list: [],
|
|
list: [],
|
|
|
|
+ total: 0,
|
|
// 选择栏目
|
|
// 选择栏目
|
|
column_list: [
|
|
column_list: [
|
|
{ value: '科技资讯', label: '科技资讯' },
|
|
{ value: '科技资讯', label: '科技资讯' },
|
|
@@ -131,7 +137,7 @@ export default {
|
|
{ value: '平台建设', label: '平台建设' },
|
|
{ value: '平台建设', label: '平台建设' },
|
|
{ value: '项目成果', label: '项目成果' },
|
|
{ value: '项目成果', label: '项目成果' },
|
|
{ value: '知识产权', label: '知识产权' },
|
|
{ value: '知识产权', label: '知识产权' },
|
|
- { value: '科技支撑', label: '科技支撑' },
|
|
|
|
|
|
+ { value: '科技合作', label: '科技合作' },
|
|
{ value: '超算联盟', label: '超算联盟' },
|
|
{ value: '超算联盟', label: '超算联盟' },
|
|
{ value: '国家网格', label: '国家网格' },
|
|
{ value: '国家网格', label: '国家网格' },
|
|
{ value: '教学中心', label: '教学中心' },
|
|
{ value: '教学中心', label: '教学中心' },
|
|
@@ -147,9 +153,7 @@ export default {
|
|
{ value: '党风廉政', label: '党风廉政' },
|
|
{ value: '党风廉政', label: '党风廉政' },
|
|
],
|
|
],
|
|
// 发布
|
|
// 发布
|
|
- form: {
|
|
|
|
- type: '0',
|
|
|
|
- },
|
|
|
|
|
|
+ form: {},
|
|
// 规则
|
|
// 规则
|
|
rules: {
|
|
rules: {
|
|
col_name: [{ required: true, message: '请选择栏目', trigger: 'blur' }],
|
|
col_name: [{ required: true, message: '请选择栏目', trigger: 'blur' }],
|
|
@@ -167,47 +171,128 @@ export default {
|
|
this.searchInfo();
|
|
this.searchInfo();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- ...news({ newsQuery: 'query', newsCreate: 'create' }),
|
|
|
|
- async searchInfo({ skip = 0, limit = 0, col_name = '工作动态', ...info } = {}) {
|
|
|
|
- let res = await this.newsQuery({ skip, limit, col_name, ...info });
|
|
|
|
|
|
+ ...news({ newsQuery: 'query', newsCreate: 'create', newsUpdate: 'update', newsDelete: 'delete' }),
|
|
|
|
+ async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
|
+ let res = await this.newsQuery({ skip, limit, ...info });
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
this.$set(this, `list`, res.data);
|
|
this.$set(this, `list`, res.data);
|
|
|
|
+ this.$set(this, `total`, res.total);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 添加
|
|
// 添加
|
|
add() {
|
|
add() {
|
|
this.display = 'detail';
|
|
this.display = 'detail';
|
|
|
|
+ this.form = {};
|
|
},
|
|
},
|
|
// 返回
|
|
// 返回
|
|
back() {
|
|
back() {
|
|
this.display = 'list';
|
|
this.display = 'list';
|
|
},
|
|
},
|
|
|
|
+ // 列表发布信息
|
|
|
|
+ async submitInfo(data) {
|
|
|
|
+ data.status = '1';
|
|
|
|
+ let res = await this.newsUpdate(data);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '发布信息成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 列表审核打开
|
|
|
|
+ examineBtn(data) {
|
|
|
|
+ this.display = 'detail';
|
|
|
|
+ this.$set(this, `form`, data);
|
|
|
|
+ },
|
|
|
|
+ // 详情审核通过
|
|
|
|
+ async examineIn() {
|
|
|
|
+ this.form.status = '2';
|
|
|
|
+ let res = await this.newsUpdate(this.form);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '审核通过',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 详情审核拒绝
|
|
|
|
+ async examineOut() {
|
|
|
|
+ this.form.status = '3';
|
|
|
|
+ let res = await this.newsUpdate(this.form);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '审核拒绝',
|
|
|
|
+ type: 'error',
|
|
|
|
+ });
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 保存草稿
|
|
// 保存草稿
|
|
submitDraft(formName) {
|
|
submitDraft(formName) {
|
|
this.$refs[formName].validate(async valid => {
|
|
this.$refs[formName].validate(async valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- this.form.uid = this.user.uid;
|
|
|
|
- this.form.status = '0';
|
|
|
|
- let res = await this.newsCreate(this.form);
|
|
|
|
- if (this.$checkRes(res)) {
|
|
|
|
- console.log(res);
|
|
|
|
|
|
+ if (this.form.publisher) {
|
|
|
|
+ let res = await this.newsUpdate(this.form);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '修改信息成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.form = {};
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.form.publisher = this.user.uid;
|
|
|
|
+ this.form.status = '0';
|
|
|
|
+ let res = await this.newsCreate(this.form);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '创建信息成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.form = {};
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- console.log(this.form);
|
|
|
|
} else {
|
|
} else {
|
|
console.log('error submit!!');
|
|
console.log('error submit!!');
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- // 提交
|
|
|
|
|
|
+ // 提交发布
|
|
submitForm(formName) {
|
|
submitForm(formName) {
|
|
this.$refs[formName].validate(async valid => {
|
|
this.$refs[formName].validate(async valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- this.form.publisher = this.user.uid;
|
|
|
|
- this.form.status = '1';
|
|
|
|
- let res = await this.newsCreate(this.form);
|
|
|
|
- if (this.$checkRes(res)) {
|
|
|
|
- console.log(res);
|
|
|
|
|
|
+ if (this.form.publisher) {
|
|
|
|
+ this.form.status = '1';
|
|
|
|
+ let res = await this.newsUpdate(this.form);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '发布信息成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.form.publisher = this.user.uid;
|
|
|
|
+ this.form.status = '1';
|
|
|
|
+ let res = await this.newsCreate(this.form);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '发布信息成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
console.log('error submit!!');
|
|
console.log('error submit!!');
|
|
@@ -218,14 +303,19 @@ export default {
|
|
// 取消
|
|
// 取消
|
|
resetForm(formName) {
|
|
resetForm(formName) {
|
|
this.$refs[formName].resetFields();
|
|
this.$refs[formName].resetFields();
|
|
|
|
+ this.display = 'list';
|
|
|
|
+ this.searchInfo();
|
|
},
|
|
},
|
|
- // 审核通过
|
|
|
|
- examineIn() {
|
|
|
|
- console.log('审核通过');
|
|
|
|
- },
|
|
|
|
- // 审核拒绝
|
|
|
|
- examineOut() {
|
|
|
|
- console.log('审核拒绝');
|
|
|
|
|
|
+ // 删除
|
|
|
|
+ async deleteBtn(id) {
|
|
|
|
+ let res = await this.newsDelete(id);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '删除信息成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.searchInfo();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 图片
|
|
// 图片
|
|
uploadSuccess({ type, data }) {
|
|
uploadSuccess({ type, data }) {
|