feat(freight-rpa): 系统连接只保留上传开关并增加 Crane 一次回查
上传页、按钮和成功判断改由连接器固定。Crane 分配中只排一次 10 分钟状态回查,手动刷新不改到期时间。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
95e7db0831
commit
3bb9938c05
33 files changed
+878
-374
No files matched your search
@@ -8,6 +8,7 @@
|
||||
来源站点详情三块折叠——库存报表|入站报表|出站报表;入站/出站走独立 get/save API。
|
||||
复制新增只预填未保存草稿(sourceCloneDraft),保存后新站点保持停用。卡片入口是右上角复制图标,抽屉底栏保留文字按钮。
|
||||
报表规则列表按用途分段(库存→入站→出站),组内按 profile_code / version 排序。
|
||||
系统连接回显用户名明文,密码留空表示不修改。自动上传只保存开关,页面动作在连接器代码里。
|
||||
视觉层已迁移 Element Plus(element-trial 主题),间距由 AdminLayout 壳层持有。
|
||||
-->
|
||||
<template>
|
||||
@@ -143,7 +144,7 @@
|
||||
<label><span>{{ t('admin.freightRpa.connectionName') }}</span><el-input v-model="profile.display_name" required /></label>
|
||||
<label><span>{{ t('admin.freightRpa.connectorType') }}</span><el-select v-model="profile.connector_type"><el-option value="dbs" :label="t('admin.freightRpa.platform.dbs')" /><el-option value="crane" :label="t('admin.freightRpa.platform.crane')" /></el-select></label>
|
||||
<label><span>{{ t('admin.freightRpa.loginUrl') }}</span><el-input v-model="profile.login_url" type="url" required /></label>
|
||||
<label><span>{{ t('admin.freightRpa.username') }}</span><el-input v-model="profile.username" name="shipping-rpa-credential-user" autocomplete="one-time-code" readonly :placeholder="t('admin.freightRpa.writeOnlyHint')" @focus="unlockCredentialField" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.username') }}</span><el-input v-model="profile.username" name="shipping-rpa-username" autocomplete="off" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.password') }}</span><el-input v-model="profile.password" name="shipping-rpa-credential-password" type="password" autocomplete="new-password" readonly :placeholder="t('admin.freightRpa.writeOnlyHint')" @focus="unlockCredentialField" /></label>
|
||||
<div class="switch-field"><span>{{ t('admin.freightRpa.enabled') }}</span><div class="switch-control"><el-switch v-model="profile.enabled" /><b>{{ profile.enabled ? t('admin.freightRpa.enabledState') : t('admin.freightRpa.disabledState') }}</b></div></div>
|
||||
|
||||
@@ -153,14 +154,6 @@
|
||||
<small>{{ t('admin.freightRpa.uploadConfigHint') }}</small>
|
||||
</header>
|
||||
<div class="switch-field"><span>{{ t('admin.freightRpa.uploadAutoEnabled') }}</span><div class="switch-control"><el-switch v-model="profile.upload_config_json.enabled" /><b>{{ profile.upload_config_json.enabled ? t('admin.freightRpa.enabledState') : t('admin.freightRpa.disabledState') }}</b></div></div>
|
||||
<label><span>{{ t('admin.freightRpa.uploadEntryUrl') }}</span><el-input v-model="profile.upload_config_json.entry_url" type="url" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.uploadFileSelector') }}</span><el-input v-model="profile.upload_config_json.file_input_selector" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.uploadSubmitMode') }}</span><el-select v-model="profile.upload_config_json.submit_mode"><el-option value="auto_after_file" :label="t('admin.freightRpa.uploadSubmitAuto')" /><el-option value="click_submit" :label="t('admin.freightRpa.uploadSubmitClick')" /></el-select></label>
|
||||
<label v-if="profile.upload_config_json.submit_mode === 'click_submit'"><span>{{ t('admin.freightRpa.uploadSubmitSelector') }}</span><el-input v-model="profile.upload_config_json.submit_selector" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.uploadResultMode') }}</span><el-select v-model="profile.upload_config_json.result_mode"><el-option value="page_notice" :label="t('admin.freightRpa.uploadResultPageNotice')" /><el-option value="history_record" :label="t('admin.freightRpa.uploadResultHistory')" /></el-select></label>
|
||||
<label><span>{{ t('admin.freightRpa.uploadResultSelector') }}</span><el-input v-model="profile.upload_config_json.result_selector" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.uploadSuccessTexts') }}</span><el-input v-model="successTextsInput" type="textarea" :rows="2" :placeholder="t('admin.freightRpa.uploadSuccessTextsHint')" /></label>
|
||||
<label><span>{{ t('admin.freightRpa.uploadTimeout') }}</span><el-input-number v-model="profile.upload_config_json.timeout_seconds" :min="1" /></label>
|
||||
<div class="form-tip full">{{ t('admin.freightRpa.uploadConfigBoundary') }}</div>
|
||||
</section>
|
||||
|
||||
@@ -746,33 +739,12 @@ const filenameVariableCandidates = computed(() => {
|
||||
return filenameVariables.filter((item) => item.key.toLowerCase().includes(query) || t(item.labelKey).toLowerCase().includes(query));
|
||||
});
|
||||
|
||||
/** 连接级“发货 Excel 自动上传”配置的受控 JSON 形状(字段与后端白名单一致)。 */
|
||||
interface ProfileUploadConfig {
|
||||
enabled: boolean;
|
||||
entry_url: string;
|
||||
file_input_selector: string;
|
||||
submit_mode: 'auto_after_file' | 'click_submit';
|
||||
submit_selector: string | null;
|
||||
result_mode: 'page_notice' | 'history_record';
|
||||
result_selector: string | null;
|
||||
success_texts: string[];
|
||||
timeout_seconds: number;
|
||||
}
|
||||
|
||||
/** 连接级“发货 Excel 自动上传”默认配置:DSV 为已确认 URL+input#file2;Crane 保持未启用待管理员补全。 */
|
||||
function defaultUploadConfig(connectorType: string): ProfileUploadConfig {
|
||||
if (connectorType === 'crane') {
|
||||
return { enabled: false, entry_url: 'https://wms-portal.craneww.com/#/shipping-order-upload', file_input_selector: 'input[name="OrderFileUpload"]', submit_mode: 'click_submit', submit_selector: null, result_mode: 'page_notice', result_selector: null, success_texts: [], timeout_seconds: 120 };
|
||||
}
|
||||
return { enabled: true, entry_url: 'https://s360.dbschenker.com/main/portal/frame/WMSUpload2', file_input_selector: 'input#file2', submit_mode: 'auto_after_file', submit_selector: null, result_mode: 'page_notice', result_selector: null, success_texts: [], timeout_seconds: 120 };
|
||||
/** 系统连接只保存是否启用自动上传;页面路径和成功判断在连接器代码里。 */
|
||||
function defaultUploadConfig(connectorType: string): { enabled: boolean } {
|
||||
return { enabled: connectorType !== 'crane' };
|
||||
}
|
||||
|
||||
const profile = reactive({ profile_code: '', display_name: '', connector_type: 'dbs', login_url: '', username: '', password: '', login_config_json: { auth_mode: 'password' }, enabled: true, upload_config_json: defaultUploadConfig('dbs') });
|
||||
/** 成功文本以换行分隔的输入视图,写回 success_texts 数组。 */
|
||||
const successTextsInput = computed<string>({
|
||||
get: () => (profile.upload_config_json.success_texts || []).join('\n'),
|
||||
set: (value) => { profile.upload_config_json.success_texts = String(value || '').split(/\r?\n/).map((item) => item.trim()).filter(Boolean); },
|
||||
});
|
||||
const parsing = reactive({
|
||||
profile_code: '', display_name: '', file_format: 'xlsx', sheet_name: '', header_row_index: 1,
|
||||
purpose: 'onhand' as 'onhand' | 'inbound' | 'outbound',
|
||||
@@ -1130,7 +1102,7 @@ watch(
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
/** 新建连接时按货代类型切换上传配置默认值;编辑既有连接不覆盖已保存配置。 */
|
||||
/** 新建连接时按货代类型决定自动上传默认开关;编辑既有连接不覆盖已保存配置。 */
|
||||
watch(
|
||||
() => profile.connector_type,
|
||||
(nextType) => {
|
||||
@@ -1176,11 +1148,11 @@ function createNew(): void {
|
||||
drawerOpen.value = true;
|
||||
}
|
||||
|
||||
/** 将列表对象复制到当前编辑表单,凭据字段永远不从列表回填。 */
|
||||
/** 将列表对象复制到当前编辑表单。用户名回填明文,密码不回填。 */
|
||||
function selectItem(item: Item): void {
|
||||
selectedId.value = Number(item.id);
|
||||
sourceCloneFrom.value = null;
|
||||
if (activeTab.value === 'profiles') Object.assign(profile, { ...item, username: '', password: '', login_config_json: item.login_config_json || { auth_mode: 'password' }, upload_config_json: item.upload_config_json || defaultUploadConfig(item.connector_type) });
|
||||
if (activeTab.value === 'profiles') Object.assign(profile, { ...item, username: String(item.username || ''), password: '', login_config_json: item.login_config_json || { auth_mode: 'password' }, upload_config_json: { enabled: Boolean(item.upload_config_json?.enabled) } });
|
||||
if (activeTab.value === 'parsing') Object.assign(parsing, {
|
||||
profile_code: item.profile_code, display_name: item.display_name, file_format: item.file_format,
|
||||
sheet_name: item.definition?.sheet_name || '', header_row_index: item.definition?.header_row_index ?? 0,
|
||||
@@ -1504,7 +1476,7 @@ function duplicateSourceFromDrawer(): void {
|
||||
async function saveCurrent(): Promise<void> {
|
||||
saving.value = true;
|
||||
try {
|
||||
if (activeTab.value === 'profiles') await saveShippingRpaProfile({ ...profile, display_name: profile.display_name || profile.profile_code, upload_config_json: profile.upload_config_json }, selectedId.value || undefined);
|
||||
if (activeTab.value === 'profiles') await saveShippingRpaProfile({ ...profile, display_name: profile.display_name || profile.profile_code, upload_config_json: { enabled: Boolean(profile.upload_config_json?.enabled) } }, selectedId.value || undefined);
|
||||
if (activeTab.value === 'parsing') {
|
||||
const payload = parsingUsesMovementContract.value ? {
|
||||
profile_code: parsing.profile_code, display_name: parsing.display_name || parsing.profile_code, file_format: parsing.file_format,
|
||||
@@ -1956,11 +1928,16 @@ function rowTitle(item: Item): string {
|
||||
|
||||
/**
|
||||
* 列表卡副标题。
|
||||
* 核心逻辑:mappings 展示「在途仓编码 → 目标仓编码」;缺在途仓时退化为仅目标编码。
|
||||
* 核心逻辑:mappings 展示「在途仓编码 → 目标仓编码」;系统连接展示平台与用户名。
|
||||
* @param item - 当前列表行对象
|
||||
* @returns 副标题文案
|
||||
*/
|
||||
function rowMeta(item: Item): string {
|
||||
if (activeTab.value === 'profiles') {
|
||||
const platform = item.connector_type ? t(`admin.freightRpa.platform.${item.connector_type}`) : String(item.profile_code || '');
|
||||
const username = String(item.username || '').trim();
|
||||
return username ? `${platform} · ${username}` : platform;
|
||||
}
|
||||
if (activeTab.value === 'mappings') {
|
||||
const targetCode = String(item.external_warehouse_code || '-');
|
||||
const inTransit = String(item.in_transit_warehouse_code || '').trim();
|
||||
|
||||
Reference in new issue
Block a user