| | |
| | | <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-click="rowClick" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad"> |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crud" |
| | | @row-click="rowClick" |
| | | @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"--> |
| | |
| | | <!-- </el-button>--> |
| | | </template> |
| | | <template slot-scope="scope" slot="menu"> |
| | | <el-button type="text" |
| | | icon="el-icon-download" |
| | | size="small" |
| | | @click="handleDownload(scope.row)">下载 |
| | | <el-button |
| | | type="text" |
| | | icon="el-icon-download" |
| | | size="small" |
| | | @click="handleDownload(scope.row)" |
| | | >下载 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" |
| | | slot="attachSize"> |
| | | <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"> |
| | | <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"; |
| | | import ElImageViewer from 'element-ui/packages/image/src/image-viewer' |
| | | import { getList, getDetail, remove } from "@/api/resource/attach"; |
| | | import { mapGetters } from "vuex"; |
| | | import ElImageViewer from "element-ui/packages/image/src/image-viewer"; |
| | | |
| | | export default { |
| | | components: { ElImageViewer }, |
| | |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | imgUrl: '', |
| | | imgUrl: "", |
| | | showViewer: false, // 显示查看器 |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | total: 0, |
| | | }, |
| | | attachBox: false, |
| | | selectionList: [], |
| | | option: { |
| | | height: 'auto', |
| | | height: "auto", |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | headerAlign: 'center', |
| | | searchShowBtn: false, |
| | | headerAlign: "center", |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | |
| | | { |
| | | label: "附件地址", |
| | | prop: "link", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入附件地址", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入附件地址", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "附件域名", |
| | | prop: "domain", |
| | | search: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入附件域名", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入附件域名", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "附件名称", |
| | | prop: "name", |
| | | search: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入附件名称", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入附件名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "附件原名", |
| | | prop: "originalName", |
| | | search: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入附件原名", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入附件原名", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "附件拓展名", |
| | | prop: "extension", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入附件拓展名", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入附件拓展名", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "附件大小", |
| | | prop: "attachSize", |
| | | slot: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入附件大小", |
| | | trigger: "blur" |
| | | }] |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入附件大小", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "所属机构", |
| | |
| | | dicUrl: "/api/blade-system/dept/selectIn", |
| | | props: { |
| | | label: "deptname", |
| | | value: "deptid" |
| | | value: "deptid", |
| | | }, |
| | | }, |
| | | { |
| | |
| | | dicData: [ |
| | | { |
| | | label: "许可审批", |
| | | value: '0' |
| | | value: "0", |
| | | }, |
| | | { |
| | | label: "备案", |
| | | value: '1' |
| | | value: "1", |
| | | }, |
| | | { |
| | | label: "撤销", |
| | | value: '2' |
| | | value: "2", |
| | | }, |
| | | { |
| | | label: "跨区备案", |
| | | value: '3' |
| | | } |
| | | value: "3", |
| | | }, |
| | | ], |
| | | }, |
| | | ] |
| | | ], |
| | | }, |
| | | data: [], |
| | | attachForm: {}, |
| | |
| | | emptyBtn: false, |
| | | column: [ |
| | | { |
| | | label: '附件上传', |
| | | prop: 'attachFile', |
| | | type: 'upload', |
| | | label: "附件上传", |
| | | prop: "attachFile", |
| | | type: "upload", |
| | | drag: true, |
| | | loadText: '模板上传中,请稍等', |
| | | loadText: "模板上传中,请稍等", |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | res: "data", |
| | | }, |
| | | action: "/api/blade-resource/oss/endpoint/put-file-attach?deptid=" |
| | | } |
| | | ] |
| | | } |
| | | action: "/api/blade-resource/oss/endpoint/put-file-attach?deptid=", |
| | | }, |
| | | ], |
| | | }, |
| | | }; |
| | | }, |
| | | created() { |
| | | var flag = false, i = 0, ind = null |
| | | var flag = false, |
| | | i = 0, |
| | | ind = null; |
| | | this.$store.state.tags.tagList.forEach((item, index) => { |
| | | if (item.label == "附件上传") { |
| | | if (flag == false) { |
| | | ind = index |
| | | flag = true |
| | | ind = index; |
| | | flag = true; |
| | | } |
| | | i++ |
| | | i++; |
| | | } |
| | | }) |
| | | }); |
| | | if (i > 1) { |
| | | this.$store.state.tags.tagList.splice(ind, 1) |
| | | |
| | | this.$store.state.tags.tagList.splice(ind, 1); |
| | | } |
| | | var deptid = this.$route.query.deptid; |
| | | var type = this.$route.query.type; |
| | | this.attachOption.column[0].action += deptid + "&type=" + type |
| | | this.attachOption.column[0].action += deptid + "&type=" + type; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | |
| | | addBtn: false, |
| | | editBtn: false, |
| | | viewBtn: false, |
| | | delBtn: this.vaildData(this.permission.attach_delete, false) |
| | | delBtn: this.vaildData(this.permission.attach_delete, false), |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | rowClick(row) { |
| | | var that = this; |
| | | that.imgUrl = row.link |
| | | this.showViewer = true |
| | | that.imgUrl = row.link; |
| | | this.showViewer = true; |
| | | }, |
| | | handleUpload() { |
| | | this.attachBox = true; |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | message: "操作成功!", |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | |
| | | 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; |
| | | }); |
| | | } |
| | |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.$route.query.deptid, this.$route.query.type).then(res => { |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query), |
| | | this.$route.query.deptid, |
| | | this.$route.query.type |
| | | ).then((res) => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |