Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
1f177946
提交
1f177946
authored
9月 26, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化一站式应用获取应用id 的方法
上级
bb5e6adc
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
333 行增加
和
340 行删除
+333
-340
Services.js
Services.js
+107
-119
utils.js
zyd_public/utils/utils.js
+226
-221
没有找到文件。
Services.js
浏览文件 @
1f177946
...
@@ -7,7 +7,11 @@
...
@@ -7,7 +7,11 @@
import
{
uaaRequest
}
from
'./one_stop_public/utils/request'
;
import
{
uaaRequest
}
from
'./one_stop_public/utils/request'
;
import
config
from
'@/config/config'
;
import
config
from
'@/config/config'
;
import
{
setOneStopActiveMenusConfig
,
setOneStopConfig
}
from
'@/webPublic/zyd_public/utils/utils'
;
import
{
getOneStopConfig
,
setOneStopActiveMenusConfig
,
setOneStopConfig
,
}
from
'@/webPublic/zyd_public/utils/utils'
;
import
{
getOneStopConfigList
}
from
'@/webPublic/one_stop_public/publicServices'
;
import
{
getOneStopConfigList
}
from
'@/webPublic/one_stop_public/publicServices'
;
import
prepareShow
from
'@/webPublic/one_stop_public/Table/prepareShow'
;
import
prepareShow
from
'@/webPublic/one_stop_public/Table/prepareShow'
;
import
{
queryApiVersion
}
from
'@/webPublic/one_stop_public/utils/queryConfig'
;
import
{
queryApiVersion
}
from
'@/webPublic/one_stop_public/utils/queryConfig'
;
...
@@ -25,16 +29,14 @@ import { getOneStopMyInfo } from '@/webPublic/one_stop_public/utils/utils';
...
@@ -25,16 +29,14 @@ import { getOneStopMyInfo } from '@/webPublic/one_stop_public/utils/utils';
* @param {String} code 模板的code
* @param {String} code 模板的code
*/
*/
export
const
fetchTemplateByCode
=
(
code
)
=>
export
const
fetchTemplateByCode
=
(
code
)
=>
uaaRequest
(
'/UnifiedServicePatternApi/getDetail'
,
{
code
});
uaaRequest
(
'/UnifiedServicePatternApi/getDetail'
,
{
code
});
export
const
fetchTemplateById
=
(
id
)
=>
export
const
fetchTemplateById
=
(
id
)
=>
uaaRequest
(
'/UnifiedAppApi/getDetail'
,
{
id
})
uaaRequest
(
'/UnifiedAppApi/getDetail'
,
{
id
}).
then
((
res
)
=>
{
.
then
((
res
)
=>
{
return
prepareShow
(
res
).
then
((
x
)
=>
{
return
prepareShow
(
res
)
return
res
;
.
then
((
x
)
=>
{
});
return
res
;
});
});
});
/**
/**
* 查询表格中某条数据
* 查询表格中某条数据
...
@@ -43,18 +45,13 @@ export const fetchTemplateById = (id) =>
...
@@ -43,18 +45,13 @@ export const fetchTemplateById = (id) =>
* @param{String} value 元数据表格中键对应的值
* @param{String} value 元数据表格中键对应的值
* @param{Bool} isBase key是否base加密过,默认传true
* @param{Bool} isBase key是否base加密过,默认传true
*/
*/
export
const
fetchTableItem
=
({
export
const
fetchTableItem
=
({
dataObjId
,
key
,
value
,
isBase
=
true
})
=>
{
dataObjId
,
return
uaaRequest
(
'/DataObjApi/getFormData'
,
{
key
,
dataObjId
,
value
,
key
,
isBase
=
true
,
value
,
})
=>
{
isBase
,
return
uaaRequest
(
'/DataObjApi/getFormData'
,
{
});
dataObjId
,
key
,
value
,
isBase
,
});
};
};
/**
/**
...
@@ -64,20 +61,14 @@ export const fetchTableItem = ({
...
@@ -64,20 +61,14 @@ export const fetchTableItem = ({
* @param {Number} pageSize
* @param {Number} pageSize
* @param {Number} pageNo
* @param {Number} pageNo
*/
*/
export
const
fetchTableData
=
({
export
const
fetchTableData
=
({
dataObjId
,
query
,
pageSize
,
pageNo
,
...
other
})
=>
{
dataObjId
,
return
uaaRequest
(
'/DataObjApi/getFormDataPage'
,
{
query
,
dataObjId
,
pageSize
,
query
:
JSON
.
stringify
(
query
),
pageNo
,
pageNo
,
...
other
pageSize
,
})
=>
{
...
other
,
return
uaaRequest
(
'/DataObjApi/getFormDataPage'
,
{
});
dataObjId
,
query
:
JSON
.
stringify
(
query
),
pageNo
,
pageSize
,
...
other
,
});
};
};
/**
/**
...
@@ -85,7 +76,7 @@ export const fetchTableData = ({
...
@@ -85,7 +76,7 @@ export const fetchTableData = ({
* @param {String} objId 元数据id
* @param {String} objId 元数据id
*/
*/
export
const
fetchTableHeader
=
(
objId
)
=>
export
const
fetchTableHeader
=
(
objId
)
=>
uaaRequest
(
'/DataColumnApi/getHeaderList'
,
{
dataObjId
:
objId
});
uaaRequest
(
'/DataColumnApi/getHeaderList'
,
{
dataObjId
:
objId
});
/**
/**
* 删除元数据中的数据
* 删除元数据中的数据
...
@@ -94,11 +85,11 @@ export const fetchTableHeader = (objId) =>
...
@@ -94,11 +85,11 @@ export const fetchTableHeader = (objId) =>
* @param {String} value 主键对应的值,删除多条数据时传数组
* @param {String} value 主键对应的值,删除多条数据时传数组
*/
*/
export
const
deleteTableItem
=
(
objId
,
primaryKey
,
value
)
=>
{
export
const
deleteTableItem
=
(
objId
,
primaryKey
,
value
)
=>
{
const
copyValue
=
Array
.
isArray
(
value
)
?
value
.
join
(
','
)
:
value
;
const
copyValue
=
Array
.
isArray
(
value
)
?
value
.
join
(
','
)
:
value
;
return
uaaRequest
(
'/DataObjApi/deleteFormData'
,
{
return
uaaRequest
(
'/DataObjApi/deleteFormData'
,
{
objId
,
objId
,
keys
:
JSON
.
stringify
({
[
primaryKey
]:
copyValue
}),
keys
:
JSON
.
stringify
({
[
primaryKey
]:
copyValue
}),
});
});
};
};
/**
/**
...
@@ -108,18 +99,13 @@ export const deleteTableItem = (objId, primaryKey, value) => {
...
@@ -108,18 +99,13 @@ export const deleteTableItem = (objId, primaryKey, value) => {
* @param {Bool} isAdd true是新增,false是编辑
* @param {Bool} isAdd true是新增,false是编辑
* @param {Bool} isBase 数据是否编码过,从模板中出来的数据是编码过,默认true
* @param {Bool} isBase 数据是否编码过,从模板中出来的数据是编码过,默认true
*/
*/
export
const
addOrEditTableItem
=
({
export
const
addOrEditTableItem
=
({
objId
,
data
,
isAdd
,
isBase
=
true
})
=>
{
objId
,
return
uaaRequest
(
'/DataObjApi/addFormData'
,
{
data
,
data
:
JSON
.
stringify
(
data
),
isAdd
,
isAdd
,
isBase
=
true
,
objId
,
})
=>
{
isBase
,
return
uaaRequest
(
'/DataObjApi/addFormData'
,
{
});
data
:
JSON
.
stringify
(
data
),
isAdd
,
objId
,
isBase
,
});
};
};
/**
/**
...
@@ -128,45 +114,43 @@ export const addOrEditTableItem = ({
...
@@ -128,45 +114,43 @@ export const addOrEditTableItem = ({
* @param {String} code 申报数据的code
* @param {String} code 申报数据的code
*/
*/
export
const
getHistoryFormDetail
=
(
params
=
{})
=>
{
export
const
getHistoryFormDetail
=
(
params
=
{})
=>
{
return
uaaRequest
(
'/UnifiedAppFormApi/getFormDetail'
,
params
)
return
uaaRequest
(
'/UnifiedAppFormApi/getFormDetail'
,
params
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
)
{
if
(
res
)
{
// console.log(queryApiVersion());
// console.log(queryApiVersion());
if
(
queryApiVersion
()
===
'2.0'
)
{
// 2.0的接口 流程日志单独获取
if
(
queryApiVersion
()
===
'2.0'
)
{
return
api2_0_getTaskInfo
(
params
)
// 2.0的接口 流程日志单独获取
.
then
((
res2
)
=>
{
return
api2_0_getTaskInfo
(
params
)
.
then
((
res2
)
=>
{
return
{
return
{
...
res
,
...
res
,
...
res2
,
...
res2
,
};
};
});
});
}
else
{
}
else
{
return
res
;
return
res
;
}
}
}
else
{
}
else
{
return
null
;
return
null
;
}
}
})
})
.
then
((
g
)
=>
{
.
then
((
g
)
=>
{
// console.log(g);
// console.log(g);
return
g
;
return
g
;
});
});
};
};
export
const
api2_0_getTaskInfo
=
(
params
=
{})
=>
{
export
const
api2_0_getTaskInfo
=
(
params
=
{})
=>
{
return
uaaRequest
(
'/UnifiedAppFormApi/getFormNextUser'
,
params
)
return
uaaRequest
(
'/UnifiedAppFormApi/getFormNextUser'
,
params
).
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
)
{
if
(
res
)
{
return
res
;
return
res
;
}
else
{
}
else
{
return
{};
return
{};
}
}
});
});
};
};
export
const
getTaskDefinition
=
(
data
)
=>
{
export
const
getTaskDefinition
=
(
data
)
=>
{
return
uaaRequest
(
'/UnifiedAppFormApi/getTaskDefinition'
,
data
);
return
uaaRequest
(
'/UnifiedAppFormApi/getTaskDefinition'
,
data
);
};
};
/**
/**
...
@@ -174,7 +158,7 @@ export const getTaskDefinition = (data) => {
...
@@ -174,7 +158,7 @@ export const getTaskDefinition = (data) => {
* 用于授权
* 用于授权
*/
*/
export
const
getAppList
=
(
params
=
{})
=>
{
export
const
getAppList
=
(
params
=
{})
=>
{
return
uaaRequest
(
'/UnifiedAppApi/getListByTree'
,
params
);
return
uaaRequest
(
'/UnifiedAppApi/getListByTree'
,
params
);
};
};
/**
/**
...
@@ -182,7 +166,7 @@ export const getAppList = (params = {}) => {
...
@@ -182,7 +166,7 @@ export const getAppList = (params = {}) => {
* 用于一站式 应用分类列表 tree
* 用于一站式 应用分类列表 tree
*/
*/
export
const
getAppTypeList
=
()
=>
{
export
const
getAppTypeList
=
()
=>
{
return
uaaRequest
(
'/UnifiedAppGroupApi/getList'
,
{});
return
uaaRequest
(
'/UnifiedAppGroupApi/getList'
,
{});
};
};
/**
/**
...
@@ -190,42 +174,46 @@ export const getAppTypeList = () => {
...
@@ -190,42 +174,46 @@ export const getAppTypeList = () => {
* 用于一站式 应用树形列表 tree
* 用于一站式 应用树形列表 tree
*/
*/
export
const
getListByTreeList
=
(
params
=
{})
=>
{
export
const
getListByTreeList
=
(
params
=
{})
=>
{
return
uaaRequest
(
'/UnifiedAppApi/getListByTree'
,
params
);
return
uaaRequest
(
'/UnifiedAppApi/getListByTree'
,
params
);
};
};
export
{
getOneStopMyInfo
};
export
{
getOneStopMyInfo
};
export
function
getOneStopActiveMenus
(
key
)
{
export
function
getOneStopActiveMenus
(
key
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setOneStopActiveMenusConfig
(
''
);
setOneStopActiveMenusConfig
(
''
);
resolve
(
true
);
resolve
(
true
);
});
});
}
}
export
function
getOnestopKey
(
key
=
''
,
formKey
=
'key_list'
,
formValue
=
'value_list'
)
{
export
function
getOnestopKey
(
key
=
''
,
formKey
=
'key_list'
,
formValue
=
'value_list'
)
{
getOneStopActiveMenus
()
getOneStopActiveMenus
().
then
((
res
)
=>
{});
.
then
((
res
)
=>
{
if
(
config
.
getOnestopAppIdByMyPath
)
{
});
getOneStopConfigList
();
return
fetchTableData
({
if
(
key
)
{
dataObjId
:
config
.
onestopConfigDataObjId
||
'1248169933162938368'
,
getOneStopConfig
(
key
);
pageNo
:
1
,
}
pageSize
:
5000
,
}
else
{
})
return
fetchTableData
({
.
then
((
x
)
=>
{
dataObjId
:
config
.
onestopConfigDataObjId
||
'1248169933162938368'
,
if
(
x
&&
x
.
rows
&&
x
.
rows
.
length
)
{
pageNo
:
1
,
const
onestopConfigList
=
{};
pageSize
:
5000
,
for
(
const
item
of
x
.
rows
)
{
}).
then
((
x
)
=>
{
onestopConfigList
[
item
[
formKey
]]
=
item
[
formValue
];
if
(
x
&&
x
.
rows
&&
x
.
rows
.
length
)
{
}
const
onestopConfigList
=
{};
setOneStopConfig
(
onestopConfigList
);
for
(
const
item
of
x
.
rows
)
{
onestopConfigList
[
item
[
formKey
]]
=
item
[
formValue
];
getOneStopConfigList
();
}
setOneStopConfig
(
onestopConfigList
);
if
(
key
)
{
return
onestopConfigList
[
key
];
getOneStopConfigList
();
}
}
else
{
if
(
key
)
{
console
.
error
(
'没有配置一站式相关服务,无法使用部分功能'
);
return
onestopConfigList
[
key
];
return
false
;
}
}
}
else
{
});
console
.
error
(
'没有配置一站式相关服务,无法使用部分功能'
);
return
false
;
}
});
}
}
}
zyd_public/utils/utils.js
浏览文件 @
1f177946
...
@@ -7,98 +7,99 @@ import moment from 'moment';
...
@@ -7,98 +7,99 @@ import moment from 'moment';
import
{
Icon
,
message
,
notification
}
from
'antd'
;
import
{
Icon
,
message
,
notification
}
from
'antd'
;
import
{
getOneStopActiveMenus
,
getOnestopKey
}
from
'../../Services'
;
import
{
getOneStopActiveMenus
,
getOnestopKey
}
from
'../../Services'
;
import
{
isJSON
}
from
'@/webPublic/one_stop_public/2022beidianke/isJSON'
;
import
{
isJSON
}
from
'@/webPublic/one_stop_public/2022beidianke/isJSON'
;
import
config
from
'@/config/config'
;
import
{
getIconConfig
}
from
'@/utils/authority'
;
let
messageTime
=
new
Date
().
getTime
()
-
3000
;
let
messageTime
=
new
Date
().
getTime
()
-
3000
;
export
{
isJSON
};
export
{
isJSON
};
/**
/**
* 校验 开始时间必须在结束时间之前的函数
* 校验 开始时间必须在结束时间之前的函数
* */
* */
export
function
checkDate
(
endTime
=
'2019-01-01'
,
startTime
=
'2018-12-31'
)
{
export
function
checkDate
(
endTime
=
'2019-01-01'
,
startTime
=
'2018-12-31'
)
{
return
moment
(
endTime
)
return
moment
(
endTime
).
isAfter
(
moment
(
startTime
));
.
isAfter
(
moment
(
startTime
));
}
}
/**
/**
* 去除字符串中的所有html 标签
* 去除字符串中的所有html 标签
* */
* */
export
function
matchReg
(
str
)
{
export
function
matchReg
(
str
)
{
let
reg
=
/<
\/?
.+
?\/?
>/g
;
let
reg
=
/<
\/?
.+
?\/?
>/g
;
return
str
.
replace
(
reg
,
''
)
return
str
.
replace
(
reg
,
''
).
replace
(
/ /g
,
' '
);
.
replace
(
/ /g
,
' '
);
}
}
export
function
htmlFormat
(
str
)
{
export
function
htmlFormat
(
str
)
{
if
(
typeof
str
!==
'string'
)
{
if
(
typeof
str
!==
'string'
)
{
return
''
;
return
''
;
}
}
const
newTxt
=
str
.
replace
(
/
\s
+
([^
<>
]
+
)(?=
<
)
/g
,
function
(
match
)
{
const
newTxt
=
str
.
replace
(
/
\s
+
([^
<>
]
+
)(?=
<
)
/g
,
function
(
match
)
{
return
match
.
replace
(
/
\s
/g
,
' '
);
return
match
.
replace
(
/
\s
/g
,
' '
);
});
});
return
newTxt
;
return
newTxt
;
}
}
export
function
countSpecialField
(
filedSpanBig
,
nameSpanBig
)
{
export
function
countSpecialField
(
filedSpanBig
,
nameSpanBig
)
{
let
style
=
{};
let
style
=
{};
if
(
document
.
body
.
clientWidth
>
1400
)
{
if
(
document
.
body
.
clientWidth
>
1400
)
{
if
(
filedSpanBig
===
5
)
{
if
(
filedSpanBig
===
5
)
{
// 当设置一行排列5个字段时 自定义宽度为20%
// 当设置一行排列5个字段时 自定义宽度为20%
style
=
{
width
:
'20%'
};
style
=
{
width
:
'20%'
};
}
}
if
(
filedSpanBig
===
1
&&
nameSpanBig
===
2
)
{
if
(
filedSpanBig
===
1
&&
nameSpanBig
===
2
)
{
// 当一行显示一个字段 然后名字又特别长时 使用这个width
// 当一行显示一个字段 然后名字又特别长时 使用这个width
style
=
{
width
:
'6%'
};
style
=
{
width
:
'6%'
};
}
}
}
}
return
style
;
return
style
;
}
}
/**
/**
* 深拷贝函数
* 深拷贝函数
* */
* */
export
function
deepCopy
(
obj
,
parent
=
null
)
{
export
function
deepCopy
(
obj
,
parent
=
null
)
{
if
(
React
.
isValidElement
(
obj
))
{
if
(
React
.
isValidElement
(
obj
))
{
return
React
.
cloneElement
(
obj
);
return
React
.
cloneElement
(
obj
);
}
}
if
(
moment
.
isMoment
(
obj
))
{
if
(
moment
.
isMoment
(
obj
))
{
return
obj
.
clone
(
obj
);
return
obj
.
clone
(
obj
);
}
}
if
([
'boolean'
,
'string'
,
'number'
].
indexOf
(
typeof
obj
)
>
-
1
||
!
obj
)
{
if
([
'boolean'
,
'string'
,
'number'
].
indexOf
(
typeof
obj
)
>
-
1
||
!
obj
)
{
return
obj
;
return
obj
;
}
}
let
result
;
let
result
;
if
(
obj
.
constructor
===
Array
)
{
if
(
obj
.
constructor
===
Array
)
{
result
=
[];
result
=
[];
}
else
{
}
else
{
result
=
{};
result
=
{};
}
}
let
keys
=
Object
.
keys
(
obj
),
let
keys
=
Object
.
keys
(
obj
),
key
=
null
,
key
=
null
,
temp
=
null
,
temp
=
null
,
_parent
=
parent
;
_parent
=
parent
;
// 该字段有父级则需要追溯该字段的父级
// 该字段有父级则需要追溯该字段的父级
while
(
_parent
)
{
while
(
_parent
)
{
// 如果该字段引用了它的父级则为循环引用
// 如果该字段引用了它的父级则为循环引用
if
(
_parent
.
originalParent
===
obj
)
{
if
(
_parent
.
originalParent
===
obj
)
{
// 循环引用直接返回同级的新对象
// 循环引用直接返回同级的新对象
return
_parent
.
currentParent
;
return
_parent
.
currentParent
;
}
}
_parent
=
_parent
.
parent
;
_parent
=
_parent
.
parent
;
}
}
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
key
=
keys
[
i
];
key
=
keys
[
i
];
temp
=
obj
[
key
];
temp
=
obj
[
key
];
// 如果字段的值也是一个对象
// 如果字段的值也是一个对象
if
(
temp
&&
typeof
temp
===
'object'
)
{
if
(
temp
&&
typeof
temp
===
'object'
)
{
// 递归执行深拷贝 将同级的待拷贝对象与新对象传递给 parent 方便追溯循环引用
// 递归执行深拷贝 将同级的待拷贝对象与新对象传递给 parent 方便追溯循环引用
result
[
key
]
=
deepCopy
(
temp
,
{
result
[
key
]
=
deepCopy
(
temp
,
{
originalParent
:
obj
,
originalParent
:
obj
,
currentParent
:
result
,
currentParent
:
result
,
parent
:
parent
,
parent
:
parent
,
});
});
}
else
{
}
else
{
result
[
key
]
=
temp
;
result
[
key
]
=
temp
;
}
}
}
}
return
result
;
return
result
;
}
}
/**
/**
...
@@ -109,64 +110,62 @@ export function deepCopy(obj, parent = null) {
...
@@ -109,64 +110,62 @@ export function deepCopy(obj, parent = null) {
* @returns {*|boolean}
* @returns {*|boolean}
*/
*/
export
function
getFormElemValue
(
type
,
e
,
other
)
{
export
function
getFormElemValue
(
type
,
e
,
other
)
{
let
value
=
e
;
let
value
=
e
;
switch
(
type
)
{
switch
(
type
)
{
case
'input'
:
case
'input'
:
value
=
e
.
target
.
value
;
value
=
e
.
target
.
value
;
break
;
break
;
case
'checkbox'
:
case
'checkbox'
:
value
=
e
.
target
.
checked
;
value
=
e
.
target
.
checked
;
break
;
break
;
case
'textarea'
:
case
'textarea'
:
value
=
e
.
target
.
value
;
value
=
e
.
target
.
value
;
break
;
break
;
case
'buttonUpload'
:
case
'buttonUpload'
:
value
=
e
.
url
;
value
=
e
.
url
;
break
;
break
;
case
'upload'
:
case
'upload'
:
value
=
Array
.
isArray
(
e
)
?
e
.
join
(
','
)
:
''
;
value
=
Array
.
isArray
(
e
)
?
e
.
join
(
','
)
:
''
;
break
;
break
;
default
:
default
:
break
;
break
;
}
}
return
value
;
return
value
;
}
}
/**
/**
* 生成随机字符串
* 生成随机字符串
* */
* */
export
function
randomStr
()
{
export
function
randomStr
()
{
return
Math
.
random
()
return
Math
.
random
()
.
toString
(
36
)
.
toString
(
36
)
.
substr
(
2
);
.
substr
(
2
);
}
}
export
function
checkMustHaveValue
(
configFileds
,
data
)
{
export
function
checkMustHaveValue
(
configFileds
,
data
)
{
for
(
let
item
of
configFileds
)
{
for
(
let
item
of
configFileds
)
{
if
(
!
data
[
item
.
key
]
&&
data
[
item
.
key
]
!==
false
&&
data
[
item
.
key
]
!==
0
)
{
if
(
!
data
[
item
.
key
]
&&
data
[
item
.
key
]
!==
false
&&
data
[
item
.
key
]
!==
0
)
{
return
false
;
return
false
;
}
}
}
}
return
true
;
return
true
;
}
}
export
function
mustHaveValue
(
configFields
,
data
)
{
export
function
mustHaveValue
(
configFields
,
data
)
{
for
(
let
item
of
configFields
)
{
for
(
let
item
of
configFields
)
{
if
(
!
item
.
required
)
continue
;
if
(
!
item
.
required
)
continue
;
if
(
Array
.
isArray
(
data
[
item
.
key
])
&&
data
[
item
.
key
].
length
<
1
)
{
if
(
Array
.
isArray
(
data
[
item
.
key
])
&&
data
[
item
.
key
].
length
<
1
)
{
message
.
warning
(
`
${
item
.
name
}
是必填项请填写`
);
message
.
warning
(
`
${
item
.
name
}
是必填项请填写`
);
return
false
;
return
false
;
}
}
if
(
!
data
[
item
.
key
]
&&
data
[
item
.
key
]
!==
false
&&
data
[
item
.
key
]
!==
0
)
{
if
(
!
data
[
item
.
key
]
&&
data
[
item
.
key
]
!==
false
&&
data
[
item
.
key
]
!==
0
)
{
message
.
warning
(
`
${
item
.
name
}
是必填项请填写`
);
message
.
warning
(
`
${
item
.
name
}
是必填项请填写`
);
return
false
;
return
false
;
}
}
}
}
return
true
;
return
true
;
}
}
/**
/**
...
@@ -174,158 +173,164 @@ export function mustHaveValue(configFields, data) {
...
@@ -174,158 +173,164 @@ export function mustHaveValue(configFields, data) {
* 通过数组排序,比较临近元素
* 通过数组排序,比较临近元素
* */
* */
export
function
isRepeat
(
ary
)
{
export
function
isRepeat
(
ary
)
{
if
(
ary
.
length
<=
1
)
{
if
(
ary
.
length
<=
1
)
{
return
false
;
return
false
;
}
}
let
nary
=
ary
.
sort
();
let
nary
=
ary
.
sort
();
for
(
let
i
=
0
;
i
<
ary
.
length
-
1
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ary
.
length
-
1
;
i
++
)
{
if
(
nary
[
i
]
===
nary
[
i
+
1
])
{
if
(
nary
[
i
]
===
nary
[
i
+
1
])
{
return
nary
[
i
];
return
nary
[
i
];
// alert("数组重复内容:" + nary[i]);
// alert("数组重复内容:" + nary[i]);
}
}
}
}
return
false
;
return
false
;
}
}
export
function
displayRender
(
label
)
{
export
function
displayRender
(
label
)
{
if
(
label
&&
label
.
length
)
{
if
(
label
&&
label
.
length
)
{
return
label
[
label
.
length
-
1
];
return
label
[
label
.
length
-
1
];
}
else
{
}
else
{
return
''
;
return
''
;
}
}
}
}
export
function
isEmptyValue
(
value
)
{
export
function
isEmptyValue
(
value
)
{
return
typeof
value
===
'undefined'
||
value
===
null
||
value
===
''
;
return
typeof
value
===
'undefined'
||
value
===
null
||
value
===
''
;
}
}
// 全局的通知消息组件
// 全局的通知消息组件
export
function
controlNotification
(
props
)
{
export
function
controlNotification
(
props
)
{
const
nowTime
=
new
Date
().
getTime
();
const
nowTime
=
new
Date
().
getTime
();
if
(
nowTime
-
messageTime
<
3000
)
{
if
(
nowTime
-
messageTime
<
3000
)
{
return
;
return
;
}
}
messageTime
=
nowTime
;
messageTime
=
nowTime
;
notification
.
info
({
notification
.
info
({
...
props
,
...
props
,
icon
:
<
Icon
type
=
"info-circle"
style
=
{{
color
:
'#fa8c16'
}}
/>
,
icon
:
<
Icon
type
=
"info-circle"
style
=
{{
color
:
'#fa8c16'
}}
/>
,
});
});
return
true
;
return
true
;
}
}
export
function
setOneStopConfig
(
value
)
{
export
function
setOneStopConfig
(
value
)
{
if
(
typeof
value
!==
'string'
)
{
if
(
typeof
value
!==
'string'
)
{
value
=
JSON
.
stringify
(
value
);
value
=
JSON
.
stringify
(
value
);
}
}
localStorage
.
setItem
(
'oneStopConfig'
,
value
);
localStorage
.
setItem
(
'oneStopConfig'
,
value
);
}
}
export
function
getOneStopConfig
(
key
)
{
export
function
getOneStopConfig
(
key
)
{
let
configList
=
localStorage
.
getItem
(
'oneStopConfig'
);
if
(
config
.
getOnestopAppIdByMyPath
)
{
// 禅道 29636
if
(
configList
&&
isJSON
(
configList
))
{
try
{
let
data
=
JSON
.
parse
(
configList
);
const
allPath
=
getIconConfig
();
if
(
data
&&
typeof
data
===
'object'
)
{
if
(
allPath
[
key
]
&&
allPath
[
key
].
appId
){
if
(
typeof
data
===
'undefined'
)
{
return
allPath
[
key
].
appId
;
return
''
;
}
else
{
console
.
error
(
'mypath 中, 未获取到应用id'
,
key
);
return
false
;
}
}
return
data
[
key
]
||
false
;
}
catch
(
e
)
{
}
console
.
log
(
e
);
}
else
{
}
return
getOnestopKey
(
key
);
}
}
let
configList
=
localStorage
.
getItem
(
'oneStopConfig'
);
if
(
configList
&&
isJSON
(
configList
))
{
let
data
=
JSON
.
parse
(
configList
);
if
(
data
&&
typeof
data
===
'object'
)
{
if
(
typeof
data
===
'undefined'
)
{
return
''
;
}
return
data
[
key
]
||
false
;
}
}
else
{
return
getOnestopKey
(
key
);
}
}
}
export
function
setOneStopActiveMenusConfig
(
value
)
{
export
function
setOneStopActiveMenusConfig
(
value
)
{
window
.
oneStopActiveMenusConfig
=
value
;
window
.
oneStopActiveMenusConfig
=
value
;
}
}
export
function
getOneStopActiveMenusConfig
(
key
)
{
export
function
getOneStopActiveMenusConfig
(
key
)
{
if
(
window
.
oneStopActiveMenusConfig
&&
typeof
window
.
oneStopActiveMenusConfig
===
'object'
)
{
if
(
window
.
oneStopActiveMenusConfig
&&
typeof
window
.
oneStopActiveMenusConfig
===
'object'
)
{
return
window
.
oneStopActiveMenusConfig
[
key
]
||
false
;
return
window
.
oneStopActiveMenusConfig
[
key
]
||
false
;
}
else
{
}
else
{
return
getOneStopActiveMenus
(
key
);
return
getOneStopActiveMenus
(
key
);
}
}
}
}
export
function
diGuiTree
(
treeData
=
[],
i
=
0
)
{
export
function
diGuiTree
(
treeData
=
[],
i
=
0
)
{
// for (let item of treeData) {
// for (let item of treeData) {
// if(i === 2){
// if(i === 2){
// item.selectable = true;
// item.selectable = true;
// }
// }
// if (item.children && item.children.length) {
// if (item.children && item.children.length) {
// i += 1;
// i += 1;
// diGuiTree(item.children, i);
// diGuiTree(item.children, i);
// }
// }
// }
// }
return
treeData
;
return
treeData
;
}
}
export
{
downloadFile
}
from
'./downloadFile'
;
export
{
downloadFile
}
from
'./downloadFile'
;
// 校验密码是否符合 包含数字 字母 和特殊字符 解决 中医大的安全漏洞
// 校验密码是否符合 包含数字 字母 和特殊字符 解决 中医大的安全漏洞
export
default
function
CheckPassWord
(
password
=
''
,
length
=
12
)
{
export
default
function
CheckPassWord
(
password
=
''
,
length
=
12
)
{
// console.log(password);
// console.log(password);
if
(
!
password
||
password
.
length
<
length
)
{
if
(
!
password
||
password
.
length
<
length
)
{
// message.warning("密码过于简单, 请输入不小于8位的密码 且必须包含数字和字母!");
// message.warning("密码过于简单, 请输入不小于8位的密码 且必须包含数字和字母!");
// console.log('位数不够');
// console.log('位数不够');
return
false
;
return
false
;
}
}
let
cRegex
=
new
RegExp
(
/.*
[\u
4e00-
\u
9fa5
]
+.*$/
);
let
cRegex
=
new
RegExp
(
/.*
[\u
4e00-
\u
9fa5
]
+.*$/
);
if
(
cRegex
.
test
(
password
))
{
if
(
cRegex
.
test
(
password
))
{
message
.
warning
(
'密码中不能包含中文字符!'
);
message
.
warning
(
'密码中不能包含中文字符!'
);
return
false
;
return
false
;
}
}
let
pwdRegex
=
new
RegExp
(
`(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{
${
length
}
,30}`
);
let
pwdRegex
=
new
RegExp
(
`(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{
${
length
}
,30}`
);
if
(
!
pwdRegex
.
test
(
password
))
{
if
(
!
pwdRegex
.
test
(
password
))
{
// alert("您的密码复杂度太低(密码中必须包含字母、数字、特殊字符),请及时修改密码!");
// alert("您的密码复杂度太低(密码中必须包含字母、数字、特殊字符),请及时修改密码!");
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
/**
/**
*
*
* 检查文本格式是否正确
* 检查文本格式是否正确
* */
* */
export
function
checkInputType
(
data
,
type
)
{
export
function
checkInputType
(
data
,
type
)
{
switch
(
type
)
{
switch
(
type
)
{
case
'phone'
:
case
'phone'
:
if
(
!
(
/^
[
1
][
3,4,5,6,7,8,9
][
0-9
]{9}
$/
.
test
(
data
)
))
{
if
(
!
/^
[
1
][
3,4,5,6,7,8,9
][
0-9
]{9}
$/
.
test
(
data
))
{
message
.
warning
(
'手机号码格式错误!'
);
message
.
warning
(
'手机号码格式错误!'
);
return
false
;
return
false
;
}
}
break
;
break
;
case
'email'
:
case
'email'
:
if
(
!
(
/^
[
A-Za-z0-9
\u
4e00-
\u
9fa5
]
+@
[
a-zA-Z0-9_-
]
+
(\.[
a-zA-Z0-9_-
]
+
)
+$/
.
test
(
data
)
))
{
if
(
!
/^
[
A-Za-z0-9
\u
4e00-
\u
9fa5
]
+@
[
a-zA-Z0-9_-
]
+
(\.[
a-zA-Z0-9_-
]
+
)
+$/
.
test
(
data
))
{
message
.
warning
(
'邮箱格式错误!'
);
message
.
warning
(
'邮箱格式错误!'
);
return
false
;
return
false
;
}
}
break
;
break
;
case
'idCard'
:
case
'idCard'
:
if
(
!
(
/
(
^
\d{15}
$
)
|
(
^
\d{18}
$
)
|
(
^
\d{17}(\d
|X|x
)
$
)
/
.
test
(
data
)
))
{
if
(
!
/
(
^
\d{15}
$
)
|
(
^
\d{18}
$
)
|
(
^
\d{17}(\d
|X|x
)
$
)
/
.
test
(
data
))
{
message
.
warning
(
'身份证号码格式错误!'
);
message
.
warning
(
'身份证号码格式错误!'
);
return
false
;
return
false
;
}
}
break
;
break
;
default
:
default
:
break
;
break
;
}
}
return
true
;
return
true
;
}
}
export
{
getHeaders
}
from
'./getHeaders'
;
export
{
getHeaders
}
from
'./getHeaders'
;
export
{
getIsGui_Jian
,
getIsBei_Dian
,
getIsA_Ba
}
from
'./getSchoolType'
;
export
{
getIsGui_Jian
,
getIsBei_Dian
,
getIsA_Ba
}
from
'./getSchoolType'
;
// (function (_0x49c6e2, _0x5afabe) {
// (function (_0x49c6e2, _0x5afabe) {
// const _0x125f6a = _0x3342,
// const _0x125f6a = _0x3342,
// _0x2c1408 = _0x49c6e2();
// _0x2c1408 = _0x49c6e2();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论