1 Star 0 Fork 1

panda666plus/ExtJsFileUploadComponent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
FileUpload.js 3.11 KB
一键复制 编辑 原始数据 按行查看 历史
panda666plus 提交于 2023-08-24 02:01 . 提交文件
/**
* 文件上传管理View
*/
Ext.define('Panda.view.core.fileUpload.FileUpload',{
extend: 'Ext.window.Window',
xtype: 'fileupload',
alias: 'widget.fileupload',
requires: [
'Panda.view.core.fileUpload.FileUploadController',
'Panda.view.core.fileUpload.FileUploadModel'
],
controller: 'core-fileUpload-FileUploadController',
viewModel: {
type: 'core-fileUpload-FileUploadModel'
},
//region 自定义参数
/**
* 上传组件的调用者
*/
caller: null,
/**
* 上传完成后,需要关联数据的容器、变量
*/
needFillElement: null,
/**
* 允许上传的文件类型
* 格式参考:'.xlsx||.xls||.pdf'
*/
allowUploadFileType: '',
/**
* 上传框顶部的文本
*/
customPromptText:'请选择上传文件',
/**
* 是否允许自定义文件名称
*/
allowCustomFileName: false,
/**
* 是否允许取消文件上传
*/
allowCancelFileUpload: true,
/**
* 上传成功后的回调函数
*/
uploadSuccessCallback: null,
/**
* 上传出现错误回调函数
*/
uploadErrorCallback: null,
/**
* 上传完成回调函数(不论是否成功)
*/
uploadFinishCallback: null,
//endregion
/**
* 构造函数
* @param configs 参数
*/
constructor:function (configs) {
//初始化调用者参数
Ext.apply(this, configs);
//调用父类构造函数
this.callParent(configs);
//初始化上传组件
this.initUploadPanel();
},
/***
* 初始化上传组件
*/
initUploadPanel:function () {
//设置窗口的标题
this.setTitle(this.customPromptText);
},
closable: true,
listeners: {
beforeclose: 'onCloseButtonClickEventHandler',
},
scrollable: true,
minHeight: 150,
maxHeight: 300,
minWidth: 200,
maxWidth: 500,
layout: 'fit',
items: [
{
xtype: 'form',
reference: 'uploadForm',
padding: '20px',
items: [
{
xtype: 'container',
width: '100%',
},
{
xtype: 'filefield',
reference: 'uploadFile',
width: '100%',
},
{
xtype: 'textfield',
fieldLabel: '自定义文件名(选填)',
labelWidth: 175,
reference: 'userDefineFileName',
name: 'userDefineFileName',
width: '100%',
},
]
}
],
buttons: [
{
text: '开始上传',
handler: 'onSubmitUploadButtonClickEventHandler',
},
{
text: '取消上传',
handler: 'onCancelSubmitButtonClickEventHandler',
},
],
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/panda666plus/ext-js-file-upload-component.git
git@gitee.com:panda666plus/ext-js-file-upload-component.git
panda666plus
ext-js-file-upload-component
ExtJsFileUploadComponent
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385