toolbar.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. import XEUtils from 'xe-utils'
  2. import GlobalConfig from '../../v-x-e-table/src/conf'
  3. import VXETable from '../../v-x-e-table'
  4. import vSize from '../../mixins/size'
  5. import UtilTools from '../../tools/utils'
  6. import DomTools from '../../tools/dom'
  7. import { getSlotVNs } from '../../tools/vn'
  8. import { GlobalEvent } from '../../tools/event'
  9. import { warnLog, errLog } from '../../tools/log'
  10. const renderDropdowns = (h, _vm, item, isBtn) => {
  11. const { _e } = _vm
  12. const { dropdowns } = item
  13. if (dropdowns) {
  14. return dropdowns.map(child => {
  15. return child.visible === false ? _e() : h('vxe-button', {
  16. on: {
  17. click: evnt => isBtn ? _vm.btnEvent(evnt, child) : _vm.tolEvent(evnt, child)
  18. },
  19. props: {
  20. disabled: child.disabled,
  21. loading: child.loading,
  22. type: child.type,
  23. icon: child.icon,
  24. circle: child.circle,
  25. round: child.round,
  26. status: child.status,
  27. content: child.name
  28. }
  29. })
  30. })
  31. }
  32. return []
  33. }
  34. /**
  35. * 渲染按钮
  36. */
  37. function renderBtns (h, _vm) {
  38. const { _e, $scopedSlots, $xegrid, $xetable, buttons = [] } = _vm
  39. const buttonsSlot = $scopedSlots.buttons
  40. if (buttonsSlot) {
  41. return buttonsSlot.call(_vm, { $grid: $xegrid, $table: $xetable }, h)
  42. }
  43. return buttons.map(item => {
  44. const { dropdowns, buttonRender } = item
  45. const compConf = buttonRender ? VXETable.renderer.get(buttonRender.name) : null
  46. if (item.visible === false) {
  47. return _e()
  48. }
  49. if (compConf) {
  50. const renderToolbarButton = compConf.renderToolbarButton || compConf.renderButton
  51. if (renderToolbarButton) {
  52. return h('span', {
  53. class: 'vxe-button--item'
  54. }, getSlotVNs(renderToolbarButton.call(_vm, h, buttonRender, { $grid: $xegrid, $table: $xetable, button: item })))
  55. }
  56. }
  57. return h('vxe-button', {
  58. on: {
  59. click: evnt => _vm.btnEvent(evnt, item)
  60. },
  61. props: {
  62. disabled: item.disabled,
  63. loading: item.loading,
  64. type: item.type,
  65. icon: item.icon,
  66. circle: item.circle,
  67. round: item.round,
  68. status: item.status,
  69. content: item.name,
  70. destroyOnClose: item.destroyOnClose,
  71. placement: item.placement,
  72. transfer: item.transfer
  73. },
  74. scopedSlots: dropdowns && dropdowns.length ? {
  75. dropdowns: () => renderDropdowns(h, _vm, item, true)
  76. } : null
  77. })
  78. })
  79. }
  80. /**
  81. * 渲染右侧工具
  82. */
  83. function renderRightTools (h, _vm) {
  84. const { _e, $scopedSlots, $xegrid, $xetable, tools = [] } = _vm
  85. const toolsSlot = $scopedSlots.tools
  86. if (toolsSlot) {
  87. return toolsSlot.call(_vm, { $grid: $xegrid, $table: $xetable }, h)
  88. }
  89. return tools.map(item => {
  90. const { dropdowns, toolRender } = item
  91. const compConf = toolRender ? VXETable.renderer.get(toolRender.name) : null
  92. if (item.visible === false) {
  93. return _e()
  94. }
  95. if (compConf) {
  96. const { renderToolbarTool } = compConf
  97. if (renderToolbarTool) {
  98. return h('span', {
  99. class: 'vxe-tool--item'
  100. }, getSlotVNs(renderToolbarTool.call(_vm, h, toolRender, { $grid: $xegrid, $table: $xetable, tool: item })))
  101. }
  102. }
  103. return h('vxe-button', {
  104. on: {
  105. click: evnt => _vm.tolEvent(evnt, item)
  106. },
  107. props: {
  108. disabled: item.disabled,
  109. loading: item.loading,
  110. type: item.type,
  111. icon: item.icon,
  112. circle: item.circle,
  113. round: item.round,
  114. status: item.status,
  115. content: item.name,
  116. destroyOnClose: item.destroyOnClose,
  117. placement: item.placement,
  118. transfer: item.transfer
  119. },
  120. scopedSlots: dropdowns && dropdowns.length ? {
  121. dropdowns: () => renderDropdowns(h, _vm, item, false)
  122. } : null
  123. })
  124. })
  125. }
  126. function renderCustoms (h, _vm) {
  127. const { $xetable, customStore, customOpts, columns } = _vm
  128. const cols = []
  129. const customBtnOns = {}
  130. const customWrapperOns = {}
  131. const checkMethod = $xetable ? $xetable.customOpts.checkMethod : null
  132. if (customOpts.trigger === 'manual') {
  133. // 手动触发
  134. } else if (customOpts.trigger === 'hover') {
  135. // hover 触发
  136. customBtnOns.mouseenter = _vm.handleMouseenterSettingEvent
  137. customBtnOns.mouseleave = _vm.handleMouseleaveSettingEvent
  138. customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent
  139. customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent
  140. } else {
  141. // 点击触发
  142. customBtnOns.click = _vm.handleClickSettingEvent
  143. }
  144. XEUtils.eachTree(columns, (column) => {
  145. const colTitle = UtilTools.formatText(column.getTitle(), 1)
  146. const colKey = column.getKey()
  147. const isColGroup = column.children && column.children.length
  148. const isDisabled = checkMethod ? !checkMethod({ column }) : false
  149. if (isColGroup || colKey) {
  150. const isChecked = column.visible
  151. const isIndeterminate = column.halfVisible
  152. cols.push(
  153. h('li', {
  154. class: ['vxe-custom--option', `level--${column.level}`, {
  155. 'is--group': isColGroup,
  156. 'is--checked': isChecked,
  157. 'is--indeterminate': isIndeterminate,
  158. 'is--disabled': isDisabled
  159. }],
  160. attrs: {
  161. title: colTitle
  162. },
  163. on: {
  164. click: () => {
  165. if (!isDisabled) {
  166. _vm.changeCustomOption(column)
  167. }
  168. }
  169. }
  170. }, [
  171. h('span', {
  172. class: ['vxe-checkbox--icon', isIndeterminate ? GlobalConfig.icon.TABLE_CHECKBOX_INDETERMINATE : (isChecked ? GlobalConfig.icon.TABLE_CHECKBOX_CHECKED : GlobalConfig.icon.TABLE_CHECKBOX_UNCHECKED)]
  173. }),
  174. h('span', {
  175. class: 'vxe-checkbox--label'
  176. }, colTitle)
  177. ])
  178. )
  179. }
  180. })
  181. const isAllChecked = customStore.isAll
  182. const isAllIndeterminate = customStore.isIndeterminate
  183. return h('div', {
  184. class: ['vxe-custom--wrapper', {
  185. 'is--active': customStore.visible
  186. }],
  187. ref: 'customWrapper'
  188. }, [
  189. h('vxe-button', {
  190. props: {
  191. circle: true,
  192. icon: customOpts.icon || GlobalConfig.icon.TOOLBAR_TOOLS_CUSTOM
  193. },
  194. attrs: {
  195. title: GlobalConfig.i18n('vxe.toolbar.custom')
  196. },
  197. on: customBtnOns
  198. }),
  199. h('div', {
  200. class: 'vxe-custom--option-wrapper'
  201. }, [
  202. h('ul', {
  203. class: 'vxe-custom--header'
  204. }, [
  205. h('li', {
  206. class: ['vxe-custom--option', {
  207. 'is--checked': isAllChecked,
  208. 'is--indeterminate': isAllIndeterminate
  209. }],
  210. attrs: {
  211. title: GlobalConfig.i18n('vxe.table.allTitle')
  212. },
  213. on: {
  214. click: _vm.allCustomEvent
  215. }
  216. }, [
  217. h('span', {
  218. class: ['vxe-checkbox--icon', isAllIndeterminate ? GlobalConfig.icon.TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? GlobalConfig.icon.TABLE_CHECKBOX_CHECKED : GlobalConfig.icon.TABLE_CHECKBOX_UNCHECKED)]
  219. }),
  220. h('span', {
  221. class: 'vxe-checkbox--label'
  222. }, GlobalConfig.i18n('vxe.toolbar.customAll'))
  223. ])
  224. ]),
  225. h('ul', {
  226. class: 'vxe-custom--body',
  227. on: customWrapperOns
  228. }, cols),
  229. customOpts.isFooter === false ? null : h('div', {
  230. class: 'vxe-custom--footer'
  231. }, [
  232. h('button', {
  233. class: 'btn--confirm',
  234. on: {
  235. click: _vm.confirmCustomEvent
  236. }
  237. }, GlobalConfig.i18n('vxe.toolbar.customConfirm')),
  238. h('button', {
  239. class: 'btn--reset',
  240. on: {
  241. click: _vm.resetCustomEvent
  242. }
  243. }, GlobalConfig.i18n('vxe.toolbar.customRestore'))
  244. ])
  245. ])
  246. ])
  247. }
  248. export default {
  249. name: 'VxeToolbar',
  250. mixins: [vSize],
  251. props: {
  252. loading: Boolean,
  253. refresh: [Boolean, Object],
  254. import: [Boolean, Object],
  255. export: [Boolean, Object],
  256. print: [Boolean, Object],
  257. zoom: [Boolean, Object],
  258. custom: [Boolean, Object],
  259. buttons: { type: Array, default: () => GlobalConfig.toolbar.buttons },
  260. tools: { type: Array, default: () => GlobalConfig.toolbar.tools },
  261. perfect: { type: Boolean, default: () => GlobalConfig.toolbar.perfect },
  262. size: { type: String, default: () => GlobalConfig.toolbar.size || GlobalConfig.size },
  263. className: [String, Function]
  264. },
  265. inject: {
  266. $xegrid: {
  267. default: null
  268. }
  269. },
  270. data () {
  271. return {
  272. $xetable: null,
  273. isRefresh: false,
  274. columns: [],
  275. customStore: {
  276. isAll: false,
  277. isIndeterminate: false,
  278. visible: false
  279. }
  280. }
  281. },
  282. computed: {
  283. refreshOpts () {
  284. return Object.assign({}, GlobalConfig.toolbar.refresh, this.refresh)
  285. },
  286. importOpts () {
  287. return Object.assign({}, GlobalConfig.toolbar.import, this.import)
  288. },
  289. exportOpts () {
  290. return Object.assign({}, GlobalConfig.toolbar.export, this.export)
  291. },
  292. printOpts () {
  293. return Object.assign({}, GlobalConfig.toolbar.print, this.print)
  294. },
  295. zoomOpts () {
  296. return Object.assign({}, GlobalConfig.toolbar.zoom, this.zoom)
  297. },
  298. customOpts () {
  299. return Object.assign({}, GlobalConfig.toolbar.custom, this.custom)
  300. }
  301. },
  302. created () {
  303. const { refresh, refreshOpts } = this
  304. this.$nextTick(() => {
  305. const $xetable = this.fintTable()
  306. const queryMethod = refreshOpts.queryMethod || refreshOpts.query
  307. if (refresh && !this.$xegrid && !queryMethod) {
  308. warnLog('vxe.error.notFunc', ['queryMethod'])
  309. }
  310. if ($xetable) {
  311. $xetable.connect(this)
  312. }
  313. if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
  314. if (this.buttons) {
  315. this.buttons.forEach(item => {
  316. const { buttonRender } = item
  317. const compConf = buttonRender ? VXETable.renderer.get(buttonRender.name) : null
  318. if (compConf && compConf.renderButton) {
  319. warnLog('vxe.error.delFunc', ['renderButton', 'renderToolbarButton'])
  320. }
  321. })
  322. }
  323. }
  324. })
  325. GlobalEvent.on(this, 'mousedown', this.handleGlobalMousedownEvent)
  326. GlobalEvent.on(this, 'blur', this.handleGlobalBlurEvent)
  327. },
  328. destroyed () {
  329. GlobalEvent.off(this, 'mousedown')
  330. GlobalEvent.off(this, 'blur')
  331. },
  332. render (h) {
  333. const { _e, $xegrid, perfect, loading, importOpts, exportOpts, refresh, refreshOpts, zoom, zoomOpts, custom, vSize, className } = this
  334. return h('div', {
  335. class: ['vxe-toolbar', className ? (XEUtils.isFunction(className) ? className({ $toolbar: this }) : className) : '', {
  336. [`size--${vSize}`]: vSize,
  337. 'is--perfect': perfect,
  338. 'is--loading': loading
  339. }]
  340. }, [
  341. h('div', {
  342. class: 'vxe-buttons--wrapper'
  343. }, renderBtns(h, this)),
  344. h('div', {
  345. class: 'vxe-tools--wrapper'
  346. }, renderRightTools(h, this)),
  347. h('div', {
  348. class: 'vxe-tools--operate'
  349. }, [
  350. this.import ? h('vxe-button', {
  351. props: {
  352. circle: true,
  353. icon: importOpts.icon || GlobalConfig.icon.TOOLBAR_TOOLS_IMPORT
  354. },
  355. attrs: {
  356. title: GlobalConfig.i18n('vxe.toolbar.import')
  357. },
  358. on: {
  359. click: this.importEvent
  360. }
  361. }) : _e(),
  362. this.export ? h('vxe-button', {
  363. props: {
  364. circle: true,
  365. icon: exportOpts.icon || GlobalConfig.icon.TOOLBAR_TOOLS_EXPORT
  366. },
  367. attrs: {
  368. title: GlobalConfig.i18n('vxe.toolbar.export')
  369. },
  370. on: {
  371. click: this.exportEvent
  372. }
  373. }) : _e(),
  374. this.print ? h('vxe-button', {
  375. props: {
  376. circle: true,
  377. icon: this.printOpts.icon || GlobalConfig.icon.TOOLBAR_TOOLS_PRINT
  378. },
  379. attrs: {
  380. title: GlobalConfig.i18n('vxe.toolbar.print')
  381. },
  382. on: {
  383. click: this.printEvent
  384. }
  385. }) : _e(),
  386. refresh ? h('vxe-button', {
  387. props: {
  388. circle: true,
  389. icon: this.isRefresh ? (refreshOpts.iconLoading || GlobalConfig.icon.TOOLBAR_TOOLS_REFRESH_LOADING) : (refreshOpts.icon || GlobalConfig.icon.TOOLBAR_TOOLS_REFRESH)
  390. },
  391. attrs: {
  392. title: GlobalConfig.i18n('vxe.toolbar.refresh')
  393. },
  394. on: {
  395. click: this.refreshEvent
  396. }
  397. }) : _e(),
  398. zoom && $xegrid ? h('vxe-button', {
  399. props: {
  400. circle: true,
  401. icon: $xegrid.isMaximized() ? (zoomOpts.iconOut || GlobalConfig.icon.TOOLBAR_TOOLS_MINIMIZE) : (zoomOpts.iconIn || GlobalConfig.icon.TOOLBAR_TOOLS_FULLSCREEN)
  402. },
  403. attrs: {
  404. title: GlobalConfig.i18n(`vxe.toolbar.zoom${$xegrid.isMaximized() ? 'Out' : 'In'}`)
  405. },
  406. on: {
  407. click: $xegrid.triggerZoomEvent
  408. }
  409. }) : _e(),
  410. custom ? renderCustoms(h, this) : _e()
  411. ])
  412. ])
  413. },
  414. methods: {
  415. syncUpdate (params) {
  416. const { collectColumn, $table } = params
  417. this.$xetable = $table
  418. this.columns = collectColumn
  419. },
  420. fintTable () {
  421. const { $children } = this.$parent
  422. const selfIndex = $children.indexOf(this)
  423. return XEUtils.find($children, (comp, index) => comp && comp.loadData && index > selfIndex && comp.$vnode.componentOptions.tag === 'vxe-table')
  424. },
  425. checkTable () {
  426. if (this.$xetable) {
  427. return true
  428. }
  429. errLog('vxe.error.barUnableLink')
  430. },
  431. showCustom () {
  432. this.customStore.visible = true
  433. this.checkCustomStatus()
  434. },
  435. closeCustom () {
  436. const { custom, customStore } = this
  437. if (customStore.visible) {
  438. customStore.visible = false
  439. if (custom && !customStore.immediate) {
  440. this.handleTableCustom()
  441. }
  442. }
  443. },
  444. confirmCustomEvent (evnt) {
  445. this.closeCustom()
  446. this.emitCustomEvent('confirm', evnt)
  447. },
  448. customOpenEvent (evnt) {
  449. const { customStore } = this
  450. if (this.checkTable()) {
  451. if (!customStore.visible) {
  452. this.showCustom()
  453. this.emitCustomEvent('open', evnt)
  454. }
  455. }
  456. },
  457. customColseEvent (evnt) {
  458. const { customStore } = this
  459. if (customStore.visible) {
  460. this.closeCustom()
  461. this.emitCustomEvent('close', evnt)
  462. }
  463. },
  464. resetCustomEvent (evnt) {
  465. const { $xetable, columns } = this
  466. const checkMethod = $xetable.customOpts.checkMethod
  467. XEUtils.eachTree(columns, column => {
  468. if (!checkMethod || checkMethod({ column })) {
  469. column.visible = column.defaultVisible
  470. column.halfVisible = false
  471. }
  472. column.resizeWidth = 0
  473. })
  474. $xetable.saveCustomResizable(true)
  475. this.closeCustom()
  476. this.emitCustomEvent('reset', evnt)
  477. },
  478. emitCustomEvent (type, evnt) {
  479. const { $xetable, $xegrid } = this
  480. const comp = $xegrid || $xetable
  481. comp.$emit('custom', { type, $table: $xetable, $grid: $xegrid, $event: evnt })
  482. },
  483. changeCustomOption (column) {
  484. const isChecked = !column.visible
  485. XEUtils.eachTree([column], (item) => {
  486. item.visible = isChecked
  487. item.halfVisible = false
  488. })
  489. this.handleOptionCheck(column)
  490. if (this.custom && this.customOpts.immediate) {
  491. this.handleTableCustom()
  492. }
  493. this.checkCustomStatus()
  494. },
  495. handleOptionCheck (column) {
  496. const matchObj = XEUtils.findTree(this.columns, item => item === column)
  497. if (matchObj && matchObj.parent) {
  498. const { parent } = matchObj
  499. if (parent.children && parent.children.length) {
  500. parent.visible = parent.children.every(column => column.visible)
  501. parent.halfVisible = !parent.visible && parent.children.some(column => column.visible || column.halfVisible)
  502. this.handleOptionCheck(parent)
  503. }
  504. }
  505. },
  506. handleTableCustom () {
  507. const { $xetable } = this
  508. $xetable.handleCustom()
  509. },
  510. checkCustomStatus () {
  511. const { $xetable, columns } = this
  512. const checkMethod = $xetable.customOpts.checkMethod
  513. this.customStore.isAll = columns.every(column => (checkMethod ? !checkMethod({ column }) : false) || column.visible)
  514. this.customStore.isIndeterminate = !this.customStore.isAll && columns.some(column => (!checkMethod || checkMethod({ column })) && (column.visible || column.halfVisible))
  515. },
  516. allCustomEvent () {
  517. const { $xetable, columns, customStore } = this
  518. const checkMethod = $xetable.customOpts.checkMethod
  519. const isAll = !customStore.isAll
  520. XEUtils.eachTree(columns, column => {
  521. if (!checkMethod || checkMethod({ column })) {
  522. column.visible = isAll
  523. column.halfVisible = false
  524. }
  525. })
  526. customStore.isAll = isAll
  527. this.checkCustomStatus()
  528. },
  529. handleGlobalMousedownEvent (evnt) {
  530. if (!DomTools.getEventTargetNode(evnt, this.$refs.customWrapper).flag) {
  531. this.customColseEvent(evnt)
  532. }
  533. },
  534. handleGlobalBlurEvent (evnt) {
  535. this.customColseEvent(evnt)
  536. },
  537. handleClickSettingEvent (evnt) {
  538. if (this.customStore.visible) {
  539. this.customColseEvent(evnt)
  540. } else {
  541. this.customOpenEvent(evnt)
  542. }
  543. },
  544. handleMouseenterSettingEvent (evnt) {
  545. this.customStore.activeBtn = true
  546. this.customOpenEvent(evnt)
  547. },
  548. handleMouseleaveSettingEvent (evnt) {
  549. const { customStore } = this
  550. customStore.activeBtn = false
  551. setTimeout(() => {
  552. if (!customStore.activeBtn && !customStore.activeWrapper) {
  553. this.customColseEvent(evnt)
  554. }
  555. }, 300)
  556. },
  557. handleWrapperMouseenterEvent (evnt) {
  558. this.customStore.activeWrapper = true
  559. this.customOpenEvent(evnt)
  560. },
  561. handleWrapperMouseleaveEvent (evnt) {
  562. const { customStore } = this
  563. customStore.activeWrapper = false
  564. setTimeout(() => {
  565. if (!customStore.activeBtn && !customStore.activeWrapper) {
  566. this.customColseEvent(evnt)
  567. }
  568. }, 300)
  569. },
  570. refreshEvent () {
  571. const { $xegrid, refreshOpts, isRefresh } = this
  572. if (!isRefresh) {
  573. const queryMethod = refreshOpts.queryMethod || refreshOpts.query
  574. if (queryMethod) {
  575. this.isRefresh = true
  576. try {
  577. Promise.resolve(queryMethod({})).catch(e => e).then(() => {
  578. this.isRefresh = false
  579. })
  580. } catch (e) {
  581. this.isRefresh = false
  582. }
  583. } else if ($xegrid) {
  584. this.isRefresh = true
  585. $xegrid.commitProxy(refreshOpts.code || 'reload').catch(e => e).then(() => {
  586. this.isRefresh = false
  587. })
  588. }
  589. }
  590. },
  591. btnEvent (evnt, item) {
  592. const { $xegrid, $xetable } = this
  593. const { code } = item
  594. if (code) {
  595. if ($xegrid) {
  596. $xegrid.triggerToolbarBtnEvent(item, evnt)
  597. } else {
  598. const commandMethod = VXETable.commands.get(code)
  599. const params = { code, button: item, $xegrid, $table: $xetable, $event: evnt }
  600. if (commandMethod) {
  601. commandMethod.call(this, params, evnt)
  602. }
  603. this.$emit('button-click', params)
  604. }
  605. }
  606. },
  607. tolEvent (evnt, item) {
  608. const { $xegrid, $xetable } = this
  609. const { code } = item
  610. if (code) {
  611. if ($xegrid) {
  612. $xegrid.triggerToolbarTolEvent(item, evnt)
  613. } else {
  614. const commandMethod = VXETable.commands.get(code)
  615. const params = { code, tool: item, $xegrid, $table: $xetable, $event: evnt }
  616. if (commandMethod) {
  617. commandMethod.call(this, params, evnt)
  618. }
  619. this.$emit('tool-click', params)
  620. }
  621. }
  622. },
  623. importEvent () {
  624. if (this.checkTable()) {
  625. this.$xetable.openImport(this.importOpts)
  626. }
  627. },
  628. exportEvent () {
  629. if (this.checkTable()) {
  630. this.$xetable.openExport(this.exportOpts)
  631. }
  632. },
  633. printEvent () {
  634. if (this.checkTable()) {
  635. this.$xetable.openPrint(this.printOpts)
  636. }
  637. }
  638. }
  639. }