提交所有文件

This commit is contained in:
2026-09-19 14:12:58 +08:00
parent 20e88479b1
commit 7b922290bb
62 changed files with 11832 additions and 131 deletions
+169 -28
View File
@@ -1,4 +1,4 @@
// 导入 h 函数
// 导入 h 函数
const { createApp, ref, reactive, onMounted, onUnmounted,nextTick, watch, h, computed } = Vue;
const { ElMessage, ElMessageBox, ElTableV2, ElCheckbox,ElLoading } = ElementPlus;
// 获取 URL 参数中的 BJDID
@@ -40,8 +40,10 @@ function logMappingDebug(stage, payload) {
}
function getDefaultPasteFieldOrder() {
const defaultOrder = ['包号', '报价产品', '技术规范书ID', '计量单位', '数量'];
const validFields = new Set(['包号', '报价产品', '技术规范书ID', '计量单位', '数量', '不导入']);
const defaultOrder = ['包号', '报价产品', '技术规范书ID', '计量单位', '数量',
'原始产品', '备注', '外购', '产品报价限价', '报价金额限价'];
const validFields = new Set(['包号', '报价产品', '技术规范书ID', '计量单位', '数量', '不导入',
'原始产品', '备注', '外购', '产品报价限价', '报价金额限价']);
let rawValue = getControlValue('txtBJU059').trim();
if (!rawValue) return defaultOrder;
@@ -128,11 +130,16 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
{ value: '报价产品', label: '报价产品' },
{ value: '技术规范书ID', label: '技术规范书ID' },
{ value: '计量单位', label: '计量单位' },
{ value: '数量', label: '数量' }
{ value: '数量', label: '数量' },
{ value: '原始产品', label: '原始产品' },
{ value: '备注', label: '备注' },
{ value: '外购', label: '外购' },
{ value: '产品报价限价', label: '产品报价限价' },
{ value: '报价金额限价', label: '报价金额限价' }
];
const batchUpdateUseSelect = computed(() =>
batchUpdateType.value === 'standard' || batchUpdateType.value === 'voltage'
batchUpdateType.value === 'standard' || batchUpdateType.value === 'voltage' || batchUpdateType.value === 'purchase'
);
const visibleColumns = computed(() => {
@@ -426,14 +433,19 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
'报价产品': null,
'技术规范书ID': null,
'计量单位': null, // 新增
'数量': null,
'数量': null,
'原始产品': null,
'备注': null,
'外购': null,
'产品报价限价': null,
'报价金额限价': null,
'型号': null,
'电压等级': null,
'标准': null,
'规格': null,
'等效': null,
});
const tableColumns = ref(['包号','报价产品', '技术规范书ID','计量单位', '数量', '型号', '电压等级', '标准', '规格', '等效']);
const tableColumns = ref(['包号','报价产品', '技术规范书ID','计量单位', '数量', '原始产品', '备注', '外购', '产品报价限价', '报价金额限价', '型号', '电压等级', '标准', '规格', '等效']);
const importing = ref(false);
const importProgress = ref(0);
const totalRows = ref(0);
@@ -816,6 +828,44 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
title: '数量',
width: 80,
align: 'left'
},
{
key: 'originalProduct',
dataKey: 'originalProduct',
title: '原始产品',
width: 120,
align: 'left'
},
{
key: 'remark',
dataKey: 'remark',
title: '备注',
width: 120,
align: 'left'
},
{
key: 'purchase',
dataKey: 'purchase',
title: '外购',
width: 60,
align: 'center',
cellRenderer: ({ rowData }) => {
return rowData.purchase === 'Y' ? '√' : '';
}
},
{
key: 'productPriceLimit',
dataKey: 'productPriceLimit',
title: '产品报价限价',
width: 110,
align: 'right'
},
{
key: 'quoteAmountLimit',
dataKey: 'quoteAmountLimit',
title: '报价金额限价',
width: 110,
align: 'right'
},
{
key: 'model',
@@ -1021,6 +1071,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
const techSpecId= row.length > 2 ? row[2].trim() : ''; // 第三列为数量
const unit= row.length > 3 ? row[3].trim() : ''; // 第四列为包号
const quantity = row.length > 4 ? row[4].trim() : ''; // 第五列为技术规范ID
const originalProduct = row.length > 5 ? row[5].trim() : '';
const remark = row.length > 6 ? row[6].trim() : '';
const purchase = row.length > 7 ? row[7].trim() : '';
const productPriceLimit = row.length > 8 ? row[8].trim() : '';
const quoteAmountLimit = row.length > 9 ? row[9].trim() : '';
// 创建XLJXMX对象
itemsToInsert.push({
@@ -1046,7 +1101,12 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
JLDW: unit, // 计量单位
SL: quantity, // 数量
FBH: packageNumber, // 包号
JSGFID: techSpecId // 技术规范ID
JSGFID: techSpecId, // 技术规范ID
YSCP: originalProduct,
BZ: remark,
WGBZ: purchase,
CPBJXJ: productPriceLimit,
BJJEXJ: quoteAmountLimit
});
parsedData.push({
@@ -1056,6 +1116,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
quantity: quantity,
packageNumber: packageNumber, // 包号
techSpecId: techSpecId, // 技术规范ID
originalProduct: originalProduct,
remark: remark,
purchase: purchase,
productPriceLimit: productPriceLimit,
quoteAmountLimit: quoteAmountLimit,
model: '',
voltage: '',
standard: '',
@@ -1112,6 +1177,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
const techSpecId = getMappedValue(row, '技术规范书ID');
const unit = getMappedValue(row, '计量单位');
const quantity = getMappedValue(row, '数量');
const originalProduct = getMappedValue(row, '原始产品');
const remark = getMappedValue(row, '备注');
const purchase = getMappedValue(row, '外购');
const productPriceLimit = getMappedValue(row, '产品报价限价');
const quoteAmountLimit = getMappedValue(row, '报价金额限价');
itemsToInsert.push({
XLJXDJ: "XSBJ",
@@ -1136,7 +1206,12 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
JLDW: unit,
SL: quantity,
FBH: packageNumber,
JSGFID: techSpecId
JSGFID: techSpecId,
YSCP: originalProduct,
BZ: remark,
WGBZ: purchase,
CPBJXJ: productPriceLimit,
BJJEXJ: quoteAmountLimit
});
parsedData.push({
@@ -1146,6 +1221,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
quantity: quantity,
packageNumber: packageNumber,
techSpecId: techSpecId,
originalProduct: originalProduct,
remark: remark,
purchase: purchase,
productPriceLimit: productPriceLimit,
quoteAmountLimit: quoteAmountLimit,
model: '',
voltage: '',
standard: '',
@@ -2131,6 +2211,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
importing.value = false;
canImport.value = false;
// 重置文件输入框,避免再次选择相同文件时不触发change事件
if (fileInput.value) {
fileInput.value.value = '';
}
// 重置映射关系
tableColumns.value.forEach(col => {
columnMapping[col] = null;
@@ -2162,6 +2247,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
excelFile.value = file;
errorMessage.value = '';
// 读取文件后立即清空 input,避免再次选择相同文件时不触发 change 事件
if (fileInput.value) {
fileInput.value.value = '';
}
// 开始解析Excel
readExcelFile(file);
};
@@ -2295,7 +2385,14 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
WHSJ: "",
DCZT: "N" ,
JLDW: rowData['计量单位'] || "",
SL: rowData['数量'] || ""
SL: rowData['数量'] || "",
YSCP: rowData['原始产品'] || "",
BZ: rowData['备注'] || "",
WGBZ: rowData['外购'] || "",
CPBJXJ: rowData['产品报价限价'] || "",
BJJEXJ: rowData['报价金额限价'] || "",
FBH: rowData['包号'] || "",
JSGFID: rowData['技术规范书id'] || ""
});
newTableData.push({
@@ -2303,10 +2400,17 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
product,
unit: rowData['计量单位'] || '',
quantity: rowData['数量'] || '',
originalProduct: rowData['原始产品'] || '',
remark: rowData['备注'] || '',
purchase: rowData['外购'] || '',
productPriceLimit: rowData['产品报价限价'] || '',
quoteAmountLimit: rowData['报价金额限价'] || '',
model: rowData['型号'] || '',
voltage: rowData['电压等级'] || '',
standard: rowData['标准'] || '',
spec: rowData['规格'] || '',
FBH: rowData['包号'] || "",
JSGFID: rowData['技术规范书id'] || "",
status: 'N',
checked: false
});
@@ -2327,6 +2431,10 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
importing.value = false;
successMessage.value = `成功导入${itemsToInsert.length}条产品数据`;
ElMessage.success(`成功导入${itemsToInsert.length}条产品数据`);
await commonParse();
// 导入成功后关闭对话框
closeImportDialog();
} else {
importing.value = false;
errorMessage.value = `导入失败: ${result?.message || '未知错误'}`;
@@ -2498,6 +2606,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
quantity: item.SL || '', // 新增
packageNumber:item.FBH, // 包号
techSpecId:item.JSGFID, // 技术规范ID
originalProduct: item.YSCP || '',
remark: item.BZ || '',
purchase: item.WGBZ || '',
productPriceLimit: item.CPBJXJ || '',
quoteAmountLimit: item.BJJEXJ || '',
model: item.JXXLXHID || item.XLXHID,
XLXHID: item.XLXHID || '',
@@ -2571,6 +2684,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
'技术规范ID',
'计量单位',
'数量',
'原始产品',
'备注',
'外购',
'产品报价限价',
'报价金额限价',
'型号',
'电压等级',
'标准',
@@ -2586,6 +2704,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
row.techSpecId ?? '',
row.unit ?? '',
row.quantity ?? '',
row.originalProduct ?? '',
row.remark ?? '',
row.purchase ?? '',
row.productPriceLimit ?? '',
row.quoteAmountLimit ?? '',
row.model ?? '',
row.voltage ?? '',
row.standard ?? '',
@@ -2603,6 +2726,11 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
{ wch: 18 }, // 技术规范ID
{ wch: 10 }, // 计量单位
{ wch: 10 }, // 数量
{ wch: 14 }, // 原始产品
{ wch: 14 }, // 备注
{ wch: 8 }, // 外购
{ wch: 14 }, // 产品报价限价
{ wch: 14 }, // 报价金额限价
{ wch: 14 }, // 型号
{ wch: 14 }, // 电压等级
{ wch: 14 }, // 标准
@@ -2660,19 +2788,18 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
selectedRowsCount.value = selectedRows.length;
hasSelectedRows.value = selectedRowsCount.value > 0;
};
// 加载批量调整线缆标准选项
const loadBatchStandardOptions = async () => {
const loadBatchStandardOptions = async (items) => {
try {
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373012.ashx';
const result = await new Promise((resolve, reject) => {
GThinking.Web.AjaxServiceProxy.invoke(
'XLBZList',
'GetBatchXLBZList',
false,
{},
{ items: items || [] },
(data) => resolve(data),
(error) => reject(error),
"XLBZList_CallBack",
"GetBatchXLBZList_CallBack",
50000
);
});
@@ -2688,27 +2815,26 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
ElMessage.error('加载线缆标准失败');
}
};
// 加载批量调整电压等级选项
const loadBatchVoltageOptions = async () => {
const loadBatchVoltageOptions = async (items) => {
try {
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373012.ashx';
const result = await new Promise((resolve, reject) => {
GThinking.Web.AjaxServiceProxy.invoke(
'GetDYDJList',
'GetBatchDYDJList',
false,
{},
{ items: items || [] },
(data) => resolve(data),
(error) => reject(error),
"GetDYDJList_CallBack",
"GetBatchDYDJList_CallBack",
50000
);
});
if (result) {
batchUpdateOptions.value = result.map(item => ({
value: item,
label: item
value: (item || '').toString().replace(/\*+$/, '').trim(),
label: (item || '').toString()
}));
}
} catch (error) {
@@ -2744,7 +2870,6 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
console.error('加载标准名称映射失败:', error);
}
};
// 显示批量调整对话框
const showBatchUpdateDialog = async (type) => {
batchUpdateType.value = type;
@@ -2752,17 +2877,25 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
batchUpdateOptions.value = [];
batchUpdateFilterQuery.value = '';
updateSelectedRows();
const selectedRows = tableData.value.filter(row => row.selected);
const items = selectedRows.map(row => buildBatchUpdateItem(row));
if (type === 'standard') {
batchUpdateTitle.value = '批量调整线缆标准';
await loadBatchStandardOptions();
await loadBatchStandardOptions(items);
} else if (type === 'voltage') {
batchUpdateTitle.value = '批量调整电压等级';
await loadBatchVoltageOptions();
await loadBatchVoltageOptions(items);
} else if (type === 'model') {
batchUpdateTitle.value = '批量调整线缆型号';
} else if (type === 'spec') {
batchUpdateTitle.value = '批量调整线缆规格';
} else if (type === 'purchase') {
batchUpdateTitle.value = '批量调整外购';
batchUpdateOptions.value = [
{ value: 'Y', label: '外购 (Y)' },
{ value: 'N', label: '不外购 (N)' }
];
}
batchUpdateDialogVisible.value = true;
@@ -2783,7 +2916,7 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
// 确认批量调整
const confirmBatchUpdate = async () => {
if (!batchUpdateValue.value.trim()) {
if (!batchUpdateValue.value.trim() && batchUpdateType.value !== 'purchase') {
ElMessage.warning(batchUpdateUseSelect.value ? '请选择调整值' : '请输入调整值');
return;
}
@@ -2797,7 +2930,7 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
let updateValue = '';
if (batchUpdateUseSelect.value) {
updateValue = resolveBatchUpdateSelectValue();
if (!updateValue) {
if (!updateValue && batchUpdateType.value !== 'purchase') {
ElMessage.warning(
batchUpdateType.value === 'standard'
? '请从下拉列表中选择有效的线缆标准'
@@ -2851,6 +2984,9 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
if (batchUpdateType.value === 'spec') {
return { ...row, spec: updateValue, XLGGID: updateValue };
}
if (batchUpdateType.value === 'purchase') {
return { ...row, purchase: updateValue };
}
return row;
});
@@ -2909,7 +3045,12 @@ function forceApplyDefaultColumnMapping(columnFieldMapping, detectedColumnCount)
JLDW: row.unit || "",
SL: row.quantity || "",
FBH: row.packageNumber || "",
JSGFID: row.techSpecId || ""
JSGFID: row.techSpecId || "",
YSCP: row.originalProduct || "",
BZ: row.remark || "",
WGBZ: row.purchase || "",
CPBJXJ: row.productPriceLimit || "",
BJJEXJ: row.quoteAmountLimit || ""
}));
// 设置服务路径(确保正确)