This commit is contained in:
yin 2026-07-24 18:17:35 +08:00
parent ae76229068
commit cd205c4853
11 changed files with 282 additions and 192 deletions

Binary file not shown.

View File

@ -50,6 +50,7 @@ export type ExpressInterfaceCreateParams = {
shop_id?: number
sys_express_code?: string
is_system_express_code?: number
is_enabled?: number
is_hide_goods?: number
sender_name?: string
sender_tel?: string
@ -92,6 +93,7 @@ export function expressInterfaceCreate(data: ExpressInterfaceCreateParams) {
export type ExpressInterfaceUpdateParams = {
id: number
shop_id?: number
is_enabled?: number
/** 发件人详细地址,使用 index.getShopExpressList 返回的 detail 字段值 */
address?: string
}

View File

@ -56,6 +56,7 @@ export function shopsEdit(data: {
id: number
platform_code?: string
custom_name?: string
shop_name?: string
}) {
return request({
url: '/system',

View File

@ -3,6 +3,9 @@ import { scanWorkflowField } from '@/views/order/orderManagement/config/order-co
/** ScanBox 基础信息分组(对齐收货/待处理订单排版) */
export const ENTRY_SCAN_BASIC_INFO_GROUP = '基础信息'
/** ScanBox 时间分组 */
export const ENTRY_SCAN_TIME_GROUP = '时间'
/** 为入库 ScanBox 基础信息字段附加分组标签 */
export type EntryScanFieldConfig = Record<string, any> & {
group: string
@ -16,6 +19,10 @@ export function entryScanBasicField(field: Record<string, any>): EntryScanFieldC
return { ...field, group: ENTRY_SCAN_BASIC_INFO_GROUP } as EntryScanFieldConfig
}
export function entryScanTimeField(field: Record<string, any>): EntryScanFieldConfig {
return { ...field, group: ENTRY_SCAN_TIME_GROUP } as EntryScanFieldConfig
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
export const entryScanBoxConfig = {
width: '250px',
@ -81,6 +88,12 @@ export function translateEntryField(fieldValue: string, value: unknown): string
}
export const availableFields: EntryScanFieldConfig[] = [
entryScanBasicField({
label: '入库单号',
value: 'entry_order_code',
type: 'text',
placeholder: '请输入入库单号',
}),
entryScanBasicField({
label: '货主',
value: 'store_id',
@ -149,11 +162,6 @@ export const availableFields: EntryScanFieldConfig[] = [
value: 'operator_id',
type: 'text'
}),
entryScanBasicField({
label: '创建时间',
value: 'order_create_time',
type: 'datetimerange'
}),
// 流程/状态(每项独立分组,对齐收货/待处理订单 scanWorkflowField 排版)
scanWorkflowField({
label: '状态',
@ -182,6 +190,29 @@ export const availableFields: EntryScanFieldConfig[] = [
{ label: '未绑定', value: false },
]
}) as EntryScanFieldConfig,
// ── 时间 ──
entryScanTimeField({
label: '创建时间',
value: 'order_create_time',
type: 'datetimerange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
entryScanTimeField({
label: '预计开始时间',
value: 'expect_start_time',
type: 'datetimerange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
entryScanTimeField({
label: '预计结束时间',
value: 'expect_end_time',
type: 'datetimerange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
]
export const entryColums = [

View File

@ -17,38 +17,13 @@
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-dropdown
trigger="click"
@command="handleExportCommand"
>
<el-button
size="small"
type="primary"
plain
:loading="exportLoading"
>
导出<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="selected" :disabled="!hasSelection">
导出选中
</el-dropdown-item>
<el-dropdown-item command="all" :divided="true">
导出全部
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
</div>
<div class="toolbar-right">
<WarehouseSelect
v-model="selectedWarehouseId"
@change="handleWarehouseChange"
<order-toolbar-button-group
:buttons="toolbarButtons"
:resolve-disabled="resolveButtonDisabled"
:resolve-loading="resolveButtonLoading"
:resolve-label="resolveButtonLabel"
:layout-key="toolbarLayoutKey"
@action="handleToolbarButtonClick"
/>
</div>
</div>
@ -201,10 +176,12 @@
import { ref, reactive, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { ArrowDown } from '@element-plus/icons-vue'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import WarehouseSelect from '@/components/WarehouseSelect.vue'
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
import * as indexApi from '@/api/index/index'
import * as entryApi from '@/api/storage.entry/entry'
@ -222,7 +199,6 @@ import entrydetail from '@/views/storage/entry/component/entrydetail.vue'
import log from '@/views/storage/entry/component/log.vue'
import DirectInboundLogs from '@/views/storage/entry/component/DirectInboundLogs.vue'
import EntryBindingRelations from '@/views/storage/entry/component/EntryBindingRelations.vue'
import WarehouseSelect from '@/components/WarehouseSelect.vue'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
@ -260,6 +236,86 @@ function openColumnConfigPanel() {
upperTable.value?.openColumnConfig?.()
}
// ─── 工具栏按钮配置 ────────────────────────────────────────────────────────
const toolbarButtons = computed<ToolbarButtonConfig[]>(() => [
{
key: 'refresh',
label: '刷新',
type: 'primary',
size: 'small',
action: 'handleRefresh'
},
{
key: 'export',
label: '导出',
size: 'small',
plain: true,
loadingKey: 'exportLoading',
action: 'handleExportAll',
buttonType: 'dropdown',
dropdownOptions: [
{ label: '导出选中', action: 'handleExportSelected' },
{ label: '导出全部', action: 'handleExportAll', divided: true }
]
},
{
key: 'columnConfig',
label: '字段设置',
size: 'small',
action: 'openColumnConfigPanel'
},
{
key: 'toggleDetail',
label: '显示详情',
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'
}
])
const buttonLoadingMap = computed(() => ({
exportLoading: exportLoading.value
}))
const buttonLabelMap = computed(() => ({
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
}))
const toolbarLayoutKey = computed(() =>
JSON.stringify({
loading: buttonLoadingMap.value,
labels: buttonLabelMap.value
})
)
function resolveButtonLoading(loadingKey?: string) {
if (!loadingKey) return false
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
}
function resolveButtonDisabled(_disabledKey?: string) {
return false
}
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
if (!dynamicLabelKey) return defaultLabel
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
}
const toolbarActionMap: Record<string, () => void> = {
handleRefresh: () => loadData(),
handleExportAll: () => handleExportAll(),
handleExportSelected: () => handleExportSelected(),
openColumnConfigPanel: () => openColumnConfigPanel(),
toggleDetailVisible: () => toggleDetailVisible()
}
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
const handler = toolbarActionMap[action]
if (!handler) return
handler()
}
const route = useRoute()
const initialConditions = ref<any>(null)
@ -267,10 +323,23 @@ const currentCondition = ref<any>(null)
const currentConditionRaw = ref<any>(null)
const presetTree = ref<any[]>([])
// 货主侧:移除货主筛选项(由登录身份决定)
const availableFieldsRef = reactive(
JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
)
// 货主侧:移除货主筛选项,添加仓库筛选(插入到第一个基础信息分类中)
const availableFieldsRef = reactive((() => {
const fields = JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
// 在入库单号之后插入全部仓库
const idx = fields.findIndex((f: any) => f.value === 'entry_order_code')
if (idx !== -1) {
fields.splice(idx + 1, 0, {
label: '全部仓库',
value: 'warehouse_id',
type: 'custom',
component: WarehouseSelect,
props: { width: '100%' },
group: '基础信息'
})
}
return fields
})())
const activeTab = ref('details')
@ -307,9 +376,6 @@ const columns = ref(entryStoreColums)
const selectedEntryId = ref<number | string | null>(null)
const currentSort = reactive({ prop: '', order: '' })
// 仓库选择(v-model 绑定 WarehouseSelect 组件)
const selectedWarehouseId = ref<string | number | null>(null)
const componentMap: Record<string, any> = {
details: entrydetail,
bindingRelations: EntryBindingRelations,
@ -482,11 +548,6 @@ async function loadData() {
try {
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
// 仓库筛选:如果选择了仓库,加入 where 条件
if (selectedWarehouseId.value) {
where.warehouse_id = { operator: 'eq', value: selectedWarehouseId.value, type: 'number' }
}
const params: StorageEntryListParams = {
pagination: {
page: pagination.currentPage,
@ -568,11 +629,6 @@ function handleConditionReset() {
loadData()
}
function handleWarehouseChange() {
pagination.currentPage = 1
loadData()
}
function handleRowClick(row: any) {
selectedEntryId.value = row?.id || null
}
@ -590,9 +646,6 @@ function handlePageSizeChange(size: number) {
function buildExportPayload() {
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
if (selectedWarehouseId.value) {
where.warehouse_id = { operator: 'eq', value: selectedWarehouseId.value, type: 'number' }
}
const payload: any = { where }
if (currentSort.prop) {
payload.sort = {
@ -610,9 +663,6 @@ function buildExportSelectedPayload() {
id: { operator: 'in', value: ids }
}
}
if (selectedWarehouseId.value) {
payload.where.warehouse_id = { operator: 'eq', value: selectedWarehouseId.value, type: 'number' }
}
return payload
}
@ -628,13 +678,6 @@ async function handleExportSelected() {
await submitExportTask(buildExportSelectedPayload())
}
function handleExportCommand(command: string) {
if (command === 'selected') {
handleExportSelected()
} else if (command === 'all') {
handleExportAll()
}
}
</script>
<style scoped lang="scss">

View File

@ -1,4 +1,35 @@
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { scanWorkflowField } from '@/views/order/orderManagement/config/order-common-config'
/** ScanBox 基础信息分组(对齐收货/待处理订单排版) */
export const PRODUCTFLOW_SCAN_BASIC_INFO_GROUP = '基础信息'
/** ScanBox 流程状态分组 */
export const PRODUCTFLOW_SCAN_WORKFLOW_GROUP = '流程状态'
/** ScanBox 时间分组 */
export const PRODUCTFLOW_SCAN_TIME_GROUP = '时间'
/** 为商品流水 ScanBox 字段附加分组标签 */
export type ProductflowScanFieldConfig = Record<string, any> & {
group: string
value: string
label: string
type?: string
options?: Array<{ label: string; value: unknown }>
}
export function productflowScanBasicField(field: Record<string, any>): ProductflowScanFieldConfig {
return { ...field, group: PRODUCTFLOW_SCAN_BASIC_INFO_GROUP } as ProductflowScanFieldConfig
}
export function productflowScanWorkflowField(field: Record<string, any>): ProductflowScanFieldConfig {
return { ...field, group: PRODUCTFLOW_SCAN_WORKFLOW_GROUP } as ProductflowScanFieldConfig
}
export function productflowScanTimeField(field: Record<string, any>): ProductflowScanFieldConfig {
return { ...field, group: PRODUCTFLOW_SCAN_TIME_GROUP } as ProductflowScanFieldConfig
}
export function formatDateTime(dateStr: string | null | undefined): string {
if (!dateStr) return '—'
@ -65,124 +96,51 @@ export const productflowToolbarButtons: ToolbarButtonConfig[] = [
}
]
export const availableFields = [
{
export const availableFields: ProductflowScanFieldConfig[] = [
// ── 基础信息 ──
productflowScanBasicField({
label: '商品ID',
value: 'stock_id',
type: 'number',
placeholder: '请输入商品ID',
operators: ['eq'],
defaultOperator: 'eq'
},
{
}),
productflowScanBasicField({
label: '订单号',
value: 'order_no',
type: 'text',
placeholder: '请输入订单号',
operators: ['contains', 'eq'],
defaultOperator: 'eq'
},
{
}),
productflowScanBasicField({
label: '批次号',
value: 'batch_no',
type: 'text',
placeholder: '请输入批次号',
operators: ['contains', 'eq'],
defaultOperator: 'eq'
},
{
}),
productflowScanBasicField({
label: '操作人',
value: 'operator_name',
type: 'text',
placeholder: '请输入操作人',
operators: ['eq', 'contains'],
defaultOperator: 'eq'
},
{
}),
productflowScanBasicField({
label: '货主',
value: 'store_id',
type: 'select',
multiple: true,
filterable: true,
options: [] as Array<{ label: string; value: unknown }>
},
{
label: '流水时间',
value: 'created_at',
type: 'date',
operators: ['between', 'eq', 'gt', 'lt'],
defaultOperator: 'between'
},
{
label: '流水类型',
value: 'transaction_type',
type: 'select',
options: Object.entries(transactionTypeConfig).map(([value, cfg]) => ({
label: cfg.text,
value
}))
},
{
label: '订单类型',
value: 'order_type',
type: 'select',
options: Object.entries(orderTypeConfig).map(([value, label]) => ({
label,
value
}))
}
]
}),
/** 货主侧筛选字段:仓库筛选替代货主筛选 */
export const storeAvailableFields = [
{
label: '商品ID',
value: 'stock_id',
type: 'number',
placeholder: '请输入商品ID',
operators: ['eq'],
defaultOperator: 'eq'
},
{
label: '订单号',
value: 'order_no',
type: 'text',
placeholder: '请输入订单号',
operators: ['contains', 'eq'],
defaultOperator: 'eq'
},
{
label: '批次号',
value: 'batch_no',
type: 'text',
placeholder: '请输入批次号',
operators: ['contains', 'eq'],
defaultOperator: 'eq'
},
{
label: '操作人',
value: 'operator_name',
type: 'text',
placeholder: '请输入操作人',
operators: ['eq', 'contains'],
defaultOperator: 'eq'
},
{
label: '仓库',
value: 'warehouse_id',
type: 'select',
multiple: true,
filterable: true,
options: [] as Array<{ label: string; value: unknown }>
},
{
label: '流水时间',
value: 'created_at',
type: 'date',
operators: ['between', 'eq', 'gt', 'lt'],
defaultOperator: 'between'
},
{
// ── 流程状态 ──
productflowScanWorkflowField({
label: '流水类型',
value: 'transaction_type',
type: 'select',
@ -190,8 +148,8 @@ export const storeAvailableFields = [
label: cfg.text,
value
}))
},
{
}) as ProductflowScanFieldConfig,
productflowScanWorkflowField({
label: '订单类型',
value: 'order_type',
type: 'select',
@ -199,7 +157,16 @@ export const storeAvailableFields = [
label,
value
}))
}
}) as ProductflowScanFieldConfig,
// ── 时间 ──
productflowScanTimeField({
label: '流水时间',
value: 'created_at',
type: 'date',
operators: ['between', 'eq', 'gt', 'lt'],
defaultOperator: 'between'
}),
]
export function getTransactionTypeLabel(type: string): string {

View File

@ -25,12 +25,6 @@
@action="handleToolbarButtonClick"
/>
</div>
<div class="toolbar-right">
<WarehouseSelect
v-model="selectedWarehouseId"
@change="handleWarehouseChange"
/>
</div>
</div>
<div class="split-stack" ref="splitStackRef">
@ -201,9 +195,23 @@ import {
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(
JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
)
// 货主侧:移除货主筛选项,添加仓库筛选(插入到第一个基础信息分类中)
const availableFieldsRef = reactive((() => {
const fields = JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
// 在商品ID之后插入全部仓库
const idx = fields.findIndex((f: any) => f.value === 'stock_id')
if (idx !== -1) {
fields.splice(idx + 1, 0, {
label: '全部仓库',
value: 'warehouse_id',
type: 'custom',
component: WarehouseSelect,
props: { width: '100%' },
group: '基础信息'
})
}
return fields
})())
const settingsStore = useSettingsStore()
const userStore = useUserStore()
@ -251,7 +259,6 @@ const tableSize = ref('small')
const columns = ref(defaultColumns)
const currentCondition = ref<any>(null)
const currentSort = reactive({ prop: 'created_at', order: 'DESC' })
const selectedWarehouseId = ref<string | number | null>(null)
const selectedIds = ref<number[]>([])
const toolbarButtons = productflowToolbarButtons
@ -422,10 +429,6 @@ async function loadList() {
const start = Date.now()
try {
const where: Record<string, any> = { ...(currentCondition.value || {}) }
// 顶部仓库选择器选中的仓库会覆盖/补充 where 条件
if (selectedWarehouseId.value !== null && selectedWarehouseId.value !== '') {
where.warehouse_id = Number(selectedWarehouseId.value)
}
const res: any = await stockTransactionStoreList({
where: Object.keys(where).length > 0 ? where : undefined,
@ -517,11 +520,6 @@ function handleSortChange(payload: { prop?: string; order?: string }) {
loadList()
}
function handleWarehouseChange() {
pagination.currentPage = 1
loadList()
}
// ─── 导出 ────────────────────────────────────────────────────────────────────
function buildExportPayload(mode: 'all' | 'selected'): Record<string, unknown> {
@ -531,9 +529,6 @@ function buildExportPayload(mode: 'all' | 'selected'): Record<string, unknown> {
where.ids = selectedIds.value
} else if (mode === 'all') {
Object.assign(where, currentCondition.value || {})
if (selectedWarehouseId.value !== null && selectedWarehouseId.value !== '') {
where.warehouse_id = Number(selectedWarehouseId.value)
}
}
return {
store_id: storeId ? Number(storeId) : undefined,

View File

@ -30,6 +30,7 @@ export const expressInterfaceListFieldOrder = [
'product_type',
'brandno',
'is_hide_goods',
'is_enabled',
'weight',
'weight_type',
'viewer',
@ -74,6 +75,7 @@ export const expressInterfaceFieldLabels: Record<string, string> = {
product_type: '产品编码',
brandno: '品牌编码',
is_hide_goods: '是否隐藏商品',
is_enabled: '是否启用',
is_system_express_code: '是否系统快递编码',
shop_name: '店铺名称',
warehouse_id: '仓库ID',
@ -141,6 +143,18 @@ export const expressInterfaceColumns: ExpressInterfaceColumn[] = [
align: 'right',
formatter: (row) => formatExpressInterfaceNumber(row.weight)
},
{
prop: 'is_enabled',
label: '状态',
width: 80,
align: 'center',
formatter: (row) => {
const enabled = row.is_enabled === 1 || row.is_enabled === '1'
return enabled
? '<span style="color:#67c23a;background:#f0f9eb;border:1px solid #c2e7b0;border-radius:4px;padding:2px 8px;font-size:12px;">启用</span>'
: '<span style="color:#f56c6c;background:#fef0f0;border:1px solid #fbc4c4;border-radius:4px;padding:2px 8px;font-size:12px;">停用</span>'
}
},
{ prop: 'actions', label: '操作', width: 140, align: 'center', fixed: 'right' }
]
@ -280,6 +294,16 @@ export const expressInterfaceScanFields = [
operators: ['eq', 'contains', 'like'],
defaultOperator: 'contains'
},
{
value: 'is_enabled',
label: '是否启用',
type: 'select',
clearable: true,
options: [
{ label: '启用', value: 1 },
{ label: '停用', value: 0 }
]
},
]
@ -487,6 +511,7 @@ export const defaultExpressInterfaceForm = {
product_type: '',
brandno: '',
is_hide_goods: 0,
is_enabled: 1,
address: '',
town_name: '',
ext_data: undefined as Record<string, any> | undefined,
@ -572,6 +597,7 @@ export function applyExpressInterfaceRowToForm(
product_type: toFormString(row.product_type),
brandno: toFormString(row.brandno),
is_hide_goods: toFormOptionalNumber(row.is_hide_goods) ?? 0,
is_enabled: toFormOptionalNumber(row.is_enabled) ?? 1,
address: toFormString(row.address),
town_name: toFormString(row.town_name),
province_name: toFormString(row.province_name),
@ -586,7 +612,7 @@ export function formatExpressInterfaceFormDisplayValue(
key: string,
val: unknown
): string {
if (key === 'is_share' || key === 'ispickup' || key === 'is_hide_goods') {
if (key === 'is_share' || key === 'ispickup' || key === 'is_hide_goods' || key === 'is_enabled') {
if (val === 1 || val === true) return '是'
if (val === 0 || val === false) return '否'
return '--'
@ -697,6 +723,7 @@ export function buildExpressInterfaceCreatePayload(
const optionalNumbers = [
'shop_id',
'is_system_express_code',
'is_enabled',
'is_hide_goods',
'weight',
'weight_type',

View File

@ -447,7 +447,18 @@
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否启用">
<el-switch
v-model="formData.is_enabled"
:active-value="1"
:inactive-value="0"
active-text="是"
inactive-text="否"
/>
</el-form-item>
</el-col>
</el-row>
</div>

View File

@ -17,9 +17,10 @@
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" :loading="loading" @click="loadList">刷新</el-button>
<el-tag size="small" type="info">共 {{ pagination.total }} 条</el-tag>
<el-button type="success" size="small" @click="openCreate">新增店铺</el-button>
<!-- <el-tag size="small" type="info">共 {{ pagination.total }} 条</el-tag> -->
</div>
<el-button type="success" size="small" @click="openCreate">新增店铺</el-button>
</div>
<div class="upper-wrapper">
@ -115,6 +116,9 @@
<el-form-item label="自定义名称" prop="custom_name">
<el-input v-model="formData.custom_name" placeholder="最大 100 字符" maxlength="100" show-word-limit />
</el-form-item>
<el-form-item label="店铺名称" prop="shop_name">
<el-input v-model="formData.shop_name" placeholder="最大 100 字符" maxlength="100" show-word-limit />
</el-form-item>
<el-form-item v-if="dialogMode === 'create'">
<el-text type="info" size="small">
店铺名称由服务端生成待授权占位名,完成平台授权后将自动同步真实店铺名。
@ -237,7 +241,8 @@ const formRef = ref<FormInstance>()
const formData = reactive({
id: undefined as number | undefined,
platform_code: '',
custom_name: ''
custom_name: '',
shop_name: ''
})
const rules: FormRules = {
@ -245,6 +250,9 @@ const rules: FormRules = {
custom_name: [
{ required: true, message: '请输入自定义名称', trigger: 'blur' },
{ max: 100, message: '最多 100 个字符', trigger: 'blur' }
],
shop_name: [
{ max: 100, message: '最多 100 个字符', trigger: 'blur' }
]
}
@ -446,6 +454,7 @@ function resetForm() {
formData.id = undefined
formData.platform_code = ''
formData.custom_name = ''
formData.shop_name = ''
formRef.value?.clearValidate()
}
@ -462,6 +471,7 @@ function openEdit(row: ShopRecord) {
formData.id = row.id
formData.platform_code = row.platform_code || ''
formData.custom_name = row.custom_name || ''
formData.shop_name = row.shop_name || ''
formRef.value?.clearValidate()
}
@ -491,17 +501,20 @@ async function submitForm() {
if (!formData.id) return
const platformCode = formData.platform_code.trim()
const customName = formData.custom_name.trim()
if (!platformCode && !customName) {
ElMessage.warning('请至少修改平台或自定义名称')
const shopName = formData.shop_name.trim()
if (!platformCode && !customName && !shopName) {
ElMessage.warning('请至少修改平台、自定义名称或店铺名称')
return
}
const payload: {
id: number
platform_code?: string
custom_name?: string
shop_name?: string
} = { id: formData.id }
if (platformCode) payload.platform_code = platformCode
if (customName) payload.custom_name = customName
if (shopName) payload.shop_name = shopName
const res: any = await shopsEdit(payload)
if (!isSuccess(res)) {

View File

@ -27,8 +27,8 @@ export const shopScanFields = [
label: '关键词',
type: 'text',
placeholder: '自定义名称/店铺名称',
operators: ['contains'],
defaultOperator: 'contains'
operators: ['contains', 'eq'],
defaultOperator: 'eq'
},
{
value: 'platform_code',
@ -62,7 +62,7 @@ export const shopScanFields = [
type: 'text',
placeholder: '请输入自定义名称',
operators: ['eq', 'contains', 'like'],
defaultOperator: 'contains'
defaultOperator: 'eq'
},
{
value: 'shop_name',
@ -70,7 +70,7 @@ export const shopScanFields = [
type: 'text',
placeholder: '请输入店铺名称',
operators: ['eq', 'contains', 'like'],
defaultOperator: 'contains'
defaultOperator: 'eq'
}
]