Ver Fonte

注册、人员信息修改等

sunyadv há 5 anos atrás
pai
commit
8eab1a1092

+ 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>

+ 46 - 14
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -3,6 +3,12 @@
     <!--工具条-->
     <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-form-item>
@@ -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>