소스 검색

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

wutt 5 년 전
부모
커밋
16339a1d8d
24개의 변경된 파일334개의 추가작업 그리고 139개의 파일을 삭제
  1. 11 1
      fhKeeper/formulahousekeeper/management-platform/pom.xml
  2. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeCalculationController.java
  3. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  4. 21 13
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
  5. 12 4
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java
  6. 11 11
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  7. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/application.yml
  8. 2 2
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeCalculationMapper.xml
  9. 6 5
      fhKeeper/formulahousekeeper/mywork/home.cpp
  10. 3 3
      fhKeeper/formulahousekeeper/mywork/httpapi.h
  11. 12 3
      fhKeeper/formulahousekeeper/mywork/mainwindow.cpp
  12. 3 3
      fhKeeper/formulahousekeeper/mywork/mainwindow.ui
  13. 7 0
      fhKeeper/formulahousekeeper/timesheet/build/webpack.base.conf.js
  14. 1 1
      fhKeeper/formulahousekeeper/timesheet/config/index.js
  15. 13 1
      fhKeeper/formulahousekeeper/timesheet/index.html
  16. 21 65
      fhKeeper/formulahousekeeper/timesheet/src/main.js
  17. 1 0
      fhKeeper/formulahousekeeper/timesheet/src/port.js
  18. 7 0
      fhKeeper/formulahousekeeper/timesheet/src/routes.js
  19. 1 1
      fhKeeper/formulahousekeeper/timesheet/src/views/Home.vue
  20. 13 1
      fhKeeper/formulahousekeeper/timesheet/src/views/Login.vue
  21. 132 0
      fhKeeper/formulahousekeeper/timesheet/src/views/Register.vue
  22. 47 15
      fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue
  23. 1 1
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue
  24. 5 6
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/statistics.vue

+ 11 - 1
fhKeeper/formulahousekeeper/management-platform/pom.xml

@@ -114,5 +114,15 @@
         </dependency>
     </dependencies>
 
-
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeCalculationController.java

@@ -42,7 +42,7 @@ public class TimeCalculationController {
      * pageIndex 分页页码
      * pageSize 分页大小
      * userId 筛选用户id 可传
-     * actionCode 筛选行为种类 可传 不传时排除0
+     * actionCode 筛选行为种类 可传 不传时默认6、7、8
      * date 筛选日期 可传
      */
     @RequestMapping("/getDevianceList")

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.sql.Timestamp;
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -170,7 +171,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     .eq("action_type", 0))) {
                 totalWorkingTime += timeCalculation.getDuration();
             }
-            resultMap.put("time", totalWorkingTime);
+            resultMap.put("time", new DecimalFormat("#.00").format(totalWorkingTime / 3600));
             resultMap.put("project", projectMapper.selectList(new QueryWrapper<Project>()
                     .eq("company_id", userMapper.selectById(userId).getCompanyId())));
             httpRespMsg.data = resultMap;

+ 21 - 13
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java

@@ -122,7 +122,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
 
     @Override
     public HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo) {
-        System.out.println("uid==="+screenshotvo.getUid());
+        System.out.println("uid===" + screenshotvo.getUid());
         String filePath = UploadFileToFileNameUtil.uploadFile(screenshotvo.getFile(), path);
         Screenshot screenshot = new Screenshot();
         BeanUtils.copyProperties(screenshotvo, screenshot);
@@ -442,6 +442,10 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
     //每次获取到截屏后计算并处理
     private void calculateTime(Screenshot screenshot) {
         try {
+            //如果图片类型为空 则认为是0-编程
+            if(screenshot.getPicType() == null){
+                screenshot.setPicType(0);
+            }
             //默认状态为不连续 如果下面判断是连续才会修改为true
             Boolean isConsecutive = false;
             //获取本人当天结束时间为准的最后一条记录
@@ -453,15 +457,18 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
             //单独记录当前的时间以便使用
             LocalTime currentTime = screenshot.getIndate().toLocalTime();
             if (latestRecord != null) {
-                //如果有记录的话 准备计算上次结束和新的开始的时间差
-                LocalTime estimatedTime = latestRecord.getEndTime();
-                Integer durationSecond = ((currentTime.getHour() - estimatedTime.getHour()) * 3600
-                        + (currentTime.getMinute() - estimatedTime.getMinute()) * 60
-                        + (currentTime.getSecond() - estimatedTime.getSecond()));
-                //如果断层不大于600秒的话
-                if (durationSecond <= DETECTION_INTERVAL) {
-                    //确认连续 将状态改为连续
-                    isConsecutive = true;
+                //首先对比类型
+                if (latestRecord.getActionType().equals(screenshot.getPicType())) {
+                    //如果有记录的话 准备计算上次结束和新的开始的时间差
+                    LocalTime estimatedTime = latestRecord.getEndTime();
+                    Integer durationSecond = ((currentTime.getHour() - estimatedTime.getHour()) * 3600
+                            + (currentTime.getMinute() - estimatedTime.getMinute()) * 60
+                            + (currentTime.getSecond() - estimatedTime.getSecond()));
+                    //断层不大于600秒的话
+                    if (durationSecond <= DETECTION_INTERVAL) {
+                        //确认连续 将状态改为连续
+                        isConsecutive = true;
+                    }
                 }
             }
             if (isConsecutive) {
@@ -479,8 +486,8 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
                 TimeCalculation timeCalculation = new TimeCalculation();
                 timeCalculation
                         .setUserId(screenshot.getUid())
-                        //根据截图种类设置行为代号 如果为空则默认为正常 即0
-                        .setActionType(screenshot.getPicType() != null ? screenshot.getPicType() : 0)
+                        //根据截图种类设置行为代号
+                        .setActionType(screenshot.getPicType())
                         .setDate(screenshot.getIndate().toLocalDate())
                         //设置开始时间和结束时间都为当前时间
                         .setStartTime(currentTime)
@@ -529,12 +536,13 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
 
     /**
      * 判断是否是看文档, 具体类型为word, excel, pdf, ppt
+     *
      * @param textContents
      * @return
      */
     public static boolean isDocument(List<String> textContents) {
         boolean find = false;
-        for (int i=0;i<textContents.size() && i <= 2; i++) {//出现在前三行
+        for (int i = 0; i < textContents.size() && i <= 2; i++) {//出现在前三行
             String text = textContents.get(i);
             if (text.endsWith("Word")
                     || text.endsWith("Excel")

+ 12 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java

@@ -65,7 +65,7 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
         try {
             Map<String, Object> resultMap = new HashMap<>();
             Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
-            //注意这里目前把代码为0以外的行为全部计作异常 后续可能需要修改
+            //actionCode为null时筛选6、7、8
             resultMap.put("records", timeCalculationMapper
                     .getDevianceList(new Page<>(pageIndex, pageSize), userId, actionCode, date, companyId));
             //返回总数
@@ -93,13 +93,21 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
                 map.put("phone", userMap.get("phone"));
                 //然后根据日期和用户id获取到所有的记录 然后手动累加在一起
                 Long[] timeArray = {0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
-                String[] stringArray = new String[9];
+                //编程 资料 文档 设计 美工 运营 小说 游戏 音乐
                 for (Map<String, Object> dataMap : timeCalculationMapper
                         .getTodayStatistics((String) userMap.get("id"), date, companyId)) {
                     timeArray[(int) dataMap.get("type")] += (Long) dataMap.get("duration");
                 }
-                for (int i = 0; i < 9; i++) {
-                    stringArray[i] = convertSecond(timeArray[i]);
+                Long[] resultArray = new Long[5];
+                //编程 浏览 设计 办公 娱乐
+                resultArray[0] = timeArray[0];
+                resultArray[1] = timeArray[1] + timeArray[2];
+                resultArray[2] = timeArray[3] + timeArray[4];
+                resultArray[3] = timeArray[5];
+                resultArray[4] = timeArray[6] + timeArray[7] + timeArray[8];
+                String[] stringArray = new String[5];
+                for (int i = 0; i < 5; i++) {
+                    stringArray[i] = convertSecond(resultArray[i]);
                 }
                 map.put("statistics", stringArray);
                 //最后是数组的和

+ 11 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -43,7 +43,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Resource
     private CompanyMapper companyMapper;
 
-    //管理员登录网页端
+    //登录网页端 管理员或负责人可以登录
     @Override
     public HttpRespMsg loginAdmin(String username, String password) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
@@ -56,12 +56,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             //检索到两个及以上账号时
             httpRespMsg.setError("账号重名");
         } else if (userList.get(0).getRole() == 0) {
-            //检索的账号role不是1 即不是管理员
-            httpRespMsg.setError("非管理员不能登陆系统");
+            //检索的账号role是0 即是普通员工
+            httpRespMsg.setError("无登录权限");
         } else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
             //检测密码正确时
             UserVO userVO = new UserVO();
-            System.out.println("userList.get(0):" + userList.get(0));
             BeanUtils.copyProperties(userList.get(0), userVO);
             userVO.setCompanyName(companyMapper.selectById(userVO.getCompanyId()).getCompanyName());
             httpRespMsg.data = userVO;
@@ -71,7 +70,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         return httpRespMsg;
     }
 
-    //员工登录网页端
+    //登录网页端 所有人都可以登录
     @Override
     public HttpRespMsg loginEmployee(String username, String password) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
@@ -83,9 +82,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         } else if (userList.size() > 1) {
             //检索到两个及以上账号时
             httpRespMsg.setError("账号重名");
-        } else if (userList.get(0).getRole() != 0) {
-            //检索的账号role不是0 即不是普通用户时
-            httpRespMsg.setError("管理员无法登陆本端");
         } else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
             //检测密码正确时
             httpRespMsg.data = userList.get(0);
@@ -99,7 +95,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Override
     public HttpRespMsg getUserInfo(String id) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg.data = userMapper.selectById(id);
+        User user = userMapper.selectById(id);
+        if (user == null) {
+            httpRespMsg.setError("未查询到用户信息");
+        } else {
+            httpRespMsg.data = user;
+        }
+
         return httpRespMsg;
     }
 
@@ -111,8 +113,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             User requester = userMapper.selectById(request.getHeader("Token"));
             //获取本公司除负责人以外全部的信息
             httpRespMsg.data = userMapper.selectList(new QueryWrapper<User>()
-                    .ne("role", 1)
-                    .ne("id", requester.getId())
                     .eq("company_id", requester.getCompanyId()));
         } catch (NullPointerException e) {
             httpRespMsg.setError("验证失败");

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application.yml

@@ -14,7 +14,7 @@ spring:
       location: C:/upload/
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://118.190.47.230:3306/man2?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    url: jdbc:mysql://118.190.47.230:3306/man_hour_manager?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     username: root
     password: p011430seya1026
     hikari:

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeCalculationMapper.xml

@@ -34,7 +34,7 @@
             AND a.action_type = #{actionCode}
         </if>
         <if test="actionCode == null">
-            AND a.action_type != 0
+            AND a.action_type IN (6,7,8)
         </if>
         <if test="date != null and date != ''">
             AND a.date = #{date}
@@ -57,7 +57,7 @@
             AND a.action_type = #{actionCode}
         </if>
         <if test="actionCode == null">
-            AND a.action_type != 0
+            AND a.action_type IN (6,7,8)
         </if>
         <if test="date != null and date != ''">
             AND a.date = #{date}

+ 6 - 5
fhKeeper/formulahousekeeper/mywork/home.cpp

@@ -1,4 +1,4 @@
-#include "home.h"
+#include "home.h"
 #include "ui_home.h"
 #include <QDateTime>
 #include <QMessageBox>
@@ -20,7 +20,7 @@
 #include <windows.h>
 #include <tlhelp32.h>
 #include <stdio.h>
-
+#pragma execution_character_set("utf-8")
 Home::Home(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::Home)
@@ -31,7 +31,7 @@ Home::Home(QWidget *parent) :
     connect(myTimer,&QTimer::timeout,[this](){
             captureScreen();
     });
-    myTimer->start(60000);
+    myTimer->start(10000);
 
     //set ui data
     webWidget = new QWebEngineView(this);
@@ -237,13 +237,14 @@ void Home::loadNavigate(QString sUrl)
 }
 Home::~Home()
 {
+    delete webWidget;
     delete ui;
 }
 void Home::closeEvent ( QCloseEvent * e )
 {
     if( QMessageBox::question(this,
-                             tr("Quit"),
-                             tr("Are you sure to quit this application?"),
+                             tr("退出"),
+                             tr("您确定要退出吗?"),
                               QMessageBox::Yes, QMessageBox::No )
                    == QMessageBox::Yes){
         e->accept();//不会将事件传递给组件的父组件

+ 3 - 3
fhKeeper/formulahousekeeper/mywork/httpapi.h

@@ -1,4 +1,4 @@
-#ifndef HTTPAPI
+#ifndef HTTPAPI
 #define HTTPAPI
 
 #include <functional>
@@ -6,8 +6,8 @@
 #include <QPair>
 #include <QJsonObject>
 #include "baseapi.h"
-const QString SERVER_URL = QString("http://127.0.0.1:10010");
-//const QString SERVER_URL = QString("http://118.190.47.230:10010");
+//const QString SERVER_URL = QString("http://127.0.0.1:10010");
+const QString SERVER_URL = QString("http://118.190.47.230:10010");
 class HttpAPI: public BaseAPI
 {
 public:

+ 12 - 3
fhKeeper/formulahousekeeper/mywork/mainwindow.cpp

@@ -1,4 +1,4 @@
-#include "mainwindow.h"
+#include "mainwindow.h"
 #include "ui_mainwindow.h"
 #include "home.h"
 
@@ -8,7 +8,7 @@
 #include <QEventLoop>
 #include <QMessageBox>
 #include "httpapi.h"
-
+#pragma execution_character_set("utf-8")
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindow)
@@ -17,7 +17,15 @@ MainWindow::MainWindow(QWidget *parent)
     ui->setupUi(this);
     connect(ui->loginBtn,SIGNAL(clicked()),this,SLOT(login_in()));
 //    connect(ui->loginBtn, &QAction::triggered, this, &MainWindow::login_in);
-
+    // 设置窗体标题
+    setWindowTitle(tr("智能工时管家"));
+    //设置账号密码
+    m_setting->beginGroup("user");
+    if (m_setting->contains("phone")) {
+        ui->account->setText(m_setting->value("phone").toString());
+        ui->pwd->setText(m_setting->value("pwd").toString());
+    }
+    m_setting->endGroup();
 }
 void MainWindow::login_in(void){//登陆
     //设置url
@@ -38,6 +46,7 @@ void MainWindow::login_in(void){//登陆
                 m_setting->setValue("id", obj.value("id"));
                 m_setting->setValue("name", obj.value("name"));
                 m_setting->setValue("phone", obj.value("phone"));
+                m_setting->setValue("pwd", pwd);
                 m_setting->endGroup();
                 //enter home page
                 home = new Home();

+ 3 - 3
fhKeeper/formulahousekeeper/mywork/mainwindow.ui

@@ -30,14 +30,14 @@
    <widget class="QLabel" name="label">
     <property name="geometry">
      <rect>
-      <x>320</x>
-      <y>100</y>
+      <x>310</x>
+      <y>110</y>
       <width>151</width>
       <height>61</height>
      </rect>
     </property>
     <property name="text">
-     <string>欢迎使用工时管家软件</string>
+     <string>欢迎使用智能工时管家</string>
     </property>
    </widget>
    <widget class="QLineEdit" name="account">

+ 7 - 0
fhKeeper/formulahousekeeper/timesheet/build/webpack.base.conf.js

@@ -13,6 +13,13 @@ module.exports = {
         //app: './src/main.js'
         app: ["babel-polyfill", "./src/main.js"]
     },
+    externals: {
+        'vue': 'Vue',
+        'vue-router': 'VueRouter',
+        'vuex': 'Vuex',
+        'element-ui': 'ElementUI',
+        'echarts': 'echarts',
+    },
     output: {
         path: config.build.assetsRoot,
         filename: '[name].js',

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/config/index.js

@@ -17,7 +17,7 @@ module.exports = {
     assetsRoot: path.resolve(__dirname, '../dist'),
     assetsSubDirectory: 'static',
     assetsPublicPath: './',
-    productionSourceMap: true,
+    productionSourceMap: false,
     productionGzip: false,
     productionGzipExtensions: ['js', 'css'],
     bundleAnalyzerReport: process.env.npm_config_report

+ 13 - 1
fhKeeper/formulahousekeeper/timesheet/index.html

@@ -4,7 +4,9 @@
         <meta charset="utf-8">
         <title>工时管家</title>
         <link rel="shortcut icon" type="image/x-icon" href="./favicon.ico"/>
-        <link href="./static/css/public.css" rel="stylesheet" type="text/css"/> 
+        <link href="./static/css/public.css" rel="stylesheet" type="text/css"/>
+        <!-- 引入样式 -->
+        <link href="https://cdn.staticfile.org/element-ui/2.13.0/theme-chalk/index.css" rel="stylesheet">
         <style>
             /* 滚动条样式修改 */
             /*滚动条凹槽的颜色,还可以设置边框属性 */
@@ -44,5 +46,15 @@
     </head>
     <body>
         <div id="app"></div>
+        <!-- 引入Vue.js -->
+        <script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>
+        <!-- 引入vuex.js -->
+        <script src="https://cdn.staticfile.org/vuex/3.0.0/vuex.min.js"></script>
+        <!-- 引入vue-router -->
+        <script src="https://cdn.staticfile.org/vue-router/3.0.0/vue-router.min.js"></script>
+        <!-- 引入组件库 -->
+        <script src="https://cdn.staticfile.org/element-ui/2.13.0/index.js"></script>
+        <!-- 引入echarts -->
+        <script src="https://cdn.staticfile.org/echarts/3.8.5/echarts.min.js"></script>
     </body>
 </html>

+ 21 - 65
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -1,21 +1,20 @@
-import Vue from 'vue'
+// import Vue from 'vue'
 import App from './App'
 import store from './vuex/store'
 import routes from './routes'
 
-import VueRouter from 'vue-router'
-Vue.use(VueRouter)
+// import VueRouter from 'vue-router'
+// Vue.use(VueRouter)
 
-import ElementUI from 'element-ui'
+// import ElementUI from 'element-ui'
+// Vue.use(ElementUI)
 
-Vue.use(ElementUI)
-
-import Vuex from 'vuex'
-Vue.use(Vuex)
+// import Vuex from 'vuex'
+// Vue.use(Vuex)
 
 import http from './http'
 import port from './port'
-import echarts from 'echarts'
+// import echarts from 'echarts'
 import $ from 'jquery'
 
 Vue.prototype.http = http
@@ -25,7 +24,7 @@ Vue.prototype.echarts = echarts
 import VueClipboard from 'vue-clipboard2'
 Vue.use(VueClipboard)
 
-import 'element-ui/lib/theme-chalk/index.css'
+// import 'element-ui/lib/theme-chalk/index.css'
 import 'font-awesome/css/font-awesome.min.css'
 import './assets/iconfont/iconfont.css'
 
@@ -38,61 +37,18 @@ import 'nprogress/nprogress.css'
 
 router.beforeEach((to, from, next) => {
     NProgress.start();
-    if(to.name != '邀请') {
-        if (to.path == '/login') {
-            sessionStorage.removeItem('user');
-        }
-    
-        let user = JSON.parse(sessionStorage.getItem('user'));
-        if (!user && to.path != '/login') {
-            next({ path: '/login' })
-        } else {
-            if(user){
-                for(var i in routes){
-                    if(routes[i].name == "基础管理" && user.parentId != 0){
-                        routes[i].hidden = true
-                    } else if(routes[i].name == "基础管理"){
-                        routes[i].hidden = false
-                    }
-                    
-                    if(routes[i].name == "项目管理" && user.parentId > 1){
-                        var children = routes[i].children;
-                        for(var j in children){
-    
-                            if(children[j].name == "人员管理"){
-                                if(user.isManager == 0){
-                                    children[j].hidden = true
-                                } else {
-                                    children[j].hidden = false
-                                }
-                            }
-    
-                            if(children[j].name == "权限管理"){
-                                if(user.isManager == 0){
-                                    children[j].hidden = true
-                                } else {
-                                    children[j].hidden = false
-                                }
-                            }
-                        }
-                    } else if(routes[i].name == "项目管理") {
-                        var children = routes[i].children;
-                        for(var j in children){
-                            if(children[j].name != "项目详情"){
-                                children[j].hidden = false
-                            }
-                            
-                            if(children[j].name == "权限管理"){
-                                if((user.parentId == 0 || user.parentId == 1) && user.isManager == 0){
-                                    children[j].hidden = true
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            next()
-        }
+    if (to.path == '/register') {
+        next();
+        return;
+    }
+
+    if (to.path == '/login') {
+        sessionStorage.removeItem('user');
+    }
+
+    let user = JSON.parse(sessionStorage.getItem('user'));
+    if (!user && to.path != '/login') {
+        next({ path: '/login' })
     } else {
         next()
     }

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet/src/port.js

@@ -1,6 +1,7 @@
 export default {
     manage: {
         login: '/user/loginAdmin', // 登录
+        register: '/user/insertCompany', //注册
         list: '/user/getEmployeeList', //获取员工列表
         delete: '/user/deleteUser', //删除用户
         insert: '/user/insertUser', //单独新增用户

+ 7 - 0
fhKeeper/formulahousekeeper/timesheet/src/routes.js

@@ -1,4 +1,5 @@
 import Login from './views/Login.vue'
+import Register from './views/Register.vue'
 import NotFound from './views/404.vue'
 import Home from './views/Home.vue'
 
@@ -25,6 +26,12 @@ let routes = [
         name: '',
         hidden: true
     },
+    {
+        path: '/register',
+        component: Register,
+        name: '',
+        hidden: true
+    },
     //今日桌面
     {
         path: '/',

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/Home.vue

@@ -21,7 +21,7 @@
                     </span>
                     <el-dropdown-menu slot="dropdown">
                         <el-dropdown-item @click.native="reset">修改密码</el-dropdown-item>
-                        <el-dropdown-item @click.native="editInfoOpen">修改信息</el-dropdown-item>
+                        <!-- <el-dropdown-item @click.native="editInfoOpen">修改信息</el-dropdown-item> -->
                         <el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item>
                     </el-dropdown-menu>
                 </el-dropdown>

+ 13 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/Login.vue

@@ -15,6 +15,9 @@
                 <el-form-item class="login-button" style="width:100%;">
                     <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit" :loading="logining">登录</el-button>
                 </el-form-item>
+                <div class="toRegister">
+                    <el-link type="primary" @click="jumpTo">立即注册</el-link>
+                </div>
             </el-form>
         </div>
     </div>
@@ -41,6 +44,10 @@
                 this.$refs.ruleForm.resetFields();
             },
 
+            jumpTo() {
+                this.$router.push({ path: '/register' });
+            },
+
             handleSubmit(ev) {
                 this.$refs.ruleForm.validate((valid) => {
                     if (valid) {
@@ -92,7 +99,7 @@
                 -moz-border-radius: 5px;
                 background-clip: padding-box;
                 width: 315px;
-                height: 365px;
+                height: 380px;
                 padding: 25px 35px 25px 35px;
                 background: #fff;
                 border: 1px solid #eaeaea;
@@ -120,4 +127,9 @@
             }
         }
     }
+
+    .toRegister {
+        margin: 15px 0;
+        text-align: right;
+    }
 </style>

+ 132 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/Register.vue

@@ -0,0 +1,132 @@
+<template>
+    <div class="login">
+        <div class="login-par">
+            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" label-width="0px" class="demo-ruleForm login-container">
+                <!-- <div class="login-logo">
+                    <img src="../assets/image/login_logo.png" style="width:80px;height:80px;"/>
+                </div> -->
+                <h3 class="title">注册</h3>
+                <el-form-item class="login-input" prop="companyName">
+                    <el-input type="text" v-model="ruleForm.companyName" autocomplete="off" placeholder="公司名" clearable prefix-icon="el-icon-s-home"></el-input>
+                </el-form-item>
+                <el-form-item class="login-input" prop="name">
+                    <el-input type="text" v-model="ruleForm.name" autocomplete="off" placeholder="姓名" clearable prefix-icon="el-icon-user-solid"></el-input>
+                </el-form-item>
+                <el-form-item class="login-input" prop="phone">
+                    <el-input type="text" v-model="ruleForm.phone" autocomplete="off" placeholder="手机号" clearable prefix-icon="el-icon-mobile-phone"></el-input>
+                </el-form-item>
+                <div style="color:#aaa;margin:15px 0 20px 0;">初始密码:000000</div>
+                <div class="login-button" style="width:100%;margin-top:0;">
+                    <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit" :loading="logining">注册</el-button>
+                </div>
+            </el-form>
+        </div>
+    </div>
+</template>
+
+<script>
+    export default {
+        data() {
+            return {
+                logining: false,
+                // 登录信息
+                ruleForm: {
+                    companyName: '',
+                    name: '',
+                    phone: ''
+                },
+                rules: {
+                    companyName: [{ required: true, message: '请输入公司名', trigger: 'blur' },],
+                    name: [{ required: true, message: '请输入姓名', trigger: 'blur' },],
+                    phone: [{ required: true, message: '请输入手机号', trigger: 'blur' },]
+                }
+            };
+        },
+        methods: {
+            handleReset2() {
+                this.$refs.ruleForm.resetFields();
+            },
+
+            handleSubmit(ev) {
+                this.$refs.ruleForm.validate((valid) => {
+                    if (valid) {
+                        var _this = this;
+                        this.logining = true;
+                        this.http.post(this.port.manage.register, this.ruleForm , res => {
+                            this.logining = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                    message: '注册成功',
+                                    type: 'success'
+                                });
+                                this.$router.push({ path: '/login' });
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: 'error'
+                                });
+                            }
+                        }, error => {
+                            this.logining = false;
+                            this.$message({
+                                message: error,
+                                type: 'error'
+                            });
+                        })
+                    }
+                });
+            }
+        }
+    }
+</script>
+
+<style lang="scss" scoped>
+    .login {
+        height: 100%;
+        .login-par {
+            width: 100%;
+            min-height: 100%;
+            background: #f0f2f5 url('../assets/image/background.png') no-repeat 50%;
+            background-size: 100%;
+            padding: 110px 0 144px;
+            position: relative;
+            box-sizing: border-box;
+            .login-logo {
+                text-align: center;
+                margin: 0 0 20px 0;
+            }
+            .login-container {
+                -webkit-border-radius: 5px;
+                border-radius: 5px;
+                -moz-border-radius: 5px;
+                background-clip: padding-box;
+                width: 450px;
+                height: 365px;
+                padding: 25px 35px 25px 35px;
+                background: #fff;
+                border: 1px solid #eaeaea;
+                box-shadow: 0 0 5px #cac6c6;
+                border-top: 10px solid #20a0ff;
+                margin:auto;
+                .title {
+                    font-size: 20px;
+                    margin: 0px auto 40px auto;
+                    text-align: center;
+                    color: #505458;
+                }
+                .remember {
+                    margin: 0px 0px 35px 0px;
+                }
+                .login-input {
+                    margin: 30px 0 0 0;
+                }
+                .login-button {
+                    margin: 30px 0 0 0;
+                }
+                .login-button .el-button {
+                    padding: 14px;
+                }
+            }
+        }
+    }
+</style>

+ 47 - 15
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -3,8 +3,14 @@
     <!--工具条-->
     <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
       <el-form :inline="true">
+        <el-form-item>
+            <div class="nowTime">
+                <i class="el-icon-s-home"></i>
+                {{user.companyName}}
+            </div>
+        </el-form-item>
         <el-form-item style="float:right;">
-          <el-link type="primary" :underline="false" @click="openInsertDialog">添加人员</el-link>
+          <el-link type="primary" :underline="false" @click="openInsertDialog(null)">添加人员</el-link>
         </el-form-item>
         <el-form-item style="float:right;">
           <el-upload
@@ -37,7 +43,7 @@
           scope.row.role == 1 ? "负责人" : "管理员"}}
         </template>
       </el-table-column>
-      <el-table-column label="操作">
+      <el-table-column label="操作" width="280">
         <template slot-scope="scope">
           <el-button
             size="small"
@@ -49,6 +55,7 @@
             v-if="scope.row.role == 2 && user.role == 1"
             @click="switchRole(scope.$index)"
           >切换为员工</el-button>
+          <el-button size="small" type="primary" @click="openInsertDialog(scope.$index)">编辑</el-button>
           <el-button size="small" type="danger" @click="deleteUser(scope.$index)">删除</el-button>
         </template>
       </el-table-column>
@@ -105,6 +112,7 @@ export default {
       list: [],
       dialogVisible: false,
       insertForm: {
+        id:null,
         name: null,
         phone: null,
         role: null
@@ -160,16 +168,24 @@ export default {
       this.$refs.form1.validate(valid => {
         if (valid) {
           this.listLoading = true;
-          this.http.post(
-            this.port.manage.insert,
-            {
+          var form = {
               name: this.insertForm.name,
               phone: this.insertForm.phone,
               role: this.insertForm.role
-            },
+            };
+            if(this.insertForm.id != null) {
+                form.id = this.insertForm.id;
+            }
+          this.http.post(
+            this.port.manage.insert,
+            form,
             res => {
               this.listLoading = false;
               if (res.code == "ok") {
+                this.$message({
+                  message: this.insertForm.id!=null?'修改':'创建'+"成功",
+                  type: "success"
+                });
                 this.dialogVisible = false;
                 //重新读取列表
                 this.getUser();
@@ -213,6 +229,10 @@ export default {
             this.$refs.upload.clearFiles();
             this.listLoading = false;
             if (res.code == "ok") {
+                this.$message({
+                  message: "导入成功",
+                  type: "success"
+                });
               //重新读取列表
               this.getUser();
             } else {
@@ -311,11 +331,23 @@ export default {
     },
 
     //打开单独新增的Dialog
-    openInsertDialog() {
-      this.insertForm.name = null;
-      this.insertForm.phone = null;
-      this.insertForm.role = null;
-      this.dialogVisible = true;
+    openInsertDialog(i) {
+        if(i != null) {
+            this.insertForm = {
+                id: this.list[i].id,
+                name: this.list[i].name,
+                phone: this.list[i].phone,
+                role: this.list[i].role
+            };
+        } else {
+            this.insertForm = {
+                id: null,
+                name: null,
+                phone: null,
+                role: null
+            };
+        }
+        this.dialogVisible = true;
     }
   },
 
@@ -335,10 +367,10 @@ export default {
 
 <style lang="scss" scoped>
 .nowTime {
-  height: 35px;
-  line-height: 28px;
-  font-size: 18px;
-  color: #333;
+  height: 40px;
+  line-height: 40px;
+  font-size: 16px;
+  color: #20a0ff;
   margin-left: 10px;
   i {
     margin-right: 10px;

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -87,7 +87,7 @@
         <el-button v-else class="button-new-tag" size="small" @click="showInput">新增项目</el-button>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="dialogVisible = false">关闭</el-button>
+        <el-button @click="projectDialogVisible = false">关闭</el-button>
       </span>
     </el-dialog>
   </section>

+ 5 - 6
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/statistics.vue

@@ -32,12 +32,11 @@
       <el-table-column type="index" width="60"></el-table-column>
       <el-table-column prop="name" label="姓名" width="140" sortable></el-table-column>
       <el-table-column prop="phone" label="手机" width="180"></el-table-column>
-      <!-- 这里数胡乱写进去的 后续需要重新约定数字代表的意义 -->
-      <el-table-column prop="statistics[0]" label="编程"></el-table-column>
-      <el-table-column prop="statistics[1]" label="设计" sortable></el-table-column>
-      <el-table-column prop="statistics[2]" label="办公" sortable></el-table-column>
-      <el-table-column prop="statistics[3]" label="娱乐" sortable></el-table-column>
-      <el-table-column prop="statistics[4]" label="浏览" sortable></el-table-column>
+      <el-table-column prop="statistics[0]" label="编程" sortable></el-table-column>
+      <el-table-column prop="statistics[1]" label="浏览" sortable></el-table-column>
+      <el-table-column prop="statistics[2]" label="设计" sortable></el-table-column>
+      <el-table-column prop="statistics[3]" label="办公" sortable></el-table-column>
+      <el-table-column prop="statistics[4]" label="娱乐" sortable></el-table-column>
       <el-table-column prop="sum" label="总时长" width="180" sortable></el-table-column>
     </el-table>