浏览代码

文章审核优化

yjwang 2 天之前
父节点
当前提交
559cdce56a
共有 1 个文件被更改,包括 71 次插入14 次删除
  1. 71 14
      src/views/his/article/index.vue

+ 71 - 14
src/views/his/article/index.vue

@@ -11,6 +11,20 @@
        />
      </el-select>
       </el-form-item>
+      <el-form-item label="审核状态">
+        <el-select
+          v-model="queryParams.auditStatus"
+          placeholder="请选择审核状态"
+          style="width: 200px"
+        >
+          <el-option
+            v-for="option in auditStatusOptions"
+            :key="option.value"
+            :label="option.label"
+            :value="option.value"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item label="标题" prop="title">
         <el-input
           v-model="queryParams.title"
@@ -66,17 +80,18 @@
           v-hasPermi="['his:healthArticle:add']"
         >新增</el-button>
       </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['his:healthArticle:edit']"
-        >修改</el-button>
-      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="success"-->
+<!--          plain-->
+<!--          icon="el-icon-edit"-->
+<!--          size="mini"-->
+<!--          :disabled="single"-->
+<!--          @click="handleUpdate"-->
+
+<!--          v-hasPermi="['his:healthArticle:edit']"-->
+<!--        >修改</el-button>-->
+<!--      </el-col>-->
       <el-col :span="1.5">
         <el-button
           type="danger"
@@ -133,8 +148,11 @@
       <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
       <el-table-column label="更新时间" align="center" prop="updateTime" width="180" />
       <el-table-column label="审核状态" align="center" prop="updateTime" width="180">
-        <template v-slot="row">
-
+        <template v-slot="scope">
+            <span v-if="scope.row.auditStatus == -1">已驳回</span>
+            <span v-if="scope.row.auditStatus == 0">待审核</span>
+            <span v-if="scope.row.auditStatus == 1">审核中</span>
+            <span v-if="scope.row.auditStatus == 2">已审核</span>
         </template>
       </el-table-column>
 
@@ -145,6 +163,7 @@
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
+            v-if="scope.row.auditStatus != 1"
             v-hasPermi="['his:healthArticle:edit']"
           >修改</el-button>
            <el-button
@@ -158,8 +177,16 @@
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
+            v-if="scope.row.auditStatus != 1"
             v-hasPermi="['his:healthArticle:remove']"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-check"
+            @click="submitReview(scope.row)"
+            v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == -1"
+          >提交审核</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -266,6 +293,13 @@ export default {
   components: { Template, Editor ,ArticleDetails},
   data() {
     return {
+      auditStatusOptions: [
+        { label: '全部', value: '' },
+        { label: '驳回', value: -1 },
+        { label: '待审核', value: 0 },
+        { label: '审核中', value: 1 },
+        { label: '已审核', value: 2 }
+      ],
       show:{
               title:"健康知识详情",
               open:false,
@@ -307,7 +341,8 @@ export default {
         isTui: null,
         isNews: null,
         contents: null,
-        publishTime: null
+        publishTime: null,
+        auditStatus: ''
       },
       // 表单参数
       form: {},
@@ -422,6 +457,7 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
+      this.queryParams.auditStatus = '';
       this.handleQuery();
     },
     // 多选框选中数据
@@ -508,6 +544,27 @@ export default {
           this.download(response.msg);
           this.exportLoading = false;
         }).catch(() => {});
+    },
+    submitReview(row) {
+      this.$confirm('是否提交审核文章', '提示', {
+        confirmButtonText: '是',
+        cancelButtonText: '否',
+        type: 'warning'
+      }).then(() => {
+        let formData = row;
+        formData.auditStatus = 1;
+        console.log("提交审核------------》", formData);
+        updateArticle(formData).then(response => {
+          this.msgSuccess("操作成功!");
+          this.open = false;
+          this.getList();
+        }).catch(error => {
+          console.error("更新文章失败:", error);
+          this.msgError("操作失败,请重试!");
+        });
+      }).catch(() => {
+        console.log("用户取消了提交审核");
+      });
     }
   }
 };