提交 b4c4ef66 编写于 作者: sq3536's avatar sq3536

配置

上级 147e5218
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
:headers="myHeaders" :headers="myHeaders"
:file-list="uploadFileList" :file-list="uploadFileList"
:show-file-list="false" :show-file-list="false"
:limit="limit"
:http-request="customUploadFile"> :http-request="customUploadFile">
<div> <div>
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
...@@ -20,7 +19,6 @@ ...@@ -20,7 +19,6 @@
<span>{{$t('components.diskFileUpload.fileDrag')}}</span> <span>{{$t('components.diskFileUpload.fileDrag')}}</span>
<span style="color:#409EFF;">{{$t('components.diskFileUpload.clickUpload')}}</span> <span style="color:#409EFF;">{{$t('components.diskFileUpload.clickUpload')}}</span>
</div> </div>
<div slot="tip" class="el-upload__tip">{{uploadTip}}</div>
</div> </div>
</el-upload> </el-upload>
</el-col> </el-col>
...@@ -34,10 +32,10 @@ ...@@ -34,10 +32,10 @@
:headers="myHeaders" :headers="myHeaders"
:file-list="uploadFileList" :file-list="uploadFileList"
:show-file-list="false" :show-file-list="false"
:limit="limit"
:http-request="customUploadFile"> :http-request="customUploadFile">
<el-button type="primary" size="small" icon="el-icon-upload">{{$t('components.diskFileUpload.clickUpload')}}</el-button> <el-button type="primary" size="small" icon="el-icon-upload">
<div slot="tip" class="el-upload__tip">{{uploadTip}}</div> {{$t('components.diskFileUpload.clickUpload')}}
</el-button>
</el-upload> </el-upload>
</el-col> </el-col>
<!--文件操作--> <!--文件操作-->
...@@ -47,8 +45,11 @@ ...@@ -47,8 +45,11 @@
<span>{{item.name}}</span> <span>{{item.name}}</span>
</div> </div>
<div class="fileMain"> <div class="fileMain">
<el-link type="success" icon="el-icon-download" @click="onDownload(item)">{{$t('components.diskFileUpload.load')}}</el-link> <el-link type="success" icon="el-icon-download" @click="onDownload(item)">
<el-link type="warning" icon="el-icon-view" v-show="showPreview" @click="onPreview(item)">{{$t('components.diskFileUpload.preview')}} {{$t('components.diskFileUpload.load')}}
</el-link>
<el-link type="warning" icon="el-icon-view" v-show="showPreview" @click="onPreview(item)">
{{$t('components.diskFileUpload.preview')}}
</el-link> </el-link>
<el-link type="primary" icon="el-icon-edit" <el-link type="primary" icon="el-icon-edit"
v-show="showEdit && (item.name.match(/^.+\.(doc|DOC|docx|DOCX|wps|WPS|xls|XLS|xlsx|XLSX|ppt|PPT|et|ET)$/))" v-show="showEdit && (item.name.match(/^.+\.(doc|DOC|docx|DOCX|wps|WPS|xls|XLS|xlsx|XLSX|ppt|PPT|et|ET)$/))"
...@@ -58,21 +59,46 @@ ...@@ -58,21 +59,46 @@
v-show="showOcrview && (item.name.match(/^.+\.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|bmp|BMP|pdf|PDF)$/))" v-show="showOcrview && (item.name.match(/^.+\.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|bmp|BMP|pdf|PDF)$/))"
@click="onOcr(item)">OCR @click="onOcr(item)">OCR
</el-link> </el-link>
<el-link type="danger" icon="el-icon-delete" @click="onRemove(item,index)">{{$t('components.diskFileUpload.delete')}}</el-link> <el-link type="danger" icon="el-icon-delete" @click="onRemove(item,index)">
{{$t('components.diskFileUpload.delete')}}
</el-link>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<!-- 自定义弹框 -->
<div class="dialogDiv">
<el-dialog
width="70%"
top="5vh"
:visible="showDialog"
:close-on-click-modal="true"
:show-close="true"
:before-close="dialogClose"
:modal-append-to-body="false">
<div style="height: 100%;">
<iframe id="wps_npIframe" :src="iframeUrl" frameborder="0" width="100%"></iframe>
</div>
</el-dialog>
</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator'; import {Component, Vue, Prop, Watch} from 'vue-property-decorator';
import {Button, Row, Col, Link, Icon, Upload, Message, MessageBox} from 'element-ui'; import {Button, Row, Col, Link, Icon, Upload, Message, MessageBox} from 'element-ui';
import Axios from 'axios'; import Axios from 'axios';
import {Subject, Unsubscribable} from 'rxjs'; import {Subject, Unsubscribable} from 'rxjs';
@Component({}) @Component({})
export default class DiskFileUpload extends Vue { export default class DiskFileUpload extends Vue {
public showDialog = false;
public iframeUrl: any = '';
public dialogClose() {
this.showDialog = false;
this.iframeUrl = '';
}
/** /**
* 当前表单对象 * 当前表单对象
...@@ -170,22 +196,6 @@ export default class DiskFileUpload extends Vue { ...@@ -170,22 +196,6 @@ export default class DiskFileUpload extends Vue {
*/ */
@Prop({default: false}) public showOcrview?: boolean; @Prop({default: false}) public showOcrview?: boolean;
/**
* 单文件大小
*
* @type {number}
* @memberof DiskFileUpload
*/
@Prop({default: 1}) public size!: number;
/**
* 文件上传个数
*
* @type {number}
* @memberof DiskFileUpload
*/
@Prop({default: 5}) public limit!: number;
/** /**
* 表单是否处于编辑状态(有真实主键,srfuf='1';srfuf='0'时处于新建未保存) * 表单是否处于编辑状态(有真实主键,srfuf='1';srfuf='0'时处于新建未保存)
* *
...@@ -194,15 +204,6 @@ export default class DiskFileUpload extends Vue { ...@@ -194,15 +204,6 @@ export default class DiskFileUpload extends Vue {
*/ */
public srfuf: string = '0'; public srfuf: string = '0';
/**
* 上传提示语
*
* @type {string}
* @memberof DiskFileUpload
*/
get uploadTip(): string {
return this.$t('components.diskFileUpload.clues')+this.size.toString()+"M,"+this.$t('components.diskFileUpload.clues1')+this.limit;
}
/** /**
* 文件列表 * 文件列表
...@@ -297,7 +298,7 @@ export default class DiskFileUpload extends Vue { ...@@ -297,7 +298,7 @@ export default class DiskFileUpload extends Vue {
* *
* @memberof DiskFileUpload * @memberof DiskFileUpload
*/ */
public created(){ public created() {
this.formStateEvent = this.formState.subscribe(($event: any) => { this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成 // 表单加载完成
if (Object.is($event.type, 'load')) { if (Object.is($event.type, 'load')) {
...@@ -336,9 +337,9 @@ export default class DiskFileUpload extends Vue { ...@@ -336,9 +337,9 @@ export default class DiskFileUpload extends Vue {
* *
* @memberof DiskFileUpload * @memberof DiskFileUpload
*/ */
public getFiles(){ public getFiles() {
// 拼接url // 拼接url
let _this:any = this; let _this: any = this;
const getUrl = '/net-disk/files/' + this.getFolder(); const getUrl = '/net-disk/files/' + this.getFolder();
// 发送get请求 // 发送get请求
Axios.get(getUrl, { Axios.get(getUrl, {
...@@ -348,7 +349,7 @@ export default class DiskFileUpload extends Vue { ...@@ -348,7 +349,7 @@ export default class DiskFileUpload extends Vue {
}, },
}).then(response => { }).then(response => {
if (!response || response.status != 200) { if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.getFileFailure')+'!'); Message.error(_this.$t('components.diskFileUpload.getFileFailure') + '!');
return; return;
} }
// 返回的是一个jsonArray // 返回的是一个jsonArray
...@@ -359,7 +360,7 @@ export default class DiskFileUpload extends Vue { ...@@ -359,7 +360,7 @@ export default class DiskFileUpload extends Vue {
} }
} }
}).catch(error => { }).catch(error => {
Message.error(_this.$t('components.diskFileUpload.getFileFailure')+':'+ error); Message.error(_this.$t('components.diskFileUpload.getFileFailure') + ':' + error);
}); });
} }
...@@ -373,12 +374,6 @@ export default class DiskFileUpload extends Vue { ...@@ -373,12 +374,6 @@ export default class DiskFileUpload extends Vue {
// 上传的文件 // 上传的文件
let _this: any = this; let _this: any = this;
let file = param.file; let file = param.file;
// 文件大小
const isSize = file.size / 1024 / 1024 < this.size;
if (!isSize) {
Message.error(_this.$t('components.diskFileUpload.loadFailure1')+_this.size.toString()+"M!");
return;
}
// formData传参 // formData传参
let formData = new FormData(); let formData = new FormData();
formData.append('file', file); formData.append('file', file);
...@@ -387,7 +382,7 @@ export default class DiskFileUpload extends Vue { ...@@ -387,7 +382,7 @@ export default class DiskFileUpload extends Vue {
// 发送post请求 // 发送post请求
Axios.post(uploadUrl, formData, {timeout: 2000}).then(response => { Axios.post(uploadUrl, formData, {timeout: 2000}).then(response => {
if (!response || response.status != 200) { if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.loadFailure')+'!'); Message.error(_this.$t('components.diskFileUpload.loadFailure') + '!');
} }
// 返回的是一个jsonobject // 返回的是一个jsonobject
if (response.data) { if (response.data) {
...@@ -404,7 +399,7 @@ export default class DiskFileUpload extends Vue { ...@@ -404,7 +399,7 @@ export default class DiskFileUpload extends Vue {
} }
} }
}).catch(err => { }).catch(err => {
Message.error(_this.$t('components.diskFileUpload.loadFailure')+':'+ err); Message.error(_this.$t('components.diskFileUpload.loadFailure') + ':' + err);
}) })
} }
...@@ -428,7 +423,7 @@ export default class DiskFileUpload extends Vue { ...@@ -428,7 +423,7 @@ export default class DiskFileUpload extends Vue {
responseType: 'arraybuffer', responseType: 'arraybuffer',
}).then(response => { }).then(response => {
if (!response || response.status != 200) { if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.downloadFile')+'!'); Message.error(_this.$t('components.diskFileUpload.downloadFile') + '!');
return; return;
} }
// 请求成功,后台返回的是一个文件流 // 请求成功,后台返回的是一个文件流
...@@ -456,7 +451,7 @@ export default class DiskFileUpload extends Vue { ...@@ -456,7 +451,7 @@ export default class DiskFileUpload extends Vue {
Message.error(_this.$t('components.diskFileUpload.downloadFile1')); Message.error(_this.$t('components.diskFileUpload.downloadFile1'));
} }
}).catch(error => { }).catch(error => {
Message.error(_this.$t('components.diskFileUpload.downloadFile')+':'+ error); Message.error(_this.$t('components.diskFileUpload.downloadFile') + ':' + error);
}); });
} }
...@@ -471,8 +466,9 @@ export default class DiskFileUpload extends Vue { ...@@ -471,8 +466,9 @@ export default class DiskFileUpload extends Vue {
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id); const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name); const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name);
const previewUrl = '/net-disk/preview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode; const previewUrl = '/net-disk/preview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode;
// 新窗口打开url // 自定义弹框打开url
window.open(previewUrl); this.showDialog = true;
this.iframeUrl = previewUrl;
} }
/** /**
...@@ -485,8 +481,10 @@ export default class DiskFileUpload extends Vue { ...@@ -485,8 +481,10 @@ export default class DiskFileUpload extends Vue {
// 拼接url // 拼接url
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id); const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name); const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name);
const editUrl = '/net-disk/edit/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode; const editUrl = '/net-disk/editview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode;
// 新窗口打开url // 自定义弹框打开url
// this.showDialog = true;
// this.iframeUrl = editUrl;
window.open(editUrl); window.open(editUrl);
} }
...@@ -501,8 +499,9 @@ export default class DiskFileUpload extends Vue { ...@@ -501,8 +499,9 @@ export default class DiskFileUpload extends Vue {
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id); const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name); const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name);
const ocrUrl = '/net-disk/ocrview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode; const ocrUrl = '/net-disk/ocrview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode;
// 新窗口打开url // 自定义弹框打开url
window.open(ocrUrl); this.showDialog = true;
this.iframeUrl = ocrUrl;
} }
/** /**
...@@ -513,7 +512,7 @@ export default class DiskFileUpload extends Vue { ...@@ -513,7 +512,7 @@ export default class DiskFileUpload extends Vue {
* @memberof DiskFileUpload * @memberof DiskFileUpload
*/ */
public onRemove(item: any, index: number) { public onRemove(item: any, index: number) {
let _this:any = this; let _this: any = this;
if (item) { if (item) {
MessageBox.confirm(_this.$t('components.diskFileUpload.deleteFile'), _this.$t('components.diskFileUpload.deleteFilePrompt'), { MessageBox.confirm(_this.$t('components.diskFileUpload.deleteFile'), _this.$t('components.diskFileUpload.deleteFilePrompt'), {
confirmButtonText: _this.$t('components.diskFileUpload.true'), confirmButtonText: _this.$t('components.diskFileUpload.true'),
...@@ -525,7 +524,7 @@ export default class DiskFileUpload extends Vue { ...@@ -525,7 +524,7 @@ export default class DiskFileUpload extends Vue {
// 发送delete请求 // 发送delete请求
Axios.delete(deleteUrl).then(response => { Axios.delete(deleteUrl).then(response => {
if (!response || response.status != 200) { if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.deleteFileFailure')+'!'); Message.error(_this.$t('components.diskFileUpload.deleteFileFailure') + '!');
} }
// 从文件列表中删除 // 从文件列表中删除
this.uploadFileList.splice(index, 1); this.uploadFileList.splice(index, 1);
...@@ -536,7 +535,7 @@ export default class DiskFileUpload extends Vue { ...@@ -536,7 +535,7 @@ export default class DiskFileUpload extends Vue {
} }
}).catch(error => { }).catch(error => {
// 提示删除失败 // 提示删除失败
Message.error(_this.$t('components.diskFileUpload.deleteFileFailure')+':'+ error); Message.error(_this.$t('components.diskFileUpload.deleteFileFailure') + ':' + error);
}); });
}); });
} }
...@@ -548,7 +547,7 @@ export default class DiskFileUpload extends Vue { ...@@ -548,7 +547,7 @@ export default class DiskFileUpload extends Vue {
* @memberof DiskFileUpload * @memberof DiskFileUpload
*/ */
public updateFileBatch(files: any, opt: any) { public updateFileBatch(files: any, opt: any) {
let _this:any = this; let _this: any = this;
// 拼接url // 拼接url
const updateUrl = '/net-disk/files/' + this.getFolder() + '?ownertype=' + this.getOwnertype() + "&ownerid=" + this.getOwnerid(); const updateUrl = '/net-disk/files/' + this.getFolder() + '?ownertype=' + this.getOwnertype() + "&ownerid=" + this.getOwnerid();
// requestBody参数 // requestBody参数
...@@ -564,67 +563,89 @@ export default class DiskFileUpload extends Vue { ...@@ -564,67 +563,89 @@ export default class DiskFileUpload extends Vue {
timeout: 2000 timeout: 2000
}).then(response => { }).then(response => {
if (!response || response.status != 200) { if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.updateFailure')+'!'); Message.error(_this.$t('components.diskFileUpload.updateFailure') + '!');
return; return;
} }
}).catch(error => { }).catch(error => {
Message.error(_this.$t('components.diskFileUpload.updateFailure')+':'+ error); Message.error(_this.$t('components.diskFileUpload.updateFailure') + ':' + error);
}); });
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
#file-upload { #file-upload {
width: auto; width: auto;
height: auto; height: auto;
border: 0px solid black; border: 0px solid black;
} }
#el-row { #el-row {
border: 0px solid red; border: 0px solid red;
width: 400px; width: 400px;
} }
.withDrag { .withDrag {
border: 0px solid grey; border: 0px solid grey;
width: 400px; width: 400px;
} }
.withoutDrag { .withoutDrag {
border: 0px solid grey; border: 0px solid grey;
width: 400px; width: 400px;
text-align: left; text-align: left;
padding-left: 0px; padding-left: 0px;
padding-top: 0px; padding-top: 0px;
margin-top: 0px; margin-top: 0px;
} }
.el-upload__tip {
margin-top: 0px;
}
.fileList { .fileList {
width: 400px; width: 400px;
border: 0px solid grey; border: 0px solid grey;
margin-top: 0px; margin-top: 0px;
} }
.fileTitle { .fileTitle {
text-align: left; text-align: left;
margin-left: 0px; margin-left: 0px;
} }
.fileTitle i { .fileTitle i {
margin-right: 5px; margin-right: 5px;
} }
.fileMain { .fileMain {
text-align: left; text-align: left;
margin-left: 0px; margin-left: 0px;
margin-top: -10px; margin-top: -10px;
} }
.fileMain .el-link:nth-child(n+2) { .fileMain .el-link:nth-child(n+2) {
margin-left: 10px; margin-left: 10px;
} }
.dialogDiv{
// el-dialog头部
.el-dialog__header{
height:40px;
}
// el-dialog面板
.el-dialog__wrapper {
height: 90vh;
overflow: visible;
}
// el-dialog
.el-dialog {
height: 100%;
}
// el-dailog内容
.el-dialog__body {
height: inherit;
}
#wps_npIframe{
height: calc(100% - 40px);
}
}
</style> </style>
\ No newline at end of file
...@@ -117,7 +117,9 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -117,7 +117,9 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll() .antMatchers("/"+previewpath+"/**").permitAll()
.antMatchers("/lite/**").permitAll(); .antMatchers("/lite/**").permitAll()
.antMatchers("/net-disk/download/**").permitAll()
.antMatchers("/net-disk/**view/**").permitAll();
for (String excludePattern : excludesPattern) { for (String excludePattern : excludesPattern) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册