Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcjg-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
780282d0
authored
2023-07-27 09:18:53 +0800
by
yuanbo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加注释
1 parent
b7cefaa0
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
190 additions
and
10 deletions
src/components/Breadcrumb.vue
src/components/Button.vue
src/components/LbTable/LbColumn.vue
src/components/Loading/index.js
src/components/Loading/src/index.js
src/components/Loading/src/loading.vue
src/components/MessageBox/src/main.js
src/components/MessageBox/src/main.vue
src/components/Popup/index.js
src/components/Popup/index.vue
src/components/TreeSelect.vue
src/components/Breadcrumb.vue
View file @
780282d
<!--
* @Description:
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-20 16:36:51
-->
...
...
@@ -32,6 +32,10 @@ export default {
this
.
getBreadcrumb
();
},
methods
:
{
/**
* @description: getBreadcrumb
* @author: renchao
*/
getBreadcrumb
()
{
// only show routes with meta.title
this
.
levelList
=
this
.
$route
.
matched
.
filter
(
...
...
@@ -41,6 +45,11 @@ export default {
this
.
levelList
=
this
.
levelList
.
slice
(
-
1
)
}
},
/**
* @description: isDashboard
* @param {*} route
* @author: renchao
*/
isDashboard
(
route
)
{
const
name
=
route
&&
route
.
name
;
if
(
!
name
)
{
...
...
@@ -50,6 +59,11 @@ export default {
name
.
trim
().
toLocaleLowerCase
()
===
"Dashboard"
.
toLocaleLowerCase
()
);
},
/**
* @description: pathCompile
* @param {*} path
* @author: renchao
*/
pathCompile
(
path
)
{
const
{
params
}
=
this
.
$route
;
var
toPath
=
pathToRegexp
.
compile
(
path
);
...
...
@@ -57,4 +71,4 @@ export default {
}
}
}
</
script
>
\ No newline at end of file
</
script
>
...
...
src/components/Button.vue
View file @
780282d
...
...
@@ -25,6 +25,11 @@
}
},
methods
:
{
/**
* @description: handleClick
* @param {*} evt
* @author: renchao
*/
handleClick
(
evt
)
{
this
.
$emit
(
'click'
,
evt
);
}
...
...
src/components/LbTable/LbColumn.vue
View file @
780282d
...
...
@@ -52,6 +52,10 @@ export default {
LbRender
},
methods
:
{
/**
* @description: setColumn
* @author: renchao
*/
setColumn
()
{
if
(
this
.
column
.
type
)
{
this
.
column
.
renderHeader
=
forced
[
this
.
column
.
type
].
renderHeader
...
...
src/components/Loading/index.js
View file @
780282d
import
service
from
'./src/index'
;
export
default
{
/**
* @description: install
* @param {*} Vue
* @author: renchao
*/
install
(
Vue
)
{
Vue
.
prototype
.
$loading
=
service
;
},
...
...
src/components/Loading/src/index.js
View file @
780282d
...
...
@@ -20,6 +20,10 @@ let fullscreenLoading;
LoadingConstructor
.
prototype
.
originalPosition
=
''
;
LoadingConstructor
.
prototype
.
originalOverflow
=
''
;
/**
* @description: close
* @author: renchao
*/
LoadingConstructor
.
prototype
.
close
=
function
()
{
if
(
this
.
fullscreen
)
{
fullscreenLoading
=
undefined
;
...
...
@@ -38,6 +42,13 @@ LoadingConstructor.prototype.close = function() {
this
.
visible
=
false
;
};
/**
* @description: addStyle
* @param {*} options
* @param {*} parent
* @param {*} instance
* @author: renchao
*/
const
addStyle
=
(
options
,
parent
,
instance
)
=>
{
let
maskStyle
=
{};
if
(
options
.
fullscreen
)
{
...
...
@@ -64,6 +75,11 @@ const addStyle = (options, parent, instance) => {
});
};
/**
* @description: Loading
* @param {*} options
* @author: renchao
*/
const
Loading
=
(
options
=
{})
=>
{
if
(
Vue
.
prototype
.
$isServer
)
return
;
options
=
merge
({},
defaults
,
options
);
...
...
src/components/Loading/src/loading.vue
View file @
780282d
...
...
@@ -28,9 +28,18 @@ export default {
},
methods
:
{
/**
* @description: handleAfterLeave
* @author: renchao
*/
handleAfterLeave
()
{
this
.
$emit
(
'after-leave'
);
},
/**
* @description: setText
* @param {*} text
* @author: renchao
*/
setText
(
text
)
{
this
.
text
=
text
;
}
...
...
@@ -46,4 +55,4 @@ export default {
height
:
80px
;
}
}
</
style
>
\ No newline at end of file
</
style
>
...
...
src/components/MessageBox/src/main.js
View file @
780282d
...
...
@@ -43,6 +43,10 @@ const MessageBoxConstructor = Vue.extend(msgboxVue);
let
currentMsg
,
instance
;
let
msgQueue
=
[];
/**
* @description: defaultCallback
* @author: renchao
*/
const
defaultCallback
=
action
=>
{
if
(
currentMsg
)
{
let
callback
=
currentMsg
.
callback
;
...
...
@@ -56,6 +60,10 @@ const defaultCallback = action => {
}
};
/**
* @description: initInstance
* @author: renchao
*/
const
initInstance
=
()
=>
{
instance
=
new
MessageBoxConstructor
({
el
:
document
.
createElement
(
'div'
)
...
...
@@ -64,6 +72,10 @@ const initInstance = () => {
instance
.
callback
=
defaultCallback
;
};
/**
* @description: showNextMsg
* @author: renchao
*/
const
showNextMsg
=
()
=>
{
if
(
!
instance
)
{
initInstance
();
...
...
@@ -109,6 +121,12 @@ const showNextMsg = () => {
}
};
/**
* @description: MessageBox
* @param {*} options
* @param {*} callback
* @author: renchao
*/
const
MessageBox
=
function
(
options
,
callback
)
{
if
(
Vue
.
prototype
.
$isServer
)
return
;
if
(
typeof
options
===
'string'
||
isVNode
(
options
))
{
...
...
@@ -143,10 +161,21 @@ const MessageBox = function (options, callback) {
}
};
/**
* @description: setDefaults
* @author: renchao
*/
MessageBox
.
setDefaults
=
defaults
=>
{
MessageBox
.
defaults
=
defaults
;
};
/**
* @description: alert
* @param {*} title
* @param {*} message
* @param {*} options
* @author: renchao
*/
MessageBox
.
alert
=
(
title
,
message
,
options
)
=>
{
if
(
typeof
title
===
'object'
)
{
options
=
title
;
...
...
@@ -163,6 +192,10 @@ MessageBox.alert = (title, message, options) => {
},
options
));
};
/**
* @description: close
* @author: renchao
*/
MessageBox
.
close
=
()
=>
{
instance
.
doClose
();
instance
.
visible
=
false
;
...
...
src/components/MessageBox/src/main.vue
View file @
780282d
<
template
>
<transition
name=
"msgbox-fade"
>
<div
class=
"el-message-box__wrapper"
tabindex=
"-1"
v-show=
"visible"
@
click
.
self=
"handleWrapperClick"
role=
"dialog"
aria-modal=
"true"
:aria-label=
"title || 'dialog'"
>
aria-modal=
"true"
:aria-label=
"title || 'dialog'"
>
<div
class=
"el-message-box"
:class=
"[customClass, center && 'el-message-box--center']"
>
<div
class=
"el-message-box__header"
v-if=
"title !== null"
>
<div
class=
"el-message-box__title"
>
<span>
标题:
{{
title
}}
</span>
</div>
<button
type=
"button"
class=
"el-message-box__headerbtn"
aria-label=
"Close"
v-if=
"showClose"
@
click=
"handleAction(distinguishCancelAndClose ? 'close' : 'cancel')"
@
keydown
.
enter=
"handleAction(distinguishCancelAndClose ? 'close' : 'cancel')"
>
@
click=
"handleAction(distinguishCancelAndClose ? 'close' : 'cancel')"
@
keydown
.
enter=
"handleAction(distinguishCancelAndClose ? 'close' : 'cancel')"
>
<i
class=
"el-message-box__close el-icon-close"
></i>
</button>
</div>
...
...
@@ -18,7 +18,7 @@
</div>
<div
class=
"el-message-box__btns"
>
<el-button
:loading=
"cancelButtonLoading"
:class=
"[cancelButtonClasses]"
:round=
"roundButton"
size=
"small"
@
click
.
native=
"handleAction('cancel')"
@
keydown
.
enter=
"handleAction('cancel')"
>
@
click
.
native=
"handleAction('cancel')"
@
keydown
.
enter=
"handleAction('cancel')"
>
{{
cancelButtonText
||
t
(
'el.messagebox.cancel'
)
}}
</el-button>
</div>
...
...
@@ -97,6 +97,10 @@ export default {
},
methods
:
{
/**
* @description: getSafeClose
* @author: renchao
*/
getSafeClose
()
{
const
currentId
=
this
.
uid
;
return
()
=>
{
...
...
@@ -105,6 +109,10 @@ export default {
});
};
},
/**
* @description: doClose
* @author: renchao
*/
doClose
()
{
if
(
!
this
.
visible
)
return
;
this
.
visible
=
false
;
...
...
@@ -122,18 +130,31 @@ export default {
});
},
/**
* @description: handleWrapperClick
* @author: renchao
*/
handleWrapperClick
()
{
if
(
this
.
closeOnClickModal
)
{
this
.
handleAction
(
this
.
distinguishCancelAndClose
?
'close'
:
'cancel'
);
}
},
/**
* @description: handleInputEnter
* @author: renchao
*/
handleInputEnter
()
{
if
(
this
.
inputType
!==
'textarea'
)
{
return
this
.
handleAction
(
'confirm'
);
}
},
/**
* @description: handleAction
* @param {*} action
* @author: renchao
*/
handleAction
(
action
)
{
if
(
this
.
$type
===
'prompt'
&&
action
===
'confirm'
&&
!
this
.
validate
())
{
return
;
...
...
@@ -147,6 +168,10 @@ export default {
}
},
/**
* @description: validate
* @author: renchao
*/
validate
()
{
if
(
this
.
$type
===
'prompt'
)
{
const
inputPattern
=
this
.
inputPattern
;
...
...
@@ -174,15 +199,27 @@ export default {
removeClass
(
this
.
getInputElement
(),
'invalid'
);
return
true
;
},
/**
* @description: getFirstFocus
* @author: renchao
*/
getFirstFocus
()
{
const
btn
=
this
.
$el
.
querySelector
(
'.el-message-box__btns .el-button'
);
const
title
=
this
.
$el
.
querySelector
(
'.el-message-box__btns .el-message-box__title'
);
return
btn
||
title
;
},
/**
* @description: getInputElement
* @author: renchao
*/
getInputElement
()
{
const
inputRefs
=
this
.
$refs
.
input
.
$refs
;
return
inputRefs
.
input
||
inputRefs
.
textarea
;
},
/**
* @description: handleClose
* @author: renchao
*/
handleClose
()
{
this
.
handleAction
(
'close'
);
}
...
...
@@ -294,4 +331,4 @@ export default {
/
deep
/
.el-message-box__content
{
padding-top
:
0
;
}
</
style
>
\ No newline at end of file
</
style
>
...
...
src/components/Popup/index.js
View file @
780282d
...
...
@@ -3,6 +3,10 @@ import Popup from './index.vue'
const
PopupBox
=
Vue
.
extend
(
Popup
)
let
popuping
=
undefined
/**
* @description: close
* @author: renchao
*/
PopupBox
.
prototype
.
close
=
function
()
{
// 如果Popup 有引用,则去掉引用
if
(
popuping
)
{
...
...
@@ -19,6 +23,14 @@ PopupBox.prototype.close = function () {
},
300
)
}
/**
* @description: Popup1
* @param {*} title
* @param {*} editItem
* @param {*} data
* @param {*} formData
* @author: renchao
*/
const
Popup1
=
(
title
,
editItem
,
data
,
formData
)
=>
{
// 如果组件已渲染,则返回即可
if
(
popuping
)
{
...
...
src/components/Popup/index.vue
View file @
780282d
...
...
@@ -74,9 +74,17 @@
},
300
)
},
methods
:
{
/**
* @description: onCancel
* @author: renchao
*/
onCancel
()
{
Popup1
().
close
()
},
/**
* @description: onConfirm
* @author: renchao
*/
onConfirm
()
{
this
.
loading
=
true
let
res
=
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -87,9 +95,19 @@
this
.
isShow
=
false
}
},
/**
* @description: loadingFn
* @param {*} e
* @author: renchao
*/
loadingFn
(
e
)
{
//加载状态
this
.
loading
=
e
},
/**
* @description: loadViewFn
* @param {*} view
* @author: renchao
*/
loadViewFn
(
view
)
{
return
(
r
)
=>
require
.
ensure
([],
()
=>
...
...
src/components/TreeSelect.vue
View file @
780282d
...
...
@@ -62,10 +62,14 @@
}
},
mounted
()
{
this
.
initHandle
()
this
.
initHandle
()
},
methods
:
{
// 初始化值
/**
* @description: 初始化值
* @author: renchao
*/
initHandle
()
{
if
(
this
.
valueId
&&
this
.
options
.
length
!=
0
)
{
this
.
valueTitle
=
this
.
$refs
.
selectTree
.
getNode
(
this
.
valueId
).
data
[
...
...
@@ -77,6 +81,10 @@
this
.
initScroll
()
},
// 初始化滚动条
/**
* @description: 初始化滚动条
* @author: renchao
*/
initScroll
()
{
this
.
$nextTick
(()
=>
{
let
scrollWrap
=
document
.
querySelectorAll
(
...
...
@@ -91,6 +99,11 @@
})
},
// 切换选项
/**
* @description: 切换选项
* @param {*} node
* @author: renchao
*/
handleNodeClick
(
node
)
{
this
.
valueId
=
node
[
this
.
props
.
value
]
this
.
valueTitle
=
node
[
this
.
props
.
label
]
...
...
@@ -122,6 +135,10 @@
// return temp
// },
// 清除选中
/**
* @description: 清除选中
* @author: renchao
*/
clearHandle
()
{
this
.
valueTitle
=
''
this
.
valueId
=
null
...
...
@@ -130,10 +147,20 @@
this
.
$emit
(
'getValue'
,
null
)
},
/* 清空选中样式 */
/**
* @description: 清空选中样式
* @author: renchao
*/
clearSelected
()
{
let
allNode
=
document
.
querySelectorAll
(
'#tree-option .el-tree-node'
)
allNode
.
forEach
((
element
)
=>
element
.
classList
.
remove
(
'is-current'
))
},
/**
* @description: filterNode
* @param {*} value
* @param {*} data
* @author: renchao
*/
filterNode
(
value
,
data
)
{
if
(
!
value
)
return
true
return
data
.
name
.
indexOf
(
value
)
!==
-
1
...
...
@@ -181,4 +208,4 @@
padding
:
0
5px
;
box-sizing
:
border-box
;
}
</
style
>
\ No newline at end of file
</
style
>
...
...
Please
register
or
sign in
to post a comment