2 Комити d7e70c1d52 ... 0b7c248abe

Аутор SHA1 Порука Датум
  GaoRunQi 0b7c248abe feat ui 修复了分类子表无法加载的问题 пре 6 месеци
  GaoRunQi a68271d40a feat ui 修改了点餐分类的类名 пре 6 месеци

+ 53 - 53
yudao-ui-admin-vue2/src/api/goods/goods/index.js → yudao-ui-admin-vue2/src/api/restaurant/restaurant/index.js

@@ -1,53 +1,53 @@
-import request from '@/utils/request'
-
-// 创建商品
-export function createGoods(data) {
-  return request({
-    url: '/goods/goods/create',
-    method: 'post',
-    data: data
-  })
-}
-
-// 更新商品
-export function updateGoods(data) {
-  return request({
-    url: '/goods/goods/update',
-    method: 'put',
-    data: data
-  })
-}
-
-// 删除商品
-export function deleteGoods(id) {
-  return request({
-    url: '/goods/goods/delete?id=' + id,
-    method: 'delete'
-  })
-}
-
-// 获得商品
-export function getGoods(id) {
-  return request({
-    url: '/goods/goods/get?id=' + id,
-    method: 'get'
-  })
-}
-
-// 获得商品分页
-export function getGoodsPage(params) {
-  return request({
-    url: '/goods/goods/page',
-    method: 'get',
-    params
-  })
-}
-// 导出商品 Excel
-export function exportGoodsExcel(params) {
-  return request({
-    url: '/goods/goods/export-excel',
-    method: 'get',
-    params,
-    responseType: 'blob'
-  })
-}
+import request from '@/utils/request'
+
+// 创建商品
+export function createGoods(data) {
+  return request({
+    url: '/restaurant/restaurant/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 更新商品
+export function updateGoods(data) {
+  return request({
+    url: '/restaurant/restaurant/update',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除商品
+export function deleteGoods(id) {
+  return request({
+    url: '/restaurant/restaurant/delete?id=' + id,
+    method: 'delete'
+  })
+}
+
+// 获得商品
+export function getGoods(id) {
+  return request({
+    url: '/restaurant/restaurant/get?id=' + id,
+    method: 'get'
+  })
+}
+
+// 获得商品分页
+export function getGoodsPage(params) {
+  return request({
+    url: '/restaurant/restaurant/page',
+    method: 'get',
+    params
+  })
+}
+// 导出商品 Excel
+export function exportGoodsExcel(params) {
+  return request({
+    url: '/restaurant/restaurant/export-excel',
+    method: 'get',
+    params,
+    responseType: 'blob'
+  })
+}

+ 7 - 7
yudao-ui-admin-vue2/src/api/goods/type/index.js → yudao-ui-admin-vue2/src/api/restaurant/type/index.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 创建商品分类
 export function createType(data) {
   return request({
-    url: '/goods/type/create',
+    url: '/restaurant/type/create',
     method: 'post',
     data: data
   })
@@ -12,7 +12,7 @@ export function createType(data) {
 // 更新商品分类
 export function updateType(data) {
   return request({
-    url: '/goods/type/update',
+    url: '/restaurant/type/update',
     method: 'put',
     data: data
   })
@@ -21,7 +21,7 @@ export function updateType(data) {
 // 删除商品分类
 export function deleteType(id) {
   return request({
-    url: '/goods/type/delete?id=' + id,
+    url: '/restaurant/type/delete?id=' + id,
     method: 'delete'
   })
 }
@@ -29,7 +29,7 @@ export function deleteType(id) {
 // 获得商品分类
 export function getType(id) {
   return request({
-    url: '/goods/type/get?id=' + id,
+    url: '/restaurant/type/get?id=' + id,
     method: 'get'
   })
 }
@@ -37,7 +37,7 @@ export function getType(id) {
 // 获得商品分类分页
 export function getTypePage(params) {
   return request({
-    url: '/goods/type/page',
+    url: '/restaurant/type/page',
     method: 'get',
     params
   })
@@ -45,7 +45,7 @@ export function getTypePage(params) {
 // 导出商品分类 Excel
 export function exportTypeExcel(params) {
   return request({
-    url: '/goods/type/export-excel',
+    url: '/restaurant/type/export-excel',
     method: 'get',
     params,
     responseType: 'blob'
@@ -56,7 +56,7 @@ export function exportTypeExcel(params) {
       // 获得商品
     export function getByGoodsTypeId(goodsTypeId) {
       return request({
-        url: '/goods/type//get-by-goods-type-id?goodsTypeId=' + goodsTypeId,
+        url: '/restaurant/type/goods/list-by-goods-type-id?goodsTypeId=' + goodsTypeId,
         method: 'get'
       })
     }

+ 109 - 109
yudao-ui-admin-vue2/src/views/goods/goods/GoodsForm.vue → yudao-ui-admin-vue2/src/views/restaurant/goods/GoodsForm.vue

@@ -1,109 +1,109 @@
-<template>
-  <div class="app-container">
-    <!-- 对话框(添加 / 修改) -->
-    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
-      <el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
-                    <el-form-item label="商品分类" prop="goodsTypeId">
-                      <el-input v-model="formData.goodsTypeId" placeholder="请输入商品分类" />
-                    </el-form-item>
-                    <el-form-item label="商品名称" prop="goodsName">
-                      <el-input v-model="formData.goodsName" placeholder="请输入商品名称" />
-                    </el-form-item>
-                    <el-form-item label="商品价格" prop="goodsPrice">
-                      <el-input v-model="formData.goodsPrice" placeholder="请输入商品价格" />
-                    </el-form-item>
-                    <el-form-item label="商品图标">
-                      <ImageUpload v-model="formData.goodsIcon"/>
-                    </el-form-item>
-      </el-form>
-              <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
-        <el-button @click="dialogVisible = false">取 消</el-button>
-      </div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-  import * as GoodsApi from '@/api/goods/goods';
-  import ImageUpload from '@/components/ImageUpload';
-      export default {
-    name: "GoodsForm",
-    components: {
-          ImageUpload,
-                    },
-    data() {
-      return {
-        // 弹出层标题
-        dialogTitle: "",
-        // 是否显示弹出层
-        dialogVisible: false,
-        // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
-        formLoading: false,
-        // 表单参数
-        formData: {
-                            goodsTypeId: undefined,
-                            goodsName: undefined,
-                            goodsPrice: undefined,
-                            goodsIcon: undefined,
-        },
-        // 表单校验
-        formRules: {
-        },
-                        };
-    },
-    methods: {
-      /** 打开弹窗 */
-     async open(id) {
-        this.dialogVisible = true;
-        this.reset();
-        // 修改时,设置数据
-        if (id) {
-          this.formLoading = true;
-          try {
-            const res = await GoodsApi.getGoods(id);
-            this.formData = res.data;
-            this.title = "修改商品";
-          } finally {
-            this.formLoading = false;
-          }
-        }
-        this.title = "新增商品";
-              },
-      /** 提交按钮 */
-      async submitForm() {
-        // 校验主表
-        await this.$refs["formRef"].validate();
-                  this.formLoading = true;
-        try {
-          const data = this.formData;
-                  // 修改的提交
-          if (data.id) {
-            await GoodsApi.updateGoods(data);
-            this.$modal.msgSuccess("修改成功");
-            this.dialogVisible = false;
-            this.$emit('success');
-            return;
-          }
-          // 添加的提交
-          await GoodsApi.createGoods(data);
-          this.$modal.msgSuccess("新增成功");
-          this.dialogVisible = false;
-          this.$emit('success');
-        } finally {
-          this.formLoading = false;
-        }
-      },
-                      /** 表单重置 */
-      reset() {
-        this.formData = {
-                            goodsTypeId: undefined,
-                            goodsName: undefined,
-                            goodsPrice: undefined,
-                            goodsIcon: undefined,
-        };
-        this.resetForm("formRef");
-      }
-    }
-  };
-</script>
+<template>
+  <div class="app-container">
+    <!-- 对话框(添加 / 修改) -->
+    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
+      <el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
+                    <el-form-item label="商品分类" prop="goodsTypeId">
+                      <el-input v-model="formData.goodsTypeId" placeholder="请输入商品分类" />
+                    </el-form-item>
+                    <el-form-item label="商品名称" prop="goodsName">
+                      <el-input v-model="formData.goodsName" placeholder="请输入商品名称" />
+                    </el-form-item>
+                    <el-form-item label="商品价格" prop="goodsPrice">
+                      <el-input v-model="formData.goodsPrice" placeholder="请输入商品价格" />
+                    </el-form-item>
+                    <el-form-item label="商品图标">
+                      <ImageUpload v-model="formData.goodsIcon"/>
+                    </el-form-item>
+      </el-form>
+              <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
+        <el-button @click="dialogVisible = false">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import * as GoodsApi from '@/api/restaurant/restaurant';
+  import ImageUpload from '@/components/ImageUpload';
+      export default {
+    name: "GoodsForm",
+    components: {
+          ImageUpload,
+                    },
+    data() {
+      return {
+        // 弹出层标题
+        dialogTitle: "",
+        // 是否显示弹出层
+        dialogVisible: false,
+        // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+        formLoading: false,
+        // 表单参数
+        formData: {
+                            goodsTypeId: undefined,
+                            goodsName: undefined,
+                            goodsPrice: undefined,
+                            goodsIcon: undefined,
+        },
+        // 表单校验
+        formRules: {
+        },
+                        };
+    },
+    methods: {
+      /** 打开弹窗 */
+     async open(id) {
+        this.dialogVisible = true;
+        this.reset();
+        // 修改时,设置数据
+        if (id) {
+          this.formLoading = true;
+          try {
+            const res = await GoodsApi.getGoods(id);
+            this.formData = res.data;
+            this.title = "修改商品";
+          } finally {
+            this.formLoading = false;
+          }
+        }
+        this.title = "新增商品";
+              },
+      /** 提交按钮 */
+      async submitForm() {
+        // 校验主表
+        await this.$refs["formRef"].validate();
+                  this.formLoading = true;
+        try {
+          const data = this.formData;
+                  // 修改的提交
+          if (data.id) {
+            await GoodsApi.updateGoods(data);
+            this.$modal.msgSuccess("修改成功");
+            this.dialogVisible = false;
+            this.$emit('success');
+            return;
+          }
+          // 添加的提交
+          await GoodsApi.createGoods(data);
+          this.$modal.msgSuccess("新增成功");
+          this.dialogVisible = false;
+          this.$emit('success');
+        } finally {
+          this.formLoading = false;
+        }
+      },
+                      /** 表单重置 */
+      reset() {
+        this.formData = {
+                            goodsTypeId: undefined,
+                            goodsName: undefined,
+                            goodsPrice: undefined,
+                            goodsIcon: undefined,
+        };
+        this.resetForm("formRef");
+      }
+    }
+  };
+</script>

+ 156 - 156
yudao-ui-admin-vue2/src/views/goods/goods/index.vue → yudao-ui-admin-vue2/src/views/restaurant/goods/index.vue

@@ -1,156 +1,156 @@
-<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="goodsTypeId">
-        <el-input v-model="queryParams.goodsTypeId" placeholder="请输入商品分类" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="商品名称" prop="goodsName">
-        <el-input v-model="queryParams.goodsName" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="商品价格" prop="goodsPrice">
-        <el-input v-model="queryParams.goodsPrice" placeholder="请输入商品价格" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="创建时间" prop="createTime">
-        <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
-                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" @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="openForm(undefined)"
-                   v-hasPermi="['goods:goods:create']">新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
-                   v-hasPermi="['goods:goods:export']">导出</el-button>
-      </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-
-            <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
-            <el-table-column label="商品编号" align="center" prop="id" />
-      <el-table-column label="商品分类" align="center" prop="goodsTypeId" />
-      <el-table-column label="商品名称" align="center" prop="goodsName" />
-      <el-table-column label="商品价格" align="center" prop="goodsPrice" />
-      <el-table-column label="商品图标" align="center" prop="goodsIcon" />
-      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
-        <template v-slot="scope">
-          <span>{{ parseTime(scope.row.createTime) }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template v-slot="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
-                     v-hasPermi="['goods:goods:update']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                     v-hasPermi="['goods:goods:delete']">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <!-- 分页组件 -->
-    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
-                @pagination="getList"/>
-    <!-- 对话框(添加 / 修改) -->
-    <GoodsForm ref="formRef" @success="getList" />
-    </div>
-</template>
-
-<script>
-import * as GoodsApi from '@/api/goods/goods';
-import GoodsForm from './GoodsForm.vue';
-export default {
-  name: "Goods",
-  components: {
-          GoodsForm,
-  },
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 导出遮罩层
-      exportLoading: false,
-      // 显示搜索条件
-      showSearch: true,
-              // 总条数
-        total: 0,
-      // 商品列表
-      list: [],
-      // 是否展开,默认全部展开
-      isExpandAll: true,
-      // 重新渲染表格状态
-      refreshTable: true,
-      // 选中行
-      currentRow: {},
-      // 查询参数
-      queryParams: {
-                    pageNo: 1,
-            pageSize: 10,
-        goodsTypeId: null,
-        goodsName: null,
-        goodsPrice: null,
-        goodsIcon: null,
-        createTime: [],
-      },
-            };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询列表 */
-    async getList() {
-      try {
-      this.loading = true;
-              const res = await GoodsApi.getGoodsPage(this.queryParams);
-        this.list = res.data.list;
-        this.total = res.data.total;
-      } finally {
-        this.loading = false;
-      }
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNo = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    /** 添加/修改操作 */
-    openForm(id) {
-      this.$refs["formRef"].open(id);
-    },
-    /** 删除按钮操作 */
-    async handleDelete(row) {
-      const id = row.id;
-      await this.$modal.confirm('是否确认删除商品编号为"' + id + '"的数据项?')
-      try {
-       await GoodsApi.deleteGoods(id);
-       await this.getList();
-       this.$modal.msgSuccess("删除成功");
-      } catch {}
-    },
-    /** 导出按钮操作 */
-    async handleExport() {
-      await this.$modal.confirm('是否确认导出所有商品数据项?');
-      try {
-        this.exportLoading = true;
-        const data = await GoodsApi.exportGoodsExcel(this.queryParams);
-        this.$download.excel(data, '商品.xls');
-      } catch {
-      } finally {
-        this.exportLoading = false;
-      }
-    },
-              }
-};
-</script>
+<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="goodsTypeId">
+        <el-input v-model="queryParams.goodsTypeId" placeholder="请输入商品分类" clearable @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+      <el-form-item label="商品名称" prop="goodsName">
+        <el-input v-model="queryParams.goodsName" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+      <el-form-item label="商品价格" prop="goodsPrice">
+        <el-input v-model="queryParams.goodsPrice" placeholder="请输入商品价格" clearable @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
+                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" @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="openForm(undefined)"
+                   v-hasPermi="['restaurant:restaurant:create']">新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
+                   v-hasPermi="['restaurant:restaurant:export']">导出</el-button>
+      </el-col>
+              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+            <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+            <el-table-column label="商品编号" align="center" prop="id" />
+      <el-table-column label="商品分类" align="center" prop="goodsTypeId" />
+      <el-table-column label="商品名称" align="center" prop="goodsName" />
+      <el-table-column label="商品价格" align="center" prop="goodsPrice" />
+      <el-table-column label="商品图标" align="center" prop="goodsIcon" />
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+        <template v-slot="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template v-slot="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
+                     v-hasPermi="['restaurant:restaurant:update']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+                     v-hasPermi="['restaurant:restaurant:delete']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页组件 -->
+    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+                @pagination="getList"/>
+    <!-- 对话框(添加 / 修改) -->
+    <GoodsForm ref="formRef" @success="getList" />
+    </div>
+</template>
+
+<script>
+import * as GoodsApi from '@/api/restaurant/restaurant';
+import GoodsForm from './GoodsForm.vue';
+export default {
+  name: "Goods",
+  components: {
+          GoodsForm,
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 显示搜索条件
+      showSearch: true,
+              // 总条数
+        total: 0,
+      // 商品列表
+      list: [],
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
+      // 选中行
+      currentRow: {},
+      // 查询参数
+      queryParams: {
+                    pageNo: 1,
+            pageSize: 10,
+        goodsTypeId: null,
+        goodsName: null,
+        goodsPrice: null,
+        goodsIcon: null,
+        createTime: [],
+      },
+            };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询列表 */
+    async getList() {
+      try {
+      this.loading = true;
+              const res = await GoodsApi.getGoodsPage(this.queryParams);
+        this.list = res.data.list;
+        this.total = res.data.total;
+      } finally {
+        this.loading = false;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNo = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 添加/修改操作 */
+    openForm(id) {
+      this.$refs["formRef"].open(id);
+    },
+    /** 删除按钮操作 */
+    async handleDelete(row) {
+      const id = row.id;
+      await this.$modal.confirm('是否确认删除商品编号为"' + id + '"的数据项?')
+      try {
+       await GoodsApi.deleteGoods(id);
+       await this.getList();
+       this.$modal.msgSuccess("删除成功");
+      } catch {}
+    },
+    /** 导出按钮操作 */
+    async handleExport() {
+      await this.$modal.confirm('是否确认导出所有商品数据项?');
+      try {
+        this.exportLoading = true;
+        const data = await GoodsApi.exportGoodsExcel(this.queryParams);
+        this.$download.excel(data, '商品.xls');
+      } catch {
+      } finally {
+        this.exportLoading = false;
+      }
+    },
+              }
+};
+</script>

+ 111 - 111
yudao-ui-admin-vue2/src/views/goods/type/TypeForm.vue → yudao-ui-admin-vue2/src/views/restaurant/type/TypeForm.vue

@@ -1,111 +1,111 @@
-<template>
-  <div class="app-container">
-    <!-- 对话框(添加 / 修改) -->
-    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
-      <el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
-                    <el-form-item label="商品分类名称" prop="goodsTypeName">
-                      <el-input v-model="formData.goodsTypeName" placeholder="请输入商品分类名称" />
-                    </el-form-item>
-      </el-form>
-                  <!-- 子表的表单 -->
-          <el-tabs v-model="subTabsName">
-                <el-tab-pane label="商品" name="">
-                  <Form ref="FormRef" :goods-type-id="formData.id" />
-                </el-tab-pane>
-          </el-tabs>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
-        <el-button @click="dialogVisible = false">取 消</el-button>
-      </div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-  import * as TypeApi from '@/api/goods/type';
-          import Form from './components/Form.vue'
-  export default {
-    name: "TypeForm",
-    components: {
-                               Form,
-    },
-    data() {
-      return {
-        // 弹出层标题
-        dialogTitle: "",
-        // 是否显示弹出层
-        dialogVisible: false,
-        // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
-        formLoading: false,
-        // 表单参数
-        formData: {
-                            goodsTypeName: undefined,
-        },
-        // 表单校验
-        formRules: {
-        },
-                              /** 子表的表单 */
-             subTabsName: ''
-      };
-    },
-    methods: {
-      /** 打开弹窗 */
-     async open(id) {
-        this.dialogVisible = true;
-        this.reset();
-        // 修改时,设置数据
-        if (id) {
-          this.formLoading = true;
-          try {
-            const res = await TypeApi.getType(id);
-            this.formData = res.data;
-            this.title = "修改商品分类";
-          } finally {
-            this.formLoading = false;
-          }
-        }
-        this.title = "新增商品分类";
-              },
-      /** 提交按钮 */
-      async submitForm() {
-        // 校验主表
-        await this.$refs["formRef"].validate();
-                          // 校验子表
-                    try {
-                                            await this.$refs['FormRef'].validate();
-                    } catch (e) {
-                      this.subTabsName = '';
-                      return;
-                    }
-        this.formLoading = true;
-        try {
-          const data = this.formData;
-                    // 拼接子表的数据
-              data.s = this.$refs['FormRef'].getData();
-          // 修改的提交
-          if (data.id) {
-            await TypeApi.updateType(data);
-            this.$modal.msgSuccess("修改成功");
-            this.dialogVisible = false;
-            this.$emit('success');
-            return;
-          }
-          // 添加的提交
-          await TypeApi.createType(data);
-          this.$modal.msgSuccess("新增成功");
-          this.dialogVisible = false;
-          this.$emit('success');
-        } finally {
-          this.formLoading = false;
-        }
-      },
-                      /** 表单重置 */
-      reset() {
-        this.formData = {
-                            goodsTypeName: undefined,
-        };
-        this.resetForm("formRef");
-      }
-    }
-  };
-</script>
+<template>
+  <div class="app-container">
+    <!-- 对话框(添加 / 修改) -->
+    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
+      <el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
+                    <el-form-item label="商品分类名称" prop="goodsTypeName">
+                      <el-input v-model="formData.goodsTypeName" placeholder="请输入商品分类名称" />
+                    </el-form-item>
+      </el-form>
+                  <!-- 子表的表单 -->
+          <el-tabs v-model="subTabsName">
+                <el-tab-pane label="商品" name="">
+                  <Form ref="FormRef" :goodsTypeId="formData.id" />
+                </el-tab-pane>
+          </el-tabs>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
+        <el-button @click="dialogVisible = false">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import * as TypeApi from '@/api/restaurant/type';
+          import Form from './components/Form.vue'
+  export default {
+    name: "TypeForm",
+    components: {
+                               Form,
+    },
+    data() {
+      return {
+        // 弹出层标题
+        dialogTitle: "",
+        // 是否显示弹出层
+        dialogVisible: false,
+        // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+        formLoading: false,
+        // 表单参数
+        formData: {
+                            goodsTypeName: undefined,
+        },
+        // 表单校验
+        formRules: {
+        },
+                              /** 子表的表单 */
+             subTabsName: ''
+      };
+    },
+    methods: {
+      /** 打开弹窗 */
+     async open(id) {
+        this.dialogVisible = true;
+        this.reset();
+        // 修改时,设置数据
+        if (id) {
+          this.formLoading = true;
+          try {
+            const res = await TypeApi.getType(id);
+            this.formData = res.data;
+            this.title = "修改商品分类";
+          } finally {
+            this.formLoading = false;
+          }
+        }
+        this.title = "新增商品分类";
+              },
+      /** 提交按钮 */
+      async submitForm() {
+        // 校验主表
+        await this.$refs["formRef"].validate();
+                          // 校验子表
+                    try {
+                                            await this.$refs['FormRef'].validate();
+                    } catch (e) {
+                      this.subTabsName = '';
+                      return;
+                    }
+        this.formLoading = true;
+        try {
+          const data = this.formData;
+                    // 拼接子表的数据
+              data.goodss = this.$refs['FormRef'].getData();
+          // 修改的提交
+          if (data.id) {
+            await TypeApi.updateType(data);
+            this.$modal.msgSuccess("修改成功");
+            this.dialogVisible = false;
+            this.$emit('success');
+            return;
+          }
+          // 添加的提交
+          await TypeApi.createType(data);
+          this.$modal.msgSuccess("新增成功");
+          this.dialogVisible = false;
+          this.$emit('success');
+        } finally {
+          this.formLoading = false;
+        }
+      },
+                      /** 表单重置 */
+      reset() {
+        this.formData = {
+                            goodsTypeName: undefined,
+        };
+        this.resetForm("formRef");
+      }
+    }
+  };
+</script>

+ 120 - 118
yudao-ui-admin-vue2/src/views/goods/type/components/Form.vue → yudao-ui-admin-vue2/src/views/restaurant/type/components/Form.vue

@@ -1,118 +1,120 @@
-<template>
-  <div class="app-container">
-      <el-form
-        ref="formRef"
-        :model="formData"
-        :rules="formRules"
-        v-loading="formLoading"
-        label-width="0px"
-        :inline-message="true"
-      >
-        <el-table :data="formData" class="-mt-10px">
-          <el-table-column label="序号" type="index" width="100" />
-                       <el-table-column label="商品名称" min-width="150">
-                        <template v-slot="{ row, $index }">
-                          <el-form-item :prop="`${$index}.goodsName`" :rules="formRules.goodsName" class="mb-0px!">
-                            <el-input v-model="row.goodsName" placeholder="请输入商品名称" />
-                          </el-form-item>
-                        </template>
-                      </el-table-column>
-                      <el-table-column label="商品价格" min-width="150">
-                        <template v-slot="{ row, $index }">
-                          <el-form-item :prop="`${$index}.goodsPrice`" :rules="formRules.goodsPrice" class="mb-0px!">
-                            <el-input v-model="row.goodsPrice" placeholder="请输入商品价格" />
-                          </el-form-item>
-                        </template>
-                      </el-table-column>
-                      <el-table-column label="商品图标" min-width="200">
-                        <template v-slot="{ row, $index }">
-                          <el-form-item :prop="`${$index}.goodsIcon`" :rules="formRules.goodsIcon" class="mb-0px!">
-                            <ImageUpload v-model="row.goodsIcon"/>
-                          </el-form-item>
-                        </template>
-                      </el-table-column>
-          <el-table-column align="center" fixed="right" label="操作" width="60">
-            <template v-slot="{ $index }">
-              <el-link @click="handleDelete($index)">—</el-link>
-            </template>
-          </el-table-column>
-        </el-table>
-      </el-form>
-      <el-row justify="center" class="mt-3">
-        <el-button @click="handleAdd" round>+ 添加商品</el-button>
-      </el-row>
-  </div>
-</template>
-
-<script>
-  import * as TypeApi from '@/api/goods/type';
-      import ImageUpload from '@/components/ImageUpload';
-  export default {
-    name: "Form",
-    components: {
-          ImageUpload,
-    },
-    props:[
-      'goodsTypeId'
-    ],// 商品分类(主表的关联字段)
-    data() {
-      return {
-        // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
-        formLoading: false,
-        // 表单参数
-        formData: [],
-        // 表单校验
-        formRules: {
-        },
-      };
-    },
-    watch:{/** 监听主表的关联字段的变化,加载对应的子表数据 */
-      goodsTypeId:{
-        handler(val) {
-          // 1. 重置表单
-              this.formData = []
-          // 2. val 非空,则加载数据
-          if (!val) {
-            return;
-          }
-          try {
-            this.formLoading = true;
-            // 这里还是需要获取一下 this 的不然取不到 formData
-            const that = this;
-            TypeApi.getListByGoodsTypeId(val).then(function (res){
-              that.formData = res.data;
-            })
-          } finally {
-            this.formLoading = false;
-          }
-        },
-        immediate: true
-      }
-    },
-    methods: {
-          /** 新增按钮操作 */
-          handleAdd() {
-            const row = {
-                                goodsTypeId: undefined,
-                                goodsName: undefined,
-                                goodsPrice: undefined,
-                                goodsIcon: undefined,
-            }
-            row.goodsTypeId = this.goodsTypeId;
-            this.formData.push(row);
-          },
-          /** 删除按钮操作 */
-          handleDelete(index) {
-            this.formData.splice(index, 1);
-          },
-      /** 表单校验 */
-      validate(){
-        return this.$refs["formRef"].validate();
-      },
-      /** 表单值 */
-      getData(){
-        return this.formData;
-      }
-    }
-  };
-</script>
+<template>
+  <div class="app-container">
+      <el-form
+        ref="formRef"
+        :model="formData"
+        :rules="formRules"
+        v-loading="formLoading"
+        label-width="0px"
+        :inline-message="true"
+      >
+        <el-table :data="formData" class="-mt-10px">
+          <el-table-column label="序号" type="index" width="100" />
+                       <el-table-column label="商品名称" min-width="150">
+                        <template v-slot="{ row, $index }">
+                          <el-form-item :prop="`${$index}.goodsName`" :rules="formRules.goodsName" class="mb-0px!">
+                            <el-input v-model="row.goodsName" placeholder="请输入商品名称" />
+                          </el-form-item>
+                        </template>
+                      </el-table-column>
+                      <el-table-column label="商品价格" min-width="150">
+                        <template v-slot="{ row, $index }">
+                          <el-form-item :prop="`${$index}.goodsPrice`" :rules="formRules.goodsPrice" class="mb-0px!">
+                            <el-input v-model="row.goodsPrice" placeholder="请输入商品价格" />
+                          </el-form-item>
+                        </template>
+                      </el-table-column>
+                      <el-table-column label="商品图标" min-width="200">
+                        <template v-slot="{ row, $index }">
+                          <el-form-item :prop="`${$index}.goodsIcon`" :rules="formRules.goodsIcon" class="mb-0px!">
+                            <ImageUpload v-model="row.goodsIcon" :limit = '1' />
+                          </el-form-item>
+                        </template>
+                      </el-table-column>
+          <el-table-column align="center" fixed="right" label="操作" width="60">
+            <template v-slot="{ $index }">
+              <el-link @click="handleDelete($index)">—</el-link>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-form>
+      <el-row justify="center" class="mt-3">
+        <el-button @click="handleAdd" round>+ 添加商品</el-button>
+      </el-row>
+  </div>
+</template>
+
+<script>
+  import * as TypeApi from '@/api/restaurant/type';
+      import ImageUpload from '@/components/ImageUpload';
+  export default {
+    name: "Form",
+    components: {
+          ImageUpload,
+    },
+    props:[
+      'goodsTypeId'
+    ],// 商品分类(主表的关联字段)
+    data() {
+      return {
+        // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+        formLoading: false,
+        // 表单参数
+        formData: [],
+        // 表单校验
+        formRules: {
+        },
+      };
+    },
+    watch:{/** 监听主表的关联字段的变化,加载对应的子表数据 */
+      goodsTypeId:{
+        
+        handler(val) {
+          // 1. 重置表单
+          console.log('goodsTypeId', val)
+              this.formData = []
+          // 2. val 非空,则加载数据
+          if (!val) {
+            return;
+          }
+          try {
+            this.formLoading = true;
+            // 这里还是需要获取一下 this 的不然取不到 formData
+            const that = this;
+            TypeApi.getByGoodsTypeId(val).then(function (res){
+              that.formData = res.data;
+            })
+          } finally {
+            this.formLoading = false;
+          }
+        },
+        immediate: true
+      }
+    },
+    methods: {
+          /** 新增按钮操作 */
+          handleAdd() {
+            const row = {
+                                goodsTypeId: undefined,
+                                goodsName: undefined,
+                                goodsPrice: undefined,
+                                goodsIcon: undefined,
+            }
+            row.goodsTypeId = this.goodsTypeId;
+            this.formData.push(row);
+          },
+          /** 删除按钮操作 */
+          handleDelete(index) {
+            this.formData.splice(index, 1);
+          },
+      /** 表单校验 */
+      validate(){
+        return this.$refs["formRef"].validate();
+      },
+      /** 表单值 */
+      getData(){
+        return this.formData;
+      }
+    }
+  };
+</script>

+ 144 - 144
yudao-ui-admin-vue2/src/views/goods/type/index.vue → yudao-ui-admin-vue2/src/views/restaurant/type/index.vue

@@ -1,144 +1,144 @@
-<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="goodsTypeName">
-        <el-input v-model="queryParams.goodsTypeName" placeholder="请输入商品分类名称" clearable @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-      <el-form-item label="创建时间" prop="createTime">
-        <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
-                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" @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="openForm(undefined)"
-                   v-hasPermi="['goods:type:create']">新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
-                   v-hasPermi="['goods:type:export']">导出</el-button>
-      </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-
-            <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
-            <el-table-column label="商品分类ID" align="center" prop="id" />
-      <el-table-column label="商品分类名称" align="center" prop="goodsTypeName" />
-      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
-        <template v-slot="scope">
-          <span>{{ parseTime(scope.row.createTime) }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template v-slot="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
-                     v-hasPermi="['goods:type:update']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                     v-hasPermi="['goods:type:delete']">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <!-- 分页组件 -->
-    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
-                @pagination="getList"/>
-    <!-- 对话框(添加 / 修改) -->
-    <TypeForm ref="formRef" @success="getList" />
-    </div>
-</template>
-
-<script>
-import * as TypeApi from '@/api/goods/type';
-import TypeForm from './TypeForm.vue';
-export default {
-  name: "Type",
-  components: {
-          TypeForm,
-  },
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 导出遮罩层
-      exportLoading: false,
-      // 显示搜索条件
-      showSearch: true,
-              // 总条数
-        total: 0,
-      // 商品分类列表
-      list: [],
-      // 是否展开,默认全部展开
-      isExpandAll: true,
-      // 重新渲染表格状态
-      refreshTable: true,
-      // 选中行
-      currentRow: {},
-      // 查询参数
-      queryParams: {
-                    pageNo: 1,
-            pageSize: 10,
-        goodsTypeName: null,
-        createTime: [],
-      },
-            };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询列表 */
-    async getList() {
-      try {
-      this.loading = true;
-              const res = await TypeApi.getTypePage(this.queryParams);
-        this.list = res.data.list;
-        this.total = res.data.total;
-      } finally {
-        this.loading = false;
-      }
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNo = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    /** 添加/修改操作 */
-    openForm(id) {
-      this.$refs["formRef"].open(id);
-    },
-    /** 删除按钮操作 */
-    async handleDelete(row) {
-      const id = row.id;
-      await this.$modal.confirm('是否确认删除商品分类编号为"' + id + '"的数据项?')
-      try {
-       await TypeApi.deleteType(id);
-       await this.getList();
-       this.$modal.msgSuccess("删除成功");
-      } catch {}
-    },
-    /** 导出按钮操作 */
-    async handleExport() {
-      await this.$modal.confirm('是否确认导出所有商品分类数据项?');
-      try {
-        this.exportLoading = true;
-        const data = await TypeApi.exportTypeExcel(this.queryParams);
-        this.$download.excel(data, '商品分类.xls');
-      } catch {
-      } finally {
-        this.exportLoading = false;
-      }
-    },
-              }
-};
-</script>
+<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="goodsTypeName">
+        <el-input v-model="queryParams.goodsTypeName" placeholder="请输入商品分类名称" clearable @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
+                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" @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="openForm(undefined)"
+                   v-hasPermi="['restaurant:type:create']">新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
+                   v-hasPermi="['restaurant:type:export']">导出</el-button>
+      </el-col>
+              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+            <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+            <el-table-column label="商品分类ID" align="center" prop="id" />
+      <el-table-column label="商品分类名称" align="center" prop="goodsTypeName" />
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+        <template v-slot="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template v-slot="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
+                     v-hasPermi="['restaurant:type:update']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+                     v-hasPermi="['restaurant:type:delete']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页组件 -->
+    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+                @pagination="getList"/>
+    <!-- 对话框(添加 / 修改) -->
+    <TypeForm ref="formRef" @success="getList" />
+    </div>
+</template>
+
+<script>
+import * as TypeApi from '@/api/restaurant/type';
+import TypeForm from './TypeForm.vue';
+export default {
+  name: "Type",
+  components: {
+          TypeForm,
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 显示搜索条件
+      showSearch: true,
+              // 总条数
+        total: 0,
+      // 商品分类列表
+      list: [],
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
+      // 选中行
+      currentRow: {},
+      // 查询参数
+      queryParams: {
+                    pageNo: 1,
+            pageSize: 10,
+        goodsTypeName: null,
+        createTime: [],
+      },
+            };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询列表 */
+    async getList() {
+      try {
+      this.loading = true;
+              const res = await TypeApi.getTypePage(this.queryParams);
+        this.list = res.data.list;
+        this.total = res.data.total;
+      } finally {
+        this.loading = false;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNo = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 添加/修改操作 */
+    openForm(id) {
+      this.$refs["formRef"].open(id);
+    },
+    /** 删除按钮操作 */
+    async handleDelete(row) {
+      const id = row.id;
+      await this.$modal.confirm('是否确认删除商品分类编号为"' + id + '"的数据项?')
+      try {
+       await TypeApi.deleteType(id);
+       await this.getList();
+       this.$modal.msgSuccess("删除成功");
+      } catch {}
+    },
+    /** 导出按钮操作 */
+    async handleExport() {
+      await this.$modal.confirm('是否确认导出所有商品分类数据项?');
+      try {
+        this.exportLoading = true;
+        const data = await TypeApi.exportTypeExcel(this.queryParams);
+        this.$download.excel(data, '商品分类.xls');
+      } catch {
+      } finally {
+        this.exportLoading = false;
+      }
+    },
+              }
+};
+</script>