index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <el-card style="margin: 15px">
  3. <!-- 操作按钮区域 -->
  4. <div class="table-operator" style="margin: 5px 0;float: right">
  5. <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
  6. <a-dropdown v-if="selectedRowKeys.length > 0">
  7. <a-menu slot="overlay">
  8. <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
  9. </a-menu>
  10. <a-button style="margin-left: 8px">
  11. 批量操作 <a-icon type="down" />
  12. </a-button>
  13. </a-dropdown>
  14. </div>
  15. <!-- 查询区域 -->
  16. <div class="table-page-search-wrapper">
  17. <a-form layout="inline" @keyup.enter.native="searchQuery">
  18. <a-form-item>
  19. <a-input
  20. v-model="queryParam.glb"
  21. style="width: 150px"
  22. placeholder="职务名称"
  23. />
  24. </a-form-item>
  25. <a-form-item>
  26. <a-button type="primary" @click="searchQuery">查询</a-button>
  27. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  28. </a-form-item>
  29. </a-form>
  30. </div>
  31. <!-- table区域-begin -->
  32. <div>
  33. <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
  34. <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
  35. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  36. </div>
  37. <a-table
  38. ref="table"
  39. size="middle"
  40. bordered
  41. row-key="id"
  42. :columns="columns"
  43. :data-source="dataSource"
  44. :pagination="ipagination"
  45. :loading="loading"
  46. :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  47. @change="handleTableChange"
  48. >
  49. <template slot="status" slot-scope="text, record">
  50. <a-switch v-model="record['status']" checked-children="启用" un-checked-children="停用" @change="changeStatus($event,record)" />
  51. </template>
  52. <span slot="action" slot-scope="text, record">
  53. <a-button type="primary" @click="handleEdit(record)">
  54. 编辑
  55. </a-button>
  56. <a-divider type="vertical" />
  57. <a-dropdown>
  58. <a-button class="ant-dropdown-link" type="primary">
  59. 操作权限 <a-icon type="down" />
  60. </a-button>
  61. <a-menu slot="overlay">
  62. <a-menu-item>
  63. <a href="javascript:;" @click="app(record)">APP功能菜单</a>
  64. </a-menu-item>
  65. <a-menu-item>
  66. <a href="javascript:;" @click="pc(record)">PC功能菜单</a>
  67. </a-menu-item>
  68. </a-menu>
  69. </a-dropdown>
  70. <a-divider type="vertical" />
  71. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  72. <a-button type="danger">
  73. 删除
  74. </a-button>
  75. </a-popconfirm>
  76. </span>
  77. </a-table>
  78. <check-and-edit-model ref="modalForm" @ok="modalFormOk" />
  79. <right-model ref="rightModal" @ok="updateQueryParam" />
  80. </div>
  81. <!-- table区域-end -->
  82. <!-- 表单区域 -->
  83. </el-card>
  84. </template>
  85. <script>
  86. import { listMixin } from '@/mixin/listMixin'
  87. import columns from './indexColumns'
  88. import CheckAndEditModel from './CheckAndEditModel'
  89. import rightModel from '@/components/RightModel'
  90. export default {
  91. components: {
  92. CheckAndEditModel,
  93. rightModel
  94. },
  95. mixins: [listMixin],
  96. data() {
  97. return {
  98. // 查询条件
  99. queryParam: {},
  100. // 表头
  101. columns: columns(this),
  102. url: {
  103. list: '/business/catenary/bus/zzdzxx/list',
  104. delete: '/business/catenary/bus/zzdzxx/',
  105. exportXlsUrl: '/exportXlsUrl',
  106. importExcelUrl: `${process.env.VUE_APP_BASE_API}/importExcelUrl`
  107. }
  108. }
  109. },
  110. created() {
  111. },
  112. methods: {
  113. changeStatus(val, row) {
  114. console.log(val, row.id)
  115. },
  116. app(data) {
  117. this.$refs.rightModal.title = 'app菜单权限'
  118. this.$refs.rightModal.treeKey = '/treeKey'
  119. this.$refs.rightModal.treeList = '/treeList'
  120. this.$refs.rightModal.show()
  121. },
  122. pc(data) {
  123. this.$refs.rightModal.title = 'pc菜单权限'
  124. this.$refs.rightModal.treeKey = '/treeKey'
  125. this.$refs.rightModal.treeList = '/treeList'
  126. this.$refs.rightModal.show()
  127. },
  128. updateQueryParam(data) {
  129. this.queryParam.unit = data.id
  130. this.queryParam.unitName = data.departName
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped>
  136. @import '~@/assets/less/common.less'
  137. </style>