From a90a8ab907c2575180aceb32a4785697182483f1 Mon Sep 17 00:00:00 2001 From: yunkexin <760754045@qq.com> Date: Thu, 8 Jan 2026 11:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E9=80=9A=E7=9F=A5=20?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E8=AE=B0=E5=BD=95=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/apply/subPages/SE/1trainNotifyEdit.vue | 195 ++++++++++--------- pages/apply/subPages/SE/1trainNotifyShow.vue | 65 +++++-- pages/apply/subPages/SE/2trainRecordEdit.vue | 63 ++++-- pages/apply/subPages/SE/2trainRecordShow.vue | 67 +++++-- 4 files changed, 244 insertions(+), 146 deletions(-) diff --git a/pages/apply/subPages/SE/1trainNotifyEdit.vue b/pages/apply/subPages/SE/1trainNotifyEdit.vue index 6af6fab..07eb3ea 100644 --- a/pages/apply/subPages/SE/1trainNotifyEdit.vue +++ b/pages/apply/subPages/SE/1trainNotifyEdit.vue @@ -3,71 +3,51 @@ - + - + - - + + - - + + - - + - - + - + - + - + - - + + - - + + - + - + @@ -76,52 +56,37 @@ - - + + - + - - + + 附件 - + - + - + - - + + - - - + + + 提交 @@ -145,7 +110,7 @@ } from '../../../../services/apply/FOServices/FOServices'; import { getEnum - } from '../../../../services/common' + } from '../../../../services/common'; export default { data() { return { @@ -266,21 +231,65 @@ name: '' }, formatter: null, + enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表) + enumsText: {}, // 存储枚举文本列表(用于下拉选择等场景) } }, onLoad(option) { this.TaskID = option.taskID ? option.taskID : ''; this.model.ID = option.ID ? option.ID : ''; this.tableKey = option.tableKey ? option.tableKey : '0'; - if (option.isAdd != 1) { - this.loadData(); - } else { - this.isAdd = 1; - this.model.ID = guid(); - this.model.CREATE_NOTIFY_RECORD = true; - } + this.fetchEnums(['TrainType', 'PlanCheckType']); + this.isAdd = option.isAdd + }, methods: { + async fetchEnums(enumNames) { + try { + // 存储所有枚举请求的Promise + const enumPromises = enumNames.map(name => { + return getEnum({ + name + }).then(res => { + // 统一处理枚举格式:添加name/code字段,便于后续映射 + return { + enumName: name, + data: res.map(item => ({ + ...item, + name: item.NAME, // 统一显示名称字段 + code: item.ID // 统一值字段 + })) + }; + }); + }); + + // 等待所有枚举请求完成 + const results = await Promise.all(enumPromises); + // 存储枚举结果到data中(键为枚举名称,值为处理后的数据) + results.forEach(({ + enumName, + data + }) => { + this.enumsData[enumName] = data; + // 生成文本列表(如需要) + this.enumsText[enumName] = data.map(item => item.name); + }); + // 所有枚举获取完成后,执行loadData + if (this.isAdd != 1) { + this.loadData(); + } else { + this.isAdd = 1; + this.model.ID = guid(); + this.model.CREATE_NOTIFY_RECORD = true; + } + } catch (error) { + console.error('枚举请求失败:', error); + uni.showToast({ + title: '枚举数据加载失败', + icon: 'none' + }); + } + }, changeSwitch(e) { this.model.CREATE_NOTIFY_RECORD = e; }, @@ -352,10 +361,7 @@ }) }) } else if (this.currSearchType == "Nav_TrainCheckType") { - var dataParm = { - 'name': "PlanCheckType" - } - getEnum(dataParm).then(res => { + getRequest(json, "/SE/TrainCheckTypeEnum/OrderPaged").then(res => { this.Lists = res.map(i => { return { ...i, @@ -363,14 +369,6 @@ } }) }) - // getRequest(json, "/SE/TrainCheckTypeEnum/OrderPaged").then(res => { - // this.Lists = res.map(i => { - // return { - // ...i, - // name: i.NAME, - // } - // }) - // }) } else if (this.currSearchType == "Nav_RecordUser") { getRequest(json, "/FM/FMUser/OrderPagedUseful").then(res => { this.Lists = res.map(i => { @@ -390,7 +388,7 @@ this.model.TRAIN_TYPE = val.ID; } else if (this.currSearchType == 'Nav_TrainCheckType') { this.model.Nav_TrainCheckType = val; - this.model.CHECKTYPE = val.ID; + this.model.CHECK_TYPE_ID = val.ID; } else if (this.currSearchType == 'Nav_RecordUser') { this.model.Nav_RecordUser = val; this.model.RECORD_USER_ID = val.ID; @@ -517,7 +515,7 @@ extendInclude(json, "Nav_TrainContentList.Nav_Point") extendInclude(json, "Nav_LaunchDepartment") extendInclude(json, "Nav_TrainType") - // extendInclude(json, "Nav_TrainCheckType") + extendInclude(json, "Nav_TrainCheckType") extendInclude(json, "Nav_RecordUser") extendInclude(json, "Nav_TrainContentList") extendInclude(json, "Nav_TrainUserList.Nav_User.Nav_Person") @@ -527,6 +525,8 @@ getRequest(json, "/SE/TrainNotify/Get").then(res => { this.model = res this.model.LEVEL_SHOW = this.transLevel(this.model.LEVEL) + this.model.TRAINTYPE_SHOW = res.TRAINTYPE !== undefined ? this.enumsData['TrainType'].find(item => item.code === res.TRAINTYPE).name : ''; + this.model.CHECKTYPE_SHOW = res.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === res.CHECKTYPE).name : ''; }) }, closePicker() { @@ -588,6 +588,8 @@ ID: 1 }, ] + } else if (p.name == 'TrainType' || p.name == 'PlanCheckType') { + column = this.enumsData[p.name] } if (column.length) { this.comPickerInfo = { @@ -606,8 +608,19 @@ name, formIndex } = this.comPickerInfo - this.model[name] = e.value[0].ID + if(name == 'TrainType'){ + this.model.TRAINTYPE_SHOW = e.value[0].name + this.model.TRAINTYPE = this.enumsData['TrainType'][e.indexs[0]].code + }else if(name == 'PlanCheckType'){ + this.model.CHECKTYPE_SHOW = e.value[0].name + this.model.CHECKTYPE = this.enumsData['PlanCheckType'][e.indexs[0]].code + }else{ + this.model[name] = e.value[0].ID this.model[name + '_SHOW'] = e.value[0].NAME + } + + + this.comPickerInfo.showSheet = false }, transLevel(level) { diff --git a/pages/apply/subPages/SE/1trainNotifyShow.vue b/pages/apply/subPages/SE/1trainNotifyShow.vue index 46d5d08..163d651 100644 --- a/pages/apply/subPages/SE/1trainNotifyShow.vue +++ b/pages/apply/subPages/SE/1trainNotifyShow.vue @@ -49,11 +49,11 @@ disabledColor="#ffffff" fontSize="14px"> - - @@ -117,30 +117,56 @@ orgId: uni.getStorageSync('orgId'), listPropUpload: ['NOTIFY_ID'], listPropValUpload: [], - Lists: [], + enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表) + enumsText: {}, // 存储枚举文本列表(用于下拉选择等场景) } }, onLoad(option) { this.model.ID = option.ID; this.TaskID = option.taskID; this.tableKey = option.tableKey ? option.tableKey : '0' - - this.getEnums() + this.fetchEnums(['TrainType', 'PlanCheckType']); }, methods: { - getEnums(){ - var dataParm = { - 'name': "PlanCheckType" + async fetchEnums(enumNames) { + try { + // 存储所有枚举请求的Promise + const enumPromises = enumNames.map(name => { + return getEnum({ + name + }).then(res => { + // 统一处理枚举格式:添加name/code字段,便于后续映射 + return { + enumName: name, + data: res.map(item => ({ + ...item, + name: item.NAME, // 统一显示名称字段 + code: item.ID // 统一值字段 + })) + }; + }); + }); + + // 等待所有枚举请求完成 + const results = await Promise.all(enumPromises); + // 存储枚举结果到data中(键为枚举名称,值为处理后的数据) + results.forEach(({ + enumName, + data + }) => { + this.enumsData[enumName] = data; + // 生成文本列表(如需要) + this.enumsText[enumName] = data.map(item => item.name); + }); + // 所有枚举获取完成后,执行loadData + this.loadData(); + } catch (error) { + console.error('枚举请求失败:', error); + uni.showToast({ + title: '枚举数据加载失败', + icon: 'none' + }); } - getEnum(dataParm).then(res => { - this.Lists = res.map(i => { - return { - ...i, - name: i.NAME, - } - }) - this.loadData() - }) }, loadData() { const json = initFilter(this.orgId, "", "CODE", 1) @@ -148,7 +174,7 @@ extendInclude(json, 'Nav_LaunchDepartment'); extendInclude(json, 'Nav_LaunchUser'); extendInclude(json, 'Nav_TrainType'); - // extendInclude(json, 'Nav_TrainCheckType'); + extendInclude(json, 'Nav_TrainCheckType'); extendInclude(json, 'Nav_TrainContentList'); extendInclude(json, 'Nav_TrainContentList.Nav_Point'); extendInclude(json, 'Nav_TrainUserList'); @@ -180,11 +206,12 @@ } } } - this.model.CHECKTYPE_NAME = res.CHECKTYPE !== undefined ? this.Lists.find(item => item.ID === res.CHECKTYPE).name : ''; this.model.TRAIN_MODEL = this.returnModel(this.model.TRAIN_MODEL); this.model.LEVEL = this.transLevel(this.model.LEVEL); this.model.TRAINCONTENT = trainContent; this.model.users = users; + this.model.TRAINTYPE_SHOW = res.TRAINTYPE !== undefined ? this.enumsData['TrainType'].find(item => item.code === res.TRAINTYPE).name : ''; + this.model.CHECKTYPE_SHOW = res.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === res.CHECKTYPE).name : ''; this.isLoadOK = true; }) }, diff --git a/pages/apply/subPages/SE/2trainRecordEdit.vue b/pages/apply/subPages/SE/2trainRecordEdit.vue index e07c7f6..866758e 100644 --- a/pages/apply/subPages/SE/2trainRecordEdit.vue +++ b/pages/apply/subPages/SE/2trainRecordEdit.vue @@ -51,11 +51,11 @@ slot="right" inputAlign="right" fontSize="14px"> - - @@ -163,28 +163,56 @@ }, currItem: '', formatter: null, + enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表) + enumsText: {}, // 存储枚举文本列表(用于下拉选择等场景) } }, onLoad(option) { this.TaskID = option.taskID ? option.taskID : ''; this.model.ID = option.ID ? option.ID : ''; this.tableKey = option.tableKey ? option.tableKey : '0'; - this.getEnums(); + this.fetchEnums(['TrainType', 'PlanCheckType']); }, methods: { - getEnums(){ - var dataParm = { - 'name': "PlanCheckType" + async fetchEnums(enumNames) { + try { + // 存储所有枚举请求的Promise + const enumPromises = enumNames.map(name => { + return getEnum({ + name + }).then(res => { + // 统一处理枚举格式:添加name/code字段,便于后续映射 + return { + enumName: name, + data: res.map(item => ({ + ...item, + name: item.NAME, // 统一显示名称字段 + code: item.ID // 统一值字段 + })) + }; + }); + }); + + // 等待所有枚举请求完成 + const results = await Promise.all(enumPromises); + // 存储枚举结果到data中(键为枚举名称,值为处理后的数据) + results.forEach(({ + enumName, + data + }) => { + this.enumsData[enumName] = data; + // 生成文本列表(如需要) + this.enumsText[enumName] = data.map(item => item.name); + }); + // 所有枚举获取完成后,执行loadData + this.loadData(); + } catch (error) { + console.error('枚举请求失败:', error); + uni.showToast({ + title: '枚举数据加载失败', + icon: 'none' + }); } - getEnum(dataParm).then(res => { - this.Lists = res.map(i => { - return { - ...i, - name: i.NAME, - } - }) - this.loadData() - }) }, sectionChange(index, item) { item.STATUS = index; @@ -240,7 +268,7 @@ extendInclude(json, "Nav_Notify") extendInclude(json, "Nav_Notify.Nav_TrainType") extendInclude(json, "Nav_Notify.Nav_LaunchDepartment") - // extendInclude(json, "Nav_Notify.Nav_TrainCheckType") + extendInclude(json, "Nav_Notify.Nav_TrainCheckType") extendInclude(json, "Nav_Notify.Nav_TrainContentList.Nav_Point") extendInclude(json, "Nav_Files.Nav_ImgFile") extendRule(json, 'ID', 1, this.model.ID) @@ -255,6 +283,8 @@ } else if (this.model.Nav_Notify.LEVEL == 3) { this.model.Nav_Notify.LEVEL_SHOW = "公司"; } + this.model.Nav_Notify.TRAINTYPE_SHOW = res.Nav_Notify.TRAINTYPE !== undefined ? this.enumsData['TrainType'].find(item => item.code === res.Nav_Notify.TRAINTYPE).name : ''; + this.model.Nav_Notify.CHECKTYPE_SHOW = res.Nav_Notify.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === res.Nav_Notify.CHECKTYPE).name : ''; this.model.Nav_Notify.TRAIN_MODEL_SHOW = ""; if (this.model.Nav_Notify.TRAIN_MODEL.indexOf(1) > 0) { this.model.Nav_Notify.TRAIN_MODEL_SHOW += "讲授法 "; @@ -265,7 +295,6 @@ } else if (this.model.Nav_Notify.TRAIN_MODEL.indexOf(4) > 0) { this.model.Nav_Notify.TRAIN_MODEL_SHOW += "演示法 "; } - this.model.Nav_Notify.CHECKTYPE_NAME = res.Nav_Notify.CHECKTYPE !== undefined ? this.Lists.find(item => item.ID === res.Nav_Notify.CHECKTYPE).name : ''; this.model.Nav_TrainContentList_SHOW = ""; for (let i = 0; i < this.model.Nav_Notify.Nav_TrainContentList.length; i++) { this.model.Nav_TrainContentList_SHOW += (i + 1) + "." + this.model.Nav_Notify diff --git a/pages/apply/subPages/SE/2trainRecordShow.vue b/pages/apply/subPages/SE/2trainRecordShow.vue index 1a7cf72..38f2619 100644 --- a/pages/apply/subPages/SE/2trainRecordShow.vue +++ b/pages/apply/subPages/SE/2trainRecordShow.vue @@ -29,10 +29,10 @@ - + - + @@ -52,7 +52,7 @@ - 查看试卷 + 查看试卷 @@ -93,29 +93,57 @@ listPropUpload: ['RECORD_ID'], listPropValUpload: [], isAgree: false, - Lists:[] + enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表) + enumsText: {}, // 存储枚举文本列表(用于下拉选择等场景) } }, onLoad(option) { this.model.ID = option.ID; this.TaskID = option.taskID; this.tableKey = option.tableKey ? option.tableKey : '0' - this.getEnums() + this.fetchEnums(['TrainType', 'PlanCheckType']); + }, methods: { - getEnums(){ - var dataParm = { - 'name': "PlanCheckType" + async fetchEnums(enumNames) { + try { + // 存储所有枚举请求的Promise + const enumPromises = enumNames.map(name => { + return getEnum({ + name + }).then(res => { + // 统一处理枚举格式:添加name/code字段,便于后续映射 + return { + enumName: name, + data: res.map(item => ({ + ...item, + name: item.NAME, // 统一显示名称字段 + code: item.ID // 统一值字段 + })) + }; + }); + }); + + // 等待所有枚举请求完成 + const results = await Promise.all(enumPromises); + // 存储枚举结果到data中(键为枚举名称,值为处理后的数据) + results.forEach(({ + enumName, + data + }) => { + this.enumsData[enumName] = data; + // 生成文本列表(如需要) + this.enumsText[enumName] = data.map(item => item.name); + }); + // 所有枚举获取完成后,执行loadData + this.loadData(); + } catch (error) { + console.error('枚举请求失败:', error); + uni.showToast({ + title: '枚举数据加载失败', + icon: 'none' + }); } - getEnum(dataParm).then(res => { - this.Lists = res.map(i => { - return { - ...i, - name: i.NAME, - } - }) - this.loadData() - }) }, loadData() { const json = initFilter(this.ORG_ID, "", "", 1) @@ -123,7 +151,7 @@ extendInclude(json, 'Nav_Notify.Nav_LaunchDepartment'); extendInclude(json, 'Nav_Notify.Nav_LaunchUser'); extendInclude(json, 'Nav_Notify.Nav_TrainType'); - // extendInclude(json, 'Nav_Notify.Nav_TrainCheckType'); + extendInclude(json, 'Nav_Notify.Nav_TrainCheckType'); extendInclude(json, 'Nav_Notify.Nav_TrainContentList'); extendInclude(json, 'Nav_Notify.Nav_TrainContentList.Nav_Point'); extendInclude(json, 'Nav_Users.Nav_User'); @@ -174,7 +202,8 @@ } } - this.model.Nav_Notify.CHECKTYPE_NAME = res.Nav_Notify.CHECKTYPE !== undefined ? this.Lists.find(item => item.ID === res.Nav_Notify.CHECKTYPE).name : ''; + this.model.Nav_Notify.TRAINTYPE_SHOW = res.Nav_Notify.TRAINTYPE !== undefined ? this.enumsData['TrainType'].find(item => item.code === res.Nav_Notify.TRAINTYPE).name : ''; + this.model.Nav_Notify.CHECKTYPE_SHOW = res.Nav_Notify.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === res.Nav_Notify.CHECKTYPE).name : ''; this.model.TRAIN_MODEL = this.returnModel(this.model.Nav_Notify.TRAIN_MODEL); this.model.LEVEL = this.transLevel(this.model.Nav_Notify.LEVEL); this.model.TRAIN_TIME = this.model.Nav_Notify.TRAIN_START_TIME?.substring(0, 16) + "~" + this