分类树

This commit is contained in:
1154079537 2024-05-23 15:53:34 +08:00
parent bada6ede69
commit 43e122c34e
2 changed files with 25 additions and 7 deletions

View File

@ -10,7 +10,10 @@
import { dataURItoBlob } from 'dropzone'
import request from './request'
// 查询商品分类
export function proCategoryListApi(data) {
return request.get('store/category/list', data)
}
// 导出商品数据
export function outportApi(data) {
@ -535,4 +538,4 @@ export function merProductLstApi(data) {
/** 商品列表 -- 商品操作记录 */
export function operateRecordList(id, data) {
return request.get(`store/product/get_operate_list/${id}`, data)
}
}

View File

@ -13,8 +13,10 @@
:data="tableData.data"
size="small"
row-key="store_category_id"
:lazy="true"
:load="load"
:default-expand-all="false"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{children: 'children', hasChildren: 'child'}"
>
<el-table-column
label="分类名称"
@ -99,8 +101,8 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
storeCategoryListApi, storeCategoryCreateApi, storeCategoryUpdateApi, storeCategoryDeleteApi,
storeCategoryStatusApi, storeCategoryRecommendApi
storeCategoryListApi, storeCategoryCreateApi, storeCategoryUpdateApi, storeCategoryDeleteApi,
storeCategoryStatusApi, storeCategoryRecommendApi, proCategoryListApi
} from '@/api/product'
export default {
name: 'ProductClassify',
@ -126,10 +128,15 @@ export default {
//
getList() {
this.listLoading = true
storeCategoryListApi(this.tableFrom).then(res => {
this.tableData.data = res.data
proCategoryListApi(this.tableFrom).then(res => {
// res.data.map(i=>{
// this.$set(i,'children',[]);
// this.$set(i,'hasChildren',true);
// })
this.tableData.data = res.data;
this.tableData.total = res.data.count
this.listLoading = false
this.$forceUpdate();
}).catch(res => {
this.listLoading = false
this.$message.error(res.message)
@ -143,6 +150,14 @@ export default {
this.tableData.limit = val
this.getList()
},
load(tree,treeNode,resolve){
console.log(tree.store_category_id)
// console.log(treeNode)
proCategoryListApi({category_id:tree.store_category_id}).then(res=>{
console.log(res.data)
resolve(res.data)
})
},
//
onAdd() {
this.$modalForm(storeCategoryCreateApi()).then(() => this.getList())