Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
5fbdea9d
提交
5fbdea9d
authored
10月 28, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
30429 系统通用功能--数据下钻/打印弹窗--均打开新页面,不要弹窗,太小了
上级
6354e6e4
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
865 行增加
和
844 行删除
+865
-844
encryptApiList.js
one_stop_public/Base16/encryptApiList.js
+3
-0
globalFunction.js
one_stop_public/Table/globalFunction.js
+821
-835
index.js
one_stop_public/libs/formList/index.js
+2
-1
FormModal.jsx
one_stop_public/tableCompon/FormModal.jsx
+22
-7
style.less
one_stop_public/tableCompon/style.less
+17
-1
没有找到文件。
one_stop_public/Base16/encryptApiList.js
浏览文件 @
5fbdea9d
...
@@ -147,6 +147,9 @@ const resBinaryApiList = [
...
@@ -147,6 +147,9 @@ const resBinaryApiList = [
{
{
api
:
'UnifiedAppApi/getDetail'
,
api
:
'UnifiedAppApi/getDetail'
,
},
},
{
api
:
'DataColumnApi/getHeaderList'
,
},
{
{
api
:
'UnifiedServiceApi/getDetail'
,
api
:
'UnifiedServiceApi/getDetail'
,
},
},
...
...
one_stop_public/Table/globalFunction.js
浏览文件 @
5fbdea9d
...
@@ -24,119 +24,114 @@ const apiUrl = queryOauthActionPath();
...
@@ -24,119 +24,114 @@ const apiUrl = queryOauthActionPath();
* 返回值
* 返回值
* rowSpanData 列合并数据,colSpanData行合并数据
* rowSpanData 列合并数据,colSpanData行合并数据
* */
* */
export
function
getSpanJson
({
export
function
getSpanJson
({
mergeKey
,
data
,
eliminateRow
=
[],
eliminateCol
=
[]
})
{
mergeKey
,
const
dataList
=
deepCopy
(
data
);
data
,
let
rowSpanData
,
eliminateRow
=
[],
colSpanData
=
null
;
eliminateCol
=
[]
try
{
})
{
rowSpanData
=
getRowSpanJson
(
mergeKey
,
dataList
,
eliminateRow
);
}
catch
(
err
)
{
const
dataList
=
deepCopy
(
data
);
console
.
table
(
'rowSpanData'
,
err
);
let
rowSpanData
,
colSpanData
=
null
;
}
try
{
try
{
rowSpanData
=
getRowSpanJson
(
mergeKey
,
dataList
,
eliminateRow
);
colSpanData
=
getColSpanJson
(
mergeKey
,
dataList
,
eliminateCol
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
table
(
"rowSpanData"
,
err
);
console
.
table
(
'colSpanData'
,
err
);
}
}
try
{
return
{
colSpanData
=
getColSpanJson
(
mergeKey
,
dataList
,
eliminateCol
);
rowSpanData
,
}
catch
(
err
)
{
colSpanData
,
console
.
table
(
"colSpanData"
,
err
);
};
}
return
{
rowSpanData
,
colSpanData
,
};
}
}
function
getRowSpanJson
(
cloumnNames
,
data
,
eliminateStr
=
[])
{
function
getRowSpanJson
(
cloumnNames
,
data
,
eliminateStr
=
[])
{
data
=
deepCopy
(
data
);
data
=
deepCopy
(
data
);
//纵向合并
//纵向合并
// 获取列的 dataIndex 集合
// 获取列的 dataIndex 集合
var
rowSpanJson
=
{};
var
rowSpanJson
=
{};
//保存上一个name
//保存上一个name
var
beforeNameMap
=
{};
var
beforeNameMap
=
{};
//相同name出现的次数
//相同name出现的次数
var
countMap
=
{};
var
countMap
=
{};
//该name第一次出现的位置
//该name第一次出现的位置
var
startIndexMap
=
{};
var
startIndexMap
=
{};
for
(
var
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
for
(
var
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
var
dataItem
=
data
[
idx
];
var
dataItem
=
data
[
idx
];
for
(
var
idj
=
0
;
idj
<
cloumnNames
.
length
;
idj
++
)
{
for
(
var
idj
=
0
;
idj
<
cloumnNames
.
length
;
idj
++
)
{
var
keyItem
=
cloumnNames
[
idj
];
var
keyItem
=
cloumnNames
[
idj
];
var
dataItemValue
=
dataItem
[
keyItem
];
var
dataItemValue
=
dataItem
[
keyItem
];
if
(
idx
===
0
)
{
if
(
idx
===
0
)
{
beforeNameMap
[
keyItem
]
=
dataItem
[
keyItem
];
beforeNameMap
[
keyItem
]
=
dataItem
[
keyItem
];
countMap
[
keyItem
]
=
1
;
countMap
[
keyItem
]
=
1
;
startIndexMap
[
keyItem
]
=
0
;
startIndexMap
[
keyItem
]
=
0
;
rowSpanJson
[
keyItem
]
=
new
Array
(
data
.
length
);
rowSpanJson
[
keyItem
]
=
new
Array
(
data
.
length
);
rowSpanJson
[
keyItem
][
0
]
=
1
;
rowSpanJson
[
keyItem
][
0
]
=
1
;
continue
;
continue
;
}
}
if
(
dataItemValue
===
beforeNameMap
[
keyItem
]
&&
eliminateStr
.
indexOf
(
dataItemValue
)
===
-
1
)
{
if
(
dataItemValue
===
beforeNameMap
[
keyItem
]
&&
eliminateStr
.
indexOf
(
dataItemValue
)
===
-
1
)
{
countMap
[
keyItem
]
=
countMap
[
keyItem
]
+
1
;
countMap
[
keyItem
]
=
countMap
[
keyItem
]
+
1
;
rowSpanJson
[
keyItem
][
startIndexMap
[
keyItem
]]
=
countMap
[
keyItem
];
rowSpanJson
[
keyItem
][
startIndexMap
[
keyItem
]]
=
countMap
[
keyItem
];
rowSpanJson
[
keyItem
][
idx
]
=
0
;
rowSpanJson
[
keyItem
][
idx
]
=
0
;
}
else
{
}
else
{
countMap
[
keyItem
]
=
1
;
countMap
[
keyItem
]
=
1
;
beforeNameMap
[
keyItem
]
=
dataItemValue
;
beforeNameMap
[
keyItem
]
=
dataItemValue
;
startIndexMap
[
keyItem
]
=
idx
;
startIndexMap
[
keyItem
]
=
idx
;
rowSpanJson
[
keyItem
][
idx
]
=
1
;
rowSpanJson
[
keyItem
][
idx
]
=
1
;
}
}
}
}
}
}
return
rowSpanJson
;
return
rowSpanJson
;
}
}
function
getColSpanJson
(
cloumnNames
,
data
,
eliminateStr
=
[])
{
function
getColSpanJson
(
cloumnNames
,
data
,
eliminateStr
=
[])
{
data
=
deepCopy
(
data
);
data
=
deepCopy
(
data
);
//横向合并
//横向合并
var
colSpanJson
=
{};
var
colSpanJson
=
{};
for
(
let
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
for
(
let
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
let
dataItem
=
data
[
idx
];
let
dataItem
=
data
[
idx
];
let
colSum
=
1
;
//宽度
let
colSum
=
1
;
//宽度
let
triggerColIndex
=
null
;
//记录触发时得位置
let
triggerColIndex
=
null
;
//记录触发时得位置
let
triggerColSum
=
1
;
//记录触发时得位置
let
triggerColSum
=
1
;
//记录触发时得位置
let
isCol
=
false
;
let
isCol
=
false
;
for
(
let
idj
=
0
;
idj
<
cloumnNames
.
length
;
idj
++
)
{
for
(
let
idj
=
0
;
idj
<
cloumnNames
.
length
;
idj
++
)
{
let
keyItem
=
cloumnNames
[
idj
];
let
keyItem
=
cloumnNames
[
idj
];
let
dataItemValue
=
dataItem
[
keyItem
];
let
dataItemValue
=
dataItem
[
keyItem
];
let
dataItemValueNext
=
idj
<
cloumnNames
.
length
-
1
?
dataItem
[
cloumnNames
[
idj
+
1
]]
:
null
;
let
dataItemValueNext
=
idj
<
cloumnNames
.
length
-
1
?
dataItem
[
cloumnNames
[
idj
+
1
]]
:
null
;
//console.log("dataItemValue",dataItemValue,idj)
//console.log("dataItemValue",dataItemValue,idj)
if
(
idx
===
0
)
{
if
(
idx
===
0
)
{
colSpanJson
[
keyItem
]
=
new
Array
(
data
.
length
);
colSpanJson
[
keyItem
]
=
new
Array
(
data
.
length
);
}
}
if
(
if
(
!
isCol
&&
!
isCol
&&
dataItemValue
===
dataItemValueNext
&&
dataItemValue
===
dataItemValueNext
&&
eliminateStr
.
indexOf
(
dataItemValue
)
===
-
1
eliminateStr
.
indexOf
(
dataItemValue
)
===
-
1
)
{
)
{
//触发合并
//触发合并
triggerColIndex
=
keyItem
;
triggerColIndex
=
keyItem
;
isCol
=
true
;
isCol
=
true
;
}
}
if
(
isCol
&&
(
dataItemValue
!==
dataItemValueNext
||
dataItemValueNext
==
null
))
{
if
(
isCol
&&
(
dataItemValue
!==
dataItemValueNext
||
dataItemValueNext
==
null
))
{
//合并结束
//合并结束
isCol
=
false
;
isCol
=
false
;
}
}
if
(
isCol
)
{
if
(
isCol
)
{
//计数
//计数
triggerColSum
++
;
triggerColSum
++
;
}
}
if
(
!
isCol
&&
triggerColIndex
!==
null
)
{
if
(
!
isCol
&&
triggerColIndex
!==
null
)
{
colSpanJson
[
triggerColIndex
][
idx
]
=
triggerColSum
;
colSpanJson
[
triggerColIndex
][
idx
]
=
triggerColSum
;
colSpanJson
[
keyItem
][
idx
]
=
0
;
colSpanJson
[
keyItem
][
idx
]
=
0
;
triggerColIndex
=
null
;
triggerColIndex
=
null
;
}
else
if
(
isCol
&&
triggerColIndex
!==
null
)
{
}
else
if
(
isCol
&&
triggerColIndex
!==
null
)
{
colSpanJson
[
keyItem
][
idx
]
=
0
;
colSpanJson
[
keyItem
][
idx
]
=
0
;
}
else
{
}
else
{
colSpanJson
[
keyItem
][
idx
]
=
colSum
;
colSpanJson
[
keyItem
][
idx
]
=
colSum
;
}
}
}
}
}
}
//console.log("colSpanJson",colSpanJson)
//console.log("colSpanJson",colSpanJson)
return
colSpanJson
;
return
colSpanJson
;
}
}
/**
/**
...
@@ -150,113 +145,106 @@ function getColSpanJson(cloumnNames, data, eliminateStr = []) {
...
@@ -150,113 +145,106 @@ function getColSpanJson(cloumnNames, data, eliminateStr = []) {
* columnsHeight 行数
* columnsHeight 行数
* */
* */
export
function
getColumns
(
columns
)
{
export
function
getColumns
(
columns
)
{
columns
=
deepCopy
(
columns
);
columns
=
deepCopy
(
columns
);
const
uj
=
{
const
uj
=
{
t
:
1
,
t
:
1
,
v
:
'序号'
,
v
:
'序号'
,
s
:
'header'
,
s
:
'header'
,
};
};
let
columnsHeight
=
getColumnsMaxLevel
(
columns
);
//递归行数
let
columnsHeight
=
getColumnsMaxLevel
(
columns
);
//递归行数
let
columnsKey
=
[];
let
columnsKey
=
[];
const
columnsList
=
new
Array
(
columnsHeight
).
fill
([]);
const
columnsList
=
new
Array
(
columnsHeight
).
fill
([]);
let
col
=
1
;
let
col
=
1
;
for
(
var
i
in
columnsList
)
{
for
(
var
i
in
columnsList
)
{
columnsList
[
i
]
=
new
Array
(
getColumnsWidth
(
columns
)).
fill
({});
columnsList
[
i
]
=
new
Array
(
getColumnsWidth
(
columns
)).
fill
({});
}
}
function
getColumnsData
(
data
=
[],
res
=
[],
level
=
1
)
{
function
getColumnsData
(
data
=
[],
res
=
[],
level
=
1
)
{
try
{
try
{
for
(
let
item
of
data
)
{
for
(
let
item
of
data
)
{
//item.key = i;
//item.key = i;
let
isLast
=
!
item
.
children
;
let
isLast
=
!
item
.
children
;
item
.
level
=
level
;
item
.
level
=
level
;
item
.
isLast
=
isLast
;
item
.
isLast
=
isLast
;
item
.
width
=
!
isLast
?
getColumnsWidth
(
item
.
children
)
:
1
;
item
.
width
=
!
isLast
?
getColumnsWidth
(
item
.
children
)
:
1
;
item
.
col
=
col
;
item
.
col
=
col
;
res
.
push
(
item
);
res
.
push
(
item
);
columnsList
[
level
-
1
][
col
-
1
]
=
{
columnsList
[
level
-
1
][
col
-
1
]
=
{
...
uj
,
...
uj
,
v
:
item
.
title
,
v
:
item
.
title
,
};
};
if
(
!
isLast
)
{
if
(
!
isLast
)
{
if
(
Array
.
isArray
(
item
.
children
))
{
if
(
Array
.
isArray
(
item
.
children
))
{
let
x
=
level
+
1
;
let
x
=
level
+
1
;
getColumnsData
(
item
.
children
,
res
,
x
);
getColumnsData
(
item
.
children
,
res
,
x
);
}
}
}
else
{
}
else
{
col
++
;
col
++
;
columnsKey
.
push
(
item
[
'dataIndex'
]);
columnsKey
.
push
(
item
[
'dataIndex'
]);
}
}
}
}
return
res
;
return
res
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
table
(
"getColumnsData"
,
e
);
console
.
table
(
'getColumnsData'
,
e
);
return
false
;
return
false
;
}
}
}
}
//递归行数
//递归行数
function
getColumnsMaxLevel
(
arr
=
[])
{
function
getColumnsMaxLevel
(
arr
=
[])
{
//递归计算树形数据最大的层级数
//递归计算树形数据最大的层级数
let
maxLevel
=
0
;
let
maxLevel
=
0
;
(
function
multiArr
(
arr
,
level
=
0
)
{
(
function
multiArr
(
arr
,
level
=
0
)
{
++
level
;
++
level
;
maxLevel
=
Math
.
max
(
level
,
maxLevel
);
maxLevel
=
Math
.
max
(
level
,
maxLevel
);
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
let
item
=
arr
[
i
];
let
item
=
arr
[
i
];
item
.
level
=
level
;
item
.
level
=
level
;
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
multiArr
(
item
.
children
,
level
);
multiArr
(
item
.
children
,
level
);
}
else
{
}
else
{
delete
item
.
children
;
delete
item
.
children
;
}
}
}
}
})(
arr
,
0
);
})(
arr
,
0
);
return
maxLevel
;
return
maxLevel
;
}
}
//递归当前数据宽度
//递归当前数据宽度
function
getColumnsWidth
(
data
=
[],
sum
=
0
)
{
function
getColumnsWidth
(
data
=
[],
sum
=
0
)
{
for
(
let
item
of
data
)
{
for
(
let
item
of
data
)
{
if
(
!
item
.
children
)
{
if
(
!
item
.
children
)
{
sum
++
;
sum
++
;
}
else
{
}
else
{
sum
=
getColumnsWidth
(
item
.
children
,
sum
);
sum
=
getColumnsWidth
(
item
.
children
,
sum
);
}
}
}
}
return
sum
;
return
sum
;
}
}
let
columnsHandle
=
getColumnsData
(
columns
).
filter
((
v
,
i
)
=>
{
let
columnsHandle
=
getColumnsData
(
columns
)
return
(
v
.
level
<
columnsHeight
&&
v
.
isLast
)
||
v
.
width
>
1
;
.
filter
((
v
,
i
)
=>
{
});
return
(
v
.
level
<
columnsHeight
&&
v
.
isLast
)
||
v
.
width
>
1
;
let
columnsMerges
=
[];
});
columnsHandle
.
forEach
((
v
,
i
)
=>
{
let
columnsMerges
=
[];
let
{
isLast
,
width
,
col
,
level
}
=
v
;
columnsHandle
.
forEach
((
v
,
i
)
=>
{
let
nowCol
=
col
-
1
;
let
{
let
nowLevel
=
level
-
1
;
isLast
,
if
(
isLast
&&
width
===
1
)
{
width
,
//合并表格的 开始行、结束行、开始列、结束列
col
,
columnsMerges
.
push
([
nowLevel
,
columnsHeight
-
1
,
nowCol
,
nowCol
]);
level
}
}
=
v
;
if
(
!
isLast
&&
width
>
1
)
{
let
nowCol
=
col
-
1
;
columnsMerges
.
push
([
nowLevel
,
nowLevel
,
nowCol
,
nowCol
+
width
-
1
]);
let
nowLevel
=
level
-
1
;
}
if
(
isLast
&&
width
===
1
)
{
});
//合并表格的 开始行、结束行、开始列、结束列
return
{
columnsMerges
.
push
([
nowLevel
,
columnsHeight
-
1
,
nowCol
,
nowCol
]);
columnsList
,
}
columnsMerges
,
if
(
!
isLast
&&
width
>
1
)
{
columnsKey
,
columnsMerges
.
push
([
nowLevel
,
nowLevel
,
nowCol
,
nowCol
+
width
-
1
]);
columnsHeight
,
}
};
});
return
{
columnsList
,
columnsMerges
,
columnsKey
,
columnsHeight
,
};
}
}
/**
/**
...
@@ -271,80 +259,76 @@ export function getColumns(columns) {
...
@@ -271,80 +259,76 @@ export function getColumns(columns) {
* url : 接口地址
* url : 接口地址
*/
*/
export
function
getColumnsSqlKeyRealize
({
export
function
getColumnsSqlKeyRealize
({
sqlKey
,
sqlKey
,
columns
,
columns
,
styles
,
styles
,
fileName
=
'导出文件'
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
,
ext
=
'xlsx'
,
allValues
=
JSON
.
stringify
({})
allValues
=
JSON
.
stringify
({}),
})
{
})
{
columns
=
deepCopy
(
columns
);
columns
=
deepCopy
(
columns
);
let
{
let
{
columnsList
,
columnsMerges
,
columnsKey
}
=
getColumns
(
columns
);
columnsList
,
columnsMerges
,
let
content
=
{
columnsKey
sheets
:
[
}
=
getColumns
(
columns
);
{
name
:
fileName
,
let
content
=
{
cells
:
columnsList
,
sheets
:
[
merges
:
columnsMerges
,
{
sqlKey
:
sqlKey
,
//sql编码
name
:
fileName
,
sqlKeyHeader
:
columnsKey
,
//sql对应key对应列
cells
:
columnsList
,
},
merges
:
columnsMerges
,
],
sqlKey
:
sqlKey
,
//sql编码
styles
:
{
sqlKeyHeader
:
columnsKey
,
//sql对应key对应列
header
:
{
},
font
:
{
],
bold
:
false
,
styles
:
{
fontHeightInPoints
:
12
,
header
:
{
},
font
:
{
alignment
:
'CENTER'
,
bold
:
false
,
borderLeft
:
'THIN'
,
fontHeightInPoints
:
12
,
borderTop
:
'THIN'
,
},
borderBottom
:
'THIN'
,
alignment
:
'CENTER'
,
borderRight
:
'THIN'
,
borderLeft
:
'THIN'
,
verticalAlignment
:
'CENTER'
,
//TOP、CENTER、BOTTOM、JUSTIFY、DISTRIBUTED
borderTop
:
'THIN'
,
wrapText
:
true
,
borderBottom
:
'THIN'
,
rowHeights
:
20
,
borderRight
:
'THIN'
,
colWidths
:
250
,
verticalAlignment
:
'CENTER'
,
//TOP、CENTER、BOTTOM、JUSTIFY、DISTRIBUTED
},
wrapText
:
true
,
head
:
{
rowHeights
:
20
,
font
:
{
colWidths
:
250
,
bold
:
true
,
},
},
head
:
{
alignment
:
'CENTER'
,
font
:
{
},
bold
:
true
,
},
},
};
alignment
:
'CENTER'
,
if
(
styles
)
{
},
content
.
styles
=
styles
;
},
}
};
try
{
if
(
styles
)
{
let
getFileData
=
giveFilePostDataInfoForTrue
(
content
.
styles
=
styles
;
{
}
content
:
JSON
.
stringify
(
content
),
try
{
title
:
fileName
,
let
getFileData
=
giveFilePostDataInfoForTrue
(
allValues
:
allValues
,
{
},
content
:
JSON
.
stringify
(
content
),
`
${
apiUrl
+
'/DataObjApi/exportCustom'
}
`
,
title
:
fileName
,
);
allValues
:
allValues
let
token
=
getToken
();
},
downloadFile
(
`
${
apiUrl
+
'/DataObjApi/exportCustom'
}
`
,
getFileData
.
url
,
);
{
let
token
=
getToken
();
...
getFileData
.
datas
,
downloadFile
(
token
:
token
,
getFileData
.
url
,
},
{
fileName
,
...
getFileData
.
datas
,
ext
,
token
:
token
,
);
},
}
catch
(
err
)
{
fileName
,
console
.
table
(
'getColumnsSqlKeyRealize'
,
err
);
ext
,
}
);
}
catch
(
err
)
{
console
.
table
(
"getColumnsSqlKeyRealize"
,
err
);
}
}
}
/**
/**
...
@@ -363,53 +347,52 @@ export function getColumnsSqlKeyRealize({
...
@@ -363,53 +347,52 @@ export function getColumnsSqlKeyRealize({
*
*
*/
*/
export
function
getColumnsDataRealize
({
export
function
getColumnsDataRealize
({
data
=
[],
data
=
[],
mergeKey
=
[],
mergeKey
=
[],
columns
,
columns
,
styles
,
styles
,
defect
=
null
,
defect
=
null
,
fileName
=
'导出文件'
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
,
ext
=
'xlsx'
,
eliminateRow
=
[],
eliminateRow
=
[],
eliminateCol
=
[],
eliminateCol
=
[],
})
{
})
{
let
content
=
getColumnsData
({
let
content
=
getColumnsData
({
data
,
data
,
mergeKey
,
mergeKey
,
columns
,
columns
,
styles
,
styles
,
defect
,
defect
,
fileName
,
fileName
,
ext
,
ext
,
eliminateRow
,
eliminateRow
,
eliminateCol
,
eliminateCol
,
});
});
if
(
styles
)
{
if
(
styles
)
{
content
.
styles
=
styles
;
content
.
styles
=
styles
;
}
}
try
{
try
{
let
getFileData
=
giveFilePostDataInfoForTrue
(
let
getFileData
=
giveFilePostDataInfoForTrue
(
{
{
content
:
JSON
.
stringify
(
content
),
content
:
JSON
.
stringify
(
content
),
title
:
fileName
,
title
:
fileName
,
},
},
`
${
apiUrl
+
'/DataObjApi/exportCustom'
}
`
,
`
${
apiUrl
+
'/DataObjApi/exportCustom'
}
`
,
);
);
let
token
=
getToken
();
let
token
=
getToken
();
downloadFile
(
downloadFile
(
getFileData
.
url
,
getFileData
.
url
,
{
{
...
getFileData
.
datas
,
...
getFileData
.
datas
,
token
:
token
,
token
:
token
,
},
},
fileName
,
fileName
,
ext
,
ext
,
);
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
table
(
"getColumnsDataRealize"
,
err
);
console
.
table
(
'getColumnsDataRealize'
,
err
);
}
}
}
}
/**
/**
...
@@ -428,159 +411,158 @@ export function getColumnsDataRealize({
...
@@ -428,159 +411,158 @@ export function getColumnsDataRealize({
*
*
*/
*/
export
function
getColumnsData
({
export
function
getColumnsData
({
data
=
[],
data
=
[],
mergeKey
=
[],
mergeKey
=
[],
columns
,
columns
,
styles
,
styles
,
defect
=
null
,
defect
=
null
,
fileName
=
'导出文件'
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
,
ext
=
'xlsx'
,
eliminateRow
=
[],
eliminateRow
=
[],
eliminateCol
=
[],
eliminateCol
=
[],
})
{
})
{
columns
=
deepCopy
(
columns
);
columns
=
deepCopy
(
columns
);
data
=
deepCopy
(
data
);
data
=
deepCopy
(
data
);
let
{
let
{
columnsList
,
columnsMerges
,
columnsKey
,
columnsHeight
}
=
getColumns
(
columns
);
columnsList
,
let
{
colSpanData
,
rowSpanData
}
=
getSpanJson
({
columnsMerges
,
mergeKey
,
columnsKey
,
data
,
columnsHeight
eliminateRow
,
}
=
getColumns
(
columns
);
eliminateCol
,
let
{
});
colSpanData
,
// 处理数据
rowSpanData
let
bodyData
=
[];
}
=
getSpanJson
({
let
dataMerges
=
[];
mergeKey
,
const
uj
=
{
data
,
t
:
1
,
eliminateRow
,
v
:
'序号'
,
eliminateCol
s
:
'header'
,
});
};
// 处理数据
try
{
let
bodyData
=
[];
data
.
forEach
((
dv
,
di
)
=>
{
let
dataMerges
=
[];
let
nowArroy
=
new
Array
(
columnsKey
.
length
).
fill
({});
const
uj
=
{
columnsKey
.
forEach
((
av
,
ai
)
=>
{
t
:
1
,
nowArroy
[
ai
]
=
{
v
:
'序号'
,
...
uj
,
s
:
'header'
,
v
:
av
in
dv
&&
dv
[
av
]
!=
null
?
dv
[
av
].
toString
()
:
defect
||
''
,
};
};
try
{
});
data
.
forEach
((
dv
,
di
)
=>
{
bodyData
.
push
(
nowArroy
);
let
nowArroy
=
new
Array
(
columnsKey
.
length
).
fill
({});
});
columnsKey
.
forEach
((
av
,
ai
)
=>
{
// 处理合并数据
nowArroy
[
ai
]
=
{
mergeKey
.
forEach
((
mv
,
mi
)
=>
{
...
uj
,
rowSpanData
[
mv
].
forEach
((
cv
,
ci
)
=>
{
v
:
av
in
dv
&&
dv
[
av
]
!=
null
?
dv
[
av
].
toString
()
:
defect
||
''
,
if
(
cv
>
1
)
{
};
//合并表格的 开始行、结束行、开始列、结束列
});
let
rowIndex
=
columnsKey
.
indexOf
(
mv
);
bodyData
.
push
(
nowArroy
);
dataMerges
.
push
([
columnsHeight
+
ci
,
columnsHeight
+
ci
+
cv
-
1
,
rowIndex
,
rowIndex
]);
});
}
// 处理合并数据
});
mergeKey
.
forEach
((
mv
,
mi
)
=>
{
colSpanData
[
mv
].
forEach
((
cv
,
ci
)
=>
{
rowSpanData
[
mv
].
forEach
((
cv
,
ci
)
=>
{
if
(
cv
>
1
)
{
if
(
cv
>
1
)
{
//合并表格的 开始行、结束行、开始列、结束列
//合并表格的 开始行、结束行、开始列、结束列
let
rowIndex
=
columnsKey
.
indexOf
(
mv
);
let
rowIndex
=
columnsKey
.
indexOf
(
mv
);
dataMerges
.
push
([
columnsHeight
+
ci
,
columnsHeight
+
ci
,
rowIndex
,
rowIndex
+
cv
-
1
]);
dataMerges
.
push
([
columnsHeight
+
ci
,
columnsHeight
+
ci
+
cv
-
1
,
rowIndex
,
rowIndex
]);
}
}
});
});
});
colSpanData
[
mv
].
forEach
((
cv
,
ci
)
=>
{
}
catch
(
err
)
{
if
(
cv
>
1
)
{
console
.
table
(
'getColumnsDataRealize'
,
err
);
//合并表格的 开始行、结束行、开始列、结束列
}
let
rowIndex
=
columnsKey
.
indexOf
(
mv
);
let
content
=
{
dataMerges
.
push
([
columnsHeight
+
ci
,
columnsHeight
+
ci
,
rowIndex
,
rowIndex
+
cv
-
1
]);
sheets
:
[
}
{
});
name
:
fileName
,
});
cells
:
[...
columnsList
,
...
bodyData
],
}
catch
(
err
)
{
merges
:
[...
columnsMerges
,
...
dataMerges
],
console
.
table
(
"getColumnsDataRealize"
,
err
);
},
}
],
let
content
=
{
styles
:
{
sheets
:
[
header
:
{
{
font
:
{
name
:
fileName
,
bold
:
false
,
cells
:
[...
columnsList
,
...
bodyData
],
fontHeightInPoints
:
12
,
merges
:
[...
columnsMerges
,
...
dataMerges
],
},
},
alignment
:
'CENTER'
,
],
borderLeft
:
'THIN'
,
styles
:
{
borderTop
:
'THIN'
,
header
:
{
borderBottom
:
'THIN'
,
font
:
{
borderRight
:
'THIN'
,
bold
:
false
,
verticalAlignment
:
'CENTER'
,
//TOP、CENTER、BOTTOM、JUSTIFY、DISTRIBUTED
fontHeightInPoints
:
12
,
wrapText
:
true
,
},
rowHeights
:
20
,
alignment
:
'CENTER'
,
colWidths
:
250
,
borderLeft
:
'THIN'
,
},
borderTop
:
'THIN'
,
head
:
{
borderBottom
:
'THIN'
,
font
:
{
borderRight
:
'THIN'
,
bold
:
true
,
verticalAlignment
:
'CENTER'
,
//TOP、CENTER、BOTTOM、JUSTIFY、DISTRIBUTED
},
wrapText
:
true
,
alignment
:
'CENTER'
,
rowHeights
:
20
,
},
colWidths
:
250
,
},
},
};
head
:
{
if
(
styles
)
{
font
:
{
content
.
styles
=
styles
;
bold
:
true
,
}
},
return
content
;
alignment
:
'CENTER'
,
},
},
};
if
(
styles
)
{
content
.
styles
=
styles
;
}
return
content
}
}
// ant列表组件合并表格 render属性,合并纵向、横向。
// ant列表组件合并表格 render属性,合并纵向、横向。
export
function
renderContentAll
(
value
,
row
,
index
,
key
,
spanData
,
cloumnNames
=
[])
{
export
function
renderContentAll
(
value
,
row
,
index
,
key
,
spanData
,
cloumnNames
=
[])
{
let
colSpan
,
let
colSpan
,
rowSpan
=
null
;
rowSpan
=
null
;
try
{
try
{
colSpan
=
spanData
.
colSpanData
[
key
][
index
];
// 横向合并
colSpan
=
spanData
.
colSpanData
[
key
][
index
];
// 横向合并
rowSpan
=
spanData
.
rowSpanData
[
key
][
index
];
// 纵向合并
rowSpan
=
spanData
.
rowSpanData
[
key
][
index
];
// 纵向合并
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
table
(
"renderContentAll"
,
err
);
console
.
table
(
'renderContentAll'
,
err
);
}
}
const
obj
=
{
const
obj
=
{
children
:
value
,
children
:
value
,
props
:
{
props
:
{
rowSpan
:
rowSpan
,
rowSpan
:
rowSpan
,
colSpan
:
colSpan
colSpan
:
colSpan
,
}
},
};
};
return
obj
;
return
obj
;
}
}
// ant列表组件合并表格 render属性,合并纵向。 meanwhileKey :key 是本身字段key,value 是同步的字段key
// ant列表组件合并表格 render属性,合并纵向。 meanwhileKey :key 是本身字段key,value 是同步的字段key
export
function
renderContentRow
(
value
,
row
,
index
,
key
,
spanData
,
cloumnNames
=
[],
meanwhileKey
=
{})
{
export
function
renderContentRow
(
let
colSpan
,
value
,
rowSpan
=
null
;
row
,
try
{
index
,
if
(
cloumnNames
.
indexOf
(
key
)
!==
-
1
)
{
key
,
rowSpan
=
spanData
.
rowSpanData
[
key
][
index
];
// 纵向合并
spanData
,
}
else
{
cloumnNames
=
[],
if
(
key
in
meanwhileKey
&&
meanwhileKey
[
key
])
{
meanwhileKey
=
{},
let
meanwhileKeyValue
=
meanwhileKey
[
key
];
)
{
rowSpan
=
spanData
.
rowSpanData
[
meanwhileKeyValue
][
index
];
// 同步字段 的纵向合并
let
colSpan
,
}
else
{
rowSpan
=
null
;
rowSpan
=
1
;
try
{
}
if
(
cloumnNames
.
indexOf
(
key
)
!==
-
1
)
{
}
rowSpan
=
spanData
.
rowSpanData
[
key
][
index
];
// 纵向合并
}
catch
(
err
)
{
}
else
{
console
.
table
(
"renderContentRow"
,
err
);
if
(
key
in
meanwhileKey
&&
meanwhileKey
[
key
])
{
}
let
meanwhileKeyValue
=
meanwhileKey
[
key
];
const
obj
=
{
rowSpan
=
spanData
.
rowSpanData
[
meanwhileKeyValue
][
index
];
// 同步字段 的纵向合并
children
:
value
,
}
else
{
props
:
{
rowSpan
=
1
;
rowSpan
:
rowSpan
,
}
colSpan
:
1
}
}
}
catch
(
err
)
{
};
console
.
table
(
'renderContentRow'
,
err
);
return
obj
;
}
const
obj
=
{
children
:
value
,
props
:
{
rowSpan
:
rowSpan
,
colSpan
:
1
,
},
};
return
obj
;
}
}
/**
/**
* 表头和数据导出(合并表格)
* 表头和数据导出(合并表格)
* templatePath : word文档模板地址
* templatePath : word文档模板地址
...
@@ -592,43 +574,41 @@ export function renderContentRow(value, row, index, key, spanData, cloumnNames =
...
@@ -592,43 +574,41 @@ export function renderContentRow(value, row, index, key, spanData, cloumnNames =
* 返回值
* 返回值
* */
* */
export
function
getWord
({
export
function
getWord
({
templatePath
,
templatePath
,
params
,
params
,
title
,
title
,
allValues
=
{},
allValues
=
{},
listConfig
=
{},
listConfig
=
{},
ext
=
'docx'
,
ext
=
'docx'
,
})
{
})
{
try
{
try
{
let
getFileData
=
giveFilePostDataInfoForTrue
(
let
getFileData
=
giveFilePostDataInfoForTrue
(
{
{
templatePath
:
templatePath
,
templatePath
:
templatePath
,
params
:
JSON
.
stringify
({
params
:
JSON
.
stringify
({
...
listConfig
,
...
listConfig
,
...
setObjectKey
(
params
),
...
setObjectKey
(
params
),
}),
}),
title
:
`
${
title
}
.
${
ext
}
`
,
title
:
`
${
title
}
.
${
ext
}
`
,
allValues
:
JSON
.
stringify
({
...
allValues
}),
allValues
:
JSON
.
stringify
({
...
allValues
}),
},
},
apiUrl
+
`/DataColumnApi/exportWord`
,
apiUrl
+
`/DataColumnApi/exportWord`
,
);
);
let
token
=
getToken
();
let
token
=
getToken
();
downloadFile
(
downloadFile
(
getFileData
.
url
,
getFileData
.
url
,
{
{
...
getFileData
.
datas
,
...
getFileData
.
datas
,
token
:
token
,
token
:
token
,
},
},
title
,
title
,
ext
,
ext
,
);
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
table
(
err
);
console
.
table
(
err
);
}
}
}
}
/**
/**
* 表头和数据导出(合并表格)
* 表头和数据导出(合并表格)
* templatePath : word文档模板地址
* templatePath : word文档模板地址
...
@@ -640,43 +620,41 @@ export function getWord({
...
@@ -640,43 +620,41 @@ export function getWord({
* 返回值
* 返回值
* */
* */
export
function
getFileAndShow
({
export
function
getFileAndShow
({
templatePath
,
templatePath
,
params
,
params
,
title
,
title
,
allValues
=
{},
allValues
=
{},
listConfig
=
{},
listConfig
=
{},
ext
=
'docx'
,
ext
=
'docx'
,
})
{
})
{
try
{
try
{
let
getFileData
=
giveFilePostDataInfoForTrue
(
let
getFileData
=
giveFilePostDataInfoForTrue
(
{
{
templatePath
:
templatePath
,
templatePath
:
templatePath
,
params
:
JSON
.
stringify
({
params
:
JSON
.
stringify
({
...
listConfig
,
...
listConfig
,
...
setObjectKey
(
params
),
...
setObjectKey
(
params
),
}),
}),
title
:
`
${
title
}
.
${
ext
}
`
,
title
:
`
${
title
}
.
${
ext
}
`
,
allValues
:
JSON
.
stringify
({
...
allValues
}),
allValues
:
JSON
.
stringify
({
...
allValues
}),
},
},
apiUrl
+
`/DataColumnApi/exportWord`
,
apiUrl
+
`/DataColumnApi/exportWord`
,
);
);
let
token
=
getToken
();
let
token
=
getToken
();
downloadFileAndShowModal
(
downloadFileAndShowModal
(
getFileData
.
url
,
getFileData
.
url
,
{
{
...
getFileData
.
datas
,
...
getFileData
.
datas
,
token
:
token
,
token
:
token
,
},
},
title
,
title
,
ext
,
ext
,
);
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
table
(
err
);
console
.
table
(
err
);
}
}
}
}
/**
/**
* 表头和数据导出(合并表格)
* 表头和数据导出(合并表格)
* templatePath : word文档模板地址
* templatePath : word文档模板地址
...
@@ -689,337 +667,345 @@ export function getFileAndShow({
...
@@ -689,337 +667,345 @@ export function getFileAndShow({
* */
* */
export
function
getListWord
({
export
function
getListWord
({
templatePath
,
templatePath
,
paramsList
=
[],
paramsList
=
[],
title
,
title
,
sonTitleKey
,
sonTitleKey
,
allValuesKey
=
[],
allValuesKey
=
[],
listConfig
=
{},
listConfig
=
{},
ext
=
'zip'
,
ext
=
'zip'
,
sonExt
=
'pdf'
,
sonExt
=
'pdf'
,
filesKey
=
[]
filesKey
=
[],
})
{
})
{
try
{
try
{
let
content
=
[];
let
content
=
[];
paramsList
.
forEach
((
v
,
i
)
=>
{
paramsList
.
forEach
((
v
,
i
)
=>
{
let
files
=
[];
let
files
=
[];
let
paramsObj
=
deepCopy
(
v
);
let
paramsObj
=
deepCopy
(
v
);
for
(
var
ki
in
filesKey
)
{
for
(
var
ki
in
filesKey
)
{
let
files_
=
v
[
filesKey
[
ki
]];
let
files_
=
v
[
filesKey
[
ki
]];
try
{
try
{
files
=
[...
files
,
...
JSON
.
parse
(
files_
).
files
]
files
=
[...
files
,
...
JSON
.
parse
(
files_
).
files
];
}
catch
(
e
)
{
}
catch
(
e
)
{}
delete
paramsObj
[
filesKey
[
ki
]];
}
}
delete
paramsObj
[
filesKey
[
ki
]];
content
.
push
({
}
params
:
{
content
.
push
({
...
setObjectKey
(
paramsObj
),
params
:
{
...
listConfig
,
...
setObjectKey
(
paramsObj
),
},
...
listConfig
,
allValues
:
{
},
...
getObjectsKey
(
allValuesKey
,
paramsObj
),
allValues
:
{
},
...
getObjectsKey
(
allValuesKey
,
paramsObj
)
title
:
(
paramsObj
[
sonTitleKey
]
||
'未设置名称'
)
+
`.
${
sonExt
}
`
,
},
files
:
JSON
.
stringify
(
files
),
title
:
(
paramsObj
[
sonTitleKey
]
||
"未设置名称"
)
+
`.
${
sonExt
}
`
,
});
files
:
JSON
.
stringify
(
files
)
});
});
let
getFileData
=
giveFilePostDataInfoForTrue
(
});
{
let
getFileData
=
giveFilePostDataInfoForTrue
(
templatePath
:
templatePath
,
{
content
:
JSON
.
stringify
(
content
),
templatePath
:
templatePath
,
zipTitle
:
`
${
title
}
.
${
ext
}
`
,
content
:
JSON
.
stringify
(
content
),
},
zipTitle
:
`
${
title
}
.
${
ext
}
`
,
apiUrl
+
`/DataColumnApi/batchExportWord`
,
},
);
apiUrl
+
`/DataColumnApi/batchExportWord`
,
);
let
token
=
getToken
();
downloadFile
(
let
token
=
getToken
();
getFileData
.
url
,
downloadFile
(
{
getFileData
.
url
,
...
getFileData
.
datas
,
{
token
:
token
,
...
getFileData
.
datas
,
},
token
:
token
,
title
,
},
ext
,
title
,
);
ext
,
}
catch
(
err
)
{
);
console
.
table
(
err
);
}
catch
(
err
)
{
}
console
.
table
(
err
);
}
function
getObjectsKey
(
listKey
=
[],
params
=
{})
{
function
getObjectsKey
(
listKey
=
[],
params
=
{})
{
return
listKey
.
filter
((
key
)
=>
Object
.
keys
(
params
).
indexOf
(
key
)).
reduce
(
return
(
(
acc
,
key
)
=>
({
listKey
...
acc
,
.
filter
((
key
)
=>
Object
.
keys
(
params
).
indexOf
(
key
))
[
key
]:
params
[
key
]
===
null
?
''
:
params
[
key
],
.
reduce
(
}),
(
acc
,
key
)
=>
({
{},
...
acc
,
);
[
key
]:
params
[
key
]
===
null
?
''
:
params
[
key
],
}
}),
{},
)
)
}
}
}
function
setObjectKey
(
data
)
{
function
setObjectKey
(
data
)
{
return
(
return
Object
.
keys
(
data
).
reduce
(
Object
.
keys
(
data
)
(
acc
,
key
)
=>
({
.
reduce
(
...
acc
,
(
acc
,
key
)
=>
({
[
'${'
+
key
+
'}'
]:
data
[
key
]
===
null
?
''
:
data
[
key
],
...
acc
,
}),
[
'${'
+
key
+
'}'
]:
data
[
key
]
===
null
?
''
:
data
[
key
],
{},
}),
);
{},
)
);
}
}
/**
/**
* 修改对象key
* 修改对象key
* 支持对象、数组对象
* 支持对象、数组对象
* @param {*} obj 数组对象或者对象
* @param {*} obj 数组对象或者对象
* @param {*} setKey {
"被修改的key":"修改后的key"
}
* @param {*} setKey {
'被修改的key":"修改后的key'
}
* @returns
* @returns
*/
*/
export
function
upObjKey
(
obj
,
setKey
=
{},
defaultValue
=
""
)
{
export
function
upObjKey
(
obj
,
setKey
=
{},
defaultValue
=
''
)
{
try
{
try
{
obj
=
deepCopy
(
obj
);
obj
=
deepCopy
(
obj
);
setKey
=
deepCopy
(
setKey
);
setKey
=
deepCopy
(
setKey
);
let
objType
=
Object
.
prototype
.
toString
.
call
(
obj
);
let
objType
=
Object
.
prototype
.
toString
.
call
(
obj
);
if
(
obj
&&
(
objType
.
indexOf
(
"Array"
)
>
-
1
||
objType
.
indexOf
(
"Object"
)
>
-
1
)
&&
Object
.
keys
(
setKey
).
length
>
0
)
{
if
(
let
nowObj
=
null
;
obj
&&
if
(
objType
===
"[object Object]"
&&
!
Array
.
isArray
(
obj
)
&&
Object
.
keys
(
obj
).
length
>
0
)
{
(
objType
.
indexOf
(
'Array'
)
>
-
1
||
objType
.
indexOf
(
'Object'
)
>
-
1
)
&&
nowObj
=
deepCopy
(
obj
);
Object
.
keys
(
setKey
).
length
>
0
for
(
var
e
in
setKey
)
{
)
{
let
upKey
=
setKey
[
e
];
let
nowObj
=
null
;
let
{
newKey
=
e
,
type
,
timeFormat
}
=
getSetKeyValue
(
upKey
);
if
(
objType
===
'[object Object]'
&&
!
Array
.
isArray
(
obj
)
&&
Object
.
keys
(
obj
).
length
>
0
)
{
nowObj
=
{
nowObj
=
deepCopy
(
obj
);
...
nowObj
,
for
(
var
e
in
setKey
)
{
...
getSetKeyJson
({
let
upKey
=
setKey
[
e
];
obj
,
e
,
newKey
,
type
,
timeFormat
,
defaultValue
let
{
newKey
=
e
,
type
,
timeFormat
}
=
getSetKeyValue
(
upKey
);
})
nowObj
=
{
};
...
nowObj
,
if
(
e
!=
newKey
)
{
...
getSetKeyJson
({
delete
nowObj
[
e
];
obj
,
}
e
,
}
newKey
,
}
type
,
if
(
objType
===
"[object Array]"
&&
Array
.
isArray
(
obj
)
&&
obj
.
length
>
0
)
{
timeFormat
,
nowObj
=
new
Array
();
defaultValue
,
obj
.
forEach
((
v
,
i
,
arr
)
=>
{
}),
let
newJson
=
deepCopy
(
v
);
};
for
(
var
e
in
setKey
)
{
if
(
e
!=
newKey
)
{
let
upKey
=
setKey
[
e
];
delete
nowObj
[
e
];
let
{
newKey
=
e
,
type
,
timeFormat
}
=
getSetKeyValue
(
upKey
);
}
newJson
=
{
}
...
newJson
,
}
...
getSetKeyJson
({
if
(
objType
===
'[object Array]'
&&
Array
.
isArray
(
obj
)
&&
obj
.
length
>
0
)
{
obj
:
v
,
e
,
newKey
,
type
,
timeFormat
,
defaultValue
nowObj
=
new
Array
();
})
obj
.
forEach
((
v
,
i
,
arr
)
=>
{
};
let
newJson
=
deepCopy
(
v
);
if
(
e
!=
newKey
)
{
for
(
var
e
in
setKey
)
{
delete
newJson
[
e
];
let
upKey
=
setKey
[
e
];
}
let
{
newKey
=
e
,
type
,
timeFormat
}
=
getSetKeyValue
(
upKey
);
}
newJson
=
{
nowObj
.
push
(
newJson
);
...
newJson
,
})
...
getSetKeyJson
({
}
obj
:
v
,
return
nowObj
;
e
,
}
else
{
newKey
,
return
null
;
type
,
}
timeFormat
,
}
catch
(
error
)
{
defaultValue
,
console
.
log
(
"upObjKey"
,
error
);
}),
return
undefined
;
};
}
if
(
e
!=
newKey
)
{
delete
newJson
[
e
];
}
}
nowObj
.
push
(
newJson
);
});
}
return
nowObj
;
}
else
{
return
null
;
}
}
catch
(
error
)
{
console
.
log
(
'upObjKey'
,
error
);
return
undefined
;
}
}
}
function
getSetKeyValue
(
value
)
{
function
getSetKeyValue
(
value
)
{
let
valeuType
=
Object
.
prototype
.
toString
.
call
(
value
);
let
valeuType
=
Object
.
prototype
.
toString
.
call
(
value
);
let
newName
=
null
;
let
newName
=
null
;
let
extendJson
=
{
let
extendJson
=
{
"type"
:
"string"
type
:
'string'
,
};
};
if
(
valeuType
===
"[object String]"
)
{
if
(
valeuType
===
'[object String]'
)
{
newName
=
value
;
newName
=
value
;
}
}
if
(
valeuType
===
"[object Object]"
)
{
if
(
valeuType
===
'[object Object]'
)
{
newName
=
value
[
"new"
];
newName
=
value
[
'new'
];
delete
value
[
"new"
];
delete
value
[
'new'
];
extendJson
=
{
extendJson
=
{
...
extendJson
,
...
extendJson
,
...
value
...
value
,
};
};
}
}
return
{
return
{
newKey
:
newName
,
newKey
:
newName
,
...
extendJson
...
extendJson
,
}
};
}
}
function
getSetKeyJson
({
function
getSetKeyJson
({
obj
,
e
,
newKey
,
type
,
timeFormat
=
'YYYY-MM-DD HH:mm:ss'
,
defaultValue
})
{
obj
,
e
,
newKey
,
type
,
timeFormat
=
"YYYY-MM-DD HH:mm:ss"
,
defaultValue
obj
=
deepCopy
(
obj
);
})
{
let
value
=
obj
[
e
];
obj
=
deepCopy
(
obj
);
let
newKeyObj
=
{};
let
value
=
obj
[
e
];
// delete obj[e];
let
newKeyObj
=
{};
switch
(
type
)
{
// delete obj[e];
case
'time'
:
switch
(
type
)
{
debugger
;
case
"time"
:
newKeyObj
[
newKey
]
=
debugger
(
timeFormat
&&
value
?
moment
(
value
).
format
(
timeFormat
)
:
value
)
||
defaultValue
;
newKeyObj
[
newKey
]
=
(
timeFormat
&&
value
?
moment
(
value
).
format
(
timeFormat
)
:
value
)
||
defaultValue
;
break
;
break
;
default
:
default
:
newKeyObj
[
newKey
]
=
value
||
defaultValue
;
newKeyObj
[
newKey
]
=
value
||
defaultValue
;
}
}
return
newKeyObj
;
return
newKeyObj
;
}
}
// 下载附件FormdataWrapper
// 下载附件FormdataWrapper
function
isObject
(
value
)
{
function
isObject
(
value
)
{
return
value
===
Object
(
value
);
return
value
===
Object
(
value
);
}
}
function
isArray
(
value
)
{
function
isArray
(
value
)
{
return
Array
.
isArray
(
value
);
return
Array
.
isArray
(
value
);
}
}
function
isFile
(
value
)
{
function
isFile
(
value
)
{
return
value
instanceof
File
;
return
value
instanceof
File
;
}
}
function
makeArrayKey
(
key
)
{
function
makeArrayKey
(
key
)
{
return
key
;
return
key
;
}
}
function
FormdataWrapper
(
obj
,
fd
,
pre
)
{
function
FormdataWrapper
(
obj
,
fd
,
pre
)
{
fd
=
fd
||
new
FormData
();
fd
=
fd
||
new
FormData
();
Object
.
keys
(
obj
)
Object
.
keys
(
obj
).
forEach
(
function
(
prop
)
{
.
forEach
(
function
(
prop
)
{
var
key
=
pre
?
pre
+
'['
+
prop
+
']'
:
prop
;
var
key
=
pre
?
pre
+
'['
+
prop
+
']'
:
prop
;
if
(
isObject
(
obj
[
prop
])
&&
!
isArray
(
obj
[
prop
])
&&
!
isFile
(
obj
[
prop
]))
{
if
(
isObject
(
obj
[
prop
])
&&
!
isArray
(
obj
[
prop
])
&&
!
isFile
(
obj
[
prop
]))
{
FormdataWrapper
(
obj
[
prop
],
fd
,
key
);
FormdataWrapper
(
obj
[
prop
],
fd
,
key
);
}
else
if
(
isArray
(
obj
[
prop
]))
{
}
else
if
(
isArray
(
obj
[
prop
]))
{
obj
[
prop
].
forEach
(
function
(
value
)
{
obj
[
prop
].
forEach
(
function
(
value
)
{
var
arrayKey
=
makeArrayKey
(
key
);
var
arrayKey
=
makeArrayKey
(
key
);
if
(
isObject
(
value
)
&&
!
isFile
(
value
))
{
if
(
isObject
(
value
)
&&
!
isFile
(
value
))
{
FormdataWrapper
(
value
,
fd
,
arrayKey
);
FormdataWrapper
(
value
,
fd
,
arrayKey
);
}
else
{
}
else
{
fd
.
append
(
arrayKey
,
value
);
fd
.
append
(
arrayKey
,
value
);
}
}
});
});
}
else
{
}
else
{
if
(
obj
[
prop
]
!=
null
)
fd
.
append
(
key
,
obj
[
prop
]);
if
(
obj
[
prop
]
!=
null
)
fd
.
append
(
key
,
obj
[
prop
]);
}
}
});
});
return
fd
;
return
fd
;
}
}
export
async
function
downloadFile
(
url
,
params
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
)
{
export
async
function
downloadFile
(
url
,
params
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
)
{
// console.log("downloadFile",url);
// console.log("downloadFile",url);
const
{
transformApi
,
headersApi
}
=
await
getTransformApi
(
url
);
const
{
transformApi
,
headersApi
}
=
await
getTransformApi
(
url
);
let
headers
=
{
let
headers
=
{
Authorization
:
`bearer
${
localStorage
.
getItem
(
'antd-pro-token-onestop'
)}
`
,
Authorization
:
`bearer
${
localStorage
.
getItem
(
'antd-pro-token-onestop'
)}
`
,
};
};
// if(headersApi){
// if(headersApi){
// headers.apis = headersApi;
// headers.apis = headersApi;
// }
// }
fetch
(
transformApi
,
{
fetch
(
transformApi
,
{
method
:
'POST'
,
method
:
'POST'
,
body
:
FormdataWrapper
(
params
),
body
:
FormdataWrapper
(
params
),
headers
,
headers
,
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
status
+
''
!==
'200'
)
{
if
(
res
.
status
+
''
!==
'200'
)
{
return
res
.
json
();
return
res
.
json
();
}
else
{
}
else
{
return
res
.
blob
();
return
res
.
blob
();
}
}
})
})
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
if
(
data
instanceof
Blob
)
{
if
(
data
instanceof
Blob
)
{
let
a
=
document
.
createElement
(
'a'
);
let
a
=
document
.
createElement
(
'a'
);
let
url
=
window
.
URL
.
createObjectURL
(
data
);
let
url
=
window
.
URL
.
createObjectURL
(
data
);
let
filename
=
fileName
+
'.'
+
ext
;
let
filename
=
fileName
+
'.'
+
ext
;
a
.
href
=
url
;
a
.
href
=
url
;
a
.
download
=
filename
;
a
.
download
=
filename
;
a
.
target
=
'_blank'
;
a
.
target
=
'_blank'
;
a
.
click
();
a
.
click
();
window
.
URL
.
revokeObjectURL
(
url
);
window
.
URL
.
revokeObjectURL
(
url
);
a
=
null
;
a
=
null
;
}
else
{
}
else
{
}
}
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
log
(
err
);
console
.
log
(
err
);
})
})
.
finally
(()
=>
{
.
finally
(()
=>
{
return
true
;
return
true
;
});
});
}
}
export
async
function
downloadFileAndShowModal
(
url
,
params
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
)
{
export
async
function
downloadFileAndShowModal
(
url
,
params
,
fileName
=
'导出文件'
,
ext
=
'xlsx'
)
{
// console.log("downloadFile",url);
// console.log("downloadFile",url);
const
{
transformApi
,
headersApi
}
=
await
getTransformApi
(
url
);
const
{
transformApi
,
headersApi
}
=
await
getTransformApi
(
url
);
let
headers
=
{
let
headers
=
{
Authorization
:
`bearer
${
localStorage
.
getItem
(
'antd-pro-token-onestop'
)}
`
,
Authorization
:
`bearer
${
localStorage
.
getItem
(
'antd-pro-token-onestop'
)}
`
,
};
};
// if(headersApi){
// if(headersApi){
// headers.apis = headersApi;
// headers.apis = headersApi;
// }
// }
fetch
(
transformApi
,
{
fetch
(
transformApi
,
{
method
:
'POST'
,
method
:
'POST'
,
body
:
FormdataWrapper
(
params
),
body
:
FormdataWrapper
(
params
),
headers
,
headers
,
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
status
+
''
!==
'200'
)
{
if
(
res
.
status
+
''
!==
'200'
)
{
return
res
.
json
();
return
res
.
json
();
}
else
{
}
else
{
return
res
.
blob
();
return
res
.
blob
();
}
}
})
})
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
if
(
data
instanceof
Blob
)
{
if
(
data
instanceof
Blob
)
{
let
url
=
window
.
URL
.
createObjectURL
(
data
);
let
url
=
window
.
URL
.
createObjectURL
(
data
);
let
filename
=
fileName
+
'.'
+
ext
;
let
filename
=
fileName
+
'.'
+
ext
;
/**
/**
* 微软word 文档在线预览
* 微软word 文档在线预览
https://view.officeapps.live.com/op/view.aspx?src=
https://view.officeapps.live.com/op/view.aspx?src=
https%3A%2F%2Fwww.longchang.gov.cn%2Flcs%2Fgsgg%2F202207%2F3ae45ccac65d40d885f40ec385ae287a%2Ffiles%2F%25E9%259A%2586%25E6%2598%258C%25E5%25B8%2582%25E7%25AC%25AC%25E5%2585%25AB%25E4%25B8%25AD%25E5%25AD%25A6%25E5%258E%2595%25E6%2589%2580%25E6%2594%25B9%25E9%2580%25A0%25E9%25A1%25B9%25E7%259B%25AE%25E5%2585%25AC%25E5%2591%258A.doc&wdOrigin=BROWSELINK
https%3A%2F%2Fwww.longchang.gov.cn%2Flcs%2Fgsgg%2F202207%2F3ae45ccac65d40d885f40ec385ae287a%2Ffiles%2F%25E9%259A%2586%25E6%2598%258C%25E5%25B8%2582%25E7%25AC%25AC%25E5%2585%25AB%25E4%25B8%25AD%25E5%25AD%25A6%25E5%258E%2595%25E6%2589%2580%25E6%2594%25B9%25E9%2580%25A0%25E9%25A1%25B9%25E7%259B%25AE%25E5%2585%25AC%25E5%2591%258A.doc&wdOrigin=BROWSELINK
* */
* */
Modal
.
info
({
title
:
filename
,
width
:
1000
,
content
:
<
div
>
<
embed
width
=
'100%'
height
=
'568px'
name
=
'plugin'
id
=
'pdfView'
src
=
{
url
}
type
=
'application/pdf'
internalinstanceid
=
'3'
window
.
open
(
url
);
title
=
{
filename
}
/
>
return
;
<
/div>
,
Modal
.
info
({
okText
:
'确定'
,
title
:
filename
,
onCancel
:
()
=>
{
width
:
1000
,
window
.
URL
.
revokeObjectURL
(
url
);
content
:
(
},
<
div
>
onOk
:
()
=>
{
<
embed
window
.
URL
.
revokeObjectURL
(
url
);
width
=
"100%"
},
height
=
"568px"
});
name
=
"plugin"
}
else
{
id
=
"pdfView"
}
src
=
{
url
}
})
type
=
"application/pdf"
.
catch
((
err
)
=>
{
internalinstanceid
=
"3"
console
.
log
(
err
);
title
=
{
filename
}
})
/
>
.
finally
(()
=>
{
<
/div
>
return
true
;
),
});
okText
:
'确定'
,
onCancel
:
()
=>
{
window
.
URL
.
revokeObjectURL
(
url
);
},
onOk
:
()
=>
{
window
.
URL
.
revokeObjectURL
(
url
);
},
});
}
else
{
}
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
})
.
finally
(()
=>
{
return
true
;
});
}
}
one_stop_public/libs/formList/index.js
浏览文件 @
5fbdea9d
...
@@ -1456,7 +1456,8 @@ class FormList extends React.Component {
...
@@ -1456,7 +1456,8 @@ class FormList extends React.Component {
onSelectRow
=
{
this
.
handleSelectRows
}
onSelectRow
=
{
this
.
handleSelectRows
}
onChange
=
{
this
.
handleStandardTableChange
}
onChange
=
{
this
.
handleStandardTableChange
}
loading
=
{
loading
}
loading
=
{
loading
}
/
>
getCheckboxProps
=
{
this
.
props
.
getCheckboxProps
||
undefined
}
/
>
)}
)}
<
/div
>
<
/div
>
)
:
(
)
:
(
...
...
one_stop_public/tableCompon/FormModal.jsx
浏览文件 @
5fbdea9d
import
React
,
{
}
from
'react'
;
import
React
from
'react'
;
import
{
Button
}
from
'antd'
;
import
{
getModal
}
from
'@/webPublic/one_stop_public/utils/utils'
;
import
{
getModal
}
from
'@/webPublic/one_stop_public/utils/utils'
;
import
styles
from
'./style.less'
const
Modal
=
getModal
();
const
Modal
=
getModal
();
export
default
class
FormModal
extends
React
.
Component
{
export
default
class
FormModal
extends
React
.
Component
{
render
()
{
render
()
{
const
showFullScreen
=
()
=>
{
let
dom
=
document
.
getElementById
(
'smartFormModal'
);
dom
.
requestFullscreen
();
console
.
log
(
dom
);
};
return
(
return
(
<
Modal
<
Modal
bodyStyle=
{
{
bodyStyle=
{
{
maxHeight
:
'80vh'
,
maxHeight
:
'80vh'
,
overflowY
:
'auto'
,
overflowY
:
'auto'
,
}
}
}
}
{
...
this
.
props
}
{
...
this
.
props
}
destroyOnClose
destroyOnClose
title=
{
this
.
props
.
title
}
title=
{
this
.
props
.
title
}
maskClosable=
{
false
}
maskClosable=
{
false
}
...
@@ -19,7 +27,14 @@ export default class FormModal extends React.Component {
...
@@ -19,7 +27,14 @@ export default class FormModal extends React.Component {
visible=
{
this
.
props
.
visible
}
visible=
{
this
.
props
.
visible
}
footer=
{
null
}
footer=
{
null
}
onCancel=
{
this
.
props
.
handleCancel
}
>
onCancel=
{
this
.
props
.
handleCancel
}
>
{
this
.
props
.
children
}
{
this
.
props
.
showFullScreen
&&
(
<
Button
type=
{
'primary'
}
onClick=
{
showFullScreen
}
>
全屏查看
</
Button
>
)
}
<
div
id=
{
'smartFormModal'
}
className=
{
styles
.
fullScreen
}
>
{
this
.
props
.
children
}
</
div
>
</
Modal
>
</
Modal
>
);
);
}
}
...
...
one_stop_public/tableCompon/style.less
浏览文件 @
5fbdea9d
.fullScreen {
&:-webkit-full-screen {
width: 100%;
height: 100%;
padding: 100px;
background-color: #fff;
}
//&:div[data-page-formkey]{
// overflow: hidden;
//}
}
:global {
:global {
// table{
// table{
// border-collapse:collapse;
// border-collapse:collapse;
// }
// }
#web_table .ant-form-item {
#web_table .ant-form-item {
margin-bottom: 2.5px;
margin-bottom: 2.5px;
margin-top: 2.5px;
margin-top: 2.5px;
...
@@ -290,7 +305,8 @@
...
@@ -290,7 +305,8 @@
min-height: 50px;
min-height: 50px;
}
}
}
}
.bigTitle{
.bigTitle {
text-align: center;
text-align: center;
font-size: 18px;
font-size: 18px;
margin-bottom: 20px;
margin-bottom: 20px;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论