Pārlūkot izejas kodu

增加管理员可以删除别人的日报功能

Lijy 3 gadi atpakaļ
vecāks
revīzija
0c8d907b3a

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

@@ -111,6 +111,7 @@
                                 <el-button v-if="(user.id == item1.id) && (item1.state == 0 || item1.state == -1)" type="normal" :loading="logining" size="small" @click="cancel(item1)">撤回</el-button>
                                 <el-button v-if="(user.id == item1.id) && (item1.state == 0 || item1.state == -1)" type="normal" :loading="logining" size="small" @click="cancel(item1)">撤回</el-button>
                                 <el-button v-if="(user.role == 1 || user.role == 2 || user.id == item1.data[0].inchargerId) && item1.state == 1" type="normal" :loading="logining" size="small" @click="showDenyDialog(item1.id,1, item1)">撤销</el-button>
                                 <el-button v-if="(user.role == 1 || user.role == 2 || user.id == item1.data[0].inchargerId) && item1.state == 1" type="normal" :loading="logining" size="small" @click="showDenyDialog(item1.id,1, item1)">撤销</el-button>
                                 <el-button v-if="item1.state >= 2 && user.id == item1.id" type="primary" size="small" @click="isSubstitude=false; fillInReport(index1,0)">编辑日报</el-button>
                                 <el-button v-if="item1.state >= 2 && user.id == item1.id" type="primary" size="small" @click="isSubstitude=false; fillInReport(index1,0)">编辑日报</el-button>
+                                <el-button v-if="user.role == 1 || user.role == 2 " type="primary" size="small" @click="guanli(item1)">删除</el-button>
                             </div>
                             </div>
                             <div class="one_daily_body">
                             <div class="one_daily_body">
                                 <el-timeline>
                                 <el-timeline>
@@ -494,7 +495,6 @@
                                         <p>用时占比</p>
                                         <p>用时占比</p>
                                         <div style="width:355px;display: flex;align-items: center;">
                                         <div style="width:355px;display: flex;align-items: center;">
                                             <el-col span="23"><el-slider style="margin-left: 5px;width:249px;" v-model="scope.row[item.projectName].progress" :min="0" :show-tooltip="false" :step="10" @input="scope.row[item.projectName].workingTime = (reportTimeType.allday*scope.row[item.projectName].progress/100).toFixed(1)" @change="addBli(scope.row[item.projectName], scope.$index, index)"></el-slider></el-col>
                                             <el-col span="23"><el-slider style="margin-left: 5px;width:249px;" v-model="scope.row[item.projectName].progress" :min="0" :show-tooltip="false" :step="10" @input="scope.row[item.projectName].workingTime = (reportTimeType.allday*scope.row[item.projectName].progress/100).toFixed(1)" @change="addBli(scope.row[item.projectName], scope.$index, index)"></el-slider></el-col>
-                                            <!-- <el-col span="10"><span style="margin-left:10px;float:right;"><span style="margin-right:10px;">{{domain.progress}}%</span>{{domain.workingTime}}小时</span></el-col> -->
                                             <el-col span="10"><span style="float:right;"><span style="margin-right:10px;">{{scope.row[item.projectName].progress || 0}}%</span>{{scope.row[item.projectName].workingTime | amounts}}小时</span></el-col>
                                             <el-col span="10"><span style="float:right;"><span style="margin-right:10px;">{{scope.row[item.projectName].progress || 0}}%</span>{{scope.row[item.projectName].workingTime | amounts}}小时</span></el-col>
                                         </div>
                                         </div>
                                     </div>
                                     </div>
@@ -504,7 +504,6 @@
                                     </div>
                                     </div>
                                 </div>
                                 </div>
                                 <div v-if="reportTimeType.multiWorktime == 0" slot="reference">
                                 <div v-if="reportTimeType.multiWorktime == 0" slot="reference">
-                                    <!-- <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && (reportTimeType.type == 1 || reportTimeType.type == 2 || reportTimeType.type == 3) && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button> -->
                                     <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 3 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
                                     <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 3 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
                                     <el-button v-else-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 1 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
                                     <el-button v-else-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 1 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
                                     <el-button v-else-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != '' && reportTimeType.type == 2" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
                                     <el-button v-else-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != '' && reportTimeType.type == 2" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
@@ -1703,6 +1702,48 @@
                 .catch(() => {});
                 .catch(() => {});
                 
                 
            },
            },
+            // 管理员删除日报
+            guanli(item) {
+                console.log(item, 123)
+                this.$confirm("确定要删除该日报吗?","提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                })
+                .then(() => {
+                    this.listLoading = true;
+                    this.http.post('/report/delete',{ 
+                        userId: item.id,
+                        date: this.workForm.createDate
+                    },
+                    res => {
+                        this.listLoading = false;
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: "删除成功",
+                                type: "success"
+                            });
+                            this.getReportList();
+                            this.getDepartment();
+                            this.dialogVisible = false;
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+                })
+                .catch(() => {});
+            },
             //提交批量审核数据
             //提交批量审核数据
             submitBatchApprove() {
             submitBatchApprove() {
                 var data = this.$refs.approveTree.getCheckedNodes();
                 var data = this.$refs.approveTree.getCheckedNodes();