疯狂的狮子li
2021-10-20 82f1f5d0cf1b51a5d81915e842e01760f404fa74
ruoyi-ui/src/views/system/oss/config.vue
@@ -23,10 +23,10 @@
      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
          <el-option
            v-for="dict in statusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
            v-for="dict in dict.type.sys_normal_disable"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
@@ -118,7 +118,7 @@
      @pagination="getList"
    />
    <!-- 添加或修改云存储配置对话框 -->
    <!-- 添加或修改对象存储配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="配置key" prop="configKey">
@@ -138,7 +138,7 @@
          <el-input v-model="form.accessKey" placeholder="请输入accessKey" />
        </el-form-item>
        <el-form-item label="secretKey" prop="secretKey">
          <el-input v-model="form.secretKey" placeholder="请输入秘钥" />
          <el-input v-model="form.secretKey" placeholder="请输入秘钥" show-password />
        </el-form-item>
        <el-form-item label="桶名称" prop="bucketName">
          <el-input v-model="form.bucketName" placeholder="请输入桶名称" />
@@ -149,23 +149,14 @@
        <el-form-item label="是否HTTPS">
          <el-radio-group v-model="form.isHttps">
            <el-radio
              v-for="dict in isHttpsOptions"
              :key="dict.dictValue"
              :label="dict.dictValue"
            >{{dict.dictLabel}}</el-radio>
              v-for="dict in dict.type.sys_yes_no"
              :key="dict.value"
              :label="dict.value"
            >{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="域" prop="region">
          <el-input v-model="form.region" placeholder="请输入域" />
        </el-form-item>
        <el-form-item label="状态">
          <el-radio-group v-model="form.status">
            <el-radio
              v-for="dict in statusOptions"
              :key="dict.dictValue"
              :label="dict.dictValue"
            >{{dict.dictLabel}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
@@ -192,6 +183,7 @@
export default {
  name: "OssConfig",
  dicts: ['sys_yes_no', 'sys_normal_disable'],
  data() {
    return {
      // 按钮loading
@@ -210,7 +202,7 @@
      showSearch: true,
      // 总条数
      total: 0,
      // 云存储配置表格数据
      // 对象存储配置表格数据
      ossConfigList: [],
      // configKeyOptions
      configKeyOptions: [],
@@ -284,16 +276,10 @@
  },
  created() {
    this.getList();
    this.getDicts("sys_yes_no").then(response => {
      this.isHttpsOptions = response.data;
    });
    this.getDicts("sys_normal_disable").then(response => {
      this.statusOptions = response.data;
    });
    this.configKeyOptions = this.configKeyDatas;
  },
  methods: {
    /** 查询云存储配置列表 */
    /** 查询对象存储配置列表 */
    getList() {
      this.loading = true;
      listOssConfig(this.queryParams).then((response) => {
@@ -344,7 +330,7 @@
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加云存储配置";
      this.title = "添加对象存储配置";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
@@ -355,7 +341,7 @@
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改云存储配置";
        this.title = "修改对象存储配置";
      });
    },
    /** 提交按钮 */
@@ -365,7 +351,7 @@
          this.buttonLoading = true;
          if (this.form.ossConfigId != null) {
            updateOssConfig(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
@@ -373,7 +359,7 @@
            });
          } else {
            addOssConfig(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
@@ -386,34 +372,25 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      const ossConfigIds = row.ossConfigId || this.ids;
      this.$confirm('是否确认删除云存储配置编号为"' + ossConfigIds + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
      this.$modal.confirm('是否确认删除对象存储配置编号为"' + ossConfigIds + '"的数据项?').then(() => {
        this.loading = true;
        return delOssConfig(ossConfigIds);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.msgSuccess("删除成功");
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    // 云存储配置状态修改
    // 对象存储配置状态修改
    handleStatusChange(row) {
      let text = row.status === "0" ? "启用" : "停用";
      this.$confirm(
        '确认要"' + text + '""' + row.configKey + '"配置吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
      }).then(() => {
      this.$modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?').then(() => {
        return changeOssConfigStatus(row.ossConfigId, row.status, row.configKey);
      }).then(() => {
        this.getList()
        this.msgSuccess(text + "成功");
        this.$modal.msgSuccess(text + "成功");
      }).catch(() => {
        row.status = row.status === "0" ? "1" : "0";
      })