Ver código fonte

分配是否为加班功能完成

Lljy-ai 4 anos atrás
pai
commit
3978a0cc42

+ 141 - 27
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -66,11 +66,12 @@
                         <i class="el-icon-d-arrow-left" ></i>
                     </span> -->
 
-                    <!--可删除 -->
-                    <!-- <div class="div2">
-                        <span class="sapn2" @click="ok()"></span>
-                    </div> -->
-                    <!--可删除 -->
+                    <!-- 增加侧边栏的点击效果 -->
+                    <div class="sidebar" @click="retract()">
+                        <div class="etui">
+                            <i class="el-icon-arrow-left" ref="box"></i>
+                        </div>
+                    </div>
                     
                     <el-main style="background:#f7f7f7;padding:0px;">
                         <el-row style="color:#999;margin-top:10px;padding: 0px 10px;">
@@ -491,13 +492,21 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                 },
                 taskRules : {
                     name: [{ required: true, message: "请输入任务内容", trigger: "blur" }],
-                }
+                },
+                sleectId: null,
+                sleectProjectId: null,
+                sidebarIndex: null, // 侧边栏索引
             };
         },
         methods: {
-            // 可刪除
-            ok() {
-                console.log(123)
+            // 侧边栏的点击事件
+            retract() {
+                if (this.$refs.box.className == 'el-icon-arrow-left') {
+                    this.$refs.box.className = 'el-icon-arrow-right'
+                } else {
+                    this.$refs.box.className = 'el-icon-arrow-left'
+                }
+                // this.$refs.box.className === 'el-icon-arrow-left' ? this.$refs.box.className = 'el-icon-arrow-right' || this.$refs.box.className = 'el-icon-arrow-left'
                 this.toggleGroup()
             },
             // 
@@ -505,6 +514,7 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                 this.groupTemplateList.forEach(g=>{
                     g.selected = false;
                 })
+                this.sidebarIndex = tIndex
                 this.groupTemplateList[tIndex].selected = true;
             },
             //获取分组模板列表
@@ -989,11 +999,30 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                 var param = JSON.parse(JSON.stringify(this.groupTemplateList.filter(g=>g.selected)[0]));
                 delete param.stagesList;
                 param.projectId = this.curProjectId;
+                // 
+                var k = this.groupTemplateList[this.sidebarIndex].name
+                var s = null;
+                var xmz = this.groupList.forEach(function(a, b, c){
+                    if (a.name == k) {
+                        s = true
+                        return
+                    }
+                })
+                if (s){ 
+                    this.addGroupDialog = false;
+                    return 
+                }
+                // 
                 this.http.post('/task-group/createFromTemplate',param,
                 res => {
                     if (res.code == "ok") {
+                        this.selectedGroup = res.data
+                        this.sleectId = res.data.id
+                        this.sleectProjectId = res.data.projectId
+
                         this.addGroupDialog = false;
-                        this.getTaskGroups();
+                        // this.getTaskGroups();
+                        this.getTaskGroup();
                     } else {
                         this.$message({
                         message: res.msg,
@@ -1008,16 +1037,47 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                     });
                 });
             },
-            addGroup() {
+
+            // addGroup() {
+            //     this.http.post('/task-group/save',this.groupForm,
+            //     res => {
+            //         if (res.code == "ok") {
+            //             this.groupList = res.data;
+            //             this.addGroupDialog = false;
+            //             this.modGroupDialog = false;
+            //             if (this.selectedGroup.id == this.groupForm.id) {
+            //                 this.selectedGroup = this.groupForm;
+            //             }
+            //         } else {
+            //             this.$message({
+            //             message: res.msg,
+            //             type: "error"
+            //             });
+            //         }
+            //     },
+            //     error => {
+            //         this.$message({
+            //             message: error,
+            //             type: "error"
+            //         });
+            //     });
+            // },
+
+            // 重新定义了 addGroup 方法
+             addGroup() {
                 this.http.post('/task-group/save',this.groupForm,
                 res => {
                     if (res.code == "ok") {
                         this.groupList = res.data;
                         this.addGroupDialog = false;
                         this.modGroupDialog = false;
-                        if (this.selectedGroup.id == this.groupForm.id) {
+                        console.log(this.selectedGroup.id);
+                        if (this.selectedGroup.id !== this.groupForm.id) {
                             this.selectedGroup = this.groupForm;
                         }
+                        this.defaultGroupId = this.groupList[this.groupList.length - 1].id
+                        // this.getTaskGroup();
+                        this.getStageList()
                     } else {
                         this.$message({
                         message: res.msg,
@@ -1032,6 +1092,7 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                     });
                 });
             },
+
             createGroup() {
                 this.addGroupDialog = true;
                 this.groupForm = {projectId: this.curProjectId};
@@ -1070,6 +1131,41 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                     });
                 });
             },
+
+            // 额外加的
+             getTaskGroup() { 
+                this.http.post('/task-group/list',{projectId: this.curProjectId},
+                res => {
+                    if (res.code == "ok") {
+                        console.log(res);
+                        console.log(res.data.length)
+                        this.allGroupData = res.data;
+                        this.groupList = res.data;
+                        if (this.groupList.length > 0) {
+                            this.defaultGroupId = this.sleectId;
+                            this.selectedGroup = this.groupList[res.data.length - 1];
+                            this.getStageList();
+                        } else {
+                            //清空任务列表
+                            this.defaultGroupId = null;
+                            this.selectedGroup = null;
+                            this.stageList = [];
+                        }
+                    } else {
+                        this.$message({
+                        message: res.msg,
+                        type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
             //切换项目
             onProjectChange() {
                 let path = this.$route.path;
@@ -1431,25 +1527,43 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
     margin:20px 0px;
 }
 
-/* 可删除 */
-.div2 {
-   width: 2px;
-   background: #e5e5e5;
-   position: relative;
+/* 项目阶段侧边栏样式 */
+.sidebar {
+    width: 2px;
+    background: #dddddd;
+    position: relative;
 }
-.div2:hover {
-   background: blue;
+.sidebar:hover {
+    background: #20a0ff;
 }
-.div2:hover .sapn2 {
-   border: 1px solid blue;
-   background: blue;
+.sidebar:hover .etui {
+    background: #20a0ff;
+    border: #20a0ff;
+    color: #fff;
 }
-.sapn2 {
-    width: 14px;
-    height: 30px;
+.etui {
+    width: 24px;
+    height: 40px;
     background: #fff;
-    border: 1px solid #e5e5e5;
+    border: 1px solid #dddddd;
     position: absolute;
-    top: 49%;
+    top: 50%;
+    left: 0%;
+    transform: translate(6%, -50%);
+    color: rgb(192, 191, 191);
+    box-sizing: border-box;
+}
+.etui i {
+    display: inline-block;
+    padding-top: 50%;
+    padding-left: 15%;
+    font-weight: bold;
+}
+
+/* bug问题 */
+.task {
+    box-sizing: border-box;
+    padding-left: 10px;
+    padding-right: 5px;
 }
 </style>

+ 26 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -95,7 +95,32 @@
             <p>
             展示样例
             </p>
+
             <div style="width:500px;">
+               开始时间: <el-time-picker
+                    v-model="startTime"
+                    :picker-options="{
+                        start: '08:30',
+                        step: '00:15',
+                        end: '18:30'
+                    }"
+                    placeholder="任意时间点">
+                </el-time-picker>
+            </div>
+            <div style="margin-top:5px;">
+               结束时间: <el-time-picker
+                            v-model="endTime"
+                            :picker-options="{
+                                start: '08:30',
+                                step: '00:15',
+                                end: '18:30',
+                                minTime: startTime
+                            }"
+                            placeholder="任意时间点">
+                        </el-time-picker>
+            </div>
+
+            <!-- <div style="width:500px;">
                 开始时间:<el-time-select
                     placeholder="起始时间"
                     v-model="startTime"
@@ -117,7 +142,7 @@
                     minTime: startTime
                     }">
                 </el-time-select>
-            </div>
+            </div> -->
                 </div>
             </el-radio> 
             

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

@@ -114,8 +114,11 @@
                                                 <span v-if="item2.reportTimeType == 0" style="margin-right:10px;">{{typeList[item2.timeType]}}</span>
                                                 <span v-if="item2.reportTimeType == 2" style="margin-right:10px;">{{item2.startTime+'-'+item2.endTime}}</span>
                                             {{item2.time.toFixed(1)}}h  
+                                            <el-tag type="danger" class="tages" v-if="item2.isOvertime === 1">加班</el-tag>
                                             </p>
+                                            
                                             <p>事项:<span v-html="item2.content"></span></p>
+                                            
                                         </el-card>
                                     </el-timeline-item>
                                 </el-timeline>
@@ -164,6 +167,16 @@
                         <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
                         </el-select>
                         <span v-if="reportTimeType.type == 1">小时</span>
+
+                        <!-- 是否加班 -->
+                            <el-checkbox v-model="domain.isOvertime">加班</el-checkbox>
+
+                        <!-- <div class="overtime">
+                            <input type="checkbox" :checked='selected' @click="check">
+                            <span>加班</span>
+                        </div> -->
+                        <!-- /是否加班 -->
+                        
                         <span v-if="reportTimeType.type == 2">
                         <!--时间范围选择 -->
                         <el-time-select 
@@ -320,9 +333,17 @@
                     children: 'children',
                     label: 'label'
                 },
+                isNew: false,
+                selected: false
             };
         },
         methods: {
+            // 是否加班的单机事件
+            check() {
+                this.selected = !this.selected
+                this.isNew = this.selected
+                
+            },
             //项目选中了, 加载子项目
             selectProject(domain, index) {
                 this.http.post('/sub-project/list',{ 
@@ -787,6 +808,7 @@
                 res => {
                     this.listLoading = false;
                     if (res.code == "ok") {
+                        console.log(res);
                         this.reportList = res.data;
                         document.querySelector("#day"+this.choseDay).scrollIntoView(true);
                     } else {
@@ -1063,7 +1085,21 @@
                             }
                             
                             formData.append("createDate", this.workForm.createDate);
+                            console.log(this.workForm.domains[i].isOvertime,123);
+                            if(this.workForm.domains[i].isOvertime == undefined ) {
+                                this.workForm.domains[i].isOvertime = '0'
+                                formData.append("isOvertime", this.workForm.domains[i].isOvertime);
+                            } else if (this.workForm.domains[i].isOvertime == false){
+                                this.workForm.domains[i].isOvertime = '0'
+                                formData.append("isOvertime", this.workForm.domains[i].isOvertime);
+                            } else {
+                                this.workForm.domains[i].isOvertime = '1'
+                                formData.append("isOvertime", this.workForm.domains[i].isOvertime);
+                            }
+                            // formData.append("isOvertime", this.workForm.domains[i].isOvertime);
                         }
+                        console.log(123,this.workForm);
+                        console.log(formData);
                         this.http.uploadFile( this.port.report.editPort, formData,
                         res => {
                             this.listLoading = false;
@@ -1301,4 +1337,24 @@
         margin-left: 10px;
         vertical-align: bottom;
     }
+</style>
+
+<style lang="scss" scoped>
+    // 加班样式
+    .overtime {
+        display: inline-block;
+        margin-left: 20px;
+
+        input {
+            display: inline-block;
+            margin-top: 5px;
+        }
+    }
+    .plus {
+        display: inline-block;
+    }
+    .tages {
+        float: right;
+    }
+    
 </style>