index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- 条件区 -->
  5. <classify-manage-search @search="reload" />
  6. <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
  7. <template v-slot:toolbar>
  8. <el-button
  9. size="small"
  10. type="primary"
  11. icon="el-icon-plus"
  12. class="ele-btn-icon"
  13. @click="openAddDialog(null)"
  14. >
  15. 新建
  16. </el-button>
  17. <!--<el-button
  18. size="small"
  19. icon="el-icon-upload"
  20. class="ele-btn-icon"
  21. @click="uploadFile()"
  22. >
  23. 导入
  24. </el-button>-->
  25. </template>
  26. <!-- 操作列 -->
  27. <template v-slot:action="{ row }">
  28. <el-link
  29. type="primary"
  30. :underline="false"
  31. icon="el-icon-edit"
  32. @click="openAddDialog(row)"
  33. >
  34. 编辑
  35. </el-link>
  36. <el-link
  37. type="primary"
  38. :underline="false"
  39. @click="junmpEdit(row)"
  40. >
  41. 下级分类
  42. </el-link>
  43. <el-popconfirm
  44. class="ele-action"
  45. title="确定要删除此分类吗?"
  46. @confirm="deleteCategory(row)"
  47. >
  48. <template v-slot:reference>
  49. <el-link type="danger" :underline="false" icon="el-icon-delete">
  50. 删除
  51. </el-link>
  52. </template>
  53. </el-popconfirm>
  54. </template>
  55. </ele-pro-table>
  56. </el-card>
  57. <list-edit ref="editRef" @done="reload" />
  58. <importDialog :defModule="moudleName" ref="importDialogRef" @success="reload" />
  59. </div>
  60. </template>
  61. <script>
  62. import ListEdit from './components/list-edit.vue';
  63. import ClassifyManageSearch from './components/classifyManageSearch.vue';
  64. import importDialog from "@/components/upload/import-dialog.vue";
  65. import { getSubPage, deleteCategory } from '@/api/classifyManage';
  66. export default {
  67. components: { ClassifyManageSearch, ListEdit, importDialog},
  68. data () {
  69. return {
  70. editData: null,
  71. moudleName : "mainCategoryLevel",
  72. columns: [
  73. {
  74. prop: 'code',
  75. label: '类型编码'
  76. },
  77. {
  78. prop: 'name',
  79. label: '类型名称'
  80. },
  81. {
  82. prop: 'ruleCode',
  83. label: '编码规则'
  84. },
  85. {
  86. prop: 'remark',
  87. label: '描述'
  88. },
  89. {
  90. columnKey: 'action',
  91. label: '操作',
  92. width: 250,
  93. align: 'center',
  94. slot: 'action',
  95. fixed: 'right'
  96. }
  97. ],
  98. searchForm: {},
  99. tableData: [
  100. {
  101. s1: '1'
  102. }
  103. ],
  104. total: 0,
  105. size: 10,
  106. page: 1
  107. };
  108. },
  109. methods: {
  110. openAddDialog (editData) {
  111. if(editData) {
  112. editData.type = editData.type + ''
  113. }
  114. this.$refs.editRef.open(editData);
  115. },
  116. reload (params) {
  117. this.$refs.table.reload({ pageNum: 1, where: params });
  118. },
  119. async deleteCategory ({ id }) {
  120. const res = await deleteCategory(id);
  121. if (res?.code == '0') {
  122. this.$message.success('删除成功!');
  123. this.$refs.table.reload();
  124. }
  125. },
  126. datasource ({ page, where, limit }) {
  127. return getSubPage({
  128. ...where,
  129. parentId: 0,
  130. pageNum: page,
  131. size: limit
  132. });
  133. },
  134. reset () {},
  135. // 编辑
  136. junmpEdit ({ id }) {
  137. this.$router.push({
  138. path: '/treeClassify/details',
  139. query: {
  140. id
  141. }
  142. });
  143. },
  144. uploadFile () {
  145. this.$refs.importDialogRef.open();
  146. },
  147. }
  148. };
  149. </script>
  150. <style lang="scss" scoped>
  151. .app-container {
  152. background: #f0f3f3;
  153. min-height: calc(100vh - 84px);
  154. }
  155. .zw-page-table {
  156. background: #ffffff;
  157. padding-top: 20px;
  158. }
  159. .pagination-wrap {
  160. display: flex;
  161. justify-content: flex-end;
  162. padding: 10px 0;
  163. }
  164. .table {
  165. width: 100%;
  166. margin-top: 10px;
  167. }
  168. </style>