|
@@ -254,6 +254,7 @@ import { onMounted, ref, watch } from 'vue'
|
|
import mainApi from '~api/project/project'
|
|
import mainApi from '~api/project/project'
|
|
import { getArrValue, getObjValue } from 'js-fast-way'
|
|
import { getArrValue, getObjValue } from 'js-fast-way'
|
|
import BigNumber from 'bignumber.js'
|
|
import BigNumber from 'bignumber.js'
|
|
|
|
+import dayjs from 'dayjs'
|
|
import HcStatusCharts from './components/charts.vue'
|
|
import HcStatusCharts from './components/charts.vue'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -282,6 +283,7 @@ watch(() => props.isAdmin, (admin) => {
|
|
|
|
|
|
//渲染完成
|
|
//渲染完成
|
|
const isAfterRender = ref(false)
|
|
const isAfterRender = ref(false)
|
|
|
|
+const currentYear = new dayjs().format('YYYY')
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
//表格太复杂,渲染较慢,等页面先加载完成,再渲染表格,不然会卡住一下不动。
|
|
//表格太复杂,渲染较慢,等页面先加载完成,再渲染表格,不然会卡住一下不动。
|
|
//因为表头涉及到年份,如果年份很多,那么会更卡。
|
|
//因为表头涉及到年份,如果年份很多,那么会更卡。
|
|
@@ -361,14 +363,28 @@ const getDetailData = async (id) => {
|
|
res.list = list
|
|
res.list = list
|
|
rowDetail.value = res
|
|
rowDetail.value = res
|
|
yearData.value = res
|
|
yearData.value = res
|
|
- console.log(yearData.value, 'yearData.valu')
|
|
|
|
- //设置默认数据
|
|
|
|
- if (list.length > 0) {
|
|
|
|
- yearKey.value = list[0].planYear
|
|
|
|
- yearIndex.value = 0
|
|
|
|
|
|
+ //设置默认数据
|
|
|
|
+ if (list.length > 0) {
|
|
|
|
+ let isIndex = false
|
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
+ const planYear = list[i].planYear.toString()
|
|
|
|
+ if (planYear === currentYear) {
|
|
|
|
+ yearIndex.value = i
|
|
|
|
+ yearKey.value = list[i].planYear
|
|
|
|
+ isIndex = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //默认值
|
|
|
|
+ if (!isIndex) {
|
|
|
|
+ yearIndex.value = 0
|
|
|
|
+ yearKey.value = list[0].planYear
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ yearIndex.value = -1
|
|
|
|
+ yearKey.value = null
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
//删除
|
|
//删除
|
|
const delTableItem = async ({ item }, resolve) => {
|
|
const delTableItem = async ({ item }, resolve) => {
|
|
const { error, code, msg } = await mainApi.del(item.id)
|
|
const { error, code, msg } = await mainApi.del(item.id)
|
|
@@ -386,6 +402,8 @@ const drawerCancel = () => {
|
|
isDrawer.value = false
|
|
isDrawer.value = false
|
|
isDrawerType.value = ''
|
|
isDrawerType.value = ''
|
|
yearData.value = {}
|
|
yearData.value = {}
|
|
|
|
+ yearIndex.value = -1
|
|
|
|
+ yearKey.value = null
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|