datav.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <div class="hc-datav-main hc-full">
  3. <img class="hc-datav-bg" :src="bgPng" alt="bg">
  4. <div id="hc-datav-header-body" class="relative">
  5. <div class="hc-datav-header">
  6. <img id="datav-header-bg" :src="png2" alt="头部图">
  7. <div class="header-title hc-flex-center w-full">
  8. <div ref="nameRef" class="name hc-flex" @click="toHomePage">
  9. <i class="i-solar-graph-outline" />
  10. 项目数据看板
  11. </div>
  12. </div>
  13. <div class="hc-datav-search-select hc-flex w-full">
  14. <div ref="searchRef" class="relative">
  15. <HcDatavSelect v-model="searchForm.year" :datas="yearArr" :clearable="false" />
  16. <HcDatavSelect v-model="pageType" :datas="pageTypeArr" :clearable="false" @change="pageTypeChange" />
  17. <template v-if="pageType === '1'">
  18. <HcDatavSelect v-model="searchForm.month" :datas="monthArr" placeholder="选择月份" @change="searchChange" />
  19. <HcDatavSelect v-model="searchForm.projectScheduleType" :datas="lagArr" @change="searchChange" />
  20. <HcDatavSelect v-if="searchForm.projectScheduleType === '3'" v-model="searchForm.projectScheduleGrade" :datas="levelArr" placeholder="滞后等级" @change="searchChange" />
  21. </template>
  22. <HcDatavSelect v-model="searchForm.projectStage" :datas="stageArr" placeholder="项目阶段" @change="searchChange" />
  23. <HcDatavSelect v-if="pageType === '1'" v-model="searchForm.projectType" :datas="typeArr" placeholder="项目类型" @change="searchChange" />
  24. <HcDatavSelect v-else v-model="searchForm.quarter" :datas="quarterArr" placeholder="选择季度" :clearable="false" @change="searchQuarterChange" />
  25. </div>
  26. <div v-if="pageType === '1'" class="date flex-1">截止时间: {{ endDate }}</div>
  27. <div v-if="pageType === '2'" class="date flex-1">截止时间: {{ workInfo.lastDate || '暂无填写记录' }}</div>
  28. </div>
  29. </div>
  30. <div class="hc-datav-total relative p-[14px]">
  31. <el-row v-if="pageType === '1'" :gutter="24">
  32. <el-col :span="6">
  33. <HcDatavCard title="项目总量" :num="projectStat.projectTotal" unit="" color="#D5DEFF" />
  34. </el-col>
  35. <el-col :span="6">
  36. <HcDatavCard title="计划总投资额" :num="projectStat.planAllMoney" unit="亿" color="#EEB500" />
  37. </el-col>
  38. <el-col :span="6">
  39. <HcDatavCard :num="projectStat.currentMoney" unit="亿" color="#0DD70C">
  40. <template #title>
  41. <span style="color: #FE0301;">目前</span>
  42. <span>实际完成投资额</span>
  43. </template>
  44. </HcDatavCard>
  45. </el-col>
  46. <el-col :span="6">
  47. <HcDatavCard title="投资完成比例" :num="projectStat.investRatio" unit="%" color="#1DC98B" />
  48. </el-col>
  49. </el-row>
  50. <el-row v-else :gutter="24">
  51. <el-col :span="6" />
  52. <el-col :span="6">
  53. <HcDatavCard>
  54. <div class="hc-diy-datav-card hc-full hc-flex-center">
  55. <span class="num vertical-sub text-[60px] font-bold" style="color: #ECCF6D">{{ workInfo.stagesCount || 0 }}</span>
  56. <span class="text text-[28px] font-bold">个方面</span>
  57. </div>
  58. </HcDatavCard>
  59. </el-col>
  60. <el-col :span="6">
  61. <HcDatavCard>
  62. <div class="hc-diy-datav-card hc-full hc-flex-center">
  63. <span class="num vertical-sub text-[60px] font-bold" style="color: #0BD70E">{{ workInfo.taskCount || 0 }}</span>
  64. <span class="text text-[28px] font-bold">项任务</span>
  65. </div>
  66. </HcDatavCard>
  67. </el-col>
  68. <el-col :span="6" />
  69. </el-row>
  70. </div>
  71. <div class="hc-datav-divider" />
  72. </div>
  73. <div id="hc-datav-row-total-body" class="hc-datav-row-total relative p-[14px]">
  74. <el-row v-if="pageType === '1'" :gutter="24" class="h-full">
  75. <el-col :span="8" class="h-full">
  76. <div class="hc-datav-row-column h-full">
  77. <div class="title">投资数据</div>
  78. <div class="notes">
  79. <span>(已完成/</span>
  80. <span class="red">未完成</span>
  81. <span>)</span>
  82. </div>
  83. <div class="gird-card-box relative mt-4">
  84. <hc-row :gutter="20">
  85. <hc-col :span="12">
  86. <div class="gird-card hc-flex p-[14px]">
  87. <div class="upper-num a1 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅰ</div>
  88. <div class="content relative ml-[12px] h-[52px] flex-1">
  89. <div class="name mb-[10px] text-center text-[16px]">一季度</div>
  90. <div class="data text-center text-[24px]">
  91. <span class="num font-bold">{{ investStat?.oneFinished || 0 }}</span>
  92. <span class="line">/</span>
  93. <span class="red font-bold">{{ investStat?.oneUnFinished || 0 }}</span>
  94. <span class="unit ml-[5px] text-[14px]">(亿)</span>
  95. </div>
  96. </div>
  97. </div>
  98. </hc-col>
  99. <hc-col :span="12">
  100. <div class="gird-card hc-flex p-[14px]">
  101. <div class="upper-num a2 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅱ</div>
  102. <div class="content relative ml-[12px] h-[52px] flex-1">
  103. <div class="name mb-[10px] text-center text-[16px]">二季度</div>
  104. <div class="data text-center text-[24px]">
  105. <span class="num font-bold">{{ investStat?.twoFinished || 0 }}</span>
  106. <span class="line">/</span>
  107. <span class="red font-bold">{{ investStat?.twoUnFinished || 0 }}</span>
  108. <span class="unit ml-[5px] text-[14px]">(亿)</span>
  109. </div>
  110. </div>
  111. </div>
  112. </hc-col>
  113. <hc-col :span="12">
  114. <div class="gird-card hc-flex p-[14px]">
  115. <div class="upper-num a3 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅲ</div>
  116. <div class="content relative ml-[12px] h-[52px] flex-1">
  117. <div class="name mb-[10px] text-center text-[16px]">三季度</div>
  118. <div class="data text-center text-[24px]">
  119. <span class="num font-bold">{{ investStat?.threeFinished || 0 }}</span>
  120. <span class="line">/</span>
  121. <span class="red font-bold">{{ investStat?.threeUnFinished || 0 }}</span>
  122. <span class="unit ml-[5px] text-[14px]">(亿)</span>
  123. </div>
  124. </div>
  125. </div>
  126. </hc-col>
  127. <hc-col :span="12">
  128. <div class="gird-card hc-flex p-[14px]">
  129. <div class="upper-num a4 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅳ</div>
  130. <div class="content relative ml-[12px] h-[52px] flex-1">
  131. <div class="name mb-[10px] text-center text-[16px]">四季度</div>
  132. <div class="data text-center text-[24px]">
  133. <span class="num font-bold">{{ investStat?.fourFinished || 0 }}</span>
  134. <span class="line">/</span>
  135. <span class="red font-bold">{{ investStat?.fourUnFinished || 0 }}</span>
  136. <span class="unit ml-[5px] text-[14px]">(亿)</span>
  137. </div>
  138. </div>
  139. </div>
  140. </hc-col>
  141. </hc-row>
  142. </div>
  143. <div class="hc-datav-divider" />
  144. <div v-if="searchForm.projectScheduleType !== '3'" class="hc-datav-table relative">
  145. <HcDatavTable :column="tableColumn1" :datas="tableData1" is-current @row-click="tableRowClick">
  146. <template #planAllMoney="{ row }">
  147. <span style="color: #06A3FF;" class="font-bold">{{ row.planAllMoney }}</span>
  148. </template>
  149. <template #currentMoney="{ row }">
  150. <span style="color: #10C90F;" class="font-bold">{{ row.currentMoney }}</span>
  151. </template>
  152. <template #unFinishedMoney="{ row }">
  153. <span style="color: #D7A70D;" class="font-bold">{{ row.unFinishedMoney }}</span>
  154. </template>
  155. </HcDatavTable>
  156. </div>
  157. <div v-else class="hc-datav-table relative">
  158. <HcDatavTable :column="lagColumn1" :datas="lagData1" is-current @row-click="lagRowClick">
  159. <template #key3="{ row }">
  160. <span style="color: #06A3FF;" class="font-bold">{{ row.key3 }}</span>
  161. </template>
  162. <template #key4="{ row }">
  163. <span style="color: #10C90F;" class="font-bold">{{ row.key4 }}</span>
  164. </template>
  165. <template #key5="{ row }">
  166. <span style="color: #D7A70D;" class="font-bold">{{ row.key5 }}</span>
  167. </template>
  168. </HcDatavTable>
  169. </div>
  170. </div>
  171. </el-col>
  172. <el-col :span="8" class="h-full">
  173. <div class="hc-datav-row-charts relative text-center">
  174. <div class="row-charts relative inline-block h-[335px] w-[520px]">
  175. <div class="title-box a1">
  176. <span>常规项目</span>
  177. <span class="num">{{ projectStat.total1 }}</span>
  178. </div>
  179. <div class="title-box a2">
  180. <span>超进度项目</span>
  181. <span class="num">{{ projectStat.total2 }}</span>
  182. </div>
  183. <div class="title-box a3">
  184. <span>滞后项目</span>
  185. <span class="num">{{ projectStat.total3 }}</span>
  186. </div>
  187. </div>
  188. </div>
  189. <div class="hc-datav-row-line relative">
  190. <div class="title">项目投资走势</div>
  191. <div class="hc-full relative">
  192. <HcDatavCharts v-if="isDatavCharts" :datas="chartsData" />
  193. </div>
  194. </div>
  195. </el-col>
  196. <el-col :span="8" class="h-full">
  197. <div class="hc-datav-row-column h-full">
  198. <div class="title">进度数据</div>
  199. <div class="notes">
  200. <span>(已完成/</span>
  201. <span class="red">未完成</span>
  202. <span>)</span>
  203. </div>
  204. <div class="gird-card-box relative mt-4">
  205. <hc-row :gutter="20">
  206. <hc-col :span="12">
  207. <div class="gird-card hc-flex p-[14px]">
  208. <div class="upper-num a1 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅰ</div>
  209. <div class="content relative ml-[12px] h-[52px] flex-1">
  210. <div class="name mb-[10px] text-center text-[16px]">一季度</div>
  211. <div class="data text-center text-[24px]">
  212. <span class="num font-bold">{{ scheduleStat?.oneFinished || 0 }}</span>
  213. <span class="line">/</span>
  214. <span class="red font-bold">{{ scheduleStat?.oneUnFinished || 0 }}</span>
  215. </div>
  216. </div>
  217. </div>
  218. </hc-col>
  219. <hc-col :span="12">
  220. <div class="gird-card hc-flex p-[14px]">
  221. <div class="upper-num a2 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅱ</div>
  222. <div class="content relative ml-[12px] h-[52px] flex-1">
  223. <div class="name mb-[10px] text-center text-[16px]">二季度</div>
  224. <div class="data text-center text-[24px]">
  225. <span class="num font-bold">{{ scheduleStat?.twoFinished || 0 }}</span>
  226. <span class="line">/</span>
  227. <span class="red font-bold">{{ scheduleStat?.twoUnFinished || 0 }}</span>
  228. </div>
  229. </div>
  230. </div>
  231. </hc-col>
  232. <hc-col :span="12">
  233. <div class="gird-card hc-flex p-[14px]">
  234. <div class="upper-num a3 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅲ</div>
  235. <div class="content relative ml-[12px] h-[52px] flex-1">
  236. <div class="name mb-[10px] text-center text-[16px]">三季度</div>
  237. <div class="data text-center text-[24px]">
  238. <span class="num font-bold">{{ scheduleStat?.threeFinished || 0 }}</span>
  239. <span class="line">/</span>
  240. <span class="red font-bold">{{ scheduleStat?.threeUnFinished || 0 }}</span>
  241. </div>
  242. </div>
  243. </div>
  244. </hc-col>
  245. <hc-col :span="12">
  246. <div class="gird-card hc-flex p-[14px]">
  247. <div class="upper-num a4 hc-flex-center h-[52px] w-[52px] text-[30px]">Ⅳ</div>
  248. <div class="content relative ml-[12px] h-[52px] flex-1">
  249. <div class="name mb-[10px] text-center text-[16px]">四季度</div>
  250. <div class="data text-center text-[24px]">
  251. <span class="num font-bold">{{ scheduleStat?.fourFinished || 0 }}</span>
  252. <span class="line">/</span>
  253. <span class="red font-bold">{{ scheduleStat?.fourUnFinished || 0 }}</span>
  254. </div>
  255. </div>
  256. </div>
  257. </hc-col>
  258. </hc-row>
  259. </div>
  260. <div class="hc-datav-divider" />
  261. <div v-if="searchForm.projectScheduleType !== '3'" class="hc-datav-table relative">
  262. <HcDatavTable :column="tableColumn2" :datas="tableData2">
  263. <template #projectTotal="{ row }">
  264. <span style="color: #D8A70F;" class="font-bold">{{ row.projectTotal }}</span>
  265. </template>
  266. <template #finishedTotal="{ row }">
  267. <span style="color: #0BD70E;" class="font-bold">{{ row.finishedTotal }}</span>
  268. </template>
  269. <template #unFinishedTotal="{ row }">
  270. <span style="color: #FF0000;" class="font-bold">{{ row.unFinishedTotal }}</span>
  271. </template>
  272. </HcDatavTable>
  273. </div>
  274. <div v-else class="hc-datav-table relative">
  275. <HcDatavTable :column="lagColumn2" :datas="lagData2">
  276. <template #key3="{ row }">
  277. <span style="color: #D8A70F;" class="font-bold">{{ row.key3 }}</span>
  278. </template>
  279. <template #key4="{ row }">
  280. <span style="color: #0BD70E;" class="font-bold">{{ row.key4 }}</span>
  281. </template>
  282. <template #key5="{ row }">
  283. <span style="color: #FF0000;" class="font-bold">{{ row.key5 }}</span>
  284. </template>
  285. </HcDatavTable>
  286. </div>
  287. </div>
  288. </el-col>
  289. </el-row>
  290. <div v-else class="hc-datav-row-column work h-full">
  291. <div class="title">工作要点</div>
  292. <div class="hc-datav-table relative" style="height: 100%;">
  293. <HcDatavTable :column="workColumn" :datas="workInfo.tabList" />
  294. </div>
  295. </div>
  296. </div>
  297. <el-tour v-model="tourOpen" @close="tourFinishClose">
  298. <el-tour-step :target="nameRef" title="操作提示" description="点击这里,进入数据分析工具" />
  299. <el-tour-step :target="searchRef" title="操作提示" description="这里进行数据筛选查询" />
  300. </el-tour>
  301. </div>
  302. </template>
  303. <script setup>
  304. import { onMounted, onUnmounted, ref } from 'vue'
  305. import router from '~src/router/index'
  306. import { useAppStore } from '~src/store'
  307. import { getStore, setStore } from 'hc-vue3-ui'
  308. import bgPng from '~src/assets/images/datav-bg.png'
  309. import png2 from '~src/assets/images/datav-2.png'
  310. import HcDatavSelect from './modules/select.vue'
  311. import HcDatavCard from './modules/card.vue'
  312. import HcDatavTable from './modules/table.vue'
  313. import HcDatavCharts from './modules/charts.vue'
  314. import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
  315. import { getDictionaryData } from '~src/utils/tools'
  316. import projectApi from '~api/datav/projectdata'
  317. import dayjs from 'dayjs'
  318. const store = useAppStore()
  319. //引导
  320. const nameRef = ref(null)
  321. const searchRef = ref(null)
  322. const tourOpen = ref(false)
  323. onMounted(() => {
  324. const isTourOpen = getStore('isTourOpen')
  325. if (isNullES(isTourOpen)) {
  326. setTimeout(() => {
  327. tourOpen.value = true
  328. }, 500)
  329. }
  330. //窗口大小改变
  331. windowResize()
  332. setTimeout(() => {
  333. onWindowResize()
  334. }, 100)
  335. //生成月份
  336. let newMonthArr = [{ id: -1, name: '所有' }]
  337. for (let i = 0; i < 12; i++) {
  338. newMonthArr.push({ id: i + 1, name: `${i + 1}月` })
  339. }
  340. monthArr.value = newMonthArr
  341. getEndDate()
  342. getProType()
  343. getProStation()
  344. searchChange()
  345. })
  346. //关闭引导提示
  347. const tourFinishClose = () => {
  348. console.log('关闭引导提示')
  349. setStore('isTourOpen', true)
  350. }
  351. //搜索表单
  352. const pageType = ref('1')
  353. const searchForm = ref({
  354. year: new dayjs().year(), month: -1, projectScheduleGrade: '-1', projectStage: null, projectType: null, projectScheduleType:'-1',
  355. quarter: '1',
  356. })
  357. //下拉框
  358. const yearArr = [{ id: '2024', name: '2024年' }, { id: '2023', name: '2023年' }, { id: '2022', name: '2022年' }]
  359. const pageTypeArr = [{ id: '1', name: '项目数据看板' }, { id: '2', name: '工作要点' }]
  360. const monthArr = ref([])
  361. const lagArr = [{ id: '1', name: '超进度项目' }, { id: '2', name: '常规项目' }, { id: '3', name: '滞后项目' }, { id: '-1', name: '所有' }]
  362. const levelArr = [{ id: '1', name: '一级' }, { id: '2', name: '二级' }, { id: '3', name: '三级' }, { id: '-1', name: '所有' }]
  363. const stageArr = ref([])
  364. const typeArr = ref([])
  365. const quarterArr = [{ id: '1', name: '一季度' }, { id: '2', name: '二季度' }, { id: '3', name: '三季度' }, { id: '4', name: '四季度' }]
  366. const getProType = async () => {
  367. let data = await getDictionaryData('projectType', true)
  368. data.forEach((ele)=>{
  369. typeArr.value.push({
  370. id:ele.value,
  371. name:ele.label,
  372. })
  373. })
  374. }
  375. const getProStation = async () => {
  376. let data = await getDictionaryData('projectStage', true)
  377. data.forEach((ele)=>{
  378. stageArr.value.push({
  379. id:ele.value,
  380. name:ele.label,
  381. })
  382. })
  383. }
  384. //获取截止时间
  385. const endDate = ref('2024年04月08日')
  386. const getEndDate = async ()=>{
  387. const { error, code, data } = await projectApi.dateEndDate()
  388. //处理数据
  389. if (!error && code === 200) {
  390. endDate.value = data
  391. } else {
  392. endDate.value = ''
  393. }
  394. }
  395. //页面类型改变
  396. const pageTypeChange = (type) => {
  397. console.log(type)
  398. //工作要点
  399. if (Number(type) === 2) {
  400. queryWorkFocusDataInfo()
  401. }
  402. }
  403. //获取工作要点的数据
  404. const workInfo = ref({})
  405. const queryWorkFocusDataInfo = async () => {
  406. const { year, projectStage } = searchForm.value
  407. const { data } = await projectApi.queryWorkFocusDataInfo({
  408. year: year,
  409. workFocusStage: projectStage || '',
  410. })
  411. const res = getObjValue(data)
  412. res.tabList = getArrValue(res?.tabList)
  413. workInfo.value = res
  414. console.log(data)
  415. }
  416. //搜索条件改变1
  417. const searchChange = ()=>{
  418. if (pageType.value === '1') {
  419. getDataProjectStat()
  420. getDataInvestStat()
  421. getScheduleStat()
  422. } else {
  423. queryWorkFocusDataInfo()
  424. }
  425. }
  426. //获取项目统计
  427. const projectStat = ref({
  428. projectTotal:0,
  429. planAllMoney:0,
  430. currentMoney:0,
  431. investRatio:0,
  432. total1:0,
  433. total2:0,
  434. total3:0,
  435. })
  436. //获取项目统计
  437. const getDataProjectStat = async ()=>{
  438. const { error, code, data } = await projectApi.dataProjectStat(searchForm.value)
  439. //处理数据
  440. if (!error && code === 200) {
  441. projectStat.value = getObjValue(data)
  442. } else {
  443. projectStat.value = {
  444. projectTotal:0,
  445. planAllMoney:0,
  446. currentMoney:0,
  447. investRatio:0,
  448. total1:0,
  449. total2:0,
  450. total3:0,
  451. }
  452. }
  453. }
  454. //获取投资数据
  455. const investStat = ref({
  456. oneFinished:0,
  457. oneUnFinished:0,
  458. twoFinished:0,
  459. twoUnFinished:0,
  460. threeFinished:0,
  461. threeUnFinished:0,
  462. fourFinished:0,
  463. fourUnFinished:0,
  464. })
  465. const chartsData = ref({})
  466. const getDataInvestStat = async ()=>{
  467. const { error, code, data } = await projectApi.dataInvestStat(searchForm.value)
  468. //处理数据
  469. if (!error && code === 200) {
  470. investStat.value = getObjValue(data)
  471. tableData1.value = getArrValue(data['list'])
  472. if (tableData1.value.length > 0) {
  473. chartsData.value = getObjValue(tableData1.value[0]['map'])
  474. } else {
  475. chartsData.value = {}
  476. }
  477. } else {
  478. investStat.value = {
  479. oneFinished:0,
  480. oneUnFinished:0,
  481. twoFinished:0,
  482. twoUnFinished:0,
  483. threeFinished:0,
  484. threeUnFinished:0,
  485. fourFinished:0,
  486. fourUnFinished:0,
  487. }
  488. tableData1.value = []
  489. }
  490. }
  491. //获取进度数据
  492. const scheduleStat = ref({
  493. oneFinished:0,
  494. oneUnFinished:0,
  495. twoFinished:0,
  496. twoUnFinished:0,
  497. threeFinished:0,
  498. threeUnFinished:0,
  499. fourFinished:0,
  500. fourUnFinished:0,
  501. })
  502. const getScheduleStat = async ()=>{
  503. const { error, code, data } = await projectApi.schedulestStat(searchForm.value)
  504. //处理数据
  505. if (!error && code === 200) {
  506. scheduleStat.value = getObjValue(data)
  507. tableData2.value = getArrValue(data['list'])
  508. } else {
  509. scheduleStat.value = {
  510. oneFinished:0,
  511. oneUnFinished:0,
  512. twoFinished:0,
  513. twoUnFinished:0,
  514. threeFinished:0,
  515. threeUnFinished:0,
  516. fourFinished:0,
  517. fourUnFinished:0,
  518. }
  519. tableData2.value = []
  520. }
  521. }
  522. //表格1
  523. const tableColumn1 = [
  524. { key: 'projectStageName', name: '项目阶段' }, { key: 'projectTypeName', name: '项目类型' },
  525. { key: 'planAllMoney', name: '计划总投资' }, { key: 'currentMoney', name: '实际已投资' },
  526. { key: 'unFinishedMoney', name: '未完成投资' },
  527. ]
  528. const tableData1 = ref([])
  529. //表格被点击
  530. const isDatavCharts = ref(true)
  531. const tableRowClick = (row) => {
  532. chartsData.value = getObjValue(row.map)
  533. //模拟改变图表
  534. isDatavCharts.value = false
  535. setTimeout(() => {
  536. isDatavCharts.value = true
  537. }, 100)
  538. }
  539. //滞后表格1
  540. const lagColumn1 = [
  541. { key: 'key1', name: '滞后等级' }, { key: 'key2', name: '项目名称' },
  542. { key: 'key3', name: '计划总投资' }, { key: 'key4', name: '实际已投资' },
  543. { key: 'key5', name: '未完成投资' },
  544. ]
  545. const lagData1 = ref([
  546. { key1: '一级', key2: 'xx', key3: '12000', key4: '12000', key5: 2000 },
  547. { key1: '二级', key2: 'xx', key3: '12000', key4: '12000', key5: 2000 },
  548. { key1: '三级', key2: 'xx', key3: '12000', key4: '12000', key5: 2000 },
  549. ])
  550. const lagRowClick = (row) => {
  551. console.log(row)
  552. //模拟改变图表
  553. isDatavCharts.value = false
  554. setTimeout(() => {
  555. isDatavCharts.value = true
  556. }, 100)
  557. }
  558. //表格2
  559. const tableColumn2 = [
  560. { key: 'projectStageName', name: '项目阶段' }, { key: 'projectTypeName', name: '项目类型' },
  561. { key: 'projectTotal', name: '项目数' }, { key: 'finishedTotal', name: '已完成项目数' },
  562. { key: 'unFinishedTotal', name: '未完成项目数' },
  563. ]
  564. const tableData2 = ref([])
  565. //滞后表格2
  566. const lagColumn2 = [
  567. { key: 'key1', name: '滞后等级' }, { key: 'key2', name: '项目名称' },
  568. { key: 'key3', name: '进度滞后季度' }, { key: 'key4', name: '进度滞后月份' },
  569. { key: 'key5', name: '进度百分比' },
  570. ]
  571. const lagData2 = ref([
  572. { key1: '一级', key2: 'xx', key3: '一季度', key4: '1月', key5: '38%' },
  573. { key1: '二级', key2: 'xx', key3: '二季度', key4: '2月', key5: '48%' },
  574. { key1: '三级', key2: 'xx', key3: '三季度', key4: '3月', key5: '58%' },
  575. ])
  576. //工作要点表格
  577. const workColumn = ref([
  578. { key: 'workFocusStageName', name: '项目阶段' }, { key: 'targetPlan', name: '目标任务' },
  579. { key: 'workPlan', name: '工作内容' }, { key: 'month1', name: '1月' },
  580. { key: 'month2', name: '2月' }, { key: 'month3', name: '3月' },
  581. { key: 'dutyUnit', name: '责任单位' },
  582. ])
  583. //季度选择
  584. const searchQuarterChange = () => {
  585. const { quarter } = searchForm.value
  586. const newArr = [{ key: 'workFocusStageName', name: '项目阶段' }, { key: 'targetPlan', name: '目标任务' }, { key: 'workPlan', name: '工作内容' }]
  587. if (quarter === '1') {
  588. newArr.push({ key: 'month1', name: '1月' })
  589. newArr.push({ key: 'month2', name: '2月' })
  590. newArr.push({ key: 'month3', name: '3月' })
  591. } else if (quarter === '2') {
  592. newArr.push({ key: 'month4', name: '4月' })
  593. newArr.push({ key: 'month5', name: '5月' })
  594. newArr.push({ key: 'month6', name: '6月' })
  595. } else if (quarter === '3') {
  596. newArr.push({ key: 'month7', name: '7月' })
  597. newArr.push({ key: 'month8', name: '8月' })
  598. newArr.push({ key: 'month9', name: '9月' })
  599. } else if (quarter === '4') {
  600. newArr.push({ key: 'month10', name: '10月' })
  601. newArr.push({ key: 'month11', name: '11月' })
  602. newArr.push({ key: 'month12', name: '12月' })
  603. }
  604. newArr.push({ key: 'dutyUnit', name: '责任单位' })
  605. workColumn.value = newArr
  606. queryWorkFocusDataInfo()
  607. }
  608. //跳转到首页
  609. const toHomePage = () => {
  610. router.push({ name: store.page })
  611. }
  612. //监听浏览器窗口变化
  613. const windowResize = () => {
  614. window.addEventListener('resize', resizeEvent)
  615. }
  616. const resizeEvent = () => {
  617. window.requestAnimationFrame(() => {
  618. onWindowResize()
  619. })
  620. }
  621. //设置尺寸
  622. const onWindowResize = () => {
  623. const height = document.getElementById('hc-datav-header-body').offsetHeight
  624. document.getElementById('hc-datav-row-total-body').style.height = `calc(100% - ${height + 10}px)`
  625. }
  626. //被卸载
  627. onUnmounted(() => {
  628. window.removeEventListener('resize', resizeEvent)
  629. })
  630. </script>
  631. <style lang="scss">
  632. @import '~src/styles/view/datav';
  633. </style>