gist-list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div v-loading="isLoading" class="hc-full" element-loading-text="加载中...">
  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 #key2="{ row }">
  8. <el-link type="primary" @click="rowNameClick(row)">{{ row.key2 }}</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" is-action-btn>
  20. <template #header>
  21. <div class="flex-1 text-center text-[24px] font-bold">工作要点详情</div>
  22. </template>
  23. <div class="hc-project-list-flex">
  24. <div class="hc-project-list-info-table">
  25. <hc-info-table>
  26. <tr>
  27. <hc-info-table-td is-title width="10%" center>项目阶段</hc-info-table-td>
  28. <hc-info-table-td center width="40%">紧盯重大项目,推动交通投资稳进增效</hc-info-table-td>
  29. <hc-info-table-td is-title width="10%" center>目标任务</hc-info-table-td>
  30. <hc-info-table-td center width="40%">充分发挥投资的关键作用</hc-info-table-td>
  31. </tr>
  32. </hc-info-table>
  33. <hc-info-table class="mt-[-1px]">
  34. <tr>
  35. <hc-info-table-td is-title width="10%" center>工作内容</hc-info-table-td>
  36. <hc-info-table-td center width="90%">2024年,市交通运输委完成投资1155亿元,其中铁路计划完成投资480亿元、公路计划完成投资565亿元(高速公路建设计划投资428亿元、高速公路养护计划投资8.5亿元、普通公路建设及养护工程力争完成投资110亿元、公交及枢纽场站计划投资8.5亿元)、水运计划投资39亿元、民航计划投资70亿元、邮政计划投资1.3亿元、公交车辆购置更新等其他计划投资10亿元。</hc-info-table-td>
  37. </tr>
  38. <tr v-if="isDrawerType === 'view'">
  39. <hc-info-table-td is-title width="10%" center>责任单位</hc-info-table-td>
  40. <hc-info-table-td center width="90%">市交通运输委</hc-info-table-td>
  41. </tr>
  42. </hc-info-table>
  43. </div>
  44. <div class="hc-project-list-drawer-year">
  45. <hc-body scrollbar padding="0">
  46. <div class="relative p-2 pt-6">
  47. <hc-card-item class="year-detail" :class="isDrawerType === 'edit' ? 'edit' : ''">
  48. <template #header>
  49. <div class="flex-1 text-center text-[14px]">
  50. <HcDropdown v-model="yearKey" :datas="yearData" />
  51. </div>
  52. </template>
  53. <el-table :data="tableYearData" border class="w-full">
  54. <el-table-column prop="month" class-name="line" width="120" align="center">
  55. <template #header>
  56. <div class="hc-table-th-line">
  57. <span class="left">月份</span>
  58. <span class="right">完成情况</span>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="key1" label="进展情况" align="center">
  63. <template #default="{ row }">
  64. <hc-body v-if="isDrawerType === 'edit'">
  65. <hc-table-input v-model="row.key1" type="textarea" resize="none" />
  66. </hc-body>
  67. <span v-else>{{ row.key1 }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="key2" label="累计进展情况" align="center">
  71. <template #default="{ row }">
  72. <hc-body v-if="isDrawerType === 'edit'">
  73. <hc-table-input v-model="row.key2" type="textarea" resize="none" />
  74. </hc-body>
  75. <span v-else>{{ row.key2 }}</span>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <hc-info-table class="mt-[-1px]">
  80. <tr>
  81. <hc-info-table-td is-title width="10%" center>存在问题</hc-info-table-td>
  82. <hc-info-table-td center width="40%">
  83. <span v-if="isDrawerType === 'view'">{{ testValue }}</span>
  84. <el-input v-else v-model="testValue" type="textarea" resize="none" />
  85. </hc-info-table-td>
  86. <hc-info-table-td is-title width="10%" center>工作建议</hc-info-table-td>
  87. <hc-info-table-td center width="40%">
  88. <span v-if="isDrawerType === 'view'">{{ testValue }}</span>
  89. <el-input v-else v-model="testValue" type="textarea" resize="none" />
  90. </hc-info-table-td>
  91. </tr>
  92. <tr>
  93. <hc-info-table-td is-title width="10%" center>填报单位</hc-info-table-td>
  94. <hc-info-table-td center width="40%">
  95. <span v-if="isDrawerType === 'view'">{{ testValue }}</span>
  96. <el-input v-else v-model="testValue" />
  97. </hc-info-table-td>
  98. <hc-info-table-td is-title width="10%" center>联系人及联系方式</hc-info-table-td>
  99. <hc-info-table-td center width="40%">
  100. <span v-if="isDrawerType === 'view'">{{ testValue }}</span>
  101. <el-input v-else v-model="testValue" />
  102. </hc-info-table-td>
  103. </tr>
  104. </hc-info-table>
  105. </hc-card-item>
  106. </div>
  107. </hc-body>
  108. </div>
  109. </div>
  110. <template v-if="isDrawerType === 'edit'" #action>
  111. <el-button type="info" @click="isDrawer = false">取消</el-button>
  112. <el-button type="warning" @click="saveCompletionClick">保存</el-button>
  113. </template>
  114. </hc-card>
  115. </hc-drawer>
  116. </div>
  117. </template>
  118. <script setup>
  119. import { ref, watch } from 'vue'
  120. const props = defineProps({
  121. isAdmin: {
  122. type: Boolean,
  123. default: false,
  124. },
  125. loading: {
  126. type: Boolean,
  127. default: false,
  128. },
  129. datas: {
  130. type: Array,
  131. default: () => ([]),
  132. },
  133. })
  134. //事件
  135. const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check'])
  136. //监听权限
  137. const isAdminAuth = ref(props.isAdmin)
  138. watch(() => props.isAdmin, (admin) => {
  139. isAdminAuth.value = admin
  140. })
  141. //监听数据
  142. const tableData = ref(props.datas)
  143. watch(() => props.datas, (data) => {
  144. tableData.value = data
  145. })
  146. //监听加载
  147. const isLoading = ref(props.loading)
  148. watch(() => props.loading, (res) => {
  149. isLoading.value = res
  150. })
  151. //表头
  152. const tableColumn = [
  153. { key: 'workFocusStage', name: '项目阶段', width: 100 },
  154. { key: 'targetPlan', name: '目标任务', width: 140 },
  155. { key: 'workPlan', name: '工作内容' },
  156. { key: 'startYear', name: '开始年份', width: 100 },
  157. { key: 'endYear', name: '结束年份', width: 100 },
  158. { key: 'dutyUnit', name: '责任单位', width: 100 },
  159. { key: 'key7', name: '完成情况填写比例(%)', width: 100 },
  160. { key: 'action', name: '操作', width: isAdminAuth.value ? 220 : 100, fixed:'right', align: 'center' },
  161. ]
  162. //表格被选择
  163. const tableCheckKeys = ref([])
  164. const tableCheckChange = (rows) => {
  165. tableCheckKeys.value = rows
  166. emit('check', rows)
  167. }
  168. //项目名称被点击
  169. const rowNameClick = (row) => {
  170. emit('tap', row)
  171. }
  172. //工作完成情况
  173. const tableYearData = ref([
  174. { month: '1月', key1: '', key2: '' },
  175. { month: '2月', key1: '', key2: '' },
  176. { month: '3月', key1: '', key2: '' },
  177. { month: '4月', key1: '', key2: '' },
  178. { month: '5月', key1: '', key2: '' },
  179. { month: '6月', key1: '', key2: '' },
  180. { month: '7月', key1: '', key2: '' },
  181. { month: '8月', key1: '', key2: '' },
  182. { month: '9月', key1: '', key2: '' },
  183. { month: '10月', key1: '', key2: '' },
  184. { month: '11月', key1: '', key2: '' },
  185. { month: '12月', key1: '', key2: '' },
  186. ])
  187. const testValue = ref('')
  188. //工作完成情况
  189. const completion = (row) => {
  190. isDrawerType.value = 'edit'
  191. isDrawer.value = true
  192. emit('completion', row)
  193. }
  194. //保存工作完成情况
  195. const saveCompletionClick = () => {
  196. isDrawer.value = false
  197. isDrawerType.value = ''
  198. }
  199. //查看
  200. const isDrawer = ref(false)
  201. const isDrawerType = ref('view')
  202. const examine = (row) => {
  203. isDrawerType.value = 'view'
  204. isDrawer.value = true
  205. emit('examine', row)
  206. }
  207. //删除
  208. const delTableItem = ({ item }, resolve) => {
  209. console.log('我被执行了', item)
  210. //这里可以写一些操作,下面是模拟3秒关闭
  211. setTimeout(() => {
  212. resolve()
  213. emit('del', item)
  214. }, 3000)
  215. }
  216. //导出数据
  217. const deriveTableItem = ({ item }, resolve) => {
  218. console.log('我被执行了', item)
  219. //这里可以写一些操作,下面是模拟3秒关闭
  220. setTimeout(() => {
  221. resolve()
  222. emit('export', item)
  223. }, 3000)
  224. }
  225. //批量删除
  226. const batchRemove = () => {
  227. if (!isAdminAuth.value) return
  228. const rows = tableCheckKeys.value
  229. console.log('批量删除', rows)
  230. }
  231. //批量导出
  232. const batchExport = () => {
  233. const rows = tableCheckKeys.value
  234. console.log('批量导出', rows)
  235. }
  236. //年数据
  237. const yearKey = ref('2023')
  238. const yearData = ref([
  239. { key: '2023', label: '2023年' },
  240. { key: '2024', label: '2024年' },
  241. ])
  242. defineExpose({
  243. batchRemove,
  244. batchExport,
  245. })
  246. </script>
  247. <style lang="scss">
  248. .hc-project-list-flex {
  249. position: relative;
  250. height: 100%;
  251. display: flex;
  252. flex-direction: column;
  253. .hc-project-list-info-table {
  254. flex-shrink: 0;
  255. }
  256. .hc-project-list-drawer-year {
  257. position: relative;
  258. border: 1px solid #dddddd;
  259. border-top: 0;
  260. flex: 1;
  261. flex-basis: auto;
  262. .el-table {
  263. --el-table-border-color: #dcdcdc;
  264. --el-table-header-text-color: #101010;
  265. --el-table-row-hover-bg-color: transparent;
  266. }
  267. .el-table th.el-table__cell.line {
  268. padding: 0;
  269. height: 100%;
  270. .cell {
  271. padding: 0;
  272. height: 100%;
  273. display: contents;
  274. }
  275. .hc-table-th-line {
  276. position: relative;
  277. height: 100%;
  278. font-size: 14px;
  279. display: contents;
  280. .left {
  281. position: absolute;
  282. bottom: 2px;
  283. left: 10px;
  284. }
  285. .right {
  286. position: absolute;
  287. top: 2px;
  288. right: 2px;
  289. }
  290. &::after {
  291. content: '';
  292. position: absolute;
  293. top: 23px;
  294. left: -20px;
  295. width: 180px;
  296. height: 1px;
  297. background: #dcdcdc;
  298. transform: rotate(17.5deg);
  299. }
  300. }
  301. }
  302. &.edit .el-table--enable-row-transition .el-table__body td.el-table__cell {
  303. height: 60px;
  304. }
  305. .el-table .el-table__cell .cell {
  306. .hc-new-main-body_content {
  307. padding: 4px !important;
  308. .el-input, .el-textarea {
  309. height: 100%;
  310. .el-input__inner {
  311. text-align: center;
  312. }
  313. .el-textarea__inner {
  314. height: 100%;
  315. }
  316. }
  317. }
  318. }
  319. }
  320. }
  321. </style>