Selaa lähdekoodia

工时管家——新增领导报告审核

ZhouRuiTing 5 vuotta sitten
vanhempi
commit
8970d3760a

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

@@ -52,7 +52,8 @@ export default {
         export: '/report/exportReport',                         // 导出报告
         getPort: '/report/getReport',                           // 获取当天自己报告
         editPort: '/report/editReport',                         // 编辑报告
-
+        
+        portList: '/report/listByState',                         // 审核列表
         approve: '/report/approve',                             // 通过报告
         deny: '/report/deny',                                   // 未通过
     }

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

@@ -15,6 +15,7 @@ import unusual from './views/desktop/unusual.vue'
 // 工作报告
 import statistics from './views/workReport/statistics.vue'
 import daily from './views/workReport/daily.vue'
+import review from './views/workReport/list.vue'
 
 // 项目管理
 import list from './views/project/list.vue'
@@ -67,6 +68,17 @@ export const manageRouter = [
             { path: '/daily', component: daily, name: '工时报告' },
         ]
     },
+    //工时报告
+    {
+        path: '/',
+        component: Home,
+        name: '报告审核',
+        iconCls: 'fa fa-check-square-o',
+        leaf: true,
+        children: [
+            { path: '/review', component: review, name: '报告审核' },
+        ]
+    },
     //成本统计
     {
         path: '/',

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

@@ -4,8 +4,7 @@
         <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
             <el-form :inline="true">
                 <el-form-item>
-                    <el-date-picker v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" 
-                    @change="changeMonth()" :clearable="false" type="month" placeholder="选择月份"></el-date-picker>
+                    <el-date-picker v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="changeMonthOut" :clearable="false" type="month" placeholder="选择月份"></el-date-picker>
                 </el-form-item>
                 <el-form-item style="float:right;">
                     <el-link type="primary" :underline="false" v-if="user.role != 0" @click="exportReport">导出日报</el-link>
@@ -149,7 +148,8 @@
         },
         methods: {
             // 改变月份
-            changeMonth() {
+            changeMonthOut() {
+                console.log(sessionStorage.msg)
                 this.getAllDate();
                 this.getReportList();
             },

+ 225 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/list.vue

@@ -0,0 +1,225 @@
+<template>
+    <section>
+        <!--工具条-->
+        <!-- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+            <el-form :inline="true">
+                <el-form-item label="类型:">
+                    <el-select v-model="search.value" placeholder="请选择类型" @change="getList()">
+                        <el-option label="全部" value="-1"></el-option>
+                        <el-option label="待审核" value="0"></el-option>
+                        <el-option label="已通过" value="1"></el-option>
+                        <el-option label="已驳回" value="2"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item v-if="search.value == -1" label="日期:" style="margin-left:20px;">
+                    <el-date-picker v-model="search.date" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
+                    @change="getList()" :clearable="true" type="date" placeholder="选择工作日期"></el-date-picker>
+                </el-form-item>
+            </el-form>
+        </el-col> -->
+
+        <!--列表-->
+        <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
+            <el-table-column type="expand">
+                <template slot-scope="props">
+                    <el-timeline>
+                        <el-timeline-item v-for="(item,index) in props.row.data" :key="index" >
+                            <el-card shadow="never">
+                                <p>项目:<b>{{item.project}}</b></p>
+                                <p>时长:{{item.time}}h</p>
+                                <p>事项:<span v-html="item.content"></span></p>
+                            </el-card>
+                        </el-timeline-item>
+                    </el-timeline>
+                </template>
+            </el-table-column>
+            <el-table-column type="index" width="60"></el-table-column>
+            <el-table-column prop="name" label="姓名" sortable></el-table-column>
+            <el-table-column prop="date" label="日期" sortable>
+                <template slot-scope="scope">
+                    <span v-if="search.value == -1">{{search.date}}</span>
+                    <span v-else>{{scope.row.date}}</span>
+                </template>
+            </el-table-column>
+            <el-table-column prop="state" label="状态" sortable>
+                <template slot-scope="scope">
+                    <span v-if="scope.row.state == 0" style="color:#DAA520;">待审核</span>
+                    <span v-else-if="scope.row.state == 1" style="color:#32CD32;">已通过</span>
+                    <span v-else-if="scope.row.state == 2" style="color:#FF0000;">已驳回</span>
+                </template>
+            </el-table-column>
+            <el-table-column label="操作" width="220">
+                <template slot-scope="scope">
+                    <el-button v-if="user.role != 0 && scope.row.state == 0" type="primary" :loading="logining" size="small" @click="approve(scope.row.id,scope.row.date)">通过</el-button>
+                    <el-button v-if="user.role != 0 && scope.row.state == 0" type="danger" :loading="logining" size="small" @click="deny(scope.row.id,0,scope.row.date)">驳回</el-button>
+                    <el-button v-if="user.role != 0 && scope.row.state == 1" type="danger" :loading="logining" size="small" @click="deny(scope.row.id,1,scope.row.date)">撤销</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+
+        <!--工具条-->
+        <!-- <el-col v-if="search.value != -1" :span="24" class="toolbar">
+            <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :page-sizes="[20 , 50 , 80 , 100]"
+                :page-size="20"
+                layout="total, sizes, prev, pager, next"
+                :total="total"
+                style="float:right;"
+            ></el-pagination>
+        </el-col> -->
+    </section>
+</template>
+
+<script>
+    import util from "../../common/js/util";
+
+    export default {
+        data() {
+            return {
+                user: JSON.parse(sessionStorage.getItem("user")),
+
+                search: {
+                    value: 0,
+                    date: util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
+                },
+
+                users: [],
+
+                tableHeight: 0,
+                listLoading: false,
+                total: 0,
+                page: 1,
+                size: 20,
+                list: [],
+                logining: false,
+
+            };
+        },
+        methods: {
+            //分页
+            handleCurrentChange(val) {
+                this.page = val;
+                this.getList();
+            },
+
+            handleSizeChange(val) {
+                this.size = val;
+                this.getList();
+            },
+
+            //获取项目列表
+            getList() {
+                this.listLoading = true;
+                let form = {}
+                if(this.search.value==-1) {
+                    form.date = this.search.date
+                } else {
+                    form.state = this.search.value;
+                }
+                this.http.post(this.search.value==-1?this.port.report.list:this.port.report.portList, form,
+                res => {
+                    this.listLoading = false;
+                    if (res.code == "ok") {
+                        this.list = res.data;
+                    } else {
+                        this.$message({
+                        message: res.msg,
+                        type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.listLoading = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            // 通过日报
+            approve(id,date) {
+                this.logining = true;
+                var time = "";
+                if(this.search.value == -1) {
+                    time = this.search.date;
+                } else {
+                    time = date;
+                }
+                this.http.post( this.port.report.approve, {id: id , date: time},
+                res => {
+                    this.logining = false;
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: "审核成功",
+                            type: "success"
+                        });
+                        this.getList();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.logining = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            // 未通过日报
+            deny(id,i,date) {
+                this.logining = true;
+                var time = "";
+                if(this.search.value == -1) {
+                    time = this.search.date;
+                } else {
+                    time = date;
+                }
+                this.http.post( this.port.report.deny, {id: id , date: time},
+                res => {
+                    this.logining = false;
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: i==0?"驳回成功":"撤销成功",
+                            type: "success"
+                        });
+                        this.getList();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.logining = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            }
+        },
+        created() {
+            let height = window.innerHeight;
+            this.tableHeight = height - 85;
+            const that = this;
+            window.onresize = function temp() {
+                that.tableHeight = window.innerHeight - 85;
+            };
+        },
+        mounted() {
+            this.getList();
+        }
+    };
+</script>
+
+<style lang="scss" scoped>
+</style>