Commit d05a8137 by 胡悦

修改平板配置门店搜索

1 parent dd3a6b16
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</template> </template>
<script> <script>
import { deepClone } from "@/common/util" import { deepClone } from "@/common/util"
import { getConfigList, getCarbrandTree, getListShop4sByRef, deleteConfig, getMateralDetail } from "@api/contentManager" import { getConfigList, getCarbrandTree, deleteConfig, getMateralDetail } from "@api/contentManager"
export default { export default {
data() { data() {
return { return {
...@@ -82,13 +82,13 @@ export default { ...@@ -82,13 +82,13 @@ export default {
}, },
{ {
label: "门店", label: "门店",
name: "merchantId", name: "merchantName",
type: "select", type: "input",
isClear: true, // isClear: true,
optionList: [], // optionList: [],
optionId: "merchantId", // optionId: "merchantId",
optionLabel: "merchantName", // optionLabel: "merchantName",
optionsName: "shopList" // optionsName: "shopList"
}, },
], ],
searchFormSearch: {}, searchFormSearch: {},
...@@ -96,7 +96,6 @@ export default { ...@@ -96,7 +96,6 @@ export default {
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list", listName: "list",
// tableOption: { width: '200px' },
tableOption: true, tableOption: true,
tableColumns: [ tableColumns: [
{ {
...@@ -104,11 +103,6 @@ export default { ...@@ -104,11 +103,6 @@ export default {
prop: "brandName", prop: "brandName",
addHtml: "brandName" addHtml: "brandName"
}, },
// {
// label: "子品牌",
// prop: "subBrandName",
// addHtml: "subBrandName"
// },
{ {
label: "关联门店", label: "关联门店",
prop: "merchantName", prop: "merchantName",
...@@ -128,7 +122,6 @@ export default { ...@@ -128,7 +122,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.initSelect()
this.getCarbrandTree() this.getCarbrandTree()
}, },
methods: { methods: {
...@@ -139,7 +132,6 @@ export default { ...@@ -139,7 +132,6 @@ export default {
if (brandId) { if (brandId) {
this.searchFormSearch.brandId = brandId[brandId.length - 1] this.searchFormSearch.brandId = brandId[brandId.length - 1]
} }
console.log(this.searchFormSearch, '=-===')
resolve() resolve()
}) })
}, },
...@@ -152,66 +144,11 @@ export default { ...@@ -152,66 +144,11 @@ export default {
console.log("this.searchForm", this.searchForm) console.log("this.searchForm", this.searchForm)
this.handleSearch() this.handleSearch()
}, },
initSelect() {
// 使用 Promise.all 处理多个异步任务,并捕获所有可能的错误
Promise.allSettled([this.getShopList()])
.then((results) => {
// 检查每个任务的结果
results.forEach((result, index) => {
if (result.status === "rejected") {
console.error(`Task ${index} failed:`, result.reason)
}
})
// 统一调用 getOptionsList
this.getOptionsList()
})
.catch((err) => {
console.error("Unexpected error in initSelect:", err)
this.getOptionsList() // 确保即使有意外错误也调用 getOptionsList
})
},
// 获取品牌树 // 获取品牌树
async getCarbrandTree() { async getCarbrandTree() {
const res = await getCarbrandTree() const res = await getCarbrandTree()
this.options = res this.options = res
}, },
getShopList() {
return new Promise((resolve, reject) => {
getListShop4sByRef({})
.then((res) => {
this.baseData.shopList = res
resolve(res) // 返回结果以便主流程感知
})
.catch((err) => {
console.error("Error in getListShop4sByRef:", err)
reject(err) // 捕获并传递错误
})
})
},
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === "select") {
if (
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
) {
// if (item.optionsName != "brandList") {
const temp = {}
temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp)
// }
}
this.$set(
this.showFormData[index],
"optionList",
this.baseData[item.optionsName]
)
}
})
},
handleDialog() { handleDialog() {
this.$router.push({ name: "addEquity" }) this.$router.push({ name: "addEquity" })
}, },
......
...@@ -131,7 +131,8 @@ export default { ...@@ -131,7 +131,8 @@ export default {
const _second = this.brandData.filter(item => !item.children).map(item => item.id) const _second = this.brandData.filter(item => !item.children).map(item => item.id)
const params = { const params = {
// firstBrandIdList: _first, // firstBrandIdList: _first,
secBrandIdList: _second secBrandIdList: _second,
scene: 0
} }
getCarBrandIds(params).then((res) => { getCarBrandIds(params).then((res) => {
this.allData = deepClone(res) this.allData = deepClone(res)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!