Commit 85f9af8d by 胡悦

修改门店弹窗搜索

1 parent 0e1341d8
......@@ -15,11 +15,12 @@
v-model.trim="storeSearchForm.brandName"
placeholder="门店名称"
max-length="20"
@input="handleStoreInput"
@keydown.native="handleStoreInput"
clearable
/>
</el-form-item>
<el-button type="primary" @click="handleCurrentChange(1)">搜索</el-button>
<el-button type="primary" @click="handleSearchStore">搜索</el-button>
</el-form>
<el-row class="tableCon">
<div class="tableBox">
......@@ -33,6 +34,7 @@
@select-all="handleAll"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column prop="merchantNo" label="门店商户号" align="center"></el-table-column>
<el-table-column prop="merchantName" label="门店名称" align="center">
</el-table-column>
</el-table>
......@@ -72,6 +74,8 @@
</template>
<script>
import { debounce } from "../../../index/debounce"
import { deepClone } from "@/common/util"
import { getCarBrandIds } from "@api/contentManager"
export default {
name: "RelateStoreDialog",
......@@ -84,6 +88,7 @@ export default {
currentPage: 1,
pageSize: 20,
storeSearchForm: {},
allData: []
}
},
......@@ -101,8 +106,13 @@ export default {
default: () => []
}
},
created() {
// 创建防抖版本的搜索函数
this.debouncedSearch = debounce(this.handleSearchStore, 300);
},
mounted() {
console.log(this.brandData)
this.allData = deepClone(this.storeSelected)
this.selectedData = this.storeSelected
this.getSelectingList()
},
......@@ -124,6 +134,7 @@ export default {
secBrandIdList: _second
}
getCarBrandIds(params).then((res) => {
this.allData = deepClone(res)
this.selectingData = res
this.total = res.total
this.$nextTick(() => {
......@@ -131,6 +142,21 @@ export default {
})
})
},
handleStoreInput(e) {
this.debouncedSearch()
},
handleSearchStore() {
console.log(this.storeSearchForm.brandName)
const {brandName} = this.storeSearchForm
if(brandName) {
this.selectingData = this.selectingData.filter(item => {
return item.merchantName.includes(brandName)
})
} else {
this.selectingData = deepClone(this.allData)
}
},
handleChange(selection, row) {
var addOrDelete = !!selection.find((item) => item.merchantNo === row.merchantNo)
addOrDelete
......@@ -156,10 +182,10 @@ export default {
const obj = this.selectingData.find((v) => v.merchantNo == row.merchantNo)
this.$refs.seletingTable.toggleRowSelection(obj)
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
// handleCurrentChange(val) {
// this.currentPage = val
// this.getSelectingList()
// },
handleRelateStoreConfirm() {
this.$emit("handleRelateStoreConfirm", this.selectedData)
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!