index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <el-card class="content-z">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-form-item>
  7. <a-input
  8. v-model="queryParam.substationName"
  9. style="width: 150px"
  10. placeholder="输入所亭名称"
  11. />
  12. </a-form-item>
  13. <a-form-item>
  14. <a-tree-select
  15. v-model="queryParam.deptId"
  16. style="width: 150px"
  17. :show-search="true"
  18. allow-clear
  19. placeholder="选择车间"
  20. :tree-data="treeData"
  21. tree-node-filter-prop="label"
  22. :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
  23. />
  24. </a-form-item>
  25. <a-form-item>
  26. <a-form-item>
  27. <j-list-select-tag
  28. v-if="lineShow"
  29. v-model="lineId"
  30. :dept-id="queryParam.deptId"
  31. style="width: 150px"
  32. placeholder="选择线路"
  33. dict-code="line"
  34. />
  35. </a-form-item>
  36. <a-form-item>
  37. <a-input
  38. v-model="queryParam.marker"
  39. style="width: 150px"
  40. placeholder="输入公里标"
  41. />
  42. </a-form-item>
  43. <a-form-item>
  44. <a-button type="primary" @click="searchQuery">查询</a-button>
  45. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  46. </a-form-item>
  47. </a-form-item></a-form>
  48. </div>
  49. <!-- 操作按钮区域 -->
  50. <div class="table-operator" style="margin: 15px 0">
  51. <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
  52. <!-- <a-button ghost type="danger" icon="download" @click="handleExportXls('角色信息')">导出</a-button>-->
  53. <!-- <a-upload name="file" :show-upload-list="false" :multiple="false" :headers="tokenHeader" :action="url.importExcelUrl" @change="handleImportExcel">-->
  54. <!-- <a-button ghost type="danger" icon="import">导入</a-button>-->
  55. <!-- </a-upload>-->
  56. <a-dropdown v-if="selectedRowKeys.length > 0">
  57. <a-menu slot="overlay">
  58. <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
  59. </a-menu>
  60. <a-button style="margin-left: 8px">
  61. 批量操作 <a-icon type="down" />
  62. </a-button>
  63. </a-dropdown>
  64. </div>
  65. <!-- table区域-begin -->
  66. <div>
  67. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  68. <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
  69. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  70. </div>
  71. <a-table
  72. ref="table"
  73. size="middle"
  74. bordered
  75. row-key="substationId"
  76. :columns="columns"
  77. :data-source="dataSource"
  78. :pagination="ipagination"
  79. :loading="loading"
  80. :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  81. @change="handleTableChange"
  82. >
  83. <span slot="action" slot-scope="text, record">
  84. <a-button size="small" type="primary" @click="handleEdit(record)">
  85. 编辑
  86. </a-button>
  87. <a-divider type="vertical" />
  88. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.substationId)">
  89. <a-button size="small" type="danger">
  90. 删除
  91. </a-button>
  92. </a-popconfirm>
  93. </span>
  94. </a-table>
  95. <check-and-edit-model ref="modalForm" @ok="modalFormOk" />
  96. </div>
  97. <!-- table区域-end -->
  98. <!-- 表单区域 -->
  99. </el-card>
  100. </template>
  101. <script>
  102. import { listMixin } from '@/mixin/listMixin'
  103. import columns from './indexColumns'
  104. import CheckAndEditModel from './CheckAndEditModel'
  105. import { getAction } from '@/api/request'
  106. export default {
  107. components: {
  108. CheckAndEditModel
  109. },
  110. mixins: [listMixin],
  111. data() {
  112. return {
  113. lineShow: true,
  114. lineId: undefined,
  115. // 查询条件
  116. queryParam: {},
  117. // 表头
  118. columns: columns(this),
  119. treeData: [],
  120. url: {
  121. list: '/business/catenary/bus/substation/list',
  122. delete: '/business/catenary/bus/substation/',
  123. exportXlsUrl: '/exportXlsUrl',
  124. tree: '/system/dept/treeSelect',
  125. importExcelUrl: `${process.env.VUE_APP_BASE_API}/importExcelUrl`
  126. }
  127. }
  128. },
  129. created() {
  130. this.loadTree()
  131. },
  132. watch: {
  133. lineId(val) {
  134. this.queryParam.lineId = val
  135. },
  136. 'queryParam.deptId': {
  137. handler: function(newV, oldV) {
  138. this.lineShow = false
  139. this.$nextTick(() => {
  140. this.queryParam.lineId = undefined
  141. this.lineId = undefined
  142. this.lineShow = true
  143. })
  144. }
  145. }
  146. },
  147. methods: {
  148. loadTree() {
  149. this.treeData = []
  150. getAction(this.url.tree).then((res) => {
  151. if (res.code === 200) {
  152. this.treeData = res.data
  153. }
  154. })
  155. }
  156. }
  157. }
  158. </script>
  159. <style scoped>
  160. @import '~@/assets/less/common.less'
  161. </style>