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
f1f05f00
Commit
f1f05f00
authored
Dec 24, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 下拉框多选功能
parent
caa6a1f1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
14 deletions
+66
-14
src/mocp/components/global-button/global-button.vue
+1
-0
src/mocp/components/global-picker/global-picker.vue
+58
-8
src/mocp/components/global-popup/global-popup.vue
+1
-0
src/pages/modules/mocp/panel/unplanApply/add.vue
+1
-1
src/pages/modules/mocp/panel/unplanApply/constants/add.compositions.js
+1
-1
src/pages/modules/mocp/panel/unplanApply/constants/add.functionals.js
+1
-1
src/pages/modules/mocp/panel/unplanWarning/add.vue
+1
-1
src/pages/modules/mocp/panel/unplanWarning/constants/add.compositions.js
+1
-1
src/pages/modules/mocp/panel/unplanWarning/constants/add.functionals.js
+1
-1
No files found.
src/mocp/components/global-button/global-button.vue
View file @
f1f05f00
...
@@ -94,6 +94,7 @@ const getRadius = computed(() => {
...
@@ -94,6 +94,7 @@ const getRadius = computed(() => {
.global-button
{
.global-button
{
border-radius
:
v-bind
(
getRadius
);
border-radius
:
v-bind
(
getRadius
);
height
:
v-bind
(
getSize
);
height
:
v-bind
(
getSize
);
min-height
:
v-bind
(
getSize
);
line-height
:
v-bind
(
getSize
);
line-height
:
v-bind
(
getSize
);
.icon
{
.icon
{
margin-right
:
8
rpx
;
margin-right
:
8
rpx
;
...
...
src/mocp/components/global-picker/global-picker.vue
View file @
f1f05f00
<
template
>
<
template
>
<!-- 全局下拉框控件 -->
<!-- 全局下拉框控件 -->
<view
class=
"picker"
:class=
"
{ 'u-border': ps.border }" :style="style">
<view
class=
"picker"
:class=
"
{ 'u-border': ps.border }" :style="style">
<global-popup
v-model=
"show"
:height=
"592"
:customStyle=
"
{ padding: '28rpx 32rpx' }" v-if="filter" :distance="distance">
<global-popup
v-model=
"show"
:height=
"592"
:customStyle=
"
{ padding: '28rpx 32rpx' }" v-if="filter
|| multiple
" :distance="distance">
<template
#
top
>
<template
#
top
>
<view>
<view>
<up-search
:placeholder=
"placeholder"
:showAction=
"false"
v-model=
"searchKey"
></up-search>
<up-search
:placeholder=
"placeholder"
:showAction=
"false"
v-model=
"searchKey"
></up-search>
...
@@ -10,7 +10,9 @@
...
@@ -10,7 +10,9 @@
<view
class=
"popup-content-list"
v-if=
"getFilterColumns.length"
>
<view
class=
"popup-content-list"
v-if=
"getFilterColumns.length"
>
<view
<view
class=
"popup-content-item u-line-1"
class=
"popup-content-item u-line-1"
:class=
"{ 'mocp-color-primary-6': modelValue == item[valueField] }"
:class=
"{
'mocp-color-primary-6': multipleValue.includes(item[valueField])
}"
v-for=
"(item, index) in getFilterColumns"
v-for=
"(item, index) in getFilterColumns"
:key=
"index"
:key=
"index"
@
tap=
"handleChoose(item[valueField])"
@
tap=
"handleChoose(item[valueField])"
...
@@ -21,6 +23,11 @@
...
@@ -21,6 +23,11 @@
<view
style=
"width: 100%; height: 100%"
v-else
>
<view
style=
"width: 100%; height: 100%"
v-else
>
<global-empty></global-empty>
<global-empty></global-empty>
</view>
</view>
<
template
#
bottom
>
<view
style=
"margin-top: 20rpx"
>
<global-button
type=
"primary"
:radius=
"5"
@
tap=
"confirmMultiple"
>
确定
</global-button>
</view>
</
template
>
</global-popup>
</global-popup>
<up-picker
<up-picker
v-else
v-else
...
@@ -52,7 +59,7 @@
...
@@ -52,7 +59,7 @@
<
script
setup
>
<
script
setup
>
import
{
computed
,
nextTick
,
ref
,
watch
}
from
'vue'
import
{
computed
,
nextTick
,
ref
,
watch
}
from
'vue'
import
*
as
dictData
from
'mocp/hooks/use-dict/dict-data'
import
*
as
dictData
from
'mocp/hooks/use-dict/dict-data'
import
{
cloneDeep
}
from
'lodash'
import
{
cloneDeep
,
min
}
from
'lodash'
import
{
getParamsByType
}
from
'mocp/hooks/use-params/useParams'
import
{
getParamsByType
}
from
'mocp/hooks/use-params/useParams'
const
es
=
defineEmits
([
'update:modelValue'
,
'change'
,
'getScrollTop'
])
const
es
=
defineEmits
([
'update:modelValue'
,
'change'
,
'getScrollTop'
])
...
@@ -67,11 +74,11 @@ const ps = defineProps({
...
@@ -67,11 +74,11 @@ const ps = defineProps({
type
:
Boolean
,
type
:
Boolean
,
default
:
false
default
:
false
},
},
//是否多选(只对filter有效)
---待优化
//是否多选(只对filter有效)
//
multiple: {
multiple
:
{
//
type: Boolean,
type
:
Boolean
,
//
default: false
default
:
false
//
},
},
style
:
{
style
:
{
type
:
Object
,
type
:
Object
,
default
:
()
=>
{
default
:
()
=>
{
...
@@ -113,6 +120,10 @@ const ps = defineProps({
...
@@ -113,6 +120,10 @@ const ps = defineProps({
type
:
String
,
type
:
String
,
default
:
'value'
default
:
'value'
},
},
valueSplit
:
{
type
:
String
,
default
:
','
},
pickAlign
:
{
pickAlign
:
{
type
:
String
,
type
:
String
,
default
:
'left'
default
:
'left'
...
@@ -186,6 +197,11 @@ const open = async () => {
...
@@ -186,6 +197,11 @@ const open = async () => {
}
}
searchKey
.
value
=
''
searchKey
.
value
=
''
show
.
value
=
true
show
.
value
=
true
if
(
ps
.
modelValue
)
{
multipleValue
.
value
=
ps
.
modelValue
.
split
(
ps
.
valueSplit
)
}
else
{
multipleValue
.
value
=
[]
}
}
}
//设置下拉框打开的默认值
//设置下拉框打开的默认值
const
defaultIndex
=
ref
(
0
)
const
defaultIndex
=
ref
(
0
)
...
@@ -225,9 +241,28 @@ const getColumns = computed(() => {
...
@@ -225,9 +241,28 @@ const getColumns = computed(() => {
return
[]
return
[]
})
})
//监听设置labelValue的值
//监听设置labelValue的值
const
multipleValue
=
ref
([])
watch
(
watch
(
[()
=>
ps
.
modelValue
,
()
=>
ps
.
options
],
[()
=>
ps
.
modelValue
,
()
=>
ps
.
options
],
()
=>
{
()
=>
{
if
(
ps
.
multiple
)
{
if
(
ps
.
modelValue
)
{
labelValue
.
value
=
ps
.
modelValue
.
split
(
ps
.
valueSplit
)
.
map
((
item
)
=>
{
return
getColumns
.
value
.
find
((
option
)
=>
String
(
option
[
ps
.
valueField
])
===
String
(
item
))[
ps
.
labelField
]
})
.
join
(
ps
.
valueSplit
)
const
indexs
=
ps
.
modelValue
.
split
(
ps
.
valueSplit
).
map
((
item
)
=>
{
return
getColumns
.
value
.
findIndex
((
option
)
=>
String
(
option
[
ps
.
valueField
])
===
String
(
item
))
})
nextTick
(()
=>
{
defaultIndex
.
value
=
min
(
indexs
)
})
}
else
{
defaultIndex
.
value
=
0
}
}
else
{
const
option
=
getColumns
.
value
?.
find
((
option
)
=>
String
(
option
[
ps
.
valueField
])
===
String
(
ps
.
modelValue
))
const
option
=
getColumns
.
value
?.
find
((
option
)
=>
String
(
option
[
ps
.
valueField
])
===
String
(
ps
.
modelValue
))
const
index
=
getColumns
.
value
?.
findIndex
((
option
)
=>
String
(
option
[
ps
.
valueField
])
===
String
(
ps
.
modelValue
))
const
index
=
getColumns
.
value
?.
findIndex
((
option
)
=>
String
(
option
[
ps
.
valueField
])
===
String
(
ps
.
modelValue
))
if
(
option
)
{
if
(
option
)
{
...
@@ -239,6 +274,7 @@ watch(
...
@@ -239,6 +274,7 @@ watch(
labelValue
.
value
=
ps
.
modelValue
labelValue
.
value
=
ps
.
modelValue
defaultIndex
.
value
=
0
defaultIndex
.
value
=
0
}
}
}
},
},
{
immediate
:
true
}
{
immediate
:
true
}
)
)
...
@@ -250,6 +286,11 @@ const confirm = (e) => {
...
@@ -250,6 +286,11 @@ const confirm = (e) => {
es
(
'update:modelValue'
,
getColumns
.
value
[
index
][
ps
.
valueField
])
es
(
'update:modelValue'
,
getColumns
.
value
[
index
][
ps
.
valueField
])
es
(
'change'
,
getColumns
.
value
[
index
][
ps
.
valueField
],
getColumns
.
value
[
index
])
es
(
'change'
,
getColumns
.
value
[
index
][
ps
.
valueField
],
getColumns
.
value
[
index
])
}
}
const
confirmMultiple
=
()
=>
{
show
.
value
=
false
es
(
'update:modelValue'
,
multipleValue
.
value
.
join
(
ps
.
valueSplit
))
es
(
'change'
,
multipleValue
.
value
.
join
(
ps
.
valueSplit
))
}
//点击清空按钮
//点击清空按钮
const
clear
=
()
=>
{
const
clear
=
()
=>
{
labelValue
.
value
=
''
labelValue
.
value
=
''
...
@@ -265,6 +306,13 @@ const getFilterColumns = computed(() => {
...
@@ -265,6 +306,13 @@ const getFilterColumns = computed(() => {
//弹出层列表点击
//弹出层列表点击
const
distance
=
ref
(
0
)
const
distance
=
ref
(
0
)
const
handleChoose
=
(
value
)
=>
{
const
handleChoose
=
(
value
)
=>
{
if
(
ps
.
multiple
)
{
if
(
multipleValue
.
value
.
includes
(
value
))
{
multipleValue
.
value
=
multipleValue
.
value
.
filter
((
item
)
=>
item
!=
value
)
}
else
{
multipleValue
.
value
.
push
(
value
)
}
}
else
{
es
(
'update:modelValue'
,
value
)
es
(
'update:modelValue'
,
value
)
es
(
es
(
'change'
,
'change'
,
...
@@ -272,6 +320,7 @@ const handleChoose = (value) => {
...
@@ -272,6 +320,7 @@ const handleChoose = (value) => {
getColumns
.
value
.
find
((
item
)
=>
item
[
ps
.
valueField
]
==
value
)
getColumns
.
value
.
find
((
item
)
=>
item
[
ps
.
valueField
]
==
value
)
)
)
show
.
value
=
false
show
.
value
=
false
}
}
}
//打开默认滑动到选中的位置
//打开默认滑动到选中的位置
watch
(
watch
(
...
@@ -306,6 +355,7 @@ watch(
...
@@ -306,6 +355,7 @@ watch(
&
-value
{
&
-value
{
color
:
$
mocp-text-4
;
color
:
$
mocp-text-4
;
margin-right
:
8
rpx
;
margin-right
:
8
rpx
;
word-break
:
break-all
;
}
}
&
-icon
{
&
-icon
{
display
:
flex
;
display
:
flex
;
...
...
src/mocp/components/global-popup/global-popup.vue
View file @
f1f05f00
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
<scroll-view
scroll-y
class=
"content"
:scroll-top=
"scrollTop"
@
scroll=
"scroll"
>
<scroll-view
scroll-y
class=
"content"
:scroll-top=
"scrollTop"
@
scroll=
"scroll"
>
<slot></slot>
<slot></slot>
</scroll-view>
</scroll-view>
<slot
name=
"bottom"
></slot>
</view>
</view>
</up-popup>
</up-popup>
</
template
>
</
template
>
...
...
src/pages/modules/mocp/panel/unplanApply/add.vue
View file @
f1f05f00
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<up-input
v-model=
"formData.delayDay"
type=
"number"
border=
"none"
inputAlign=
"right"
placeholder=
"请输入"
clearable
></up-input>
<up-input
v-model=
"formData.delayDay"
type=
"number"
border=
"none"
inputAlign=
"right"
placeholder=
"请输入"
clearable
></up-input>
</up-form-item>
</up-form-item>
<up-form-item
label=
"申请原因"
prop=
"warningReason"
:borderBottom=
"true"
required
>
<up-form-item
label=
"申请原因"
prop=
"warningReason"
:borderBottom=
"true"
required
>
<global-picker
v-model=
"formData.warningReason"
pickAlign=
"right"
paramsType=
"WarningReason"
clearable
></global-picker>
<global-picker
v-model=
"formData.warningReason"
pickAlign=
"right"
paramsType=
"WarningReason"
clearable
multiple
></global-picker>
</up-form-item>
</up-form-item>
<up-form-item
label=
"缺件航材"
:borderBottom=
"true"
>
<up-form-item
label=
"缺件航材"
:borderBottom=
"true"
>
<global-switch
v-model=
"formData.materialDelay"
switchAlign=
"right"
></global-switch>
<global-switch
v-model=
"formData.materialDelay"
switchAlign=
"right"
></global-switch>
...
...
src/pages/modules/mocp/panel/unplanApply/constants/add.compositions.js
View file @
f1f05f00
...
@@ -47,7 +47,7 @@ export const formData = reactive({
...
@@ -47,7 +47,7 @@ export const formData = reactive({
delayDay
:
''
,
delayDay
:
''
,
approver
:
''
,
approver
:
''
,
warningReason
:
''
,
warningReason
:
''
,
materialDelay
:
0
,
materialDelay
:
'0'
,
materialPns
:
''
,
materialPns
:
''
,
reason
:
''
,
reason
:
''
,
delayDay
:
null
delayDay
:
null
...
...
src/pages/modules/mocp/panel/unplanApply/constants/add.functionals.js
View file @
f1f05f00
...
@@ -8,7 +8,7 @@ export const resetData = () => {
...
@@ -8,7 +8,7 @@ export const resetData = () => {
delayDay
:
''
,
delayDay
:
''
,
approver
:
''
,
approver
:
''
,
warningReason
:
''
,
warningReason
:
''
,
materialDelay
:
0
,
materialDelay
:
'0'
,
materialPns
:
''
,
materialPns
:
''
,
reason
:
''
,
reason
:
''
,
delayDay
:
null
delayDay
:
null
...
...
src/pages/modules/mocp/panel/unplanWarning/add.vue
View file @
f1f05f00
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
></up-input>
></up-input>
</up-form-item>
</up-form-item>
<up-form-item
label=
"申请原因"
prop=
"warningReason"
:borderBottom=
"true"
required
>
<up-form-item
label=
"申请原因"
prop=
"warningReason"
:borderBottom=
"true"
required
>
<global-picker
v-model=
"formData.warningReason"
pickAlign=
"right"
paramsType=
"WarningReason"
clearable
></global-picker>
<global-picker
v-model=
"formData.warningReason"
pickAlign=
"right"
paramsType=
"WarningReason"
clearable
multiple
></global-picker>
</up-form-item>
</up-form-item>
<up-form-item
label=
"缺件航材"
:borderBottom=
"true"
>
<up-form-item
label=
"缺件航材"
:borderBottom=
"true"
>
<global-switch
v-model=
"formData.materialDelay"
switchAlign=
"right"
></global-switch>
<global-switch
v-model=
"formData.materialDelay"
switchAlign=
"right"
></global-switch>
...
...
src/pages/modules/mocp/panel/unplanWarning/constants/add.compositions.js
View file @
f1f05f00
...
@@ -39,7 +39,7 @@ export const formData = reactive({
...
@@ -39,7 +39,7 @@ export const formData = reactive({
delayDay
:
''
,
delayDay
:
''
,
approver
:
''
,
approver
:
''
,
warningReason
:
''
,
warningReason
:
''
,
materialDelay
:
0
,
materialDelay
:
'0'
,
materialPns
:
''
,
materialPns
:
''
,
reason
:
''
reason
:
''
})
})
src/pages/modules/mocp/panel/unplanWarning/constants/add.functionals.js
View file @
f1f05f00
...
@@ -9,7 +9,7 @@ export const resetData = () => {
...
@@ -9,7 +9,7 @@ export const resetData = () => {
delayDay
:
''
,
delayDay
:
''
,
approver
:
''
,
approver
:
''
,
warningReason
:
''
,
warningReason
:
''
,
materialDelay
:
0
,
materialDelay
:
'0'
,
materialPns
:
''
,
materialPns
:
''
,
reason
:
''
reason
:
''
})
})
...
...
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