|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<div class="filters">
|
|
|
<el-input placeholder="ASIN/父ASIN/标题/SKU"></el-input>
|
|
|
- <el-select v-model="value" style="width: 300px">
|
|
|
- <el-option v-for="item in options" :key="item.productlineId" :label="item.productlinename" :value="item.productlineId" />
|
|
|
+ <el-select v-model="selectValue" style="width: 300px">
|
|
|
+ <el-option v-for="(item, index) in options" :key="item.productlineId" :label="item.productlinename" :value="item.productlineId" />
|
|
|
</el-select>
|
|
|
<DateRangePicker v-model="dateRange"></DateRangePicker>
|
|
|
</div>
|
|
@@ -13,27 +13,41 @@ import DateRangePicker from '/@/components/DateRangePicker/index.vue'
|
|
|
import { usePublicData } from '/@/stores/publicData'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
import { getProductLineSelect } from '/@/views/productCenter/productList/api'
|
|
|
-import { inject, onMounted, ref } from 'vue'
|
|
|
+import { inject, onBeforeUnmount, onMounted, ref,watch } from 'vue'
|
|
|
+import emitter from '/@/utils/emitter'
|
|
|
|
|
|
const publicData = usePublicData()
|
|
|
const { dateRange } = storeToRefs(publicData)
|
|
|
const profile = <any>inject('profile')
|
|
|
|
|
|
-const value = ref('')
|
|
|
+const selectValue = ref('')
|
|
|
const options = ref([])
|
|
|
|
|
|
async function fetchProductLine() {
|
|
|
try {
|
|
|
const resp = await getProductLineSelect({ profileId: profile.value.profile_id })
|
|
|
options.value = resp.data
|
|
|
+ selectValue.value = options.value[0].productlineId
|
|
|
} catch (error) {
|
|
|
console.log('error:', error)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+emitter.on('ProductSelectCard-cardId', (value: any) => {
|
|
|
+ selectValue.value = value.productlineId
|
|
|
+})
|
|
|
+
|
|
|
+watch(selectValue, ()=> {
|
|
|
+ emitter.emit('TopFilters-selectValue', { selectValue: selectValue.value })
|
|
|
+})
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
fetchProductLine()
|
|
|
})
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ emitter.all.clear()
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|