修改筛选门店
parent
4a9bb036b8
commit
d52ec7402b
|
|
@ -42,11 +42,16 @@
|
|||
import { http } from '@/utils/request'
|
||||
import { onMounted, ref, reactive, computed, toRaw } from 'vue'
|
||||
import debounce from '@climblee/uv-ui/libs/function/debounce'
|
||||
import { empty } from '@climblee/uv-ui/libs/function/test'
|
||||
const props = defineProps({
|
||||
color: {
|
||||
type: String,
|
||||
default: '#fff',
|
||||
},
|
||||
isAll: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
onMounted(() => {
|
||||
getData()
|
||||
|
|
@ -93,15 +98,14 @@ const storeText = computed(() => {
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
function truncateString(str, maxLength) {
|
||||
if (str.length <= maxLength) {
|
||||
return str;
|
||||
return str
|
||||
}
|
||||
if (maxLength <= 3) {
|
||||
return str.substring(0, maxLength) + '...';
|
||||
return str.substring(0, maxLength) + '...'
|
||||
}
|
||||
return str.substring(0, maxLength - 3) + '...';
|
||||
return str.substring(0, maxLength - 3) + '...'
|
||||
}
|
||||
|
||||
const selectMenu = (e) => {
|
||||
|
|
@ -116,6 +120,9 @@ const selectMenu = (e) => {
|
|||
|
||||
debounce(
|
||||
() => {
|
||||
const obj = toRaw(arrayToObject(result.value))
|
||||
if (!props.isAll && empty(obj.store_id)) return
|
||||
|
||||
emit('change', toRaw(arrayToObject(result.value)))
|
||||
},
|
||||
500,
|
||||
|
|
@ -134,7 +141,11 @@ function arrayToObject(arr) {
|
|||
const getData = async () => {
|
||||
http.get('/region').then((res) => {
|
||||
regions.value = res
|
||||
provinces.value = [{ name: '全部区域', code: null }].concat(res.province)
|
||||
let _all = []
|
||||
|
||||
_all = [{ name: '全部区域', code: null }]
|
||||
|
||||
provinces.value = _all.concat(res.province)
|
||||
citys.value = getCityByCode()
|
||||
regionsConfirm({
|
||||
value: [provinces.value[0], citys.value[0]],
|
||||
|
|
@ -172,7 +183,11 @@ const getStoreData = () => {
|
|||
params: params,
|
||||
})
|
||||
.then((res) => {
|
||||
store.value = [{ title: '全部门店', id: null }].concat(res)
|
||||
let _all = []
|
||||
if (props.isAll) {
|
||||
_all = [{ title: '全部门店', id: null }]
|
||||
}
|
||||
store.value = _all.concat(res)
|
||||
storeConfirm({ value: [store.value[0]] })
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
bgColor="#fff"
|
||||
v-if="checkPermission(['admin'])"
|
||||
>
|
||||
<StoreDown color="#333333" @change="storeChange"></StoreDown>
|
||||
<StoreDown color="#333333" @change="storeChange" :isAll="false"></StoreDown>
|
||||
</uv-sticky>
|
||||
|
||||
<uv-form
|
||||
|
|
|
|||
Loading…
Reference in New Issue