xqjyTaskList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="top-table-style">
  3. <el-input v-model="search" placeholder="输入筛选目标点" size="mini"></el-input>
  4. <el-table
  5. height="480"
  6. ref="xqtasklist"
  7. :data="tableDatas.filter(data=> !search || data.targetName.toLowerCase().includes(search.toLowerCase()))"
  8. tooltip-effect="light"
  9. :header-row-style="{background:'rgba(160, 160, 160, 0.3)'}"
  10. :header-cell-style="{padding:'0px',fontFamily: 'SourceHanSansCN-Regular',color: '#fff',backgroundColor:'transparent'}"
  11. :cell-style="{'padding':'0px'}"
  12. :row-style="selectRowStyle"
  13. @row-click="selectRow"
  14. @selection-change="handleSelectionChange"
  15. >
  16. <el-table-column type="selection" width="40" align="center"></el-table-column>
  17. <el-table-column v-for="(col, i) in cols" :prop="col.prop" :label="col.name"
  18. :key="i"
  19. align="center"
  20. :width="col.width"
  21. show-overflow-tooltip></el-table-column>
  22. </el-table>
  23. </div>
  24. </template>
  25. <script>
  26. import {getClickedTagetListDataForxqlbTB} from '@/api/api.js'
  27. export default {
  28. name: "xqjyTaskList",
  29. props: [],
  30. data() {
  31. return {
  32. // eslint-disable-next-line vue/no-dupe-keys
  33. tableDatas: [],
  34. cols: [
  35. {
  36. name: "目标",
  37. prop: "targetName",
  38. width: 80
  39. }, {
  40. name: "目的",
  41. prop: "observationPurposeChinese",
  42. width: 80
  43. }, {
  44. name: "状态",
  45. prop: "statusChinese",
  46. width: 80
  47. }, {
  48. name: "类型",
  49. prop: "typeChinese",
  50. width: 80
  51. }, {
  52. name: "编号",
  53. prop: "parentId",
  54. width: 140
  55. }],
  56. search: "",
  57. selections: [],
  58. selectId: null
  59. };
  60. },
  61. methods: {
  62. handleSelectionChange(val) {
  63. this.selections = val;
  64. },
  65. selectRow(row) {
  66. const old = this.selectId
  67. this.selectId = row.id
  68. if (old == this.selectId) {
  69. return
  70. }
  71. this.$events.emit("xqjywindowlist", row.parentId)
  72. this.$emit("select", row)
  73. },
  74. selectRowStyle({row}) {
  75. // console.log(row, index)
  76. let style = {background: 'rgba(160, 160, 160, 0.3)', height: '30px'};
  77. this.selections.some(select => {
  78. if (select.id == row.id) {
  79. style.background = 'rgba(0, 149, 255, 0.6)'
  80. return true;
  81. }
  82. })
  83. if (this.selectId == row.id) {
  84. style.background = '#0095ff';
  85. }
  86. return style;
  87. },
  88. updateDatas() {
  89. let parentId = sessionStorage.getItem("parentId");
  90. parentId = "241022_XQCH_10018"
  91. getClickedTagetListDataForxqlbTB({
  92. status: 1,
  93. parentId,
  94. }).then(response => {
  95. let data = []
  96. if (response.code == 200) {
  97. data = response.resp
  98. data.forEach(item => {
  99. if (item.observationPurpose != null) {
  100. item.observationPurposeChinese = this.dictionary.observationPurpose[item.observationPurpose]
  101. }
  102. if (item.status != null) {
  103. item.statusChinese = this.dictionary.taskStatus[item.status]
  104. }
  105. if (item.type != null) {
  106. item.typeChinese = this.dictionary.targetType[item.type]
  107. }
  108. })
  109. }
  110. this.tableDatas = data;
  111. })
  112. }
  113. },
  114. mounted() {
  115. let self = this;
  116. self.updateDatas();
  117. },
  118. watch: {
  119. $route(to) {
  120. if (to.name === 'xqjyPage') {
  121. this.updateDatas();
  122. }
  123. }
  124. },
  125. destroyed() {
  126. this.$events.$off("xqglXQTBData")
  127. }
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. .top-table-style {
  132. padding: 70px 20px 0 42px;
  133. .el-input {
  134. width: 142px;
  135. margin: 5px 10px;
  136. float: right;
  137. text-align: center;
  138. ::v-deep(.el-input__inner) {
  139. border: 1px solid #fff;
  140. border-radius: 16px;
  141. background-color: rgba(160, 160, 160, 0.5);
  142. color: #fff;
  143. }
  144. }
  145. .el-table {
  146. margin-top: 20px;
  147. padding: 0 10px;
  148. ::v-deep .el-table__row:hover {
  149. cursor: pointer;
  150. background: #0095ff !important;
  151. }
  152. }
  153. /deep/ .operate-bnt {
  154. color: #fff;
  155. background-color: #016dba;
  156. border: none;
  157. padding: 6px 6px;
  158. }
  159. }
  160. //设置表格内容区域+表头背景色为透明色
  161. // /deep/.el-table th,
  162. // /deep/.el-table tr,
  163. // /deep/.el-table tr {
  164. // background-color: transparent !important;
  165. // }
  166. //设置表格内容区域背景色为透明色
  167. /deep/ .el-table, .el-table__expanded-ceel {
  168. background-color: transparent !important
  169. }
  170. //表格行与行之间存在8px的间距
  171. ::v-deep .el-table__body {
  172. -webkit-border-vertical-spacing: 8px; //垂直间距
  173. // -webkit-border-horizontal-spacing:8px //水平间距
  174. }
  175. //设置表格区域内容背景色为透明时,出现表格底部的横线(表格外层的下边框),以下代码可去掉该横线
  176. /deep/ .el-table:before {
  177. height: 0
  178. }
  179. //去掉表格内容的下边框--没有成功
  180. /deep/ .el-table td, .el-table th.is-leaf {
  181. // border-bottom:none !important //去掉表格内容的所有边框
  182. // border-bottom:1px solid rgba(255,255,255,0.3);
  183. // border-top:1px solid rgba(255,255,255,0.3)
  184. // border:1px solid rgba(255,255,255,0.3)
  185. border: none
  186. }
  187. /deep/ .el-table::after {
  188. right: -1px
  189. }
  190. //修改表格滚动条样式
  191. //滚动条宽度,width 竖向;height 横向
  192. // /deep/ .el-table__body-wrapper::-webkit-scrollbar{
  193. /deep/ ::-webkit-scrollbar {
  194. width: 4px !important;
  195. height: 4px !important;
  196. }
  197. //滚动条滑块样式
  198. // /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb{
  199. /deep/ ::-webkit-scrollbar-thumb {
  200. background-color: rgba(160, 160, 160, 0.3) !important;
  201. border-radius: 2px !important;
  202. }
  203. /deep/ .el-table {
  204. font-size: 14px;
  205. font-family: SourceHanSansCN-Regular;
  206. color: #fff;
  207. background-color: rgba(160, 160, 160, 0.3);
  208. }
  209. /deep/ .el-table .el-table__cell {
  210. text-align: center;
  211. }
  212. //取消鼠标滑过某行时,更改背景色
  213. /deep/ .el-table tbody tr:hover > td {
  214. background-color: transparent !important;
  215. }
  216. </style>