Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
9141c564
Commit
9141c564
authored
Apr 15, 2021
by
季圣华
Browse files
去除多余的文件
parent
24e40a36
Changes
7
Hide whitespace changes
Inline
Side-by-side
jshERP-web/src/components/AvatarList/List.vue
View file @
9141c564
<!--
<template>
<div :class="[prefixCls]">
<ul>
<slot></slot>
<template v-for="item in filterEmpty($slots.default).slice(0, 3)"></template>
<template v-if="maxLength > 0 && filterEmpty($slots.default).length > maxLength">
<avatar-item :size="size">
<avatar :size="size !== 'mini' && size || 20" :style="excessItemsStyle">{{ `+${maxLength}` }}</avatar>
</avatar-item>
</template>
</ul>
</div>
</template>
-->
<
script
>
import
Avatar
from
'
ant-design-vue/es/avatar
'
import
AvatarItem
from
'
./Item
'
import
{
filterEmpty
}
from
'
@/components/_util/util
'
export
default
{
AvatarItem
,
name
:
"
AvatarList
"
,
components
:
{
Avatar
,
AvatarItem
},
props
:
{
prefixCls
:
{
type
:
String
,
default
:
'
ant-pro-avatar-list
'
},
/**
* 头像大小 类型: large、small 、mini, default
* 默认值: default
*/
size
:
{
type
:
[
String
,
Number
],
default
:
'
default
'
},
/**
* 要显示的最大项目
*/
maxLength
:
{
type
:
Number
,
default
:
0
},
/**
* 多余的项目风格
*/
excessItemsStyle
:
{
type
:
Object
,
default
:
()
=>
{
return
{
color
:
'
#f56a00
'
,
backgroundColor
:
'
#fde3cf
'
}
}
}
},
data
()
{
return
{}
},
methods
:
{
getItems
(
items
)
{
const
classString
=
{
[
`
${
this
.
prefixCls
}
-item`
]:
true
,
[
`
${
this
.
size
}
`
]:
true
}
if
(
this
.
maxLength
>
0
)
{
items
=
items
.
slice
(
0
,
this
.
maxLength
)
items
.
push
((
<
Avatar
size
=
{
this
.
size
}
style
=
{
this
.
excessItemsStyle
}
>
{
`+
${
this
.
maxLength
}
`
}
<
/Avatar>
)
)
}
const
itemList
=
items
.
map
((
item
)
=>
(
<
li
class
=
{
classString
}
>
{
item
}
<
/li
>
))
return
itemList
}
},
render
()
{
const
{
prefixCls
,
size
}
=
this
.
$props
const
classString
=
{
[
`
${
prefixCls
}
`
]:
true
,
[
`
${
size
}
`
]:
true
,
}
const
items
=
filterEmpty
(
this
.
$slots
.
default
)
const
itemsDom
=
items
&&
items
.
length
?
<
ul
class
=
{
`
${
prefixCls
}
-items`
}
>
{
this
.
getItems
(
items
)
}
<
/ul> : nul
l
return
(
<
div
class
=
{
classString
}
>
{
itemsDom
}
<
/div
>
)
}
}
<!--
<template>
<div :class="[prefixCls]">
<ul>
<slot></slot>
<template v-for="item in filterEmpty($slots.default).slice(0, 3)"></template>
<template v-if="maxLength > 0 && filterEmpty($slots.default).length > maxLength">
<avatar-item :size="size">
<avatar :size="size !== 'mini' && size || 20" :style="excessItemsStyle">{{ `+${maxLength}` }}</avatar>
</avatar-item>
</template>
</ul>
</div>
</template>
-->
<
script
>
import
Avatar
from
'
ant-design-vue/es/avatar
'
import
AvatarItem
from
'
./Item
'
export
default
{
AvatarItem
,
name
:
"
AvatarList
"
,
components
:
{
Avatar
,
AvatarItem
},
props
:
{
prefixCls
:
{
type
:
String
,
default
:
'
ant-pro-avatar-list
'
},
/**
* 头像大小 类型: large、small 、mini, default
* 默认值: default
*/
size
:
{
type
:
[
String
,
Number
],
default
:
'
default
'
},
/**
* 要显示的最大项目
*/
maxLength
:
{
type
:
Number
,
default
:
0
},
/**
* 多余的项目风格
*/
excessItemsStyle
:
{
type
:
Object
,
default
:
()
=>
{
return
{
color
:
'
#f56a00
'
,
backgroundColor
:
'
#fde3cf
'
}
}
}
},
data
()
{
return
{}
},
methods
:
{
getItems
(
items
)
{
const
classString
=
{
[
`
${
this
.
prefixCls
}
-item`
]:
true
,
[
`
${
this
.
size
}
`
]:
true
}
if
(
this
.
maxLength
>
0
)
{
items
=
items
.
slice
(
0
,
this
.
maxLength
)
items
.
push
((
<
Avatar
size
=
{
this
.
size
}
style
=
{
this
.
excessItemsStyle
}
>
{
`+
${
this
.
maxLength
}
`
}
<
/Avatar>
))
}
const
itemList
=
items
.
map
((
item
)
=>
(
<
li
class
=
{
classString
}
>
{
item
}
<
/li>
))
return
itemList
}
},
render
()
{
const
{
prefixCls
,
size
}
=
this
.
$props
const
classString
=
{
[
`
${
prefixCls
}
`
]:
true
,
[
`
${
size
}
`
]:
true
,
}
}
}
</
script
>
\ No newline at end of file
jshERP-web/src/components/Ellipsis/Ellipsis.vue
View file @
9141c564
<
script
>
import
{
cutStrByFullLength
,
getStrFullLength
}
from
'
@/components/_util/StringUtil
'
export
default
{
name
:
'
Ellipsis
'
,
props
:
{
prefixCls
:
{
type
:
String
,
default
:
'
ant-pro-ellipsis
'
},
tooltip
:
{
type
:
Boolean
,
default
:
true
,
},
length
:
{
type
:
Number
,
default
:
25
,
},
lines
:
{
type
:
Number
,
default
:
1
},
fullWidthRecognition
:
{
type
:
Boolean
,
default
:
false
}
},
methods
:
{},
render
()
{
const
{
tooltip
,
length
}
=
this
.
$props
let
text
=
''
// 处理没有default插槽时的特殊情况
if
(
this
.
$slots
.
default
)
{
text
=
this
.
$slots
.
default
.
map
(
vNode
=>
vNode
.
text
).
join
(
''
)
}
// 判断是否显示 tooltip
if
(
tooltip
&&
getStrFullLength
(
text
)
>
length
)
{
return
(
<
a
-
tooltip
>
<
template
slot
=
"
title
"
>
{
text
}
<
/template
>
<
span
>
{
cutStrByFullLength
(
text
,
this
.
length
)
+
'
…
'
}
<
/span
>
<
/a-tooltip
>
)
}
else
{
return
(
<
span
>
{
text
}
<
/span>
)
}
}
}
<
script
>
export
default
{
name
:
'
Ellipsis
'
,
props
:
{
prefixCls
:
{
type
:
String
,
default
:
'
ant-pro-ellipsis
'
},
tooltip
:
{
type
:
Boolean
,
default
:
true
,
},
length
:
{
type
:
Number
,
default
:
25
,
},
lines
:
{
type
:
Number
,
default
:
1
},
fullWidthRecognition
:
{
type
:
Boolean
,
default
:
false
}
},
methods
:
{},
render
()
{
const
{
tooltip
,
length
}
=
this
.
$props
let
text
=
''
// 处理没有default插槽时的特殊情况
if
(
this
.
$slots
.
default
)
{
text
=
this
.
$slots
.
default
.
map
(
vNode
=>
vNode
.
text
).
join
(
''
)
}
}
}
</
script
>
\ No newline at end of file
jshERP-web/src/components/_util/Area.js
deleted
100644 → 0
View file @
24e40a36
import
{
pcaa
}
from
'
area-data
'
/**
* 省市区
*/
export
default
class
Area
{
/**
* 构造器
* @param express
*/
constructor
()
{
let
arr
=
[]
const
province
=
pcaa
[
'
86
'
]
Object
.
keys
(
province
).
map
(
key
=>
{
arr
.
push
({
id
:
key
,
text
:
province
[
key
],
pid
:
'
86
'
});
const
city
=
pcaa
[
key
];
Object
.
keys
(
city
).
map
(
key2
=>
{
arr
.
push
({
id
:
key2
,
text
:
city
[
key2
],
pid
:
key
});
const
qu
=
pcaa
[
key2
];
Object
.
keys
(
qu
).
map
(
key3
=>
{
arr
.
push
({
id
:
key3
,
text
:
qu
[
key3
],
pid
:
key2
});
})
})
})
this
.
all
=
arr
;
}
get
pca
(){
return
this
.
all
;
}
getCode
(
text
){
if
(
!
text
||
text
.
length
==
0
){
return
''
}
for
(
let
item
of
this
.
all
){
if
(
item
.
text
===
text
){
return
item
.
id
;
}
}
}
getText
(
code
){
if
(
!
code
||
code
.
length
==
0
){
return
''
}
let
arr
=
[]
this
.
getAreaBycode
(
code
,
arr
);
return
arr
.
join
(
'
/
'
)
}
getRealCode
(
code
){
let
arr
=
[]
this
.
getPcode
(
code
,
arr
)
return
arr
;
}
getPcode
(
id
,
arr
){
for
(
let
item
of
this
.
all
){
if
(
item
.
id
===
id
){
arr
.
unshift
(
id
)
if
(
item
.
pid
!=
'
86
'
){
this
.
getPcode
(
item
.
pid
,
arr
)
}
}
}
}
getAreaBycode
(
code
,
arr
){
//console.log("this.all.length",this.all)
for
(
let
item
of
this
.
all
){
if
(
item
.
id
===
code
){
arr
.
unshift
(
item
.
text
);
this
.
getAreaBycode
(
item
.
pid
,
arr
)
}
}
}
}
\ No newline at end of file
jshERP-web/src/components/_util/StringUtil.js
deleted
100644 → 0
View file @
24e40a36
/**
* 获取字符串的长度ascii长度为1 中文长度为2
* @param str
* @returns {number}
*/
export
const
getStrFullLength
=
(
str
=
''
)
=>
str
.
split
(
''
).
reduce
((
pre
,
cur
)
=>
{
const
charCode
=
cur
.
charCodeAt
(
0
)
if
(
charCode
>=
0
&&
charCode
<=
128
)
{
return
pre
+
1
}
return
pre
+
2
},
0
)
/**
* 给定一个字符串和一个长度,将此字符串按指定长度截取
* @param str
* @param maxLength
* @returns {string}
*/
export
const
cutStrByFullLength
=
(
str
=
''
,
maxLength
)
=>
{
let
showLength
=
0
return
str
.
split
(
''
).
reduce
((
pre
,
cur
)
=>
{
const
charCode
=
cur
.
charCodeAt
(
0
)
if
(
charCode
>=
0
&&
charCode
<=
128
)
{
showLength
+=
1
}
else
{
showLength
+=
2
}
if
(
showLength
<=
maxLength
)
{
return
pre
+
cur
}
return
pre
},
''
)
}
\ No newline at end of file
jshERP-web/src/components/_util/util.js
deleted
100644 → 0
View file @
24e40a36
/**
* components util
*/
/**
* 清理空值,对象
* @param children
* @returns {*[]}
*/
export
function
filterEmpty
(
children
=
[])
{
return
children
.
filter
(
c
=>
c
.
tag
||
(
c
.
text
&&
c
.
text
.
trim
()
!==
''
))
}
\ No newline at end of file
jshERP-web/src/components/jeecg/JAreaLinkage.vue
View file @
9141c564
<
template
>
<div
v-if=
"!reloading"
class=
"j-area-linkage"
>
<area-cascader
v-if=
"_type === enums.type[0]"
:value=
"innerValue"
:data=
"pcaa"
:level=
"1"
:style=
"
{width}"
v-bind="$attrs"
v-on="_listeners"
@change="handleChange"
/>
<area-select
v-else-if=
"_type === enums.type[1]"
:value=
"innerValue"
:data=
"pcaa"
:level=
"2"
v-bind=
"$attrs"
v-on=
"_listeners"
@
change=
"handleChange"
/>
<div
v-else
>
<span
style=
"color:red;"
>
Bad type value:
{{
_type
}}
</span>
</div>
</div>
</
template
>
<
script
>
import
{
pcaa
}
from
'
area-data
'
import
Area
from
'
@/components/_util/Area
'
export
default
{
name
:
'
JAreaLinkage
'
,
props
:
{
value
:
{
type
:
String
,
required
:
false
},
// 组件的类型,可选值:
// select 下拉样式
// cascader 级联样式(默认)
type
:
{
type
:
String
,
default
:
'
cascader
'
},
width
:
{
type
:
String
,
default
:
'
100%
'
}
},
data
()
{
return
{
pcaa
,
innerValue
:
[],
usedListeners
:
[
'
change
'
],
enums
:
{
type
:
[
'
cascader
'
,
'
select
'
]
},
reloading
:
false
,
areaData
:
''
}
},
computed
:
{
_listeners
()
{
let
listeners
=
{
...
this
.
$listeners
}
// 去掉已使用的事件,防止冲突
this
.
usedListeners
.
forEach
(
key
=>
{
delete
listeners
[
key
]
})
return
listeners
},
_type
()
{
if
(
this
.
enums
.
type
.
includes
(
this
.
type
))
{
return
this
.
type
}
else
{
console
.
error
(
`JAreaLinkage的type属性只能接收指定的值(
${
this
.
enums
.
type
.
join
(
'
|
'
)}
)`
)
return
this
.
enums
.
type
[
0
]
}
},
},
watch
:
{
value
:
{
immediate
:
true
,
handler
()
{
this
.
loadDataByValue
(
this
.
value
)
}
},
},
created
()
{
this
.
initAreaData
();
},
methods
:
{
/** 通过 value 反推 options */
loadDataByValue
(
value
)
{
if
(
!
value
||
value
.
length
==
0
){
this
.
innerValue
=
[]
this
.
reloading
=
true
;
setTimeout
(()
=>
{
this
.
reloading
=
false
},
100
)
}
else
{
this
.
initAreaData
();
let
arr
=
this
.
areaData
.
getRealCode
(
value
);
this
.
innerValue
=
arr
}
},
/** 通过地区code获取子级 */
loadDataByCode
(
value
)
{
let
options
=
[]
let
data
=
pcaa
[
value
]
if
(
data
)
{
for
(
let
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
options
.
push
({
value
:
key
,
label
:
data
[
key
],
})
}
}
return
options
}
else
{
return
[]
}
},
/** 判断是否有子节点 */
hasChildren
(
options
)
{
options
.
forEach
(
option
=>
{
let
data
=
this
.
loadDataByCode
(
option
.
value
)
option
.
isLeaf
=
data
.
length
===
0
})
},
handleChange
(
values
)
{
let
value
=
values
[
values
.
length
-
1
]
this
.
$emit
(
'
change
'
,
value
)
},
initAreaData
(){
if
(
!
this
.
areaData
){
this
.
areaData
=
new
Area
();
}
},
},
model
:
{
prop
:
'
value
'
,
event
:
'
change
'
},
}
</
script
>
<
style
lang=
"less"
scoped
>
.j-area-linkage {
height:40px;
/deep/ .area-cascader-wrap .area-select {
width: 100%;
}
/deep/ .area-select .area-selected-trigger {
line-height: 1.15;
}
}
<
template
>
<div
v-if=
"!reloading"
class=
"j-area-linkage"
>
<area-cascader
v-if=
"_type === enums.type[0]"
:value=
"innerValue"
:data=
"pcaa"
:level=
"1"
:style=
"
{width}"
v-bind="$attrs"
v-on="_listeners"
@change="handleChange"
/>
<area-select
v-else-if=
"_type === enums.type[1]"
:value=
"innerValue"
:data=
"pcaa"
:level=
"2"
v-bind=
"$attrs"
v-on=
"_listeners"
@
change=
"handleChange"
/>
<div
v-else
>
<span
style=
"color:red;"
>
Bad type value:
{{
_type
}}
</span>
</div>
</div>
</
template
>
<
script
>
import
{
pcaa
}
from
'
area-data
'
export
default
{
name
:
'
JAreaLinkage
'
,
props
:
{
value
:
{
type
:
String
,
required
:
false
},
// 组件的类型,可选值:
// select 下拉样式
// cascader 级联样式(默认)
type
:
{
type
:
String
,
default
:
'
cascader
'
},
width
:
{
type
:
String
,
default
:
'
100%
'
}
},
data
()
{
return
{
pcaa
,
innerValue
:
[],
usedListeners
:
[
'
change
'
],
enums
:
{
type
:
[
'
cascader
'
,
'
select
'
]
},
reloading
:
false
,
areaData
:
''
}
},
computed
:
{
_listeners
()
{
let
listeners
=
{
...
this
.
$listeners
}
// 去掉已使用的事件,防止冲突
this
.
usedListeners
.
forEach
(
key
=>
{
delete
listeners
[
key
]
})
return
listeners
},
_type
()
{
if
(
this
.
enums
.
type
.
includes
(
this
.
type
))
{
return
this
.
type
}
else
{
console
.
error
(
`JAreaLinkage的type属性只能接收指定的值(
${
this
.
enums
.
type
.
join
(
'
|
'
)}
)`
)
return
this
.
enums
.
type
[
0
]
}
},
},
watch
:
{
value
:
{
immediate
:
true
,
handler
()
{
this
.
loadDataByValue
(
this
.
value
)
}
},
},
created
()
{
this
.
initAreaData
();
},
methods
:
{
/** 通过 value 反推 options */
loadDataByValue
(
value
)
{
if
(
!
value
||
value
.
length
==
0
){
this
.
innerValue
=
[]
this
.
reloading
=
true
;
setTimeout
(()
=>
{
this
.
reloading
=
false
},
100
)
}
else
{
this
.
initAreaData
();
let
arr
=
this
.
areaData
.
getRealCode
(
value
);
this
.
innerValue
=
arr
}
},
/** 通过地区code获取子级 */
loadDataByCode
(
value
)
{
let
options
=
[]
let
data
=
pcaa
[
value
]
if
(
data
)
{
for
(
let
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
options
.
push
({
value
:
key
,
label
:
data
[
key
],
})
}
}
return
options
}
else
{
return
[]
}
},
/** 判断是否有子节点 */
hasChildren
(
options
)
{
options
.
forEach
(
option
=>
{
let
data
=
this
.
loadDataByCode
(
option
.
value
)
option
.
isLeaf
=
data
.
length
===
0
})
},
handleChange
(
values
)
{
let
value
=
values
[
values
.
length
-
1
]
this
.
$emit
(
'
change
'
,
value
)
},
initAreaData
(){
if
(
!
this
.
areaData
){
this
.
areaData
=
new
Area
();
}
},
},
model
:
{
prop
:
'
value
'
,
event
:
'
change
'
},
}
</
script
>
<
style
lang=
"less"
scoped
>
.j-area-linkage {
height:40px;
/deep/ .area-cascader-wrap .area-select {
width: 100%;
}
/deep/ .area-select .area-selected-trigger {
line-height: 1.15;
}
}
</
style
>
\ No newline at end of file
jshERP-web/vue.config.js
View file @
9141c564
...
...
@@ -70,13 +70,6 @@ module.exports = {
deleteOriginalAssets
:
false
// 删除源文件
}))
}
// 配置 webpack 识别 markdown 为普通的文件
// config.module
// .rule('markdown')
// .test(/\.md$/)
// .use()
// .loader('file-loader')
// .end()
},
css
:
{
loaderOptions
:
{
...
...
Write
Preview
Supports
Markdown
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