Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
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
周远喜
mes-ui
Commits
71e24d4f
Commit
71e24d4f
authored
Sep 11, 2020
by
周远喜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok
parent
e80688da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
217 additions
and
71 deletions
+217
-71
config.js
libs/config.js
+32
-0
henq.js
libs/henq.js
+40
-0
index.vue
pages/system/config/index.vue
+43
-0
index.js
store/index.js
+102
-71
No files found.
libs/config.js
0 → 100644
View file @
71e24d4f
const
config
=
{
tenantCode
:
""
,
//租户Id
//业务设置
bus
:{
orderStartWarning
:
3
,
//订单开工预警
orderFinishWarning
:
3
,
//订单完工预警
excuteStartWarning
:
3
,
//工单开工预警
excuteEndWarning
:
3
,
//工单完工预警
storeWarning
:
true
,
//库存预警
setHeaderWarning
:
3
,
//工艺设置预警
suportingFinishWarning
:
1
,
//配套完成预警
excuteHandover
:
true
,
//工单交接开关
inenerExcuteHandover
:
false
,
//同车间工单交接开关
suportingOverStart
:
false
,
//配套完成才能开工
},
//站点设置
common
:{
language
:
"zh-cn"
,
//默认语言
password
:
"111111"
,
//系统
passwordRule
:
0
,
//密码规则
firstLoginEditPassword
:
true
,
loginValidHoure
:
24
,
// 登陆有效期设置
loginCode
:
0
,
//登陆验证码开启
pageSize
:
20
,
//页面分页大小,
windowWidth
:
1200
,
//默认页面大小//
windowMove
:
false
,
bug
:
false
,
ExceptionWarning
:
true
,
ExceptionMessage
:
""
,
}
}
export
default
config
;
\ No newline at end of file
libs/henq.js
View file @
71e24d4f
...
@@ -255,4 +255,44 @@ henq.dirCode = (code, v) => {
...
@@ -255,4 +255,44 @@ henq.dirCode = (code, v) => {
}
}
return
items
return
items
}
}
//js对象深度比较 全相等
henq
.
isEqual
=
(
oldData
,
newData
)
=>
{
compare
=
this
;
function
isObject
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
)
===
'[object Object]'
}
// 判断此对象是否是Object类型
function
isArray
(
arr
)
{
return
Object
.
prototype
.
toString
.
call
(
arr
)
===
'[object Array]'
}
// 类型为基本类型时,如果相同,则返回true
if
(
oldData
===
newData
)
return
true
if
(
compareObj
.
isObject
(
oldData
)
&&
compareObj
.
isObject
(
newData
)
&&
Object
.
keys
(
oldData
).
length
===
Object
.
keys
(
newData
).
length
)
{
// 类型为对象并且元素个数相同
// 遍历所有对象中所有属性,判断元素是否相同
for
(
const
key
in
oldData
)
{
if
(
oldData
.
hasOwnProperty
(
key
))
{
if
(
!
compareObj
.
compare
(
oldData
[
key
],
newData
[
key
]))
{
// 对象中具有不相同属性 返回false
return
false
}
}
}
}
else
if
(
compareObj
.
isArray
(
oldData
)
&&
compareObj
.
isArray
(
oldData
)
&&
oldData
.
length
===
newData
.
length
)
{
// 类型为数组并且数组长度相同
for
(
let
i
=
0
,
length
=
oldData
.
length
;
i
<
length
;
i
++
)
{
if
(
!
compareObj
.
compare
(
oldData
[
i
],
newData
[
i
]))
{
// 如果数组元素中具有不相同元素,返回false
return
false
}
}
}
else
{
// 其它类型,均返回false
return
false
}
// 走到这里,说明数组或者对象中所有元素都相同,返回true
return
true
}
export
default
henq
;
export
default
henq
;
pages/system/config/index.vue
0 → 100644
View file @
71e24d4f
<
template
>
<div
class=
"config flex "
>
<div
class=
"menu"
>
<Menu
theme=
"light"
active-name=
"1-2"
:open-names=
"site"
>
<MenuItem
name=
"site"
to=
"#site"
>
站点设置
</MenuItem>
<MenuItem
name=
"bus"
to=
"#bus"
>
业务设置
</MenuItem>
</Menu>
</div>
<div
class=
"main"
>
<div
class=
"tool"
>
<Button
type=
"primary"
@
click=
"save"
>
保存更改
</Button>
<Button
type=
"text"
>
恢复默认
</Button>
</div>
<Form
ref=
"form"
:model=
"config"
:rules=
"rules"
:label-width=
"100"
>
<div
id=
"site"
>
<h3>
站点设置
</h3>
</div>
<div
id=
"bus"
>
<h3>
业务设置
</h3>
</div>
</Form>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
""
,
data
()
{
return
{
config
:
null
,
rules
:
{},
};
},
methods
:
{
save
()
{},
reset
()
{},
},
};
</
script
>
<
style
lang=
"less"
>
</
style
>
\ No newline at end of file
store/index.js
View file @
71e24d4f
import
createVuexAlong
from
'vuex-along'
import
createVuexAlong
from
'vuex-along'
import
Api
from
'@/plugins/request'
import
Api
from
'@/plugins/request'
export
const
state
=
()
=>
({
export
const
state
=
()
=>
({
counter
:
0
,
counter
:
0
,
dictionary
:
new
Map
(),
//所有字典项
dictionary
:
new
Map
(),
//所有字典项
userMap
:[],
//所有用户缓存;
userMap
:
[],
//所有用户缓存;
userInfo
:{
userInfo
:
{
userId
:
0
,
userId
:
0
,
userName
:
""
userName
:
""
,
},
tenantCode
:
"000001"
siteConfig
:{},
},
defaultConfig
:{},
siteConfig
:
{},
defaultConfig
:
{},
})
})
export
const
getters
=
{
export
const
getters
=
{
dictionaryByKey
:
(
state
)
=>
(
key
)
=>
{
dictionaryByKey
:
(
state
)
=>
(
key
)
=>
{
let
result
=
[];
let
result
=
[];
let
items
=
state
.
dictionary
.
get
(
key
);
let
items
=
state
.
dictionary
.
get
(
key
);
...
@@ -21,7 +22,7 @@ export const getters={
...
@@ -21,7 +22,7 @@ export const getters={
}
}
return
result
;
return
result
;
},
},
getUser
:
state
=>
key
=>
{
getUser
:
state
=>
key
=>
{
// try{
// try{
// if(state.userMap.has(key)){
// if(state.userMap.has(key)){
// return state.userMap.get(key);
// return state.userMap.get(key);
...
@@ -29,44 +30,59 @@ export const getters={
...
@@ -29,44 +30,59 @@ export const getters={
// }catch(e){
// }catch(e){
// console.log(e);
// console.log(e);
// }
// }
let
user
=
state
.
userMap
.
filter
(
u
=>
{
return
u
.
id
==
key
});
let
user
=
state
.
userMap
.
filter
(
u
=>
{
if
(
user
.
length
>
0
){
return
u
.
id
==
key
});
if
(
user
.
length
>
0
)
{
return
user
[
0
]
return
user
[
0
]
}
else
{
}
else
{
return
null
;
return
null
;
}
}
}
}
}
}
export
const
mutations
=
{
export
const
mutations
=
{
increment
(
state
){
increment
(
state
)
{
state
.
counter
++
state
.
counter
++
},
},
setUserInfo
(
state
,
userInfo
)
{
setUserInfo
(
state
,
userInfo
)
{
state
.
userInfo
=
userInfo
;
state
.
userInfo
=
userInfo
;
// sessionStorage.setItem("userInfo", JSON.stringify(userInfo));
// sessionStorage.setItem("userInfo", JSON.stringify(userInfo));
// sessionStorage.setItem("token", userInfo.token);
// sessionStorage.setItem("token", userInfo.token);
},
},
addUser
(
state
,
user
){
addUser
(
state
,
user
)
{
state
.
userMap
.
push
(
user
);
state
.
userMap
.
push
(
user
);
},
},
setDictionary
(
state
,
dictionary
)
{
setDictionary
(
state
,
dictionary
)
{
state
.
dictionary
=
dictionary
;
state
.
dictionary
=
dictionary
;
},
},
setSiteConfig
(
state
,
config
){
setSiteConfig
(
state
,
config
)
{
state
.
siteConfig
=
config
;
state
.
siteConfig
=
config
;
}
},
setDefaultConfig
(
state
,
config
)
{
state
.
defaultConfig
=
config
;
}
}
}
export
const
actions
=
{
export
const
actions
=
{
async
loadUser
({
commit
},
key
){
async
loadUser
({
commit
let
{
result
}
=
await
this
.
$api
.
get
(
`
${
systemUrl
}
/user/getuser`
,{
id
:
key
});
},
key
)
{
console
.
warn
(
"result"
,
result
)
commit
(
"addUser"
,
result
);
let
{
result
}
=
await
this
.
$api
.
get
(
`
${
systemUrl
}
/user/getuser`
,
{
id
:
key
});
console
.
warn
(
"result"
,
result
)
commit
(
"addUser"
,
result
);
},
},
async
loadDictionary
({
commit
})
{
async
loadDictionary
({
commit
})
{
let
url
=
`
${
systemUrl
}
/Dictionary/GetAll`
let
url
=
`
${
systemUrl
}
/Dictionary/GetAll`
let
{
result
}
=
await
Api
.
get
(
url
);
let
{
result
}
=
await
Api
.
get
(
url
);
var
map
=
new
Map
();
var
map
=
new
Map
();
...
@@ -77,36 +93,51 @@ export const actions={
...
@@ -77,36 +93,51 @@ export const actions={
}
}
commit
(
"setDictionary"
,
map
);
commit
(
"setDictionary"
,
map
);
},
},
loadSiteConfig
(){
async
loadSiteConfig
({
// let params={
commit
,
// pageSize:2,
state
// conditions:[{
})
{
// "fieldName":"key",
let
params
=
{
// "fieldValue":"a,b",
pageSize
:
2
,
// "conditionalType":"In",
conditions
:
[{
// },]
"fieldName"
:
"key"
,
// }
"fieldValue"
:
"defaultConfig,tenant-"
+
state
.
userInfo
.
tenantCode
,
// let {result} = await Api.post(`${systemUrl}/config/list`,params);
"conditionalType"
:
"In"
,
// if(result.length>1){
},
]
// conm
}
// }
let
{
result
}
=
await
Api
.
post
(
`
${
systemUrl
}
/config/list`
,
params
);
if
(
result
[
0
])
{
commit
(
"setDefaultConfig"
,
result
[
0
])
}
if
(
result
[
1
])
{
commit
(
"setSiteConfig"
,
result
[
1
])
}
else
{
if
(
result
[
0
]){
commit
(
"setSiteConfig"
,
result
[
0
])
}
}
},
async
saveConfig
({
commit
},
config
){
}
}
}
}
export
const
plugins
=
[
export
const
plugins
=
[
createVuexAlong
({
createVuexAlong
({
// 设置保存的集合名字,避免同站点下的多项目数据冲突
// 设置保存的集合名字,避免同站点下的多项目数据冲突
name
:
"hyhmes"
,
name
:
"hyhmes"
,
local
:
{
local
:
{
list
:
[
"hyhmes"
],
list
:
[
"hyhmes"
],
// 过滤模块 ma 数据, 将其他的存入 localStorage
// 过滤模块 ma 数据, 将其他的存入 localStorage
isFilter
:
true
,
isFilter
:
true
,
},
},
session
:
{
session
:
{
// 保存模块 ma 中的 a1 到 sessionStorage
// 保存模块 ma 中的 a1 到 sessionStorage
list
:
[
"hyhmes.session"
],
list
:
[
"hyhmes.session"
],
},
},
}),
}),
]
]
//设置 strict 为不严格模式,即可在actions中修改state
//设置 strict 为不严格模式,即可在actions中修改state
export
const
strict
=
false
;
export
const
strict
=
false
;
\ No newline at end of file
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