修改库存调拨商品列表,预订单添加同步价格
This commit is contained in:
parent
0412b0bfc3
commit
c8e40ce7ec
|
@ -57,4 +57,9 @@ export function apiBeforehandOrderCartInfoFix(params: any) {
|
|||
url: '/beforehand_order_cart_info/beforehandordercartinfo/fix',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 同步商品价格
|
||||
export function apiBeforehandOrderCartInfoSyncPrice(params: any) {
|
||||
return request.get({ url: '/beforehand_order_cart_info/beforehandordercartinfo/syncPrice', params })
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
<el-form-item label="转出门店" prop="one_id" v-if="formData.one_type == 1">
|
||||
<el-select v-model="formData.one_id" filterable remote reserve-keyword placeholder="请选择转出方"
|
||||
remote-show-suffix :remote-method="remoteMethodStore" :loading="storeloading"
|
||||
style="width: 300px">
|
||||
@change="changeStore" style="width: 300px">
|
||||
<el-option v-for="item in storeList" :key="item.id"
|
||||
:label="`${item.name}|${item.phone} (ID:${item.id})`" :value="item.id" />
|
||||
</el-select>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<el-form-item label="转出仓库" prop="one_id" v-if="formData.one_type == 2">
|
||||
<el-select v-model="formData.one_id" filterable remote reserve-keyword placeholder="请选择转出方"
|
||||
remote-show-suffix :remote-method="remoteMethodWarehouse" :loading="warehouseloading"
|
||||
style="width: 300px">
|
||||
@change="changeWarehouse" style="width: 300px">
|
||||
<el-option v-for="item in warehouseList" :key="item.id" :label="item.name"
|
||||
:value="item.id" />
|
||||
</el-select>
|
||||
|
@ -81,7 +81,8 @@
|
|||
</el-form>
|
||||
</div>
|
||||
<el-dialog v-model="showProduct" title="选择商品" width="70%">
|
||||
<product-pop @onBindStore="onBindProduct"></product-pop>
|
||||
<product-pop @onBindStore="onBindProduct" :is_branch="1" :store_id="store_id"
|
||||
:warehouse_id="warehouse_id" :is_warehouse="is_warehouse" :key="productModalKey"></product-pop>
|
||||
</el-dialog>
|
||||
</popup>
|
||||
</div>
|
||||
|
@ -106,6 +107,8 @@
|
|||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const store_id = ref(0) // 门店id
|
||||
const warehouse_id = ref(0) //仓库id
|
||||
const is_warehouse = ref(0) //是否仓库
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
|
@ -146,6 +149,17 @@
|
|||
showProduct.value = false
|
||||
}
|
||||
|
||||
const changeStore = (e : any) => {
|
||||
store_id.value = e
|
||||
resetUserId()
|
||||
}
|
||||
|
||||
const changeWarehouse = (e : any) => {
|
||||
warehouse_id.value = e
|
||||
is_warehouse.value = 1
|
||||
resetUserId()
|
||||
}
|
||||
|
||||
const storeloading = ref(false)
|
||||
const storeList = ref([])
|
||||
const remoteMethodStore = (e = '') => {
|
||||
|
@ -191,7 +205,7 @@
|
|||
expiration_date: item.expiration_date
|
||||
}
|
||||
})
|
||||
const data = { product_arr,...formData }
|
||||
const data = { product_arr, ...formData }
|
||||
await formRef.value?.validate()
|
||||
mode.value == 'edit'
|
||||
? await apiInventoryTransferEdit(data)
|
||||
|
@ -209,7 +223,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const getDetail = async (row : Record<string, any>) => {
|
||||
const data = await apiInventoryTransferDetail({
|
||||
id: row.id
|
||||
|
@ -217,6 +231,11 @@
|
|||
setFormData(data)
|
||||
}
|
||||
|
||||
const productModalKey = ref(0)
|
||||
const resetUserId = () => {
|
||||
productModalKey.value++
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<el-form-item>
|
||||
<!-- <el-button type="primary" @click="fixAcceptNum">修复分拣数量</el-button> -->
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button type="primary" @click="syncPrice">同步价格</el-button>
|
||||
<export-data
|
||||
class="ml-2.5"
|
||||
:fetch-fun="apiBeforehandOrderCartInfoLists"
|
||||
|
@ -194,7 +195,8 @@ import {
|
|||
apiBeforehandOrderCartInfoLists,
|
||||
apiBeforehandOrderCartInfoDelete,
|
||||
apiBeforehandOrderCartInfoProcurementStatus,
|
||||
apiBeforehandOrderCartInfoFix
|
||||
apiBeforehandOrderCartInfoFix,
|
||||
apiBeforehandOrderCartInfoSyncPrice
|
||||
} from '@/api/beforehand_order_cart_info'
|
||||
import { apiDeliveryServiceLists } from '@/api/delivery_service'
|
||||
import feedback from '@/utils/feedback'
|
||||
|
@ -323,6 +325,13 @@ const fixAcceptNum = () => {
|
|||
})
|
||||
}
|
||||
|
||||
const syncPrice = async() => {
|
||||
await apiBeforehandOrderCartInfoSyncPrice({
|
||||
bhoid: formData.value.id
|
||||
})
|
||||
getLists()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
queryParams.bhoid = route.query.id
|
||||
formData.value.id = route.query.id
|
||||
|
|
|
@ -88,7 +88,13 @@
|
|||
placeholder="请选择订单类型"
|
||||
@change="resetPage"
|
||||
>
|
||||
<el-option label="普通订单" value="1" />
|
||||
<el-option label="批发订单" value="4" />
|
||||
<el-option label="铺货订单" value="11" />
|
||||
<el-option label="摊贩订单" value="12" />
|
||||
<el-option label="一条龙订单" value="13" />
|
||||
<el-option label="仓库补货" value="15" />
|
||||
<el-option label="其他订单" value="17" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
|
|
@ -1,29 +1,16 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
@keydown.enter="resetPage"
|
||||
v-model="queryParams.store_name"
|
||||
clearable
|
||||
placeholder="请输入商品名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类" prop="store_name">
|
||||
<el-cascader
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.class_all"
|
||||
filterable
|
||||
clearable
|
||||
:before-filter="beforeFilter"
|
||||
:props="props"
|
||||
placeholder="请选择商品分类"
|
||||
@change="resetPage"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="商品条码" prop="bar_code">
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input class="w-[280px]" @keydown.enter="resetPage" v-model="queryParams.store_name" clearable
|
||||
placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类" prop="store_name">
|
||||
<el-cascader class="w-[280px]" v-model="queryParams.class_all" filterable clearable
|
||||
:before-filter="beforeFilter" :props="props" placeholder="请选择商品分类" @change="resetPage" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="商品条码" prop="bar_code">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.bar_code"
|
||||
|
@ -31,284 +18,209 @@
|
|||
placeholder="请输入商品条码"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="排序" prop="order_by">
|
||||
<el-select
|
||||
v-model="queryParams.order_by"
|
||||
placeholder="请选择排序"
|
||||
style="width: 240px"
|
||||
@change="resetPage"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in [
|
||||
<el-form-item label="排序" prop="order_by">
|
||||
<el-select v-model="queryParams.order_by" placeholder="请选择排序" style="width: 240px"
|
||||
@change="resetPage">
|
||||
<el-option v-for="item in [
|
||||
{ id: 'asc', name: '升序' },
|
||||
{ id: 'desc', name: '降序' }
|
||||
]"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
<export-data
|
||||
class="ml-2.5"
|
||||
:fetch-fun="apiWarehouseProductStoregeLists"
|
||||
:params="queryParams"
|
||||
:page-size="pager.size"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<router-link
|
||||
:to="{
|
||||
]" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
<export-data class="ml-2.5" :fetch-fun="apiWarehouseProductStoregeLists" :params="queryParams"
|
||||
:page-size="pager.size" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<router-link :to="{
|
||||
path: 'import',
|
||||
query: { warehouse_id: queryParams.warehouse_id }
|
||||
}"
|
||||
class="ml-4"
|
||||
>
|
||||
<el-button type="primary"> 出库 </el-button>
|
||||
</router-link>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="商品图片" prop="image" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<el-image
|
||||
style="width: 50px; height: 50px"
|
||||
:src="row.image"
|
||||
:preview-teleported="true"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="商品名称"
|
||||
prop="store_name"
|
||||
min-width="200"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="分类"
|
||||
prop="cate_name"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="单位"
|
||||
prop="unit_name"
|
||||
min-width="80"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="供货价"
|
||||
prop="purchase"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="商户价"
|
||||
prop="cost"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="终端零售价"
|
||||
prop="price"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="规格"
|
||||
prop="store_info"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="毛利率"
|
||||
prop="rose"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="库存"
|
||||
prop="nums"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="价值"
|
||||
prop="total_price"
|
||||
min-width="200"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
@click="resetProductStoregeClick(row)"
|
||||
v-perms="[
|
||||
}" class="ml-4">
|
||||
<el-button type="primary"> 出库 </el-button>
|
||||
</router-link>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="商品图片" prop="image" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<el-image style="width: 50px; height: 50px" :src="row.image" :preview-teleported="true" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" prop="store_name" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="分类" prop="cate_name" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit_name" min-width="80" show-overflow-tooltip />
|
||||
<el-table-column label="供货价" prop="purchase" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="商户价" prop="cost" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="终端零售价" prop="price" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="规格" prop="store_info" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="毛利率" prop="rose" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="库存" prop="nums" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="价值" prop="total_price" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link @click="resetProductStoregeClick(row)" v-perms="[
|
||||
'warehouse_product_storege.warehouse_product_storege/edit'
|
||||
]"
|
||||
>
|
||||
重置数量
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- <Details ref="detailsRef"></Details> -->
|
||||
</div>
|
||||
<el-dialog v-model="resetProductStoregeShow" title="重置数量" width="600">
|
||||
<el-form :model="formData" label-width="90px">
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input v-model="formData.store_name" clearable :readonly="false" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input
|
||||
v-model="formData.nums"
|
||||
clearable
|
||||
:readonly="false"
|
||||
placeholder="请输入数量"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="resetProductStoregeShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="resetProductStorege"> 确认 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
]">
|
||||
重置数量
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- <Details ref="detailsRef"></Details> -->
|
||||
</div>
|
||||
<el-dialog v-model="resetProductStoregeShow" title="重置数量" width="600">
|
||||
<el-form :model="formData" label-width="90px">
|
||||
<el-form-item label="商品名称" prop="store_name">
|
||||
<el-input v-model="formData.store_name" clearable :readonly="false" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input v-model="formData.nums" clearable :readonly="false" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" clearable :readonly="false" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="resetProductStoregeShow = false">取消</el-button>
|
||||
<el-button type="primary" @click="resetProductStorege"> 确认 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="storeProductLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import {
|
||||
apiWarehouseProductStoregeLists,
|
||||
apiWarehouseProductStoregeEdit
|
||||
} from '@/api/warehouse_product_storege'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
// import Details from './details.vue'
|
||||
import { apiStoreCategoryLists } from '@/api/store_category'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import {
|
||||
apiWarehouseProductStoregeLists,
|
||||
apiWarehouseProductStoregeEdit
|
||||
} from '@/api/warehouse_product_storege'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
// import Details from './details.vue'
|
||||
import { apiStoreCategoryLists } from '@/api/store_category'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
const route = useRoute()
|
||||
|
||||
const resetProductStoregeShow = ref(false)
|
||||
const formData = ref({
|
||||
id: '',
|
||||
store_name: '',
|
||||
nums: ''
|
||||
})
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
store_name: '',
|
||||
class_all: '',
|
||||
warehouse_id: '',
|
||||
bar_code: '',
|
||||
order_by: '',
|
||||
field: 'nums'
|
||||
})
|
||||
const resetProductStoregeShow = ref(false)
|
||||
const formData = ref({
|
||||
id: '',
|
||||
store_name: '',
|
||||
nums: '',
|
||||
remark: ''
|
||||
})
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
store_name: '',
|
||||
class_all: '',
|
||||
warehouse_id: '',
|
||||
bar_code: '',
|
||||
order_by: '',
|
||||
field: 'nums'
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
// 分页相关
|
||||
let page_no = 1
|
||||
if (route.query.page_no) {
|
||||
page_no = parseInt(route.query.page_no)
|
||||
}
|
||||
if (route.query.id) {
|
||||
queryParams.warehouse_id = parseInt(route.query.id)
|
||||
}
|
||||
console.log(route.query.id)
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
page: page_no,
|
||||
fetchFun: apiWarehouseProductStoregeLists,
|
||||
params: queryParams
|
||||
})
|
||||
const resetProductStoregeClick = (data: any) => {
|
||||
resetProductStoregeShow.value = true
|
||||
formData.value.id = data.id
|
||||
formData.value.store_name = data.store_name
|
||||
formData.value.nums = data.nums
|
||||
}
|
||||
const resetProductStorege = (data: any) => {
|
||||
resetProductStoregeShow.value = false
|
||||
if (formData.value.id <= 0) {
|
||||
ElMessage.error('id不能为空')
|
||||
return false
|
||||
}
|
||||
apiWarehouseProductStoregeEdit(formData.value).then((res) => {
|
||||
getLists()
|
||||
})
|
||||
}
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val : any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
// 分页相关
|
||||
let page_no = 1
|
||||
if (route.query.page_no) {
|
||||
page_no = parseInt(route.query.page_no)
|
||||
}
|
||||
if (route.query.id) {
|
||||
queryParams.warehouse_id = parseInt(route.query.id)
|
||||
}
|
||||
console.log(route.query.id)
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
page: page_no,
|
||||
fetchFun: apiWarehouseProductStoregeLists,
|
||||
params: queryParams
|
||||
})
|
||||
const resetProductStoregeClick = (data : any) => {
|
||||
resetProductStoregeShow.value = true
|
||||
formData.value.id = data.id
|
||||
formData.value.store_name = data.store_name
|
||||
formData.value.nums = data.nums
|
||||
}
|
||||
const resetProductStorege = (data : any) => {
|
||||
resetProductStoregeShow.value = false
|
||||
if (formData.value.id <= 0) {
|
||||
ElMessage.error('id不能为空')
|
||||
return false
|
||||
}
|
||||
apiWarehouseProductStoregeEdit(formData.value).then((res) => {
|
||||
getLists()
|
||||
})
|
||||
}
|
||||
|
||||
let resolves
|
||||
let nodes
|
||||
const flag = ref(false)
|
||||
let name
|
||||
const beforeFilter = (value) => {
|
||||
name = value
|
||||
flag.value = true
|
||||
props.lazyLoad(nodes, resolves)
|
||||
return false
|
||||
}
|
||||
const props = {
|
||||
value: 'id',
|
||||
label: 'name',
|
||||
emitPath: false,
|
||||
lazy: true,
|
||||
lazyLoad(node, resolve) {
|
||||
if (!resolves) resolves = resolve
|
||||
if (!nodes) nodes = node
|
||||
const pid = node.value || 0
|
||||
let data = {}
|
||||
if (flag.value) {
|
||||
data = { name: name }
|
||||
if (!name) {
|
||||
data = {
|
||||
pid: pid,
|
||||
page_size: 10000
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = {
|
||||
pid: pid,
|
||||
page_size: 10000
|
||||
}
|
||||
}
|
||||
apiStoreCategoryLists({
|
||||
...data
|
||||
}).then((res) => {
|
||||
resolve(
|
||||
res.lists.map((item: any) => {
|
||||
// item.leaf = item.is_children == 0;
|
||||
item.leaf = true
|
||||
flag.value = false
|
||||
return item
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
let resolves
|
||||
let nodes
|
||||
const flag = ref(false)
|
||||
let name
|
||||
const beforeFilter = (value) => {
|
||||
name = value
|
||||
flag.value = true
|
||||
props.lazyLoad(nodes, resolves)
|
||||
return false
|
||||
}
|
||||
const props = {
|
||||
value: 'id',
|
||||
label: 'name',
|
||||
emitPath: false,
|
||||
lazy: true,
|
||||
lazyLoad(node, resolve) {
|
||||
if (!resolves) resolves = resolve
|
||||
if (!nodes) nodes = node
|
||||
const pid = node.value || 0
|
||||
let data = {}
|
||||
if (flag.value) {
|
||||
data = { name: name }
|
||||
if (!name) {
|
||||
data = {
|
||||
pid: pid,
|
||||
page_size: 10000
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = {
|
||||
pid: pid,
|
||||
page_size: 10000
|
||||
}
|
||||
}
|
||||
apiStoreCategoryLists({
|
||||
...data
|
||||
}).then((res) => {
|
||||
resolve(
|
||||
res.lists.map((item : any) => {
|
||||
// item.leaf = item.is_children == 0;
|
||||
item.leaf = true
|
||||
flag.value = false
|
||||
return item
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getLists()
|
||||
})
|
||||
</script>
|
||||
onMounted(() => {
|
||||
getLists()
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue