style:入库单据/出库单据-列表添加默认状态筛选

main
黄伟杰 6 days ago
parent 6302b615f7
commit ff48b38e2b

@ -360,7 +360,7 @@ const queryParams = reactive({
productId: undefined,
supplierId: undefined,
inTime: [],
statusList: [0, 1, 10],
statusList: [],
remark: undefined,
inType: undefined,
creator: undefined
@ -378,6 +378,8 @@ const activeName = ref('')
const queryFormRef = ref() //
const exportLoading = ref(false) //
const showAllFilters = ref(false)
const DEFAULT_STATUS_LIST = [0, 1, 10]
const useInitialStatusFilter = ref(true)
const filterCount = 7
const toggleFilters = () => {
showAllFilters.value = !showAllFilters.value
@ -426,7 +428,7 @@ const getList = async () => {
loading.value = true
try {
await loadAuditConfig()
const data = await StockInApi.getStockInPage(queryParams)
const data = await StockInApi.getStockInPage(buildQueryParams())
list.value = data.list
total.value = data.total
} finally {
@ -434,14 +436,25 @@ const getList = async () => {
}
}
const buildQueryParams = () => ({
...queryParams,
statusList: queryParams.statusList?.length
? queryParams.statusList
: useInitialStatusFilter.value
? DEFAULT_STATUS_LIST
: []
})
/** 搜索按钮操作 */
const handleQuery = () => {
useInitialStatusFilter.value = false
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
useInitialStatusFilter.value = false
queryFormRef.value.resetFields()
queryParams.statusList = []
queryParams.inType = activeName.value || stockInTypeOptions.value[0]?.value
@ -533,7 +546,7 @@ const handleExport = async () => {
exportLoading.value = true
const ids = selectionList.value.map((item) => item.id).filter((v) => v != null)
const params = {
...queryParams,
...buildQueryParams(),
ids: ids.length ? ids.join(',') : undefined
}
const data = await StockInApi.exportStockIn(params)
@ -565,7 +578,8 @@ const syncDefaultInType = () => {
watch(stockInTypeOptions, (options) => {
if (!queryParams.inType && options.length) {
syncDefaultInType()
handleQuery()
queryParams.pageNo = 1
getList()
}
})

@ -358,7 +358,7 @@ const queryParams = reactive({
no: undefined,
productId: undefined,
outTime: [],
statusList: [0, 1, 10],
statusList: [],
remark: undefined,
outType: undefined,
creator: undefined
@ -378,6 +378,8 @@ const activeName = ref('')
const queryFormRef = ref() // ?
const exportLoading = ref(false) //
const showAllFilters = ref(false)
const DEFAULT_STATUS_LIST = [0, 1, 10]
const useInitialStatusFilter = ref(true)
const filterCount = 7
const toggleFilters = () => {
showAllFilters.value = !showAllFilters.value
@ -425,7 +427,7 @@ const getList = async () => {
loading.value = true
try {
await loadAuditConfig()
const data = await StockOutApi.getStockOutPage(queryParams)
const data = await StockOutApi.getStockOutPage(buildQueryParams())
list.value = data.list
total.value = data.total
} finally {
@ -433,14 +435,24 @@ const getList = async () => {
}
}
const buildQueryParams = () => ({
...queryParams,
statusList: queryParams.statusList?.length
? queryParams.statusList
: useInitialStatusFilter.value
? DEFAULT_STATUS_LIST
: []
})
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
useInitialStatusFilter.value = false
queryParams.pageNo = 1
getList()
}
/** 閲嶇疆鎸夐挳鎿嶄綔 */
const resetQuery = () => {
useInitialStatusFilter.value = false
queryFormRef.value.resetFields()
queryParams.statusList = []
queryParams.outType = activeName.value || stockOutTypeOptions.value[0]?.value
@ -532,7 +544,7 @@ const handleExport = async () => {
exportLoading.value = true
const ids = selectionList.value.map((item) => item.id).filter((v) => v != null)
const params = {
...queryParams,
...buildQueryParams(),
ids: ids.length ? ids.join(',') : undefined
}
const data = await StockOutApi.exportStockOut(params)
@ -564,7 +576,8 @@ const syncDefaultOutType = () => {
watch(stockOutTypeOptions, (options) => {
if (!queryParams.outType && options.length) {
syncDefaultOutType()
handleQuery()
queryParams.pageNo = 1
getList()
}
})

Loading…
Cancel
Save