From 6a0106e367874b02a9f89764fd22dc6e1300daa1 Mon Sep 17 00:00:00 2001
From: huliyong <2783385703@qq.com>
Date: Tue, 22 Jul 2025 23:13:36 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BA=A7?=
=?UTF-8?q?=E5=93=81):=20=E6=96=B0=E5=A2=9E=E4=BA=A7=E5=93=81=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
新增产品列表、表单、规格管理及相关API接口
添加产品规格的增删改查功能
实现产品的导入导出功能
---
.../src/views/applet/product/AppletProduct.api.ts | 64 ++++++
.../src/views/applet/product/AppletProduct.data.ts | 156 ++++++++++++++
.../src/views/applet/product/AppletProductList.vue | 228 +++++++++++++++++++++
.../views/applet/product/AppletProductSpec.api.ts | 65 ++++++
.../views/applet/product/AppletProductSpec.data.ts | 107 ++++++++++
.../product/components/AppletProductForm.vue | 70 +++++++
.../product/components/AppletProductModal.vue | 99 +++++++++
.../product/components/AppletProductSpecForm.vue | 73 +++++++
.../product/components/AppletProductSpecModal.vue | 175 ++++++++++++++++
9 files changed, 1037 insertions(+)
create mode 100644 jeecgboot-vue3/src/views/applet/product/AppletProduct.api.ts
create mode 100644 jeecgboot-vue3/src/views/applet/product/AppletProduct.data.ts
create mode 100644 jeecgboot-vue3/src/views/applet/product/AppletProductList.vue
create mode 100644 jeecgboot-vue3/src/views/applet/product/AppletProductSpec.api.ts
create mode 100644 jeecgboot-vue3/src/views/applet/product/AppletProductSpec.data.ts
create mode 100644 jeecgboot-vue3/src/views/applet/product/components/AppletProductForm.vue
create mode 100644 jeecgboot-vue3/src/views/applet/product/components/AppletProductModal.vue
create mode 100644 jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecForm.vue
create mode 100644 jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecModal.vue
diff --git a/jeecgboot-vue3/src/views/applet/product/AppletProduct.api.ts b/jeecgboot-vue3/src/views/applet/product/AppletProduct.api.ts
new file mode 100644
index 0000000..a01fc7d
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/AppletProduct.api.ts
@@ -0,0 +1,64 @@
+import {defHttp} from '/@/utils/http/axios';
+import { useMessage } from "/@/hooks/web/useMessage";
+
+const { createConfirm } = useMessage();
+
+enum Api {
+ list = '/appletProduct/appletProduct/list',
+ save='/appletProduct/appletProduct/add',
+ edit='/appletProduct/appletProduct/edit',
+ deleteOne = '/appletProduct/appletProduct/delete',
+ deleteBatch = '/appletProduct/appletProduct/deleteBatch',
+ importExcel = '/appletProduct/appletProduct/importExcel',
+ exportXls = '/appletProduct/appletProduct/exportXls',
+}
+/**
+ * 导出api
+ * @param params
+ */
+export const getExportUrl = Api.exportXls;
+/**
+ * 导入api
+ */
+export const getImportUrl = Api.importExcel;
+/**
+ * 列表接口
+ * @param params
+ */
+export const list = (params) =>
+ defHttp.get({url: Api.list, params});
+
+/**
+ * 删除单个
+ */
+export const deleteOne = (params,handleSuccess) => {
+ return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
+ handleSuccess();
+ });
+}
+/**
+ * 批量删除
+ * @param params
+ */
+export const batchDelete = (params, handleSuccess) => {
+ createConfirm({
+ iconType: 'warning',
+ title: '确认删除',
+ content: '是否删除选中数据',
+ okText: '确认',
+ cancelText: '取消',
+ onOk: () => {
+ return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
+ handleSuccess();
+ });
+ }
+ });
+}
+/**
+ * 保存或者更新
+ * @param params
+ */
+export const saveOrUpdate = (params, isUpdate) => {
+ let url = isUpdate ? Api.edit : Api.save;
+ return defHttp.post({url: url, params});
+}
diff --git a/jeecgboot-vue3/src/views/applet/product/AppletProduct.data.ts b/jeecgboot-vue3/src/views/applet/product/AppletProduct.data.ts
new file mode 100644
index 0000000..0d722d5
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/AppletProduct.data.ts
@@ -0,0 +1,156 @@
+import {BasicColumn} from '/@/components/Table';
+import {FormSchema} from '/@/components/Table';
+import { rules} from '/@/utils/helper/validator';
+import { render } from '/@/utils/common/renderUtils';
+import { getWeekMonthQuarterYear } from '/@/utils';
+//列表数据
+export const columns: BasicColumn[] = [
+ {
+ title: '产品名称',
+ align:"center",
+ dataIndex: 'name'
+ },
+ {
+ title: '产品描述',
+ align:"center",
+ dataIndex: 'info'
+ },
+ {
+ title: '类型',
+ align:"center",
+ dataIndex: 'type_dictText'
+ },
+ {
+ title: '分类',
+ align:"center",
+ dataIndex: 'classId_dictText'
+ },
+ {
+ title: '原价',
+ align:"center",
+ dataIndex: 'originalPrice'
+ },
+ {
+ title: '现价',
+ align:"center",
+ dataIndex: 'currentPrice'
+ },
+ {
+ title: '单位',
+ align:"center",
+ dataIndex: 'unit'
+ },
+ {
+ title: '已出售',
+ align:"center",
+ dataIndex: 'sold'
+ },
+];
+//查询数据
+export const searchFormSchema: FormSchema[] = [
+ {
+ label: "类型",
+ field: 'type',
+ component: 'JSelectMultiple',
+ componentProps:{
+ dictCode:"applet_product_type"
+ },
+ //colProps: {span: 6},
+ },
+ {
+ label: "分类",
+ field: 'classId',
+ component: 'JSelectMultiple',
+ componentProps:{
+ dictCode:"applet_product_category,name,id"
+ },
+ //colProps: {span: 6},
+ },
+];
+//表单数据
+export const formSchema: FormSchema[] = [
+ {
+ label: '产品名称',
+ field: 'name',
+ component: 'Input',
+ },
+ {
+ label: '产品描述',
+ field: 'info',
+ component: 'Input',
+ },
+ {
+ label: '类型',
+ field: 'type',
+ component: 'JDictSelectTag',
+ componentProps:{
+ dictCode:"applet_product_type"
+ },
+ },
+ {
+ label: '分类',
+ field: 'classId',
+ component: 'JDictSelectTag',
+ componentProps:{
+ dictCode:"applet_product_category,name,id"
+ },
+ },
+ {
+ label: '原价',
+ field: 'originalPrice',
+ component: 'InputNumber',
+ },
+ {
+ label: '现价',
+ field: 'currentPrice',
+ component: 'InputNumber',
+ },
+ {
+ label: '单位',
+ field: 'unit',
+ component: 'Input',
+ },
+ {
+ label: '详情',
+ field: 'detail',
+ component: 'JEditor',
+ },
+ {
+ label: '已出售',
+ field: 'sold',
+ component: 'InputNumber',
+ },
+ {
+ label: '产品内容',
+ field: 'content',
+ component: 'Input',
+ },
+ // TODO 主键隐藏字段,目前写死为ID
+ {
+ label: '',
+ field: 'id',
+ component: 'Input',
+ show: false
+ },
+];
+
+// 高级查询数据
+export const superQuerySchema = {
+ name: {title: '产品名称',order: 0,view: 'text', type: 'string',},
+ info: {title: '产品描述',order: 1,view: 'text', type: 'string',},
+ type: {title: '类型',order: 2,view: 'list', type: 'string',dictCode: 'applet_product_type',},
+ classId: {title: '分类',order: 3,view: 'list', type: 'string',dictTable: "applet_product_category", dictCode: 'id', dictText: 'name',},
+ originalPrice: {title: '原价',order: 4,view: 'number', type: 'number',},
+ currentPrice: {title: '现价',order: 5,view: 'number', type: 'number',},
+ unit: {title: '单位',order: 6,view: 'text', type: 'string',},
+ sold: {title: '已出售',order: 8,view: 'number', type: 'number',},
+};
+
+/**
+* 流程表单调用这个方法获取formSchema
+* @param param
+*/
+export function getBpmFormSchema(_formData): FormSchema[]{
+ // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
+ return formSchema;
+}
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/AppletProductList.vue b/jeecgboot-vue3/src/views/applet/product/AppletProductList.vue
new file mode 100644
index 0000000..d9575cd
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/AppletProductList.vue
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+ 新增
+ 导出
+ 导入
+
+
+
+
+
+
+ 删除
+
+
+
+ 批量操作
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/AppletProductSpec.api.ts b/jeecgboot-vue3/src/views/applet/product/AppletProductSpec.api.ts
new file mode 100644
index 0000000..dba87d2
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/AppletProductSpec.api.ts
@@ -0,0 +1,65 @@
+import {defHttp} from '/@/utils/http/axios';
+import { useMessage } from "/@/hooks/web/useMessage";
+
+const { createConfirm } = useMessage();
+
+enum Api {
+ list = '/appletProductSpec/appletProductSpec/list',
+ save='/appletProductSpec/appletProductSpec/add',
+ edit='/appletProductSpec/appletProductSpec/edit',
+ deleteOne = '/appletProductSpec/appletProductSpec/delete',
+ deleteBatch = '/appletProductSpec/appletProductSpec/deleteBatch',
+ importExcel = '/appletProductSpec/appletProductSpec/importExcel',
+ exportXls = '/appletProductSpec/appletProductSpec/exportXls',
+}
+
+/**
+ * 导出api
+ * @param params
+ */
+export const getExportUrl = Api.exportXls;
+/**
+ * 导入api
+ */
+export const getImportUrl = Api.importExcel;
+/**
+ * 列表接口
+ * @param params
+ */
+export const list = (params) =>
+ defHttp.get({url: Api.list, params});
+
+/**
+ * 删除单个
+ */
+export const deleteOne = (params,handleSuccess) => {
+ return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
+ handleSuccess();
+ });
+}
+/**
+ * 批量删除
+ * @param params
+ */
+export const batchDelete = (params, handleSuccess) => {
+ createConfirm({
+ iconType: 'warning',
+ title: '确认删除',
+ content: '是否删除选中数据',
+ okText: '确认',
+ cancelText: '取消',
+ onOk: () => {
+ return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
+ handleSuccess();
+ });
+ }
+ });
+}
+/**
+ * 保存或者更新
+ * @param params
+ */
+export const saveOrUpdate = (params, isUpdate) => {
+ let url = isUpdate ? Api.edit : Api.save;
+ return defHttp.post({url: url, params});
+}
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/AppletProductSpec.data.ts b/jeecgboot-vue3/src/views/applet/product/AppletProductSpec.data.ts
new file mode 100644
index 0000000..b57fb89
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/AppletProductSpec.data.ts
@@ -0,0 +1,107 @@
+import {BasicColumn} from '/@/components/Table';
+import {FormSchema} from '/@/components/Table';
+import { rules} from '/@/utils/helper/validator';
+import { render } from '/@/utils/common/renderUtils';
+
+//列表数据
+export const columns: BasicColumn[] = [
+ {
+ title: '规格名称',
+ align:"center",
+ dataIndex: 'specName'
+ },
+ {
+ title: '规格值',
+ align:"center",
+ dataIndex: 'specValue'
+ },
+ {
+ title: '价格',
+ align:"center",
+ dataIndex: 'price'
+ },
+ {
+ title: '排序',
+ align:"center",
+ dataIndex: 'sortOrder'
+ },
+ {
+ title: '创建时间',
+ align:"center",
+ dataIndex: 'createTime',
+ customRender: ({ text }) => {
+ return !text ? "" : render.renderDate(text);
+ }
+ },
+];
+
+//查询数据
+export const searchFormSchema: FormSchema[] = [
+ {
+ label: "规格名称",
+ field: 'specName',
+ component: 'Input',
+ colProps: {span: 6},
+ },
+ {
+ label: "规格值",
+ field: 'specValue',
+ component: 'Input',
+ colProps: {span: 6},
+ },
+];
+
+//表单数据
+export const formSchema: FormSchema[] = [
+ {
+ label: '规格名称',
+ field: 'specName',
+ component: 'Input',
+ required: true,
+ },
+ {
+ label: '规格值',
+ field: 'specValue',
+ component: 'Input',
+ required: true,
+ },
+ {
+ label: '价格',
+ field: 'price',
+ component: 'InputNumber',
+ componentProps: {
+ precision: 2,
+ min: 0,
+ },
+ },
+ {
+ label: '排序',
+ field: 'sortOrder',
+ component: 'InputNumber',
+ componentProps: {
+ min: 0,
+ },
+ },
+ {
+ label: '产品ID',
+ field: 'productId',
+ component: 'Input',
+ show: false,
+ },
+ // TODO 主键隐藏字段,目前写死为ID
+ {
+ label: '',
+ field: 'id',
+ component: 'Input',
+ show: false
+ },
+];
+
+/**
+* 流程表单调用这个方法获取formSchema
+* @param param
+*/
+export function getBpmFormSchema(_formData): FormSchema[]{
+ // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
+ return formSchema;
+}
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/components/AppletProductForm.vue b/jeecgboot-vue3/src/views/applet/product/components/AppletProductForm.vue
new file mode 100644
index 0000000..01192b9
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/components/AppletProductForm.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/components/AppletProductModal.vue b/jeecgboot-vue3/src/views/applet/product/components/AppletProductModal.vue
new file mode 100644
index 0000000..e5b222a
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/components/AppletProductModal.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecForm.vue b/jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecForm.vue
new file mode 100644
index 0000000..5aaa4b1
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecForm.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecModal.vue b/jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecModal.vue
new file mode 100644
index 0000000..be1e2f2
--- /dev/null
+++ b/jeecgboot-vue3/src/views/applet/product/components/AppletProductSpecModal.vue
@@ -0,0 +1,175 @@
+
+
+
+
新增规格
+
加载中...
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file