project-list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <div class="hc-full">
  3. <hc-table
  4. :column="tableColumn" :datas="tableData" :index-style="{ width: 60 }" is-check :check-style="{ fixed: true, width: 29 }"
  5. class="hc-project-list-table" @selection-change="tableCheckChange"
  6. >
  7. <template #key1="{ row }">
  8. <el-link type="primary" @click="rowNameClick(row)">{{ row.key1 }}</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">
  20. <template #header>
  21. <div class="flex-1 text-center text-[24px] font-bold">项目详情</div>
  22. </template>
  23. <hc-info-table>
  24. <tr>
  25. <hc-info-table-td is-title width="30px" center>项目阶段</hc-info-table-td>
  26. <hc-info-table-td center>开工项目</hc-info-table-td>
  27. <hc-info-table-td is-title width="30px" center>项目类型</hc-info-table-td>
  28. <hc-info-table-td center>高速公路</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>成渝高速</hc-info-table-td>
  33. <hc-info-table-td is-title width="30px" center>建设规模</hc-info-table-td>
  34. <hc-info-table-td center>你猜</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>2023</hc-info-table-td>
  39. <hc-info-table-td is-title width="30px" center>完 工 年</hc-info-table-td>
  40. <hc-info-table-td center>2024</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>重庆建设集团</hc-info-table-td>
  45. <hc-info-table-td is-title width="30px" center rowspan="2">配合单位</hc-info-table-td>
  46. <hc-info-table-td center rowspan="2">你猜</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>你猜啊</hc-info-table-td>
  51. </tr>
  52. </hc-info-table>
  53. <div class="hc-project-list-drawer-year">
  54. <el-scrollbar>
  55. <div class="relative p-3">
  56. <hc-card contents>
  57. <template #header>
  58. <div class="flex-1 text-center text-[14px]">
  59. <HcDropdown />
  60. </div>
  61. </template>
  62. 1111
  63. </hc-card>
  64. </div>
  65. </el-scrollbar>
  66. </div>
  67. </hc-card>
  68. </hc-drawer>
  69. </div>
  70. </template>
  71. <script setup>
  72. import { onMounted, ref, watch } from 'vue'
  73. const props = defineProps({
  74. isAdmin: {
  75. type: Boolean,
  76. default: false,
  77. },
  78. })
  79. //事件
  80. const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check'])
  81. //监听权限
  82. const isAdminAuth = ref(props.isAdmin)
  83. watch(() => props.isAdmin, (admin) => {
  84. isAdminAuth.value = admin
  85. })
  86. //渲染完成
  87. onMounted(() => {
  88. })
  89. //表头
  90. const tableColumn = ref([
  91. { key: 'key1', name: '项目名称' },
  92. { key: 'key2', name: '项目类型' },
  93. { key: 'key3', name: '建设规模' },
  94. { key: 'key4', name: '开工年' },
  95. { key: 'key5', name: '完工年' },
  96. { key: 'key6', name: '牵头单位' },
  97. { key: 'key7', name: '配合单位' },
  98. { key: 'key8', name: '责任单位' },
  99. {
  100. name: '2024年',
  101. children: [
  102. { key: 'key9', name: '全年投资(亿元)' },
  103. { key: 'key10', name: '预计一季度完成投资比例(亿元)' },
  104. { key: 'key11', name: '预计二季度完成投资比例(亿元)' },
  105. { key: 'key12', name: '预计三季度完成投资比例(亿元)' },
  106. { key: 'key13', name: '预计四季度完成投资比例(亿元)' },
  107. {
  108. name: '投资完成金额(亿元)',
  109. children: [
  110. {
  111. name: '一季度',
  112. children: [
  113. { key: 'january', name: '1月' },
  114. { key: 'february', name: '2月' },
  115. { key: 'march', name: '3月' },
  116. ],
  117. },
  118. {
  119. name: '二季度',
  120. children: [
  121. { key: 'april', name: '4月' },
  122. { key: 'may', name: '5月' },
  123. { key: 'june', name: '6月' },
  124. ],
  125. },
  126. {
  127. name: '三季度',
  128. children: [
  129. { key: 'july', name: '7月' },
  130. { key: 'august', name: '8月' },
  131. { key: 'september', name: '9月' },
  132. ],
  133. },
  134. {
  135. name: '四季度',
  136. children: [
  137. { key: 'october', name: '10月' },
  138. { key: 'november', name: '11月' },
  139. { key: 'december', name: '12月' },
  140. ],
  141. },
  142. ],
  143. },
  144. { key: 'key15', name: '当年累计完成投资(亿元)' },
  145. { key: 'key16', name: '开工累计完成投资(亿元)' },
  146. { key: 'key17', name: '全年目标' },
  147. { key: 'key18', name: '一季度工作计划' },
  148. { key: 'key19', name: '二季度工作计划' },
  149. { key: 'key20', name: '三季度工作计划' },
  150. { key: 'key21', name: '四季度工作计划' },
  151. {
  152. name: '工作计划完成情况',
  153. children: [
  154. {
  155. name: '1月',
  156. children: [
  157. { key: 'january1', name: '累计进展情况' },
  158. { key: 'january2', name: '当月进展情况' },
  159. { key: 'january3', name: '形象进度百分比' },
  160. ],
  161. },
  162. {
  163. name: '2月',
  164. children: [
  165. { key: 'february1', name: '累计进展情况' },
  166. { key: 'february2', name: '当月进展情况' },
  167. { key: 'february3', name: '形象进度百分比' },
  168. ],
  169. },
  170. {
  171. name: '3月',
  172. children: [
  173. { key: 'march1', name: '累计进展情况' },
  174. { key: 'march2', name: '当月进展情况' },
  175. { key: 'march3', name: '形象进度百分比' },
  176. ],
  177. },
  178. {
  179. name: '4月',
  180. children: [
  181. { key: 'april1', name: '累计进展情况' },
  182. { key: 'april2', name: '当月进展情况' },
  183. { key: 'april3', name: '形象进度百分比' },
  184. ],
  185. },
  186. {
  187. name: '5月',
  188. children: [
  189. { key: 'may1', name: '累计进展情况' },
  190. { key: 'may2', name: '当月进展情况' },
  191. { key: 'may3', name: '形象进度百分比' },
  192. ],
  193. },
  194. {
  195. name: '6月',
  196. children: [
  197. { key: 'june1', name: '累计进展情况' },
  198. { key: 'june2', name: '当月进展情况' },
  199. { key: 'june3', name: '形象进度百分比' },
  200. ],
  201. },
  202. {
  203. name: '7月',
  204. children: [
  205. { key: 'july1', name: '累计进展情况' },
  206. { key: 'july2', name: '当月进展情况' },
  207. { key: 'july3', name: '形象进度百分比' },
  208. ],
  209. },
  210. {
  211. name: '8月',
  212. children: [
  213. { key: 'august1', name: '累计进展情况' },
  214. { key: 'august2', name: '当月进展情况' },
  215. { key: 'august3', name: '形象进度百分比' },
  216. ],
  217. },
  218. {
  219. name: '9月',
  220. children: [
  221. { key: 'september1', name: '累计进展情况' },
  222. { key: 'september2', name: '当月进展情况' },
  223. { key: 'september3', name: '形象进度百分比' },
  224. ],
  225. },
  226. {
  227. name: '10月',
  228. children: [
  229. { key: 'october1', name: '累计进展情况' },
  230. { key: 'october2', name: '当月进展情况' },
  231. { key: 'october3', name: '形象进度百分比' },
  232. ],
  233. },
  234. {
  235. name: '11月',
  236. children: [
  237. { key: 'november1', name: '累计进展情况' },
  238. { key: 'november2', name: '当月进展情况' },
  239. { key: 'november3', name: '形象进度百分比' },
  240. ],
  241. },
  242. {
  243. name: '12月',
  244. children: [
  245. { key: 'december1', name: '累计进展情况' },
  246. { key: 'december2', name: '当月进展情况' },
  247. { key: 'december3', name: '形象进度百分比' },
  248. ],
  249. },
  250. ],
  251. },
  252. { key: 'key23', name: '存在问题' },
  253. { key: 'key24', name: '工作建议' },
  254. { key: 'key25', name: '填报单位' },
  255. { key: 'key26', name: '联系人' },
  256. ],
  257. },
  258. { key: 'action', name: '操作', width: isAdminAuth.value ? 220 : 100, fixed:'right', align: 'center' },
  259. ])
  260. //表格数据
  261. const tableData = ref([
  262. { key1: '名称1', key2: '-', key3: '-' },
  263. { key1: '名称2', key2: '-', key3: '-' },
  264. { key1: '名称3', key2: '-', key3: '-' },
  265. { key1: '名称4', key2: '-', key3: '-' },
  266. { key1: '名称5', key2: '-', key3: '-' },
  267. ])
  268. //表格被选择
  269. const tableCheckKeys = ref([])
  270. const tableCheckChange = (rows) => {
  271. tableCheckKeys.value = rows
  272. emit('check', rows)
  273. }
  274. //项目名称被点击
  275. const rowNameClick = (row) => {
  276. emit('tap', row)
  277. }
  278. //项目完成情况
  279. const completion = (row) => {
  280. console.log('项目完成情况')
  281. emit('completion', row)
  282. }
  283. //查看
  284. const isDrawer = ref(false)
  285. const examine = (row) => {
  286. isDrawer.value = true
  287. emit('examine', row)
  288. }
  289. //删除
  290. const delTableItem = ({ item }, resolve) => {
  291. console.log('我被执行了', item)
  292. //这里可以写一些操作,下面是模拟3秒关闭
  293. setTimeout(() => {
  294. resolve()
  295. emit('del', item)
  296. }, 3000)
  297. }
  298. //导出数据
  299. const deriveTableItem = ({ item }, resolve) => {
  300. console.log('我被执行了', item)
  301. //这里可以写一些操作,下面是模拟3秒关闭
  302. setTimeout(() => {
  303. resolve()
  304. emit('export', item)
  305. }, 3000)
  306. }
  307. //批量删除
  308. const batchRemove = () => {
  309. if (!isAdminAuth.value) return
  310. const rows = tableCheckKeys.value
  311. console.log('批量删除', rows)
  312. }
  313. //批量导出
  314. const batchExport = () => {
  315. const rows = tableCheckKeys.value
  316. console.log('批量导出', rows)
  317. }
  318. defineExpose({
  319. batchRemove,
  320. batchExport,
  321. })
  322. </script>
  323. <style lang="scss">
  324. .hc-project-list-table .el-table[hc].new {
  325. --el-table-header-bg-color: #101010;
  326. --el-table-header-text-color: #fff;
  327. --el-table-text-color: #101010;
  328. thead.is-group th.el-table__cell {
  329. background: var(--el-table-header-bg-color);
  330. }
  331. thead .el-table-fixed-column--left.el-table__cell,
  332. thead .el-table-fixed-column--right.el-table__cell {
  333. background: var(--el-table-header-bg-color) !important;
  334. }
  335. tbody .el-table-fixed-column--left.el-table__cell,
  336. tbody .el-table-fixed-column--right.el-table__cell {
  337. background: var(--el-table-tr-bg-color) !important;
  338. }
  339. .el-table__body tr.current-row>td.el-table__cell {
  340. background-color: var(--el-table-current-row-bg-color) !important;
  341. }
  342. }
  343. .hc-project-list-drawer-year {
  344. position: relative;
  345. border: 1px solid #dddddd;
  346. border-top: 0;
  347. height: calc(100% - 170px);
  348. }
  349. </style>