Browse Source

工时管家——消息提醒

ZhouRuiTing 5 years ago
parent
commit
9cf6325e67

+ 4 - 0
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -44,6 +44,10 @@ router.beforeEach((to, from, next) => {
         return;
         return;
     }
     }
 
 
+    if(to.path != '/daily') {
+        sessionStorage.removeItem("from")
+    }
+
     if (to.path == '/login') {
     if (to.path == '/login') {
         sessionStorage.removeItem('user');
         sessionStorage.removeItem('user');
     }
     }

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

@@ -14,6 +14,9 @@ export default {
         insert: '/user/insertUser',                             // 单独新增用户
         insert: '/user/insertUser',                             // 单独新增用户
         import: '/user/importUser',                             // 批量导入用户
         import: '/user/importUser',                             // 批量导入用户
         permission: '/user/switchPermission',                   // 切换权限
         permission: '/user/switchPermission',                   // 切换权限
+
+        msgList: '/information/list',                           // 消息列表
+        check: '/information/check',                            // 点击消息
     },
     },
 
 
     //时间
     //时间

+ 82 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/Home.vue

@@ -16,6 +16,21 @@
             </el-col>
             </el-col>
             <el-col :span="10" class="userinfo">
             <el-col :span="10" class="userinfo">
                 到期日期:{{remainingTime}}
                 到期日期:{{remainingTime}}
+                <el-badge class="itemNew" :value="popoverData.length" :hidden="popoverData.length == 0">
+                    <i class="el-icon-message-solid" style="font-size:24px" v-popover:popover1 @click="drawer = true"></i>
+                </el-badge>
+                <el-drawer title="消息中心" :visible.sync="drawer" direction="rtl" :with-header="false" size="30%">
+                    <el-table :data="popoverData" :height="tableHeight">
+                        <el-table-column property="type" label="消息中心" align="center">
+                            <template slot-scope="scope">
+                                <el-link type="primary" :underline="false" @click="locationHerf(scope.row.id,scope.row.content)">
+                                    {{scope.row.type==0?"审批未通过":"审批通过"}}
+                                </el-link>
+                            </template>
+                        </el-table-column>
+                        <el-table-column property="content" label="时间" align="center"></el-table-column>
+                    </el-table>
+                </el-drawer>                
                 <el-dropdown trigger="hover" style="margin-left:10px;">
                 <el-dropdown trigger="hover" style="margin-left:10px;">
                     <span class="el-dropdown-link userinfo-inner">
                     <span class="el-dropdown-link userinfo-inner">
                         <img src="../assets/image/userHead.png" />
                         <img src="../assets/image/userHead.png" />
@@ -156,6 +171,10 @@
 
 
                 timer: null,
                 timer: null,
                 remainingTime: '',
                 remainingTime: '',
+
+                drawer: false,
+                tableHeight: 0,
+                popoverData: [],
             };
             };
         },
         },
         methods: {
         methods: {
@@ -284,13 +303,74 @@
                 var m = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'm');
                 var m = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'm');
                 var s = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 's');
                 var s = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 's');
                 this.remainingTime = d+'天'+h+'时'+m+'分'+s+'秒';
                 this.remainingTime = d+'天'+h+'时'+m+'分'+s+'秒';
-            }
+            },
+
+            // 加载消息
+            loadNotice() {
+                this.http.post( this.port.manage.msgList, {},
+                res => {
+                    if (res.code == "ok") {
+                        this.popoverData = res.data;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            //点击消息的跳转
+            locationHerf(id, date) {
+                this.http.post( this.port.manage.check, { id: id },
+                res => {
+                    if (res.code == "ok") {
+                        this.loadNotice();
+                        sessionStorage.msg = date;
+                        sessionStorage.from = 1;
+                        //本页面再点的话强制转移一下
+                        var currentRoute = this.$route.path.split("/");
+                        if (currentRoute[1] == "daily") {
+                            this.$router.go(0);
+                            return false;
+                        }
+                        this.$router.push("/daily");
+                        this.drawer = true;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
         },
         },
         mounted() {
         mounted() {
+            let height = window.innerHeight;
+            this.tableHeight = height - 15;
+            const that = this;
+            window.onresize = function temp() {
+                that.tableHeight = window.innerHeight - 15;
+            };
+
             if (this.user) {
             if (this.user) {
                 var user = JSON.parse(this.user);
                 var user = JSON.parse(this.user);
                 this.user = user;
                 this.user = user;
                 this.sysUserName = user.name || "";
                 this.sysUserName = user.name || "";
+                this.loadNotice();
                 if(this.user.remainingTime != "" && this.user.remainingTime != 0) {
                 if(this.user.remainingTime != "" && this.user.remainingTime != 0) {
                     this.remainingTime = util.formatDate.format(new Date(new Date().getTime() + this.user.remainingTime), "yyyy-MM-dd")
                     this.remainingTime = util.formatDate.format(new Date(new Date().getTime() + this.user.remainingTime), "yyyy-MM-dd")
                 } else {
                 } else {
@@ -336,7 +416,7 @@
                 }
                 }
                 .itemNew {
                 .itemNew {
                     height: 25px;
                     height: 25px;
-                    margin-right: 25px;
+                    margin: 0 0 0 10px;
                     i {
                     i {
                         vertical-align: top;
                         vertical-align: top;
                     }
                     }

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

@@ -11,7 +11,7 @@
                     <el-link type="primary" :underline="false" v-if="user.role != 0" @click="exportReport">导出日报</el-link>
                     <el-link type="primary" :underline="false" v-if="user.role != 0" @click="exportReport">导出日报</el-link>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item style="float:right;">
                 <el-form-item style="float:right;">
-                    <el-link type="primary" :underline="false" @click="fillInReport">填写日报</el-link>
+                    <el-link type="primary" :underline="false" @click="fillInReport(-1)">填写日报</el-link>
                 </el-form-item>
                 </el-form-item>
             </el-form>
             </el-form>
         </el-col>
         </el-col>
@@ -35,11 +35,15 @@
                             </span>
                             </span>
                             <el-link v-if="user.role != 0" type="primary" :underline="false" @click="junpToDeskTop(item1.id)">系统智能统计:{{item1.calculateTime}}h</el-link>
                             <el-link v-if="user.role != 0" type="primary" :underline="false" @click="junpToDeskTop(item1.id)">系统智能统计:{{item1.calculateTime}}h</el-link>
                             <span v-else>系统智能统计:{{item1.calculateTime}}h</span>
                             <span v-else>系统智能统计:{{item1.calculateTime}}h</span>
+                            <span style="margin-left:15px;color:#DAA520;" v-if="item1.state == 0">[ 待审核 ]</span>
+                            <span style="margin-left:15px;color:#32CD32;" v-else-if="item1.state == 1">[ 已通过 ]</span>
+                            <span style="margin-left:15px;color:#FF0000;" v-else-if="item1.state == 2">[ 已驳回 ]</span>
                         </span>
                         </span>
                         <div class="checkbtn">
                         <div class="checkbtn">
                             <el-button v-if="user.role != 0 && item1.state == 0" type="primary" :loading="logining" size="small" @click="approve(item1.id)">通过</el-button>
                             <el-button v-if="user.role != 0 && item1.state == 0" type="primary" :loading="logining" size="small" @click="approve(item1.id)">通过</el-button>
                             <el-button v-if="user.role != 0 && item1.state == 0" type="danger" :loading="logining" size="small" @click="deny(item1.id,0)">驳回</el-button>
                             <el-button v-if="user.role != 0 && item1.state == 0" type="danger" :loading="logining" size="small" @click="deny(item1.id,0)">驳回</el-button>
                             <el-button v-if="user.role != 0 && item1.state == 1" type="danger" :loading="logining" size="small" @click="deny(item1.id,1)">撤销</el-button>
                             <el-button v-if="user.role != 0 && item1.state == 1" type="danger" :loading="logining" size="small" @click="deny(item1.id,1)">撤销</el-button>
+                            <el-button v-if="item1.state == 2 && user.id == item1.id" type="primary" size="small" @click="fillInReport(index1)">编辑日报</el-button>
                         </div>
                         </div>
                         <div class="one_daily_body">
                         <div class="one_daily_body">
                             <el-timeline>
                             <el-timeline>
@@ -54,7 +58,7 @@
                         </div>
                         </div>
                     </div>
                     </div>
                     <!-- 简陋的无报告提示 -->
                     <!-- 简陋的无报告提示 -->
-                    <span v-if="reportList.length==0">本日暂无报告</span>
+                    <div v-if="reportList.length==0" style="font-size:17px;text-align:center;margin-top:175px;color:#aaa;">本日暂无报告</div>
                 </div>
                 </div>
             </el-card>
             </el-card>
         </div>
         </div>
@@ -64,7 +68,7 @@
             <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
             <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
                 <el-form-item label="工作日期" prop="createDate">
                 <el-form-item label="工作日期" prop="createDate">
                     <el-date-picker v-model="workForm.createDate" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
                     <el-date-picker v-model="workForm.createDate" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
-                    @change="changeMonth()" :clearable="false" type="date" placeholder="选择工作日期"></el-date-picker>
+                    @change="changeMonth()" :clearable="false" type="date" placeholder="选择工作日期" :disabled="isDisable"></el-date-picker>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="待分配时长" prop="name">
                 <el-form-item label="待分配时长" prop="name">
                     <span>{{report.time}}h</span>
                     <span>{{report.time}}h</span>
@@ -114,7 +118,7 @@
                 user: JSON.parse(sessionStorage.getItem("user")),
                 user: JSON.parse(sessionStorage.getItem("user")),
 
 
                 allDate: [],
                 allDate: [],
-                date: util.formatDate.format(new Date(new Date()), "yyyy-MM"),
+                date: sessionStorage.msg?sessionStorage.msg.split('-')[0]+"-"+sessionStorage.msg.split('-')[1]:util.formatDate.format(new Date(new Date()), "yyyy-MM"),
                 choseDay: 0,
                 choseDay: 0,
 
 
                 tableHeight: 0,
                 tableHeight: 0,
@@ -126,7 +130,7 @@
                 dialogVisible: false, //项目弹窗
                 dialogVisible: false, //项目弹窗
                 report: '',
                 report: '',
                 workForm: {
                 workForm: {
-                    createDate: util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
+                    createDate: sessionStorage.msg?sessionStorage.msg:util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
                     domains: [{
                     domains: [{
                         id: null,
                         id: null,
                         projectId: "",
                         projectId: "",
@@ -140,6 +144,7 @@
                 },
                 },
 
 
                 logining: false,
                 logining: false,
+                isDisable: false,
             };
             };
         },
         },
         methods: {
         methods: {
@@ -152,6 +157,8 @@
             // 选择日期
             // 选择日期
             choseDate(i) {
             choseDate(i) {
                 this.choseDay = i;
                 this.choseDay = i;
+                let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
+                sessionStorage.msg = this.date + day,
                 this.getReportList();
                 this.getReportList();
             },
             },
 
 
@@ -163,8 +170,14 @@
                     var str = new Date(this.date.replace(/-/g, "/")).getMonth() + 1 + "月" + k + "日";
                     var str = new Date(this.date.replace(/-/g, "/")).getMonth() + 1 + "月" + k + "日";
                     if ( new Date(this.date.replace(/-/g, "/")).getFullYear() == new Date(new Date()).getFullYear() &&
                     if ( new Date(this.date.replace(/-/g, "/")).getFullYear() == new Date(new Date()).getFullYear() &&
                     new Date(this.date.replace(/-/g, "/")).getMonth() == new Date(new Date()).getMonth()) {
                     new Date(this.date.replace(/-/g, "/")).getMonth() == new Date(new Date()).getMonth()) {
-                        if (new Date().getDate() == k) {
-                            this.choseDay = k - 1;
+                        if(sessionStorage.msg) {
+                            if(parseInt(sessionStorage.msg.split("-")[2]) == k) {
+                                this.choseDay = k - 1;
+                            }
+                        } else {
+                            if (new Date().getDate() == k) {
+                                this.choseDay = k - 1;
+                            }   
                         }
                         }
                     } else {
                     } else {
                         this.choseDay = 0;
                         this.choseDay = 0;
@@ -267,7 +280,7 @@
             },
             },
 
 
             // 获取个人某天的日报
             // 获取个人某天的日报
-            getReport() {
+            getReport(i) {
                 this.http.post( this.port.report.getPort, {
                 this.http.post( this.port.report.getPort, {
                     date: this.workForm.createDate
                     date: this.workForm.createDate
                 },
                 },
@@ -302,7 +315,6 @@
                                 }],
                                 }],
                             }
                             }
                         }
                         }
-                        console.log(this.workForm)
                     } else {
                     } else {
                         this.$message({
                         this.$message({
                             message: res.msg,
                             message: res.msg,
@@ -319,8 +331,16 @@
             },
             },
 
 
             // 打开日报填写
             // 打开日报填写
-            fillInReport() {
-                this.getReport();
+            fillInReport(i) {
+                if(i == -1) {
+                    this.isDisable = false;
+                    this.workForm.createDate = util.formatDate.format(new Date(new Date()), "yyyy-MM-dd");
+                } else {
+                    this.isDisable = true;
+                    let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
+                    this.workForm.createDate = this.date + day;
+                }
+                this.getReport(i);
                 this.dialogVisible = true;
                 this.dialogVisible = true;
             },
             },