From a8e8ae3ba98dc0d843b5f59ff83a77a0e21d65b0 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期四, 03 八月 2023 18:15:18 +0800
Subject: [PATCH] 1、对模板升版版本值进行了修改
---
Source/UBCS-WEB/src/components/file/main.vue | 158 +++++++++++++++++++++++++++++++++++-----------------
1 files changed, 105 insertions(+), 53 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/file/main.vue b/Source/UBCS-WEB/src/components/file/main.vue
index d3a2da1..251148c 100644
--- a/Source/UBCS-WEB/src/components/file/main.vue
+++ b/Source/UBCS-WEB/src/components/file/main.vue
@@ -4,8 +4,8 @@
:table-loading="loading"
:data="data"
:page.sync="page"
- :permission="permissionList"
:before-open="beforeOpen"
+ :permission="permissionList"
v-model="form"
ref="crud"
@row-del="rowDel"
@@ -17,19 +17,25 @@
@refresh-change="refreshChange"
@on-load="onLoad">
<template slot="menuLeft">
- <el-button type="primary"
+ <el-button v-if="hasUpload" type="primary"
size="small"
plain
icon="el-icon-upload2"
@click="handleUpload">涓� 浼�
</el-button>
- <el-button type="primary"
+ <el-button v-if="hasEdit" type="primary"
size="small"
plain
icon="el-icon-edit"
@click="handleEdit">淇� 鏀�
</el-button>
- <el-button type="danger"
+ <el-button v-if="hasDownload" type="primary"
+ size="small"
+ icon="el-icon-download"
+ plain
+ @click="handleDownload">涓� 杞�
+ </el-button>
+ <el-button v-if="hasDel" type="danger"
size="small"
icon="el-icon-delete"
plain
@@ -37,7 +43,7 @@
</el-button>
</template>
<template slot-scope="scope" slot="menu">
- <el-button type="text"
+ <el-button v-if="hasDownload" type="text"
icon="el-icon-download"
size="small"
@click="handleDownload(scope.row)">涓嬭浇
@@ -58,15 +64,18 @@
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,
@@ -74,11 +83,15 @@
},
attachBox: false,
selectionList: [],
+ hasUpload:validatenull(this.options.hasUpload) ? true :this.options.hasUpload,
+ hasEdit:validatenull(this.options.hasEdit) ? true :this.options.hasEdit,
+ hasDel:validatenull(this.options.hasDel) ? true :this.options.hasDel,
+ hasDownload:validatenull(this.options.hasDownload) ? true :this.options.hasDownload,
option: {
- height: 'auto',
+ height:(this.options.tableHeight?this.options.tableHeight:'200'),
calcHeight: 30,
tip: false,
- searchShow: true,
+ searchShow: false,
searchMenuSpan: 6,
border: true,
index: true,
@@ -150,25 +163,7 @@
date: "date",
refer: "refer",
},
- data: [{
- btmname: "fileobject",
- createTime: "2023-06-14 16:08:50.002",
- creator: "1",
- fileDocClassify: "undefined",
- fileDocClassifyName: null,
- fileExtension: "png",
- filePath: "VolumnFactoryService:/f87a4c92-ce6e-458b-aad0-0c76bd5eeb35\\54120082-76aa-4092-abbf-b13cb40606c5",
- fileSize: 858,
- id: "assignRole",
- name: "assignRole",
- nameOid: "9FF4C05D-4EFA-F00B-0080-5ABB50257D4E",
- oid: "54120082-76aa-4092-abbf-b13cb40606c5",
- ownBtmname: "wupin",
- ownbizOid: "6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9",
- owner: "1",
- secretGrade: null,
- secretGradeText: null
- }],
+ data: [],
attachForm: {},
attachOption: {
submitBtn: false,
@@ -195,6 +190,7 @@
prop: 'attachFile',
type: 'upload',
dragFile: true,
+ showFileList:false,
accept: this.options.uploadAccept || 'file',
loadText: '鏂囦欢涓婁紶涓紝璇风◢绛�',
span: 24,
@@ -203,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 || "绠$悊鍛樺叡浜枃浠�"
},
@@ -214,13 +210,13 @@
};
},
computed: {
- ...mapGetters(["permission"]),
+ ...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),
+ editBtn: false
};
},
oids() {
@@ -231,9 +227,18 @@
return oids.join(",");
}
},
- mounted() {
+ created() {
this.setFormItem();
this.setParams()
+ },
+ mounted() {
+
+ },
+ watch:{
+ ownbizOid(val){
+ this.setParams()
+ this.refreshChange()
+ }
},
methods: {
setFormItem(){
@@ -312,16 +317,33 @@
}
return [];
},
- setParams(){
+ setParams() {
var queryMap = {
- currentButtonKey:'VIEW',
- ownbizOid:this.options.ownbizOid,
- ownbizBtm:this.options.ownbizBtm
+ currentButtonKey: 'VIEW',
+ 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);
+ if (this.options.where) {
+ Object.assign(queryMap, this.options.where);
}
- this.params=queryMap;
+ this.params = queryMap;
+
+ if (!this.options.pageObject) {
+ this.options.pageObject = {
+ limit: 10,
+ page: 1
+ };
+ }
+ 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='';
@@ -331,10 +353,10 @@
},
handleEdit() {
if(this.selectionList.length==0){
- this.$message.error('璇烽�夋嫨闇�瑕佷慨鏀圭殑鏂囦欢')
+ this.$message.warning('璇烽�夋嫨闇�瑕佷慨鏀圭殑鏂囦欢')
return false;
}else if(this.selectionList.length>1){
- this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹�')
+ this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
return false;
}
this.attachOption.column[1].data.fileOid=this.oids;
@@ -346,21 +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}`);
- download(row.oid)
+ let data=new FormData();
+ if(row && row.oid){
+ data.append('fileOids',row.oid)
+ this.downloadFile(data);
+ }else{
+ if (this.selectionList.length === 0) {
+ this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return;
+ }
+ 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("纭畾灏嗛�夋嫨鏂囦欢鍒犻櫎?", {
@@ -369,7 +406,7 @@
type: "warning"
})
.then(() => {
- return remove(row.oid);
+ return remove([row.oid]);
})
.then(() => {
this.onLoad(this.page);
@@ -390,7 +427,7 @@
type: "warning"
})
.then(() => {
- return remove(this.oids);
+ return remove(this.oids.split(','));
})
.then(() => {
this.onLoad(this.page);
@@ -433,7 +470,7 @@
this.page.pageSize = pageSize;
},
refreshChange() {
- this.onLoad(this.page, this.query);
+ this.onLoad(this.page);
},
onLoad(page, params={}) {
this.loading = true;
@@ -446,9 +483,24 @@
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;
- this.data = data.records;
+ if(this.options.fileDocClassifyCombox){
+ this.data = data.records.map(item => {
+ if(validatenull(item.fileDocClassifyName)&& !validatenull(item.fileDocClassify)){
+ item.fileDocClassifyName = this.options.fileDocClassifyCombox[item.fileDocClassify] || '';
+ }
+ return {
+ ...item
+ }
+ })
+ }else{
+ this.data = data.records;
+ }
+
this.loading = false;
this.selectionClear();
+ }).catch(error=>{
+ this.$message.error(error);
+ this.loading = false;
});
}
}
--
Gitblit v1.9.3