分类管理

This commit is contained in:
焦钰锟 2025-04-29 14:31:02 +08:00
parent 86e3cee234
commit a9d4698fc5
5 changed files with 351 additions and 0 deletions

BIN
dist.zip Normal file

Binary file not shown.

View File

@ -0,0 +1,112 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from '@/libs/request';
/**
* 获取列表数据
* @param params
* @return {*}
*/
export function getWebsiteProductsCateListApi(params) {
return request({
url: 'crud/website_products_cate',
method: 'get',
params,
});
}
/**
* 获取添加表单数据
* @return {*}
*/
export function getWebsiteProductsCateCreateApi() {
return request({
url: 'crud/website_products_cate/create',
method: 'get',
});
}
/**
* 添加数据
* @param data
* @return {*}
*/
export function websiteProductsCateSaveApi(data) {
return request({
url: 'crud/website_products_cate',
method: 'post',
data
});
}
/**
* 获取编辑表单数据
* @param id
* @return {*}
*/
export function getWebsiteProductsCateEditApi(id) {
return request({
url: `crud/website_products_cate/${id}/edit`,
method: 'get'
});
}
/**
* 修改数据
* @param id
* @return {*}
*/
export function websiteProductsCateUpdateApi(id, data) {
return request({
url: `crud/website_products_cate/${id}`,
method: 'put',
data
});
}
/**
* 修改状态
* @param id
* @return {*}
*/
export function websiteProductsCateStatusApi(id, data) {
return request({
url: `crud/website_products_cate/status/${id}`,
method: 'put',
data
});
}
/**
* 删除数据
* @param id
* @return {*}
*/
export function websiteProductsCateDeleteApi(id) {
return request({
url: `crud/website_products_cate/${id}`,
method: 'delete'
});
}
/**
* 获取数据
* @param id
* @return {*}
*/
export function getWebsiteProductsCateReadApi(id) {
return request({
url: `crud/website_products_cate/${id}`,
method: 'get'
});
}

View File

@ -78,6 +78,11 @@
:loading="loading" :loading="loading"
highlight-current-row highlight-current-row
> >
<el-table-column prop="id" label="产品ID">
</el-table-column>
<el-table-column prop="cid" label="分类ID">
</el-table-column>
<el-table-column label="列表头图"> <el-table-column label="列表头图">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="tabBox_img" v-viewer> <div class="tabBox_img" v-viewer>

View File

@ -0,0 +1,195 @@
<template>
<div>
<el-card shadow="never" class="ivu-mt" :body-style="{padding:0}">
<div class="padding-add">
<el-form
ref="curlFrom"
:model="from"
:label-width="labelWidth"
:label-position="labelPosition"
inline
@submit.native.prevent
>
<el-form-item label="分类名称:" label-for="name">
<el-input
v-model="from.name"
placeholder="请输入分类名称"
class="form_content_width"
/>
</el-form-item>
<el-form-item label="英文分类名:" label-for="en_name">
<el-input
v-model="from.en_name"
placeholder="请输入英文分类名"
class="form_content_width"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchs">查询</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never" dis-hover class="ivu-mt mt16">
<el-row type="flex">
<el-col v-bind="grid">
<el-button v-auth="['website_products_cate-add']" type="primary" icon="md-add" @click="add">添加</el-button>
</el-col>
</el-row>
<el-table
:data="dataList"
ref="table"
class="mt25"
:loading="loading"
highlight-current-row
>
<el-table-column prop="name" label="分类名称">
</el-table-column>
<el-table-column prop="en_name" label="英文分类名">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<a @click="show(scope.row)">详情</a>
<el-divider direction="vertical" />
<a @click="edit(scope.row.id)">修改</a>
<el-divider direction="vertical" />
<a @click="del(scope.row, '删除', scope.$index)">删除</a>
</template>
</el-table-column>
</el-table>
<div class="acea-row row-right page">
<pagination :total="total" @pagination="pageChange" :limit.sync="from.limit" :page.sync="from.page" />
</div>
</el-card>
<el-dialog title="查看详情" :visible.sync="dialogTableVisible" v-if='dialogTableVisible'>
<el-descriptions title="website_products_cate">
<el-descriptions-item label="自增ID">{{info.id}}</el-descriptions-item>
<el-descriptions-item label="分类名称">{{info.name}}</el-descriptions-item>
<el-descriptions-item label="英文分类名">{{info.en_name}}</el-descriptions-item>
<el-descriptions-item label="添加时间">{{info.create_time}}</el-descriptions-item>
<el-descriptions-item label="修改时间">{{info.update_time}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { websiteProductsCateSaveApi, websiteProductsCateStatusApi, websiteProductsCateDeleteApi, websiteProductsCateUpdateApi, getWebsiteProductsCateCreateApi, getWebsiteProductsCateEditApi, getWebsiteProductsCateListApi, getWebsiteProductsCateReadApi} from '@/api/crud/websiteProductsCate';
export default {
name: 'website_products_cate',
data() {
return {
grid: {
xl: 7,
lg: 7,
md: 12,
sm: 24,
xs: 24,
},
loading: false,
from: {
name:'',
en_name:'',
page: 1,
limit: 15,
},
dataList: [],
total: 0,
dialogTableVisible: false,
info: {},
};
},
computed: {
...mapState('media', ['isMobile']),
labelWidth() {
return this.isMobile ? undefined : '75px';
},
labelPosition() {
return this.isMobile ? 'top' : 'left';
},
},
created() {
this.getList();
},
methods: {
show(row) {
getWebsiteProductsCateReadApi(row.id).then(res => {
this.dialogTableVisible = true;
this.info = res.data;
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
updateStatus(row, field) {
websiteProductsCateStatusApi(row.id, {field: field, value: row[field]})
.then(async (res) => {
this.$message.success(res.msg);
})
.catch((res) => {
this.$message.error(res.msg);
});
},
//
add() {
this.$modalForm(getWebsiteProductsCateCreateApi()).then(() => this.getList());
},
//
searchs() {
this.from.page = 1;
this.getList();
},
//
getList() {
this.loading = true;
getWebsiteProductsCateListApi(this.from)
.then(async (res) => {
let data = res.data;
this.dataList = data.list;
this.total = data.count;
this.loading = false;
})
.catch((res) => {
this.loading = false;
this.$Message.error(res.msg);
});
},
//
pageChange(index) {
this.from.page = index;
this.getList();
},
//
edit(id) {
this.$modalForm(getWebsiteProductsCateEditApi(id)).then(() => this.getList());
},
//
del(row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `crud/website_products_cate/${row.id}`,
method: 'DELETE',
ids: '',
};
this.$modalSure(delfromData)
.then((res) => {
this.$Message.success(res.msg);
this.getList();
})
.catch((res) => {
this.$Message.error(res.msg);
});
},
},
};
</script>
<style scoped lang="stylus"></style>

View File

@ -0,0 +1,39 @@
// +---------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +---------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +---------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +---------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +---------------------------------------------------------------------
import LayoutMain from '@/layout';
import setting from '@/setting'
let routePre = setting.routePre
const meta = {
auth: true,
}
const pre = 'website_products_cate_'
export default {
path: `${routePre}`,
name: 'crud_website_products_cate',
header: '',
meta,
component: LayoutMain,
children: [
{
path: 'crud/website_products_cate',
name: `${pre}list`,
meta: {
auth: ['website_products_cate-crud-list-index'],
title: '网站产品分类',
},
component: () => import('@/pages/crud/websiteProductsCate/index'),
},
],
}