Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
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
李俊赕
self-support
Commits
d46036e4
Commit
d46036e4
authored
Apr 28, 2021
by
李超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:add
scope:self-support body: 添加组件
parent
35da037d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
204 additions
and
0 deletions
+204
-0
XhServiceMeasure.vue
src/components/createCom/XhServiceMeasure.vue
+158
-0
arrMixin.js
src/components/createCom/arrMixin.js
+46
-0
No files found.
src/components/createCom/XhServiceMeasure.vue
0 → 100644
View file @
d46036e4
<!-- ******************* 单级/多级 选择 ******************* -->
<
template
>
<view
class=
"picker-box"
>
<view
class=
"u-flex u-row-between"
@
click=
"openPicker"
>
<view
class=
"txt u-flex-1"
>
{{
text
||
''
}}
</view>
<u-icon
name=
"arrow-right"
color=
"#666"
size=
"28"
></u-icon>
</view>
<u-picker
v-model=
"showPicker"
range-key=
"label"
@
columnchange=
"columnchange"
:mode=
"isNotMulti?'selector':'multiSelector'"
@
confirm=
"pickerConfirm"
:range=
"settings"
></u-picker>
<!-- :default-selector='[0, 1]' -->
<u-toast
ref=
"uToast"
/>
</view>
</
template
>
<
script
>
import
objMixin
from
'./objMixin'
export
default
{
name
:
'XhPicker'
,
components
:
{},
mixins
:
[
objMixin
],
props
:
{
// 当mode=selector或者mode=multiSelector时,提供的默认选中的下标
defaultSelector
:
{
type
:
Array
,
default
()
{
return
[
0
];
}
},
// 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
rangeKey
:
{
type
:
String
,
default
:
'label'
},
value
:
{
type
:
String
,
default
:
'{}'
},
orderId
:{
type
:
Number
,
default
:
0
},
categoryId
:{
type
:
Number
,
default
:
0
},
specificationId
:{
type
:
String
,
default
:
'0'
},
orderServiceType
:{
type
:
String
,
default
:
'安装'
},
},
filters
:{},
data
()
{
return
{
isNotMulti
:
true
,
showPicker
:
false
,
settings
:[],
measure
:[]
}
},
computed
:
{
text
(){
let
val
=
''
if
(
this
.
value
){
let
data
=
JSON
.
parse
(
this
.
value
);
val
=
data
[
0
].
measureTypeName
+
"-"
+
data
[
0
].
measureName
}
return
val
}
},
watch
:
{
specificationId
(
val
,
oldVal
){
this
.
initComponent
()
},
},
mounted
()
{
this
.
isNotMulti
=
this
.
orderServiceType
===
'安装'
this
.
initComponent
()
},
methods
:
{
openPicker
(){
if
(
this
.
specificationId
===
'0'
){
this
.
$refs
.
uToast
.
show
({
title
:
'请先选择规格'
,
type
:
'error'
})
return
}
this
.
showPicker
=
true
},
initComponent
(){
if
(
this
.
isNotMulti
){
this
.
initMeasure
()
}
else
{
this
.
initSymptoms
()
}
},
initSymptoms
(){
// 初始化现象
},
initCause
(){
// 初始化原因
},
initMeasure
(){
// 初始化措施
let
self
=
this
if
(
self
.
orderId
){
let
param
=
{
orderId
:
self
.
orderId
,
categoryId
:
self
.
categoryId
,
specificationId
:
self
.
specificationId
,
orderServiceTypeText
:
self
.
orderServiceType
}
self
.
$u
.
api
.
getMeasure
(
param
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
let
result
=
[]
for
(
let
key
in
res
.
data
){
self
.
measure
=
res
.
data
[
key
].
measureExtendDtos
res
.
data
[
key
].
measureExtendDtos
.
map
((
item
,
index
)
=>
{
result
.
push
({
"id"
:
item
.
measureId
,
"label"
:
item
.
measureName
})
})
}
if
(
self
.
orderServiceType
===
'安装'
){
self
.
settings
=
result
}
else
{
self
.
settings
[
2
]
=
result
}
}
else
{
console
.
log
(
res
.
message
,
"查询措施失败"
);
}
});
}
},
pickerConfirm
(
data
){
let
result
=
[]
if
(
this
.
isMulti
){
// 维修
}
else
{
// 安装
result
.
push
(
this
.
measure
[
data
[
0
]])
}
this
.
valueChange
(
JSON
.
stringify
(
result
))
},
columnchange
(
data
){
// console.log(data,'data')
// // 树列改变时进行联动操作
// const {column ,index} = data
// let arr = [9,10,50]
// this.settings.splice(column+1,1,arr)
// console.log(this.settings,'this.settings')
},
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
src/components/createCom/arrMixin.js
0 → 100644
View file @
d46036e4
/** 自定义组件 共同逻辑 */
export
default
{
data
()
{
return
{
dataValue
:
null
}
},
watch
:
{
value
:
function
(
val
)
{
this
.
dataValue
=
val
}
},
props
:
{
value
:
{
type
:
Array
,
default
:
[]
},
/** 索引值 用于更新数据 */
itemIndex
:
Number
,
groupIndex
:
Number
,
/** 包含数据源 */
item
:
Object
,
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
mounted
()
{
/** 如果有值以传入值为主 如果无值 已默认值为主 */
this
.
dataValue
=
this
.
value
},
methods
:
{
// 输入的值
valueChange
(
val
)
{
const
data
=
{
groupIndex
:
this
.
groupIndex
,
// 左侧菜单下标
itemIndex
:
this
.
itemIndex
,
//右侧某一项下标
value
:
val
}
this
.
$emit
(
'value-change'
,
data
)
}
}
}
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