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

main
黄伟杰 1 month ago
parent 6302b615f7
commit ff48b38e2b

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

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

Loading…
Cancel
Save