疯狂的狮子li
2021-08-13 824635df7f95b68ff493b904071e6c053fad9f9b
ruoyi-ui/src/views/system/oss/index.vue
@@ -96,7 +96,16 @@
          v-hasPermi="['system:oss:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-s-operation"
          size="mini"
          @click="handleOssConfig"
          v-hasPermi="['system:oss:list']"
        >配置管理</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
@@ -106,13 +115,15 @@
      <el-table-column label="文件名" align="center" prop="fileName" />
      <el-table-column label="原名" align="center" prop="originalName" />
      <el-table-column label="文件后缀" align="center" prop="fileSuffix" />
      <el-table-column label="文件展示" align="center" prop="url" >
        <template slot-scope="scope" v-if="previewListResource">
      <el-table-column label="文件展示" align="center" prop="url">
        <template slot-scope="scope">
          <el-image
            v-if="scope.row.fileSuffix.indexOf('png','jpg','jpeg') > 0"
            v-if="previewListResource && checkFileSuffix(scope.row.fileSuffix)"
            style="width: 100px; height: 100px;"
            :src="scope.row.url"
            :preview-src-list="[scope.row.url]"/>
          <span v-text="scope.row.url"
                v-if="!checkFileSuffix(scope.row.fileSuffix) || !previewListResource"/>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -168,9 +179,7 @@
<script>
import { listOss, delOss } from "@/api/system/oss";
import { downLoadOss } from "@/utils/ossdownload";
import { updateConfig } from "@/api/system/config";
import { downLoadOss } from "@/utils/download";
export default {
  name: "Oss",
@@ -239,12 +248,18 @@
        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
      }
      this.getConfigKey("sys.oss.previewListResource").then(response => {
        this.previewListResource = response.msg;
        this.previewListResource = response.msg === undefined ? true : response.msg === 'true';
      });
      listOss(this.queryParams).then(response => {
        this.ossList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    checkFileSuffix(fileSuffix) {
      let arr = ["png", "jpg", "jpeg"];
      return arr.some(type => {
        return fileSuffix.indexOf(type) > -1;
      });
    },
    // 取消按钮
@@ -276,6 +291,10 @@
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 任务日志列表查询 */
    handleOssConfig() {
      this.$router.push({ path: '/system/oss-config/index'})
    },
    /** 文件按钮操作 */
    handleFile() {
      this.reset();