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
201f9695
Commit
201f9695
authored
Aug 16, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 物料减到0提示
parent
f3ab7678
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
132 deletions
+173
-132
XhParts.vue
src/components/createCom/XhParts.vue
+153
-131
adjust.vue
src/components/select-parts/adjust.vue
+4
-1
application.vue
src/pages/parts/application.vue
+16
-0
No files found.
src/components/createCom/XhParts.vue
View file @
201f9695
<!-- ******************* 物料选择 ******************* -->
<!-- ******************* 物料选择 ******************* -->
<
template
>
<
template
>
<view>
<view>
<view
class=
"list u-flex u-row-between"
>
<view
class=
"list u-flex u-row-between"
>
<image
class=
"item-image"
:src=
"mixingImage"
v-if=
"item.required"
></image>
<image
class=
"item-image"
:src=
"mixingImage"
v-if=
"item.required"
></image>
<view
class=
"u-m-r-20"
>
{{
item
.
fieldsTitle
}}
</view>
<view
class=
"u-m-r-20"
>
{{
item
.
fieldsTitle
}}
</view>
<view
class=
"u-flex-1 add-parts"
@
click=
"toParts"
v-if=
"!disabled && lists.length > 0"
>
<view
添加物料
<u-icon
name=
"arrow-right"
color=
"#2979ff"
size=
"30"
></u-icon>
class=
"u-flex-1 add-parts"
</view>
@
click=
"toParts"
</view>
v-if=
"!disabled && lists.length > 0"
>
添加物料
<u-icon
name=
"arrow-right"
color=
"#2979ff"
size=
"30"
></u-icon>
</view>
</view>
<view
class=
"complete-part"
>
<view
class=
"complete-part"
>
<view
v-if=
"lists.length > 0"
>
<view
v-if=
"lists.length > 0"
>
<adjust-parts
v-for=
"(item, index) in lists"
:key=
"index"
:info=
"item"
@
change=
"partsChange($event, index)"
:disabled=
"disabled"
></adjust-parts>
<adjust-parts
v-for=
"(item, index) in lists"
:key=
"index"
:info=
"item"
@
change=
"partsChange($event, index)"
@
minusValue=
"minusValue($event, index)"
:disabled=
"disabled"
></adjust-parts>
</view>
</view>
<view
class=
"u-flex select-part"
v-else
>
<view
class=
"u-flex select-part"
v-else
>
<view
class=
"img"
>
<view
class=
"img"
>
<image
:src=
"noPartsImage"
class=
"part-icon"
/>
<image
:src=
"noPartsImage"
class=
"part-icon"
/>
</view>
</view>
...
@@ -27,141 +38,152 @@
...
@@ -27,141 +38,152 @@
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
adjustParts
from
"@/components/select-parts/adjust"
import
adjustParts
from
'@/components/select-parts/adjust'
import
stringMixin
from
'./stringMixin'
import
stringMixin
from
'./stringMixin'
export
default
{
export
default
{
name
:
'XhParts'
,
name
:
'XhParts'
,
components
:
{
components
:
{
adjustParts
adjustParts
,
},
mixins
:
[
stringMixin
],
props
:
{
orderId
:
{
type
:
String
,
default
:
''
,
},
},
mixins
:
[
stringMixin
],
categoryId
:
{
props
:
{
type
:
String
,
orderId
:
{
default
:
''
,
type
:
String
,
default
:
''
},
categoryId
:
{
type
:
String
,
default
:
''
},
brandId
:
{
type
:
String
,
default
:
''
}
},
data
()
{
return
{
lists
:
[]
}
},
computed
:
{
customStyle
()
{
return
{
'width'
:
'200rpx'
,
'height'
:
'80rpx'
,
'color'
:
'#2272FF'
,
'font-size'
:
'32rpx'
,
}
},
mixingImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'mixing.png'
},
noPartsImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'no_parts.png'
},
selectedParts
()
{
return
this
.
lists
.
filter
((
item
)
=>
{
return
item
.
quantity
>
0
})
}
},
},
mounted
()
{
brandId
:
{
this
.
getWorkOrderParts
()
type
:
String
,
default
:
''
,
},
},
methods
:
{
},
getWorkOrderParts
()
{
data
()
{
// this.lists = JSON.parse(this.dataValue) || []
return
{
this
.
lists
=
this
.
dataValue
?
JSON
.
parse
(
this
.
dataValue
)
:
[]
lists
:
[],
},
}
partsChange
(
val
,
index
)
{
},
this
.
$set
(
this
.
lists
[
index
],
'quantity'
,
val
)
computed
:
{
this
.
valueChange
(
JSON
.
stringify
(
this
.
selectedParts
))
customStyle
()
{
},
return
{
valChange
(
val
)
{
width
:
'200rpx'
,
val
.
forEach
(
v
=>
{
height
:
'80rpx'
,
const
index
=
this
.
lists
.
findIndex
(
k
=>
k
.
part_id
===
v
.
part_id
)
color
:
'#2272FF'
,
if
(
index
<
0
)
{
'font-size'
:
'32rpx'
,
this
.
lists
.
push
(
v
)
}
else
{
this
.
$set
(
this
.
lists
,
index
,
v
)
}
})
this
.
valueChange
(
JSON
.
stringify
(
this
.
selectedParts
))
},
toParts
()
{
uni
.
navigateTo
({
url
:
`/pages/order/parts?workOrderId=
${
this
.
orderId
}
&brandId=
${
this
.
brandId
}
&categoryId=
${
this
.
categoryId
}
`
})
}
}
}
},
}
mixingImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'mixing.png'
},
noPartsImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'no_parts.png'
}
},
mounted
()
{
this
.
getWorkOrderParts
()
},
methods
:
{
getWorkOrderParts
()
{
// this.lists = JSON.parse(this.dataValue) || []
this
.
lists
=
this
.
dataValue
?
JSON
.
parse
(
this
.
dataValue
)
:
[]
},
partsChange
(
val
,
index
)
{
this
.
$set
(
this
.
lists
[
index
],
'quantity'
,
val
)
console
.
log
(
"this.lists"
,
this
.
lists
)
this
.
valueChange
(
this
.
lists
)
},
minusValue
(
val
,
index
)
{
if
(
val
===
0
)
{
uni
.
showModal
({
title
:
'温馨提示'
,
content
:
'确定要删除该物料?'
,
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
this
.
lists
.
splice
(
index
,
1
)
}
else
if
(
res
.
cancel
)
{
this
.
partsChange
(
1
,
index
)
}
},
})
}
},
valChange
(
val
)
{
val
.
forEach
((
v
)
=>
{
const
index
=
this
.
lists
.
findIndex
((
k
)
=>
k
.
part_id
===
v
.
part_id
)
if
(
index
<
0
)
{
this
.
lists
.
push
(
v
)
}
else
{
this
.
$set
(
this
.
lists
,
index
,
v
)
}
})
this
.
valueChange
(
this
.
lists
)
},
toParts
()
{
uni
.
navigateTo
({
url
:
`/pages/order/parts?workOrderId=
${
this
.
orderId
}
&brandId=
${
this
.
brandId
}
&categoryId=
${
this
.
categoryId
}
`
,
})
},
},
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.item-image
{
.item-image
{
width
:
24rpx
;
width
:
24rpx
;
height
:
24rpx
;
height
:
24rpx
;
margin-right
:
10rpx
;
margin-right
:
10rpx
;
}
}
.required
{
.required
{
padding-right
:
10rpx
;
padding-right
:
10rpx
;
font-size
:
28rpx
;
font-size
:
28rpx
;
line-height
:
40rpx
;
line-height
:
40rpx
;
color
:
#fa3534
;
color
:
#fa3534
;
}
}
.add-parts
{
.add-parts
{
color
:
#2272FF
;
color
:
#2272ff
;
text-align
:
right
;
text-align
:
right
;
}
}
.complete-part
{
.complete-part
{
.select-part
{
.select-part
{
align-items
:
center
;
height
:
240rpx
;
.img
{
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
height
:
240rpx
;
margin-right
:
30rpx
;
.img
{
.part-icon
{
display
:
flex
;
width
:
110rpx
;
align-items
:
center
;
height
:
110rpx
;
margin-right
:
30rpx
;
border-radius
:
50%
;
.part-icon
{
width
:
110rpx
;
height
:
110rpx
;
border-radius
:
50%
;
}
}
}
.content
{
}
padding-right
:
8px
;
.content
{
flex
:
1
;
padding-right
:
8px
;
color
:
#3b4144
;
flex
:
1
;
flex-direction
:
column
;
color
:
#3b4144
;
justify-content
:
space-betwee
n
;
flex-direction
:
colum
n
;
overflow
:
hidd
en
;
justify-content
:
space-betwe
en
;
.title
{
overflow
:
hidden
;
text-align
:
left
;
.title
{
color
:
#2272FF
;
text-align
:
left
;
font-size
:
38rpx
;
color
:
#2272ff
;
font-weight
:
bold
;
font-size
:
38rpx
;
margin-right
:
auto
;
font-weight
:
bold
;
}
margin-right
:
auto
;
.desc
{
}
text-align
:
left
;
.desc
{
color
:
#999
;
text-align
:
left
;
font-size
:
26rpx
;
color
:
#999
;
margin-right
:
auto
;
font-size
:
26rpx
;
}
margin-right
:
auto
;
}
}
}
}
}
}
}
</
style
>
</
style
>
src/components/select-parts/adjust.vue
View file @
201f9695
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
{{
info
.
name
}}
{{
info
.
name
}}
</view>
</view>
<view
class=
"num"
>
<view
class=
"num"
>
<u-number-box
v-if=
"!disabled"
v-model=
"info.quantity"
:min=
"info.min || 0"
:max=
"info.max || 9999"
@
change=
"numChange"
></u-number-box>
<u-number-box
v-if=
"!disabled"
v-model=
"info.quantity"
:min=
"info.min || 0"
:max=
"info.max || 9999"
@
change=
"numChange"
@
minus=
"minusValue"
></u-number-box>
<text
class=
"nums"
v-else
>
x
{{
info
.
quantity
||
1
}}
</text>
<text
class=
"nums"
v-else
>
x
{{
info
.
quantity
||
1
}}
</text>
</view>
</view>
</view>
</view>
...
@@ -37,6 +37,9 @@
...
@@ -37,6 +37,9 @@
methods
:
{
methods
:
{
numChange
(
event
)
{
numChange
(
event
)
{
this
.
$emit
(
'change'
,
event
.
value
)
this
.
$emit
(
'change'
,
event
.
value
)
},
minusValue
(
event
)
{
this
.
$emit
(
'minusValue'
,
event
.
value
)
}
}
}
}
}
}
...
...
src/pages/parts/application.vue
View file @
201f9695
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
:info=
"row"
:info=
"row"
:show-checked=
"false"
:show-checked=
"false"
@
change=
"numChange($event, index)"
@
change=
"numChange($event, index)"
@
minusValue=
"minusValue($event, index)"
></select-parts>
></select-parts>
</view>
</view>
</view>
</view>
...
@@ -161,6 +162,21 @@ export default {
...
@@ -161,6 +162,21 @@ export default {
numChange
(
val
,
index
)
{
numChange
(
val
,
index
)
{
this
.
$set
(
this
.
parts
[
index
],
'quantity'
,
val
)
this
.
$set
(
this
.
parts
[
index
],
'quantity'
,
val
)
},
},
minusValue
(
val
,
index
)
{
if
(
val
===
0
)
{
uni
.
showModal
({
title
:
'温馨提示'
,
content
:
'确定要删除该物料?'
,
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
this
.
parts
.
splice
(
index
,
1
)
}
else
if
(
res
.
cancel
)
{
this
.
$set
(
this
.
parts
[
index
],
'quantity'
,
1
)
}
},
})
}
},
updateParts
(
parts
)
{
updateParts
(
parts
)
{
// if(this.$u.test.isEmpty(parts)) {
// if(this.$u.test.isEmpty(parts)) {
// this.parts = []
// this.parts = []
...
...
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