diff --git a/pages/apply/subPages/SE/1trainNotifyList.vue b/pages/apply/subPages/SE/1trainNotifyList.vue index 2722819..78b572c 100644 --- a/pages/apply/subPages/SE/1trainNotifyList.vue +++ b/pages/apply/subPages/SE/1trainNotifyList.vue @@ -37,7 +37,7 @@ 考核方式: - {{item.CHECKTYPE_NAME}} + {{item.CHECKTYPE_SHOW}} 状态: @@ -161,8 +161,8 @@ return { ...i, title: i.NAME, - STATUS: i.STATUS !== undefined ? this.enumsData['SETrainNotifyStatus'].find(item => item.code === i.STATUS).name : '', - CHECKTYPE_NAME:i.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === i.CHECKTYPE).name : '', + STATUS: i.STATUS !== undefined ? this.enumsData['SETrainNotifyStatus'].find(item => item.code === i.STATUS)?.name : '', + CHECKTYPE_SHOW :i.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === i.CHECKTYPE)?.name : '' } }) @@ -184,7 +184,12 @@ column = ['全部', '当天', '最近三天', '最近一周', '最近一月'] } if (p.name === 'status') { - column = this.enumsText['SETrainNotifyStatus'] + let arr = [] + arr.push('全部') + this.enumsText['SETrainNotifyStatus'].map(item=>{ + arr.push(item) + }) + column =arr } this.comPickerInfo = { showPicker: true, @@ -212,7 +217,11 @@ } } if (this.comPickerInfo.name === 'status') { - this.filterStatus = this.enumsData['SETrainNotifyStatus'][e.indexs[0]].code + if (e.value[0] == '全部') { + this.filterStatus = null + } else { + this.filterStatus = this.enumsData['SETrainNotifyStatus'][e.indexs[0]-1].code + } this.statusFilterTxt = e.value[0] } this.closePicker() diff --git a/pages/apply/subPages/SE/2trainRecordList.vue b/pages/apply/subPages/SE/2trainRecordList.vue index d35e121..2c44347 100644 --- a/pages/apply/subPages/SE/2trainRecordList.vue +++ b/pages/apply/subPages/SE/2trainRecordList.vue @@ -6,8 +6,7 @@ {{dateFilterTxt}} - + @@ -22,8 +21,7 @@ 记录人: - {{item.Nav_Notify.Nav_RecordUser?item.Nav_Notify.Nav_RecordUser.NAME:''}} + {{item.Nav_Notify.Nav_RecordUser?item.Nav_Notify.Nav_RecordUser.NAME:''}} 培训类型: @@ -39,7 +37,7 @@ 考核方式: - {{item.Nav_Notify.CHECKTYPE_NAME}} + {{item.CHECKTYPE_SHOW}} 状态: @@ -53,8 +51,7 @@ - + @@ -71,6 +68,7 @@ getEnum } from '../../../../services/common'; + export default { data() { return { @@ -88,26 +86,53 @@ title: '', name: '' }, - Lists:[] + enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表) + enumsText: {} // 存储枚举文本列表(用于下拉选择等场景) } }, onLoad() { - this.getEnums() + this.fetchEnums(['SETrainRecordStatus', '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() - }) }, handleSearch(obj) { this.keyword = obj.value @@ -133,22 +158,23 @@ } getRequestOrderPage(json, "/SE/TrainRecord/OrderPaged").then(res => { this.total = res.TotalCount; - for (let i = 0; i < res.Data.length; i++) { - if (res.Data[i].STATUS == 0) { - res.Data[i].STATUS = "草稿"; - } else if (res.Data[i].STATUS == 1) { - res.Data[i].STATUS = "签到中"; - } else if (res.Data[i].STATUS == 2) { - res.Data[i].STATUS = "审阅中"; - } else if (res.Data[i].STATUS == 3) { - res.Data[i].STATUS = "归档"; - } - res.Data[i].Nav_Notify.CHECKTYPE_NAME = res.Data[i].Nav_Notify.CHECKTYPE !== undefined ? this.Lists.find(item => item.ID === res.Data[i].Nav_Notify.CHECKTYPE).name : '' - } + // for (let i = 0; i < res.Data.length; i++) { + // if (res.Data[i].STATUS == 0) { + // res.Data[i].STATUS = "草稿"; + // } else if (res.Data[i].STATUS == 1) { + // res.Data[i].STATUS = "签到中"; + // } else if (res.Data[i].STATUS == 2) { + // res.Data[i].STATUS = "审阅中"; + // } else if (res.Data[i].STATUS == 3) { + // res.Data[i].STATUS = "归档"; + // } + // } let newRes = (res.Data || []).map(i => { return { ...i, title: i.Nav_Notify.NAME, + STATUS: i.STATUS !== undefined ? this.enumsData['SETrainRecordStatus'].find(item => item.code === i.STATUS)?.name : '', + CHECKTYPE_SHOW: i.Nav_Notify && i.Nav_Notify.CHECKTYPE !== undefined ? this.enumsData['PlanCheckType'].find(item => item.code === i.Nav_Notify.CHECKTYPE)?.name : '' } }) @@ -170,7 +196,12 @@ column = ['全部', '当天', '最近三天', '最近一周', '最近一月'] } if (p.name === 'status') { - column = ['全部', '草稿', '签到中', '归档'] + let arr = [] + arr.push('全部') + this.enumsText['SETrainRecordStatus'].map(item=>{ + arr.push(item) + }) + column =arr } this.comPickerInfo = { showPicker: true, @@ -198,23 +229,13 @@ } } if (this.comPickerInfo.name === 'status') { - if (e.indexs[0] === 1) { - // 草稿 0 - this.filterStatus = 0 - } else if (e.indexs[0] === 2) { - // 签到中 2 - this.filterStatus = 2 - } else if (e.indexs[0] === 3) { - // 归档 5 - this.filterStatus = 5 - } - if (e.indexs[0] === 0) { - // 全部 + if (e.value[0] == '全部') { this.filterStatus = null - this.statusFilterTxt = '状态筛选' } else { - this.statusFilterTxt = e.value[0] + this.filterStatus = this.enumsData['SETrainRecordStatus'][e.indexs[0]-1].code } + this.statusFilterTxt = e.value[0] + } this.closePicker() }, diff --git a/static/banner12.jpg b/static/banner12.png similarity index 100% rename from static/banner12.jpg rename to static/banner12.png