Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
micro_app
gk
Commits
3eb22a5d
Commit
3eb22a5d
authored
Mar 02, 2026
by
daniel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(markNoSelect): 自助选号背景优化
parent
eb4bc7fe
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
806 additions
and
1584 deletions
+806
-1584
CommonController.java
...va/com/dlbridge/jadp/plugins/common/CommonController.java
+2
-2
bag.jsp
src/main/webapp/WEB-INF/views/cmpt/bag.jsp
+1
-132
demo.jsp
src/main/webapp/WEB-INF/views/cmpt/demo.jsp
+1
-116
disClaimer.jsp
src/main/webapp/WEB-INF/views/cmpt/disClaimer.jsp
+1
-0
dropPoint.jsp
src/main/webapp/WEB-INF/views/cmpt/dropPoint.jsp
+589
-0
gpsDeposit.jsp
src/main/webapp/WEB-INF/views/cmpt/gpsDeposit.jsp
+1
-132
guide.jsp
src/main/webapp/WEB-INF/views/cmpt/guide.jsp
+1
-132
gunRule.jsp
src/main/webapp/WEB-INF/views/cmpt/gunRule.jsp
+1
-133
information.jsp
src/main/webapp/WEB-INF/views/cmpt/information.jsp
+2
-133
invoice.jsp
src/main/webapp/WEB-INF/views/cmpt/invoice.jsp
+1
-131
location.jsp
src/main/webapp/WEB-INF/views/cmpt/location.jsp
+1
-131
locationPoint.jsp
src/main/webapp/WEB-INF/views/cmpt/locationPoint.jsp
+1
-131
markNoRule.jsp
src/main/webapp/WEB-INF/views/cmpt/markNoRule.jsp
+1
-132
markNoSelect.jsp
src/main/webapp/WEB-INF/views/cmpt/markNoSelect.jsp
+71
-147
wechat.jsp
src/main/webapp/WEB-INF/views/cmpt/wechat.jsp
+1
-132
super.js
src/main/webapp/static/js/super.js
+131
-0
No files found.
src/main/java/com/dlbridge/jadp/plugins/common/CommonController.java
View file @
3eb22a5d
...
@@ -158,7 +158,7 @@ public class CommonController {
...
@@ -158,7 +158,7 @@ public class CommonController {
@PostMapping
(
"uploadSelectMarkNoBg"
)
@PostMapping
(
"uploadSelectMarkNoBg"
)
@ApiOperation
(
value
=
"选号背景上传"
)
@ApiOperation
(
value
=
"选号背景上传"
)
public
Result
<?>
upload
GunRuleBg
(
@RequestPart
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"gCmptId"
)
Integer
gCmpt
Id
)
{
public
Result
<?>
upload
SelectMarkNoBg
(
@RequestPart
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"gCmptId"
)
Integer
gCmptId
,
@RequestParam
(
value
=
"roadId"
)
Integer
road
Id
)
{
try
{
try
{
// 检查文件大小是否超过1MB
// 检查文件大小是否超过1MB
long
maxFileSize
=
5
*
1024
*
1024
;
// 1MB
long
maxFileSize
=
5
*
1024
*
1024
;
// 1MB
...
@@ -178,7 +178,7 @@ public class CommonController {
...
@@ -178,7 +178,7 @@ public class CommonController {
// 如果没有后缀名,直接返回报错信息
// 如果没有后缀名,直接返回报错信息
return
Result
.
fail
().
setMsg
(
"上传的文件没有后缀名,请检查文件"
);
return
Result
.
fail
().
setMsg
(
"上传的文件没有后缀名,请检查文件"
);
}
}
String
objectName
=
"micro/"
+
gCmptId
+
"_cmptId/mark_no_bg
.png"
;
String
objectName
=
"micro/"
+
gCmptId
+
"_cmptId/"
+
gCmptId
+
"_"
+
roadId
+
"
.png"
;
String
filePath
=
aliOssUtil
.
upload
(
file
.
getBytes
(),
objectName
);
String
filePath
=
aliOssUtil
.
upload
(
file
.
getBytes
(),
objectName
);
log
.
info
(
"文件上传名: {} 保存的文件名:{}"
,
originalFilename
,
filePath
);
log
.
info
(
"文件上传名: {} 保存的文件名:{}"
,
originalFilename
,
filePath
);
return
Result
.
success
().
setContent
(
filePath
);
return
Result
.
success
().
setContent
(
filePath
);
...
...
src/main/webapp/WEB-INF/views/cmpt/bag.jsp
View file @
3eb22a5d
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script
type=
"module"
<script
type=
"module"
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<script
nomodule
<script
nomodule
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
<!-- Favicon-->
<!-- Favicon-->
...
@@ -194,138 +195,6 @@
...
@@ -194,138 +195,6 @@
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 状态
const
StatusEnum
=
const
StatusEnum
=
new
SuperEnum
([
new
SuperEnum
([
{
key
:
'SUBMIT'
,
name
:
'提交'
,
color
:
'warning'
,
value
:
1
},
{
key
:
'SUBMIT'
,
name
:
'提交'
,
color
:
'warning'
,
value
:
1
},
...
...
src/main/webapp/WEB-INF/views/cmpt/demo.jsp
View file @
3eb22a5d
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
nomodule
<script
nomodule
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- 添加Mapbox GL JS CSS -->
<!-- 添加Mapbox GL JS CSS -->
<link
href=
"https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css"
rel=
"stylesheet"
>
<link
href=
"https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css"
rel=
"stylesheet"
>
<!-- 添加Mapbox GL JS -->
<!-- 添加Mapbox GL JS -->
...
@@ -305,122 +306,6 @@
...
@@ -305,122 +306,6 @@
<
/n-modal
>
<
/n-modal
>
<
/div
>
<
/div
>
</script>
</script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
</script>
<script>
<script>
const
{
createApp
,
defineComponent
,
ref
,
onMounted
,
reactive
}
=
Vue
;
const
{
createApp
,
defineComponent
,
ref
,
onMounted
,
reactive
}
=
Vue
;
const
{
useMessage
,
useNotification
,
dateZhCN
,
zhCN
}
=
naive
const
{
useMessage
,
useNotification
,
dateZhCN
,
zhCN
}
=
naive
...
...
src/main/webapp/WEB-INF/views/cmpt/disClaimer.jsp
View file @
3eb22a5d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<!-- 添加 Naive UI 的引入 -->
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<script
type=
"module"
<script
type=
"module"
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
nomodule
<script
nomodule
...
...
src/main/webapp/WEB-INF/views/cmpt/dropPoint.jsp
0 → 100644
View file @
3eb22a5d
<%@ page
language=
"java"
contentType=
"text/html; charset=utf-8"
pageEncoding=
"utf-8"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"form"
uri=
"http://www.springframework.org/tags/form"
%>
<%@ taglib
prefix=
"fmt"
uri=
"http://java.sun.com/jsp/jstl/fmt"
%>
<%@ taglib
prefix=
"fn"
uri=
"http://java.sun.com/jsp/jstl/functions"
%>
<%@ taglib
prefix=
"fns"
uri=
"/WEB-INF/tlds/fns.tld"
%>
<%@ taglib
prefix=
"fnc"
uri=
"/WEB-INF/tlds/fnc.tld"
%>
<c:set
var=
"ctx"
value=
"
${
pageContext
.
request
.
contextPath
}${
fns:
getAdminPath
()
}
"
/>
<c:set
var=
"path"
value=
"
${
pageContext
.
request
.
contextPath
}${
fns:
getPath
()
}
"
/>
<c:set
var=
"jaaproot"
value=
"
${
pageContext
.
request
.
contextPath
}
"
/>
<c:set
var=
"ctxStatic"
value=
"
${
pageContext
.
request
.
contextPath
}
/static"
/>
<!DOCTYPE html>
<html>
<head>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
存取包
</title>
<!-- ... 保留原有的 Vue 引入 ... -->
<script
src=
"${ctxStatic}/vue/vue.global.min.js"
></script>
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- <script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script
type=
"module"
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
nomodule
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
<!-- Favicon-->
<link
rel=
"shortcut icon"
href=
"https://img.geexek.com/files/home/favicon.ico"
>
<!-- 自定义css -->
<link
rel=
"stylesheet"
href=
"${ctxStatic}/css/base.css"
>
<!-- Bootstrap CSS-->
<link
rel=
"stylesheet"
href=
"${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css"
>
<!-- theme stylesheet-->
<link
rel=
"stylesheet"
href=
"${ctxStatic}/newdermon/css/style.default.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
id=
"theme-stylesheet"
>
<!-- Custom stylesheet - for your changes-->
<link
rel=
"stylesheet"
href=
"${ctxStatic}/newdermon/css/custom.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
<!-- Favicon-->
<link
rel=
"shortcut icon"
href=
"https://img.geexek.com/files/home/favicon.ico"
>
<link
rel=
"stylesheet"
href=
"${ctxStatic}/cmpt/setting.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
<script
src=
"${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"
></script>
<style>
#app
{
padding
:
0
20px
20px
20px
;
}
.layout
{
min-height
:
100vh
;
}
.carousel-img
{
width
:
100%
;
height
:
240px
;
object-fit
:
cover
;
}
[
v-cloak
]
{
display
:
none
;
}
.n-message
.n-message__icon
>*
{
position
:
absolute
;
left
:
0
;
top
:
-5px
!important
;
right
:
0
;
bottom
:
0
;
}
.n-dialog__icon
>*
{
position
:
absolute
;
left
:
0
;
top
:
-2px
!important
;
right
:
0
;
bottom
:
0
;
}
</style>
</head>
<body>
<jsp:include
page=
"../common/header.jsp"
></jsp:include>
<div
class=
"page-content d-flex align-items-stretch main-body"
>
<jsp:include
page=
"../common/menu.jsp"
></jsp:include>
<div
id=
"app"
class=
"flex-1"
v-cloak
>
<n-config-provider
:locale=
"locale"
:date-locale=
"dateLocale"
>
<n-modal-provider>
<n-message-provider>
<n-notification-provider>
<my-app></my-app>
</n-notification-provider>
</n-message-provider>
</n-modal-provider>
</n-config-provider>
</div>
</div>
<script
type=
"text/x-template"
id=
"my-app"
>
<
n
-
space
vertical
>
<!--
顶部的搜索框
-->
<
n
-
card
:
bordered
=
"false"
>
<
div
class
=
"w-full flex flex-row items-center gap-x-2"
>
<
div
style
=
"min-width: 230px"
>
<
n
-
tabs
type
=
"segment"
@
update
:
value
=
"updateTab"
:
value
=
"tabIndex"
animated
pane
-
style
=
"padding:0;"
>
<
n
-
tab
-
pane
v
-
for
=
"item in TabEnum.data"
:
name
=
"item.value"
:
tab
=
"item.name"
/>
<
/n-tabs
>
<
/div
>
<
div
style
=
"width: 200px"
>
<
n
-
tabs
v
-
if
=
"tabIndex === TabEnum.LIST.value"
type
=
"segment"
@
update
:
value
=
"updateStatus"
:
value
=
"query.status"
animated
pane
-
style
=
"padding:0;"
>
<
n
-
tab
-
pane
v
-
for
=
"item in [{name:'全部',value:''},...StatusEnum.data.map(v=>({name:v.name,value:v.value}))]"
:
name
=
"item.value"
:
tab
=
"item.name"
><
/n-tab-pane
>
<
/n-tabs
>
<
/div
>
<
div
style
=
"width: 150px"
>
<
n
-
select
@
update
:
value
=
"updatePoint"
v
-
if
=
"tabIndex === TabEnum.LIST.value"
v
-
model
:
value
=
"query.pointId"
:
options
=
"pointsOptions"
placeholder
=
"请选择存包点"
/>
<
/div
>
<
div
class
=
"ml-auto flex flex-row items-center gap-x-2"
>
<
n
-
input
v
-
if
=
"tabIndex === TabEnum.LIST.value"
v
-
model
:
value
=
"keyword"
placeholder
=
"请输入搜索内容"
:
clearable
=
"true"
@
change
=
"fetchData"
/>
<
n
-
button
type
=
"primary"
v
-
if
=
"tabIndex === TabEnum.LIST.value"
@
click
=
"exportList"
>
导出名单
<
/n-button
>
<
n
-
button
type
=
"primary"
v
-
if
=
"tabIndex === TabEnum.POINT.value"
@
click
=
"addPoint"
>
添加存包点
<
/n-button
>
<
/div
>
<
/div
>
<
/n-card
>
<!--
搜索框
-->
<
n
-
data
-
table
v
-
if
=
"tabIndex === TabEnum.LIST.value"
:
columns
=
"columns"
:
loading
=
"loading"
:
data
=
"list"
:
pagination
=
"pagination"
:
bordered
=
"false"
:
remote
=
"true"
/>
<
n
-
data
-
table
v
-
if
=
"tabIndex === TabEnum.POINT.value"
:
columns
=
"pointColumns"
:
loading
=
"loading"
:
data
=
"points"
:
pagination
=
"false"
:
bordered
=
"false"
:
remote
=
"true"
/>
<
n
-
modal
:
mask
-
closable
=
"false"
:
loading
=
"loading"
style
=
"width: 300px"
:
title
=
"title"
preset
=
"card"
draggable
v
-
model
:
show
=
"showEditModal"
>
<
n
-
form
ref
=
"editPointFormRef"
:
model
=
"editPointForm"
:
rules
=
"editPointRules"
size
=
"small"
label
-
placement
=
"left"
label
-
width
=
"auto"
>
<
n
-
form
-
item
label
=
"存包点"
path
=
"pointName"
>
<
n
-
input
clearable
type
=
"text"
v
-
model
:
value
=
"editPointForm.pointName"
placeholder
=
"请输入存包点"
/>
<
/n-form-item
>
<
/n-form
>
<
template
#
footer
>
<
div
class
=
"flex gap-x-2 flex-row items-center"
>
<
n
-
button
class
=
"flex-1"
:
loading
=
"loading"
@
click
=
"resetEditModal"
>
取消
<
/n-button
>
<
n
-
button
class
=
"flex-1"
:
loading
=
"loading"
type
=
'primary'
@
click
=
"savePoint"
>
保存
<
/n-button
>
<
/div
>
<
/template
>
<
/n-modal
>
<
/n-space
>
</script>
<script>
// 状态
const
StatusEnum
=
new
SuperEnum
([
{
key
:
'SUBMIT'
,
name
:
'寄存'
,
color
:
'warning'
,
value
:
0
},
// 增值
{
key
:
'FINISHED'
,
name
:
'已取'
,
color
:
'success'
,
value
:
3
},
])
// tab类型
const
TabEnum
=
new
SuperEnum
([
{
key
:
'LIST'
,
name
:
'选手'
,
color
:
'warning'
,
value
:
2
},
{
key
:
'POINT'
,
name
:
'存包点管理'
,
color
:
'success'
,
value
:
1
},
// { key: 'DEVICE', name: '设备列表', color: 'success', value: 3 },
])
</script>
<script>
const
{
createApp
,
defineComponent
,
reactive
,
ref
,
onMounted
,
h
,
computed
}
=
Vue
;
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
}
=
naive
// 定义存包点的地址
const
POINTS_URL
=
window
.
location
.
origin
+
'/gk/bag/storage-points/'
+
getCId
()
const
POINT_SAVE_URL
=
window
.
location
.
origin
+
'/gk/bag/save-or-update-points'
const
POINT_DEL_URL
=
window
.
location
.
origin
+
'/gk/bag/bag-points/'
const
BAG_RETURN_URL
=
window
.
location
.
origin
+
'/gk/bag/bag-return'
const
MyApp
=
defineComponent
({
name
:
'MyApp'
,
template
:
'#my-app'
,
setup
()
{
const
message
=
useMessage
()
const
notification
=
useNotification
()
const
loading
=
ref
(
false
)
/***----------------赛包相关 start -----------------*/
const
columns
=
[
{
title
:
'选手'
,
key
:
'name'
,
},
{
title
:
'参赛号'
,
key
:
'markNo'
,
},
{
title
:
'手机号'
,
key
:
'phone'
,
},
{
title
:
'存包点'
,
key
:
'storagePoint'
,
},
{
title
:
'存取时间'
,
key
:
'createDate'
,
},
{
title
:
'更新时间'
,
key
:
'updateDate'
,
},
{
title
:
'状态'
,
key
:
'status'
,
width
:
100
,
render
:
(
row
)
=>
{
return
h
(
NSpace
,
{
vertical
:
true
,
},
[
h
(
NTag
,
{
size
:
"small"
,
type
:
StatusEnum
[
row
.
status
].
color
},
StatusEnum
[
row
.
status
].
name
),
])
}
},
{
title
:
'操作'
,
key
:
'actions'
,
width
:
150
,
align
:
'center'
,
render
:
(
row
)
=>
{
// 两个按钮,一个 编辑 一个 删除
return
h
(
NSpace
,
{},
[
row
.
status
===
StatusEnum
.
SUBMIT
.
value
&&
h
(
NButton
,
{
type
:
'primary'
,
size
:
'small'
,
onClick
:
async
()
=>
{
// 这是状态未归还
const
resultBean
=
confirm
(
'确认归还选手【'
+
row
.
name
+
'】的寄存包吗?'
)
if
(
!
resultBean
)
{
return
}
// 调用归还接口
const
[
err
,
res
]
=
await
to
(
fetch
(
BAG_RETURN_URL
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
({
id
:
row
.
id
}),
}).
then
(
res
=>
res
.
json
()))
if
(
err
)
{
message
.
error
(
err
.
message
||
'归还失败'
)
return
}
if
(
res
.
code
!==
200
)
{
message
.
error
(
res
.
msg
||
'归还失败'
)
return
}
message
.
success
(
'归还成功'
)
// 刷新列表
fetchData
()
}
},
'归还'
),
])
}
}
]
/***----------------存包点 start -----------------*/
// 列表
const
points
=
ref
([])
const
pointsOptions
=
computed
(()
=>
points
.
value
.
map
(
item
=>
({
label
:
item
.
pointName
,
value
:
item
.
id
,
})))
const
title
=
ref
(
'添加存包点'
)
const
pointColumns
=
[
{
title
:
'存包点'
,
key
:
'pointName'
,
},
{
title
:
'寄存数'
,
key
:
'saveCount'
,
align
:
'center'
,
},
{
title
:
'已取数'
,
key
:
'takeCount'
,
align
:
'center'
,
},
{
title
:
'创建时间'
,
key
:
'createDate'
,
align
:
'center'
,
},
{
title
:
'操作'
,
key
:
'actions'
,
width
:
150
,
align
:
'center'
,
render
:
(
row
)
=>
{
// 两个按钮,一个 编辑 一个 删除
return
h
(
NSpace
,
{},
[
h
(
NButton
,
{
type
:
'primary'
,
size
:
'small'
,
onClick
:
()
=>
{
editPointForm
.
pointName
=
row
.
pointName
editPointForm
.
cmptId
=
row
.
cmptId
editPointForm
.
id
=
row
.
id
showEditModal
.
value
=
true
title
.
value
=
'编辑存包点'
}
},
'编辑'
),
h
(
NButton
,
{
type
:
'error'
,
size
:
'small'
,
onClick
:
()
=>
{
delPoint
(
row
)
}
},
'删除'
)
])
}
}
]
// 表单
const
editPointForm
=
reactive
({
pointName
:
''
,
cmptId
:
getCId
(),
id
:
undefined
,
})
const
editPointFormRef
=
ref
()
// 规则
const
editPointRules
=
reactive
({
pointName
:
[
{
required
:
true
,
message
:
'请输入存包点'
,
trigger
:
'blur'
},
]
})
// 弹框的控制
const
showEditModal
=
ref
(
false
)
/***----------------存包点 end -----------------*/
// 分页
const
pagination
=
reactive
({
pageSize
:
20
,
page
:
1
,
pageCount
:
0
,
showSizePicker
:
true
,
itemCount
:
0
,
pageSizes
:
[
20
,
50
,
200
,
500
],
prefix
:
(
info
)
=>
"共"
+
info
.
itemCount
+
"条数据"
,
onChange
:
(
page
)
=>
{
pagination
.
page
=
page
fetchData
()
},
onUpdatePageSize
:
(
pageSize
)
=>
{
pagination
.
pageSize
=
pageSize
pagination
.
page
=
1
fetchData
()
}
})
const
tabIndex
=
ref
(
2
)
// 查询的参数
const
query
=
reactive
({
status
:
''
,
// 业务类型(1:赛包邮寄,2:赛包寄存)
serviceType
:
2
,
pointId
:
undefined
,
})
const
keyword
=
ref
(
''
)
// 赛包的数据列表
const
list
=
ref
([])
// 状态更新
const
updateStatus
=
(
value
)
=>
{
pagination
.
page
=
1
query
.
status
=
value
fetchData
()
}
// 状态更新
const
updatePoint
=
(
value
)
=>
{
pagination
.
page
=
1
query
.
pointId
=
value
fetchData
()
}
// 状态更新
const
updateType
=
(
value
)
=>
{
pagination
.
page
=
1
query
.
invoiceType
=
value
fetchData
()
}
// 状态tab
const
updateTab
=
(
value
)
=>
{
tabIndex
.
value
=
value
if
(
value
===
TabEnum
.
POINT
.
value
)
{
getPoints
()
}
else
{
fetchData
()
}
}
// 获取赛包分页列表
const
fetchData
=
async
()
=>
{
loading
.
value
=
true
let
params
=
{
...
query
,
page
:
pagination
.
page
,
size
:
pagination
.
pageSize
,
cmptId
:
getCId
(),
keyword
:
keyword
.
value
}
if
(
params
.
pointId
===
undefined
)
{
delete
params
.
pointId
}
// 发起请求
const
[
err
,
data
]
=
await
to
(
fetch
(
"/gk/bag/delivery/list?"
+
new
URLSearchParams
(
params
).
toString
(),
{
method
:
"GET"
,
headers
:
{
'Content-Type'
:
'application/json'
},
}).
then
(
res
=>
res
.
json
()))
loading
.
value
=
false
if
(
data
.
code
===
200
)
{
list
.
value
=
data
.
content
pagination
.
itemCount
=
data
.
total
}
else
{
message
.
error
(
data
.
msg
)
}
}
// 导出名单
const
exportList
=
()
=>
{
window
.
location
.
href
=
"/gk/bag/export?"
+
new
URLSearchParams
({
query
,
cmptId
:
getCId
(),
keyword
:
keyword
.
value
,
serviceType
:
2
}).
toString
()
}
/***---------------- 赛包相关 end -----------------*/
/***----------------存包点 start -----------------*/
const
addPoint
=
async
()
=>
{
showEditModal
.
value
=
true
title
.
value
=
'添加存包点'
}
const
resetEditModal
=
()
=>
{
showEditModal
.
value
=
false
editPointForm
.
id
=
undefined
editPointForm
.
cmptId
=
getCId
()
editPointForm
.
pointName
=
""
}
// 删除存包点
const
delPoint
=
async
(
row
)
=>
{
console
.
log
({
row
})
const
resultBean
=
confirm
(
"确定删除存包点:"
+
row
.
pointName
+
"吗?"
)
if
(
!
resultBean
)
{
return
}
loading
.
value
=
true
const
[
err
,
data
]
=
await
to
(
fetch
(
POINT_DEL_URL
+
row
.
id
,
{
method
:
"DELETE"
,
headers
:
{
'Content-Type'
:
'application/json'
},
}).
then
(
res
=>
res
.
json
()))
loading
.
value
=
false
if
(
data
.
code
===
200
)
{
message
.
success
(
'操作成功'
)
resetEditModal
()
getPoints
()
}
else
{
message
.
error
(
data
.
msg
)
}
}
// 获取存包点分页列表
const
getPoints
=
async
()
=>
{
loading
.
value
=
true
const
[
err
,
data
]
=
await
to
(
fetch
(
POINTS_URL
,
{
method
:
"GET"
,
headers
:
{
'Content-Type'
:
'application/json'
},
}).
then
(
res
=>
res
.
json
()))
loading
.
value
=
false
if
(
err
)
{
message
.
error
(
err
.
message
)
return
}
if
(
data
.
code
===
0
)
{
points
.
value
=
data
.
content
}
else
{
message
.
error
(
data
.
msg
)
}
}
// 保存存包点
const
savePoint
=
async
()
=>
{
editPointFormRef
.
value
?.
validate
(
async
(
errors
)
=>
{
if
(
errors
)
return
message
.
error
(
'请检查表单是否填写完整'
)
loading
.
value
=
true
const
[
err
,
data
]
=
await
to
(
fetch
(
POINT_SAVE_URL
,
{
method
:
"POST"
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
(
editPointForm
)
}).
then
(
res
=>
res
.
json
()))
loading
.
value
=
false
if
(
data
.
code
===
200
)
{
message
.
success
(
data
.
msg
)
showEditModal
.
value
=
false
getPoints
()
}
else
{
message
.
error
(
data
.
msg
)
}
})
}
/***----------------存包点 end -----------------*/
onMounted
(
async
()
=>
{
await
getPoints
()
fetchData
()
})
return
{
// 赛包相关
updateStatus
,
list
,
query
,
pagination
,
columns
,
keyword
,
fetchData
,
exportList
,
// 公共数据
loading
,
StatusEnum
,
// 状态tab
tabIndex
,
updateTab
,
TabEnum
,
// 点位
pointColumns
,
points
,
title
,
addPoint
,
delPoint
,
updatePoint
,
getPoints
,
showEditModal
,
editPointForm
,
editPointRules
,
editPointFormRef
,
savePoint
,
resetEditModal
,
pointsOptions
,
}
}
})
const
app
=
Vue
.
createApp
({
setup
()
{
return
{
locale
:
zhCN
,
dateLocale
:
dateZhCN
}
}
})
app
.
component
(
'my-app'
,
MyApp
)
app
.
use
(
naive
)
app
.
mount
(
'#app'
)
</script>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/views/cmpt/gpsDeposit.jsp
View file @
3eb22a5d
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
<link
rel=
"stylesheet"
<link
rel=
"stylesheet"
href=
"${ctxStatic}/newdermon/css/style.default.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
href=
"${ctxStatic}/newdermon/css/style.default.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
id=
"theme-stylesheet"
>
id=
"theme-stylesheet"
>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- Custom stylesheet - for your changes-->
<!-- Custom stylesheet - for your changes-->
<link
rel=
"stylesheet"
<link
rel=
"stylesheet"
href=
"${ctxStatic}/newdermon/css/custom.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
href=
"${ctxStatic}/newdermon/css/custom.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
...
@@ -284,138 +285,6 @@
...
@@ -284,138 +285,6 @@
</script>
</script>
<script>
<script>
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 订单类型
// 订单类型
const
OrderTypeEnum
=
const
OrderTypeEnum
=
new
SuperEnum
([
new
SuperEnum
([
...
...
src/main/webapp/WEB-INF/views/cmpt/guide.jsp
View file @
3eb22a5d
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
<!-- Bootstrap CSS-->
<!-- Bootstrap CSS-->
<link
rel=
"stylesheet"
<link
rel=
"stylesheet"
href=
"${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css"
>
href=
"${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css"
>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- 自定义css -->
<!-- 自定义css -->
<link
rel=
"stylesheet"
href=
"${ctxStatic}/css/base.css"
>
<link
rel=
"stylesheet"
href=
"${ctxStatic}/css/base.css"
>
<!-- Font Awesome CSS-->
<!-- Font Awesome CSS-->
...
@@ -131,138 +132,6 @@
...
@@ -131,138 +132,6 @@
// 或者如果cmpt是复杂对象,可以序列化为JSON
// 或者如果cmpt是复杂对象,可以序列化为JSON
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
$
(
".header-second-titile"
).
text
(
"赛事列表"
)
$
(
".header-second-titile"
).
text
(
"赛事列表"
)
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// 赛事状态枚举
// 赛事状态枚举
const
CmptStatusEnum
=
new
SuperEnum
([
const
CmptStatusEnum
=
new
SuperEnum
([
{
key
:
'UNSHELVE'
,
name
:
'下架'
,
color
:
'default'
,
value
:
0
},
{
key
:
'UNSHELVE'
,
name
:
'下架'
,
color
:
'default'
,
value
:
0
},
...
...
src/main/webapp/WEB-INF/views/cmpt/gunRule.jsp
View file @
3eb22a5d
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
nomodule
<script
nomodule
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- Favicon-->
<!-- Favicon-->
<link
rel=
"shortcut icon"
href=
"https://img.geexek.com/files/home/favicon.ico"
>
<link
rel=
"shortcut icon"
href=
"https://img.geexek.com/files/home/favicon.ico"
>
<!-- 自定义css -->
<!-- 自定义css -->
...
@@ -372,139 +373,6 @@
...
@@ -372,139 +373,6 @@
<
/n-modal
>
<
/n-modal
>
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
</script>
<script>
<script>
const
{
createApp
,
defineComponent
,
onBeforeUnmount
,
reactive
,
ref
,
onMounted
,
h
,
computed
}
=
Vue
;
const
{
createApp
,
defineComponent
,
onBeforeUnmount
,
reactive
,
ref
,
onMounted
,
h
,
computed
}
=
Vue
;
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
,
NInputNumber
,
NSelect
,
NInput
,
NDatePicker
}
=
naive
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
,
NInputNumber
,
NSelect
,
NInput
,
NDatePicker
}
=
naive
...
...
src/main/webapp/WEB-INF/views/cmpt/information.jsp
View file @
3eb22a5d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<!-- 添加 Naive UI 的引入 -->
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- <script nomodule
<!-- <script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script
type=
"module"
<script
type=
"module"
...
@@ -210,139 +211,7 @@
...
@@ -210,139 +211,7 @@
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
<script>
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
// tab类型
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// tab类型
const
TabEnum
=
const
TabEnum
=
new
SuperEnum
([
new
SuperEnum
([
{
key
:
'SETTING'
,
name
:
'字段配置'
,
color
:
'warning'
,
value
:
1
},
{
key
:
'SETTING'
,
name
:
'字段配置'
,
color
:
'warning'
,
value
:
1
},
...
...
src/main/webapp/WEB-INF/views/cmpt/invoice.jsp
View file @
3eb22a5d
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script
type=
"module"
<script
type=
"module"
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<script
nomodule
<script
nomodule
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
<!-- Favicon-->
<!-- Favicon-->
...
@@ -252,137 +253,6 @@
...
@@ -252,137 +253,6 @@
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 选号规则类型
// 选号规则类型
const
InvoiceTypeEnum
=
const
InvoiceTypeEnum
=
new
SuperEnum
([
new
SuperEnum
([
...
...
src/main/webapp/WEB-INF/views/cmpt/location.jsp
View file @
3eb22a5d
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script
type=
"module"
<script
type=
"module"
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<script
nomodule
<script
nomodule
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
></script>
<!-- Favicon-->
<!-- Favicon-->
...
@@ -178,137 +179,6 @@
...
@@ -178,137 +179,6 @@
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 状态
// 状态
const
StatusEnum
=
const
StatusEnum
=
new
SuperEnum
([
new
SuperEnum
([
...
...
src/main/webapp/WEB-INF/views/cmpt/locationPoint.jsp
View file @
3eb22a5d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<!-- 添加 Naive UI 的引入 -->
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<script
type=
"module"
<script
type=
"module"
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
src=
"https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
></script>
<script
nomodule
<script
nomodule
...
@@ -242,137 +243,6 @@
...
@@ -242,137 +243,6 @@
</script>
</script>
<script>
<script>
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
const
cmpt
=
JSON
.
parse
(
'${fns:toJson(cmpt)}'
);
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
const
tk
=
"16a595e56ea0cec57ad8c07368d7f1ac"
const
tk
=
"16a595e56ea0cec57ad8c07368d7f1ac"
// 地图用到的图标
// 地图用到的图标
...
...
src/main/webapp/WEB-INF/views/cmpt/markNoRule.jsp
View file @
3eb22a5d
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<title>
自选号规则
</title>
<title>
自选号规则
</title>
<!-- ... 保留原有的 Vue 引入 ... -->
<!-- ... 保留原有的 Vue 引入 ... -->
<script
src=
"${ctxStatic}/vue/vue.global.min.js"
></script>
<script
src=
"${ctxStatic}/vue/vue.global.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- 添加 Naive UI 的引入 -->
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
...
@@ -245,138 +246,6 @@
...
@@ -245,138 +246,6 @@
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 选号规则类型
// 选号规则类型
const
RuleTypeEnum
=
const
RuleTypeEnum
=
new
SuperEnum
([
new
SuperEnum
([
...
...
src/main/webapp/WEB-INF/views/cmpt/markNoSelect.jsp
View file @
3eb22a5d
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
href=
"${ctxStatic}/cmpt/setting.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
href=
"${ctxStatic}/cmpt/setting.css?v=
<%=
System
.
currentTimeMillis
()
%>
"
>
<script
src=
"${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"
></script>
<script
src=
"${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<style>
<style>
#app
{
#app
{
padding
:
0
20px
20px
20px
;
padding
:
0
20px
20px
20px
;
...
@@ -158,8 +159,13 @@
...
@@ -158,8 +159,13 @@
:
remote
=
"true"
/>
:
remote
=
"true"
/>
<
n
-
space
v
-
else
>
<
n
-
space
v
-
else
>
<!--
只允许上传
png
-->
<!--
只允许上传
png
-->
<
n
-
card
>
<
n
-
card
v
-
if
=
"!loading"
>
<
div
class
=
"flex flex-col gap-y-3"
>
<
div
class
=
"flex flex-col gap-y-3"
>
<
h4
>
组别信息
<
/h4
>
<!--
组别
-->
<
n
-
tag
@
click
=
"changeRoad(index)"
:
type
=
"roadIndex===index?'success':'default'"
:
key
=
"road.id"
v
-
for
=
"(road,index) in cmptInfo?.roads"
>
{{
road
.
name
}}
<
/n-tag
>
<
n
-
alert
title
=
"图片要求"
type
=
"warning"
>
<
n
-
alert
title
=
"图片要求"
type
=
"warning"
>
建议上传
350
x350png
(
1
:
1
)
格式
2
MB
以内
建议上传
350
x350png
(
1
:
1
)
格式
2
MB
以内
<
/n-alert
>
<
/n-alert
>
...
@@ -172,12 +178,14 @@
...
@@ -172,12 +178,14 @@
accept
=
"image/png"
accept
=
"image/png"
>
>
<
n
-
button
type
=
"primary"
block
>
<
n
-
button
type
=
"primary"
block
>
上传自助选号背景
{{
certExit
?
'更新自助选号背景'
:
'上传自助选号背景'
}}
<
/n-button
>
<
/n-button
>
<
/n-upload
>
<
/n-upload
>
<
/div>
<
/div>
<
/n-card>
<
/n-card>
<
n
-
card
title
=
"选号底图"
>
<
n
-
card
title
=
"选号底图"
v
-
if
=
"!loading"
>
<
n
-
alert
title
=
"未上传"
v
-
if
=
"!certExit"
type
=
"warning"
>
<
/n-alert
>
<
n
-
image
<
n
-
image
width
=
"300"
width
=
"300"
:
src
=
"bgImage"
:
src
=
"bgImage"
...
@@ -196,137 +204,8 @@
...
@@ -196,137 +204,8 @@
<
/n-space
>
<
/n-space
>
</script>
</script>
<script>
<script>
// 枚举class
const
{
createApp
,
defineComponent
,
reactive
,
ref
,
onMounted
,
h
,
computed
,
nextTick
}
=
Vue
;
class
SuperEnum
{
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
}
=
naive
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
// 状态
// 状态
const
StatusEnum
=
const
StatusEnum
=
new
SuperEnum
([
new
SuperEnum
([
...
@@ -349,13 +228,10 @@
...
@@ -349,13 +228,10 @@
{
key
:
'MARK_NO'
,
name
:
'参赛号列表'
,
color
:
'success'
,
value
:
2
},
{
key
:
'MARK_NO'
,
name
:
'参赛号列表'
,
color
:
'success'
,
value
:
2
},
{
key
:
'SETTING'
,
name
:
'设置'
,
color
:
'success'
,
value
:
3
},
{
key
:
'SETTING'
,
name
:
'设置'
,
color
:
'success'
,
value
:
3
},
])
])
</script>
<script>
const
{
createApp
,
defineComponent
,
reactive
,
ref
,
onMounted
,
h
,
computed
}
=
Vue
;
const
{
useMessage
,
useNotification
,
dateZhCN
,
NButton
,
NTag
,
zhCN
,
NSpace
,
NImageGroup
,
NImage
,
NText
}
=
naive
// 添加全局 loading 指令
// 添加全局 loading 指令
const
uploadUrl
=
window
.
location
.
origin
+
'/api-common/v1/upload?folder='
+
'gk/invoice'
+
'&cmptId='
+
getCId
()
const
uploadUrl
=
window
.
location
.
origin
+
'/api-common/v1/upload?folder='
+
'gk/invoice'
+
'&cmptId='
+
getCId
()
const
uploadBgUrl
=
window
.
location
.
origin
+
'/api-common/v1/uploadSelectMarkNoBg'
+
'?gCmptId='
+
getCId
()
const
BASE_ECC_URL
=
"https://ecc.geexek.com"
const
BASE_ECC_URL
=
"https://ecc.geexek.com"
// 人员列表
// 人员列表
const
PLAYERS_URL
=
BASE_ECC_URL
+
'/api-pick/v1/enroll-page'
const
PLAYERS_URL
=
BASE_ECC_URL
+
'/api-pick/v1/enroll-page'
...
@@ -370,6 +246,9 @@
...
@@ -370,6 +246,9 @@
// 随机分配名单
// 随机分配名单
const
RANDOM_ASSIGN_URL
=
BASE_ECC_URL
+
'/api-pick/v1/pick-up-batch?cmptId='
+
getCId
()
const
RANDOM_ASSIGN_URL
=
BASE_ECC_URL
+
'/api-pick/v1/pick-up-batch?cmptId='
+
getCId
()
// 获取赛事信息
const
GET_CMPT_URL
=
"https://timerbackend.geexek.com/getCmpt.do?cmptId="
+
getCId
()
const
MyApp
=
defineComponent
({
const
MyApp
=
defineComponent
({
name
:
'MyApp'
,
name
:
'MyApp'
,
template
:
'#my-app'
,
template
:
'#my-app'
,
...
@@ -377,6 +256,8 @@
...
@@ -377,6 +256,8 @@
const
message
=
useMessage
()
const
message
=
useMessage
()
const
notification
=
useNotification
()
const
notification
=
useNotification
()
const
loading
=
ref
(
false
)
const
loading
=
ref
(
false
)
// 赛事信息
const
cmptInfo
=
ref
()
/***----------------选手名单相关 start -----------------*/
/***----------------选手名单相关 start -----------------*/
const
tabIndex
=
ref
(
1
)
const
tabIndex
=
ref
(
1
)
const
isPlayerList
=
computed
(()
=>
tabIndex
.
value
===
1
)
const
isPlayerList
=
computed
(()
=>
tabIndex
.
value
===
1
)
...
@@ -409,6 +290,10 @@
...
@@ -409,6 +290,10 @@
title
:
'参赛号'
,
title
:
'参赛号'
,
key
:
MARK_NO
,
key
:
MARK_NO
,
},
},
{
title
:
'组别'
,
key
:
'roadName'
,
},
{
{
title
:
'手机号'
,
title
:
'手机号'
,
key
:
'phone'
,
key
:
'phone'
,
...
@@ -511,7 +396,7 @@
...
@@ -511,7 +396,7 @@
if
(
value
!==
3
)
{
if
(
value
!==
3
)
{
fetchData
()
fetchData
()
}
else
{
}
else
{
checkCert
()
getCmptInfo
()
}
}
}
}
// 上传完成
// 上传完成
...
@@ -667,15 +552,32 @@
...
@@ -667,15 +552,32 @@
}
}
/***---------------- 自助选号相关 end -----------------*/
/***---------------- 自助选号相关 end -----------------*/
/***---------------- 自助选号背景 start -----------------*/
/***---------------- 自助选号背景 start -----------------*/
// 自助选号背景是否存在
const
certExit
=
ref
(
false
)
const
certExit
=
ref
(
false
)
// 当前组别索引
const
roadIndex
=
ref
(
0
)
// 图片地址
const
bgFileList
=
ref
([])
const
bgFileList
=
ref
([])
// 证书地址
// 组别id
const
bgImage
=
"https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/micro/"
+
getCId
()
+
"_cmptId/mark_no_bg.png"
+
"?t="
+
new
Date
().
getTime
()
const
roadId
=
computed
(()
=>
cmptInfo
.
value
?.
roads
?
cmptInfo
.
value
.
roads
[
roadIndex
.
value
].
id
:
''
)
// 时间值
const
t
=
ref
(
0
)
// 选号地址
const
bgImage
=
computed
(()
=>
"https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/micro/"
+
getCId
()
+
"_cmptId/"
+
getCId
()
+
"_"
+
roadId
.
value
+
".png?t="
+
t
.
value
)
// 图片上传地址
const
uploadBgUrl
=
computed
(()
=>
window
.
location
.
origin
+
'/api-common/v1/uploadSelectMarkNoBg'
+
'?gCmptId='
+
getCId
()
+
'&roadId='
+
roadId
.
value
)
// 组别切换
const
changeRoad
=
(
index
)
=>
{
roadIndex
.
value
=
index
checkCert
()
}
// 检查证书是否存在
// 检查证书是否存在
const
checkCert
=
()
=>
{
const
checkCert
=
()
=>
{
// 判断图片是否存在
// 判断图片是否存在
const
img
=
new
Image
()
const
img
=
new
Image
()
img
.
src
=
bgImage
// 改变t的值,图片重新加载
t
.
value
=
new
Date
().
getTime
()
img
.
src
=
bgImage
.
value
img
.
onload
=
function
()
{
img
.
onload
=
function
()
{
certExit
.
value
=
true
certExit
.
value
=
true
}
}
...
@@ -683,10 +585,11 @@
...
@@ -683,10 +585,11 @@
certExit
.
value
=
false
certExit
.
value
=
false
}
}
}
}
const
onFileUploadBg
=
(
file
)
=>
{
// 自助选号背景上传完成
const
onFileUploadBg
=
async
(
file
)
=>
{
await
nextTick
()
bgFileList
.
value
=
[]
bgFileList
.
value
=
[]
checkCert
()
checkCert
()
// window.location.reload()
loading
.
value
=
false
loading
.
value
=
false
}
}
// 文件上传前回调
// 文件上传前回调
...
@@ -704,6 +607,26 @@
...
@@ -704,6 +607,26 @@
loading
.
value
=
true
loading
.
value
=
true
return
true
return
true
}
}
// 获取赛事信息
const
getCmptInfo
=
async
()
=>
{
loading
.
value
=
true
const
[
err
,
res
]
=
await
to
(
fetch
(
GET_CMPT_URL
,
{
method
:
"GET"
,
}).
then
(
res
=>
res
.
json
()))
loading
.
value
=
false
if
(
err
)
{
message
.
error
(
err
)
return
}
if
(
res
.
status
===
0
)
{
if
(
res
.
cmpt
)
{
cmptInfo
.
value
=
res
.
cmpt
checkCert
()
}
}
else
{
message
.
error
(
res
.
message
)
}
}
/***---------------- 自助选号背景 end -----------------*/
/***---------------- 自助选号背景 end -----------------*/
onMounted
(()
=>
{
onMounted
(()
=>
{
fetchData
()
fetchData
()
...
@@ -740,13 +663,14 @@
...
@@ -740,13 +663,14 @@
MARK_NO
,
MARK_NO
,
// 背景上传
// 背景上传
uploadBgUrl
,
uploadBgUrl
,
cmptInfo
,
roadIndex
,
certExit
,
certExit
,
bgFileList
,
bgFileList
,
bgImage
,
bgImage
,
changeRoad
,
onFileUploadBg
,
onFileUploadBg
,
beforeUploadBg
beforeUploadBg
}
}
}
}
})
})
...
...
src/main/webapp/WEB-INF/views/cmpt/wechat.jsp
View file @
3eb22a5d
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<title>
小程序链接+二维码
</title>
<title>
小程序链接+二维码
</title>
<!-- ... 保留原有的 Vue 引入 ... -->
<!-- ... 保留原有的 Vue 引入 ... -->
<script
src=
"${ctxStatic}/vue/vue.global.min.js"
></script>
<script
src=
"${ctxStatic}/vue/vue.global.min.js"
></script>
<script
src=
"${ctxStatic}/js/super.js"
></script>
<!-- 添加 Naive UI 的引入 -->
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
<script
src=
"${ctxStatic}/navie-ui/index.min.js"
></script>
...
@@ -198,138 +199,6 @@
...
@@ -198,138 +199,6 @@
<
/n-space
>
<
/n-space
>
<
/n-spin
>
<
/n-spin
>
</script>
</script>
<script>
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
</script>
<script>
<script>
const
{
createApp
,
defineComponent
,
onBeforeUnmount
,
reactive
,
ref
,
onMounted
,
h
,
computed
}
=
Vue
;
const
{
createApp
,
defineComponent
,
onBeforeUnmount
,
reactive
,
ref
,
onMounted
,
h
,
computed
}
=
Vue
;
const
{
useMessage
,
useNotification
,
dateZhCN
,
zhCN
}
=
naive
const
{
useMessage
,
useNotification
,
dateZhCN
,
zhCN
}
=
naive
...
...
src/main/webapp/static/js/super.js
0 → 100644
View file @
3eb22a5d
// 枚举class
class
SuperEnum
{
constructor
(
param
)
{
const
keyObj
=
{};
const
valueObj
=
{};
const
nameObj
=
{};
if
(
!
Array
.
isArray
(
param
))
{
throw
new
TypeError
(
'param is not an array!'
);
}
param
.
forEach
((
element
)
=>
{
if
(
!
element
.
key
||
!
element
.
name
)
{
return
;
}
// 使用对象存储键值对,方便快速查找
keyObj
[
element
.
key
]
=
element
;
valueObj
[
element
.
value
]
=
element
;
nameObj
[
element
.
name
]
=
element
;
// 动态添加属性
this
[
element
.
key
]
=
element
;
this
[
element
.
name
]
=
element
;
if
(
element
.
key
!==
element
.
value
)
{
this
[
element
.
value
]
=
element
;
}
});
// 保存源数组
this
.
data
=
param
;
this
.
keyObj
=
keyObj
;
this
.
valueObj
=
valueObj
;
this
.
nameObj
=
nameObj
;
// 防止被修改
Object
.
freeze
(
this
);
}
getColorByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
color
;
}
getData
()
{
return
this
.
data
;
}
getKeyByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
key
;
}
getNameByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getNameByValue
(
value
)
{
const
prop
=
this
.
valueOf
(
value
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
name
;
}
getValueByKey
(
key
)
{
const
prop
=
this
.
keyOf
(
key
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
getValueByName
(
name
)
{
const
prop
=
this
.
nameOf
(
name
);
if
(
!
prop
)
{
const
error
=
new
Error
(
'No enum constant'
);
error
.
code
=
'ENUM_NOT_FOUND'
;
throw
error
;
}
return
prop
.
value
;
}
keyOf
(
key
)
{
return
this
.
keyObj
[
key
];
}
nameOf
(
name
)
{
return
this
.
nameObj
[
name
];
}
valueOf
(
value
)
{
return
this
.
valueObj
[
value
];
}
}
// to 方法,封装try catch
const
to
=
async
(
promise
,
errorExt
,
)
=>
{
try
{
const
data
=
await
promise
const
result
=
[
null
,
data
]
return
result
}
catch
(
error
)
{
if
(
errorExt
)
{
const
parsedError
=
Object
.
assign
({},
error
,
errorExt
)
return
[
parsedError
,
undefined
]
}
return
[
error
,
undefined
]
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment