Commit b45390ec authored by Damon's avatar Damon

refactor: 不用物料逻辑处理

parent 71d0f65b
...@@ -91,8 +91,8 @@ export default { ...@@ -91,8 +91,8 @@ export default {
methods: { methods: {
getWorkOrderParts() { getWorkOrderParts() {
// this.lists = JSON.parse(this.dataValue) || [] // this.lists = JSON.parse(this.dataValue) || []
console.log("this.dataValue", this.dataValue) const lists = this.dataValue ? JSON.parse(this.dataValue) : []
this.lists = this.dataValue ? JSON.parse(this.dataValue) : [] this.lists = lists.filter(v => v.name)
}, },
partsChange(val, index) { partsChange(val, index) {
this.$set(this.lists[index], 'quantity', val) this.$set(this.lists[index], 'quantity', val)
...@@ -114,6 +114,7 @@ export default { ...@@ -114,6 +114,7 @@ export default {
} }
}, },
valChange(val) { valChange(val) {
if (val) {
val.forEach((v) => { val.forEach((v) => {
const index = this.lists.findIndex((k) => k.part_id === v.part_id) const index = this.lists.findIndex((k) => k.part_id === v.part_id)
if (index < 0) { if (index < 0) {
...@@ -122,7 +123,10 @@ export default { ...@@ -122,7 +123,10 @@ export default {
this.$set(this.lists, index, v) this.$set(this.lists, index, v)
} }
}) })
this.valueChange(this.lists) } else {
this.lists = []
}
this.valueChange(JSON.stringify(val ? this.lists : [{}]))
}, },
toParts() { toParts() {
uni.navigateTo({ uni.navigateTo({
......
...@@ -119,6 +119,9 @@ ...@@ -119,6 +119,9 @@
this.$u.route({ type: 'back' }) this.$u.route({ type: 'back' })
}, },
cancel() { cancel() {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上一个页面
prevPage.$vm.$refs['fileChildParts'][0].valChange()
this.$u.route({ type: 'back' }) this.$u.route({ type: 'back' })
}, },
qnFile(src) { qnFile(src) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment