Commit a7282f18 by 张立顺

fix 车型选择修复

1 parent ddbdb81d
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-table-column label="序号" type="index" width="70" align="center"></el-table-column> <el-table-column label="序号" type="index" width="70" align="center"></el-table-column>
<el-table-column prop="brandName" label="品牌名称" align="center"></el-table-column> <el-table-column prop="brandName" label="品牌名称" align="center"></el-table-column>
<el-table-column prop="childName" label="子品牌名称" align="center"></el-table-column> <el-table-column prop="childName" label="子品牌名称" align="center"></el-table-column>
<el-table-column prop="seriesName" label="车系名称" align="center"></el-table-column> <el-table-column prop="vehicleSeriesName" label="车系名称" align="center"></el-table-column>
</el-table> </el-table>
<el-pagination class="pagination" small background @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pageSize" layout="total, prev, pager, next" :total="total" /> <el-pagination class="pagination" small background @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pageSize" layout="total, prev, pager, next" :total="total" />
</div> </div>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<el-table :data="selectedData" border height="464px"> <el-table :data="selectedData" border height="464px">
<el-table-column prop="brandName" label="品牌名称" align="center"></el-table-column> <el-table-column prop="brandName" label="品牌名称" align="center"></el-table-column>
<el-table-column prop="childName" label="子品牌名称" align="center"></el-table-column> <el-table-column prop="childName" label="子品牌名称" align="center"></el-table-column>
<el-table-column prop="seriesName" label="车系名称" align="center"></el-table-column> <el-table-column prop="vehicleSeriesName" label="车系名称" align="center"></el-table-column>
<el-table-column label="删除" align="center" width="80px"> <el-table-column label="删除" align="center" width="80px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button class="el-icon-delete" @click="handleDelete(scope.row)" type="text" /> <el-button class="el-icon-delete" @click="handleDelete(scope.row)" type="text" />
...@@ -76,15 +76,16 @@ export default { ...@@ -76,15 +76,16 @@ export default {
}, },
mounted() { mounted() {
console.log(this.storeSelected, 'this.storeSelected')
this.selectedData = this.storeSelected this.selectedData = this.storeSelected
this.getSelectingList() this.getSelectingList()
}, },
methods: { methods: {
recoverySelection() { recoverySelection() {
var exitIds = this.selectedData.map(item => item.seriesId) var exitIds = this.selectedData.map(item => item.vehicleSeriesId)
this.selectingData.forEach(item => { this.selectingData.forEach(item => {
exitIds.includes(item.seriesId) && this.$refs.seletingTable.toggleRowSelection(item, true) exitIds.includes(item.vehicleSeriesId) && this.$refs.seletingTable.toggleRowSelection(item, true)
}) })
}, },
getSelectingList() { getSelectingList() {
...@@ -95,7 +96,11 @@ export default { ...@@ -95,7 +96,11 @@ export default {
pageSize: this.pageSize pageSize: this.pageSize
}) })
.then(res => { .then(res => {
this.selectingData = res.list this.selectingData = res.list.map(item => {
item.vehicleSeriesId = item.seriesId
item.vehicleSeriesName = item.seriesName
return item
})
this.total = res.total this.total = res.total
this.$nextTick(() => { this.$nextTick(() => {
this.recoverySelection() this.recoverySelection()
...@@ -103,12 +108,12 @@ export default { ...@@ -103,12 +108,12 @@ export default {
}) })
}, },
handleChange(selection, row) { handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.seriesId === row.seriesId) var addOrDelete = !!selection.find(item => item.vehicleSeriesId === row.vehicleSeriesId)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.seriesId !== row.seriesId)) addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.vehicleSeriesId !== row.vehicleSeriesId))
}, },
handleAll(selection) { handleAll(selection) {
this.selectingData.forEach(item => { this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.seriesId === item.seriesId) var isExit = this.selectedData.findIndex(subItem => subItem.vehicleSeriesId === item.vehicleSeriesId)
if (selection.length && isExit === -1) { if (selection.length && isExit === -1) {
this.selectedData.push(item) this.selectedData.push(item)
} else if (!selection.length && isExit !== -1) { } else if (!selection.length && isExit !== -1) {
...@@ -117,8 +122,8 @@ export default { ...@@ -117,8 +122,8 @@ export default {
}) })
}, },
handleDelete(row) { handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.seriesId !== row.seriesId) this.selectedData = this.selectedData.filter(item => item.vehicleSeriesId !== row.vehicleSeriesId)
const obj = this.selectingData.find(v => v.seriesId == row.seriesId) const obj = this.selectingData.find(v => v.vehicleSeriesId == row.vehicleSeriesId)
this.$refs.seletingTable.toggleRowSelection(obj) this.$refs.seletingTable.toggleRowSelection(obj)
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</td> </td>
<td> <td>
<el-select placeholder="车型" :disabled="routeInfo.type == 2" size="small" multiple collapse-tags :class="{ 'w-200-per': true }" style="width: 200px" v-model="subItem.seriesConfigList" @focus="carTypeSelect(false, subItem)" value-key="seriesId"> <el-select placeholder="车型" :disabled="routeInfo.type == 2" size="small" multiple collapse-tags :class="{ 'w-200-per': true }" style="width: 200px" v-model="subItem.seriesConfigList" @focus="carTypeSelect(false, subItem)" value-key="seriesId">
<el-option v-for="item in subItem.seriesConfigList" :key="item.seriesId" :label="item.seriesName" :value="item"></el-option> <el-option v-for="item in subItem.seriesConfigList" :key="item.vehicleSeriesId" :label="item.vehicleSeriesName" :value="item"></el-option>
</el-select> </el-select>
</td> </td>
<td style="width: 60px" v-if="routeInfo.type != 2"> <td style="width: 60px" v-if="routeInfo.type != 2">
...@@ -326,9 +326,9 @@ export default { ...@@ -326,9 +326,9 @@ export default {
}, },
// 确认门店弹窗或者品牌弹窗 // 确认门店弹窗或者品牌弹窗
handleRelateStoreConfirm(selectedData) { handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) { // if (!selectedData.length) {
return this.$message.error(`请选择车型`) // return this.$message.error(`请选择车型`)
} // }
// 如果是批量 // 如果是批量
if (this.isAllow) { if (this.isAllow) {
this.goodsInfoData?.goodsSpecificationList.forEach(item => { this.goodsInfoData?.goodsSpecificationList.forEach(item => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!