From c892580371ef4679c858e2da98f71a9345aa3d80 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 08 十二月 2023 10:37:20 +0800
Subject: [PATCH] 代码提交
---
Source/UBCS-WEB/src/components/file/main.vue | 107 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 69 insertions(+), 38 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/file/main.vue b/Source/UBCS-WEB/src/components/file/main.vue
index 7a9ba08..8444c92 100644
--- a/Source/UBCS-WEB/src/components/file/main.vue
+++ b/Source/UBCS-WEB/src/components/file/main.vue
@@ -1,21 +1,22 @@
<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"
@@ -63,17 +64,18 @@
<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,
@@ -86,10 +88,10 @@
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:'400'),
calcHeight: 30,
tip: false,
- searchShow: true,
+ searchShow: false,
searchMenuSpan: 6,
border: true,
index: true,
@@ -188,6 +190,7 @@
prop: 'attachFile',
type: 'upload',
dragFile: true,
+ showFileList:false,
accept: this.options.uploadAccept || 'file',
loadText: '鏂囦欢涓婁紶涓紝璇风◢绛�',
span: 24,
@@ -196,7 +199,7 @@
},
data: {
ownbizOid:this.options.ownbizOid || "share",
- ownBtmname:this.options.ownbizBtm || "share",
+ ownBtmName:this.options.ownbizBtm || "share",
fileDocClassify:this.options.fileDocClassify || "ADMIN_SHARE",
fileDocClassifyName:this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
},
@@ -230,6 +233,12 @@
},
mounted() {
+ },
+ watch:{
+ ownbizOid(val){
+ this.setParams()
+ this.refreshChange()
+ }
},
methods: {
setFormItem(){
@@ -311,10 +320,10 @@
setParams() {
var queryMap = {
currentButtonKey: 'VIEW',
- ownbizOid: this.options.ownbizOid,
- ownbizBtm: this.options.ownbizBtm,
- fileDocClassify: this.options.fileDocClassify,
- fileDocClassifyName: this.options.fileDocClassifyName
+ ownbizOid: this.options.ownbizOid || "share",
+ ownBtmName: this.options.ownbizBtm || "share",
+ fileDocClassify: this.options.fileDocClassify || "ADMIN_SHARE",
+ fileDocClassifyName: this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
};
if (this.options.where) {
Object.assign(queryMap, this.options.where);
@@ -329,6 +338,12 @@
}
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='';
@@ -353,29 +368,36 @@
done();
},
uploadAfter(res, done, loading, column) {
- if(res.success){
- this.attachBox = false;
- this.$message.success('鏂囦欢涓婁紶鎴愬姛')
- }else{
- this.$message.error(res.msg);
- }
+ this.attachBox = false;
+ this.$message.success('鏂囦欢涓婁紶鎴愬姛')
this.refreshChange();
done();
},
uploadError(error, column) {
- this.$message.error('涓婁紶鏂囦欢鍑虹幇浜嗗紓甯�')
+ this.$message.error(error || '涓婁紶鏂囦欢鍑虹幇浜嗗紓甯�')
},
handleDownload(row) {
//window.open(`${row.link}`);
+ let data=new FormData();
if(row && row.oid){
- download(row.oid)
+ data.append('fileOids',row.oid)
+ this.downloadFile(data);
}else{
if (this.selectionList.length === 0) {
this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
return;
}
- download(this.oids);
+ data.append('fileOids',this.oids)
+ this.downloadFile(data);
}
+ },
+ downloadFile(data){
+ download(data).then(res=>{
+ // console.log(res);
+ if(res){
+ func.downloadFileByBlobHandler(res);
+ }
+ });
},
rowDel(row) {
this.$confirm("纭畾灏嗛�夋嫨鏂囦欢鍒犻櫎?", {
@@ -384,7 +406,7 @@
type: "warning"
})
.then(() => {
- return remove(row.oid);
+ return remove([row.oid]);
})
.then(() => {
this.onLoad(this.page);
@@ -405,7 +427,7 @@
type: "warning"
})
.then(() => {
- return remove(this.oids);
+ return remove(this.oids.split(','));
})
.then(() => {
this.onLoad(this.page);
@@ -436,6 +458,13 @@
},
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 = [];
@@ -448,7 +477,7 @@
this.page.pageSize = pageSize;
},
refreshChange() {
- this.onLoad(this.page, this.query);
+ this.onLoad(this.page);
},
onLoad(page, params={}) {
this.loading = true;
@@ -461,7 +490,7 @@
getList(page.currentPage, page.pageSize, Object.assign(params,this.params, query,this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
- if(data && data.records.length>0 && this.options.fileDocClassifyCombox){
+ if(this.options.fileDocClassifyCombox){
this.data = data.records.map(item => {
if(validatenull(item.fileDocClassifyName)&& !validatenull(item.fileDocClassify)){
item.fileDocClassifyName = this.options.fileDocClassifyCombox[item.fileDocClassify] || '';
@@ -470,8 +499,10 @@
...item
}
})
+ }else{
+ this.data = data.records;
}
- //this.data = data.records;
+
this.loading = false;
this.selectionClear();
}).catch(error=>{
--
Gitblit v1.9.3