浏览代码

删除人员转移日报

Lijy 2 年之前
父节点
当前提交
00186e4608
共有 1 个文件被更改,包括 137 次插入31 次删除
  1. 137 31
      fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

+ 137 - 31
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -471,11 +471,36 @@
               </el-form>
             </div>
             <span slot="footer" class="dialog-footer">
-                <el-button type="danger" @click="deleteUser(insertForm)" style="float:left;">{{ $t('btn.delete') }}</el-button>
+                <!-- <el-button type="danger" @click="deleteUser(insertForm, '1')" style="float:left;">{{ $t('btn.delete') }}</el-button> -->
+                <el-button type="danger" @click="deleteUserFlg = true" style="float:left;">{{ $t('btn.delete') }}</el-button>
                 <el-button @click="dialogVisible=false">{{ $t('btn.cancel') }}</el-button>
                 <el-button type="primary" @click="submitInsert('insertForm')" :loading="submitLoading">{{ $t('btn.submit') }}</el-button>
             </span>
         </el-dialog>
+        <!-- 删除员工时转移日报 -->
+        <el-dialog title="提示" :visible.sync="deleteUserFlg" width="600px" :before-close="handleClose">
+        <div>
+          <div class="deteee">确定删除该员工吗?</div>
+          <div class="deteeeAce" v-if="deleteUserFlgData.isExistsReport">
+
+            <div style="margin-right: 10px">该员工存在工时数据转移 至</div>
+            <el-select v-if="user.userNameNeedTranslate != 1" v-model="moveReportUserId" style="width:140px;" :placeholder="$t('defaultText.pleaseChoose')" clearable size="small" filterable popper-class="managePopperClass">
+                <el-option v-for="item in users" :key="item.id" :label="item.name + '\u3000' + item.jobNumber" :value="item.id">
+                    <span style="float: left">{{ item.name }}</span>
+                    <span style="float: right; color: #8492a6;">{{ item.jobNumber }}</span>
+                </el-option>
+            </el-select>
+
+            <selectCat v-if="user.userNameNeedTranslate == 1" :size="'small'" :subject="users" :widthStr="350" :subjectId="moveReportUserId" :distinction="'22'" :clearable="true" @selectCal="selectCal"></selectCat>
+
+          </div>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="deleteUserFlg = false">取 消</el-button>
+          <el-button type="primary" @click="deleteUser(deleteUserFlgData)" :loading="deleteUserFlgloading">确 定</el-button>
+        </span>
+      </el-dialog>
+
         <!-- 编辑超级管理员的Dialog -->
         <el-dialog :title="$t('editorialstaff')" :visible.sync="dialogVisible1" width="550px" >
             <el-form ref="form1" :model="insertForm" :rules="rules" label-width="80px">
@@ -1072,7 +1097,12 @@ export default {
 
       adjustPosition: false,
 
-      dataRepeat: []
+      dataRepeat: [],
+
+      deleteUserFlg: false,
+      deleteUserFlgData: {},
+      moveReportUserId: '',
+      deleteUserFlgloading: false
     };
   },
   filters: {
@@ -1829,41 +1859,105 @@ export default {
         }
       );
     },
-
-    deleteUser(targetUser) {
-      this.$confirm(this.$t('deletthisemployee'), this.$t('other.prompts'), {
-        //type: 'warning'
-      }).then(() => {
-        this.http.post(
-          "/user/deleteUser",
-          {
-            userId: targetUser.id,
-          },
-          (res) => {
-            if (res.code == "ok") {
-              this.$message({
-                message: this.$t('message.successfullyDeleted'),
-                type: "success",
-              });
-              this.dialogVisible = false;
-              this.getUser();
-            } else {
+    // 转移日报
+    transferDaily() {
+      this.http.post("/report/moveReport", {
+          targetId: this.moveReportUserId,
+          sourceId: this.deleteUserFlgData.id
+        },
+        (res) => {
+          if (res.code == "ok") {
+              this.transferDailydete()
+          } else {
+            
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        });
+    },
+    transferDailydete() {
+          this.deleteUserFlgloading = true
+          this.http.post(
+            "/user/deleteUser",
+            {
+              // userId: targetUser.id,
+              userId: this.deleteUserFlgData.id,
+            },
+            (res) => {
+              this.deleteUserFlg = false
+              if (res.code == "ok") {
+                this.$message({
+                  message: this.$t('message.successfullyDeleted'),
+                  type: "success",
+                });
+                this.dialogVisible = false;
+                this.deleteUserFlgloading = false
+                this.getUser();
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error",
+                });
+                this.dialogVisible = false;
+              }
+            },
+            (error) => {
+              this.deleteUserFlg = false
               this.$message({
-                message: res.msg,
+                message: error,
                 type: "error",
               });
               this.dialogVisible = false;
+              this.deleteUserFlgloading = false
             }
-          },
-          (error) => {
-            this.$message({
-              message: error,
-              type: "error",
-            });
-            this.dialogVisible = false;
+          );
+    },
+    deleteUser(targetUser) {
+      console.log(targetUser, '数据', this.deleteUserFlgData)
+        // this.$confirm(this.$t('deletthisemployee'), this.$t('other.prompts'), {
+        //   //type: 'warning'
+        // }).then(() => {
+          this.dialogVisible = true
+          if(this.deleteUserFlgData.isExistsReport) {
+            this.transferDaily()
+          } else {
+            this.transferDailydete()
           }
-        );
-      });
+          // this.http.post(
+          //   "/user/deleteUser",
+          //   {
+          //     // userId: targetUser.id,
+          //     userId: this.deleteUserFlgData.id,
+          //   },
+          //   (res) => {
+          //     if (res.code == "ok") {
+          //       this.$message({
+          //         message: this.$t('message.successfullyDeleted'),
+          //         type: "success",
+          //       });
+          //       this.dialogVisible = false;
+          //       this.getUser();
+          //     } else {
+          //       this.$message({
+          //         message: res.msg,
+          //         type: "error",
+          //       });
+          //       this.dialogVisible = false;
+          //     }
+          //   },
+          //   (error) => {
+          //     this.$message({
+          //       message: error,
+          //       type: "error",
+          //     });
+          //     this.dialogVisible = false;
+          //   }
+          // );
+        // });
     },
     chufa(data, b, c, e) {
       if (this.depData == null || data.id != this.depData.id) {
@@ -2405,6 +2499,7 @@ export default {
           },
           (res) => {
             if (res.code == "ok") {
+              this.deleteUserFlgData = res.data
               this.insertForm = {
                 id: res.data.id,
                 name: res.data.name,
@@ -3435,6 +3530,9 @@ export default {
         this.depForm.reportAuditUserid = obj.id
       } else if(obj.distinction == '12'){
         this.toUserId = obj.id
+      } else if(obj.distinction == '22') {
+        console.log(obj, '返回')
+        this.moveReportUserId = obj.id
       }
     },
     // 企业微信可见范围设置
@@ -3551,6 +3649,14 @@ export default {
 </script>
 
 <style scoped>
+.deteee{
+  font-size: 25px;
+  margin-bottom: 20px;
+}
+.deteeeAce {
+  display: flex;
+  align-items: center;
+}
 .treeIons {
   float: right;
   position: absolute;