项目编号新增排序功能

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(() => { onMounted(() => {
// console.log(store.state.project_number,'store.state.project_number') // console.log(store.state.project_number,'store.state.project_number')
}); });
const options = computed(()=>store.state.project_number.map(e => { const options = computed(() => {
return{ 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, value: e.value + e.name,
label: ' 【 ' + e.value + ' 】 ' + e.name, label: ' 【 ' + e.value + ' 】 ' + e.name,
searchData: e.value searchData: e.value
} }));
})) });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>