From 16f6364152f854f7dc9438c9bd88c63a03fd5f2d Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 20 七月 2023 16:09:15 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs
---
Source/UBCS-WEB/dist/src/views/resource/attach.vue | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 288 insertions(+), 0 deletions(-)
diff --git a/Source/UBCS-WEB/dist/src/views/resource/attach.vue b/Source/UBCS-WEB/dist/src/views/resource/attach.vue
new file mode 100644
index 0000000..a0b1b7c
--- /dev/null
+++ b/Source/UBCS-WEB/dist/src/views/resource/attach.vue
@@ -0,0 +1,288 @@
+<template>
+ <basic-container>
+ <avue-crud :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad">
+ <template slot="menuLeft">
+ <el-button type="primary"
+ size="small"
+ plain
+ v-if="permission.attach_upload"
+ icon="el-icon-upload2"
+ @click="handleUpload">涓� 浼�
+ </el-button>
+ <el-button type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.attach_delete"
+ @click="handleDelete">鍒� 闄�
+ </el-button>
+ </template>
+ <template slot-scope="scope" slot="menu">
+ <el-button type="text"
+ icon="el-icon-download"
+ size="small"
+ v-if="permission.attach_download"
+ @click="handleDownload(scope.row)">涓嬭浇
+ </el-button>
+ </template>
+ <template slot-scope="{row}"
+ slot="attachSize">
+ <el-tag>{{`${row.attachSize} KB`}}</el-tag>
+ </template>
+ </avue-crud>
+ <el-dialog title="闄勪欢绠$悊"
+ append-to-body
+ :visible.sync="attachBox"
+ width="555px">
+ <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-after="uploadAfter">
+ </avue-form>
+ </el-dialog>
+ </basic-container>
+</template>
+
+<script>
+ import {getList, getDetail, remove} from "@/api/resource/attach";
+ import {mapGetters} from "vuex";
+
+ export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ attachBox: false,
+ selectionList: [],
+ option: {
+ height: 'auto',
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "闄勪欢鍦板潃",
+ prop: "link",
+ rules: [{
+ required: true,
+ message: "璇疯緭鍏ラ檮浠跺湴鍧�",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "闄勪欢鍩熷悕",
+ prop: "domainUrl",
+ search: true,
+ rules: [{
+ required: true,
+ message: "璇疯緭鍏ラ檮浠跺煙鍚�",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "闄勪欢鍚嶇О",
+ prop: "name",
+ search: true,
+ rules: [{
+ required: true,
+ message: "璇疯緭鍏ラ檮浠跺悕绉�",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "闄勪欢鍘熷悕",
+ prop: "originalName",
+ search: true,
+ rules: [{
+ required: true,
+ message: "璇疯緭鍏ラ檮浠跺師鍚�",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "闄勪欢鎷撳睍鍚�",
+ prop: "extension",
+ rules: [{
+ required: true,
+ message: "璇疯緭鍏ラ檮浠舵嫇灞曞悕",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "闄勪欢澶у皬",
+ prop: "attachSize",
+ slot: true,
+ rules: [{
+ required: true,
+ message: "璇疯緭鍏ラ檮浠跺ぇ灏�",
+ trigger: "blur"
+ }]
+ },
+ ]
+ },
+ data: [],
+ attachForm: {},
+ attachOption: {
+ submitBtn: false,
+ emptyBtn: false,
+ column: [
+ {
+ label: '闄勪欢涓婁紶',
+ prop: 'attachFile',
+ type: 'upload',
+ drag: true,
+ loadText: '妯℃澘涓婁紶涓紝璇风◢绛�',
+ span: 24,
+ propsHttp: {
+ res: 'data'
+ },
+ action: "/api/ubcs-resource/oss/endpoint/put-file-attach"
+ }
+ ]
+ }
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: false,
+ editBtn: false,
+ viewBtn: false,
+ delBtn: this.vaildData(this.permission.attach_delete, false)
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ }
+ },
+ methods: {
+ handleUpload() {
+ this.attachBox = true;
+ },
+ uploadAfter(res, done, loading, column) {
+ window.console.log(column);
+ this.attachBox = false;
+ this.refreshChange();
+ done();
+ },
+ handleDownload(row) {
+ window.open(`${row.link}`);
+ },
+ rowDel(row) {
+ this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ });
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return;
+ }
+ this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(this.ids);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then(res => {
+ this.form = res.data.data;
+ });
+ }
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ }
+ }
+ };
+</script>
+
+<style>
+</style>
--
Gitblit v1.9.3