疯狂的狮子li
2021-09-13 2af534eea471f4adb104906c7a814bcc66d4d68d
ruoyi-ui/src/views/system/oss/index.vue
@@ -98,6 +98,15 @@
      </el-col>
      <el-col :span="1.5">
        <el-button
          :type="previewListResource ? 'danger' : 'warning'"
          plain
          size="mini"
          @click="handlePreviewListResource(!previewListResource)"
          v-hasPermi="['system:oss:edit']"
        >预览开关 : {{previewListResource ? "禁用" : "启用"}}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-s-operation"
@@ -111,7 +120,7 @@
    <el-table v-loading="loading" :data="ossList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="云存储主键" align="center" prop="ossId" v-if="false"/>
      <el-table-column label="对象存储主键" align="center" prop="ossId" v-if="false"/>
      <el-table-column label="文件名" align="center" prop="fileName" />
      <el-table-column label="原名" align="center" prop="originalName" />
      <el-table-column label="文件后缀" align="center" prop="fileSuffix" />
@@ -161,7 +170,7 @@
      @pagination="getList"
    />
    <!-- 添加或修改OSS云存储对话框 -->
    <!-- 添加或修改OSS对象存储对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="文件名">
@@ -178,7 +187,7 @@
</template>
<script>
import { listOss, delOss } from "@/api/system/oss";
import { listOss, delOss, changePreviewListResource } from "@/api/system/oss";
import { downLoadOss } from "@/utils/download";
export default {
@@ -201,7 +210,7 @@
      showSearch: true,
      // 总条数
      total: 0,
      // OSS云存储表格数据
      // OSS对象存储表格数据
      ossList: [],
      // 弹出层标题
      title: "",
@@ -239,7 +248,7 @@
    this.getList();
  },
  methods: {
    /** 查询OSS云存储列表 */
    /** 查询OSS对象存储列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
@@ -321,18 +330,37 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      const ossIds = row.ossId || this.ids;
      this.$confirm('是否确认删除OSS云存储编号为"' + ossIds + '"的数据项?', "警告", {
      this.$confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.loading = true;
          return delOss(ossIds);
        }).then(() => {
          this.loading = false;
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {});
      }).then(() => {
        this.loading = true;
        return delOss(ossIds);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    // 预览列表图片状态修改
    handlePreviewListResource(previewListResource) {
      let text = previewListResource ? "启用" : "停用";
      this.$confirm(
        '确认要"' + text + '""预览列表图片"配置吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
      }).then(() => {
        return changePreviewListResource(previewListResource);
      }).then(() => {
        this.getList()
        this.msgSuccess(text + "成功");
      }).catch(() => {
        this.previewListResource = previewListResource !== true;
      })
    }
  }
};