| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :before-open="beforeOpen" |
| | | :permission="permissionList" |
| | | 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"> |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :before-open="beforeOpen" |
| | | :permission="permissionList" |
| | | v-model="form" |
| | | ref="crud" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @row-click="selectedRowClick" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad"> |
| | | <template slot="menuLeft"> |
| | | <el-button v-if="hasUpload" type="primary" |
| | | size="small" |
| | |
| | | <script> |
| | | import {getList, getFile,upload,update, remove,download} from "@/api/resource/file"; |
| | | import {mapGetters} from "vuex"; |
| | | import {dateFormat} from "@/util/date"; |
| | | import {validatenull} from "@/util/validate"; |
| | | import func from "@/util/func"; |
| | | |
| | | export default { |
| | | props: ["options","visible"], |
| | | props: ["options","visible","ownbizOid"], |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | params:{}, |
| | | loading: false, |
| | | hasPage:this.options.hasPage||false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | hasDel:validatenull(this.options.hasDel) ? true :this.options.hasDel, |
| | | hasDownload:validatenull(this.options.hasDownload) ? true :this.options.hasDownload, |
| | | option: { |
| | | height:(this.options.tableHeight?this.options.tableHeight:'auto'), |
| | | height:(this.options.tableHeight?this.options.tableHeight:'300'), |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchShow: false, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | |
| | | mounted() { |
| | | |
| | | }, |
| | | watch:{ |
| | | ownbizOid(val){ |
| | | this.setParams() |
| | | this.refreshChange() |
| | | } |
| | | }, |
| | | methods: { |
| | | setFormItem(){ |
| | | /*this.options.formItems=[{ |
| | |
| | | setParams() { |
| | | var queryMap = { |
| | | currentButtonKey: 'VIEW', |
| | | ownbizOid:this.options.ownbizOid || "share", |
| | | ownBtmName:this.options.ownbizBtm || "share", |
| | | fileDocClassify: this.options.fileDocClassify|| "ADMIN_SHARE", |
| | | ownbizOid: this.options.ownbizOid || "share", |
| | | ownBtmName: this.options.ownbizBtm || "share", |
| | | fileDocClassify: this.options.fileDocClassify || "ADMIN_SHARE", |
| | | fileDocClassifyName: this.options.fileDocClassifyName || "管理员共享文件" |
| | | }; |
| | | if (this.options.where) { |
| | |
| | | } |
| | | this.page.pageSize = this.options.pageObject.limit; |
| | | this.page.currentPage = this.options.pageObject.page; |
| | | |
| | | this.attachOption.column[1].data.ownbizOid = this.options.ownbizOid || "share"; |
| | | this.attachOption.column[1].data.ownBtmName = this.options.ownbizBtm || "share"; |
| | | this.attachOption.column[1].data.fileDocClassify = this.options.fileDocClassify || "ADMIN_SHARE"; |
| | | this.attachOption.column[1].data.fileDocClassifyName = this.options.fileDocClassifyName || "管理员共享文件" |
| | | |
| | | }, |
| | | handleUpload() { |
| | | this.attachOption.column[1].data.fileOid=''; |
| | |
| | | let data=new FormData(); |
| | | if(row && row.oid){ |
| | | data.append('fileOids',row.oid) |
| | | download(data) |
| | | this.downloadFile(data); |
| | | }else{ |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据");x |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | data.append('fileOids',this.oids) |
| | | download(data); |
| | | this.downloadFile(data); |
| | | } |
| | | }, |
| | | downloadFile(data){ |
| | | download(data).then(res=>{ |
| | | // console.log(res); |
| | | if(res){ |
| | | func.downloadFileByBlobHandler(res); |
| | | } |
| | | }); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择文件删除?", { |
| | |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | this.$refs.crud.setCurrentRow(this.selectionList[list.length-1]); |
| | | }, |
| | | selectedRowClick(row){ |
| | | this.selectionList = row; |
| | | this.$refs.crud.toggleSelection(); |
| | | this.$refs.crud.setCurrentRow(row); |
| | | this.$refs.crud.toggleRowSelection(row); //选中当前行 |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | this.onLoad(this.page); |
| | | }, |
| | | onLoad(page, params={}) { |
| | | this.loading = true; |