Commit 85f9af8d by 胡悦

修改门店弹窗搜索

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