yusm 2 nedēļas atpakaļ
vecāks
revīzija
02ace5b5ae

+ 3 - 2
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/FactoryController.java

@@ -1,6 +1,8 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.Factory;
 import com.management.platform.service.FactoryService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,8 +26,7 @@ public class FactoryController {
     @RequestMapping("/getFactories")
     public HttpRespMsg getFactories(){
         HttpRespMsg msg = new HttpRespMsg();
-
-       msg.setData(factoryService.list());
+       msg.setData(factoryService.list(new QueryWrapper<Factory>().eq("is_active",1)));
        msg.setCode("ok");
        return msg;
     }

+ 4 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/MealApplicationsController.java

@@ -15,6 +15,7 @@ import com.management.platform.entity.User;
 import com.management.platform.service.MealApplicationsService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -26,6 +27,7 @@ import java.io.ByteArrayOutputStream;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 
 /**
@@ -78,7 +80,8 @@ public class MealApplicationsController {
                 Integer generatedId = mealApplications.getId();
 
                 // 生成二维码内容
-                String qrContent = now + "" + generatedId;
+                String format = now.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+                String qrContent = format + generatedId;
                 // 生成二维码图片
                 String qrCodeBase64 = generateQRCode(qrContent, 300, 300);
                 mealApplications.setQrCode(qrCodeBase64);

+ 47 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/MealTypesController.java

@@ -1,14 +1,20 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.MealTypes;
 import com.management.platform.service.MealApplicationsService;
 import com.management.platform.service.MealTypesService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.time.LocalDateTime;
+
 /**
  * <p>
  *  前端控制器
@@ -26,10 +32,50 @@ public class MealTypesController {
     @RequestMapping("/getMeals")
     public HttpRespMsg getMeals(){
         HttpRespMsg msg = new HttpRespMsg();
-        msg.setData(mealTypesService.list());
+        msg.setData(mealTypesService.list(new QueryWrapper<MealTypes>().eq("is_active",1)));
         msg.setCode("ok");
         return msg;
     }
+    @RequestMapping("/updateMeal")
+    public HttpRespMsg updateMeal(MealTypes mealTypes){
+        HttpRespMsg msg = new HttpRespMsg();
+        LocalDateTime now = LocalDateTime.now();
+        mealTypes.setUpdateAt(now);
+        boolean update = mealTypesService.updateById(mealTypes);
+        if(update){
+            msg.setCode("ok");
+        }else{
+            msg.setCode("error");
+        }
+        return msg;
+    }
+    @RequestMapping("/deleteMealType")
+    public HttpRespMsg deleteMealType(Integer id){
+        HttpRespMsg msg = new HttpRespMsg();
+        boolean delete = mealTypesService.removeById(id);
+        if(delete){
+            msg.setCode("ok");
+        }else{
+            msg.setCode("error");
+        }
+        return msg;
+    }
+    @RequestMapping("/addMealType")
+    public HttpRespMsg addMealType(MealTypes mealTypes){
+        HttpRespMsg msg = new HttpRespMsg();
+        LocalDateTime now = LocalDateTime.now();
+        MealTypes mealType = new MealTypes();
+        mealType.setCreateAt(now);
+        mealType.setName(mealTypes.getName());
+        mealType.setIsActive(mealTypes.getIsActive());
+        boolean save = mealTypesService.save(mealType);
+        if(save){
+            msg.setCode("ok");
+        }else{
+            msg.setCode("error");
+        }
+        return msg;
+    }
 
 }
 

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Factory.java

@@ -47,7 +47,7 @@ public class Factory extends Model<Factory> {
      * 是否启用 0:没启用 ;1:启用;
      */
     @TableField("is_active")
-    private String isActive;
+    private Integer isActive;
 
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern="yyyy-MM-dd")

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/MealTypes.java

@@ -63,7 +63,7 @@ public class MealTypes extends Model<MealTypes> {
      * 是否启用,1:启用,0:关闭
      */
     @TableField("is_active")
-    private String isActive;
+    private Integer isActive;
 
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern="yyyy-MM-dd")

+ 10 - 6
fhKeeper/formulahousekeeper/timesheet-workshop/src/routes.js

@@ -41,6 +41,8 @@ import quanx from './views/quanx/quanx'
 
 // 项目表单设置
 import projectForm from './views/project/projectForm'
+import factorySetting from './views/settings/factorySetting.vue'
+import mealTypeSetting from './views/settings/mealTypeSetting.vue'
 
 // 出勤日历
 import attendanceCalendar from './views/attendanceCalendar/index.vue'
@@ -106,7 +108,7 @@ export const allRouters = [
             { path: '/costDep/:id/:name', component: depDetail, name: '成本详情', hidden: true },
         ],
     },
-    
+
     {
         path: '/',
         component: Home,
@@ -141,7 +143,7 @@ export const allRouters = [
         ],
         name: '计划详情'
     },
-    
+
     {
         path: '/',
         component: Home,
@@ -152,7 +154,7 @@ export const allRouters = [
             { path: '/statistic', component: statistic, name: '数据统计' }
         ],
     },
-    
+
     {
         path: '/',
         component: Home,
@@ -163,7 +165,7 @@ export const allRouters = [
             { path: '/team', component: team, name: '组织架构' },
         ],
     },
-    
+
     {
         path: '/',
         component: Home,
@@ -179,12 +181,14 @@ export const allRouters = [
         component: Home,
         name: '系统设置',
         iconCls: 'iconfont firerock-iconsetting',
-        leaf: true,//只有一个节点
+        leaf: false,//只有一个节点
         children: [
             { path: '/settings', component: settings, name: '角色权限'},
+            { path: '/factorySetting', component: factorySetting, name: '厂区设置'},
+            { path: '/mealTypeSetting', component: mealTypeSetting, name: '餐别设置'},
         ],
     },
-    
+
     {
         path: '/404',
         component: NotFound,

+ 274 - 0
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/settings/factorySetting.vue

@@ -0,0 +1,274 @@
+<template>
+  <section>
+    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;position:sticky;top:0;z-index:1002">
+      <el-form :inline="true">
+        <el-form-item label="餐别设置">
+        </el-form-item>
+      </el-form>
+    </el-col>
+
+    <div style="padding: 20px;">
+      <div style="margin-bottom: 20px;">
+        <el-button type="primary" @click="handleAdd">新增厂区</el-button>
+      </div>
+
+      <el-table :data="tableData" border style="width: 100%;">
+        <el-table-column  type="index" label="序号" width="80" align="center"></el-table-column>
+        <el-table-column prop="name" label="餐别名称" align="center"></el-table-column>
+        <el-table-column label="是否启用" width="120" align="center">
+          <template slot-scope="scope">
+            <el-tag :type="scope.row.isActive === 1 ? 'success' : 'danger'">
+              {{ scope.row.isActive === 1 ? '启用' : '未启用' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="250" align="center">
+          <template slot-scope="scope">
+            <el-button size="mini" @click="handleEdit(scope.row)">修改</el-button>
+            <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
+            <el-button
+                size="mini"
+                :type="scope.row.isActive === 1 ? 'warning' : 'success'"
+                @click="toggleisActive(scope.row)">
+              {{ scope.row.isActive === 1 ? '禁用' : '启用' }}
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <!-- 新增/编辑对话框 -->
+    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="500px">
+      <el-form :model="formData" :rules="formRules" ref="formRef" label-width="100px">
+        <el-form-item label="餐别名称" prop="name">
+          <el-input v-model="formData.name" placeholder="请输入餐别名称"></el-input>
+        </el-form-item>
+        <el-form-item label="是否启用">
+          <el-switch
+              v-model="formData.isActive"
+              :active-value=1
+              :inactive-value=0
+              active-text="启用"
+              inactive-text="禁用">
+          </el-switch>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </section>
+</template>
+
+<script>export default {
+  data() {
+    return {
+      tableData: [],
+      dialogVisible: false,
+      dialogTitle: '',
+      isEdit: false,
+      formData: {
+        id: null,
+        name: '',
+        isActive: 1
+      },
+      formRules: {
+        name: [
+          { required: true, message: '请输入餐别名称', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+
+  mounted() {
+    this.fetchData();
+  },
+
+  methods: {
+    // 获取数据
+    fetchData() {
+      this.http.post('/meal-types/getMeals', {},
+          res => {
+            if (res.code == "ok") {
+              this.tableData = res.data;
+            } else {
+              this.$message({
+                message: res.msg,
+                type: "error"
+              });
+            }
+          },
+          error => {
+            this.$message({
+              message: error,
+              type: "error"
+            });
+          }
+      );
+    },
+
+    // 新增按钮点击事件
+    handleAdd() {
+      this.dialogTitle = '新增餐别';
+      this.isEdit = false;
+      this.formData = { id: null, name: '', isActive: 1 };
+      this.dialogVisible = true;
+    },
+
+    // 编辑按钮点击事件
+    handleEdit(row) {
+      this.dialogTitle = '编辑餐别';
+      this.isEdit = true;
+      this.formData = { ...row };
+      this.dialogVisible = true;
+    },
+
+    // 删除按钮点击事件
+    handleDelete(row) {
+      this.$confirm(`确定要删除餐别"${row.name}"吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.http.post('/meal-types/deleteMealType', {
+          id: row.id,
+        }, res => {
+          if (res.code == "ok") {
+            this.$message({
+              message: '删除成功',
+              type: "success"
+            });
+            this.fetchData();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        }, error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+
+    // 切换启用状态
+    toggleisActive(row) {
+      const newisActive = row.isActive === 1 ? 0 : 1;
+      const action = newisActive === 1 ? '启用' : '禁用';
+
+      this.$confirm(`确定要${action}餐别"${row.name}"吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.http.post('/meal-types/updateMeal', {
+          id: row.id,
+          isActive: newisActive
+        }, res => {
+          if (res.code == "ok") {
+            row.isActive = newisActive;
+            this.$message({
+              type: 'success',
+              message: `${action}成功!`
+            });
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        }, error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: `已取消${action}`
+        });
+      });
+    },
+
+    // 提交表单
+    handleSubmit() {
+      this.$refs.formRef.validate((valid) => {
+        if (valid) {
+          if (this.isEdit) {
+            this.http.post('/meal-types/updateMeal', {
+                  id: this.formData.id,
+                  name: this.formData.name,
+                  isActive: this.formData.isActive
+                },
+                res => {
+                  if (res.code == "ok") {
+                    this.$message({
+                      message: '编辑成功',
+                      type: "success"
+                    });
+                    this.dialogVisible = false;
+                    this.fetchData();
+                  } else {
+                    this.$message({
+                      message: res.msg,
+                      type: "error"
+                    });
+                  }
+                },
+                error => {
+                  this.$message({
+                    message: error,
+                    type: "error"
+                  });
+                }
+            );
+          } else {
+
+            this.http.post('/meal-types/addMealType', this.formData,
+                res => {
+                  if (res.code == "ok") {
+                    this.$message({
+                      message: '新增成功',
+                      type: "success"
+                    });
+                    this.dialogVisible = false;
+                    this.fetchData();
+                  } else {
+                    this.$message({
+                      message: res.msg,
+                      type: "error"
+                    });
+                  }
+                },
+                error => {
+                  this.$message({
+                    message: error,
+                    type: "error"
+                  });
+                }
+            );
+          }
+          this.dialogVisible = false;
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style scoped>.toolbar {
+  background: #f5f5f5;
+  padding: 15px;
+  margin-bottom: 20px;
+}
+</style>

+ 274 - 0
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/settings/mealTypeSetting.vue

@@ -0,0 +1,274 @@
+<template>
+  <section>
+    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;position:sticky;top:0;z-index:1002">
+      <el-form :inline="true">
+        <el-form-item label="餐别设置">
+        </el-form-item>
+      </el-form>
+    </el-col>
+
+    <div style="padding: 20px;">
+      <div style="margin-bottom: 20px;">
+        <el-button type="primary" @click="handleAdd">新增餐别</el-button>
+      </div>
+
+      <el-table :data="tableData" border style="width: 100%;">
+        <el-table-column  type="index" label="序号" width="80" align="center"></el-table-column>
+        <el-table-column prop="name" label="餐别名称" align="center"></el-table-column>
+        <el-table-column label="是否启用" width="120" align="center">
+          <template slot-scope="scope">
+            <el-tag :type="scope.row.isActive === 1 ? 'success' : 'danger'">
+              {{ scope.row.isActive === 1 ? '启用' : '未启用' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="250" align="center">
+          <template slot-scope="scope">
+            <el-button size="mini" @click="handleEdit(scope.row)">修改</el-button>
+            <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
+            <el-button
+                size="mini"
+                :type="scope.row.isActive === 1 ? 'warning' : 'success'"
+                @click="toggleisActive(scope.row)">
+              {{ scope.row.isActive === 1 ? '禁用' : '启用' }}
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <!-- 新增/编辑对话框 -->
+    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="500px">
+      <el-form :model="formData" :rules="formRules" ref="formRef" label-width="100px">
+        <el-form-item label="餐别名称" prop="name">
+          <el-input v-model="formData.name" placeholder="请输入餐别名称"></el-input>
+        </el-form-item>
+        <el-form-item label="是否启用">
+          <el-switch
+              v-model="formData.isActive"
+              :active-value=1
+              :inactive-value=0
+              active-text="启用"
+              inactive-text="禁用">
+          </el-switch>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </section>
+</template>
+
+<script>export default {
+  data() {
+    return {
+      tableData: [],
+      dialogVisible: false,
+      dialogTitle: '',
+      isEdit: false,
+      formData: {
+        id: null,
+        name: '',
+        isActive: 1
+      },
+      formRules: {
+        name: [
+          { required: true, message: '请输入餐别名称', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+
+  mounted() {
+    this.fetchData();
+  },
+
+  methods: {
+    // 获取数据
+    fetchData() {
+      this.http.post('/meal-types/getMeals', {},
+        res => {
+          if (res.code == "ok") {
+            this.tableData = res.data;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
+
+    // 新增按钮点击事件
+    handleAdd() {
+      this.dialogTitle = '新增餐别';
+      this.isEdit = false;
+      this.formData = { id: null, name: '', isActive: 1 };
+      this.dialogVisible = true;
+    },
+
+    // 编辑按钮点击事件
+    handleEdit(row) {
+      this.dialogTitle = '编辑餐别';
+      this.isEdit = true;
+      this.formData = { ...row };
+      this.dialogVisible = true;
+    },
+
+    // 删除按钮点击事件
+    handleDelete(row) {
+      this.$confirm(`确定要删除餐别"${row.name}"吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.http.post('/meal-types/deleteMealType', {
+          id: row.id,
+        }, res => {
+          if (res.code == "ok") {
+            this.$message({
+              message: '删除成功',
+              type: "success"
+            });
+            this.fetchData();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        }, error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+
+    // 切换启用状态
+    toggleisActive(row) {
+      const newisActive = row.isActive === 1 ? 0 : 1;
+      const action = newisActive === 1 ? '启用' : '禁用';
+
+      this.$confirm(`确定要${action}餐别"${row.name}"吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.http.post('/meal-types/updateMeal', {
+          id: row.id,
+          isActive: newisActive
+        }, res => {
+          if (res.code == "ok") {
+            row.isActive = newisActive;
+            this.$message({
+              type: 'success',
+              message: `${action}成功!`
+            });
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        }, error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: `已取消${action}`
+        });
+      });
+    },
+
+    // 提交表单
+    handleSubmit() {
+      this.$refs.formRef.validate((valid) => {
+        if (valid) {
+          if (this.isEdit) {
+            this.http.post('/meal-types/updateMeal', {
+                  id: this.formData.id,
+                  name: this.formData.name,
+                  isActive: this.formData.isActive
+                },
+              res => {
+                if (res.code == "ok") {
+                  this.$message({
+                    message: '编辑成功',
+                    type: "success"
+                  });
+                  this.dialogVisible = false;
+                  this.fetchData();
+                } else {
+                  this.$message({
+                    message: res.msg,
+                    type: "error"
+                  });
+                }
+              },
+              error => {
+                this.$message({
+                  message: error,
+                  type: "error"
+                });
+              }
+            );
+          } else {
+
+            this.http.post('/meal-types/addMealType', this.formData,
+              res => {
+                if (res.code == "ok") {
+                  this.$message({
+                    message: '新增成功',
+                    type: "success"
+                  });
+                  this.dialogVisible = false;
+                  this.fetchData();
+                } else {
+                  this.$message({
+                    message: res.msg,
+                    type: "error"
+                  });
+                }
+              },
+              error => {
+                this.$message({
+                  message: error,
+                  type: "error"
+                });
+              }
+            );
+          }
+          this.dialogVisible = false;
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style scoped>.toolbar {
+  background: #f5f5f5;
+  padding: 15px;
+  margin-bottom: 20px;
+}
+</style>