Commit 221ff6cf authored by jingnan's avatar jingnan 👀

配套出库申请及审核批量左侧数据处理

parent 8381cf1b
...@@ -43,14 +43,21 @@ ...@@ -43,14 +43,21 @@
<section class="collapse-title">| {{ request.name }}{{ request.lists.length }}</section> <section class="collapse-title">| {{ request.name }}{{ request.lists.length }}</section>
</template> </template>
<ul v-if="request.lists.length"> <ul v-if="request.lists.length">
<!-- 带复选框 -->
<template> <template>
<li <li
v-for="(item, subIndex) in request.lists" v-for="(item, subIndex) in request.lists"
:key="item.id" :key="item.id"
class="blue" class="blue"
:class="{active: subIndex === active,'active-background':item.activeBackground}" :class="{active: subIndex === active,'active-background':item.activeBackground}"
@click="currentAoClick(item,subIndex)" @click="checkClick(item)"
> >
<el-checkbox
v-model="item.checked"
style="margin-right: 6px;"
@click.native="stopDefault($event)"
@change="v => checkboxChange(v, index, subIndex,item)"
/>
<i class="el-icon-document" /> <i class="el-icon-document" />
{{ item.sorties }} ,{{ item.serialNumber || '暂无' }}, {{ item.sorties }} ,{{ item.serialNumber || '暂无' }},
{{ item.plannerName }}, {{ item.plannerName }},
...@@ -154,11 +161,11 @@ export default { ...@@ -154,11 +161,11 @@ export default {
const data = res.items.content.map(item => { const data = res.items.content.map(item => {
return { return {
...item, ...item,
plannerName: item.joExecutePlan && item.joExecutePlan[0] && item.joExecutePlan[0].planner && item.joExecutePlan[0].planner.name plannerName: item.joExecutePlan && item.joExecutePlan[0] && item.joExecutePlan[0].planner && item.joExecutePlan[0].planner.name,
checked: false
} }
}) })
this.requests.find(item => item.name === '配套出库').lists = data this.requests.find(item => item.name === '配套出库').lists = data
this.currentAoClick(data[0], 0)
}).catch(err => console.log(err)).finally(() => { }).catch(err => console.log(err)).finally(() => {
this.loading = false this.loading = false
}) })
...@@ -171,9 +178,18 @@ export default { ...@@ -171,9 +178,18 @@ export default {
this.form = {} this.form = {}
this.init() this.init()
}, },
currentAoClick(item, subIndex) { // 切换复选框
this.active = subIndex checkboxChange(v, index, subIndex, item) {
this.$emit('currentAo:click', item) this.$set(item, 'activeBackground', v)
this.requests[index].lists[subIndex].checked = v
const checkList = this.requests.find(item => item.name === '配套出库').lists.filter(item => item.checked)
this.$emit('currentAo:click', checkList)
},
checkClick(item) {
this.$set(item, 'activeBackground', true)
item.checked = !item.checked
const checkList = this.requests.find(item => item.name === '配套出库').lists.filter(item => item.checked)
this.$emit('currentAo:click', checkList)
}, },
// 阻止事件冒泡 // 阻止事件冒泡
stopDefault(e) { stopDefault(e) {
......
...@@ -32,8 +32,8 @@ export default { ...@@ -32,8 +32,8 @@ export default {
default: () => {} default: () => {}
}, },
currentAo: { currentAo: {
type: Object, type: Array,
default: () => {} default: () => []
} }
}, },
data() { data() {
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
selectionChange(val) { selectionChange(val) {
this.selectionRows = val this.selectionRows = val
const requestIds = val && val.map(item => item.id) const requestIds = val && val.map(item => item.id)
this.$refs.outStorageMatchItem.$refs.asCom.getData(requestIds) this.$refs.outStorageMatchItem && this.$refs.outStorageMatchItem.$refs.asCom.getData(requestIds)
}, },
selectionChange_item(val) { selectionChange_item(val) {
this.selectionItemRows = val this.selectionItemRows = val
...@@ -68,10 +68,18 @@ export default { ...@@ -68,10 +68,18 @@ export default {
selectionChange_jobRes(val) { selectionChange_jobRes(val) {
this.selectionJobResRows = val this.selectionJobResRows = val
}, },
init(currentAo) { init(checkList) {
setTimeout(() => { const aoIds = checkList && checkList.map(item => item.id)
this.$refs.outStorageMatch && this.$refs.outStorageMatch.$refs.asCom.getData(currentAo && currentAo.id || 0) if (aoIds && aoIds.length) {
}, 100) this.$refs.outStorageMatch && this.$refs.outStorageMatch.$refs.asCom.getData(aoIds)
} else {
this.$refs.outStorageMatch && (this.$refs.outStorageMatch.$refs.asCom.pagination.total = 0)
this.$refs.outStorageMatchItem && (this.$refs.outStorageMatchItem.$refs.asCom.pagination.total = 0)
this.$refs.jobResponseOutStorageMatch && (this.$refs.jobResponseOutStorageMatch.$refs.asCom.pagination.total = 0)
this.$refs.outStorageMatch && (this.$refs.outStorageMatch.$refs.asCom.showData = [])
this.$refs.outStorageMatchItem && (this.$refs.outStorageMatchItem.$refs.asCom.showData = [])
this.$refs.jobResponseOutStorageMatch && (this.$refs.jobResponseOutStorageMatch.$refs.asCom.showData = [])
}
} }
} }
} }
......
...@@ -43,14 +43,21 @@ ...@@ -43,14 +43,21 @@
<section class="collapse-title">| {{ request.name }}{{ request.lists.length }}</section> <section class="collapse-title">| {{ request.name }}{{ request.lists.length }}</section>
</template> </template>
<ul v-if="request.lists.length"> <ul v-if="request.lists.length">
<!-- 带复选框 -->
<template> <template>
<li <li
v-for="(item, subIndex) in request.lists" v-for="(item, subIndex) in request.lists"
:key="item.id" :key="item.id"
class="blue" class="blue"
:class="{active: subIndex === active,'active-background':item.activeBackground}" :class="{active: subIndex === active,'active-background':item.activeBackground}"
@click="currentAoClick(item,subIndex)" @click="checkClick(item)"
> >
<el-checkbox
v-model="item.checked"
style="margin-right: 6px;"
@click.native="stopDefault($event)"
@change="v => checkboxChange(v, index, subIndex,item)"
/>
<i class="el-icon-document" /> <i class="el-icon-document" />
{{ item.sorties }} ,{{ item.serialNumber || '暂无' }}, {{ item.sorties }} ,{{ item.serialNumber || '暂无' }},
{{ item.plannerName }}, {{ item.plannerName }},
...@@ -154,11 +161,11 @@ export default { ...@@ -154,11 +161,11 @@ export default {
const data = res.items.content.map(item => { const data = res.items.content.map(item => {
return { return {
...item, ...item,
plannerName: item.joExecutePlan && item.joExecutePlan[0] && item.joExecutePlan[0].planner && item.joExecutePlan[0].planner.name plannerName: item.joExecutePlan && item.joExecutePlan[0] && item.joExecutePlan[0].planner && item.joExecutePlan[0].planner.name,
checked: false
} }
}) })
this.requests.find(item => item.name === '配套出库').lists = data this.requests.find(item => item.name === '配套出库').lists = data
this.currentAoClick(data[0], 0)
}).catch(err => console.log(err)).finally(() => { }).catch(err => console.log(err)).finally(() => {
this.loading = false this.loading = false
}) })
...@@ -171,9 +178,18 @@ export default { ...@@ -171,9 +178,18 @@ export default {
this.form = {} this.form = {}
this.init() this.init()
}, },
currentAoClick(item, subIndex) { // 切换复选框
this.active = subIndex checkboxChange(v, index, subIndex, item) {
this.$emit('currentAo:click', item) this.$set(item, 'activeBackground', v)
this.requests[index].lists[subIndex].checked = v
const checkList = this.requests.find(item => item.name === '配套出库').lists.filter(item => item.checked)
this.$emit('currentAo:click', checkList)
},
checkClick(item) {
this.$set(item, 'activeBackground', true)
item.checked = !item.checked
const checkList = this.requests.find(item => item.name === '配套出库').lists.filter(item => item.checked)
this.$emit('currentAo:click', checkList)
}, },
// 阻止事件冒泡 // 阻止事件冒泡
stopDefault(e) { stopDefault(e) {
......
...@@ -32,8 +32,8 @@ export default { ...@@ -32,8 +32,8 @@ export default {
default: () => {} default: () => {}
}, },
currentAo: { currentAo: {
type: Object, type: Array,
default: () => {} default: () => []
} }
}, },
data() { data() {
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
selectionChange(val) { selectionChange(val) {
this.selectionRows = val this.selectionRows = val
const requestIds = val && val.map(item => item.id) const requestIds = val && val.map(item => item.id)
this.$refs.outStorageMatchItem.$refs.asCom.getData(requestIds) this.$refs.outStorageMatchItem && this.$refs.outStorageMatchItem.$refs.asCom.getData(requestIds)
}, },
selectionChange_item(val) { selectionChange_item(val) {
this.selectionItemRows = val this.selectionItemRows = val
...@@ -68,10 +68,18 @@ export default { ...@@ -68,10 +68,18 @@ export default {
selectionChange_jobRes(val) { selectionChange_jobRes(val) {
this.selectionJobResRows = val this.selectionJobResRows = val
}, },
init(currentAo) { init(checkList) {
setTimeout(() => { const aoIds = checkList && checkList.map(item => item.id)
this.$refs.outStorageMatch && this.$refs.outStorageMatch.$refs.asCom.getData(currentAo && currentAo.id || 0) if (aoIds && aoIds.length) {
}, 100) this.$refs.outStorageMatch && this.$refs.outStorageMatch.$refs.asCom.getData(aoIds)
} else {
this.$refs.outStorageMatch && (this.$refs.outStorageMatch.$refs.asCom.pagination.total = 0)
this.$refs.outStorageMatchItem && (this.$refs.outStorageMatchItem.$refs.asCom.pagination.total = 0)
this.$refs.jobResponseOutStorageMatch && (this.$refs.jobResponseOutStorageMatch.$refs.asCom.pagination.total = 0)
this.$refs.outStorageMatch && (this.$refs.outStorageMatch.$refs.asCom.showData = [])
this.$refs.outStorageMatchItem && (this.$refs.outStorageMatchItem.$refs.asCom.showData = [])
this.$refs.jobResponseOutStorageMatch && (this.$refs.jobResponseOutStorageMatch.$refs.asCom.showData = [])
}
} }
} }
} }
......
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