Explorar o código

Merge remote-tracking branch 'origin/saas_adminUi' into saas_adminUi

yys hai 7 horas
pai
achega
ec69432a9b
Modificáronse 1 ficheiros con 12 adicións e 22 borrados
  1. 12 22
      src/views/admin/article/index.vue

+ 12 - 22
src/views/admin/article/index.vue

@@ -3,7 +3,7 @@
     <el-card shadow="never" class="mb16 filter-card">
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="small">
       <el-form-item label="租户名称" prop="tenantId">
-        <inline-tenant-selector @change="handleTenantChange" />
+        <inline-tenant-selector :key="tenantSelectorKey" @change="handleTenantChange" />
       </el-form-item>
       <el-form-item label="文章标题" prop="articleTitle">
         <el-input
@@ -125,7 +125,6 @@
       @pagination="getList"
     />
 
-    <!-- 详情弹窗 -->
     <el-dialog title="文章详情" :visible.sync="viewOpen" width="800px" append-to-body>
       <el-form :model="viewForm" label-width="100px">
         <el-form-item label="租户名称">
@@ -154,7 +153,6 @@
       </el-form>
     </el-dialog>
 
-    <!-- 审计弹窗 -->
     <el-dialog :title="auditTitle" :visible.sync="auditOpen" width="400px" append-to-body>
       <el-form ref="auditForm" :model="auditForm" label-width="80px">
         <el-form-item label="审计备注">
@@ -166,7 +164,6 @@
       </div>
     </el-dialog>
 
-    <!-- 统计弹窗 -->
     <el-dialog title="文章统计" :visible.sync="showStatistics" width="600px" append-to-body>
       <el-card>
         <el-row :gutter="20">
@@ -214,19 +211,18 @@ export default {
       showSearch: true,
       total: 0,
       articleList: [],
+      tenantSelectorKey: 0,
       statistics: {
         totalCount: 0,
         pendingCount: 0,
         approvedCount: 0,
         rejectedCount: 0
       },
-      // 状态选项
       statusOptions: [
         { value: 0, label: '待审计' },
         { value: 1, label: '已通过' },
         { value: 2, label: '已拒绝' }
       ],
-      // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
@@ -234,10 +230,8 @@ export default {
         articleTitle: null,
         status: null
       },
-      // 详情弹窗
       viewOpen: false,
       viewForm: {},
-      // 审计弹窗
       auditOpen: false,
       auditTitle: '',
       auditForm: {
@@ -245,7 +239,6 @@ export default {
         status: null,
         auditRemark: ''
       },
-      // 统计弹窗
       showStatistics: false
     }
   },
@@ -267,7 +260,6 @@ export default {
         this.loading = false
       })
     },
-    /** 查询待审计列表 */
     handlePending() {
       this.loading = true
       listPendingArticles().then(response => {
@@ -276,7 +268,6 @@ export default {
         this.loading = false
       })
     },
-    /** 搜索按钮操作 */
     handleQuery() {
       if (!this.queryParams.tenantId) {
         this.$message.warning('请先选择租户')
@@ -286,22 +277,25 @@ export default {
       this.getList()
     },
     handleTenantChange(val) {
-      this.queryParams.tenantId = val || null
-      this.handleQuery()
+      if (val) {
+        this.queryParams.tenantId = val
+        this.handleQuery()
+      }
     },
     resetQuery() {
       this.resetForm('queryForm')
+      this.articleList = []
+      this.total = 0
       this.queryParams.tenantId = null
-      this.handleQuery()
+      this.$store.dispatch('tenant/setTenantId', null)
+      this.tenantSelectorKey++
     },
-    /** 查看详情 */
     handleView(row) {
       getArticleInfo(row.articleId).then(response => {
         this.viewForm = response.data
         this.viewOpen = true
       })
     },
-    /** 审计文章 */
     handleAudit(row, status) {
       this.auditTitle = status === 1 ? '通过文章' : '拒绝文章'
       this.auditForm = {
@@ -311,7 +305,6 @@ export default {
       }
       this.auditOpen = true
     },
-    /** 提交审计 */
     submitAudit() {
       auditArticle(this.auditForm.articleId, this.auditForm.status, this.auditForm.auditRemark).then(response => {
         this.$message.success(this.auditForm.status === 1 ? '通过成功' : '拒绝成功')
@@ -319,7 +312,6 @@ export default {
         this.getList()
       })
     },
-    /** 删除文章 */
     handleDelete(row) {
       this.$confirm('确定删除文章 [' + row.articleTitle + '] 吗?', '提示', {
         confirmButtonText: '确定',
@@ -332,14 +324,12 @@ export default {
         })
       })
     },
-    /** 查看统计 */
     showStatisticsDialog() {
       getArticleStatistics().then(response => {
         this.statistics = response.data
         this.showStatistics = true
       })
     },
-    /** 导出按钒操作 */
     handleExport() {
       this.exportLoading = true
       exportAllArticles(this.queryParams).then(response => {
@@ -367,8 +357,8 @@ export default {
   display: block;
   margin-top: 5px;
   font-size: 14px;
-  color: #666;
+  color: #606266;
 }
 .mb16 { margin-bottom: 16px; }
 .filter-card { padding-bottom: 0; }
-</style>
+</style>