喻文俊 3 éve
szülő
commit
42f874edbf
1 módosított fájl, 71 hozzáadás és 40 törlés
  1. 71 40
      src/views/authentic/doc/fileList.vue

+ 71 - 40
src/views/authentic/doc/fileList.vue

@@ -39,7 +39,12 @@
         <el-option label="未上线" :value="0" />
       </el-select>
       <el-button type="primary" icon="el-icon-search" @click="getList">查询</el-button>
-      <el-button v-if="userIdentity === 2 || proxyInfo!==null" icon="el-icon-edit" type="primary" @click="handleShowDialog('add')">添加文件</el-button>
+      <el-button
+        v-if="userIdentity === 2 || proxyInfo !== null"
+        icon="el-icon-edit"
+        type="primary"
+        @click="handleShowDialog('add')"
+      >添加文件</el-button>
     </div>
     <!-- 搜索区域END -->
     <!-- 表格区域 -->
@@ -61,13 +66,7 @@
           <!-- 未通过原因展示 -->
           <template v-if="row.auditStatus === 0">
             <!-- <span class="status danger">审核未通过&nbsp;</span> -->
-            <el-popover
-              placement="top-start"
-              title="审核说明"
-              width="400"
-              trigger="hover"
-              :content="row.invalidReason"
-            >
+            <el-popover placement="top-start" title="审核说明" width="400" trigger="hover" :content="row.invalidReason">
               <el-tag slot="reference" size="small" type="danger" class="reason">
                 <span>审核未通过</span>
                 <span class="el-icon-question status danger " />
@@ -78,16 +77,27 @@
         </template>
       </el-table-column>
       <el-table-column label="上线状态" width="180px" align="center">
-        <template slot-scope="{row}">
+        <template slot-scope="{ row }">
           <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
           <template v-if="row.auditStatus === 1">
             <template v-if="row.status === 0">
               <span style="margin-right:10px;" class="status danger">已下线</span>
-              <el-button v-if="userIdentity===2 || proxyInfo!==null" type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+              <el-button
+                v-if="userIdentity === 2 || proxyInfo !== null"
+                type="primary"
+                size="mini"
+                @click="handleChangeStatus(row)"
+              >上线</el-button>
             </template>
             <template v-else>
               <span style="margin-right:10px;" class="status success ">已上线</span>
-              <el-button v-if="userIdentity===2 || proxyInfo!==null" type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+              <el-button
+                v-if="userIdentity === 2 || proxyInfo !== null"
+                type="info"
+                size="mini"
+                plain
+                @click="handleChangeStatus(row)"
+              >下线</el-button>
             </template>
           </template>
           <template v-else>
@@ -97,19 +107,37 @@
         </template>
       </el-table-column>
       <el-table-column label="创建时间" width="240px" align="center">
-        <template slot-scope="{row}">
+        <template slot-scope="{ row }">
           {{ row.createTime | formatTime }}
         </template>
       </el-table-column>
       <el-table-column label="操作" width="240px" align="center">
-        <template slot-scope="{row}">
-          <el-button type="primary" size="mini" style="margin-right:5px" icon="el-icon-edit" @click="handleShowDialog('edit',row)">编辑</el-button>
-          <el-button type="danger" size="mini" style="margin-right:5px" icon="el-icon-s-check" @click="handleRemoveFile(row)">删除</el-button>
+        <template slot-scope="{ row }">
+          <el-button
+            type="primary"
+            size="mini"
+            style="margin-right:5px"
+            icon="el-icon-edit"
+            @click="handleShowDialog('edit', row)"
+          >编辑</el-button>
+          <el-button
+            type="danger"
+            size="mini"
+            style="margin-right:5px"
+            icon="el-icon-s-check"
+            @click="handleRemoveFile(row)"
+          >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
     <!-- 表格区域END -->
-    <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList(listQuery)" />
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="getList(listQuery)"
+    />
     <!-- 视频预览对话框 -->
     <el-dialog
       :title="dialogTitle"
@@ -130,7 +158,7 @@
             <el-upload
               ref="uploadFileRef"
               accept=".pdf"
-              :class="{hidden:hasFile}"
+              :class="{ hidden: hasFile }"
               :auto-upload="false"
               :headers="headers"
               :action="action"
@@ -249,10 +277,10 @@ export default {
       }
       // 对标题字段进行规则校验
       console.log(this.dialogData)
-      this.$refs.formRef.validateField('fileTitle', (error) => {
+      this.$refs.formRef.validateField('fileTitle', error => {
         if (!error) {
-          this.submitLoading = true;
-          (this.hasFile && !this.chooseNewFile) ? this.save() : this.$refs.uploadFileRef.submit()
+          this.submitLoading = true
+          this.hasFile && !this.chooseNewFile ? this.save() : this.$refs.uploadFileRef.submit()
         }
       })
     },
@@ -278,7 +306,8 @@ export default {
               message: res.data,
               duration: 500
             })
-          }).finally(() => {
+          })
+          .finally(() => {
             this.submitLoading = false
           })
       })
@@ -293,12 +322,11 @@ export default {
         this.$message.info('已取消操作')
       })
       if (text !== 'confirm') return
-      removeFile({ fileId: row.fileId })
-        .then(res => {
-          if (res.code !== 0) return
-          this.$message.success(res.data)
-          this.getList()
-        })
+      removeFile({ fileId: row.fileId }).then(res => {
+        if (res.code !== 0) return
+        this.$message.success(res.data)
+        this.getList()
+      })
     },
     // 显示dialog对话框
     handleShowDialog(type, row) {
@@ -393,19 +421,22 @@ export default {
         fileId: item.fileId,
         status: item.status === 1 ? 0 : 1
       }
-      changeFileStatus(params).then(res => {
-        // this.$message.success(res.data)
-        this.$message({
-          message: res.data,
-          duration: 500,
-          type: 'success'
+      changeFileStatus(params)
+        .then(res => {
+          // this.$message.success(res.data)
+          this.$message({
+            message: res.data,
+            duration: 500,
+            type: 'success'
+          })
+          this.getList()
+        })
+        .catch(err => {
+          console.log(err)
+        })
+        .finally(() => {
+          this.listLoading = false
         })
-        this.getList()
-      }).catch(err => {
-        console.log(err)
-      }).finally(() => {
-        this.listLoading = false
-      })
     },
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
@@ -436,7 +467,7 @@ export default {
 .el-table .cell {
   overflow: visible;
 }
-.el-badge{
+.el-badge {
   margin: 0 6px;
 }
 </style>