weeklyRecords.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="app-container">
  3. <div style="display: flex;justify-content: space-between;margin-bottom: 8px">
  4. <div style="font-size: 24px">{{ title }}</div>
  5. <el-button size="mini" @click="exportPdf" icon="el-icon-download" style="margin-right: 20px">导出</el-button>
  6. </div>
  7. <el-descriptions title="" :column="2" :size="size" border>
  8. <el-descriptions-item>
  9. <template slot="label">
  10. <i class="el-icon-user"></i>
  11. 会议时间
  12. </template>
  13. 2022-12-12 12:00:00至2022-12-12 12:00:00
  14. </el-descriptions-item>
  15. <el-descriptions-item>
  16. <template slot="label">
  17. <i class="el-icon-mobile-phone"></i>
  18. 会议主持人
  19. </template>
  20. 张三
  21. </el-descriptions-item>
  22. <el-descriptions-item>
  23. <template slot="label">
  24. <i class="el-icon-location-outline"></i>
  25. 会议地点
  26. </template>
  27. 重庆柏玮熠办公室
  28. </el-descriptions-item>
  29. <el-descriptions-item>
  30. <template slot="label">
  31. <i class="el-icon-tickets"></i>
  32. 会议记录人
  33. </template>
  34. <el-tag size="small">李四</el-tag>
  35. </el-descriptions-item>
  36. <el-descriptions-item :span="2">
  37. <template slot="label">
  38. <i class="el-icon-office-building"></i>
  39. 参会人员
  40. </template>
  41. 王五、张三、小七
  42. </el-descriptions-item>
  43. <el-descriptions-item :span="2">
  44. <template slot="label">
  45. <i class="el-icon-office-building"></i>
  46. 参会情况
  47. </template>
  48. 应到15人,实到12人
  49. </el-descriptions-item>
  50. </el-descriptions>
  51. <el-table
  52. style="width: 100%" border stripe>
  53. <el-table-column
  54. prop="date"
  55. label="姓名" align="center"
  56. width="120">
  57. </el-table-column>
  58. <el-table-column prop="workzongjie" label="本周工作总结" align="center" min-width="450">
  59. <el-table-column label="工作内容" align="center">
  60. </el-table-column>
  61. <el-table-column label="是否上周遗留" align="center" width="120">
  62. </el-table-column>
  63. <el-table-column label="完成情况说明" align="center">
  64. </el-table-column>
  65. </el-table-column>
  66. <el-table-column prop="workplan" label="下周工作计划" align="center">
  67. <el-table-column label="工作内容" align="center">
  68. </el-table-column>
  69. <el-table-column label="计划时间" align="center" width="150">
  70. </el-table-column>
  71. </el-table-column>
  72. <el-table-column prop="pingfen" label="评分" align="center" width="85">
  73. </el-table-column>
  74. <el-table-column prop="remark" label="备注" align="center">
  75. </el-table-column>
  76. </el-table>
  77. </div>
  78. </template>
  79. <script>
  80. import {downloadPdf, getWeeksRecordsByWeeks} from "@/api/meeting/meeting";
  81. export default {
  82. name: 'weeklyRecords',
  83. data() {
  84. return {
  85. title: '技术部周会',
  86. size: '',
  87. tableData: [],
  88. meetingId: 30,
  89. weeks: 46,
  90. m: {
  91. id: null,
  92. meetingName: '',
  93. external: 0,
  94. meetingType: 1,
  95. meetingPlace: null,
  96. beginTime: null,
  97. endTime: null,
  98. outAttendees: null,
  99. innerAttendees: '',
  100. emcee: null,
  101. recorder: null,
  102. createUserId: 1,
  103. createTime: null,
  104. status: 1,
  105. weeks: 46
  106. },
  107. workContents: {
  108. col: 0,
  109. row: 0
  110. },
  111. spanArr: [], // 存合并行数据的数组
  112. pos: 0,// 合并行数据数组下标
  113. rowIndex: 1, // 序号
  114. // 合并行
  115. mergeArr: [],
  116. // 排序号
  117. indexNum: {},
  118. }
  119. },
  120. methods: {
  121. exportPdf() {
  122. downloadPdf()
  123. },
  124. getData() {
  125. getWeeksRecordsByWeeks(this.meetingId, this.weeks).then(res => {
  126. this.tableData = res.data.workContent
  127. // this.getSpanArr(this.tableData)
  128. this.m = res.data.meeting
  129. })
  130. },
  131. colMethod(columnArr, data) {
  132. let column = {}
  133. let position = 0
  134. //遍历合并的列的数据
  135. columnArr.forEach((prop) => {
  136. column[prop] = []
  137. data.forEach((row, rowIndex) => {
  138. column[prop][rowIndex] = [1, 1]
  139. if (rowIndex === 0) {
  140. position = 0
  141. } else if (row[prop] === data[rowIndex - 1][prop]) {
  142. // 当前行数据等于上一行,根据记录的行号,计算需要合并几行。
  143. column[prop][position][0] += 1
  144. // 当前行 隐藏不显示
  145. column[prop][rowIndex][0] = 0
  146. } else {
  147. // 不相等之后,重置记录行号
  148. position = rowIndex
  149. }
  150. })
  151. })
  152. return column;
  153. },
  154. getList() {
  155. const _this = this;
  156. // 计算合并的行
  157. this.mergeArr = this.colMethod(['id'], this.tableData)
  158. // 浅拷贝处理数据
  159. let dataBase = Array.from(this.tableData);
  160. let saleIdArr = this.colMethod(['id'], dataBase)
  161. // 先根据saleId合并第一次,将数据源根据合并下标处理为多段数据源
  162. let newData = []
  163. saleIdArr.saleId.forEach((item, index) => {
  164. if (item[0] > 0) {
  165. let res = []
  166. for (let i = 0; i < item[0]; i++) {
  167. res.push(dataBase.slice(0, 1)[0])
  168. this.$delete(dataBase, 0)
  169. }
  170. newData.push(res)
  171. }
  172. })
  173. // 根据合并后的数据,分段处理time的合并行下标
  174. let outArr = []
  175. for (let i = 0; i < newData.length; i++) {
  176. let obt = _this.colMethod(['time'], newData[i]);
  177. if (obt.outboundTime.length > 0) {
  178. outArr.push(obt.outboundTime)
  179. }
  180. }
  181. // 处理time合并行
  182. let finishRes = []
  183. outArr.forEach(item => {
  184. if (item.length > 1) {
  185. for (let i = 0; i < item.length; i++) {
  186. finishRes.push(item[i])
  187. }
  188. } else {
  189. finishRes.push(item[0])
  190. }
  191. })
  192. // 赋值给总合并行集合
  193. this.mergeArr.outboundTime = finishRes
  194. //排列序号
  195. this.indexObj()
  196. },
  197. getSpanArr(data) {
  198. // 重新查询后,要清空行数据数组、序号重置为1
  199. this.spanArr = []
  200. this.rowIndex = 1
  201. for (let i = 0; i < data.length; i++) {
  202. let executor = data[i].executor;
  203. if (i === 0) {
  204. this.spanArr.push(1)
  205. this.pos = 0
  206. data[i].serialNo = this.rowIndex
  207. this.rowIndex++
  208. } else {
  209. if (data[i].executor === data[i - 1].executor) {
  210. this.spanArr.push[this.pos] += 1
  211. this.spanArr.push(0)
  212. } else {
  213. this.spanArr.push(1)
  214. this.pos = i
  215. data[i].serialNo = this.rowIndex
  216. this.rowIndex++
  217. }
  218. }
  219. }
  220. },
  221. objectSpanMethod({row, column, rowIndex, columnIndex}) {
  222. let arr = this.mergeArr[column.property] || []
  223. if (column.type == 'index' && this.mergeArr['id'])
  224. return this.mergeArr['id'][rowIndex]
  225. else if (arr.length) return arr[rowIndex]
  226. else [1, 1]
  227. },
  228. indexObj() {
  229. let num = 0;
  230. this.mergeArr['id'].forEach((item, index) => {
  231. if (item[0] != 0) {
  232. this.indexNum[index] = num += 1
  233. }
  234. })
  235. }
  236. }
  237. }
  238. </script>