| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <!-- 条件区 -->
- <classify-manage-search @search="reload" />
- <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openAddDialog(null)"
- >
- 新建
- </el-button>
- <!--<el-button
- size="small"
- icon="el-icon-upload"
- class="ele-btn-icon"
- @click="uploadFile()"
- >
- 导入
- </el-button>-->
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openAddDialog(row)"
- >
- 编辑
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- @click="junmpEdit(row)"
- >
- 下级分类
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此分类吗?"
- @confirm="deleteCategory(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <list-edit ref="editRef" @done="reload" />
- <importDialog :defModule="moudleName" ref="importDialogRef" @success="reload" />
- </div>
- </template>
- <script>
- import ListEdit from './components/list-edit.vue';
- import ClassifyManageSearch from './components/classifyManageSearch.vue';
- import importDialog from "@/components/upload/import-dialog.vue";
- import { getSubPage, deleteCategory } from '@/api/classifyManage';
- export default {
- components: { ClassifyManageSearch, ListEdit, importDialog},
- data () {
- return {
- editData: null,
- moudleName : "mainCategoryLevel",
- columns: [
- {
- prop: 'code',
- label: '类型编码'
- },
- {
- prop: 'name',
- label: '类型名称'
- },
- {
- prop: 'ruleCode',
- label: '编码规则'
- },
- {
- prop: 'remark',
- label: '描述'
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 250,
- align: 'center',
- slot: 'action',
- fixed: 'right'
- }
- ],
- searchForm: {},
- tableData: [
- {
- s1: '1'
- }
- ],
- total: 0,
- size: 10,
- page: 1
- };
- },
- methods: {
- openAddDialog (editData) {
- if(editData) {
- editData.type = editData.type + ''
- }
- this.$refs.editRef.open(editData);
- },
- reload (params) {
- this.$refs.table.reload({ pageNum: 1, where: params });
- },
- async deleteCategory ({ id }) {
- const res = await deleteCategory(id);
- if (res?.code == '0') {
- this.$message.success('删除成功!');
- this.$refs.table.reload();
- }
- },
- datasource ({ page, where, limit }) {
- return getSubPage({
- ...where,
- parentId: 0,
- pageNum: page,
- size: limit
- });
- },
- reset () {},
- // 编辑
- junmpEdit ({ id }) {
- this.$router.push({
- path: '/treeClassify/details',
- query: {
- id
- }
- });
- },
- uploadFile () {
- this.$refs.importDialogRef.open();
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- .app-container {
- background: #f0f3f3;
- min-height: calc(100vh - 84px);
- }
- .zw-page-table {
- background: #ffffff;
- padding-top: 20px;
- }
- .pagination-wrap {
- display: flex;
- justify-content: flex-end;
- padding: 10px 0;
- }
- .table {
- width: 100%;
- margin-top: 10px;
- }
- </style>
|