dev
wxy 2024-04-29 17:17:30 +08:00
parent e9203e1c4e
commit 07c218af6d
9 changed files with 1126 additions and 335 deletions

View File

@ -1,5 +1,5 @@
{
"name": "muyu",
"name": "ruoyi",
"version": "3.6.3",
"description": "若依管理系统",
"author": "若依",
@ -33,7 +33,7 @@
],
"repository": {
"type": "git",
"url": "https://gitee.com/y_project/MuYu-Cloud.git"
"url": "https://gitee.com/y_project/RuoYi-Cloud.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询商品规格列表
export function listType(query) {
return request({
url: '/product/type/list',
method: 'get',
params: query
})
}
// 查询商品规格详细
export function getType(id) {
return request({
url: '/product/type/' + id,
method: 'get'
})
}
// 新增商品规格
export function addType(data) {
return request({
url: '/product/type',
method: 'post',
data: data
})
}
// 修改商品规格
export function updateType(data) {
return request({
url: '/product/type/'+data.id,
method: 'put',
data: data
})
}
// 删除商品规格
export function delType(id) {
return request({
url: '/product/type/' + id,
method: 'delete'
})
}

View File

@ -1,10 +1,11 @@
import Vue from 'vue'
import Router from 'vue-router'
/* Layout */
import Layout from '@/layout'
Vue.use(Router)
/* Layout */
import Layout from '@/layout'
/**
* Note: 路由配置项
*
@ -19,12 +20,12 @@ Vue.use(Router)
* roles: ['admin', 'common'] // 访问路由的角色权限
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
* meta : {
noCache: true // 如果设置为true则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标对应路径src/assets/icons/svg
breadcrumb: false // 如果设置为false则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
noCache: true // 如果设置为true则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标对应路径src/assets/icons/svg
breadcrumb: false // 如果设置为false则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
// 公共路由
@ -69,7 +70,7 @@ export const constantRoutes = [
path: 'index',
component: () => import('@/views/index'),
name: 'Index',
meta: {title: '首页', icon: 'dashboard', affix: true}
meta: { title: '首页', icon: 'dashboard', affix: true }
}
]
},
@ -83,7 +84,7 @@ export const constantRoutes = [
path: 'profile',
component: () => import('@/views/system/user/profile/index'),
name: 'Profile',
meta: {title: '个人中心', icon: 'user'}
meta: { title: '个人中心', icon: 'user' }
}
]
}
@ -101,7 +102,7 @@ export const dynamicRoutes = [
path: 'role/:userId(\\d+)',
component: () => import('@/views/system/user/authRole'),
name: 'AuthRole',
meta: {title: '分配角色', activeMenu: '/system/user'}
meta: { title: '分配角色', activeMenu: '/system/user' }
}
]
},
@ -115,7 +116,7 @@ export const dynamicRoutes = [
path: 'user/:roleId(\\d+)',
component: () => import('@/views/system/role/authUser'),
name: 'AuthUser',
meta: {title: '分配用户', activeMenu: '/system/role'}
meta: { title: '分配用户', activeMenu: '/system/role' }
}
]
},
@ -129,7 +130,7 @@ export const dynamicRoutes = [
path: 'index/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'),
name: 'Data',
meta: {title: '字典数据', activeMenu: '/system/dict'}
meta: { title: '字典数据', activeMenu: '/system/dict' }
}
]
},
@ -143,7 +144,7 @@ export const dynamicRoutes = [
path: 'index/:jobId(\\d+)',
component: () => import('@/views/monitor/job/log'),
name: 'JobLog',
meta: {title: '调度日志', activeMenu: '/monitor/job'}
meta: { title: '调度日志', activeMenu: '/monitor/job' }
}
]
},
@ -157,7 +158,7 @@ export const dynamicRoutes = [
path: 'index/:tableId(\\d+)',
component: () => import('@/views/tool/gen/editTable'),
name: 'GenEdit',
meta: {title: '修改生成配置', activeMenu: '/tool/gen'}
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
}
]
}
@ -177,6 +178,6 @@ Router.prototype.replace = function push(location) {
export default new Router({
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({y: 0}),
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})

View File

@ -0,0 +1,301 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="组名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入组名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="states">
<el-select v-model="queryParams.states" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['product:attributeGroup:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['product:attributeGroup:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:attributeGroup:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['product:attributeGroup:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="attributeGroupList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="规格名称" align="center" prop="name" />
<el-table-column label="组内属性" align="center" prop="attributeInfoList" >
<template slot-scope="scope">
<el-tag v-for="attributeInfo in scope.row.attributeInfoList">
{{attributeInfo.name}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="states">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.states"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['product:attributeGroup:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['product:attributeGroup:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改属性组对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="组名称" prop="name">
<el-input v-model="form.name" placeholder="请输入组名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="states">
<el-radio-group v-model="form.states">
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-row>
<CheckAttribute v-model="form.attributeIdList"/>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup } from "@/api/product/attributeGroup";
export default {
name: "AttributeGroup",
dicts: ['sys_yes_no'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 属性组表格数据
attributeGroupList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
states: null
},
// 表单参数
form: {},
// 表单校验
rules: {
name: [
{ required: true, message: "组名称不能为空", trigger: "blur" }
],
states: [
{ required: true, message: "状态不能为空", trigger: "change" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询属性组列表 */
getList() {
this.loading = true;
listAttributeGroup(this.queryParams).then(response => {
this.attributeGroupList = response.data.rows;
this.total = response.data.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
states: null,
remark: null,
attributeIdList: [],
};
this.checkedAttributeList = []
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加属性组";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getAttributeGroup(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改属性组";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateAttributeGroup(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAttributeGroup(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除属性组编号为"' + ids + '"的数据项?').then(function() {
return delAttributeGroup(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/attributeGroup/export', {
...this.queryParams
}, `attributeGroup_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -73,7 +73,7 @@
<el-table v-loading="loading" :data="attributeGroupList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="规格名称" align="center" prop="name" />
<el-table-column label="组内属性" align="center" prop="attributeInfoList" >
<template slot-scope="scope">
<el-tag v-for="attributeInfo in scope.row.attributeInfoList">
@ -241,7 +241,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -283,12 +283,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除属性组编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除属性组编号为"' + ids + '"的数据项?').then(function () {
return delAttributeGroup(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {

View File

@ -1,24 +1,15 @@
<template>
<div class="app-container">
<el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="品牌名称" prop="nam">
<el-form-item label="品牌名称" prop="name">
<el-input
v-model="queryParams.nam"
v-model="queryParams.name"
placeholder="请输入品牌名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否启用" prop="start">
<el-select v-model="queryParams.start" placeholder="请选择是否启用" clearable>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -33,7 +24,7 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['product:brand:add']"
v-hasPermi="['brand:brand:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
@ -44,7 +35,7 @@
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['product:brand:edit']"
v-hasPermi="['brand:brand:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
@ -55,7 +46,7 @@
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:brand:remove']"
v-hasPermi="['brand:brand:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
@ -65,28 +56,45 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['product:brand:export']"
v-hasPermi="['brand:brand:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-card>
<el-card>
<i class="el-icon-tickets">品牌数据列表</i>
</el-card>
<el-card>
<el-table v-loading="loading" :data="brandList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="品牌名称" align="center" prop="nam" />
<el-table-column label="LOGO" align="center" prop="logo" width="100">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="品牌名称" align="center" prop="name" />
<el-table-column label="品牌描述" align="center" prop="productDesc" />
<el-table-column label="品牌介绍" align="center" prop="content">
<template slot-scope="scope">
<image-preview :src="scope.row.logo" :width="50" :height="50"/>
<img :src="scope.row.content" alt="品牌介绍" width="80px" height="80px"/>
</template>
</el-table-column>
<el-table-column label="是否启用" align="center" prop="start">
<el-table-column label="品牌logo" align="center" prop="logo">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
<img :src="scope.row.logo" alt="品牌logo" width="50px" height="50px" />
</template>
</el-table-column>
<el-table-column
label="品牌状态"
width="180">
<template slot-scope="scope">
是否上下架<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
@change="updateBrandStatus"
></el-switch>
</template>
</el-table-column>
<el-table-column label="介绍" align="center" prop="introduction" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -94,14 +102,14 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['product:brand:edit']"
v-hasPermi="['brand:brand:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['product:brand:remove']"
v-hasPermi="['brand:brand:remove']"
>删除</el-button>
</template>
</el-table-column>
@ -115,47 +123,42 @@
@pagination="getList"
/>
<!-- 添加或修改品牌信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<!-- 添加或修改商品品牌对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="品牌名称" prop="nam">
<el-input v-model="form.nam" placeholder="请输入品牌名称" />
<el-form-item label="品牌名称" prop="name">
<el-input v-model="form.name" placeholder="请输入品牌名称" />
</el-form-item>
<el-form-item label="LOGO" prop="logo">
<image-upload v-model="form.logo" :limit="1" :is-show-tip="false"/>
<el-form-item label="品牌描述" prop="productDesc">
<el-input v-model="form.productDesc" placeholder="请输入品牌描述" />
</el-form-item>
<el-form-item label="是否启用" prop="start">
<el-radio-group v-model="form.start">
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="介绍">
<editor v-model="form.introduction" :min-height="192"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-form-item label="品牌介绍">
<image-upload v-model="form.content" placeholder="请输入品牌logo" :limit="1" :is-show-tip="false"/>
</el-form-item>
<el-col>
<el-form-item label="品牌logo" prop="image">
<image-upload v-model="form.logo" placeholder="请输入品牌logo" :limit="1" :is-show-tip="false"/>
</el-form-item>
</el-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { listBrand, getBrand, delBrand, addBrand, updateBrand } from "@/api/product/brand";
import ImageUpload from "@/components/ImageUpload"
export default {
components: {ImageUpload},
name: "Brand",
dicts: ['sys_yes_no'],
data() {
return {
value: true,
//
loading: true,
//
@ -168,7 +171,7 @@ export default {
showSearch: true,
//
total: 0,
//
//
brandList: [],
//
title: "",
@ -178,30 +181,21 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
nam: null,
logo: null,
start: null,
introduction: null,
name: null,
},
//
form: {},
//
rules: {
nam: [
{ required: true, message: "品牌名称不能为空", trigger: "blur" }
],
logo: [
{ required: true, message: "LOGO不能为空", trigger: "blur" }
],
start: [
{ required: true, message: "是否启用不能为空", trigger: "change" }
],
createBy: [
{ required: true, message: "创建人不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
name: [
{ required: true, message: "请输入品牌名称", trigger: "blur" }
],
}
};
},
@ -209,11 +203,16 @@ export default {
this.getList();
},
methods: {
/** 查询品牌信息列表 */
updateBrandStatus(params){
console.log(params);
const {id,status} = params;
this.handleUpdate(id,status);
},
/** 查询商品品牌列表 */
getList() {
this.loading = true;
listBrand(this.queryParams).then(response => {
this.brandList = response.data.rows;
this.brandList = response.data.list;
this.total = response.data.total;
this.loading = false;
});
@ -227,11 +226,12 @@ export default {
reset() {
this.form = {
id: null,
nam: null,
name: null,
productDesc: null,
content: null,
logo: null,
start: null,
introduction: null,
remark: null,
status: null,
revision: null,
createBy: null,
createTime: null,
updateBy: null,
@ -259,7 +259,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = "添加品牌信息";
this.title = "添加商品品牌";
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -268,7 +268,7 @@ export default {
getBrand(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改品牌信息";
this.title = "修改商品品牌";
});
},
/** 提交按钮 */
@ -276,11 +276,7 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateBrand(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
this.updateBrandInfoById(this.form)
} else {
addBrand(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
@ -291,10 +287,17 @@ export default {
}
});
},
updateBrandInfoById(data){
updateBrand(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除品牌信息编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除商品品牌编号为"' + ids + '"的数据项?').then(function() {
return delBrand(ids);
}).then(() => {
this.getList();

View File

@ -1,31 +1,125 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="品牌名称" prop="nam">
<el-form :model="queryProductReq" ref="queryProductReq" size="small" :inline="true">
<el-form-item label="输入搜索:">
<el-input
v-model="queryParams.nam"
placeholder="请输入品牌名称"
v-model="queryProductReq.productName"
placeholder="商品名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否启用" prop="start">
<el-select v-model="queryParams.start" placeholder="请选择是否启用" clearable>
<el-form-item label="商品货号:">
<el-input
v-model="queryProductReq.productNumber"
placeholder="商品货号"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="商品分类:">
<el-cascader :options="options" v-model="queryProductReq.typeId"
:show-all-levels="false"
:props="{muliple:true,emitPath:false,value:'value',label:'label'}"
filterable clearable></el-cascader>
</el-form-item>
<el-form-item label="商品品牌:">
<el-select v-model="queryProductReq.brandId" placeholder="请选择品牌" clearable>
<el-option v-for="item in brand" :label="item.brandName" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="上架状态:" prop="status">
<el-select
v-model="queryProductReq.productStatus"
placeholder="全部"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
label="上架"
value="1"
/>
<el-option
label="下架"
value="2"
/>
</el-select>
</el-form-item>
<el-form-item label="审核状态:" prop="status">
<el-select
v-model="queryProductReq.productExamine"
placeholder="全部"
clearable
style="width: 240px"
>
<el-option
label="审核通过"
value="1"
/>
<el-option
label="未审核"
value="2"
/>
</el-select>
</el-form-item>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['product:info:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['product:info:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:info:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['product:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-row :gutter="10" class="mb8" style="float: right">
<el-col :span="1.5">
<el-button
type="primary"
@ -33,211 +127,274 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['product:brand:add']"
v-hasPermi="['system:role:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['product:brand:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:brand:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['product:brand:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="brandList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="bookId" />
<el-table-column label="名称" align="center" prop="bookName" />
<el-table-column label="LOGO" align="center" prop="logo" width="100">
<el-table :data="arr" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="序号"
width="180">
<template slot-scope="scope">
<image-preview :src="scope.row.logo" :width="50" :height="50"/>
<span style="margin-left: 10px">{{ scope.$index +1}}</span>
</template>
</el-table-column>
<el-table-column label="是否启用" align="center" prop="start">
<el-table-column
label="图片"
width="180">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
<img :src="scope.row.imagesUrl" width="100px" height="100px" alt="图片损坏"/>
</template>
</el-table-column>
<el-table-column label="介绍" align="center" prop="introduction" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="名称"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.productName }}</span><br>
</template>
</el-table-column>
<el-table-column
label="性别/成绩"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">性别{{ scope.row.purSex }}</span><br>
<span style="margin-left: 10px">成绩{{ scope.row.purScore }}</span>
</template>
</el-table-column>
<el-table-column
label="货号"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.productNumber }}</span><br>
</template>
</el-table-column>
<el-table-column
label="单位"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.productUnit }}</span><br>
</template>
</el-table-column>
<el-table-column
label="标签"
width="180">
<template slot-scope="scope">
优秀<el-switch
v-model="scope.row.productStatus"
:active-value="1"
:inactive-value="0"
></el-switch><br>
良好<el-switch
v-model="scope.row.productNew"
:active-value="1"
:inactive-value="0"
></el-switch><br>
不及格<el-switch
v-model="scope.row.productRecommended"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column
label="审核状态"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.productExamine==0?'待审核':scope.row.productExamine==1?'通过':'驳回'}}</span><br>
<el-link type="primary">审核详情</el-link>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['product:brand:edit']"
>修改</el-button>
@click="handleDetails(scope.row.id)">查看</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['product:brand:remove']"
>删除</el-button>
@click="handleEdit(scope.row)">编辑</el-button><br>
<el-button
size="mini"
@click="handleLogs(scope.$index, scope.row)">日志</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改品牌信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="品牌名称" prop="nam">
<el-input v-model="form.nam" placeholder="请输入品牌名称" />
</el-form-item>
<el-form-item label="LOGO" prop="logo">
<image-upload v-model="form.logo" :limit="1" :is-show-tip="false"/>
</el-form-item>
<el-form-item label="是否启用" prop="start">
<el-radio-group v-model="form.start">
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="介绍">
<editor v-model="form.introduction" :min-height="192"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<!-- 详情对话框-->
<el-dialog title="详情查看" :visible.sync="dialogFormVisible">
<div style="display: flex;">
<div style="flex: 1;">
<img :src="productVo.imagesUrl" width="200px" height="200px" alt="图片损坏" style="margin-right: 20px;">
</div>
<div style="flex: 2;">
<el-form :model="productVo">
<el-form-item :label-width="formLabelWidth" label="活动名称">
<el-input v-model="productVo.productName" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="品牌名称">
<el-input v-model="productVo.brandName" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="产品信息">
<el-input v-model="productVo.productInformation" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="详情标题">
<el-input v-model="productVo.detailsTitle" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="详情信息">
<el-input v-model="productVo.detailsInformation" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="销售价格">
<el-input v-model="productVo.salePrice" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="促销价格">
<el-input v-model="productVo.promotionPrice" autocomplete="off" readonly></el-input>
</el-form-item>
<el-form-item :label-width="formLabelWidth" label="服务名称">
<el-input v-model="productVo.serviceName" autocomplete="off" readonly></el-input>
</el-form-item>
</el-form>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="dialogFormVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listInfo } from "@/api/product/info";
import {listInfo,getInfo,delInfo} from "@/api/product/info";
export default {
name: "Brand",
dicts: ['sys_yes_no'],
name: "product",
data() {
return {
//
loading: true,
//
ids: [],
//
dialogTableVisible: false,
dialogFormVisible: false,
formLabelWidth: '120px',
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
brandList: [],
//
title: "",
//
open: false,
multiple: true,
brandName: null,
options: [{
value: '',
label: '',
children: [{
value: '',
label: '',
}]
}],
brand:[],
queryProductReq:{
pageNum:1,
pageSize:10
},
arr:[],
//
queryParams: {
pageNum: 1,
pageSize: 10,
bookName: null,
logo: null,
start: null,
introduction: null,
pageSize: 10
},
//
form: {},
//
rules: {
nam: [
{ required: true, message: "品牌名称不能为空", trigger: "blur" }
],
logo: [
{ required: true, message: "LOGO不能为空", trigger: "blur" }
],
start: [
{ required: true, message: "是否启用不能为空", trigger: "change" }
],
createBy: [
{ required: true, message: "创建人不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
}
productVo:{}
};
},
created() {
this.getList();
this.getBrand();
this.getType();
},
methods: {
/** 查询信息列表 */
getList() {
this.loading = true;
listInfo(this.queryParams).then(response => {
this.brandList = response.data.rows;
this.total = response.data.total;
this.loading = false;
/**查看详情**/
handleDetails(id) {
getInfo(id).then(
response => {
this.productVo = response.data
this.dialogFormVisible = true;
}
)
},
/**修改**/
handleEdit(row) {
this.$router.push({path: '/product/update', query: {product: row}})
},
/**删除**/
handleDelete(id) {
this.$confirm('确认删除此消息吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
delInfo(id).then(response => {
this.$message.success(response.msg || '删除成功');
this.getList();
}).catch(error => {
this.$message.error(error.message || '删除失败');
});
}).catch(() => {
//
});
},
//
cancel() {
this.open = false;
this.reset();
/**添加跳转其他页面**/
handleAdd() {
this.open = true;
this.title = "添加";
},
//
reset() {
this.form = {
id: null,
bookName: null,
logo: null,
start: null,
introduction: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
/**查询品牌表**/
getBrand() {
listInfo(this.brandName).then(
response => {
console.log(response)
this.brand = response.data
}
)
},
/**查询类型**/
getType() {
listInfo().then(response => {
if (response && response.data && response.data.length > 0) {
const firstCategory = response.data[0]; //
this.options = [{
value: firstCategory.id,
label: firstCategory.name,
children: firstCategory.childrenList.map(child => ({
value: child.id,
label: child.name
}))
}];
} else {
console.error('响应数据不完整或为空');
}
}).catch(error => {
console.error('查询分类出错:', error);
});
},
/** 查询商品列表 */
getList() {
listInfo(this.queryProductReq).then(
response => {
console.log(response)
this.arr = response.data.list
}
)
},
/** 搜索按钮操作 */
handleQuery() {
@ -246,67 +403,22 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.ids = selection.map(item => item.roleId)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加品牌信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getBrand(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改品牌信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateBrand(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBrand(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除品牌信息编号为"' + ids + '"的数据项?').then(function() {
return delBrand(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/brand/export', {
this.download('product/info/export', {
...this.queryParams
}, `brand_${new Date().getTime()}.xlsx`)
}, `pur_${new Date().getTime()}.xlsx`)
}
}
},
};
</script>

View File

@ -9,6 +9,14 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="乐观锁" prop="revision">
<el-input
v-model="queryParams.revision"
placeholder="请输入乐观锁"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -61,12 +69,13 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ruleList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="规格名称" align="center" prop="name" />
<el-table-column label="规格详情" align="center" prop="ruleAttr" />
<el-table-column label="规格状态" align="center" prop="status" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="乐观锁" align="center" prop="revision" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -96,13 +105,16 @@
/>
<!-- 添加或修改商品规格对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="规格名称" prop="name">
<el-input v-model="form.name" placeholder="请输入规格名称" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-form-item label="规格详情" prop="ruleAttr">
<el-input v-model="form.ruleAttr" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="乐观锁" prop="revision">
<el-input v-model="form.revision" placeholder="请输入乐观锁" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -115,9 +127,11 @@
<script>
import { listRule, getRule, delRule, addRule, updateRule } from "@/api/product/rule";
import {delInfo} from "@/api/product/info";
import {getAttributeGroup} from "@/api/product/attributeGroup";
export default {
name: "Rule",
name: "Info",
data() {
return {
//
@ -133,7 +147,7 @@ export default {
//
total: 0,
//
ruleList: [],
infoList: [],
//
title: "",
//
@ -143,12 +157,23 @@ export default {
pageNum: 1,
pageSize: 10,
name: null,
ruleAttr: null,
status: null,
revision: null,
},
//
form: {},
//
rules: {
name: [
{ required: true, message: "规格名称不能为空", trigger: "blur" }
],
ruleAttr: [
{ required: true, message: "规格详情不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "规格状态不能为空", trigger: "change" }
],
createBy: [
{ required: true, message: "创建人不能为空", trigger: "blur" }
],
@ -166,7 +191,7 @@ export default {
getList() {
this.loading = true;
listRule(this.queryParams).then(response => {
this.ruleList = response.data.rows;
this.infoList = response.data.list;
this.total = response.data.total;
this.loading = false;
});
@ -181,8 +206,9 @@ export default {
this.form = {
id: null,
name: null,
ruleAttr: null,
status: null,
remark: null,
revision: null,
createBy: null,
createTime: null,
updateBy: null,
@ -245,18 +271,19 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?').then(function () {
return delRule(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/rule/export', {
...this.queryParams
}, `rule_${new Date().getTime()}.xlsx`)
}, `info_${new Date().getTime()}.xlsx`)
}
}
};

View File

@ -0,0 +1,302 @@
<template>
<div class="app-container">
<el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="分类名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入分类名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input
v-model="queryParams.sort"
placeholder="请输入排序"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="商品数量" prop="productCount">
<el-input
v-model="queryParams.productCount"
placeholder="请输入商品数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['product:type:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['product:type:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:type:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['product:type:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-card>
<el-card>
<i class="el-icon-tickets">商品分类数据列表</i>
</el-card>
<el-card>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分类id" align="center" prop="catId" />
<el-table-column label="分类名称" align="center" prop="name" />
<el-table-column label="父分类id" align="center" prop="parentCid" />
<el-table-column label="层级" align="center" prop="catLevel" />
<el-table-column label="是否显示[0-不显示1显示]" align="center" prop="showStatus"/>
<el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="图标地址" align="center" prop="icon" />
<el-table-column label="计量单位" align="center" prop="productUnit" />
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['product:type:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['product:type:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改商品三级分类对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="分类名称" prop="name">
<el-input v-model="form.name" placeholder="请输入分类名称" />
</el-form-item>
<el-form-item label="父分类id" prop="parentCid">
<el-input v-model="form.parentCid" placeholder="请输入父分类id" />
</el-form-item>
<el-form-item label="层级" prop="catLevel">
<el-input v-model="form.catLevel" placeholder="请输入层级" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序" />
</el-form-item>
<el-form-item label="图标地址" prop="icon">
<el-input v-model="form.icon" placeholder="请输入图标地址" />
</el-form-item>
<el-form-item label="计量单位" prop="productUnit">
<el-input v-model="form.productUnit" placeholder="请输入计量单位" />
</el-form-item>
<el-form-item label="商品数量" prop="productCount">
<el-input v-model="form.productCount" placeholder="请输入商品数量" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { listType, getType, delType, addType, updateType } from "@/api/product/type";
import {addRule, updateRule} from "@/api/product/rule";
export default {
name: "Type",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
typeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询商品三级分类列表 */
getList() {
this.loading = true;
listType(this.queryParams).then(response => {
this.typeList = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
catId: null,
name: null,
parentCid: null,
catLevel: null,
showStatus: null,
sort: null,
icon: null,
productUnit: null,
productCount: null,
revision: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.catId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加商品三级分类";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const catId = row.catId || this.ids
getType(catId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改商品三级分类";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const catIds = row.catId || this.ids;
this.$modal.confirm('是否确认删除商品三级分类编号为"' + catIds + '"的数据项?').then(function() {
return delType(catIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/type/export', {
...this.queryParams
}, `type_${new Date().getTime()}.xlsx`)
}
}
};
</script>