project-list.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <div v-loading="!isAfterRender" element-loading-text="加载中..." class="hc-full">
  3. <hc-table
  4. v-if="isAfterRender" :column="tableColumn" :datas="tableData" :index-style="{ width: 60 }" is-check
  5. :check-style="{ fixed: true, width: 29 }" class="hc-project-list-table" @selection-change="tableCheckChange"
  6. >
  7. <template #name="{ row }">
  8. <el-link type="primary" @click="rowNameClick(row)">{{ row.name }}</el-link>
  9. </template>
  10. <template #action="{ row }">
  11. <el-link v-if="isAdminAuth" type="warning" @click="completion(row)">项目完成情况</el-link>
  12. <el-link type="primary" @click="examine(row)">查看</el-link>
  13. <el-link v-if="isAdminAuth" v-del-com:[delTableItem]="row" type="danger">删除</el-link>
  14. <el-link v-yes-com:[deriveTableItem]="row" type="success">导出</el-link>
  15. </template>
  16. </hc-table>
  17. <!-- 查看详情 -->
  18. <hc-drawer v-model="isDrawer" to-id="hc-main-box" is-close>
  19. <hc-card class="hc-project-list-drawer" :scrollbar="true">
  20. <template #header>
  21. <div class="flex-1 text-center text-[24px] font-bold">项目详情</div>
  22. </template>
  23. <HcInfoTable>
  24. <tr>
  25. <hc-info-table-td is-title width="30px" center>项目阶段</hc-info-table-td>
  26. <hc-info-table-td center>{{ rowDetail?.projectStageName }}</hc-info-table-td>
  27. <hc-info-table-td is-title width="30px" center>项目类型</hc-info-table-td>
  28. <hc-info-table-td center>{{ rowDetail?.projectTypeName }}</hc-info-table-td>
  29. </tr>
  30. <tr>
  31. <hc-info-table-td is-title width="30px" center>项目名称</hc-info-table-td>
  32. <hc-info-table-td center>{{ rowDetail?.name }}</hc-info-table-td>
  33. <hc-info-table-td is-title width="30px" center>建设规模</hc-info-table-td>
  34. <hc-info-table-td center>{{ rowDetail?.buildScaleName }}</hc-info-table-td>
  35. </tr>
  36. <tr>
  37. <hc-info-table-td is-title width="30px" center>开 工 年</hc-info-table-td>
  38. <hc-info-table-td center>{{ rowDetail?.startYear }}</hc-info-table-td>
  39. <hc-info-table-td is-title width="30px" center>完 工 年</hc-info-table-td>
  40. <hc-info-table-td center>{{ rowDetail?.endYear }}</hc-info-table-td>
  41. </tr>
  42. <tr>
  43. <hc-info-table-td is-title width="30px" center>总投资</hc-info-table-td>
  44. <hc-info-table-td center>{{ rowDetail?.allInvestMoney }}</hc-info-table-td>
  45. <hc-info-table-td is-title width="30px" center>“十四五”计划投资</hc-info-table-td>
  46. <hc-info-table-td center>{{ rowDetail?.fourteenFiveInvest }}</hc-info-table-td>
  47. </tr>
  48. <tr>
  49. <hc-info-table-td is-title width="30px" center>市级重点项目</hc-info-table-td>
  50. <hc-info-table-td center>{{ rowDetail.isFocusProject === 1 ? '是' : '否' }}</hc-info-table-td>
  51. <hc-info-table-td is-title width="30px" center>交通强国建设试点任务</hc-info-table-td>
  52. <hc-info-table-td center>{{ rowDetail?.isPilotPlan === 1 ? '是' : '否' }}</hc-info-table-td>
  53. </tr>
  54. <tr>
  55. <hc-info-table-td is-title width="30px" center>牵头单位</hc-info-table-td>
  56. <hc-info-table-td center>{{ rowDetail?.leaderUnit }}</hc-info-table-td>
  57. <hc-info-table-td is-title width="30px" center rowspan="2">配合单位</hc-info-table-td>
  58. <hc-info-table-td center rowspan="2">{{ rowDetail?.assistUnit }}</hc-info-table-td>
  59. </tr>
  60. <tr>
  61. <hc-info-table-td is-title width="30px" center>责任单位</hc-info-table-td>
  62. <hc-info-table-td center>{{ rowDetail?.dutyUnit }}</hc-info-table-td>
  63. </tr>
  64. </HcInfoTable>
  65. <div class="hc-project-list-drawer-year">
  66. <el-scrollbar>
  67. <div class="relative p-2 pt-3">
  68. <hc-card-item class="year-detail">
  69. <template #header>
  70. <div class="flex-1 text-center text-[14px]">
  71. <HcDropdown v-model="yearKey" :datas="yearData.list" text="年" :props="{ key: 'planYear', label: 'planYear' }" @change="yearChange" />
  72. </div>
  73. </template>
  74. <el-table v-if="yearData.list && yearData.list.length > 0" :data="yearData.list[yearIndex].list" border class="w-full" :span-method="tableYearMethod">
  75. <el-table-column prop="planQuarterName" label="季度" width="100" align="center" />
  76. <el-table-column prop="planMonthName" class-name="line" width="120" align="center">
  77. <template #header>
  78. <div class="hc-table-th-line">
  79. <span class="left">月份</span>
  80. <span class="right">完成情况</span>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column prop="planInvestMoney" label="计划完成投资额(亿元)" width="100" align="center" />
  85. <el-table-column prop="investMoney" label="投资完成额(亿元)" width="100" align="center" />
  86. <el-table-column prop="investUnfinishedMoney" label="投资未完成额(亿元)" width="100" align="center" />
  87. <el-table-column prop="yearlyTarget" label="全年目标" width="100" align="center" />
  88. <el-table-column prop="workPlan" label="工作计划" width="100" align="center" />
  89. <el-table-column prop="workProgressAll" label="累计进展计划" align="center" />
  90. <el-table-column prop="workProgress" label="工作计划进展计划" align="center" />
  91. <el-table-column prop="planRatio" label="形象进度百分比(%)" width="100" align="center" />
  92. </el-table>
  93. <HcInfoTable v-if="yearData.list && yearData.list.length > 0" class="mt-[-1px]">
  94. <tr>
  95. <hc-info-table-td is-title width="130px" center>该年累计完成投资(亿元)</hc-info-table-td>
  96. <hc-info-table-td center>{{ yearData.list[yearIndex].yearFinishInvest || "-" }}</hc-info-table-td>
  97. <hc-info-table-td is-title width="130px" center>该年力争完成投资(亿元)</hc-info-table-td>
  98. <hc-info-table-td center>{{ yearData.list[yearIndex]?.yearlyInvest || "-" }}</hc-info-table-td>
  99. <hc-info-table-td is-title width="130px" center>该年累计未完成投资(亿元)</hc-info-table-td>
  100. <hc-info-table-td center>{{ yearData.list[yearIndex]?.yearUnfinishedInvest || "-" }}</hc-info-table-td>
  101. </tr>
  102. </HcInfoTable>
  103. <HcInfoTable v-if="yearData.list && yearData.list.length > 0" class="mt-[-1px]">
  104. <tr>
  105. <hc-info-table-td is-title width="30px" center>存在问题</hc-info-table-td>
  106. <hc-info-table-td center>{{ yearData.list[yearIndex]?.questionable || '-' }}</hc-info-table-td>
  107. <hc-info-table-td is-title width="30px" center>工作建议</hc-info-table-td>
  108. <hc-info-table-td center>{{ yearData.list[yearIndex]?.workAdvise || '-' }}</hc-info-table-td>
  109. </tr>
  110. <tr>
  111. <hc-info-table-td is-title width="30px" center>填报单位</hc-info-table-td>
  112. <hc-info-table-td center>{{ yearData.list[yearIndex]?.writeUnit || '-' }}</hc-info-table-td>
  113. <hc-info-table-td is-title width="30px" center>联系人</hc-info-table-td>
  114. <hc-info-table-td center>{{ yearData.list[yearIndex]?.linkman || '-' }}</hc-info-table-td>
  115. </tr>
  116. </HcInfoTable>
  117. </hc-card-item>
  118. </div>
  119. </el-scrollbar>
  120. </div>
  121. </hc-card>
  122. </hc-drawer>
  123. <!-- 项目完成情况 -->
  124. <hc-drawer v-model="isCompletionDrawer" to-id="hc-main-box" is-close>
  125. <hc-card class="hc-project-list-drawer" is-action-btn :scrollbar="true">
  126. <template #header>
  127. <div class="flex-1 text-center text-[24px] font-bold">项目完成情况</div>
  128. </template>
  129. <HcInfoTable>
  130. <tr>
  131. <hc-info-table-td is-title width="30px" center>项目名称</hc-info-table-td>
  132. <hc-info-table-td center>{{ rowDetail?.name }}</hc-info-table-td>
  133. <hc-info-table-td is-title width="30px" center>项目类型</hc-info-table-td>
  134. <hc-info-table-td center>{{ rowDetail?.projectTypeName }}</hc-info-table-td>
  135. </tr>
  136. </HcInfoTable>
  137. <div class="hc-project-list-drawer-year detail">
  138. <el-scrollbar>
  139. <div class="relative p-2 pt-3">
  140. <hc-card-item class="year-detail edit">
  141. <template #header>
  142. <div class="flex-1 text-center text-[14px]">
  143. <HcDropdown v-model="yearKey" :datas="yearData.list" text="年" :props="{ key: 'planYear', label: 'planYear' }" @change="yearChange" />
  144. </div>
  145. </template>
  146. <el-table v-if="yearData.list && yearData.list.length > 0" :data="yearData.list[yearIndex].list" border class="w-full" :span-method="tableYearMethod1">
  147. <el-table-column prop="planQuarterName" label="季度" width="100" align="center" />
  148. <el-table-column prop="planMonthName" class-name="line" width="120" align="center">
  149. <template #header>
  150. <div class="hc-table-th-line">
  151. <span class="left">月份</span>
  152. <span class="right">完成情况</span>
  153. </div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="planInvestMoney" label="计划完成投资额(亿元)" width="100" align="center">
  157. <template #default="{ row }">
  158. <hc-body>
  159. <hc-table-input v-model="row.planInvestMoney" disabled />
  160. </hc-body>
  161. </template>
  162. </el-table-column>
  163. <el-table-column prop="investMoney" label="投资完成额(亿元)" width="100" align="center">
  164. <template #default="{ row, $index }">
  165. <hc-body>
  166. <!-- <hc-table-input v-model="row.investMoney" /> -->
  167. <el-input v-model="row.investMoney" clearable :formatter="formatInput" :disabled="(yearData.list[yearIndex].isCanFill === 1 ? false : true) || !row.planInvestMoney" @change="changeInvestMoney($event, row, $index)" />
  168. </hc-body>
  169. </template>
  170. </el-table-column>
  171. <el-table-column prop="investMoneyAll" label="累计投资完成额(亿元)" width="100" align="center">
  172. <template #default="{ row }">
  173. <hc-body>
  174. <hc-table-input v-model="row.investMoneyAll" disabled />
  175. </hc-body>
  176. </template>
  177. </el-table-column>
  178. <el-table-column prop="workPlan" label="工作计划" width="100" align="center">
  179. <template #default="{ row }">
  180. <hc-body>
  181. <hc-table-input v-model="row.workPlan" type="textarea" disabled resize="none" />
  182. </hc-body>
  183. </template>
  184. </el-table-column>
  185. <el-table-column prop="workProgress" label="工作计划进展情况" align="center">
  186. <template #default="{ row }">
  187. <hc-body>
  188. <hc-table-input v-model="row.workProgress" type="textarea" resize="none" :disabled="(yearData.list[yearIndex].isCanFill === 1 ? false : true) || !row.workPlan" />
  189. </hc-body>
  190. </template>
  191. </el-table-column>
  192. <el-table-column prop="workProgressAll" label="累计进展情况" align="center">
  193. <template #default="{ row }">
  194. <hc-body>
  195. <hc-table-input v-model="row.workProgressAll" type="textarea" resize="none" :disabled="(yearData.list[yearIndex].isCanFill === 1 ? false : true) || !row.workPlan" />
  196. </hc-body>
  197. </template>
  198. </el-table-column>
  199. <el-table-column prop="planRatio" label="形象进度百分比(%)" width="100" align="center">
  200. <template #default="{ row, $index }">
  201. <hc-body>
  202. <!-- <hc-table-input v-model="row.planRatio" :disabled="yearData.list[yearIndex].isCanFill === 1 ? false : true" /> -->
  203. <el-input v-model="row.planRatio" :disabled="(yearData.list[yearIndex].isCanFill === 1 ? false : true) || !row.workPlan" :formatter="formatInput" @change="changePlanRatio($enent, row, $index)" />
  204. </hc-body>
  205. </template>
  206. </el-table-column>
  207. </el-table>
  208. <HcInfoTable v-if="yearData.list && yearData.list.length > 0" class="mt-[-1px]">
  209. <tr>
  210. <hc-info-table-td is-title width="30px" center>存在问题</hc-info-table-td>
  211. <hc-info-table-td center>
  212. <el-input v-model="yearData.list[yearIndex].questionable" type="textarea" resize="none" :disabled="yearData.list[yearIndex].isCanFill === 1 ? false : true" />
  213. </hc-info-table-td>
  214. <hc-info-table-td is-title width="30px" center>工作建议</hc-info-table-td>
  215. <hc-info-table-td center>
  216. <el-input v-model=" yearData.list[yearIndex].workAdvise" type="textarea" resize="none" :disabled="yearData.list[yearIndex].isCanFill === 1 ? false : true" />
  217. </hc-info-table-td>
  218. </tr>
  219. <tr>
  220. <hc-info-table-td is-title width="30px" center>填报单位</hc-info-table-td>
  221. <hc-info-table-td center>
  222. <el-input v-model="yearData.list[yearIndex].writeUnit " :disabled="yearData.list[yearIndex].isCanFill === 1 ? false : true" />
  223. </hc-info-table-td>
  224. <hc-info-table-td is-title width="30px" center>联系人</hc-info-table-td>
  225. <hc-info-table-td center>
  226. <el-input v-model="yearData.list[yearIndex].linkman" :disabled="yearData.list[yearIndex].isCanFill === 1 ? false : true" />
  227. </hc-info-table-td>
  228. </tr>
  229. </HcInfoTable>
  230. </hc-card-item>
  231. </div>
  232. </el-scrollbar>
  233. </div>
  234. <template #action>
  235. <el-button type="info" @click="isCompletionDrawer = false">取消</el-button>
  236. <el-button type="warning" :loading="saveCompleLoading" @click="saveComplete">保存</el-button>
  237. </template>
  238. </hc-card>
  239. </hc-drawer>
  240. </div>
  241. </template>
  242. <script setup>
  243. import { onMounted, ref, watch } from 'vue'
  244. import mainApi from '~api/project/project'
  245. import { getArrValue, getObjValue } from 'js-fast-way'
  246. import BigNumber from 'bignumber.js'
  247. const props = defineProps({
  248. isAdmin: {
  249. type: Boolean,
  250. default: false,
  251. },
  252. loading: {
  253. type: Boolean,
  254. default: false,
  255. },
  256. datas: {
  257. type: Array,
  258. default: () => ([]),
  259. },
  260. })
  261. //事件
  262. const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check', 'change'])
  263. //监听权限
  264. const isAdminAuth = ref(props.isAdmin)
  265. watch(() => props.isAdmin, (admin) => {
  266. isAdminAuth.value = admin
  267. })
  268. //渲染完成
  269. const isAfterRender = ref(false)
  270. onMounted(() => {
  271. //表格太复杂,渲染较慢,等页面先加载完成,再渲染表格,不然会卡住一下不动。
  272. //因为表头涉及到年份,如果年份很多,那么会更卡。
  273. setTimeout(() => {
  274. isAfterRender.value = true
  275. }, 200)
  276. })
  277. //表头
  278. const tableColumn = ref([
  279. { key: 'projectStageName', name: '项目阶段' },
  280. { key: 'projectTypeName', name: '项目类型' },
  281. { key: 'name', name: '项目名称' },
  282. { key: 'buildScaleName', name: '建设规模' },
  283. { key: 'startYear', name: '开工年' },
  284. { key: 'endYear', name: '完工年' },
  285. { key: 'allInvestMoney', name: '总投资(亿元)' },
  286. { key: 'fourteenFiveInvest', name: '\“十四五”\'计划投资(亿元)' },
  287. { key: 'isFocusProjectName', name: '市级重点项目' },
  288. { key: 'isPilotPlanName', name: '交通强国建设试点任务' },
  289. { key: 'finishedInvestMoney', name: '完成投资金额(亿元)' },
  290. { key: 'progressRatio', name: '项目进展比例(%)' },
  291. { key: 'finishedFillRatio', name: '完成情况填写比例(%)' },
  292. { key: 'leaderUnit', name: '牵头单位' },
  293. { key: 'assistUnit', name: '配合单位' },
  294. { key: 'dutyUnit', name: '责任单位' },
  295. { key: 'action', name: '操作', width: isAdminAuth.value ? 220 : 100, fixed:'right', align: 'center' },
  296. ])
  297. //监听数据
  298. const tableData = ref(props.datas)
  299. watch(() => props.datas, (data) => {
  300. tableData.value = data
  301. })
  302. //表格被选择
  303. const tableCheckKeys = ref([])
  304. const tableCheckChange = (rows) => {
  305. tableCheckKeys.value = rows
  306. emit('check', rows)
  307. }
  308. //项目名称被点击
  309. const rowNameClick = (row) => {
  310. emit('tap', row)
  311. }
  312. //项目完成情况
  313. const isCompletionDrawer = ref(false)
  314. const completion = (row) => {
  315. isCompletionDrawer.value = true
  316. emit('completion', row)
  317. getDetailData(row.id)
  318. }
  319. //查看
  320. const rowDetail = ref({})
  321. const isDrawer = ref(false)
  322. const isDrawerType = ref('view')
  323. const examine = (row) => {
  324. isDrawer.value = true
  325. isDrawerType.value = 'view'
  326. rowDetail.value = row
  327. getDetailData(row.id)
  328. // emit('examine', row)
  329. }
  330. const getDetailData = async (id) => {
  331. const { error, code, data, msg } = await mainApi.detailMore(id)
  332. if (error || code !== 200) {
  333. window.$message.error(msg ?? '获取数据失败')
  334. drawerCancel()
  335. return
  336. }
  337. //处理数据
  338. const res = getObjValue(data)
  339. const list = getArrValue(res.list)
  340. res.list = list
  341. rowDetail.value = res
  342. yearData.value = res
  343. console.log(yearData.value, 'yearData.valu')
  344. //设置默认数据
  345. if (list.length > 0) {
  346. yearKey.value = list[0].planYear
  347. yearIndex.value = 0
  348. }
  349. }
  350. //删除
  351. const delTableItem = async ({ item }, resolve) => {
  352. const { error, code, msg } = await mainApi.del(item.id)
  353. if (!error && code === 200) {
  354. window.$message.success('删除成功')
  355. resolve()
  356. emit('change')
  357. } else {
  358. window.$message.error(msg ?? '删除失败')
  359. resolve()
  360. }
  361. }
  362. //关闭抽屉
  363. const drawerCancel = () => {
  364. isDrawer.value = false
  365. isDrawerType.value = ''
  366. yearData.value = {}
  367. }
  368. //导出数据
  369. const deriveTableItem = ({ item }, resolve) => {
  370. console.log('我被执行了', item)
  371. //这里可以写一些操作,下面是模拟3秒关闭
  372. setTimeout(() => {
  373. resolve()
  374. emit('export', item)
  375. }, 3000)
  376. }
  377. //批量删除
  378. const batchRemove = () => {
  379. if (!isAdminAuth.value) return
  380. const rows = tableCheckKeys.value
  381. console.log('批量删除', rows)
  382. }
  383. //批量导出
  384. const batchExport = () => {
  385. const rows = tableCheckKeys.value
  386. console.log('批量导出', rows)
  387. }
  388. //年数据
  389. const yearKey = ref('2023')
  390. const yearData = ref({})
  391. const yearIndex = ref(-1)
  392. const yearChange = (_, index) => {
  393. yearIndex.value = index
  394. }
  395. //合并列或行
  396. const tableYearMethod = ({ rowIndex, columnIndex }) => {
  397. return setSpanMethod(columnIndex, rowIndex)
  398. }
  399. //合并列或行
  400. const tableYearMethod1 = ({ rowIndex, columnIndex }) => {
  401. return setSpanMethod(columnIndex, rowIndex, false)
  402. }
  403. const saveCompleLoading = ref(false)
  404. const saveComplete = async ()=>{
  405. saveCompleLoading.value = true
  406. //发起请求
  407. const { error, code, msg } = await mainApi.updateProFin({
  408. ...yearData.value,
  409. })
  410. //判断状态
  411. saveCompleLoading.value = false
  412. if (!error && code === 200) {
  413. window.$message.success('操作成功')
  414. getDetailData(rowDetail.value.id)
  415. } else {
  416. window.$message.error(msg ?? '操作失败')
  417. }
  418. }
  419. const setSpanMethod = (column, row, isAllYear = true) => {
  420. if (column === 0) { //第一列
  421. const rows = [0, 3, 6, 9], irows = [1, 2, 4, 5, 7, 8, 10, 11]
  422. if (rows.indexOf(row) !== -1) {
  423. //主要季度隐藏
  424. return { rowspan: 3, colspan: 1 }
  425. } else if (irows.indexOf(row) !== -1) {
  426. //非主要的季度隐藏
  427. return { rowspan: 0, colspan: 0 }
  428. } else {
  429. return { rowspan: 1, colspan: 1 }
  430. }
  431. } else if (column === 2) { //第三列
  432. const rows = [0, 3, 6, 9], irows = [1, 2, 4, 5, 7, 8, 10, 11]
  433. if (rows.indexOf(row) !== -1) {
  434. //主要隐藏
  435. return { rowspan: 3, colspan: 1 }
  436. } else if (irows.indexOf(row) !== -1) {
  437. //非主要的隐藏
  438. return { rowspan: 0, colspan: 0 }
  439. } else {
  440. return { rowspan: 1, colspan: 1 }
  441. }
  442. } else if (column === 5) { //第六列
  443. if (isAllYear) {
  444. if (row === 0) {
  445. return { rowspan: 12, colspan: 1 }
  446. } else if (row > 0 && row < 12) {
  447. return { rowspan: 0, colspan: 0 }
  448. } else {
  449. return { rowspan: 1, colspan: 1 }
  450. }
  451. } else {
  452. const rows = [0, 3, 6, 9], irows = [1, 2, 4, 5, 7, 8, 10, 11]
  453. if (rows.indexOf(row) !== -1) {
  454. //主要隐藏
  455. return { rowspan: 3, colspan: 1 }
  456. } else if (irows.indexOf(row) !== -1) {
  457. //非主要的隐藏
  458. return { rowspan: 0, colspan: 0 }
  459. } else {
  460. return { rowspan: 1, colspan: 1 }
  461. }
  462. }
  463. } else if (column === 6) { //第七列
  464. if (isAllYear) {
  465. const rows = [0, 3, 6, 9], irows = [1, 2, 4, 5, 7, 8, 10, 11]
  466. if (rows.indexOf(row) !== -1) {
  467. //主要隐藏
  468. return { rowspan: 3, colspan: 1 }
  469. } else if (irows.indexOf(row) !== -1) {
  470. //非主要的隐藏
  471. return { rowspan: 0, colspan: 0 }
  472. } else {
  473. return { rowspan: 1, colspan: 1 }
  474. }
  475. }
  476. }
  477. }
  478. const formatInput = (value)=>{
  479. // 移除非数字和小数点
  480. value = value.replace(/[^\d.]/g, '')
  481. // 将输入值转换为浮点数
  482. let floatValue = parseFloat(value)
  483. // 检查输入是否为数字且不小于0
  484. if (!isNaN(floatValue) && floatValue >= 0) {
  485. // 如果是数字且不小于0,则返回原始值
  486. return value
  487. } else {
  488. // 如果输入不符合要求,则返回空字符串
  489. return ''
  490. }
  491. }
  492. const changeInvestMoney = (val, row, index)=>{
  493. let table = yearData.value.list[yearIndex.value].list
  494. table.forEach((ele, index)=>{
  495. if (index === 0) {
  496. table[index].investMoneyAll = Number(table[index].investMoney )
  497. } else if (0 < index < 12) {
  498. // table[index].investMoneyAll = Number(table[index].investMoney ) + Number(table[index - 1].investMoneyAll)
  499. let a = Number( table[index].investMoney )
  500. let b = Number(table[index - 1].investMoneyAll)
  501. a = BigNumber(a)
  502. b = BigNumber(b)
  503. let c = a.plus(b).toNumber()
  504. table[index].investMoneyAll = c
  505. }
  506. })
  507. }
  508. const changePlanRatio = (val, row, index)=>{
  509. /*let table = yearData.value.list[yearIndex.value].list
  510. if (index > 0) {
  511. let topVal = Number(table[index - 1].planRatio)
  512. if (Number(row.planRatio) < topVal) {
  513. window.$message.warning('形象进度百分比:每季度应为增加情况,当月不得低于上月')
  514. row.planRatio = ''
  515. }
  516. } else if (index === 0) {
  517. let nextVal = Number(table[index + 1].planRatio)
  518. if (nextVal > 0 && Number(row.planRatio) > nextVal) {
  519. window.$message.warning('形象进度百分比:每季度应为增加情况,当月不得低于上月')
  520. row.planRatio = ''
  521. }
  522. }*/
  523. }
  524. defineExpose({
  525. batchRemove,
  526. batchExport,
  527. })
  528. </script>
  529. <style lang="scss">
  530. .hc-project-list-table .el-table[hc].new {
  531. --el-table-header-bg-color: #101010;
  532. --el-table-header-text-color: #fff;
  533. --el-table-text-color: #101010;
  534. thead.is-group th.el-table__cell {
  535. background: var(--el-table-header-bg-color);
  536. }
  537. thead .el-table-fixed-column--left.el-table__cell,
  538. thead .el-table-fixed-column--right.el-table__cell {
  539. background: var(--el-table-header-bg-color) !important;
  540. }
  541. tbody .el-table-fixed-column--left.el-table__cell,
  542. tbody .el-table-fixed-column--right.el-table__cell {
  543. background: var(--el-table-tr-bg-color) !important;
  544. }
  545. .el-table__body tr.current-row>td.el-table__cell {
  546. background-color: var(--el-table-current-row-bg-color) !important;
  547. }
  548. }
  549. .hc-project-list-drawer-year {
  550. position: relative;
  551. border: 1px solid #dddddd;
  552. border-top: 0;
  553. height: calc(100% - 170px);
  554. &.detail {
  555. height: calc(100% - 34px);
  556. }
  557. .year-detail {
  558. padding: 14px;
  559. background: #f7f7f7;
  560. border-radius: 5px;
  561. .hc-card-item-header {
  562. border-bottom: 1px solid #ecebeb;
  563. padding-bottom: 10px;
  564. .item-header {
  565. justify-content: center;
  566. }
  567. }
  568. .el-table {
  569. --el-table-border-color: #dcdcdc;
  570. --el-table-header-text-color: #101010;
  571. --el-table-row-hover-bg-color: transparent;
  572. }
  573. .el-table th.el-table__cell.line {
  574. padding: 0;
  575. height: 100%;
  576. .cell {
  577. padding: 0;
  578. height: 100%;
  579. display: contents;
  580. }
  581. .hc-table-th-line {
  582. position: relative;
  583. height: 100%;
  584. font-size: 14px;
  585. display: contents;
  586. .left {
  587. position: absolute;
  588. bottom: 6px;
  589. left: 10px;
  590. }
  591. .right {
  592. position: absolute;
  593. top: 6px;
  594. right: 6px;
  595. font-size: 13px;
  596. }
  597. &::after {
  598. content: '';
  599. position: absolute;
  600. top: 36px;
  601. left: -20px;
  602. width: 180px;
  603. height: 1px;
  604. background: #dcdcdc;
  605. transform: rotate(27deg);
  606. }
  607. }
  608. }
  609. &.edit .el-table--enable-row-transition .el-table__body td.el-table__cell {
  610. height: 60px;
  611. }
  612. .el-table .el-table__cell .cell {
  613. .hc-new-main-body_content {
  614. padding: 4px !important;
  615. .el-input, .el-textarea {
  616. height: 100%;
  617. .el-input__inner {
  618. text-align: center;
  619. }
  620. .el-textarea__inner {
  621. height: 100%;
  622. }
  623. }
  624. }
  625. }
  626. }
  627. }
  628. </style>