This commit is contained in:
yunkexin 2026-01-19 15:17:10 +08:00
parent 2768f45e03
commit 3a6985d6fa
3 changed files with 83 additions and 53 deletions

View File

@ -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()

View File

@ -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"
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()
},

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB