tab3.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. :scroll="{ x: 500 | true,y: 'calc(100vh - 400px)'}"
  56. ref="table"
  57. size="middle"
  58. bordered
  59. row-key="id"
  60. :columns="columns"
  61. :data-source="dataSource"
  62. :pagination="ipagination"
  63. :loading="loading"
  64. @change="handleTableChange"
  65. />
  66. </div>
  67. <!-- table区域-end -->
  68. <!-- 表单区域 -->
  69. </div>
  70. </template>
  71. <script>
  72. import { listMixin } from '@/mixin/listMixin'
  73. import columns from './tab3Columns'
  74. import { getAction } from '@/api/request'
  75. import { ChartImport } from '@/api/dashboard-json'
  76. export default {
  77. name: 'Tab3',
  78. components: {},
  79. mixins: [listMixin],
  80. data() {
  81. return {
  82. // 查询条件
  83. queryParam: {},
  84. treeData: [],
  85. // 表头
  86. columns: columns(this),
  87. url: {
  88. list: '/show/bpdjxjh/list',
  89. delete: '/business/catenary/bus/jcb/fdfxjyq/',
  90. tree: '/system/dept/treeSelect',
  91. exportXlsUrl: '/business/catenary/bus/jcb/fdfxjyq/export'
  92. },
  93. readyRender: true
  94. }
  95. },
  96. created() {
  97. this.loadTree()
  98. },
  99. methods: {
  100. loadTree() {
  101. this.treeData = []
  102. getAction(this.url.tree).then((res) => {
  103. if (res.code === 200) {
  104. this.treeData = res.data
  105. }
  106. })
  107. },
  108. handleImport(evt) {
  109. window.console.log('evt', evt)
  110. const file = evt.target.files[0]
  111. evt.target.value = null
  112. ChartImport('bdsjxjhb', file).then(res => {
  113. console.log('res => ', res)
  114. if (res.code === 200) {
  115. this.$message.success('导入成功')
  116. this.readyRender = false
  117. setTimeout(() => {
  118. this.readyRender = true
  119. }, 200)
  120. } else {
  121. this.$message.success('导入失败')
  122. }
  123. })
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped>
  129. @import '~@/assets/less/common.less'
  130. </style>