tab3.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div>
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper" style="position: relative">
  5. <!-- 操作按钮区域 -->
  6. <div class="table-operator" style="margin: 5px 0;float: right">
  7. <a-button
  8. class="right-upload-btn"
  9. ghost
  10. type="primary"
  11. icon="upload"
  12. @click="$refs.fileDom.click()"
  13. >导入
  14. </a-button>
  15. <input id="fileDom" type="file" ref="fileDom" style="display: none" @change="handleImport($event)">
  16. <a-dropdown v-if="selectedRowKeys.length > 0">
  17. <a-menu slot="overlay">
  18. <a-menu-item key="1" @click="batchDel">
  19. <a-icon type="delete"/>
  20. 删除
  21. </a-menu-item>
  22. </a-menu>
  23. <a-button style="margin-left: 8px">
  24. 批量操作
  25. <a-icon type="down"/>
  26. </a-button>
  27. </a-dropdown>
  28. </div>
  29. <a-form layout="inline" @keyup.enter.native="searchQuery">
  30. <a-form-item>
  31. <j-dict-select-tag
  32. v-model="queryParam.ssgq"
  33. style="width: 150px"
  34. placeholder="选择工区"
  35. dict-code="dlyc_sygq"
  36. />
  37. </a-form-item>
  38. <a-form-item>
  39. <j-dict-select-tag
  40. v-model="queryParam.gravity"
  41. style="width: 150px"
  42. placeholder="选择严重性"
  43. dict-code="dlycyzx"
  44. />
  45. </a-form-item>
  46. <a-form-item>
  47. <a-button type="primary" @click="searchQuery">查询</a-button>
  48. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  49. </a-form-item>
  50. </a-form>
  51. </div>
  52. <!-- table区域-begin -->
  53. <div v-if="readyRender">
  54. <a-table
  55. ref="table"
  56. size="middle"
  57. bordered
  58. row-key="id"
  59. :columns="columns"
  60. :data-source="dataSource"
  61. :pagination="ipagination"
  62. :loading="loading"
  63. @change="handleTableChange"
  64. />
  65. </div>
  66. <!-- table区域-end -->
  67. <!-- 表单区域 -->
  68. </div>
  69. </template>
  70. <script>
  71. import { listMixin } from '@/mixin/listMixin'
  72. import columns from './tab3Columns'
  73. import { getAction } from '@/api/request'
  74. import { ChartImport } from '@/api/dashboard-json'
  75. export default {
  76. name: 'Tab3',
  77. components: {},
  78. mixins: [listMixin],
  79. data() {
  80. return {
  81. // 查询条件
  82. queryParam: {},
  83. treeData: [],
  84. // 表头
  85. columns: columns(this),
  86. url: {
  87. list: '/show/bpdjxjh/list',
  88. delete: '/business/catenary/bus/jcb/fdfxjyq/',
  89. tree: '/system/dept/treeSelect',
  90. exportXlsUrl: '/business/catenary/bus/jcb/fdfxjyq/export'
  91. },
  92. readyRender: true
  93. }
  94. },
  95. created() {
  96. this.loadTree()
  97. },
  98. methods: {
  99. loadTree() {
  100. this.treeData = []
  101. getAction(this.url.tree).then((res) => {
  102. if (res.code === 200) {
  103. this.treeData = res.data
  104. }
  105. })
  106. },
  107. handleImport(evt) {
  108. window.console.log('evt', evt)
  109. const file = evt.target.files[0]
  110. evt.target.value = null
  111. ChartImport('bdsjxjhb', file).then(res => {
  112. console.log('res => ', res)
  113. if (res.code === 200) {
  114. this.$message.success('导入成功')
  115. this.readyRender = false
  116. setTimeout(() => {
  117. this.readyRender = true
  118. }, 200)
  119. } else {
  120. this.$message.success('导入失败')
  121. }
  122. })
  123. }
  124. }
  125. }
  126. </script>
  127. <style scoped>
  128. @import '~@/assets/less/common.less'
  129. </style>