Commit 9636fe0f by qinjianhui

feat: 商品类型查询条件修改

parent 34c97635
...@@ -54,6 +54,7 @@ declare module 'vue' { ...@@ -54,6 +54,7 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline'] ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload'] ElUpload: typeof import('element-plus/es')['ElUpload']
......
...@@ -34,6 +34,8 @@ export interface SearchForm { ...@@ -34,6 +34,8 @@ export interface SearchForm {
interceptStatus?: boolean interceptStatus?: boolean
standardDesignImage?: number standardDesignImage?: number
productMarkList?: string[] productMarkList?: string[]
podCustomizedQuantity?: string
cpCustomizedQuantity?: string
} }
export interface FactoryOrderNewListData { export interface FactoryOrderNewListData {
......
...@@ -34,6 +34,10 @@ export interface SearchForm { ...@@ -34,6 +34,10 @@ export interface SearchForm {
interceptStatus?: boolean interceptStatus?: boolean
standardDesignImage?: number standardDesignImage?: number
productMarkList?: string[] productMarkList?: string[]
/** list_page:POD 商品单面/多面,与 productMarkList 中 pod 联动 */
podCustomizedQuantity?: string
/** list_page:一件定制局部印单面/多面,与 productMarkList 中 custom_part 联动 */
cpCustomizedQuantity?: string
operationNo?: string operationNo?: string
} }
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
/** 选项 value 与接口查询字段的对应关系见 `../utils/productMarkQuery.ts`(productMarkList / podCustomizedQuantity / cpCustomizedQuantity)。 */
import { computed } from 'vue' import { computed } from 'vue'
import { ArrowDown } from '@element-plus/icons-vue' import { ArrowDown } from '@element-plus/icons-vue'
import type { ProductTypeGroup, ProductTypeValue } from './productTypeFilterTypes' import type { ProductTypeGroup, ProductTypeValue } from './productTypeFilterTypes'
......
...@@ -3,6 +3,12 @@ import { getListCraftApi, getCustomTagListCnApi, allErpCodeListApi } from '@/api ...@@ -3,6 +3,12 @@ import { getListCraftApi, getCustomTagListCnApi, allErpCodeListApi } from '@/api
import { getUserMarkList, loadWarehouseListApi } from '@/api/common' import { getUserMarkList, loadWarehouseListApi } from '@/api/common'
import { getAllCountryApi } from '@/api/logistics' import { getAllCountryApi } from '@/api/logistics'
import type { ProductTypeGroup } from '../component/productTypeFilterTypes' import type { ProductTypeGroup } from '../component/productTypeFilterTypes'
import {
PRODUCT_TYPE_CUSTOM_PART_MULTIPLE,
PRODUCT_TYPE_CUSTOM_PART_SINGLE,
PRODUCT_TYPE_POD_MULTIPLE,
PRODUCT_TYPE_POD_SINGLE,
} from '../utils/productMarkQuery'
import type { IAllList } from '@/types/api/podUsOrder' import type { IAllList } from '@/types/api/podUsOrder'
import type { CraftListData } from '@/types/api/podCnOrder' import type { CraftListData } from '@/types/api/podCnOrder'
import type { WarehouseListData } from '@/types' import type { WarehouseListData } from '@/types'
...@@ -38,28 +44,28 @@ export function useOrderDictionaries() { ...@@ -38,28 +44,28 @@ export function useOrderDictionaries() {
const productTypeGroups = ref<ProductTypeGroup[]>([ const productTypeGroups = ref<ProductTypeGroup[]>([
{ {
label: '普品', label: '普品',
value: 'NORMAL_ALL', value: 'normal',
children: [{ label: '普品', value: 'NORMAL' }], children: [{ label: '普品', value: 'normal' }],
}, },
{ {
label: '胚衣', label: '胚衣',
value: 'GREIGE_ALL', value: 'custom_normal',
children: [{ label: '胚衣', value: 'GREIGE' }], children: [{ label: '胚衣', value: 'custom_normal' }],
}, },
{ {
label: 'POD商品', label: 'POD商品',
value: 'POD_ALL', value: 'pod',
children: [ children: [
{ label: '单面', value: 'POD_SINGLE' }, { label: '单面', value: PRODUCT_TYPE_POD_SINGLE },
{ label: '多面', value: 'POD_MULTI' }, { label: '多面', value: PRODUCT_TYPE_POD_MULTIPLE },
], ],
}, },
{ {
label: '一件定制局部印', label: '一件定制局部印',
value: 'CUSTOM_PART_ALL', value: 'custom_part',
children: [ children: [
{ label: '单面', value: 'CUSTOM_PART_SINGLE' }, { label: '单面', value: PRODUCT_TYPE_CUSTOM_PART_SINGLE },
{ label: '多面', value: 'CUSTOM_PART_MULTI' }, { label: '多面', value: PRODUCT_TYPE_CUSTOM_PART_MULTIPLE },
], ],
}, },
]) ])
......
import { nextTick, ref } from 'vue' import { nextTick, ref } from 'vue'
import type { SearchForm } from '@/types/api/order/factoryOrderNew' import type { SearchForm } from '@/types/api/order/factoryOrderNew'
import { normalizeProductMarkListForQuery } from '../utils/productMarkQuery'
export function useOrderSearchForm(refreshCurrentView: () => void) { export function useOrderSearchForm(refreshCurrentView: () => void) {
const searchForm = ref<SearchForm>({}) const searchForm = ref<SearchForm>({})
...@@ -57,11 +58,16 @@ export function useOrderSearchForm(refreshCurrentView: () => void) { ...@@ -57,11 +58,16 @@ export function useOrderSearchForm(refreshCurrentView: () => void) {
searchForm.value.shipmentType = '' searchForm.value.shipmentType = ''
} }
const getQueryPayload = () => ({ const getQueryPayload = () => {
...searchForm.value, const { productMarkList: rawProductMarks, ...rest } = searchForm.value
const markQuery = normalizeProductMarkListForQuery(rawProductMarks)
return {
...rest,
...markQuery,
startTime: dateRange.value?.[0] || null, startTime: dateRange.value?.[0] || null,
endTime: dateRange.value?.[1] || null, endTime: dateRange.value?.[1] || null,
}) }
}
const reset = () => { const reset = () => {
searchForm.value = {} searchForm.value = {}
......
/** POD 商品子项,与 useOrderDictionaries 中 options 一致 */
export const PRODUCT_TYPE_POD_SINGLE = 'pod_single'
export const PRODUCT_TYPE_POD_MULTIPLE = 'pod_multiple'
/** 一件定制局部印子项 */
export const PRODUCT_TYPE_CUSTOM_PART_SINGLE = 'custom_part_single'
export const PRODUCT_TYPE_CUSTOM_PART_MULTIPLE = 'custom_part_multiple'
export interface ProductMarkQueryResult {
productMarkList?: string[]
podCustomizedQuantity?: string
cpCustomizedQuantity?: string
}
export function normalizeProductMarkListForQuery(
raw: string[] | undefined,
): ProductMarkQueryResult {
if (!raw?.length) {
return {}
}
const set = new Set(raw)
const marks: string[] = []
if (set.has('normal')) marks.push('normal')
if (set.has('custom_normal')) marks.push('custom_normal')
if (
set.has(PRODUCT_TYPE_POD_SINGLE) ||
set.has(PRODUCT_TYPE_POD_MULTIPLE)
) {
marks.push('pod')
}
if (
set.has(PRODUCT_TYPE_CUSTOM_PART_SINGLE) ||
set.has(PRODUCT_TYPE_CUSTOM_PART_MULTIPLE)
) {
marks.push('custom_part')
}
const podS = set.has(PRODUCT_TYPE_POD_SINGLE)
const podM = set.has(PRODUCT_TYPE_POD_MULTIPLE)
const partS = set.has(PRODUCT_TYPE_CUSTOM_PART_SINGLE)
const partM = set.has(PRODUCT_TYPE_CUSTOM_PART_MULTIPLE)
const podQty =
podS && podM ? undefined : podS ? 'single' : podM ? 'multiple' : undefined
const partQty =
partS && partM ? undefined : partS ? 'single' : partM ? 'multiple' : undefined
const result: ProductMarkQueryResult = {}
if (marks.length) result.productMarkList = marks
if (podQty !== undefined) result.podCustomizedQuantity = podQty
if (partQty !== undefined) result.cpCustomizedQuantity = partQty
return result
}
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, ref, watch } from 'vue' import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
import useLodop from '@/utils/hooks/useLodop' import useLodop from '@/utils/hooks/useLodop'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { OrderData, ProductList, IorderItem } from '@/types/api/podMakeOrder' import { OrderData, ProductList, IorderItem } from '@/types/api/podMakeOrder'
...@@ -404,13 +404,6 @@ const emit = defineEmits<{ ...@@ -404,13 +404,6 @@ const emit = defineEmits<{
(e: 'refresh'): void (e: 'refresh'): void
(e: 'set-printer', v: string): void (e: 'set-printer', v: string): void
}>() }>()
onMounted(() => {
window.addEventListener('keydown', keyDown)
})
onUnmounted(() => {
window.removeEventListener('keydown', keyDown)
})
const visible = computed({ const visible = computed({
get() { get() {
return props.modelValue return props.modelValue
...@@ -475,6 +468,14 @@ const handleWarehouseChange = (value: string) => { ...@@ -475,6 +468,14 @@ const handleWarehouseChange = (value: string) => {
function keyDown(e: KeyboardEvent) { function keyDown(e: KeyboardEvent) {
const e1 = e || (window.event as KeyboardEvent) const e1 = e || (window.event as KeyboardEvent)
if (![37, 38, 39, 40].includes(e1.keyCode)) return if (![37, 38, 39, 40].includes(e1.keyCode)) return
const t = e1.target as HTMLElement | null
if (
t?.closest?.(
'input, textarea, select, [contenteditable="true"], [role="textbox"]',
)
) {
return
}
e1.stopPropagation() e1.stopPropagation()
e1.preventDefault() e1.preventDefault()
let idx = boxIndex.value ?? 0 let idx = boxIndex.value ?? 0
...@@ -486,6 +487,23 @@ function keyDown(e: KeyboardEvent) { ...@@ -486,6 +487,23 @@ function keyDown(e: KeyboardEvent) {
if (idx < 1 || idx > len) return if (idx < 1 || idx > len) return
boxIndex.value = idx boxIndex.value = idx
} }
watch(
visible,
(v) => {
if (v) {
window.addEventListener('keydown', keyDown)
} else {
window.removeEventListener('keydown', keyDown)
}
},
{ immediate: true },
)
onUnmounted(() => {
window.removeEventListener('keydown', keyDown)
})
const testingInputRef = ref<HTMLInputElement | null>(null) const testingInputRef = ref<HTMLInputElement | null>(null)
async function inputActive() { async function inputActive() {
await nextTick() await nextTick()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment