Commit d05a8137 by 胡悦

修改平板配置门店搜索

1 parent dd3a6b16
......@@ -69,7 +69,7 @@
</template>
<script>
import { deepClone } from "@/common/util"
import { getConfigList, getCarbrandTree, getListShop4sByRef, deleteConfig, getMateralDetail } from "@api/contentManager"
import { getConfigList, getCarbrandTree, deleteConfig, getMateralDetail } from "@api/contentManager"
export default {
data() {
return {
......@@ -82,13 +82,13 @@ export default {
},
{
label: "门店",
name: "merchantId",
type: "select",
isClear: true,
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "shopList"
name: "merchantName",
type: "input",
// isClear: true,
// optionList: [],
// optionId: "merchantId",
// optionLabel: "merchantName",
// optionsName: "shopList"
},
],
searchFormSearch: {},
......@@ -96,7 +96,6 @@ export default {
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
// tableOption: { width: '200px' },
tableOption: true,
tableColumns: [
{
......@@ -104,11 +103,6 @@ export default {
prop: "brandName",
addHtml: "brandName"
},
// {
// label: "子品牌",
// prop: "subBrandName",
// addHtml: "subBrandName"
// },
{
label: "关联门店",
prop: "merchantName",
......@@ -128,7 +122,6 @@ export default {
}
},
mounted() {
this.initSelect()
this.getCarbrandTree()
},
methods: {
......@@ -139,7 +132,6 @@ export default {
if (brandId) {
this.searchFormSearch.brandId = brandId[brandId.length - 1]
}
console.log(this.searchFormSearch, '=-===')
resolve()
})
},
......@@ -152,66 +144,11 @@ export default {
console.log("this.searchForm", this.searchForm)
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() {
const res = await getCarbrandTree()
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() {
this.$router.push({ name: "addEquity" })
},
......
......@@ -131,7 +131,8 @@ export default {
const _second = this.brandData.filter(item => !item.children).map(item => item.id)
const params = {
// firstBrandIdList: _first,
secBrandIdList: _second
secBrandIdList: _second,
scene: 0
}
getCarBrandIds(params).then((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!