From ea81762709db76159f8c0cdb7841b067be5857d5 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 16 六月 2023 15:58:34 +0800
Subject: [PATCH] 文件列表展示
---
Source/UBCS-WEB/src/api/resource/file.js | 74 +++++++
Source/UBCS-WEB/src/components/file/main.vue | 325 ++++++++++++++++++++++++++++++++
Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue | 1
Source/UBCS-WEB/src/components/file/inHtml.vue | 26 ++
Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue | 110 ++++++-----
Source/UBCS-WEB/src/components/file/inDialog.vue | 40 ++++
6 files changed, 526 insertions(+), 50 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/resource/file.js b/Source/UBCS-WEB/src/api/resource/file.js
new file mode 100644
index 0000000..bd737e9
--- /dev/null
+++ b/Source/UBCS-WEB/src/api/resource/file.js
@@ -0,0 +1,74 @@
+import request from '@/router/axios';
+
+export const getList = (page, limit, params) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/listFiles',
+ method: 'get',
+ params: {
+ ...params,
+ page,
+ limit
+ }
+ })
+}
+
+export const remove = (oids) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/deleteFile',
+ method: 'post',
+ params: {
+ oids
+ }
+ })
+}
+
+export const upload = (row) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/uploadFile',
+ method: 'post',
+ data: row
+ })
+}
+
+export const update = (row) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/uploadFile',
+ method: 'post',
+ data: row
+ })
+}
+
+export const download = (oids) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/downloadFilesByOids',
+ method: 'get',
+ params: {
+ oids
+ }
+ })
+}
+
+/**
+ * 浣跨敤鏂囦欢涓婚敭鑾峰彇瀵硅薄
+ * @param oid 涓婚敭
+ * @return 鏂囦欢鏄剧ず瀵硅薄
+ */
+export const getFile = (oid) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/get',
+ method: 'get',
+ params: {
+ oid
+ }
+ })
+}
+
+export const listFilesByOids = (oids) => {
+ return request({
+ url: '/api/ubcs-resource/fileController/listFilesByOids',
+ method: 'get',
+ params: {
+ oids
+ }
+ })
+}
diff --git a/Source/UBCS-WEB/src/components/file/inDialog.vue b/Source/UBCS-WEB/src/components/file/inDialog.vue
new file mode 100644
index 0000000..ffa15f5
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/file/inDialog.vue
@@ -0,0 +1,40 @@
+<template>
+ <div>
+ <el-dialog :title="options.title|| '闄勪欢绠$悊'"
+ :visible.sync="visible"
+ append-to-body
+ class="avue-dialog avue-dialog--top"
+ @close="close"
+ top="0"
+ :width="options.width|| '80%'">
+ <fileContent
+ :options="options"
+ ></fileContent>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import fileContent from './main.vue';
+export default {
+ name: "inDialog",
+ components: { fileContent },
+ props: ["options","visible"],
+ data(){
+ return{
+
+ }
+ },
+ computed: {
+ },
+ methods:{
+ close(){
+ this.$emit("close", false);
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/Source/UBCS-WEB/src/components/file/inHtml.vue b/Source/UBCS-WEB/src/components/file/inHtml.vue
new file mode 100644
index 0000000..66eddf1
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/file/inHtml.vue
@@ -0,0 +1,26 @@
+<template>
+ <basic-container>
+ <fileContent
+ :options="options"
+ ></fileContent>
+ </basic-container>
+</template>
+
+<script>
+import fileContent from './main.vue';
+export default {
+ name: "inHtml",
+ components: { fileContent },
+ props: ["options"],
+ data(){
+ return{
+ }
+ },
+ computed: {
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/Source/UBCS-WEB/src/components/file/main.vue b/Source/UBCS-WEB/src/components/file/main.vue
new file mode 100644
index 0000000..04d3498
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/file/main.vue
@@ -0,0 +1,325 @@
+<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
+ icon="el-icon-upload2"
+ @click="handleUpload">涓� 浼�
+ </el-button>
+ <el-button type="primary"
+ size="small"
+ plain
+ icon="el-icon-edit"
+ @click="handleEdit">淇� 鏀�
+ </el-button>
+ <el-button type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ @click="handleDelete">鍒� 闄�
+ </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>
+ </template>
+ </avue-crud>
+ <el-dialog title="涓婁紶闄勪欢鍒楄〃"
+ append-to-body
+ :visible.sync="attachBox"
+ width="555px">
+ <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-before="uploadBefore" :upload-after="uploadAfter" :upload-error="uploadError">
+ </avue-form>
+ </el-dialog>
+ </basic-container>
+</template>
+
+<script>
+import {getList, getFile,upload,update, remove,download} from "@/api/resource/file";
+import {mapGetters} from "vuex";
+import {dateFormat} from "@/util/date";
+
+export default {
+ props: ["options","visible"],
+ data() {
+ return {
+ form: {},
+ query: {},
+ params:{},
+ loading: false,
+ 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: "name",
+ search: true,
+ /*formatter:function(d){
+ if(this.options.hasDownloadRight != false){
+ //璇存槑鏈変笅杞芥枃浠剁殑鏉冮檺锛岄偅涔堟垜浠氨娣诲姞涓�涓秴閾炬帴
+ return ''//'<a name="filenamedownloadlink " class="layui-btn layui-btn-intable" lay-event="PREVIEW" fileoid="' + d.oid +'">' + (d.id?d.id:d.name) + '</a>';
+ }else{
+ return d.id || d.name;
+ }
+ }*/
+ },
+ {
+ label: "鏂囦欢澶у皬",
+ prop: "fileSize",
+ formatter:function(d){
+ if(!d.fileSize || d.fileSize == null || d.fileSize*1 == 0 || isNaN(d.fileSize*1) ){
+ return "鏈煡澶у皬";
+ }else{
+ //鍘熷澶у皬鏄疊
+ var filesize = d.fileSize*1;
+ if(filesize>1024*1024*1024*1024){
+ return parseInt(filesize/(1024*1024*1024*1024)) + "TB";
+ }else if(filesize> 1024*1024*1024){
+ return parseInt(filesize/(1024*1024*1024)) + "GB";
+ }else if(filesize> 1024*1024){
+ return parseInt(filesize/(1024*1024)) + "MB";
+ }else if(filesize> 1024){
+ return parseInt(filesize/1024) + "KB";
+ }else {
+ return filesize + "B";
+ }
+ }
+ }
+ },
+ /*{
+ label: "瀵嗙骇",
+ prop: "secretGradeText"
+ },
+ {
+ label: "鏂囨。绫诲埆",
+ prop: "fileDocClassifyName"
+ },*/
+ {
+ label: "鍒涘缓鑰�",
+ prop: "creator"
+ },
+ {
+ label: "鍒涘缓鏃堕棿",
+ prop: "createTime"
+ },
+ ]
+ },
+ 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
+ }],
+ attachForm: {},
+ attachOption: {
+ submitBtn: true,
+ emptyBtn: true,
+ column: [
+ {
+ label: '闄勪欢涓婁紶',
+ prop: 'attachFile',
+ type: 'upload',
+ dragFile: true,
+ loadText: '鏂囦欢涓婁紶涓紝璇风◢绛�',
+ span: 24,
+ propsHttp: {
+ res: 'data'
+ },
+ action: "/api/ubcs-resource/fileController/uploadFile"
+ }
+ ]
+ }
+ };
+ },
+ 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: {
+ setParams(){
+ var params={
+ ownbizOid:options.ownbizOid || '6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9',
+ ownbizBtm:options.ownbizBtm || 'wupin',
+ fileDocClassify:options.fileDocClassify || '!=processAuditSuggest'
+ }
+ this.params=params;
+ },
+ handleUpload() {
+ this.attachBox = true;
+ },
+ handleEdit() {
+ this.attachBox = true;
+ },
+ uploadBefore(file, done, loading,column) {
+ console.log(file,column)
+ //濡傛灉浣犳兂淇敼file鏂囦欢,鐢变簬涓婁紶鐨刦ile鏄彧璇绘枃浠讹紝蹇呴』澶嶅埗鏂扮殑file鎵嶅彲浠ヤ慨鏀瑰悕瀛楋紝瀹屽悗璧嬪�煎埌done鍑芥暟閲�,濡傛灉涓嶄慨鏀圭殑璇濈洿鎺ュ啓done()鍗冲彲
+ var newFile = new File([file], '1234', { type: file.type });
+ done(newFile)
+ this.$message.success('涓婁紶鍓嶇殑鏂规硶')
+ },
+ uploadAfter(res, done, loading, column) {
+ window.console.log(column);
+ this.attachBox = false;
+ this.refreshChange();
+ done();
+ },
+ uploadError(error, column) {
+ this.$message.success('涓婁紶澶辫触鍥炶皟')
+ console.log(error, column)
+ },
+ 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;
+ params=this.params || {}
+ /*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>
diff --git a/Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue b/Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue
index f50524e..1017fc7 100644
--- a/Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue
+++ b/Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue
@@ -180,6 +180,7 @@
...item,
label: item.title,
prop: item.field,
+ formatter:item.template,
search: true
}
}
diff --git a/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue b/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue
index a0521bf..d140c92 100644
--- a/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue
+++ b/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue
@@ -1,50 +1,60 @@
-<template>
- <div>
- <el-button @click="visible = true">娴嬭瘯</el-button>
- <el-button @click="visible1 = true">鐩镐技椤规煡璇�</el-button>
- <FormTemplateDialog
- :visible.sync="visible"
- :type="this.type"
- :templateOid="this.templateOid"
- :codeClassifyOid="this.codeClassifyOid"
- :codeRuleOid="this.codeRuleOid"
- :disabledProp="disabledProp"
- :rowOid="rowOid"
- @submit="submit"
- ></FormTemplateDialog>
- <ResembleQueryDialog
- :visible.sync="visible1"
- :type="this.type"
- :templateOid="this.templateOid"
- :codeClassifyOid="this.codeClassifyOid"
- :codeRuleOid="this.codeRuleOid"
- ></ResembleQueryDialog>
- </div>
-</template>
-
-<script>
-import ResembleQueryDialog from '@/components/FormTemplate/ResembleQueryDialog.vue';
-export default {
- name: "FormTempalteTest",
- components: { ResembleQueryDialog },
- data() {
- return {
- visible: false,
- visible1: false,
- // 榛樿绂佺敤鐨勮〃鍏冪礌
- disabledProp: ["id", 'lcstatus'],
- // 琛ㄥ崟绫诲瀷
- type: "add",
- templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
- codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
- codeRuleOid: "B95872A6-9CEA-D490-8F1B-9D26548CAF96",
- rowOid: '6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9'
- };
- },
- methods: {
- submit(data) {
- console.log(data);
- }
- }
-};
-</script>
+<template>
+ <div>
+ <el-button @click="visible = true">娴嬭瘯</el-button>
+ <el-button @click="visible1 = true">鐩镐技椤规煡璇�</el-button>
+ <el-button @click="visible2 = true">闄勪欢绠$悊dialog</el-button>
+ <FormTemplateDialog
+ :visible.sync="visible"
+ :type="this.type"
+ :templateOid="this.templateOid"
+ :codeClassifyOid="this.codeClassifyOid"
+ :codeRuleOid="this.codeRuleOid"
+ :disabledProp="disabledProp"
+ :rowOid="rowOid"
+ @submit="submit"
+ ></FormTemplateDialog>
+ <ResembleQueryDialog
+ :visible.sync="visible1"
+ :type="this.type"
+ :templateOid="this.templateOid"
+ :codeClassifyOid="this.codeClassifyOid"
+ :codeRuleOid="this.codeRuleOid"
+ ></ResembleQueryDialog>
+ <fileInHtml :options="{}"></fileInHtml>
+ <fileinDialog
+ :visible="visible2"
+ :options="{}"
+ @close="visible2=false"
+ ></fileinDialog>
+ </div>
+</template>
+
+<script>
+import ResembleQueryDialog from '@/components/FormTemplate/ResembleQueryDialog.vue';
+import fileInHtml from '@/components/file/inHtml.vue';
+import fileinDialog from '@/components/file/inDialog.vue';
+export default {
+ name: "FormTempalteTest",
+ components: { ResembleQueryDialog ,fileInHtml ,fileinDialog},
+ data() {
+ return {
+ visible: false,
+ visible1: false,
+ visible2: false,
+ // 榛樿绂佺敤鐨勮〃鍏冪礌
+ disabledProp: ["id", 'lcstatus'],
+ // 琛ㄥ崟绫诲瀷
+ type: "add",
+ templateOid: "78B8C7C5-A042-0B96-FE6D-65421451782A",
+ codeClassifyOid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96",
+ codeRuleOid: "B95872A6-9CEA-D490-8F1B-9D26548CAF96",
+ rowOid: '6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9'
+ };
+ },
+ methods: {
+ submit(data) {
+ console.log(data);
+ }
+ }
+};
+</script>
--
Gitblit v1.9.3