Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-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
6fa6ef99
authored
2022-11-30 16:27:50 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:用户信息
1 parent
ff6711fb
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
83 deletions
src/components/LbTable/lb-column.vue
src/components/LbTable/lb-table.vue
src/components/LbTable/radio.js
src/components/lbTable/lb-column.vue
src/components/lbTable/lb-table.vue
src/store/getters.js
src/store/modules/user.js
src/views/ywbl/ywsq/javascript/jsydsyq100.js
src/components/LbTable/lb-column.vue
View file @
6fa6ef9
...
...
@@ -41,7 +41,6 @@
<
script
>
import
LbRender
from
'./lb-render'
import
forced
from
'./forced.js'
import
radio
from
'./radio.js'
export
default
{
name
:
'LbColumn'
,
props
:
{
...
...
@@ -54,13 +53,10 @@ export default {
},
methods
:
{
setColumn
()
{
if
(
this
.
column
.
type
&&
this
.
column
.
type
!=
'radio'
)
{
if
(
this
.
column
.
type
)
{
this
.
column
.
renderHeader
=
forced
[
this
.
column
.
type
].
renderHeader
this
.
column
.
render
=
this
.
column
.
render
||
forced
[
this
.
column
.
type
].
renderCell
}
if
(
this
.
column
.
type
==
'radio'
)
{
this
.
column
.
render
=
this
.
column
.
render
||
radio
[
this
.
column
.
type
].
renderCell
}
if
(
this
.
column
.
formatter
)
{
this
.
column
.
render
=
(
h
,
scope
)
=>
{
return
<
span
>
{
scope
.
column
.
formatter
(
scope
.
row
,
scope
.
column
,
scope
.
row
,
scope
.
$index
)}
<
/span
>
...
...
src/components/LbTable/lb-table.vue
View file @
6fa6ef9
...
...
@@ -11,9 +11,15 @@
<
template
>
<div
:class=
"['lb-table', customClass]"
>
<el-table
v-if=
"!heightNumSetting"
class=
"table-fixed"
:row-style=
"
{ height: '50px' }" ref="elTable"
:border='border' :row-class-name="tableRowClassName" :show-header='showHeader'
:border='border' :row-class-name="tableRowClassName" :show-header='showHeader'
@row-click="singleElection"
:header-cell-style="{ background: 'rgb(236, 245, 255)' }" v-bind="$attrs" :height="tableHeight" v-on="$listeners"
:data="data" style="width: 100%" :span-method="this.merge ? this.mergeMethod : this.spanMethod">
<el-table-column
width=
"45"
align=
"center"
v-if=
"isRadio"
>
<template
slot-scope=
"scope"
>
<el-radio
v-model=
"selected"
:label=
"scope.$index"
></el-radio>
</
template
>
</el-table-column>
<lb-column
v-bind=
"$attrs"
v-for=
"(item, index) in column"
:key=
"index"
:column=
"item"
>
</lb-column>
</el-table>
...
...
@@ -22,6 +28,12 @@
:row-class-name=
"tableRowClassName"
:show-header=
'showHeader'
:header-cell-style=
"{ background: 'rgb(236, 245, 255)' }"
v-bind=
"$attrs"
:max-height=
"maxHeight"
v-on=
"$listeners"
:data=
"data"
style=
"width: 100%"
:span-method=
"this.merge ? this.mergeMethod : this.spanMethod"
>
<el-table-column
width=
"45"
align=
"center"
v-if=
"isRadio"
>
<
template
slot-scope=
"scope"
>
<el-radio
v-model=
"selected"
:label=
"scope.$index"
></el-radio>
</
template
>
</el-table-column>
<lb-column
v-bind=
"$attrs"
v-for=
"(item, index) in column"
:key=
"index"
:column=
"item"
>
</lb-column>
</el-table>
...
...
@@ -45,6 +57,10 @@ export default {
type
:
Boolean
,
default
:
true
,
},
isRadio
:
{
type
:
Boolean
,
default
:
false
,
},
border
:
{
type
:
Boolean
,
default
:
true
,
...
...
@@ -87,6 +103,7 @@ export default {
tableHeight
:
''
,
mergeLine
:
{},
mergeIndex
:
{},
selected
:
''
}
},
created
()
{
...
...
@@ -99,6 +116,13 @@ export default {
},
},
methods
:
{
// 单选
singleElection
(
row
)
{
this
.
selected
=
this
.
data
.
indexOf
(
row
);
console
.
log
(
this
.
selected
);
},
tableRowClassName
({
row
,
rowIndex
})
{
if
(
rowIndex
%
2
===
1
)
{
return
'interlaced'
;
...
...
@@ -197,4 +221,8 @@ export default {
padding-left
:
3px
;
padding-right
:
3px
;
}
/
deep
/
.el-radio__label
{
display
:
none
;
}
</
style
>
...
...
src/components/LbTable/radio.js
deleted
100644 → 0
View file @
ff6711f
export
default
{
radio
:
{
renderHeader
:
(
h
,
{
store
})
=>
{
return
'单选'
},
renderCell
:
(
h
,
{
row
,
column
,
store
,
$index
})
=>
{
return
(
<
el
-
radio
nativeOn
-
click
=
{
event
=>
event
.
stopPropagation
()}
value
=
{
store
.
isSelected
(
row
)}
disabled
=
{
column
.
selectable
?
!
column
.
selectable
.
call
(
null
,
row
,
$index
)
:
false
}
on
-
input
=
{()
=>
{
store
.
commit
(
'rowSelectedChanged'
,
row
)
}}
/
>
)
},
sortable
:
false
,
resizable
:
false
},
index
:
{
renderHeader
:
(
h
,
scope
)
=>
{
return
<
span
>
{
scope
.
column
.
label
||
'#'
}
<
/span
>
},
renderCell
:
(
h
,
{
$index
,
column
})
=>
{
let
i
=
$index
+
1
const
index
=
column
.
index
if
(
typeof
index
===
'number'
)
{
i
=
$index
+
index
}
else
if
(
typeof
index
===
'function'
)
{
i
=
index
(
$index
)
}
return
<
div
>
{
i
}
<
/div
>
},
sortable
:
false
},
expand
:
{
renderHeader
:
(
h
,
scope
)
=>
{
return
<
span
>
{
scope
.
column
.
label
||
''
}
<
/span
>
},
renderCell
:
(
h
,
{
row
,
store
},
proxy
)
=>
{
const
expanded
=
store
.
states
.
expandRows
.
indexOf
(
row
)
>
-
1
return
(
<
div
class
=
{
'el-table__expand-icon '
+
(
expanded
?
'el-table__expand-icon--expanded'
:
''
)
}
on
-
click
=
{
e
=>
proxy
.
handleExpandClick
(
row
,
e
)}
>
<
i
class
=
'el-icon el-icon-arrow-right'
/>
<
/div
>
)
},
sortable
:
false
,
resizable
:
false
,
className
:
'el-table__expand-column'
}
}
src/components/lbTable/lb-column.vue
View file @
6fa6ef9
...
...
@@ -41,7 +41,6 @@
<
script
>
import
LbRender
from
'./lb-render'
import
forced
from
'./forced.js'
import
radio
from
'./radio.js'
export
default
{
name
:
'LbColumn'
,
props
:
{
...
...
@@ -54,13 +53,10 @@ export default {
},
methods
:
{
setColumn
()
{
if
(
this
.
column
.
type
&&
this
.
column
.
type
!=
'radio'
)
{
if
(
this
.
column
.
type
)
{
this
.
column
.
renderHeader
=
forced
[
this
.
column
.
type
].
renderHeader
this
.
column
.
render
=
this
.
column
.
render
||
forced
[
this
.
column
.
type
].
renderCell
}
if
(
this
.
column
.
type
==
'radio'
)
{
this
.
column
.
render
=
this
.
column
.
render
||
radio
[
this
.
column
.
type
].
renderCell
}
if
(
this
.
column
.
formatter
)
{
this
.
column
.
render
=
(
h
,
scope
)
=>
{
return
<
span
>
{
scope
.
column
.
formatter
(
scope
.
row
,
scope
.
column
,
scope
.
row
,
scope
.
$index
)}
<
/span
>
...
...
src/components/lbTable/lb-table.vue
View file @
6fa6ef9
...
...
@@ -11,9 +11,15 @@
<
template
>
<div
:class=
"['lb-table', customClass]"
>
<el-table
v-if=
"!heightNumSetting"
class=
"table-fixed"
:row-style=
"
{ height: '50px' }" ref="elTable"
:border='border' :row-class-name="tableRowClassName" :show-header='showHeader'
:border='border' :row-class-name="tableRowClassName" :show-header='showHeader'
@row-click="singleElection"
:header-cell-style="{ background: 'rgb(236, 245, 255)' }" v-bind="$attrs" :height="tableHeight" v-on="$listeners"
:data="data" style="width: 100%" :span-method="this.merge ? this.mergeMethod : this.spanMethod">
<el-table-column
width=
"45"
align=
"center"
v-if=
"isRadio"
>
<template
slot-scope=
"scope"
>
<el-radio
v-model=
"selected"
:label=
"scope.$index"
></el-radio>
</
template
>
</el-table-column>
<lb-column
v-bind=
"$attrs"
v-for=
"(item, index) in column"
:key=
"index"
:column=
"item"
>
</lb-column>
</el-table>
...
...
@@ -22,6 +28,12 @@
:row-class-name=
"tableRowClassName"
:show-header=
'showHeader'
:header-cell-style=
"{ background: 'rgb(236, 245, 255)' }"
v-bind=
"$attrs"
:max-height=
"maxHeight"
v-on=
"$listeners"
:data=
"data"
style=
"width: 100%"
:span-method=
"this.merge ? this.mergeMethod : this.spanMethod"
>
<el-table-column
width=
"45"
align=
"center"
v-if=
"isRadio"
>
<
template
slot-scope=
"scope"
>
<el-radio
v-model=
"selected"
:label=
"scope.$index"
></el-radio>
</
template
>
</el-table-column>
<lb-column
v-bind=
"$attrs"
v-for=
"(item, index) in column"
:key=
"index"
:column=
"item"
>
</lb-column>
</el-table>
...
...
@@ -45,6 +57,10 @@ export default {
type
:
Boolean
,
default
:
true
,
},
isRadio
:
{
type
:
Boolean
,
default
:
false
,
},
border
:
{
type
:
Boolean
,
default
:
true
,
...
...
@@ -87,6 +103,7 @@ export default {
tableHeight
:
''
,
mergeLine
:
{},
mergeIndex
:
{},
selected
:
''
}
},
created
()
{
...
...
@@ -99,6 +116,13 @@ export default {
},
},
methods
:
{
// 单选
singleElection
(
row
)
{
this
.
selected
=
this
.
data
.
indexOf
(
row
);
console
.
log
(
this
.
selected
);
},
tableRowClassName
({
row
,
rowIndex
})
{
if
(
rowIndex
%
2
===
1
)
{
return
'interlaced'
;
...
...
@@ -197,4 +221,8 @@ export default {
padding-left
:
3px
;
padding-right
:
3px
;
}
/
deep
/
.el-radio__label
{
display
:
none
;
}
</
style
>
...
...
src/store/getters.js
View file @
6fa6ef9
...
...
@@ -7,6 +7,7 @@ const getters = {
token
:
state
=>
state
.
user
.
token
,
avatar
:
state
=>
state
.
user
.
avatar
,
name
:
state
=>
state
.
user
.
name
,
userData
:
state
=>
state
.
user
.
userData
,
permission_routes
:
state
=>
state
.
permission
.
routes
,
addRoutes
:
state
=>
state
.
permission
.
addRoutes
,
addDict
:
state
=>
state
.
dict
.
addDict
,
...
...
src/store/modules/user.js
View file @
6fa6ef9
...
...
@@ -2,10 +2,12 @@ import { getUserInfo } from '@/api/user'
const
state
=
{
name
:
''
,
avatar
:
'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
,
userData
:
{}
}
const
mutations
=
{
SET_NAME
:
(
state
,
name
)
=>
{
state
.
name
=
name
SET_NAME
:
(
state
,
data
)
=>
{
state
.
name
=
data
.
loginName
state
.
userData
=
data
}
}
...
...
@@ -13,7 +15,7 @@ const actions = {
getUserInfo
({
commit
})
{
return
new
Promise
(
async
(
resolve
)
=>
{
let
{
result
:
res
}
=
await
getUserInfo
()
commit
(
'SET_NAME'
,
res
.
loginName
)
commit
(
'SET_NAME'
,
res
)
resolve
(
true
)
})
},
...
...
src/views/ywbl/ywsq/javascript/jsydsyq100.js
View file @
6fa6ef9
...
...
@@ -11,9 +11,8 @@ class data extends filter {
columns
()
{
return
[
{
type
:
'radio'
,
label
:
'单选'
,
width
:
'50'
type
:
'selection'
,
label
:
'全选'
},
{
label
:
'序号'
,
...
...
Please
register
or
sign in
to post a comment