Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa
提交
8c41d204
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,发现更多精彩内容 >>
提交
8c41d204
编写于
6月 04, 2021
作者:
U
unknown
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
导入模型
上级
e4338d45
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
143 addition
and
241 deletion
+143
-241
o2web/source/x_component_query_Query/Importer.js
o2web/source/x_component_query_Query/Importer.js
+143
-241
未找到文件。
o2web/source/x_component_query_Query/Importer.js
浏览文件 @
8c41d204
...
...
@@ -642,28 +642,65 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
this
.
errorTextList
=
this
.
errorTextList
.
concat
(
errorTextList
);
this
.
errorTextListExcel
=
this
.
errorTextListExcel
.
concat
(
errorTextListExcel
);
if
(
this
.
errorTextList
.
length
>
0
){
return
false
;
}
this
.
createData
();
if
(
this
.
importer
.
json
.
type
===
"
cms
"
){
this
.
checkCMS
(
true
);
}
else
if
(
this
.
importer
.
json
.
type
===
"
process
"
){
this
.
checkProcess
(
true
);
}
if
(
this
.
errorTextList
.
length
>
0
){
return
false
;
}
return
true
;
},
checkCMS
:
function
(
notCheckName
){
getColInfor
:
function
(
key
,
isExcel
){
var
lp
=
this
.
lp
;
if
(
this
.
pathIndexMap
&&
typeOf
(
this
.
pathIndexMap
[
key
])
===
"
number
"
){
var
i
=
this
.
pathIndexMap
[
key
];
if
(
isExcel
){
var
text
=
lp
.
importValidationColumnTextExcel
;
return
text
.
replace
(
"
{n}
"
,
this
.
importer
.
excelUtils
.
index2ColName
(
i
)
);
}
else
{
var
text
=
lp
.
importValidationColumnText
;
return
text
.
replace
(
"
{n}
"
,
i
+
1
);
}
}
return
""
},
checkCMS
:
function
(
notCheckName
){
var
columnText
=
lp
.
importValidationColumnText
;
var
columnTextExcel
=
lp
.
importValidationColumnTextExcel
;
var
data
=
this
.
document
.
identity
;
if
(
!
data
){
this
.
errorTextList
.
push
(
this
.
getColInfor
(
"
identity
"
)
+
"
未设置拟稿人身份或者拟稿人在系统中不存在
"
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
this
.
getColInfor
(
"
identity
"
,
true
)
+
"
未设置拟稿人身份或者拟稿人在系统中不存在
"
+
lp
.
fullstop
);
}
else
if
(
data
.
split
(
"
@
"
).
getLast
().
toLowerCase
()
!==
"
i
"
){
this
.
errorTextList
.
push
(
'
"
'
+
data
+
'
"
'
+
"
拟稿人未设置成身份
"
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
'
"
'
+
data
+
'
"
'
+
"
拟稿人未设置成身份
"
+
lp
.
fullstop
);
}
var
errorTextList
=
[];
var
errorTextListExcel
=
[];
var
data
=
this
.
document
.
publishTime
;
if
(
!
data
){
this
.
errorTextList
.
push
(
"
未设置发布时间或者发布时间在系统中不存在
"
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
"
未设置发布时间或者发布时间在系统中不存在
"
+
lp
.
fullstop
);
}
else
if
(
!
new
Date
(
data
).
isValid
(
data
)
){
this
.
errorTextList
.
push
(
'
"
'
+
data
+
'
"
'
+
"
发布时间格式不正确
"
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
'
"
'
+
data
+
'
"
'
+
"
发布时间格式不正确
"
+
lp
.
fullstop
);
}
data
=
this
.
document
.
title
;
if
(
data
&&
data
>
70
){
this
.
errorTextList
.
push
(
'
"
'
+
data
+
'
"
'
+
lp
.
cmsTitleLengthInfor
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
'
"
'
+
data
+
'
"
'
+
+
lp
.
cmsTitleLengthInfor
+
lp
.
fullstop
);
}
data
=
this
.
document
.
summary
;
if
(
data
&&
data
.
length
>
70
){
this
.
errorTextList
.
push
(
'
"
'
+
data
+
'
"
'
+
lp
.
cmsSummaryLengthInfor
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
'
"
'
+
data
+
'
"
'
+
lp
.
cmsSummaryLengthInfor
+
lp
.
fullstop
);
}
this
.
importer
.
json
.
data
.
columnList
.
each
(
function
(
columnJson
,
i
)
{
...
...
@@ -761,6 +798,8 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
return
true
;
},
createData
:
function
(){
var
json
=
this
.
importer
.
json
;
...
...
@@ -783,98 +822,27 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
json
.
data
.
columnList
.
each
(
function
(
columnJson
,
i
)
{
var
dataType
=
json
.
type
===
"
dynamicTable
"
?
columnJson
.
dataType_Querytable
:
columnJson
.
dataType_CMSProcess
;
var
value
=
this
.
importedData
[
i
]
||
""
;
if
(
!
value
)
return
;
var
data
;
if
(
value
){
var
data
=
this
.
parseData
(
value
,
(
json
.
type
===
"
dynamicTable
"
?
columnJson
.
dataType_Querytable
:
columnJson
.
dataType_CMSProcess
),
columnJson
.
isName
);
if
(
!
data
)
return
;
switch
(
dataType
)
{
case
"
string
"
:
case
"
stringList
"
:
if
(
columnJson
.
isName
){
var
arr
=
value
.
split
(
/
\s
*,
\s
*/g
);
//空格,空格
if
(
json
.
type
===
"
dynamicTable
"
){
data
=
arr
}
else
{
data
=
arr
.
map
(
function
(
d
,
idx
){
return
this
.
importer
.
getOrgData
(
d
,
true
,
true
)
||
d
;
}.
bind
(
this
)).
clean
();
}
}
else
{
data
=
dataType
===
"
string
"
?
value
:
value
.
split
(
/
\s
*,
\s
*/g
);
}
break
;
case
"
number
"
:
case
"
integer
"
:
case
"
long
"
:
data
=
parseInt
(
value
);
break
;
case
"
double
"
:
data
=
parseFloat
(
value
);
break
;
case
"
numberList
"
:
case
"
integerList
"
:
case
"
longList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
parseInt
(
d
);
}.
bind
(
this
)).
clean
();
break
;
case
"
doubleList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
parseFloat
(
d
);
}.
bind
(
this
)).
clean
();
break
;
case
"
date
"
:
data
=
Date
.
parse
(
value
).
format
(
"
%Y-%m-%d
"
);
break
;
case
"
dateTime
"
:
data
=
Date
.
parse
(
value
).
format
(
"
db
"
);
break
;
case
"
dateList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
Date
.
parse
(
d
).
format
(
"
%Y-%m-%d
"
);
}.
bind
(
this
)).
clean
();
break
;
case
"
dateTimeList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
Date
.
parse
(
d
).
format
(
"
db
"
);
}.
bind
(
this
)).
clean
();
break
;
default
:
data
=
value
;
break
;
}
if
(
json
.
type
===
"
dynamicTable
"
){
this
.
data
[
columnJson
.
path
]
=
data
;
}
else
{
var
names
=
columnJson
.
path
.
split
(
"
.
"
);
var
d
=
this
.
data
;
Array
.
each
(
names
,
function
(
n
,
idx
)
{
// if( idx === names.length -1 )return;
if
(
!
d
[
n
]
){
if
(
this
.
isNumberString
(
n
)
){
d
[
n
.
toInt
()]
=
[];
}
else
{
d
[
n
]
=
{};
}
}
d
=
d
[
n
];
}.
bind
(
this
));
// d[names[names.length -1]] = data;
}
if
(
data
){
if
(
json
.
type
===
"
cms
"
){
// this.parseCMSDocument_FromExcel( columnJson, i, data )
if
(
columnJson
.
isName
)
{
if
(
columnJson
.
isAuthor
)
{
var
array
=
this
.
parseCMSReadAndAuthor
(
data
);
this
.
document
.
authorList
=
this
.
document
.
authorList
.
concat
(
array
)
}
if
(
columnJson
.
isReader
)
{
var
array
=
this
.
parseCMSReadAndAuthor
(
data
);
this
.
document
.
readerList
=
this
.
document
.
readerList
.
concat
(
array
)
}
}
if
(
json
.
type
===
"
dynamicTable
"
){
this
.
data
[
columnJson
.
path
]
=
data
;
}
else
{
this
.
setDataWithPath
(
this
.
data
,
columnJson
.
path
,
data
);
}
}
else
if
(
json
.
type
===
"
process
"
){
this
.
parseProcessWork_FromExcel
(
columnJson
,
i
,
data
)
if
(
json
.
type
===
"
cms
"
){
if
(
columnJson
.
isName
)
{
if
(
columnJson
.
isAuthor
)
{
var
array
=
this
.
parseCMSReadAndAuthor
(
data
);
this
.
document
.
authorList
=
this
.
document
.
authorList
.
concat
(
array
)
}
if
(
columnJson
.
isReader
)
{
var
array
=
this
.
parseCMSReadAndAuthor
(
data
);
this
.
document
.
readerList
=
this
.
document
.
readerList
.
concat
(
array
)
}
}
...
...
@@ -891,24 +859,10 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
if
(
json
.
type
===
"
dynamicTable
"
){
this
.
data
[
fieldJson
.
path
]
=
data
;
}
else
{
var
names
=
fieldJson
.
path
.
split
(
"
.
"
);
var
d
=
this
.
data
;
Array
.
each
(
names
,
function
(
n
,
idx
)
{
// if( idx === names.length -1 )return;
if
(
!
d
[
n
]
){
if
(
this
.
isNumberString
(
n
)
){
d
[
n
.
toInt
()]
=
[];
}
else
{
d
[
n
]
=
{};
}
}
d
=
d
[
n
];
});
// d[names[names.length -1]] = data;
this
.
setDataWithPath
(
this
.
data
,
fieldJson
.
path
,
data
);
}
if
(
json
.
type
===
"
cms
"
){
// this.parseCMSDocument_CalculateField( fieldJson, data )
if
(
fieldJson
.
isAuthor
){
var
array
=
this
.
parseCMSReadAndAuthor
(
data
);
this
.
document
.
authorList
=
this
.
document
.
authorList
.
concat
(
array
)
...
...
@@ -918,8 +872,6 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
this
.
document
.
readerList
=
this
.
document
.
readerList
.
concat
(
array
)
}
}
else
if
(
json
.
type
===
"
process
"
){
// this.parseProcessWork_CalculateField( fieldJson, data )
}
}
}.
bind
(
this
));
...
...
@@ -974,12 +926,85 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
this
.
importer
.
fireEvent
(
"
afterCreateRowData
"
,
[
null
,
this
]);
},
parseData
:
function
(
value
,
dataType
,
isName
){
var
data
;
switch
(
dataType
)
{
case
"
string
"
:
case
"
stringList
"
:
if
(
isName
){
var
arr
=
value
.
split
(
/
\s
*,
\s
*/g
);
//空格,空格
if
(
json
.
type
===
"
dynamicTable
"
){
data
=
arr
}
else
{
data
=
arr
.
map
(
function
(
d
,
idx
){
return
this
.
importer
.
getOrgData
(
d
,
true
,
true
)
||
d
;
}.
bind
(
this
)).
clean
();
}
}
else
{
data
=
dataType
===
"
string
"
?
value
:
value
.
split
(
/
\s
*,
\s
*/g
);
}
break
;
case
"
number
"
:
case
"
integer
"
:
case
"
long
"
:
data
=
parseInt
(
value
);
break
;
case
"
double
"
:
data
=
parseFloat
(
value
);
break
;
case
"
numberList
"
:
case
"
integerList
"
:
case
"
longList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
parseInt
(
d
);
}.
bind
(
this
)).
clean
();
break
;
case
"
doubleList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
parseFloat
(
d
);
}.
bind
(
this
)).
clean
();
break
;
case
"
date
"
:
data
=
Date
.
parse
(
value
).
format
(
"
%Y-%m-%d
"
);
break
;
case
"
dateTime
"
:
data
=
Date
.
parse
(
value
).
format
(
"
db
"
);
break
;
case
"
dateList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
Date
.
parse
(
d
).
format
(
"
%Y-%m-%d
"
);
}.
bind
(
this
)).
clean
();
break
;
case
"
dateTimeList
"
:
data
=
value
.
split
(
/
\s
*,
\s
*/g
).
map
(
function
(
d
,
idx
){
return
Date
.
parse
(
d
).
format
(
"
db
"
);
}.
bind
(
this
)).
clean
();
break
;
default
:
data
=
value
;
break
;
}
return
data
;
},
setDataWithPath
:
function
(
obj
,
path
,
data
){
var
names
=
path
.
split
(
"
.
"
);
var
d
=
obj
;
Array
.
each
(
names
,
function
(
n
,
idx
)
{
if
(
idx
===
names
.
length
-
1
)
return
;
if
(
!
d
[
n
]
){
if
(
this
.
isNumberString
(
n
)
){
d
[
n
.
toInt
()]
=
[];
}
else
{
d
[
n
]
=
{};
}
}
d
=
d
[
n
];
}.
bind
(
this
));
d
[
names
[
names
.
length
-
1
]]
=
data
;
},
setDataWithField
:
function
(
obj
,
fieldName
,
path
,
isName
){
var
json
=
this
.
importer
.
json
;
var
data
;
if
(
json
.
data
[
fieldName
]
){
var
f
=
json
.
data
[
fieldName
];
json
.
data
.
cloumnList
.
each
(
function
(
json
,
i
){
if
(
json
.
path
===
f
)
this
.
pathIndexMap
[
path
]
=
i
;
}.
bind
(
this
));
var
d
=
this
.
data
;
Array
.
each
(
json
.
data
[
fieldName
]
.
split
(
"
.
"
),
function
(
n
)
{
Array
.
each
(
f
.
split
(
"
.
"
),
function
(
n
)
{
if
(
this
.
isNumberString
(
n
))
n
=
n
.
toInt
();
if
(
d
)
d
=
d
[
n
];
});
...
...
@@ -998,82 +1023,6 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
isNumberString
:
function
(
string
){
return
string
.
toInt
().
toString
()
===
string
;
},
parseCMSDocument_FromExcel
:
function
(
columnJson
,
i
,
data
,
excelValue
){
var
lp
=
this
.
importer
.
lp
;
var
columnText
=
lp
.
importValidationColumnText
;
var
columnTextExcel
=
lp
.
importValidationColumnTextExcel
;
var
colInfor
=
columnText
.
replace
(
"
{n}
"
,
i
+
1
);
var
colInforExcel
=
columnTextExcel
.
replace
(
"
{n}
"
,
this
.
importer
.
excelUtils
.
index2ColName
(
i
)
);
if
(
columnJson
.
isTitle
){
this
.
document
.
title
=
data
;
}
if
(
columnJson
.
isSummary
){
this
.
document
.
summary
=
data
;
}
if
(
columnJson
.
isName
){
if
(
columnJson
.
isPublisher
&&
data
.
length
){
this
.
document
.
identity
=
data
[
0
].
distinguishedName
}
// if( columnJson.isAuthor ){
// var array = this.parseCMSReadAndAuthor( data );
// this.document.authorList = this.document.authorList.concat( array )
// }
// if( columnJson.isReader ){
// var array = this.parseCMSReadAndAuthor( data );
// this.document.readerList = this.document.readerList.concat( array )
// }
}
// if( columnJson.isTop ){
// if( [lp.yes,"yes","true"].contains(data) ){
// this.document.isTop = true;
// }
// }
},
parseCMSDocument_CalculateField
:
function
(
fieldJson
,
data
){
var
lp
=
this
.
importer
.
lp
;
var
fieldInfor
=
lp
.
caculateFieldValidationText
+
(
fieldJson
.
displayName
||
fieldJson
.
path
);
if
(
fieldJson
.
isTitle
){
if
(
data
.
length
>
70
){
this
.
errorTextList
.
push
(
fieldInfor
+
'
"
'
+
data
+
'
"
'
+
lp
.
cmsTitleLengthInfor
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
fieldInfor
+
'
"
'
+
data
+
'
"
'
+
+
lp
.
cmsTitleLengthInfor
+
lp
.
fullstop
);
}
else
{
this
.
document
.
title
=
data
;
}
}
if
(
fieldJson
.
isSummary
){
if
(
data
.
length
>
70
){
this
.
errorTextList
.
push
(
fieldInfor
+
'
"
'
+
data
+
'
"
'
+
lp
.
cmsSummaryLengthInfor
+
lp
.
fullstop
);
this
.
errorTextListExcel
.
push
(
fieldInfor
+
'
"
'
+
data
+
'
"
'
+
lp
.
cmsSummaryLengthInfor
+
lp
.
fullstop
);
}
else
{
this
.
document
.
summary
=
data
;
}
}
if
(
fieldJson
.
isPublisher
){
var
d
=
(
typeOf
(
data
)
===
"
array
"
&&
data
.
length
)
?
data
[
0
]
:
data
;
if
(
d
){
d
=
typeOf
(
d
)
===
"
object
"
?
d
.
distinguishedName
:
d
;
this
.
document
.
identity
=
data
[
0
].
distinguishedName
}
}
// if( fieldJson.isAuthor ){
// var array = this.parseCMSReadAndAuthor( data );
// this.document.authorList = this.document.authorList.concat( array )
// }
// if( fieldJson.isReader ){
// var array = this.parseCMSReadAndAuthor( data );
// this.document.readerList = this.document.readerList.concat( array )
// }
// if( fieldJson.isTop ){
// if( [lp.yes,"yes","true"].contains(data) ){
// this.document.isTop = true;
// }
// }
},
parseCMSReadAndAuthor
:
function
(
data
){
var
cnArray
=
[
"
组织
"
,
"
群组
"
,
"
人员
"
,
"
人员
"
,
"
角色
"
];
var
keyArray
=
[
"
U
"
,
"
G
"
,
"
I
"
,
"
P
"
,
"
R
"
];
...
...
@@ -1091,44 +1040,6 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
}).
clean
()
},
parseProcessWork_FromExcel
:
function
(
columnJson
,
i
,
data
,
excelValue
){
var
lp
=
this
.
importer
.
lp
;
var
columnText
=
lp
.
importValidationColumnText
;
var
columnTextExcel
=
lp
.
importValidationColumnTextExcel
;
var
colInfor
=
columnText
.
replace
(
"
{n}
"
,
i
+
1
);
var
colInforExcel
=
columnTextExcel
.
replace
(
"
{n}
"
,
this
.
importer
.
excelUtils
.
index2ColName
(
i
)
);
if
(
columnJson
.
isProcessTitle
){
this
.
work
.
title
=
data
;
}
if
(
columnJson
.
isName
){
if
(
columnJson
.
isProcessDrafter
&&
data
.
length
){
this
.
work
.
identity
=
data
[
0
].
distinguishedName
}
}
},
parseProcessWork_CalculateField
:
function
(
fieldJson
,
data
){
var
lp
=
this
.
importer
.
lp
;
var
fieldInfor
=
lp
.
caculateFieldValidationText
+
(
fieldJson
.
displayName
||
fieldJson
.
path
);
if
(
columnJson
.
isProcessTitle
){
// if( data.length > 70 ){
// this.errorTextList.push( fieldInfor +'"'+ data +'"'+ lp.cmsTitleLengthInfor + lp.fullstop );
// this.errorTextListExcel.push( fieldInfor +'"'+ data +'"'+ + lp.cmsTitleLengthInfor + lp.fullstop );
// }else{
this
.
work
.
title
=
data
;
// }
}
if
(
columnJson
.
isProcessDrafter
){
var
d
=
(
typeOf
(
data
)
===
"
array
"
&&
data
.
length
)
?
data
[
0
]
:
data
;
if
(
d
){
d
=
typeOf
(
d
)
===
"
object
"
?
d
.
distinguishedName
:
d
;
this
.
work
.
identity
=
data
[
0
].
distinguishedName
}
}
},
getResult
:
function
(){
if
(
this
.
importer
.
json
.
type
===
"
cms
"
){
return
this
.
document
;
...
...
@@ -1138,15 +1049,6 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
return
this
.
data
;
}
}
// save : function () {
// if( this.json.type === "dynamicTable" ){
//
// }else if( this.json.type === "cms" ){
//
// }else if( this.json.type === "process" ){
//
// }
// }
});
MWF
.
xApplication
.
query
.
Query
.
Importer
.
ExcelUtils
=
new
Class
({
...
...
liyi_hz2008
@liyi_hz2008
mentioned in commit
e87842ea
·
6月 17, 2021
mentioned in commit
e87842ea
mentioned in commit e87842eab94a5fe8368bf31f1a8bbe4aab5abb8a
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录