项目编号新增排序功能

This commit is contained in:
zhangsir
2024-10-11 10:00:25 +08:00
parent d6794b338d
commit d9d694b214

View File

@@ -31,13 +31,22 @@ const handleChange = (value,option)=>{
onMounted(() => {
// console.log(store.state.project_number,'store.state.project_number')
});
const options = computed(()=>store.state.project_number.map(e => {
return{
const options = computed(() => {
const projectNumberList = store.state.project_number;
const sortedList = projectNumberList.sort((a, b) => {
if (a.sort !== b.sort) {
return a.sort - b.sort;
}
const aTimestamp = Date.parse(a.createTime);
const bTimestamp = Date.parse(b.createTime);
return bTimestamp - aTimestamp;
});
return sortedList.map(e => ({
value: e.value + e.name,
label: ' 【 ' + e.value + ' 】 ' + e.name,
searchData: e.value
}
}))
}));
});
</script>
<style lang="scss" scoped>