Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa
提交
2911cb67
o2oa
项目概览
浙江兰德纵横网络技术股份有限公司
/
o2oa
通知
339
Star
10
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2911cb67
编写于
3月 18, 2024
作者:
NoSubject
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'cherry-pick-
50223aa3
' into 'master'
修复导入模型下载模板样式的问题,并增加下载模板的数据有效性校验 See merge request o2oa/o2oa!2603
上级
9282592a
0ea80a8e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
99 addition
and
21 deletion
+99
-21
o2web/source/x_component_Template/lp/en.js
o2web/source/x_component_Template/lp/en.js
+6
-0
o2web/source/x_component_Template/lp/es.js
o2web/source/x_component_Template/lp/es.js
+6
-0
o2web/source/x_component_Template/lp/zh-cn.js
o2web/source/x_component_Template/lp/zh-cn.js
+7
-0
o2web/source/x_component_Template/utils/ExcelUtils.js
o2web/source/x_component_Template/utils/ExcelUtils.js
+69
-19
o2web/source/x_component_query_ImporterDesigner/lp/zh-cn.js
o2web/source/x_component_query_ImporterDesigner/lp/zh-cn.js
+1
-1
o2web/source/x_component_query_Query/Importer.js
o2web/source/x_component_query_Query/Importer.js
+10
-1
未找到文件。
o2web/source/x_component_Template/lp/en.js
浏览文件 @
2911cb67
...
...
@@ -62,6 +62,12 @@ MWF.xApplication.Template.LP={
"
close
"
:
"
Close
"
,
"
max
"
:
"
Maximize
"
,
"
restore
"
:
"
Restore
"
},
"
excelUtils
"
:
{
"
promptTitle
"
:
"
Input prompt
"
,
"
prompt
"
:
"
Please select a value from the dropdown list
"
,
"
errorTitle
"
:
"
Input error
"
,
"
error
"
:
"
The value you entered is not in the list
"
}
}
MWF
.
xApplication
.
Template
[
"
lp.
"
+
o2
.
language
]
=
MWF
.
xApplication
.
Template
.
LP
\ No newline at end of file
o2web/source/x_component_Template/lp/es.js
浏览文件 @
2911cb67
...
...
@@ -62,6 +62,12 @@ MWF.xApplication.Template.LP={
"
close
"
:
"
Cerrar
"
,
"
max
"
:
"
Maximizar
"
,
"
restore
"
:
"
Restaurar
"
},
"
excelUtils
"
:
{
"
promptTitle
"
:
"
Consejos de entrada
"
,
"
prompt
"
:
"
Por favor, seleccione un valor de la lista desplegable
"
,
"
errorTitle
"
:
"
Error de entrada
"
,
"
error
"
:
"
El valor que ingresaste no está en la lista
"
}
}
MWF
.
xApplication
.
Template
[
"
lp.
"
+
o2
.
language
]
=
MWF
.
xApplication
.
Template
.
LP
\ No newline at end of file
o2web/source/x_component_Template/lp/zh-cn.js
浏览文件 @
2911cb67
...
...
@@ -72,5 +72,12 @@ o2.xApplication.Template.LP = {
"
close
"
:
"
关闭
"
,
"
max
"
:
"
最大化
"
,
"
restore
"
:
"
还原
"
},
"
excelUtils
"
:
{
"
promptTitle
"
:
'
输入提示
'
,
"
prompt
"
:
'
请从下拉列表中选择一个值
'
,
"
errorTitle
"
:
'
输入错误
'
,
"
error
"
:
'
你输入的值不在列表中
'
}
};
\ No newline at end of file
o2web/source/x_component_Template/utils/ExcelUtils.js
浏览文件 @
2911cb67
...
...
@@ -121,39 +121,53 @@ MWF.xApplication.Template.utils.ExcelUtils = new Class({
// array.push([ "张三","男","大学本科","计算机","2001-1-2","2019-9-2" ]);
// array.push([ "李四","男","大学专科","数学","1998-1-2","2018-9-2" ]);
// this.exportToExcel(array, "导出数据"+(new Date).format("db"));
if
(
!
MWF
.
xApplication
.
Template
.
LP
){
MWF
.
xDesktop
.
requireApp
(
"
Template
"
,
"
lp.
"
+
MWF
.
language
,
null
,
false
);
}
this
.
_loadExportResource
(
function
(){
var
workbook
=
new
ExcelJS
.
Workbook
();
var
sheet
=
workbook
.
addWorksheet
(
'
s
heet1
'
);
var
sheet
=
workbook
.
addWorksheet
(
'
S
heet1
'
);
//sheet.properties.defaultRowHeight = 25;
var
titleArray
=
array
[
0
];
this
.
appendDataToSheet
(
sheet
,
array
,
colWidthArr
,
dateIndexArray
,
numberIndexArray
);
workbook
.
xlsx
.
writeBuffer
().
then
(
function
(
buffer
){
var
blob
=
new
Blob
([
buffer
]);
this
.
_openDownloadDialog
(
blob
,
fileName
+
"
.xlsx
"
,
callback
);
}.
bind
(
this
));
}.
bind
(
this
))
var
hasValidation
=
false
;
var
ps
=
titleArray
.
map
(
function
(
title
){
if
(
o2
.
typeOf
(
title
)
===
'
object
'
&&
title
.
options
){
hasValidation
=
true
;
return
title
.
options
;
}
return
null
;
});
if
(
hasValidation
){
Promise
.
all
(
ps
).
then
(
function
(
args
){
for
(
var
i
=
0
;
i
<
args
.
length
;
i
++
){
if
(
args
[
i
])
titleArray
[
i
].
optionsValue
=
args
[
i
];
}
this
.
setDataValidation
(
workbook
,
sheet
,
titleArray
);
this
.
downloadExcel
(
workbook
,
fileName
,
callback
);
}.
bind
(
this
));
}
else
{
this
.
downloadExcel
(
workbook
,
fileName
,
callback
);
}
}.
bind
(
this
));
},
downloadExcel
:
function
(
workbook
,
fileName
,
callback
){
workbook
.
xlsx
.
writeBuffer
().
then
(
function
(
buffer
){
var
blob
=
new
Blob
([
buffer
]);
this
.
_openDownloadDialog
(
blob
,
fileName
+
"
.xlsx
"
,
callback
);
}.
bind
(
this
));
},
appendDataToSheet
:
function
(
sheet
,
array
,
colWidthArr
,
dateIndexArray
,
numberIndexArray
){
var
titleRow
=
sheet
.
getRow
(
1
);
var
titleArray
=
array
.
shift
();
titleArray
.
each
(
function
(
title
,
i
){
var
value
,
options
;
if
(
o2
.
typeOf
(
title
)
===
'
object
'
){
value
=
title
.
text
;
options
=
title
.
options
;
}
else
{
value
=
title
;
}
sheet
.
getColumn
(
i
+
1
).
width
=
colWidthArr
[
i
]
?
(
colWidthArr
[
i
]
/
10
)
:
20
;
var
cell
=
titleRow
.
getCell
(
i
+
1
);
cell
.
value
=
valu
e
;
cell
.
value
=
o2
.
typeOf
(
title
)
===
'
object
'
?
title
.
text
:
titl
e
;
cell
.
font
=
{
name
:
'
宋体
'
,
family
:
4
,
size
:
12
,
bold
:
true
};
// cell.fill = {
// type: 'pattern',
// pattern:'solid',
// fgColor:{argb:'FFFFFF'}
// };
// cell.fill = { type: 'pattern', pattern:'solid', fgColor:{argb:'FFFFFF'} };
cell
.
alignment
=
{
vertical
:
'
middle
'
,
horizontal
:
'
center
'
,
wrapText
:
true
};
});
...
...
@@ -171,6 +185,42 @@ MWF.xApplication.Template.utils.ExcelUtils = new Class({
});
});
},
setDataValidation
:
function
(
workbook
,
dataSheet
,
titleArray
){
var
validationSheet
=
workbook
.
addWorksheet
(
'
Validation
'
);
validationSheet
.
state
=
'
hidden
'
;
//hidden 隐藏 veryHidden 从“隐藏/取消隐藏”对话框中隐藏工作表
var
colIndex
=
0
;
titleArray
.
each
(
function
(
title
,
i
){
var
optionsValue
=
o2
.
typeOf
(
title
)
===
'
object
'
&&
title
.
optionsValue
;
if
(
!
optionsValue
)
return
;
colIndex
++
;
var
optionsArray
=
o2
.
typeOf
(
optionsValue
)
===
"
array
"
?
optionsValue
:
[
optionsValue
];
validationSheet
.
getColumn
(
colIndex
).
values
=
optionsArray
;
var
colName
=
this
.
index2ColName
(
colIndex
-
1
);
var
dataValidation
=
{
type
:
'
list
'
,
allowBlank
:
true
,
showErrorMessage
:
true
,
showInputMessage
:
false
,
formulae
:
[
'
=Validation!$
'
+
colName
+
'
$1:$
'
+
colName
+
'
$
'
+
optionsArray
.
length
],
// 这里引用Validation Sheet的内容 '=Validation!A1:A3'
//formulae: ['"'+optionsArray.join(",")+'"'],
promptTitle
:
MWF
.
xApplication
.
Template
.
LP
.
excelUtils
.
promptTitle
,
prompt
:
MWF
.
xApplication
.
Template
.
LP
.
excelUtils
.
prompt
,
errorTitle
:
MWF
.
xApplication
.
Template
.
LP
.
excelUtils
.
errorTitle
,
error
:
MWF
.
xApplication
.
Template
.
LP
.
excelUtils
.
error
};
var
dataColName
=
this
.
index2ColName
(
i
);
for
(
var
rowIndex
=
2
;
rowIndex
<=
3000
;
rowIndex
++
)
{
const
cell
=
dataSheet
.
getCell
(
dataColName
+
rowIndex
);
cell
.
dataValidation
=
dataValidation
;
}
}.
bind
(
this
));
},
// exportToExcel2: function(array, fileName, colWidthArr, dateIndexArray, numberIndexArray, callback){
// // var array = [["姓名","性别","学历","专业","出生日期","毕业日期"]];
// // array.push([ "张三","男","大学本科","计算机","2001-1-2","2019-9-2" ]);
...
...
o2web/source/x_component_query_ImporterDesigner/lp/zh-cn.js
浏览文件 @
2911cb67
...
...
@@ -155,7 +155,7 @@ MWF.xApplication.query.ImporterDesigner.LP = {
"
valueScriptWorkNote
"
:
"
如果导入流程work,系统生成的工作数据
"
,
"
idPathNote
"
:
"
当导入自建表数据时,字段路径为'id'表示更新原有记录。
"
,
"
excelSelectedOption
"
:
"
excel列可选项
"
,
"
selectedOptionScript
"
:
"
可选项脚本
"
"
selectedOptionScript
"
:
"
可选项脚本
,返回数组
"
},
"
formToolbar
"
:{
"
save
"
:
"
保存
"
,
...
...
o2web/source/x_component_query_Query/Importer.js
浏览文件 @
2911cb67
...
...
@@ -762,13 +762,22 @@ MWF.xApplication.query.Query.Importer = MWF.QImporter = new Class(
if
(
!
this
.
importerJson
){
this
.
getImporterJSON
(
function
()
{
exportTo
();
}.
bind
(
this
))
}.
bind
(
this
))
;
}
else
{
exportTo
();
}
},
downloadTemplate
:
function
(
fileName
,
callback
){
if
(
this
.
Macro
){
this
.
_downloadTemplate
(
fileName
,
callback
);
}
else
{
this
.
loadMacro
(
function
(){
this
.
_downloadTemplate
(
fileName
,
callback
);
}.
bind
(
this
));
}
},
_downloadTemplate
:
function
(
fileName
,
callback
){
if
(
!
this
.
excelUtils
){
this
.
excelUtils
=
new
MWF
.
xApplication
.
query
.
Query
.
Importer
.
ExcelUtils
(
this
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录