Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
o2oa
提交
b2ab9b2e
o2oa
项目概览
此号慢热型
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
5
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
b2ab9b2e
编写于
2月 18, 2021
作者:
U
unknown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
数据网格导入导出
上级
0bc9a72c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
152 addition
and
24 deletion
+152
-24
o2web/source/x_component_process_Xform/DatagridPC.js
o2web/source/x_component_process_Xform/DatagridPC.js
+151
-24
o2web/source/x_component_process_Xform/lp/zh-cn.js
o2web/source/x_component_process_Xform/lp/zh-cn.js
+1
-0
未找到文件。
o2web/source/x_component_process_Xform/DatagridPC.js
浏览文件 @
b2ab9b2e
...
...
@@ -1781,18 +1781,17 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
return
this
.
json
.
id
+
i
;
},
exportToExcel
:
function
()
{
debugger
;
var
titleThs
=
this
.
titleTr
.
getElements
(
"
th
"
);
// var editorTds = this.editorTr.getElements("td");
var
resultArr
=
[];
var
titleArr
=
[];
isAvaliableImpExpColumn
:
function
(
thJson
,
module
,
type
){
if
(
thJson
&&
(
thJson
.
isShow
===
false
||
thJson
.
isImpExp
===
false
))
return
false
;
//隐藏列,不允许导入导出
if
(
module
&&
(
module
.
json
.
type
==
"
sequence
"
||
module
.
json
.
cellType
==
"
sequence
"
)
)
return
false
;
//序号列
if
(
module
&&
[
"
Image
"
,
"
Button
"
,
"
ImageClipper
"
,
"
Attachment
"
,
"
AttachmentDg
"
,
"
Label
"
].
contains
(
module
.
json
.
type
)
)
return
false
;
//图片,附件,Label列不导入导出
// if (type==="import" && module && ["Label"].contains(module.json.type))return false; //Label 不导入
return
true
;
},
getExportColWidthArray
:
function
(){
var
titleThs
=
this
.
titleTr
.
getElements
(
"
th
"
);
var
colWidthArr
=
[];
var
dateIndexArr
=
[];
//日期格式列下标
var
idx
=
0
;
titleThs
.
each
(
function
(
th
,
index
){
if
(
this
.
editable
&&
(
index
===
0
||
index
===
titleThs
.
length
-
1
)
)
return
;
//第一列操作列和最后一列排序列
...
...
@@ -1809,14 +1808,81 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
colWidthArr
.
push
(
500
);
}
else
if
(
module
&&
module
.
json
.
type
===
"
Calendar
"
)
{
colWidthArr
.
push
(
150
);
dateIndexArr
.
push
(
idx
);
}
else
{
colWidthArr
.
push
(
150
);
}
}
}.
bind
(
this
));
return
colWidthArr
;
},
getExportDateIndexArray
:
function
(){
var
titleThs
=
this
.
titleTr
.
getElements
(
"
th
"
);
var
dateIndexArr
=
[];
//日期格式列下标
var
idx
=
0
;
titleThs
.
each
(
function
(
th
,
index
){
if
(
this
.
editable
&&
(
index
===
0
||
index
===
titleThs
.
length
-
1
)
)
return
;
//第一列操作列和最后一列排序列
var
thJson
=
this
.
form
.
_getDomjson
(
th
);
var
module
=
this
.
editModules
[
this
.
editable
?
(
index
-
1
)
:
index
];
if
(
this
.
isAvaliableImpExpColumn
(
thJson
,
module
)
)
{
if
(
module
&&
module
.
json
.
type
===
"
Calendar
"
)
{
dateIndexArr
.
push
(
idx
);
}
idx
++
;
}
}.
bind
(
this
));
return
dateIndexArr
;
},
getExportTitleArray
:
function
(
type
){
var
titleThs
=
this
.
titleTr
.
getElements
(
"
th
"
);
var
titleArr
=
[];
titleThs
.
each
(
function
(
th
,
index
){
if
(
this
.
editable
&&
(
index
===
0
||
index
===
titleThs
.
length
-
1
)
)
return
;
//第一列操作列和最后一列排序列
var
thJson
=
this
.
form
.
_getDomjson
(
th
);
var
module
=
this
.
editModules
[
this
.
editable
?
(
index
-
1
)
:
index
];
if
(
this
.
isAvaliableImpExpColumn
(
thJson
,
module
,
type
)
)
{
titleArr
.
push
(
th
.
get
(
"
text
"
));
}
}.
bind
(
this
));
return
titleArr
;
},
exportToExcel
:
function
()
{
debugger
;
var
titleThs
=
this
.
titleTr
.
getElements
(
"
th
"
);
// var editorTds = this.editorTr.getElements("td");
var
resultArr
=
[];
var
titleArr
=
this
.
getExportTitleArray
();
var
colWidthArr
=
this
.
getExportColWidthArray
();
var
dateIndexArr
=
this
.
getExportDateIndexArray
();
//日期格式列下标
// var idx=0;
// titleThs.each(function(th, index){
// if ( this.editable && (index===0 || index === titleThs.length-1) )return; //第一列操作列和最后一列排序列
//
// var thJson = this.form._getDomjson( th );
// var module = this.editModules[this.editable ? (index-1) : index];
// if ( this.isAvaliableImpExpColumn( thJson, module ) ) {
// if (module && ["Org","Reader","Author","Personfield","Orgfield"].contains(module.json.type)) {
// colWidthArr.push(340);
// } else if (module && module.json.type === "Address") {
// colWidthArr.push(170);
// } else if (module && module.json.type === "Textarea") {
// colWidthArr.push(260);
// } else if (module && module.json.type === "Htmleditor") {
// colWidthArr.push(500);
// } else if (module && module.json.type === "Calendar") {
// colWidthArr.push(150);
// dateIndexArr.push(idx);
// } else {
// colWidthArr.push(150);
// }
// idx++;
// titleArr.push(th.get("text"));
// }
// }.bind(this));
resultArr
.
push
(
titleArr
);
if
(
this
.
gridData
.
data
){
...
...
@@ -1949,13 +2015,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
}.
bind
(
this
));
},
isAvaliableImpExpColumn
:
function
(
thJson
,
module
,
type
){
if
(
thJson
&&
(
thJson
.
isShow
===
false
||
thJson
.
isImpExp
===
false
))
return
false
;
//隐藏列,不允许导入导出
if
(
module
&&
(
module
.
json
.
type
==
"
sequence
"
||
module
.
json
.
cellType
==
"
sequence
"
)
)
return
false
;
//序号列
if
(
module
&&
[
"
Image
"
,
"
Button
"
,
"
ImageClipper
"
,
"
Attachment
"
,
"
AttachmentDg
"
].
contains
(
module
.
json
.
type
)
)
return
false
;
//图片,附件列不导入导出
if
(
type
===
"
import
"
&&
module
&&
[
"
Label
"
].
contains
(
module
.
json
.
type
))
return
false
;
//Label 不导入
return
true
;
},
setImportData
:
function
(
columnList
,
importedData
){
var
data
=
{
...
...
@@ -2052,6 +2112,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
},
openImportedErrorDlg
:
function
(
columnList
,
tableData
){
var
_self
=
this
;
var
objectToString
=
function
(
obj
,
type
)
{
if
(
!
obj
)
return
""
;
...
...
@@ -2076,13 +2137,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
htmlArray
.
push
(
"
<th style='
"
+
titleStyle
+
"
'>
"
+
MWF
.
xApplication
.
process
.
Xform
.
LP
.
validationInfor
+
"
</th>
"
);
htmlArray
.
push
(
"
</tr>
"
);
var
contentStyles
=
Object
.
clone
(
this
.
json
.
contentStyles
);
if
(
!
contentStyles
[
"
border-bottom
"
]
&&
!
contentStyles
[
"
border
"
]
)
contentStyles
[
"
border-bottom
"
]
=
"
1px solid #eee
"
;
var
contentStyle
=
objectToString
(
Object
.
merge
(
contentStyles
,
{
"
text-align
"
:
"
left
"
})
,
"
style
"
);
var
contentStyle
=
objectToString
(
Object
.
merge
(
Object
.
clone
(
this
.
json
.
contentStyles
),
{
"
text-align
"
:
"
left
"
})
,
"
style
"
);
tableData
.
each
(
function
(
lineData
,
lineIndex
){
htmlArray
.
push
(
"
<tr>
"
);
columnList
.
each
(
function
(
obj
,
i
)
{
htmlArray
.
push
(
"
<td style='
"
+
contentStyle
+
"
'>
"
+
lineData
[
obj
.
text
]
+
"
</td>
"
)
;
htmlArray
.
push
(
"
<td style='
"
+
contentStyle
+
"
'>
"
+
(
lineData
[
obj
.
text
]
||
''
).
replace
(
/ /g
,
"
<br/>
"
)
+
"
</td>
"
);
//换行符

;
});
htmlArray
.
push
(
"
<td style='
"
+
contentStyle
+
"
'>
"
+
(
lineData
.
errorTextList
?
lineData
.
errorTextList
.
join
(
"
<br/>
"
)
:
""
)
+
"
</td>
"
);
htmlArray
.
push
(
"
</tr>
"
);
...
...
@@ -2096,10 +2159,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
"
title
"
:
MWF
.
xApplication
.
process
.
Xform
.
LP
.
importFail
,
"
content
"
:
div
,
"
offset
"
:
{
"
y
"
:
0
},
"
isMax
"
:
fals
e
,
"
isMax
"
:
tru
e
,
"
width
"
:
1000
,
"
height
"
:
700
,
"
buttonList
"
:
[
{
"
type
"
:
"
exportWithError
"
,
"
text
"
:
MWF
.
xApplication
.
process
.
Xform
.
LP
.
datagridExport
,
"
action
"
:
function
()
{
_self
.
exportWithImportDataToExcel
(
columnList
,
tableData
);
}
},
{
"
type
"
:
"
cancel
"
,
"
text
"
:
MWF
.
LP
.
process
.
button
.
cancel
,
...
...
@@ -2112,15 +2180,62 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
});
},
exportWithImportDataToExcel
:
function
(
columnList
,
importedData
)
{
debugger
;
var
titleThs
=
this
.
titleTr
.
getElements
(
"
th
"
);
// var editorTds = this.editorTr.getElements("td");
var
resultArr
=
[];
var
colWidthArr
=
this
.
getExportColWidthArray
();
colWidthArr
.
push
(
220
);
var
dateIndexArr
=
this
.
getExportDateIndexArray
();
//日期格式列下标
var
titleArr
=
this
.
getExportTitleArray
(
"
import
"
);
titleArr
.
push
(
MWF
.
xApplication
.
process
.
Xform
.
LP
.
validationInfor
);
resultArr
.
push
(
titleArr
);
importedData
.
each
(
function
(
lineData
,
lineIndex
){
var
array
=
[];
columnList
.
each
(
function
(
obj
,
i
)
{
array
.
push
(
(
lineData
[
obj
.
text
]
||
''
).
replace
(
/ /g
,
"
\n
"
)
);
});
array
.
push
(
lineData
.
errorTextListExcel
?
lineData
.
errorTextListExcel
.
join
(
"
\n
"
)
:
""
);
resultArr
.
push
(
array
);
}.
bind
(
this
));
var
title
;
if
(
this
.
json
.
excelName
&&
this
.
json
.
excelName
.
code
){
title
=
this
.
form
.
Macro
.
exec
(
this
.
json
.
excelName
.
code
,
this
);
}
else
{
title
=
MWF
.
xApplication
.
process
.
Xform
.
LP
.
exportDefaultName
;
}
var
titleA
=
title
.
split
(
"
.
"
);
if
(
[
"
xls
"
,
"
xlst
"
].
contains
(
titleA
[
titleA
.
length
-
1
].
toLowerCase
()
)
){
titleA
.
splice
(
titleA
.
length
-
1
);
}
title
=
titleA
.
join
(
"
.
"
);
var
arg
=
{
data
:
resultArr
,
colWidthArray
:
colWidthArr
,
title
:
title
,
withError
:
true
};
this
.
fireEvent
(
"
export
"
,
[
arg
]);
new
MWF
.
xApplication
.
process
.
Xform
.
DatagridPC
.
ExcelUtils
(
this
).
export
(
resultArr
,
arg
.
title
||
title
,
colWidthArr
,
dateIndexArr
);
},
checkImportedData
:
function
(
columnList
,
tableData
){
var
flag
=
true
;
var
lp
=
MWF
.
xApplication
.
process
.
Xform
.
LP
;
var
columnText
=
lp
.
importValidationColumnText
;
var
columnTextExcel
=
lp
.
importValidationColumnTextExcel
;
var
excelUtil
=
new
MWF
.
xApplication
.
process
.
Xform
.
DatagridPC
.
ExcelUtils
(
this
);
tableData
.
each
(
function
(
lineData
,
lineIndex
){
var
errorTextList
=
[];
var
errorTextListExcel
=
[];
columnList
.
each
(
function
(
obj
,
i
)
{
var
index
=
obj
.
index
;
var
module
=
obj
.
module
;
...
...
@@ -2128,6 +2243,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
var
text
=
obj
.
text
;
var
colInfor
=
columnText
.
replace
(
"
{n}
"
,
index
);
var
colInforExcel
=
columnTextExcel
.
replace
(
"
{n}
"
,
excelUtil
.
index2ColName
(
index
-
1
)
);
var
d
=
lineData
[
text
]
||
""
;
...
...
@@ -2140,14 +2256,23 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
var
arr
=
d
.
split
(
/
\s
*,
\s
*/g
);
//空格,空格
arr
.
each
(
function
(
d
,
idx
){
var
obj
=
this
.
getImportOrgData
(
d
);
if
(
obj
.
errorText
)
errorTextList
.
push
(
colInfor
+
obj
.
errorText
+
+
lp
.
fullstop
);
if
(
obj
.
errorText
){
errorTextList
.
push
(
colInfor
+
obj
.
errorText
+
+
lp
.
fullstop
);
errorTextListExcel
.
push
(
colInforExcel
+
obj
.
errorText
+
+
lp
.
fullstop
);
}
}.
bind
(
this
));
break
;
case
"
Number
"
:
if
(
parseFloat
(
d
).
toString
()
===
"
NaN
"
)
errorTextList
.
push
(
colInfor
+
d
+
lp
.
notValidNumber
+
lp
.
fullstop
);
if
(
parseFloat
(
d
).
toString
()
===
"
NaN
"
){
errorTextList
.
push
(
colInfor
+
d
+
lp
.
notValidNumber
+
lp
.
fullstop
);
errorTextListExcel
.
push
(
colInforExcel
+
d
+
lp
.
notValidNumber
+
lp
.
fullstop
);
}
break
;
case
"
Calendar
"
:
if
(
!
(
isNaN
(
d
)
&&
!
isNaN
(
Date
.
parse
(
d
)
)))
errorTextList
.
push
(
colInfor
+
d
+
lp
.
notValidDate
+
lp
.
fullstop
);
if
(
!
(
isNaN
(
d
)
&&
!
isNaN
(
Date
.
parse
(
d
)
))){
errorTextList
.
push
(
colInfor
+
d
+
lp
.
notValidDate
+
lp
.
fullstop
);
errorTextListExcel
.
push
(
colInforExcel
+
d
+
lp
.
notValidDate
+
lp
.
fullstop
);
}
break
;
default
:
break
;
...
...
@@ -2157,6 +2282,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
module
.
validationMode
();
if
(
!
module
.
validation
()){
errorTextList
.
push
(
colInfor
+
module
.
errNode
.
get
(
"
text
"
));
errorTextListExcel
.
push
(
colInforExcel
+
module
.
errNode
.
get
(
"
text
"
));
module
.
errNode
.
destroy
();
}
}
...
...
@@ -2164,6 +2290,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
if
(
errorTextList
.
length
>
0
){
lineData
.
errorTextList
=
errorTextList
;
lineData
.
errorTextListExcel
=
errorTextListExcel
;
flag
=
false
;
}
...
...
o2web/source/x_component_process_Xform/lp/zh-cn.js
浏览文件 @
b2ab9b2e
...
...
@@ -15,6 +15,7 @@ MWF.xApplication.process.Xform.LP = {
"
validationInfor
"
:
"
校验信息
"
,
"
importFail
"
:
"
导入失败
"
,
"
importValidationColumnText
"
:
"
第{n}列:
"
,
"
importValidationColumnTextExcel
"
:
"
列{n}:
"
,
"
notValidNumber
"
:
"
不是数字
"
,
"
notValidDate
"
:
"
不是日期格式
"
,
"
fullstop
"
:
"
。
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录