index.vue 5.8 KB

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