Quellcode durchsuchen

2022.3.30年假管理

17613754660 vor 3 Jahren
Ursprung
Commit
08e76bba9d
1 geänderte Dateien mit 84 neuen und 36 gelöschten Zeilen
  1. 84 36
      fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

+ 84 - 36
fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

@@ -385,24 +385,26 @@
         </el-dialog>
 
     </div>
-  <!-- -------------- -->
+  <!-- --------- -->
     <div v-if="displayTable && apk && apk2 == 6" class="tops">
       <div class="ctons">
         <div style="display: flex;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #f2f2f2">
             <div style="display: inline-block;width: 350px">
-              <el-input style="float:left;" v-model="keywordAl" class="input-with-select" placeholder="请输入人员搜索" clearable="true" size="small">
+              <el-input style="float:left;" v-model="keywordAl" class="input-with-select" placeholder="请输入人员姓名搜索" clearable="true" size="small">
                   <el-button slot="append" @click="searchAl()" icon="el-icon-search"></el-button>
               </el-input>
             </div>
             <div style="display: inline-block;width: 340px;margin-left:100px">
               <span style="display: inline-block;margin: 0 15px 0 20px;color: rgb(96, 98, 102);">按部门筛选</span>
               <el-cascader
+                ref="selectAl"
                 filterable
                 v-model="NcurDeptId"
-                placeholder="请选择部门/指定人员"
+                placeholder="请选择部门"
                 size="small"
                 style="width: 50%"
-                @change="chooseDept"
+                @change="selAl()"
+                clearable
                 :options="Nsdata"
                 :props="{ checkStrictly: true, expandTrigger: 'hover' }"
                 :show-all-levels="false">
@@ -411,52 +413,52 @@
         </div>
         <div>
           <el-table v-loading="loading" :data="iAlDataS" height="780px" style="width: 100%">
-              <el-table-column prop="name" label="姓名" width="200">
+              <el-table-column prop="userName" label="姓名" width="200">
                 <template slot-scope="scope">
-                  <div v-if="scope.row.name">
-                    {{scope.row.name}}
+                  <div v-if="scope.row.userName">
+                    {{scope.row.userName}}
                   </div>
                   <div v-else>
                     <span>暂无请假统计</span>
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column prop="Dpm" label="所在部门" width="200">
+              <el-table-column prop="department" label="所在部门" width="200">
                 <template slot-scope="scope">
-                  {{scope.row.Dpm}}
+                  {{scope.row.department}}
                 </template>
               </el-table-column>
-              <el-table-column prop="AltimeAll" label="每年年假天数" width="200">
+              <el-table-column prop="yearDays" label="每年年假天数" width="200">
                 <template slot-scope="scope">
-                  {{scope.row.AltimeAll}}天
+                  {{scope.row.yearDays != null ? scope.row.yearDays + "天" : "-"}}
                 </template>
               </el-table-column>
-              <el-table-column prop="AltimeAlr" label="剩余年假天数" width="200">
+              <el-table-column prop="leftdays" label="剩余年假天数" width="200">
                 <template slot-scope="scope">
-                  {{scope.row.AltimeAll - scope.row.AltimeAlr}}天
+                  {{scope.row.yearDays != null ? scope.row.yearDays - scope.row.alreadyDays + "天" : "-"}}
                 </template>
               </el-table-column>
-              <el-table-column prop="id" label="设置">
+              <el-table-column prop="id" label="修改年假天数">
                 <template slot-scope="scope">
-                  <el-button size="small" @click="changeAltime(scope.row.id)">设置</el-button>
+                  <el-button size="small" @click="changeAltime(scope.row)">设置</el-button>
                 </template>
               </el-table-column>
           </el-table>
         </div>
       </div>
       <el-dialog title="请设置年假时限" v-if="Alshow" :visible.sync="Alshow" width="500px">
-        <el-form label-width="100px">
+        <el-form label-width="120px">
           <el-form-item label="设置总年假天数" >
-            <el-input v-model="Alchange" type="number" placeholder="请输入天数"></el-input>
+            <el-input v-model="Alchange.yearDays" type="number" min="0" placeholder="请输入天数"></el-input>
           </el-form-item>
         </el-form>
         <div slot="footer" class="dialog-footer">
-          <el-button type="default" @click="delAltime" v-if="!isAdd" style="float:left;">取消</el-button>
-          <el-button type="primary" @click="chgAltime" >确定</el-button>
+          <el-button type="default" @click="delAltime()">取消</el-button>
+          <el-button type="primary" @click="chgAltime()">确定</el-button>
         </div>
       </el-dialog>
     </div>
-<!-- ------------------- -->
+<!-- --------- -->
   </div>
   <!-- 请假单详情 -->
   <el-dialog title="请假单详情" :visible.sync="dialog" width="1000px" @close="bangd()">
@@ -675,20 +677,16 @@ export default {
       soption : null,
 
       Alshow: false,
-      Alchange: '',
+      Alchange: null,
       susers: [],
       keywordAl: '',
-      NcurDeptId:null,
+      NcurDeptId:[],
       Nsdata : [],
       AlData : [],
       iAlDataS: [],
-      iAlData : [
-        {name: "杨峰", id: "7913998191517310976", Dpm:"软件开发部", AltimeAll: 2, AltimeAlr: 1},
-        {name: "赵四", id: "123456789", Dpm:"美术中心", AltimeAll: 3, AltimeAlr: 1},
-        {name: "刘能", id: "987654321", Dpm:"策划部", AltimeAll: 3, AltimeAlr: 2},
-      ]
+      iAlData : []
 
-      // ------------------
+      // ---------
     };
   },
   computed: {},
@@ -709,9 +707,10 @@ export default {
   },
   filters: {},
   methods: {
-    changeAltime(id){
+    changeAltime(e){
       this.Alshow = true
-      console.log("id",id);
+      this.Alchange = JSON.parse(JSON.stringify(e))
+      console.log("设置",this.Alchange);
     },
     searchAl(){
       this.iAlDataS = []
@@ -722,21 +721,70 @@ export default {
       }
     },
     delAltime(){
-
+      this.Alshow = false
+      this.Alchange = null
     },
     chgAltime(){
-
+      this.http.post('/user-yearleave-setting/save',{userId: this.Alchange.userId, companyId: this.user.companyId, yearDays: this.Alchange.yearDays},
+          res => {
+            if(res.code == "ok"){
+              this.Alshow = false,
+              this.getAl()
+            }else{
+              this.$message({
+                message: res.msg,
+                type: "error"
+              })
+            }
+          },
+          error => {
+            this.Alshow = false
+            this.$message({
+                message: error,
+                type: "error"
+              })
+          }
+      )
     },
     getAl(){
       this.http.get('/user-yearleave-setting/list',
           res => {
             if(res.code == "ok"){
               this.iAlData = res.data
+              this.iAlDataS = this.iAlData
+              if(this.apk2 == 6){
+                this.selAl()
+              }
               console.log("getAl",res.data);
+            } else {
+              this.$message({
+                message: res.msg,
+                type: "error"
+              })
             }
+          },
+          error => {
+            this.Alshow = false
+            this.$message({
+                message: error,
+                type: "error"
+              })
           }
       )
     },
+    selAl(){
+        let e = this.$refs.selectAl.getCheckedNodes()[0]
+        if(e == undefined){
+          this.iAlDataS = this.iAlData
+        }else{
+          this.iAlDataS = []
+        for (let i = 0; i < this.iAlData.length; i++) {
+          if (e.label == this.iAlData[i].department) {
+            this.iAlDataS.push(this.iAlData[i])
+          }
+        }
+        }
+    },
     // ---------
 
     handleNodeClick(data) {
@@ -782,7 +830,7 @@ export default {
                           {value: 2 , label : "指定人员",children : this.susers}
                         ]
                         this.Nsdata = list1
-                        // console.log("列表",this.Nsdata);
+                        console.log("列表",this.Nsdata);
                     } else {
                         this.$message({
                             message: res.msg,
@@ -981,7 +1029,7 @@ export default {
       this.addForm.leaveType = index
     },
     staffs(key, keyPath) {
-      // console.log("keypath",keyPath)
+      console.log("keypath",keyPath)
       if (keyPath[0] == '1') {
         this.displayTable = false;
         this.apk = false
@@ -999,11 +1047,11 @@ export default {
         this.apk = true
         this.statistical()
       } else {
+        this.NcurDeptId = []
         this.displayTable = true;
         this.apk2 = 6
         this.apk = true
-        this.iAlDataS = this.iAlData
-        this.statistical()
+        this.getAl()
       }
     },
     bills(audit, tr){