增加注释
Showing
1 changed file
with
93 additions
and
1 deletions
| ... | @@ -106,6 +106,11 @@ | ... | @@ -106,6 +106,11 @@ |
| 106 | components: { | 106 | components: { |
| 107 | LbColumn, | 107 | LbColumn, |
| 108 | }, | 108 | }, |
| 109 | |||
| 110 | /** | ||
| 111 | * @description: data | ||
| 112 | * @author: renchao | ||
| 113 | */ | ||
| 109 | data () { | 114 | data () { |
| 110 | return { | 115 | return { |
| 111 | tableHeight: 'auto', | 116 | tableHeight: 'auto', |
| ... | @@ -114,6 +119,10 @@ | ... | @@ -114,6 +119,10 @@ |
| 114 | selected: '' | 119 | selected: '' |
| 115 | } | 120 | } |
| 116 | }, | 121 | }, |
| 122 | /** | ||
| 123 | * @description: created | ||
| 124 | * @author: renchao | ||
| 125 | */ | ||
| 117 | created () { | 126 | created () { |
| 118 | this.getMergeArr(this.data, this.merge) | 127 | this.getMergeArr(this.data, this.merge) |
| 119 | this.getHeight() | 128 | this.getHeight() |
| ... | @@ -124,17 +133,29 @@ | ... | @@ -124,17 +133,29 @@ |
| 124 | }, | 133 | }, |
| 125 | }, | 134 | }, |
| 126 | methods: { | 135 | methods: { |
| 127 | // 单选 | 136 | /** |
| 137 | * @description: 单选 | ||
| 138 | * @param {*} row | ||
| 139 | * @author: renchao | ||
| 140 | */ | ||
| 128 | singleElection (row) { | 141 | singleElection (row) { |
| 129 | this.selected = this.data.indexOf(row); | 142 | this.selected = this.data.indexOf(row); |
| 130 | // this.$emit('row-click', row) | 143 | // this.$emit('row-click', row) |
| 131 | }, | 144 | }, |
| 132 | 145 | ||
| 146 | /** | ||
| 147 | * @description: tableRowClassName | ||
| 148 | * @author: renchao | ||
| 149 | */ | ||
| 133 | tableRowClassName ({ row, rowIndex }) { | 150 | tableRowClassName ({ row, rowIndex }) { |
| 134 | if (rowIndex % 2 === 1) { | 151 | if (rowIndex % 2 === 1) { |
| 135 | return 'interlaced'; | 152 | return 'interlaced'; |
| 136 | } | 153 | } |
| 137 | }, | 154 | }, |
| 155 | /** | ||
| 156 | * @description: getHeight | ||
| 157 | * @author: renchao | ||
| 158 | */ | ||
| 138 | getHeight () { | 159 | getHeight () { |
| 139 | if (!this.heightNumSetting) { | 160 | if (!this.heightNumSetting) { |
| 140 | let _this = this | 161 | let _this = this |
| ... | @@ -170,6 +191,12 @@ | ... | @@ -170,6 +191,12 @@ |
| 170 | }) | 191 | }) |
| 171 | } | 192 | } |
| 172 | }, | 193 | }, |
| 194 | /** | ||
| 195 | * @description: calcHeightx | ||
| 196 | * @param {*} value | ||
| 197 | * @param {*} wappered | ||
| 198 | * @author: renchao | ||
| 199 | */ | ||
| 173 | calcHeightx (value, wappered = true) { | 200 | calcHeightx (value, wappered = true) { |
| 174 | //项目自定义的公共header部分的高度,可忽略 | 201 | //项目自定义的公共header部分的高度,可忽略 |
| 175 | let header = document.querySelector(".from-clues-header").offsetHeight; | 202 | let header = document.querySelector(".from-clues-header").offsetHeight; |
| ... | @@ -195,36 +222,89 @@ | ... | @@ -195,36 +222,89 @@ |
| 195 | } | 222 | } |
| 196 | return res; | 223 | return res; |
| 197 | }, | 224 | }, |
| 225 | /** | ||
| 226 | * @description: clearSelection | ||
| 227 | * @author: renchao | ||
| 228 | */ | ||
| 198 | clearSelection () { | 229 | clearSelection () { |
| 199 | this.$refs.elTable.clearSelection() | 230 | this.$refs.elTable.clearSelection() |
| 200 | }, | 231 | }, |
| 232 | /** | ||
| 233 | * @description: toggleRowSelection | ||
| 234 | * @author: renchao | ||
| 235 | */ | ||
| 201 | toggleRowSelection (row, selected) { | 236 | toggleRowSelection (row, selected) { |
| 202 | this.$refs.elTable.toggleRowSelection(row, selected) | 237 | this.$refs.elTable.toggleRowSelection(row, selected) |
| 203 | }, | 238 | }, |
| 239 | /** | ||
| 240 | * @description: toggleAllSelection | ||
| 241 | * @author: renchao | ||
| 242 | */ | ||
| 204 | toggleAllSelection () { | 243 | toggleAllSelection () { |
| 205 | this.$refs.elTable.toggleAllSelection() | 244 | this.$refs.elTable.toggleAllSelection() |
| 206 | }, | 245 | }, |
| 246 | /** | ||
| 247 | * @description: toggleRowExpansion | ||
| 248 | * @param {*} row | ||
| 249 | * @param {*} bsm | ||
| 250 | * @author: renchao | ||
| 251 | */ | ||
| 207 | toggleRowExpansion (row, expanded) { | 252 | toggleRowExpansion (row, expanded) { |
| 208 | this.$refs.elTable.toggleRowExpansion(row, expanded) | 253 | this.$refs.elTable.toggleRowExpansion(row, expanded) |
| 209 | }, | 254 | }, |
| 255 | /** | ||
| 256 | * @description: setCurrentRow | ||
| 257 | * @param {*} row | ||
| 258 | * @author: renchao | ||
| 259 | */ | ||
| 210 | setCurrentRow (row) { | 260 | setCurrentRow (row) { |
| 211 | this.$refs.elTable.setCurrentRow(row) | 261 | this.$refs.elTable.setCurrentRow(row) |
| 212 | }, | 262 | }, |
| 263 | /** | ||
| 264 | * @description: setCurrentRow | ||
| 265 | * @author: renchao | ||
| 266 | */ | ||
| 213 | clearSort () { | 267 | clearSort () { |
| 214 | this.$refs.elTable.clearSort() | 268 | this.$refs.elTable.clearSort() |
| 215 | }, | 269 | }, |
| 270 | /** | ||
| 271 | * @description: clearFilter | ||
| 272 | * @param {*} columnKey | ||
| 273 | * @author: renchao | ||
| 274 | */ | ||
| 216 | clearFilter (columnKey) { | 275 | clearFilter (columnKey) { |
| 217 | this.$refs.elTable.clearFilter(columnKey) | 276 | this.$refs.elTable.clearFilter(columnKey) |
| 218 | }, | 277 | }, |
| 278 | /** | ||
| 279 | * @description: doLayout | ||
| 280 | * @author: renchao | ||
| 281 | */ | ||
| 219 | doLayout () { | 282 | doLayout () { |
| 220 | this.$refs.elTable.doLayout() | 283 | this.$refs.elTable.doLayout() |
| 221 | }, | 284 | }, |
| 285 | /** | ||
| 286 | * @description: sort | ||
| 287 | * @param {*} prop | ||
| 288 | * @param {*} order | ||
| 289 | * @author: renchao | ||
| 290 | */ | ||
| 222 | sort (prop, order) { | 291 | sort (prop, order) { |
| 223 | this.$refs.elTable.sort(prop, order) | 292 | this.$refs.elTable.sort(prop, order) |
| 224 | }, | 293 | }, |
| 294 | /** | ||
| 295 | * @description: paginationCurrentChange | ||
| 296 | * @param {*} val | ||
| 297 | * @author: renchao | ||
| 298 | */ | ||
| 225 | paginationCurrentChange (val) { | 299 | paginationCurrentChange (val) { |
| 226 | this.$emit('p-current-change', val) | 300 | this.$emit('p-current-change', val) |
| 227 | }, | 301 | }, |
| 302 | /** | ||
| 303 | * @description: getMergeArr | ||
| 304 | * @param {*} tableData | ||
| 305 | * @param {*} merge | ||
| 306 | * @author: renchao | ||
| 307 | */ | ||
| 228 | getMergeArr (tableData, merge) { | 308 | getMergeArr (tableData, merge) { |
| 229 | if (!merge) return | 309 | if (!merge) return |
| 230 | this.mergeLine = {} | 310 | this.mergeLine = {} |
| ... | @@ -247,6 +327,10 @@ | ... | @@ -247,6 +327,10 @@ |
| 247 | }) | 327 | }) |
| 248 | }) | 328 | }) |
| 249 | }, | 329 | }, |
| 330 | /** | ||
| 331 | * @description: mergeMethod | ||
| 332 | * @author: renchao | ||
| 333 | */ | ||
| 250 | mergeMethod ({ row, column, rowIndex, columnIndex }) { | 334 | mergeMethod ({ row, column, rowIndex, columnIndex }) { |
| 251 | const index = this.merge.indexOf(column.property) | 335 | const index = this.merge.indexOf(column.property) |
| 252 | if (index > -1) { | 336 | if (index > -1) { |
| ... | @@ -260,9 +344,17 @@ | ... | @@ -260,9 +344,17 @@ |
| 260 | }, | 344 | }, |
| 261 | }, | 345 | }, |
| 262 | watch: { | 346 | watch: { |
| 347 | /** | ||
| 348 | * @description: merge | ||
| 349 | * @author: renchao | ||
| 350 | */ | ||
| 263 | merge () { | 351 | merge () { |
| 264 | this.getMergeArr(this.data, this.merge) | 352 | this.getMergeArr(this.data, this.merge) |
| 265 | }, | 353 | }, |
| 354 | /** | ||
| 355 | * @description: dataLength | ||
| 356 | * @author: renchao | ||
| 357 | */ | ||
| 266 | dataLength () { | 358 | dataLength () { |
| 267 | this.getMergeArr(this.data, this.merge) | 359 | this.getMergeArr(this.data, this.merge) |
| 268 | } | 360 | } | ... | ... |
-
Please register or sign in to post a comment