src/views/resource/oss.vue
@@ -2,10 +2,12 @@
  <basic-container
    :class="[
      'hasButOne',
      $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :option="option"
      :table-loading="loading"
      :data="data"
@@ -84,7 +86,7 @@
  add,
  update,
  remove,
  enable,
  enable
} from "@/api/resource/oss";
import { mapGetters } from "vuex";
import func from "@/util/func";
@@ -100,7 +102,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      selectionList: [],
      option: {
@@ -130,7 +132,7 @@
            dicUrl: "/api/blade-system/dict/dictionary?code=oss",
            props: {
              label: "dictValue",
              value: "dictKey",
              value: "dictKey"
            },
            dataType: "number",
            slot: true,
@@ -140,9 +142,9 @@
              {
                required: true,
                message: "请选择分类",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "资源编号",
@@ -154,9 +156,9 @@
              {
                required: true,
                message: "请输入资源编号",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "资源地址",
@@ -166,9 +168,9 @@
              {
                required: true,
                message: "请输入资源地址",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "空间名",
@@ -179,9 +181,9 @@
              {
                required: true,
                message: "请输入空间名",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "accessKey",
@@ -194,9 +196,9 @@
              {
                required: true,
                message: "请输入accessKey",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "secretKey",
@@ -208,23 +210,23 @@
              {
                required: true,
                message: "请输入secretKey",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "appId",
            prop: "appId",
            span: 24,
            hide: true,
            display: false,
            display: false
          },
          {
            label: "region",
            prop: "region",
            span: 24,
            hide: true,
            display: false,
            display: false
          },
          {
            label: "是否启用",
@@ -235,19 +237,19 @@
            slot: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            viewDisplay: false
          },
          {
            label: "备注",
            prop: "remark",
            span: 24,
            hide: true,
          },
        ],
            hide: true
          }
        ]
      },
      data: [],
      debugForm: {
        code: "",
        code: ""
      },
      debugOption: {
        submitText: "提交",
@@ -256,7 +258,7 @@
            label: "资源编号",
            prop: "code",
            disabled: true,
            span: 24,
            span: 24
          },
          {
            label: "上传背景",
@@ -266,18 +268,18 @@
            action: "/api/blade-resource/oss/endpoint/put-file",
            propsHttp: {
              res: "data",
              url: "link",
              url: "link"
            },
            span: 24,
          },
        ],
      },
            span: 24
          }
        ]
      }
    };
  },
  watch: {
    "form.category"() {
      const category = func.toInt(this.form.category);
      this.$refs.crud.option.column.filter((item) => {
      this.$refs.crud.option.column.filter(item => {
        if (item.prop === "appId") {
          item.display = category === 4;
        }
@@ -289,7 +291,7 @@
    "debugForm.code"() {
      const column = this.findObject(this.debugOption.column, "backgroundUrl");
      column.action = `/api/blade-resource/oss/endpoint/put-file?code=${this.debugForm.code}`;
    },
    }
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
@@ -298,16 +300,19 @@
        addBtn: this.vaildData(this.permission.oss_add),
        viewBtn: this.vaildData(this.permission.oss_view),
        delBtn: this.vaildData(this.permission.oss_delete),
        editBtn: this.vaildData(this.permission.oss_edit),
        editBtn: this.vaildData(this.permission.oss_edit)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    rowSave(row, done, loading) {
@@ -316,11 +321,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -332,11 +337,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -346,7 +351,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -355,7 +360,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -380,7 +385,7 @@
      this.$confirm("是否确定启用这条配置?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return enable(row.id);
@@ -389,7 +394,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
@@ -402,7 +407,7 @@
    handleSubmit(form, done) {
      this.$message({
        type: "success",
        message: `获取到图片地址:[${form.backgroundUrl}]`,
        message: `获取到图片地址:[${form.backgroundUrl}]`
      });
      done();
    },
@@ -414,7 +419,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -423,14 +428,14 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -451,14 +456,15 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.selectionClear();
      });
    },
  },
    }
  }
};
</script>