list
This commit is contained in:
parent
2768f45e03
commit
3a6985d6fa
@ -37,7 +37,7 @@
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">考核方式:</text>
|
||||
<text class="value">{{item.CHECKTYPE_NAME}}</text>
|
||||
<text class="value">{{item.CHECKTYPE_SHOW}}</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">状态:</text>
|
||||
@ -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()
|
||||
|
||||
@ -6,8 +6,7 @@
|
||||
<text>{{dateFilterTxt}}</text>
|
||||
<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
|
||||
</view>
|
||||
<uni-search-bar class="search-bar" radius="100" v-model="keyword" @confirm="handleSearch"
|
||||
@cancel="handleCancelSearch" @clear="handleCancelSearch" placeholder="搜索" cancel-button="none">
|
||||
<uni-search-bar class="search-bar" radius="100" v-model="keyword" @confirm="handleSearch" @cancel="handleCancelSearch" @clear="handleCancelSearch" placeholder="搜索" cancel-button="none">
|
||||
<uni-icons slot="searchIcon" color="#999999" size="16" type="search" class="search-slot" />
|
||||
</uni-search-bar>
|
||||
<view class="filter filter-status" @click="handleShowPicker({title: '状态', name: 'status'})">
|
||||
@ -22,8 +21,7 @@
|
||||
<view>
|
||||
<view class="field">
|
||||
<text class="label">记录人:</text>
|
||||
<text
|
||||
class="value">{{item.Nav_Notify.Nav_RecordUser?item.Nav_Notify.Nav_RecordUser.NAME:''}}</text>
|
||||
<text class="value">{{item.Nav_Notify.Nav_RecordUser?item.Nav_Notify.Nav_RecordUser.NAME:''}}</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">培训类型:</text>
|
||||
@ -39,7 +37,7 @@
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">考核方式:</text>
|
||||
<text class="value">{{item.Nav_Notify.CHECKTYPE_NAME}}</text>
|
||||
<text class="value">{{item.CHECKTYPE_SHOW}}</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">状态:</text>
|
||||
@ -53,8 +51,7 @@
|
||||
</u-empty>
|
||||
</view>
|
||||
</view>
|
||||
<u-picker :show="comPickerInfo.showPicker" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
|
||||
:defaultIndex="[0]" @cancel="closePicker"></u-picker>
|
||||
<u-picker :show="comPickerInfo.showPicker" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" :defaultIndex="[0]" @cancel="closePicker"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -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"
|
||||
}
|
||||
getEnum(dataParm).then(res => {
|
||||
this.Lists = res.map(i => {
|
||||
async fetchEnums(enumNames) {
|
||||
try {
|
||||
// 存储所有枚举请求的Promise
|
||||
const enumPromises = enumNames.map(name => {
|
||||
return getEnum({
|
||||
name
|
||||
}).then(res => {
|
||||
// 统一处理枚举格式:添加name/code字段,便于后续映射
|
||||
return {
|
||||
...i,
|
||||
name: i.NAME,
|
||||
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'
|
||||
});
|
||||
}
|
||||
})
|
||||
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()
|
||||
},
|
||||
|
||||
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Loading…
Reference in New Issue
Block a user