Commit 221ff6cf authored by jingnan's avatar jingnan 👀

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

parent 8381cf1b
......@@ -43,14 +43,21 @@
<section class="collapse-title">| {{ request.name }}{{ request.lists.length }}</section>
</template>
<ul v-if="request.lists.length">
<!-- 带复选框 -->
<template>
<li
v-for="(item, subIndex) in request.lists"
:key="item.id"
class="blue"
: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" />
{{ item.sorties }} ,{{ item.serialNumber || '暂无' }},
{{ item.plannerName }},
......@@ -154,11 +161,11 @@ export default {
const data = res.items.content.map(item => {
return {
...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.currentAoClick(data[0], 0)
}).catch(err => console.log(err)).finally(() => {
this.loading = false
})
......@@ -171,9 +178,18 @@ export default {
this.form = {}
this.init()
},
currentAoClick(item, subIndex) {
this.active = subIndex
this.$emit('currentAo:click', item)
// 切换复选框
checkboxChange(v, index, subIndex, 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) {
......
......@@ -32,8 +32,8 @@ export default {
default: () => {}
},
currentAo: {
type: Object,
default: () => {}
type: Array,
default: () => []
}
},
data() {
......@@ -58,7 +58,7 @@ export default {
selectionChange(val) {
this.selectionRows = val
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) {
this.selectionItemRows = val
......@@ -68,10 +68,18 @@ export default {
selectionChange_jobRes(val) {
this.selectionJobResRows = val
},
init(currentAo) {
setTimeout(() => {
this.$refs.outStorageMatch && this.$refs.outStorageMatch.$refs.asCom.getData(currentAo && currentAo.id || 0)
}, 100)
init(checkList) {
const aoIds = checkList && checkList.map(item => item.id)
if (aoIds && aoIds.length) {
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 @@
<section class="collapse-title">| {{ request.name }}{{ request.lists.length }}</section>
</template>
<ul v-if="request.lists.length">
<!-- 带复选框 -->
<template>
<li
v-for="(item, subIndex) in request.lists"
:key="item.id"
class="blue"
: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" />
{{ item.sorties }} ,{{ item.serialNumber || '暂无' }},
{{ item.plannerName }},
......@@ -154,11 +161,11 @@ export default {
const data = res.items.content.map(item => {
return {
...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.currentAoClick(data[0], 0)
}).catch(err => console.log(err)).finally(() => {
this.loading = false
})
......@@ -171,9 +178,18 @@ export default {
this.form = {}
this.init()
},
currentAoClick(item, subIndex) {
this.active = subIndex
this.$emit('currentAo:click', item)
// 切换复选框
checkboxChange(v, index, subIndex, 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) {
......
......@@ -32,8 +32,8 @@ export default {
default: () => {}
},
currentAo: {
type: Object,
default: () => {}
type: Array,
default: () => []
}
},
data() {
......@@ -58,7 +58,7 @@ export default {
selectionChange(val) {
this.selectionRows = val
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) {
this.selectionItemRows = val
......@@ -68,10 +68,18 @@ export default {
selectionChange_jobRes(val) {
this.selectionJobResRows = val
},
init(currentAo) {
setTimeout(() => {
this.$refs.outStorageMatch && this.$refs.outStorageMatch.$refs.asCom.getData(currentAo && currentAo.id || 0)
}, 100)
init(checkList) {
const aoIds = checkList && checkList.map(item => item.id)
if (aoIds && aoIds.length) {
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