fix: 打包报错修复与部署脚本 Windows 跨平台化
- 修复 TS1261 import 大小写(33 处)、TS2561 report_code→report_id、TS2339 类型标注 - deploy/rollback 支持 Windows: npm.cmd EINVAL(改用 node 直跑 npm-cli.js)、sshKey 绝对路径 - map.ts 兼容后端菜单老路径,强制指向 basicManagement newview(含投递计划/报表定义) - report.deliveryPlan.copy 返回结构对齐后端 created/skipped,修正前端误报复制成功
This commit is contained in:
parent
08b3dc4739
commit
81b663de63
@ -30,7 +30,7 @@ const BASE_PATH = config.basePath; // 项目在服务器上的存放路径
|
||||
const KEEP_RELEASES = config.keepReleases; // 服务器上保留的最近版本数
|
||||
const SITE_HOST = config.siteHost; // 发版后健康检查域名
|
||||
const LOCAL_DIST = path.resolve('dist');
|
||||
const SSH_KEY = path.join(os.homedir(), '.ssh', config.sshKey);
|
||||
const SSH_KEY = path.isAbsolute(config.sshKey) ? config.sshKey : path.join(os.homedir(), '.ssh', config.sshKey);
|
||||
const SSH_OPTS = ['-i', SSH_KEY, '-o', 'StrictHostKeyChecking=no'];
|
||||
const HOST = `${USER}@${IP}`;
|
||||
const TARBALL = 'dist.tar.gz';
|
||||
@ -47,7 +47,20 @@ function timestamp() {
|
||||
}
|
||||
|
||||
function run(cmd, args, opts = {}) {
|
||||
const res = spawnSync(cmd, args, { stdio: 'inherit', ...opts });
|
||||
// Windows 下 .cmd/.bat(如 npm.cmd)不能直接用 spawnSync 执行(报 EINVAL):
|
||||
// 优先用 node 直接运行 npm-cli.js(无 shell、无 DEP0190 警告),否则回退到 shell: true
|
||||
const isWinCmd = process.platform === 'win32' && /\.(cmd|bat)$/i.test(cmd)
|
||||
let res
|
||||
if (isWinCmd) {
|
||||
const npmCli = process.env.npm_execpath
|
||||
if (npmCli && /npm-cli\.js$/i.test(npmCli)) {
|
||||
res = spawnSync(process.execPath, [npmCli, ...args], { stdio: 'inherit', ...opts })
|
||||
} else {
|
||||
res = spawnSync(cmd, args, { stdio: 'inherit', shell: true, ...opts })
|
||||
}
|
||||
} else {
|
||||
res = spawnSync(cmd, args, { stdio: 'inherit', ...opts })
|
||||
}
|
||||
if (res.error) {
|
||||
console.error(`❌ 无法执行命令 ${cmd}: ${res.error.message}`);
|
||||
if (res.error.code === 'ENOENT') {
|
||||
|
||||
@ -27,7 +27,7 @@ const config = JSON.parse(readFileSync(CONFIG_PATH, 'utf8'));
|
||||
const USER = config.user;
|
||||
const IP = config.ip; // 服务器 IP
|
||||
const BASE_PATH = config.basePath; // 项目在服务器上的存放路径
|
||||
const SSH_KEY = path.join(os.homedir(), '.ssh', config.sshKey);
|
||||
const SSH_KEY = path.isAbsolute(config.sshKey) ? config.sshKey : path.join(os.homedir(), '.ssh', config.sshKey);
|
||||
const SSH_OPTS = ['-i', SSH_KEY, '-o', 'StrictHostKeyChecking=no'];
|
||||
const HOST = `${USER}@${IP}`;
|
||||
|
||||
|
||||
@ -210,10 +210,10 @@ export interface DeliveryPlanCopyParams {
|
||||
}
|
||||
|
||||
export interface DeliveryPlanCopyResult {
|
||||
/** 成功复制的计划数 */
|
||||
copied: number
|
||||
/** 复制后的计划ID列表 */
|
||||
plan_ids?: number[]
|
||||
/** 成功复制的计划列表(实际后端返回结构;每项含目标货主 store_id 与可选新计划 plan_id) */
|
||||
created?: Array<{ store_id?: number; plan_id?: number }>
|
||||
/** 跳过的货主列表(含原因,如「货主不存在或状态异常」) */
|
||||
skipped?: Array<{ store_id: number; reason?: string }>
|
||||
code?: number
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ import LangSelect from '@/components/LangSelect/index.vue'
|
||||
import TopMenu from './TopMenu.vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
import { afterSaleWorkCount, afterSaleWorkList } from '@/api/aftersale/index'
|
||||
import { afterSaleWorkCount, afterSaleWorkList } from '@/api/afterSale/index'
|
||||
|
||||
const { isFullscreen, toggle } = useFullscreen()
|
||||
|
||||
|
||||
@ -48,6 +48,9 @@ export const componentMap: Record<string, any> = {
|
||||
'order/weighing': () => import('@/views/order/orderWeighing/index.vue'),
|
||||
'role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||
'basicManagement':() => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
||||
/** 与后端菜单 component 字段兼容:部分环境为老路径 system/setting/basicManagement/index → 强制指向 newview(含投递计划/报表定义) */
|
||||
'system/setting/basicManagement/index': () => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
||||
'system/setting/basicManagement': () => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
||||
'system/setting/role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||
// 'role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||
// 'system/setting/role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@ import {
|
||||
type AfterSale,
|
||||
type AfterSaleStep,
|
||||
type AfterSaleRelated,
|
||||
} from '@/api/aftersale/index'
|
||||
} from '@/api/afterSale/index'
|
||||
import { orderQueryOrderLogList, type OrderLogListItem } from '@/api/order.index/orderindex'
|
||||
import { getCOSUploadConfig, uploadSuccessNotify } from '@/api/index/index'
|
||||
import {
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { afterSaleRegisterClaim } from '@/api/aftersale/index'
|
||||
import { afterSaleRegisterClaim } from '@/api/afterSale/index'
|
||||
import { CLAIM_STATUS_MAP } from '@/views/afterSale/list/afterSale-config'
|
||||
|
||||
const props = defineProps<{ afterSaleId: number; claimNeeded?: 0|1; claimAmount?: number|null; claimStatus?: string|null; carrierClaimNeeded?: 0|1; carrierClaimAmount?: number|null; carrierClaimStatus?: string|null }>()
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { afterSaleHandleWorkOrder } from '@/api/aftersale/index'
|
||||
import { afterSaleHandleWorkOrder } from '@/api/afterSale/index'
|
||||
import { getCOSUploadConfig, uploadSuccessNotify } from '@/api/index/index'
|
||||
|
||||
const props = defineProps<{ afterSaleId: number; currentStatus?: string }>()
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { afterSaleTransfer } from '@/api/aftersale/index'
|
||||
import { afterSaleTransfer } from '@/api/afterSale/index'
|
||||
|
||||
const props = defineProps<{ afterSaleId: number }>()
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
@ -353,7 +353,7 @@ import {
|
||||
type AfterSaleHandleWorkOrderParams,
|
||||
type AfterSaleTransferParams,
|
||||
type AfterSaleRegisterClaimParams,
|
||||
} from '@/api/aftersale/index'
|
||||
} from '@/api/afterSale/index'
|
||||
import { getCOSUploadConfig, uploadSuccessNotify } from '@/api/index/index'
|
||||
import {
|
||||
AFTER_SALE_TYPE_MAP,
|
||||
|
||||
@ -233,7 +233,7 @@ import {
|
||||
type AfterSaleCreateParams,
|
||||
type AfterSaleUpdateParams,
|
||||
type AfterSaleTransferParams,
|
||||
} from '@/api/aftersale/index'
|
||||
} from '@/api/afterSale/index'
|
||||
import {
|
||||
getAfterSaleAvailableFields,
|
||||
afterSaleAvailableFields,
|
||||
|
||||
@ -177,7 +177,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { returnReceivedList, returnReceivedCreate, returnReceivedDetail, returnReceivedDelete } from '@/api/returnreceived'
|
||||
import { returnReceivedList, returnReceivedCreate, returnReceivedDetail, returnReceivedDelete } from '@/api/returnReceived'
|
||||
import { loadStores } from '@/api/index/index'
|
||||
import { extractStoreListFromResponse, fillStoreScanFieldOptions } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
|
||||
@ -152,11 +152,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { afterSaleCreate, type AfterSaleCreateParams } from '@/api/aftersale/index'
|
||||
import { afterSaleCreate, type AfterSaleCreateParams } from '@/api/afterSale/index'
|
||||
import { AFTER_SALE_TYPE_MAP } from '@/views/afterSale/list/afterSale-config'
|
||||
import { loadStores } from '@/api/index/index'
|
||||
import { extractStoreListFromResponse, mapStoreListToSelectOptions } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { orderDeliveryOrderQuickSearch } from '@/api/order.deliveryorder/orderdeliveryOrder'
|
||||
import { orderDeliveryOrderQuickSearch } from '@/api/order.deliveryOrder/orderdeliveryOrder'
|
||||
import { getEntryList } from '@/api/storage.entry/entry'
|
||||
import { stockoutList } from '@/api/storage.stockout/stockout'
|
||||
import { getReceivingList } from '@/api/storage_receiving/receiving'
|
||||
|
||||
@ -218,7 +218,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { afterSaleWorkList, afterSaleBatchSetPendingFeedback, afterSaleBatchClose, type AfterSaleListParams } from '@/api/aftersale/index'
|
||||
import { afterSaleWorkList, afterSaleBatchSetPendingFeedback, afterSaleBatchClose, type AfterSaleListParams } from '@/api/afterSale/index'
|
||||
import {
|
||||
getAfterSaleAvailableFields,
|
||||
afterSaleAvailableFields,
|
||||
|
||||
@ -454,9 +454,9 @@ import {
|
||||
orderPendingOrder,
|
||||
orderPendingOrderParseAddress,
|
||||
type PendingOrderParseAddressData
|
||||
} from '@/api/order.pendingorder/orderpendingOrder'
|
||||
} from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import { parseOrderListResponse } from '../utils/order-index-helpers'
|
||||
import type { PendingOrderCreateOrderParams } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import type { PendingOrderCreateOrderParams } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import {
|
||||
buildCityOptions,
|
||||
buildDistrictOptions,
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import {
|
||||
formatOrderTime,
|
||||
orderItemCompactColumns,
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import {
|
||||
ORDER_DETAIL_TIME_FIELDS,
|
||||
COMMON_TRANSLATIONS,
|
||||
|
||||
@ -241,8 +241,8 @@ import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { orderDeliveryOrder } from '@/api/order.deliveryorder/orderdeliveryOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderDeliveryOrder } from '@/api/order.deliveryOrder/orderdeliveryOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
|
||||
import {
|
||||
deliveryAvailableFields,
|
||||
|
||||
@ -381,7 +381,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
|
||||
@ -191,7 +191,7 @@ import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { orderOutboundOrder } from '@/api/order.outboundorder/orderoutboundOrder'
|
||||
import { orderOutboundOrder } from '@/api/order.outboundOrder/orderoutboundOrder'
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
outboundAvailableFields,
|
||||
|
||||
@ -384,7 +384,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import TaskProgressDialog from '@/components/TaskProgressDialog.vue'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { confirmIntercept } from '@/api/order.recheckorder/recheckOrder'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
@ -184,8 +184,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { orderReviewOrder } from '@/api/order.revieworder/orderreviewOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderReviewOrder } from '@/api/order.reviewOrder/orderreviewOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
|
||||
import {
|
||||
reviewAvailableFields,
|
||||
|
||||
@ -112,7 +112,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { orderPendingOrderList } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrderList } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import { isOrderIndexApiSuccess } from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
import ExpressWeighingForm, { type ExpressWeighingFormResult } from './ExpressWeighingForm.vue'
|
||||
|
||||
|
||||
@ -978,7 +978,7 @@ import type {
|
||||
} from '@/api/order.wave/orderwave'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { getWavePlatformPrintData } from '@/api/order.print/orderprint'
|
||||
import { orderPendingOrderList, orderPendingOrderDetail } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrderList, orderPendingOrderDetail } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||
import pcasCodeData from 'china-division/dist/pcas-code.json'
|
||||
|
||||
|
||||
@ -557,7 +557,7 @@ import type {
|
||||
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { getWavePlatformPrintData } from '@/api/order.print/orderprint'
|
||||
import { orderPendingOrderList, orderPendingOrderDetail } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrderList, orderPendingOrderDetail } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 与路由 path 组合,隔离 ScanBox 筛选缓存(波次各标签页须各不相同) */
|
||||
|
||||
@ -178,7 +178,7 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import { orderWaveBatchRemoveOrders } from '@/api/order.wave/orderwave'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import AllocateExpressForm from '@/views/order/orderManagement/form/AllocateExpressForm.vue'
|
||||
|
||||
@ -16,7 +16,7 @@ import {
|
||||
} from '@/views/order/orderManagement/config/order-common-config'
|
||||
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||
import type { WaveStrategyCreateParams, WaveStrategyUpdateParams } from '@/api/order.wave/orderwave'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
import {
|
||||
isOrderIndexApiSuccess,
|
||||
normalizeOrderDetailItems,
|
||||
|
||||
@ -22,7 +22,7 @@ import DetailPanel from './components/DetailPanel.vue'
|
||||
import LogPanel from './components/LogPanel.vue'
|
||||
import DeliveryPlanFormDialog from '../pages/DeliveryPlanFormDialog.vue'
|
||||
import ExportReportDialog from '../pages/ExportReportDialog.vue'
|
||||
import { listDeliveryPlan, listDeliveryLog, meta } from '@/api/report/report'
|
||||
import { listDeliveryPlan, listDeliveryLog, listReportDefinition, meta } from '@/api/report/report'
|
||||
import { loadStores } from '@/api/index/index'
|
||||
|
||||
// ============================================================
|
||||
@ -53,6 +53,33 @@ export const COMPONENT_REGISTRY: Record<string, Component> = {
|
||||
/** 货主下拉选项(value 为货主ID),ScanBox 与表单共用 */
|
||||
export const storeOptions = ref<{ value: number; label: string }[]>([])
|
||||
|
||||
// ============================================================
|
||||
// 〇-A2、报表定义选项(投递计划下拉关联用,对齐 newview/template-config)
|
||||
// ============================================================
|
||||
/** 可投递的报表定义选项(value=报表定义ID,label=报表名称;仅启用项) */
|
||||
export const reportDefinitionOptions = ref<{ value: number; label: string }[]>([])
|
||||
let reportDefinitionLoading = false
|
||||
|
||||
/** 加载报表定义(force 强制刷新):下拉选项仅取启用项 */
|
||||
export async function loadReportDefinitions(force = false): Promise<{ value: number; label: string }[]> {
|
||||
if (reportDefinitionOptions.value.length && !force) return reportDefinitionOptions.value
|
||||
if (reportDefinitionLoading) return reportDefinitionOptions.value
|
||||
reportDefinitionLoading = true
|
||||
try {
|
||||
const res: any = await listReportDefinition({ pagination: { page: 1, pageSize: 200 } })
|
||||
const list: any[] = res?.data?.list ?? res?.list ?? []
|
||||
reportDefinitionOptions.value = list
|
||||
.filter((d: any) => d && Number(d.id) > 0 && Number(d.is_enabled) === 1)
|
||||
.map((d: any) => ({ value: Number(d.id), label: d.name ? String(d.name) : `报表 #${d.id}` }))
|
||||
} catch (e) {
|
||||
console.error('加载报表定义选项失败', e)
|
||||
reportDefinitionOptions.value = []
|
||||
} finally {
|
||||
reportDefinitionLoading = false
|
||||
}
|
||||
return reportDefinitionOptions.value
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 loadStores / ScanBox 等处的货主项归一化为下拉可用的 { value, label }。
|
||||
* 兼容 { value, label }、{ id, store_remask }、{ store_id, store_name } 等形态。
|
||||
@ -295,14 +322,14 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
||||
slot: null,
|
||||
detailLabel: '货主'
|
||||
},
|
||||
/** 报表编码 */
|
||||
report_code: {
|
||||
key: 'report_code',
|
||||
label: '报表编码',
|
||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||
table: { minWidth: 140, copyAction: 'copy', showOverflowTooltip: true },
|
||||
/** 关联报表(报表定义ID,下拉选择) */
|
||||
report_definition_id: {
|
||||
key: 'report_definition_id',
|
||||
label: '关联报表',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: reportDefinitionOptions as any },
|
||||
table: { minWidth: 140, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '报表编码'
|
||||
detailLabel: '关联报表'
|
||||
},
|
||||
/** 每日投递时间点(HH:mm 数组) */
|
||||
schedule_times: {
|
||||
@ -893,8 +920,8 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
name: 'plan',
|
||||
label: '投递计划',
|
||||
scanBoxCacheKey: 'generalreport-plan',
|
||||
scanBoxFieldKeys: ['store_id', 'report_code', 'enabled'],
|
||||
tableColumnKeys: ['store_id', 'report_code', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark', 'created_at', 'updated_at', 'operation'],
|
||||
scanBoxFieldKeys: ['store_id', 'report_definition_id', 'enabled'],
|
||||
tableColumnKeys: ['store_id', 'name', 'report_definition_id', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark', 'created_at', 'updated_at', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: '报表投递计划',
|
||||
showSelection: false
|
||||
@ -906,7 +933,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
{
|
||||
title: '基础信息',
|
||||
columnCount: 3,
|
||||
fieldKeys: ['store_id', 'report_code', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark']
|
||||
fieldKeys: ['store_id', 'name', 'report_definition_id', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark']
|
||||
},
|
||||
{
|
||||
title: '通知配置',
|
||||
@ -926,8 +953,12 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
return { list: res?.data?.list ?? res?.list ?? [], total: res?.data?.total ?? res?.total ?? 0 }
|
||||
},
|
||||
buildListParams({ pagination, conditions, sort }) {
|
||||
// ScanBox 的关联报表字段名是 report_definition_id,后端 where 参数为 report_id,做一次映射
|
||||
const { report_definition_id, ...rest } = conditions || {}
|
||||
const where = buildWhereConditions(rest)
|
||||
if (report_definition_id) where.report_id = report_definition_id
|
||||
return {
|
||||
where: buildWhereConditions(conditions),
|
||||
where,
|
||||
pagination: { page: pagination.page, pageSize: pagination.pageSize },
|
||||
...(sort?.prop ? { sort: { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' } } : {})
|
||||
}
|
||||
@ -941,8 +972,9 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
type: 'warning',
|
||||
formKey: 'DeliveryPlanFormDialog',
|
||||
paramMap: {
|
||||
name: 'name',
|
||||
store_id: 'store_id',
|
||||
report_code: 'report_code',
|
||||
report_definition_id: 'report_definition_id',
|
||||
schedule_times: 'schedule_times',
|
||||
channel: 'channel',
|
||||
late_grace_minutes: 'late_grace_minutes',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--
|
||||
DeliveryPlanFormDialog — 货主报表投递计划 新增/编辑 表单弹窗
|
||||
对接接口:report.deliveryPlan.save(货主 store_id + 报表 report_code 唯一,存在则更新)
|
||||
对接接口:report.deliveryPlan.save(货主 store_id + 报表定义 report_id 唯一,存在则更新)
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
@ -36,8 +36,24 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="报表编码" prop="report_code">
|
||||
<el-input v-model="form.report_code" placeholder="请输入已启用的报表编码,如 deliveryPlan" />
|
||||
<el-form-item label="计划名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入计划名称(≤100 字符)" maxlength="100" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关联报表" prop="report_definition_id">
|
||||
<el-select
|
||||
v-model="form.report_definition_id"
|
||||
filterable
|
||||
placeholder="请选择关联的报表定义"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in reportOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="投递时间" prop="schedule_times">
|
||||
@ -126,15 +142,17 @@
|
||||
import { reactive, ref, watch, computed, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { saveDeliveryPlan } from '@/api/report/report'
|
||||
import { storeOptions, loadStoreOptions } from '../config/template-config'
|
||||
import { storeOptions, loadStoreOptions, reportDefinitionOptions, loadReportDefinitions } from '../config/template-config'
|
||||
|
||||
defineOptions({ name: 'DeliveryPlanFormDialog' })
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
/** 编辑时由行数据注入的初始值 */
|
||||
name?: string
|
||||
store_id?: number | string
|
||||
report_code?: string
|
||||
/** 关联的报表定义ID(列表行 report_definition_id) */
|
||||
report_definition_id?: number
|
||||
schedule_times?: string[]
|
||||
channel?: string
|
||||
late_grace_minutes?: number
|
||||
@ -153,8 +171,9 @@ const formRef = ref<any>(null)
|
||||
const submitting = ref(false)
|
||||
|
||||
const form = reactive({
|
||||
name: '',
|
||||
store_id: undefined as number | undefined,
|
||||
report_code: '',
|
||||
report_definition_id: undefined as number | undefined,
|
||||
schedule_times: [] as string[],
|
||||
channel: 'wecom',
|
||||
late_grace_minutes: 60,
|
||||
@ -164,20 +183,34 @@ const form = reactive({
|
||||
notify_member_ids_text: ''
|
||||
})
|
||||
|
||||
const isEdit = computed(() => Boolean(props.store_id && props.report_code))
|
||||
const isEdit = computed(() => Boolean(props.store_id && props.report_definition_id))
|
||||
|
||||
/** 关联报表下拉选项:启用中的报表定义;编辑回显时若当前报表已停用则补占位项 */
|
||||
const reportOptions = computed(() => {
|
||||
const opts = reportDefinitionOptions.value
|
||||
const cur = form.report_definition_id
|
||||
if (cur === undefined || cur === null || opts.some((o) => o.value === cur)) return opts
|
||||
return [...opts, { value: cur, label: `报表 #${cur}` }]
|
||||
})
|
||||
|
||||
const rules = {
|
||||
store_id: [{ required: true, message: '请输入货主ID', trigger: 'blur' }],
|
||||
report_code: [{ required: true, message: '请输入报表编码', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||
store_id: [{ required: true, message: '请选择货主', trigger: 'change' }],
|
||||
report_definition_id: [{ required: true, message: '请选择关联报表', trigger: 'change' }],
|
||||
schedule_times: [{ required: true, type: 'array', min: 1, message: '至少添加一个投递时间', trigger: 'change' }]
|
||||
}
|
||||
|
||||
watch(() => props.visible, (v) => {
|
||||
if (v) {
|
||||
form.name = props.name ?? ''
|
||||
form.store_id = props.store_id !== undefined && props.store_id !== null && props.store_id !== ''
|
||||
? Number(props.store_id)
|
||||
: undefined
|
||||
form.report_code = props.report_code ?? ''
|
||||
form.report_definition_id = props.report_definition_id !== undefined && props.report_definition_id !== null && props.report_definition_id !== 0
|
||||
? Number(props.report_definition_id)
|
||||
: undefined
|
||||
// 打开时刷新报表定义下拉(force,避免同会话新增报表后未出现)
|
||||
void loadReportDefinitions(true)
|
||||
form.schedule_times = Array.isArray(props.schedule_times) ? [...props.schedule_times] : []
|
||||
form.channel = props.channel ?? 'wecom'
|
||||
form.late_grace_minutes = props.late_grace_minutes ?? 60
|
||||
@ -195,6 +228,7 @@ function handleClosed() {
|
||||
|
||||
onMounted(() => {
|
||||
void loadStoreOptions()
|
||||
void loadReportDefinitions()
|
||||
})
|
||||
|
||||
async function handleSubmit() {
|
||||
@ -218,8 +252,10 @@ async function handleSubmit() {
|
||||
.filter(Boolean)
|
||||
|
||||
await saveDeliveryPlan({
|
||||
name: form.name.trim(),
|
||||
store_id: Number(form.store_id),
|
||||
report_code: form.report_code.trim(),
|
||||
// 后端参数为 report_id(报表定义ID,与 reportId 二选一);form 取自列表行的 report_definition_id
|
||||
report_id: Number(form.report_definition_id),
|
||||
schedule_times: form.schedule_times,
|
||||
channel: form.channel,
|
||||
late_grace_minutes: form.late_grace_minutes,
|
||||
|
||||
@ -192,8 +192,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storewarehouse.store/storeWarehouse'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
|
||||
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
|
||||
@ -1036,7 +1036,7 @@ import { storeWarehouseList, storeWarehouseUnbind,
|
||||
storeWarehouseExportPrintQuantityLogs,
|
||||
storeWarehouseExportPrintQuantityLogsTaskProgress,
|
||||
storeWarehouseCreateUser
|
||||
} from '@/api/storewarehouse.store/storeWarehouse'
|
||||
} from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import { listInterfaceTypes, getExpressList, getPlatformList, getQimenAppList, loadStores } from '@/api/index/index'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
@ -94,7 +94,7 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { saveReportDefinition } from '@/api/report/report'
|
||||
import { saveReportDefinition, type ReportDefinitionTypeField } from '@/api/report/report'
|
||||
import {
|
||||
loadReportTypeList,
|
||||
reportTypeOptions as typeOptions,
|
||||
@ -154,7 +154,7 @@ const currentTypeFields = computed(() => {
|
||||
if (fields.length) return fields
|
||||
// 编辑兜底:类型未命中清单时,用既有字段构造可读选项
|
||||
if (isEdit.value && form.fields.length) {
|
||||
return form.fields.map((k) => ({ key: k, label: k }))
|
||||
return form.fields.map((k): ReportDefinitionTypeField => ({ key: k, label: k }))
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
@ -126,8 +126,18 @@ async function handleSubmit() {
|
||||
try {
|
||||
const res: any = await copyDeliveryPlan({ id: Number(props.id), store_ids: form.store_ids })
|
||||
if (res && (res.code === 1 || res.code === 200)) {
|
||||
const copied = Number(res?.copied ?? res?.data?.copied ?? form.store_ids.length)
|
||||
ElMessage.success(`已复制到 ${copied} 个货主`)
|
||||
const createdList = Array.isArray(res?.created) ? res.created : []
|
||||
const skippedList = Array.isArray(res?.skipped) ? res.skipped : []
|
||||
const copiedCount = createdList.length
|
||||
if (skippedList.length) {
|
||||
const reasons = skippedList
|
||||
.map((s: any) => s?.reason || (s?.store_id != null ? `货主 ${s.store_id}` : '未知货主'))
|
||||
.filter(Boolean)
|
||||
.join(';')
|
||||
ElMessage.warning(`已复制 ${copiedCount} 个货主,跳过 ${skippedList.length} 个(${reasons})`)
|
||||
} else {
|
||||
ElMessage.success(`已复制到 ${copiedCount} 个货主`)
|
||||
}
|
||||
emit('update:visible', false)
|
||||
emit('success')
|
||||
} else {
|
||||
|
||||
@ -442,7 +442,7 @@ import {
|
||||
storeWarehouseExportStorePrintQuantityLogs,
|
||||
storeWarehouseExportStorePrintQuantityLogsTaskProgress,
|
||||
storeWarehouseQueryStorePrintQuantityLogs
|
||||
} from '@/api/storewarehouse.store/storeWarehouse'
|
||||
} from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import { listInterfaceTypes, getQimenAppList } from '@/api/index/index'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user