925 lines
35 KiB
JavaScript
925 lines
35 KiB
JavaScript
const { createApp, ref, reactive, computed, onMounted, onBeforeUnmount } = Vue;
|
||
function getControlValue(controlId) {
|
||
const exact = document.getElementById(controlId);
|
||
if (exact && typeof exact.value !== 'undefined') {
|
||
return exact.value || '';
|
||
}
|
||
const bySuffix = document.querySelector(`[id$="${controlId}"]`);
|
||
if (bySuffix && typeof bySuffix.value !== 'undefined') {
|
||
return bySuffix.value || '';
|
||
}
|
||
return '';
|
||
}
|
||
|
||
const BJU061 = getControlValue('txtBJU061');
|
||
|
||
const app = createApp({
|
||
setup() {
|
||
|
||
/* ===== 基础状态 ===== */
|
||
const loading = ref(false);
|
||
const enableSJDC = ref(false);
|
||
const queryDrawerVisible = ref(false);
|
||
const tableContainer = ref(null);
|
||
|
||
const detailDialogVisible = ref(false);
|
||
const detailBasicInfo = ref({});
|
||
const detailMaterialList = ref([]);
|
||
|
||
/* ===== 表格 ===== */
|
||
const tableWidth = ref(1600);
|
||
const tableHeight = ref(800);
|
||
const tableVersion = ref(0);
|
||
|
||
const dicCLMC = ref({});
|
||
const dicCLJG = ref({});
|
||
const dicCLWL = ref({});
|
||
|
||
const items = ref([]);
|
||
const filteredItems = ref([]);
|
||
|
||
/* ===== 分页 ===== */
|
||
const currentPage = ref(1);
|
||
const pageSize = ref(5000);
|
||
|
||
const total = computed(() => filteredItems.value.length);
|
||
|
||
const pagedData = computed(() => {
|
||
const start = (currentPage.value - 1) * pageSize.value;
|
||
const end = start + pageSize.value;
|
||
return filteredItems.value.slice(start, end);
|
||
});
|
||
|
||
const handleSizeChange = (val) => {
|
||
pageSize.value = val;
|
||
currentPage.value = 1;
|
||
};
|
||
|
||
const calcTableSize = () => {
|
||
const container = tableContainer.value;
|
||
if (!container) return;
|
||
|
||
tableWidth.value = container.clientWidth;
|
||
tableHeight.value = container.clientHeight;
|
||
|
||
console.log('calcTableSize', tableWidth.value, tableHeight.value);
|
||
};
|
||
|
||
const handleCurrentChange = (val) => {
|
||
currentPage.value = val;
|
||
};
|
||
|
||
/* ===== 动态列 ===== */
|
||
|
||
const COLUMN_MIN_WIDTH_MAP = {
|
||
|
||
};
|
||
|
||
const dynamicWidths = reactive({});
|
||
const dynamicColumns = ref([]);
|
||
|
||
const columns = computed(() => {
|
||
return dynamicColumns.value.map(col => ({
|
||
key: col.prop,
|
||
dataKey: col.prop,
|
||
title: col.label,
|
||
width:
|
||
dynamicWidths[col.prop] ||
|
||
COLUMN_MIN_WIDTH_MAP[col.prop] ||
|
||
120
|
||
}));
|
||
});
|
||
|
||
const generateColumns = () => {
|
||
|
||
const cols = [];
|
||
// ===== 固定基础列 =====
|
||
cols.push(
|
||
{ label: '型号', prop: 'XLXSCLQD_XLXHID', width: 120 },
|
||
{ label: '规格', prop: 'XLXSCLQD_XLGGID', width: 120 },
|
||
{ label: '标准', prop: 'XLBZ', width: 60 },
|
||
{ label: '电压等级', prop: 'XLXSCLQD_DYDJID', width: 80 },
|
||
{ label: '物料编码', prop: 'WLID', width: 80 },
|
||
{ label: '物料信息', prop: 'WLXX', width: 180 },
|
||
{ label: '计量单位', prop: 'JLDW', width: 60 },
|
||
{ label: '材料重量', prop: 'XLXSCLQD_CLZL', width: 80 },
|
||
{ label: '材料成本', prop: 'CLCB', width: 80 }
|
||
);
|
||
|
||
// ===== 动态 01~10 列 =====
|
||
for (let i = 1; i <= 80; i++) {
|
||
const index = i.toString().padStart(2, '0');
|
||
|
||
cols.push(
|
||
{ label: `第${index}列`, prop: `XLXSCLQD_SL${index}`, width: 80 },
|
||
{ label: `第${index}列价格`, prop: `CLJG${index}`, width: 100 },
|
||
{ label: '材料物料', prop: `XLXSCLWL${index}`, width: 100 },
|
||
{ label: '物料价格(元/Kg)', prop: `XLXSCLWLJG${index}`, width: 120 },
|
||
{ label: '物料成本', prop: `XLXSCLWLCB${index}`, width: 100 }
|
||
);
|
||
}
|
||
|
||
// ===== 尾部列 =====
|
||
cols.push(
|
||
{ label: '备注', prop: 'XLXSCLQD_BZ', width: 150 },
|
||
{ label: '维护人', prop: 'XLXSCLQD_WHR', width: 80 },
|
||
{ label: '维护时间', prop: 'XLXSCLQD_WHSJ', width: 150 }
|
||
);
|
||
|
||
dynamicColumns.value = cols;
|
||
|
||
|
||
|
||
tableVersion.value++;
|
||
};
|
||
|
||
const buildDynamicMaterialColumns = () => {
|
||
|
||
const cols = [];
|
||
// ===== 固定基础列 =====
|
||
cols.push(
|
||
{ label: '型号', prop: 'XLXSCLQD_XLXHID', width: 120 },
|
||
{ label: '规格', prop: 'XLXSCLQD_XLGGID', width: 120 },
|
||
{ label: '标准', prop: 'XLBZ', width: 60 },
|
||
{ label: '电压等级', prop: 'XLXSCLQD_DYDJID', width: 80 },
|
||
{ label: '物料编码', prop: 'WLID', width: 80 },
|
||
{ label: '物料信息', prop: 'WLXX', width: 180 },
|
||
{ label: '计量单位', prop: 'JLDW', width: 60 },
|
||
{ label: '材料重量', prop: 'XLXSCLQD_CLZL', width: 80 },
|
||
{ label: '材料成本', prop: 'CLCB', width: 80 }
|
||
);
|
||
|
||
// ===== 动态 01~10 列 =====
|
||
for (let i = 1; i <= 80; i++) {
|
||
|
||
const index = i.toString().padStart(2, '0');
|
||
const key = `第${index}列`;
|
||
|
||
const hasCLMC = dicCLMC.value[key] && dicCLMC.value[key].trim() !== '';
|
||
const hasCLWL = dicCLWL.value[key];
|
||
|
||
// ===== 如果 CLMC 不存在 → 整组隐藏 =====
|
||
if (!hasCLMC) continue;
|
||
|
||
// ===== 1️⃣ 材料数量列 =====
|
||
cols.push({
|
||
label: dicCLMC.value[key] || `第${index}列`,
|
||
prop: `XLXSCLQD_SL${index}`,
|
||
width: 80
|
||
});
|
||
|
||
// ===== 2️⃣ 材料价格列 =====
|
||
if (!hasCLWL) {
|
||
cols.push({
|
||
label: dicCLJG.value[key] || `价格`,
|
||
prop: `CLJG${index}`,
|
||
width: 100
|
||
});
|
||
}
|
||
|
||
// ===== 3️⃣ 物料列 =====
|
||
if (hasCLWL) {
|
||
|
||
cols.push(
|
||
{
|
||
label: dicCLWL.value[key] || '材料物料',
|
||
prop: `XLXSCLWL${index}`,
|
||
width: 100
|
||
},
|
||
{
|
||
label: '物料价格(元/Kg)',
|
||
prop: `XLXSCLWLJG${index}`,
|
||
width: 120
|
||
},
|
||
{
|
||
label: '物料成本',
|
||
prop: `XLXSCLWLCB${index}`,
|
||
width: 100
|
||
}
|
||
);
|
||
}
|
||
}
|
||
|
||
// ===== 尾部列 =====
|
||
cols.push(
|
||
{ label: '备注', prop: 'XLXSCLQD_BZ', width: 150 },
|
||
{ label: '维护人', prop: 'XLXSCLQD_WHR', width: 80 },
|
||
{ label: '维护时间', prop: 'XLXSCLQD_WHSJ', width: 150 }
|
||
);
|
||
|
||
dynamicColumns.value = cols;
|
||
|
||
|
||
|
||
tableVersion.value++;
|
||
};
|
||
|
||
const handleRowDblClick = (row) => {
|
||
//查询条件尺重表号为空
|
||
if (!queryConditions.structureWeightTableCode) return;
|
||
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetCLCBMX',
|
||
false,
|
||
{
|
||
sXLXHID: row.XLXSCLQD_XLXHID,
|
||
sXLGGID: row.XLXSCLQD_XLGGID,
|
||
sXLBZID: row.XLBZ ? row.XLBZ.split('|')[0] : '',
|
||
sDYDJID: row.XLXSCLQD_DYDJID,
|
||
sHSJGBZ: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
sJGBID:queryConditions.jgbid
|
||
},
|
||
(result) => {
|
||
|
||
if (!result) return;
|
||
|
||
/* ========= 基本信息 ========= */
|
||
detailBasicInfo.value = {
|
||
型号: result.Model,
|
||
规格: result.Specification,
|
||
标准: row.XLBZ,
|
||
电压等级: result.VoltageLevel,
|
||
计量单位: result.Unit,
|
||
材料重量: result.MaterialWeight,
|
||
材料成本: result.MaterialCost,
|
||
结构尺重表: jgczbOptions.value.find(
|
||
item => item.value === queryConditions.structureWeightTableValue
|
||
)?.label || '',
|
||
备注: result.Remark,
|
||
维护人: result.Maintainer,
|
||
维护时间: result.MaintainTime
|
||
};
|
||
|
||
/* ========= 明细表 ========= */
|
||
detailMaterialList.value = result.Materials.map(item => ({
|
||
材料编码: item.MaterialCode,
|
||
材料名称: item.MaterialName,
|
||
物料信息: item.MaterialInfo,
|
||
材料用量: item.MaterialUsage,
|
||
材料比例: item.MaterialUsageRatio,
|
||
材料损耗率: item.MaterialLossRate,
|
||
材料价格: item.MaterialPrice,
|
||
材料成本: item.MaterialCost
|
||
}));
|
||
|
||
detailDialogVisible.value = true;
|
||
}
|
||
);
|
||
};
|
||
|
||
|
||
|
||
|
||
const rowEventHandlers = {
|
||
onDblclick: ({ rowData }) => {
|
||
handleRowDblClick(rowData);
|
||
}
|
||
};
|
||
|
||
const getDic = () => {
|
||
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || '',
|
||
Standard: queryConditions.standard || '',
|
||
Specification: queryConditions.specification || '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: queryConditions.orderOption || '',
|
||
PageSize: queryConditions.pageSize || 5000,
|
||
PageNum: queryConditions.pageNum || 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
GThinking.Web.AjaxServiceProxy.servicePath =
|
||
'S_XLXSBJ/102373017.ashx';
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetDic',
|
||
false,
|
||
{ condition: condition },
|
||
(result) => {
|
||
|
||
dicCLMC.value = result.CLMC || {};
|
||
dicCLJG.value = result.CLJG || {};
|
||
dicCLWL.value = result.CLWL || {};
|
||
console.log(dicCLMC);
|
||
console.log(dicCLJG);
|
||
console.log(dicCLWL);
|
||
|
||
|
||
buildDynamicMaterialColumns(); // 字典拿到后重新生成列
|
||
}
|
||
);
|
||
};
|
||
|
||
const getCLCBResults = () => {
|
||
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || '',
|
||
Standard: queryConditions.standard || '',
|
||
Specification: queryConditions.specification || '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: queryConditions.orderOption || '',
|
||
PageSize: queryConditions.pageSize || 5000,
|
||
PageNum: queryConditions.pageNum || 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
loading.value = true;
|
||
console.log('helloworld');
|
||
GThinking.Web.AjaxServiceProxy.servicePath =
|
||
'S_XLXSBJ/102373017.ashx';
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetCLCBResults',
|
||
false,
|
||
{ condition: condition },
|
||
(result) => {
|
||
console.log(result);
|
||
loading.value = false;
|
||
|
||
if (!result || result.length === 0) {
|
||
items.value = [];
|
||
filteredItems.value = [];
|
||
return;
|
||
}
|
||
|
||
// 现在 result 本身就是数组
|
||
items.value = result;
|
||
filteredItems.value = result;
|
||
|
||
currentPage.value = 1;
|
||
}
|
||
);
|
||
};
|
||
/* ===== 查询条件 ===== */
|
||
|
||
const queryConditions = reactive({
|
||
structureWeightTableValue: '',
|
||
structureWeightTableCode: '',
|
||
structureWeightTableVersion: '',
|
||
models: [],
|
||
specification: '',
|
||
standard: '',
|
||
voltageLevel: '',
|
||
iSHSJGCheck: true,
|
||
iSWLCBCheck: false,
|
||
orderOption: '型号+序号',
|
||
pageSize: 5000,
|
||
pageNum: 0,
|
||
jgbid:'',
|
||
fileContent: '',
|
||
fileName: '',
|
||
iSDRCX: 'N',
|
||
iSDRCXChecked: false
|
||
});
|
||
|
||
const handleResetFilter = () => {
|
||
Object.keys(queryConditions).forEach(k => {
|
||
if (Array.isArray(queryConditions[k])) {
|
||
queryConditions[k] = [];
|
||
} else if (typeof queryConditions[k] === 'boolean') {
|
||
queryConditions[k] = false;
|
||
} else {
|
||
queryConditions[k] = '';
|
||
}
|
||
});
|
||
queryConditions.iSDRCX = 'N';
|
||
queryConditions.iSDRCXChecked = false;
|
||
uploadRef.value?.clearFiles();
|
||
};
|
||
|
||
const confirmQueryDrawer = () => {
|
||
queryConditions.iSDRCX = queryConditions.iSDRCXChecked ? 'Y' : 'N';
|
||
|
||
queryDrawerVisible.value = false;
|
||
getDic();
|
||
buildDynamicMaterialColumns();
|
||
getCLCBResults();
|
||
};
|
||
|
||
const openQueryDrawer = () => {
|
||
queryDrawerVisible.value = true;
|
||
};
|
||
|
||
const sjdc = () => {
|
||
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || '',
|
||
Standard: queryConditions.standard || '',
|
||
Specification: queryConditions.specification || '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: queryConditions.orderOption || '',
|
||
PageSize: queryConditions.pageSize || 5000,
|
||
PageNum: queryConditions.pageNum || 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'SJDC',
|
||
false,
|
||
{ condition: condition },
|
||
(result) => {
|
||
|
||
if (!result) {
|
||
alert("导出失败或没有数据");
|
||
return;
|
||
}
|
||
|
||
// 🔥 直接下载
|
||
const a = document.createElement("a");
|
||
a.href = result;
|
||
a.download = ""; // 让浏览器自动用服务器文件名
|
||
document.body.appendChild(a);
|
||
a.click();
|
||
document.body.removeChild(a);
|
||
}
|
||
);
|
||
};
|
||
|
||
|
||
|
||
/* ===== 下拉 ===== */
|
||
const jgbOptions = ref([]);
|
||
const jgczbOptions = ref([]);
|
||
const xhOptions = ref([]);
|
||
const filteredXhOptions = ref([]);
|
||
const modelLoading = ref(false);
|
||
const standardOptions = ref([]);
|
||
const dydjOptions = ref([]);
|
||
const pxfsOptions = ref([
|
||
{ label: '型号+序号', value: '型号+序号' },
|
||
{ label: '尺重表内容导入行号', value: '尺重表内容导入行号' }
|
||
]);
|
||
|
||
const uploadRef = ref(null);
|
||
|
||
const readExcelAsBase64 = (file) => {
|
||
return new Promise((resolve, reject) => {
|
||
const reader = new FileReader();
|
||
reader.onload = (e) => {
|
||
const base64 = e.target.result.split(',')[1];
|
||
resolve(base64);
|
||
};
|
||
reader.onerror = reject;
|
||
reader.readAsDataURL(file);
|
||
});
|
||
};
|
||
|
||
const validateExcelHeaders = async (file) => {
|
||
return new Promise((resolve) => {
|
||
const reader = new FileReader();
|
||
reader.onload = (e) => {
|
||
try {
|
||
const data = new Uint8Array(e.target.result);
|
||
const workbook = XLSX.read(data, { type: 'array' });
|
||
const firstSheetName = workbook.SheetNames[0];
|
||
const worksheet = workbook.Sheets[firstSheetName];
|
||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
|
||
|
||
if (jsonData.length === 0) {
|
||
resolve({ valid: false, message: 'Excel文件为空' });
|
||
return;
|
||
}
|
||
|
||
const headers = jsonData[0].map(h => String(h).trim());
|
||
const requiredHeaders = ['型号', '规格', '标准', '电压等级'];
|
||
const missingHeaders = requiredHeaders.filter(h => !headers.includes(h));
|
||
|
||
if (missingHeaders.length > 0) {
|
||
resolve({ valid: false, message: `缺少必要栏目:${missingHeaders.join(', ')}` });
|
||
return;
|
||
}
|
||
|
||
resolve({ valid: true });
|
||
} catch (err) {
|
||
resolve({ valid: false, message: '读取Excel文件失败' });
|
||
}
|
||
};
|
||
reader.onerror = () => resolve({ valid: false, message: '读取文件失败' });
|
||
reader.readAsArrayBuffer(file);
|
||
});
|
||
};
|
||
|
||
const handleFileChange = async (file, fileList) => {
|
||
if (!file || !file.raw) return;
|
||
|
||
const fileName = file.raw.name;
|
||
const extension = fileName.substring(fileName.lastIndexOf('.')).toLowerCase();
|
||
|
||
if (extension !== '.xlsx' && extension !== '.xls') {
|
||
ElMessage.error('只能上传Excel文件(.xlsx, .xls)');
|
||
uploadRef.value?.clearFiles();
|
||
return;
|
||
}
|
||
|
||
const validation = await validateExcelHeaders(file.raw);
|
||
if (!validation.valid) {
|
||
ElMessage.error(validation.message);
|
||
uploadRef.value?.clearFiles();
|
||
return;
|
||
}
|
||
|
||
queryConditions.fileName = fileName;
|
||
|
||
const base64 = await readExcelAsBase64(file.raw);
|
||
queryConditions.fileContent = base64;
|
||
|
||
ElMessage.success('文件上传成功');
|
||
};
|
||
|
||
const handleFileRemove = () => {
|
||
queryConditions.fileName = '';
|
||
queryConditions.fileContent = '';
|
||
};
|
||
|
||
const initOptionsData = () => {
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetJGBOptions',
|
||
false,
|
||
'',
|
||
(result) => {
|
||
if (!result || result.length === 0) {
|
||
jgbOptions.value = [];
|
||
queryConditions.jgbid = '';
|
||
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || '',
|
||
Standard: queryConditions.standard || '',
|
||
Specification: queryConditions.specification || '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: queryConditions.orderOption || '',
|
||
PageSize: queryConditions.pageSize || 5000,
|
||
PageNum: queryConditions.pageNum || 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
loadOtherOptions(condition);
|
||
return;
|
||
}
|
||
jgbOptions.value = result.map(item => ({
|
||
value: item.Code, // 注意大小写
|
||
label: item.Name
|
||
}));
|
||
queryConditions.jgbid = result[0].Code;
|
||
console.log(result[0].Code)
|
||
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || '',
|
||
Standard: queryConditions.standard || '',
|
||
Specification: queryConditions.specification || '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: queryConditions.orderOption || '',
|
||
PageSize: queryConditions.pageSize || 5000,
|
||
PageNum: queryConditions.pageNum || 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
loadOtherOptions(condition);
|
||
}
|
||
);
|
||
};
|
||
|
||
const loadOtherOptions = (condition) => {
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetStructureWeightTableOptions',
|
||
false,
|
||
{ conditon: condition },
|
||
(result) => {
|
||
const allowedCodes = new Set(BJU061.split(',').map(code => code.trim()));
|
||
// 2. 过滤结果:排除Code不在允许列表中的项,得到过滤后的有效数据
|
||
const filteredResult =BJU061==''?result: result ? result.filter(item => allowedCodes.has(item.Code.split('|')[0])) : [];
|
||
if (!filteredResult) {
|
||
jgczbOptions.value = [];
|
||
return;
|
||
}
|
||
jgczbOptions.value = filteredResult.map(item => ({
|
||
value: item.Code, // 注意大小写
|
||
label: item.Name
|
||
}));
|
||
}
|
||
);
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetStandardOptions',
|
||
false,
|
||
false,
|
||
(result) => {
|
||
if (!result) {
|
||
standardOptions.value = [];
|
||
return;
|
||
}
|
||
standardOptions.value = result.map(item => ({
|
||
value: item.Code, // 注意大小写
|
||
label: item.Name
|
||
}));
|
||
}
|
||
);
|
||
|
||
xhOptions.value = [];
|
||
filteredXhOptions.value = [];
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetVoltageLevelOptions',
|
||
false,
|
||
{ conditon: condition },
|
||
(result) => {
|
||
if (!result) {
|
||
dydjOptions.value = [];
|
||
return;
|
||
}
|
||
dydjOptions.value = result.map(item => ({
|
||
value: item.Code, // 注意大小写
|
||
label: item.Name
|
||
}));
|
||
}
|
||
);
|
||
};
|
||
|
||
const remoteSearchModel = (query) => {
|
||
if (!query) {
|
||
filteredXhOptions.value = [];
|
||
xhOptions.value = [];
|
||
return;
|
||
}
|
||
|
||
modelLoading.value = true;
|
||
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: query,
|
||
VoltageLevel: '',
|
||
Standard: '',
|
||
Specification: '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: '',
|
||
PageSize: 100,
|
||
PageNum: 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetModelOptions',
|
||
false,
|
||
{ conditon: condition },
|
||
(result) => {
|
||
modelLoading.value = false;
|
||
if (!result) {
|
||
filteredXhOptions.value = [];
|
||
return;
|
||
}
|
||
const options = result.map(item => ({
|
||
value: item.Code,
|
||
label: item.Name
|
||
}));
|
||
filteredXhOptions.value = options;
|
||
xhOptions.value = [...options];
|
||
}
|
||
);
|
||
};
|
||
|
||
const handleStructureWeightChange = (val) => {
|
||
if (!val) return;
|
||
const arr = val.split('|');
|
||
queryConditions.structureWeightTableCode = arr[0] || '';
|
||
queryConditions.structureWeightTableVersion = arr[1] || '';
|
||
const condition = {
|
||
StructureWeightTableCode: queryConditions.structureWeightTableCode || '',
|
||
StructureWeightTableVersion: queryConditions.structureWeightTableVersion || '',
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || '',
|
||
Standard: queryConditions.standard || '',
|
||
Specification: queryConditions.specification || '',
|
||
ISHSJGCheck: queryConditions.iSHSJGCheck ? 'Y' : 'N',
|
||
ISWLCBCheck: queryConditions.iSWLCBCheck ? 'Y' : 'N',
|
||
OrderOption: queryConditions.orderOption || '',
|
||
PageSize: queryConditions.pageSize || 5000,
|
||
PageNum: queryConditions.pageNum || 0,
|
||
JGBID: queryConditions.jgbid || '',
|
||
ISDRCX:queryConditions.iSDRCX,
|
||
FileContent:queryConditions.fileContent,
|
||
FileName:queryConditions.fileName
|
||
};
|
||
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
|
||
xhOptions.value = [];
|
||
filteredXhOptions.value = [];
|
||
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetVoltageLevelOptions',
|
||
false,
|
||
{ conditon: condition },
|
||
(result) => {
|
||
if (!result) {
|
||
dydjOptions.value = [];
|
||
return;
|
||
}
|
||
dydjOptions.value = result.map(item => ({
|
||
value: item.Code, // 注意大小写
|
||
label: item.Name
|
||
}));
|
||
}
|
||
);
|
||
|
||
|
||
|
||
|
||
|
||
};
|
||
|
||
const loadStructureWeightTableOptions = () => {
|
||
const condition = {
|
||
Models: Array.isArray(queryConditions.models)
|
||
? queryConditions.models.join(',')
|
||
: (queryConditions.models || ''),
|
||
VoltageLevel: queryConditions.voltageLevel || ''
|
||
};
|
||
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'GetStructureWeightTableOptions',
|
||
false,
|
||
{ conditon: condition },
|
||
(result) => {
|
||
const allowedCodes = new Set(BJU061.split(',').map(code => code.trim()));
|
||
// 2. 过滤结果:排除Code不在允许列表中的项,得到过滤后的有效数据
|
||
const filteredResult =BJU061==''?result:result ? result.filter(item => allowedCodes.has(item.Code.split('|')[0])) : [];
|
||
|
||
|
||
if (!filteredResult || filteredResult.length === 0) {
|
||
jgczbOptions.value = [];
|
||
queryConditions.structureWeightTableValue = '';
|
||
queryConditions.structureWeightTableCode = '';
|
||
queryConditions.structureWeightTableVersion = '';
|
||
return;
|
||
}
|
||
|
||
jgczbOptions.value = filteredResult.map(item => ({
|
||
value: item.Code,
|
||
label: item.Name
|
||
}));
|
||
|
||
if (filteredResult.length === 1) {
|
||
queryConditions.structureWeightTableValue = filteredResult[0].Code;
|
||
const arr = filteredResult[0].Code.split('|');
|
||
queryConditions.structureWeightTableCode = arr[0] || '';
|
||
queryConditions.structureWeightTableVersion = arr[1] || '';
|
||
} else {
|
||
queryConditions.structureWeightTableValue = '';
|
||
queryConditions.structureWeightTableCode = '';
|
||
queryConditions.structureWeightTableVersion = '';
|
||
}
|
||
}
|
||
);
|
||
};
|
||
|
||
const handleModelChange = () => {
|
||
loadStructureWeightTableOptions();
|
||
};
|
||
|
||
const handleVoltageLevelChange = () => {
|
||
loadStructureWeightTableOptions();
|
||
};
|
||
|
||
/* ===== 自适应 ===== */
|
||
|
||
|
||
|
||
const checkEnableSJDC = () => {
|
||
GThinking.Web.AjaxServiceProxy.servicePath = 'S_XLXSBJ/102373017.ashx';
|
||
GThinking.Web.AjaxServiceProxy.invoke(
|
||
'EnableSJDC',
|
||
false,
|
||
'',
|
||
(result) => {
|
||
enableSJDC.value = result === true;
|
||
}
|
||
);
|
||
};
|
||
|
||
onMounted(() => {
|
||
calcTableSize();
|
||
generateColumns();
|
||
checkEnableSJDC();
|
||
initOptionsData();
|
||
|
||
});
|
||
|
||
onBeforeUnmount(() => {
|
||
|
||
});
|
||
|
||
return {
|
||
loading,
|
||
enableSJDC,
|
||
queryDrawerVisible,
|
||
tableContainer,
|
||
jgbOptions,
|
||
|
||
tableWidth,
|
||
tableHeight,
|
||
tableVersion,
|
||
columns,
|
||
sjdc,
|
||
handleRowDblClick,
|
||
detailDialogVisible,
|
||
detailBasicInfo,
|
||
detailMaterialList,
|
||
rowEventHandlers,
|
||
currentPage,
|
||
pageSize,
|
||
total,
|
||
pagedData,
|
||
handleSizeChange,
|
||
handleCurrentChange,
|
||
dicCLMC,
|
||
dicCLJG,
|
||
dicCLWL,
|
||
buildDynamicMaterialColumns,
|
||
|
||
queryConditions,
|
||
jgczbOptions,
|
||
xhOptions,
|
||
filteredXhOptions,
|
||
modelLoading,
|
||
standardOptions,
|
||
dydjOptions,
|
||
pxfsOptions,
|
||
handleStructureWeightChange,
|
||
handleModelChange,
|
||
handleVoltageLevelChange,
|
||
remoteSearchModel,
|
||
getDic,
|
||
calcTableSize,
|
||
|
||
handleResetFilter,
|
||
confirmQueryDrawer,
|
||
openQueryDrawer,
|
||
uploadRef,
|
||
handleFileChange,
|
||
handleFileRemove
|
||
};
|
||
}
|
||
});
|
||
|
||
app.use(ElementPlus);
|
||
app.mount('#app'); |