|
|
@@ -270,6 +270,10 @@ const props = defineProps({
|
|
|
type: Array,
|
|
|
default: () => ([]),
|
|
|
},
|
|
|
+ planYear: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//事件
|
|
|
@@ -280,7 +284,16 @@ const isAdminAuth = ref(props.isAdmin)
|
|
|
watch(() => props.isAdmin, (admin) => {
|
|
|
isAdminAuth.value = admin
|
|
|
})
|
|
|
+//分页搜索的年份
|
|
|
+const planYearData = ref(props.planYear)
|
|
|
+watch(() => props.planYear, (year) => {
|
|
|
+
|
|
|
+
|
|
|
+ planYearData.value = year
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+})
|
|
|
//渲染完成
|
|
|
const currentYear = ref('')
|
|
|
const isAfterRender = ref(false)
|
|
|
@@ -288,6 +301,8 @@ onMounted(() => {
|
|
|
//表格太复杂,渲染较慢,等页面先加载完成,再渲染表格,不然会卡住一下不动。
|
|
|
//因为表头涉及到年份,如果年份很多,那么会更卡。
|
|
|
currentYear.value = new dayjs().format('YYYY')
|
|
|
+
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
isAfterRender.value = true
|
|
|
}, 200)
|
|
|
@@ -374,18 +389,33 @@ const getDetailData = async (id) => {
|
|
|
//设置默认数据
|
|
|
if (list.length > 0) {
|
|
|
let isIndex = false
|
|
|
+ // for (let i = 0; i < list.length; i++) {
|
|
|
+ // const planYear = list[i].planYear.toString()
|
|
|
+ // if (planYear === currentYear.value) {
|
|
|
+ // yearIndex.value = i
|
|
|
+ // yearKey.value = list[i].planYear
|
|
|
+ // console.log( yearKey.value, ' yearKey.value')
|
|
|
+
|
|
|
+
|
|
|
+ // isIndex = true
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
const planYear = list[i].planYear.toString()
|
|
|
- if (planYear === currentYear.value) {
|
|
|
+ if (planYear === planYearData.value) {
|
|
|
+ yearKey.value = planYearData.value
|
|
|
yearIndex.value = i
|
|
|
- yearKey.value = list[i].planYear
|
|
|
isIndex = true
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
//默认值
|
|
|
if (!isIndex) {
|
|
|
yearIndex.value = 0
|
|
|
yearKey.value = list[0].planYear
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
} else {
|
|
|
yearIndex.value = -1
|