Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mocp-uniapp
Overview
Overview
Details
Activity
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
pangchong
mocp-uniapp
Commits
df5a590c
Commit
df5a590c
authored
Jul 26, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 列表多选
parent
8ad2b684
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
12 deletions
+92
-12
src/mocp/components/global-page-swiper-item/global-page-swiper-item.vue
+15
-4
src/mocp/components/global-page-swiper/global-page-swiper.vue
+35
-3
src/mocp/components/global-page/global-page.vue
+41
-4
src/pages/modules/mocp/panel/my-toDo/components/appraisal-record-list.vue
+1
-1
No files found.
src/mocp/components/global-page-swiper-item/global-page-swiper-item.vue
View file @
df5a590c
<
template
>
<
template
>
<!-- 配合global-page-swiper实现左右滑动 -->
<!-- 配合global-page-swiper实现左右滑动 -->
<view
class=
"content"
>
<view
class=
"
mocp-
content"
>
<z-paging
<z-paging
:auto=
"auto"
:auto=
"auto"
:refresher-enabled=
"refresherEnabled"
:refresher-enabled=
"refresherEnabled"
...
@@ -171,6 +171,7 @@ const getDataList = computed({
...
@@ -171,6 +171,7 @@ const getDataList = computed({
}
}
})
})
defineExpose
({
defineExpose
({
getDataList
,
reload
:
()
=>
{
reload
:
()
=>
{
paging
.
value
?.
reload
()
paging
.
value
?.
reload
()
},
},
...
@@ -179,10 +180,20 @@ defineExpose({
...
@@ -179,10 +180,20 @@ defineExpose({
}
}
})
})
</
script
>
</
script
>
<
script
>
<
style
>
export
default
{
options
:
{
styleIsolation
:
'shared'
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
/* 注意:父节点需要固定高度,z-paging的height:100%才会生效 */
/* 注意:父节点需要固定高度,z-paging的height:100%才会生效 */
.content
{
.
mocp-
content
{
height
:
100%
;
height
:
100%
;
//多选框
:deep(.u-checkbox__icon-wrap)
{
min-width
:
18px
;
}
}
}
</
style
>
</
style
>
src/mocp/components/global-page-swiper/global-page-swiper.vue
View file @
df5a590c
...
@@ -65,7 +65,16 @@
...
@@ -65,7 +65,16 @@
:transformData=
"transformData"
:transformData=
"transformData"
>
>
<
template
#="{
dataList
}"
>
<
template
#="{
dataList
}"
>
<template
v-for=
"(item, index) in dataList"
:key=
"index"
>
<up-checkbox-group
v-model=
"chooseValue"
v-if=
"chooseDataType == 'checkbox'"
>
<template
v-for=
"(item, index) in dataList"
:key=
"index"
>
<up-checkbox
:name=
"index"
v-if=
"chooseDataType == 'checkbox'"
>
<template
#
label
>
<slot
:item=
"item"
:index=
"index"
></slot>
</
template
>
</up-checkbox>
</template>
</up-checkbox-group>
<
template
v-for=
"(item, index) in dataList"
:key=
"index"
v-else
>
<slot
:item=
"item"
:index=
"index"
></slot>
<slot
:item=
"item"
:index=
"index"
></slot>
</
template
>
</
template
>
</template>
</template>
...
@@ -85,11 +94,11 @@
...
@@ -85,11 +94,11 @@
</template>
</template>
<
script
setup
>
<
script
setup
>
import
{
computed
,
nextTick
,
onUnmounted
,
ref
}
from
'vue'
import
{
computed
,
nextTick
,
onUnmounted
,
ref
,
watch
}
from
'vue'
// 获取屏幕边界到安全区域距离
// 获取屏幕边界到安全区域距离
const
{
safeAreaInsets
}
=
uni
.
getSystemInfoSync
()
const
{
safeAreaInsets
}
=
uni
.
getSystemInfoSync
()
const
es
=
defineEmits
([
'handleLeftClick'
,
'handleRightClick'
,
'handleFooterClick'
])
const
es
=
defineEmits
([
'handleLeftClick'
,
'handleRightClick'
,
'handleFooterClick'
,
'handleChooseData'
])
const
ps
=
defineProps
({
const
ps
=
defineProps
({
background
:
{
background
:
{
type
:
String
,
type
:
String
,
...
@@ -213,6 +222,19 @@ const ps = defineProps({
...
@@ -213,6 +222,19 @@ const ps = defineProps({
type
:
Boolean
,
type
:
Boolean
,
default
:
true
default
:
true
},
},
//选择数据的类型'checkbox' | 'radio'
chooseDataType
:
{
type
:
String
,
default
:
''
},
mapFieldName
:
{
type
:
String
,
default
:
''
},
mapFieldSplit
:
{
type
:
String
,
default
:
','
},
//查询参数
//查询参数
params
:
{
params
:
{
type
:
Object
,
type
:
Object
,
...
@@ -284,6 +306,16 @@ const getStyle = computed(() => {
...
@@ -284,6 +306,16 @@ const getStyle = computed(() => {
}
}
return
style
return
style
})
})
//监听选择
const
chooseValue
=
ref
([])
watch
(
chooseValue
,
(
value
)
=>
{
let
data
=
value
.
map
((
index
)
=>
pagingArr
.
value
[
current
.
value
]?.
getDataList
[
index
])
if
(
ps
.
mapFieldName
)
{
data
=
data
.
map
((
v
)
=>
v
[
ps
.
mapFieldName
]).
join
(
ps
.
mapFieldSplit
)
}
console
.
log
(
data
)
es
(
'handleChooseData'
,
data
)
})
const
current
=
ref
(
ps
.
current
)
const
current
=
ref
(
ps
.
current
)
// tabs通知swiper切换
// tabs通知swiper切换
const
tabsChange
=
(
item
)
=>
{
const
tabsChange
=
(
item
)
=>
{
...
...
src/mocp/components/global-page/global-page.vue
View file @
df5a590c
...
@@ -47,8 +47,19 @@
...
@@ -47,8 +47,19 @@
</template>
</template>
<!-- 滚动内容 -->
<!-- 滚动内容 -->
<view
class=
"mocp-content"
:style=
"getStyle"
>
<view
class=
"mocp-content"
:style=
"getStyle"
>
<
template
v-for=
"(item, index) in getDataList"
:key=
"index"
v-if=
"isDataList || localData"
>
<
template
v-if=
"isDataList || localData"
>
<slot
:item=
"item"
:index=
"index"
></slot>
<up-checkbox-group
v-model=
"chooseValue"
v-if=
"chooseDataType == 'checkbox'"
>
<template
v-for=
"(item, index) in getDataList"
:key=
"index"
>
<up-checkbox
:name=
"index"
v-if=
"chooseDataType == 'checkbox'"
>
<template
#
label
>
<slot
:item=
"item"
:index=
"index"
></slot>
</
template
>
</up-checkbox>
</template>
</up-checkbox-group>
<
template
v-for=
"(item, index) in getDataList"
:key=
"index"
v-else
>
<slot
:item=
"item"
:index=
"index"
></slot>
</
template
>
</template>
</template>
<slot
v-else
></slot>
<slot
v-else
></slot>
</view>
</view>
...
@@ -65,10 +76,10 @@
...
@@ -65,10 +76,10 @@
</template>
</template>
<
script
setup
>
<
script
setup
>
import
{
filterEmptyValues
}
from
'mocp/utils/tool'
import
{
filterEmptyValues
}
from
'mocp/utils/tool'
import
{
computed
,
nextTick
,
onUnmounted
,
ref
}
from
'vue'
import
{
computed
,
nextTick
,
onUnmounted
,
ref
,
watch
}
from
'vue'
const
dataList
=
ref
([])
const
dataList
=
ref
([])
const
es
=
defineEmits
([
'query'
,
'handleLeftClick'
,
'handleRightClick'
,
'handleFooterClick'
])
const
es
=
defineEmits
([
'query'
,
'handleLeftClick'
,
'handleRightClick'
,
'handleFooterClick'
,
'handleChooseData'
])
const
paging
=
ref
()
const
paging
=
ref
()
const
ps
=
defineProps
({
const
ps
=
defineProps
({
background
:
{
background
:
{
...
@@ -183,6 +194,19 @@ const ps = defineProps({
...
@@ -183,6 +194,19 @@ const ps = defineProps({
type
:
Boolean
,
type
:
Boolean
,
default
:
false
default
:
false
},
},
//选择数据的类型'checkbox' | 'radio'
chooseDataType
:
{
type
:
String
,
default
:
''
},
mapFieldName
:
{
type
:
String
,
default
:
''
},
mapFieldSplit
:
{
type
:
String
,
default
:
','
},
//查询参数
//查询参数
params
:
{
params
:
{
type
:
Object
,
type
:
Object
,
...
@@ -267,6 +291,15 @@ const scroll = () => {
...
@@ -267,6 +291,15 @@ const scroll = () => {
},
500
)
},
500
)
// #endif
// #endif
}
}
//监听选择
const
chooseValue
=
ref
([])
watch
(
chooseValue
,
(
value
)
=>
{
let
data
=
value
.
map
((
index
)
=>
getDataList
.
value
[
index
])
if
(
ps
.
mapFieldName
)
{
data
=
data
.
map
((
v
)
=>
v
[
ps
.
mapFieldName
]).
join
(
ps
.
mapFieldSplit
)
}
es
(
'handleChooseData'
,
data
)
})
// 获取屏幕边界到安全区域距离
// 获取屏幕边界到安全区域距离
const
{
safeAreaInsets
}
=
uni
.
getSystemInfoSync
()
const
{
safeAreaInsets
}
=
uni
.
getSystemInfoSync
()
//列表加载
//列表加载
...
@@ -391,6 +424,10 @@ export default {
...
@@ -391,6 +424,10 @@ export default {
}
}
}
}
}
}
//
多选框
:deep
(
.u-checkbox__icon-wrap
)
{
min-width
:
18px
;
}
}
}
.cancel
{
.cancel
{
...
...
src/pages/modules/mocp/panel/my-toDo/components/appraisal-record-list.vue
View file @
df5a590c
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
auto
auto
>
>
<template
#
default=
"
{ item }">
<template
#
default=
"
{ item }">
<view
v-for=
"item in dataList"
:key=
"item.id"
class=
"item"
@
tap=
"goDetails(item)"
>
<view
class=
"item"
@
tap=
"goDetails(item)"
>
<view
class=
"item-title"
>
<view
class=
"item-title"
>
<view
class=
"desc"
>
<view
class=
"desc"
>
<custom-state
:value=
"item.status == 1 ? 'OPEN' : 'CLOSE'"
></custom-state>
<custom-state
:value=
"item.status == 1 ? 'OPEN' : 'CLOSE'"
></custom-state>
...
...
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