From 86b0362eaf4c320dc6a54fc12ce80b0bf7890a85 Mon Sep 17 00:00:00 2001
From: yaozc <yaozc@yhzhg.cn>
Date: Thu, 30 May 2024 02:06:17 +0000
Subject: [PATCH] 11111

---
 eladmin-web-master/src/views/treatment/userInsurance/index.vue |  176 +++++++++++++++++++++++++++++++---------------------------
 1 files changed, 94 insertions(+), 82 deletions(-)

diff --git a/eladmin-web-master/src/views/treatment/userInsurance/index.vue b/eladmin-web-master/src/views/treatment/userInsurance/index.vue
index e2e85cd..3c5a318 100644
--- a/eladmin-web-master/src/views/treatment/userInsurance/index.vue
+++ b/eladmin-web-master/src/views/treatment/userInsurance/index.vue
@@ -5,16 +5,20 @@
       <div v-if="crud.props.searchToggle">
         <!-- 搜索 -->
         <label class="el-form-item-label">员工</label>
-        <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
-          <el-option
-            v-for="item in users"
-            :key="item.id"
-            :label="item.nickName"
-            :value="item.id"
-          />
-        </el-select>
+        <el-cascader
+          v-model="selectedValue"
+          :filterable="true"
+          :options="options"
+          :props="propsUsers"
+          clearable
+          collapse-tags
+          placeholder="所属员工"
+          :show-all-levels="false"
+          style="width: 230px"
+          @change="changeUserList"
+        />
         <label class="el-form-item-label">年月</label>
-        <el-date-picker v-model="query.yearMonth" clearable type="month" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+        <el-date-picker v-model="query.yearMonth" value-format="yyyy-MM" clearable type="month" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
         <rrOperation :crud="crud" />
       </div>
       <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
@@ -31,8 +35,8 @@
         >生成</el-button>
       </crudOperation>
       <!--表单组件-->
-      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
-        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
+      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="550px">
+        <el-form ref="form" :model="form" :inline="true" :rules="rules" size="small" label-width="96px">
           <el-form-item label="员工" prop="userId">
             <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" style="width: 340px;" @change="changeUser">
               <el-option
@@ -50,81 +54,87 @@
           <el-form-item label="年月" prop="yearMonth">
             <el-date-picker v-model="form.yearMonth" value-format="yyyy-MM" format="yyyy 年 MM 月" clearable type="month" placeholder="请选择年月" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="公积金基数" prop="accumulationFund">
+          <el-divider>公积金</el-divider>
+          <el-form-item label="基数" prop="accumulationFund">
             <el-input v-model="form.accumulationFund" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="公积金个人比例" prop="accumulationFundPersonal">
-            <el-input v-model="form.accumulationFundPersonal" style="width: 370px;">
+          <el-form-item label="个人比例" prop="accumulationFundPersonal">
+            <el-input v-model="form.accumulationFundPersonal" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="公积金公司比例" prop="accumulationFundCompany">
-            <el-input v-model="form.accumulationFundCompany" style="width: 370px;">
+          <el-form-item label="公司比例" prop="accumulationFundCompany">
+            <el-input v-model="form.accumulationFundCompany" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="养老险基数" prop="retirementInsurance">
+          <el-divider>养老险</el-divider>
+          <el-form-item label="基数" prop="retirementInsurance">
             <el-input v-model="form.retirementInsurance" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="公积金个人比例" prop="retirementInsurancePersonal">
-            <el-input v-model="form.retirementInsurancePersonal" style="width: 370px;">
+          <el-form-item label="个人比例" prop="retirementInsurancePersonal">
+            <el-input v-model="form.retirementInsurancePersonal" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="公积金公司比例" prop="retirementInsuranceCompany">
-            <el-input v-model="form.retirementInsuranceCompany" style="width: 370px;">
+          <el-form-item label="公司比例" prop="retirementInsuranceCompany">
+            <el-input v-model="form.retirementInsuranceCompany" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="医疗险基数" prop="medicalInsurance">
+          <el-divider>医疗险</el-divider>
+          <el-form-item label="基数" prop="medicalInsurance">
             <el-input v-model="form.medicalInsurance" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="医疗险个人比例" prop="medicalInsurancePersonal">
-            <el-input v-model="form.medicalInsurancePersonal" style="width: 370px;">
+          <el-form-item label="个人比例" prop="medicalInsurancePersonal">
+            <el-input v-model="form.medicalInsurancePersonal" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="医疗险公司比例" prop="medicalInsuranceCompany">
-            <el-input v-model="form.medicalInsuranceCompany" style="width: 370px;">
+          <el-form-item label="公司比例" prop="medicalInsuranceCompany">
+            <el-input v-model="form.medicalInsuranceCompany" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="失业险基数" prop="unemploymentInsurance">
+          <el-divider>失业险</el-divider>
+          <el-form-item label="基数" prop="unemploymentInsurance">
             <el-input v-model="form.unemploymentInsurance" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="失业险个人比例" prop="unemploymentInsurancePersonal">
-            <el-input v-model="form.unemploymentInsurancePersonal" style="width: 370px;">
+          <el-form-item label="个人比例" prop="unemploymentInsurancePersonal">
+            <el-input v-model="form.unemploymentInsurancePersonal" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="失业险公司比例" prop="unemploymentInsuranceCompany">
-            <el-input v-model="form.unemploymentInsuranceCompany" style="width: 370px;">
+          <el-form-item label="公司比例" prop="unemploymentInsuranceCompany">
+            <el-input v-model="form.unemploymentInsuranceCompany" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="生育险基数" prop="birthInsurance">
+          <el-divider>生育险</el-divider>
+          <el-form-item label="基数" prop="birthInsurance">
             <el-input v-model="form.birthInsurance" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="生育险个人比例" prop="birthInsurancePersonal">
-            <el-input v-model="form.birthInsurancePersonal" style="width: 370px;">
+          <el-form-item label="个人比例" prop="birthInsurancePersonal">
+            <el-input v-model="form.birthInsurancePersonal" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="生育险公司比例" prop="birthInsuranceCompany">
-            <el-input v-model="form.birthInsuranceCompany" style="width: 370px;">
+          <el-form-item label="公司比例" prop="birthInsuranceCompany">
+            <el-input v-model="form.birthInsuranceCompany" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="工伤险基数" prop="employmentInsurance">
+          <el-divider>工伤险</el-divider>
+          <el-form-item label="基数" prop="employmentInsurance">
             <el-input v-model="form.employmentInsurance" style="width: 370px;" />
           </el-form-item>
-          <el-form-item label="工伤险个人比例" prop="employmentInsurancePersonal">
-            <el-input v-model="form.employmentInsurancePersonal" style="width: 370px;">
+          <el-form-item label="个人比例" prop="employmentInsurancePersonal">
+            <el-input v-model="form.employmentInsurancePersonal" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="工伤险公司比例" prop="employmentInsuranceCompany">
-            <el-input v-model="form.employmentInsuranceCompany" style="width: 370px;">
+          <el-form-item label="公司比例" prop="employmentInsuranceCompany">
+            <el-input v-model="form.employmentInsuranceCompany" style="width: 130px;">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
@@ -229,17 +239,18 @@
               placeholder="工资年月"
             />
           </el-form-item>
-          <el-form-item label="员工" prop="userId">
-            <el-tree
-              ref="tree"
-              :data="deptDatas"
-              :props="props"
-              :load="getDeptDatas"
-              lazy
-              :default-expanded-keys="[]"
-              show-checkbox
-              node-key="id"
-              @check="handleCheckChange"
+          <el-form-item label="所属员工" prop="userIds">
+            <el-cascader
+              v-model="selectedValue1"
+              :filterable="true"
+              :options="options"
+              :props="propsUsers"
+              clearable
+              collapse-tags
+              placeholder="请选择"
+              :show-all-levels="false"
+              style="width: 370px"
+              @change="changeUserListTwo"
             />
           </el-form-item>
         </el-form>
@@ -343,11 +354,13 @@
         ]
       },
       queryTypeOptions: [
-        { key: 'userId', display_name: '员工' },
+        { key: 'userIds', display_name: '员工' },
         { key: 'yearMonth', display_name: '年月' }
       ],
       // 员工
       users: [],
+      selectedValue: [],
+      selectedValue1: [],
       // 生成表单状态
       generateStatus: false,
       // 生成表单加载
@@ -363,7 +376,8 @@
       props: {
         children: 'children', label: 'label', isLeaf: 'leaf'
       },
-      deptDatas: []
+      options: [],
+      propsUsers: { multiple: true }
     }
   },
   mounted() {
@@ -380,12 +394,30 @@
       crudUser.getAll({ enabled: true }).then(res => {
         this.users = res
       })
+      crudUser.getUserDept().then(res => {
+        this.options = res
+      })
       this.users.forEach(user => {
         if (user.id === userId) {
-          const num=  user.company
+          const num = user.company
         }
       })
-
+    },
+    changeUserList(e) {
+      var tempList = []
+      for (let i = 0; i < e.length; i++) {
+        var temp = e[i]
+        tempList.push(temp[e[i].length - 1])
+      }
+      this.query.userIds = tempList
+    },
+    changeUserListTwo(e) {
+      var tempList = []
+      for (let i = 0; i < e.length; i++) {
+        var temp = e[i]
+        tempList.push(temp[e[i].length - 1])
+      }
+      this.generateForm.nodes = tempList
     },
     // 变更员工
     changeUser(userId) {
@@ -402,12 +434,17 @@
       this.generateForm = { targetYearMonth: null, nodes: [] }
       // 生成表单状态
       this.generateStatus = true
+      // 清空
+      this.selectedValue1 = []
     },
     // 生成表单关闭
     closeGenerate() {
       // 生成表单状态
       this.generateStatus = false
-      this.getDeptDatas({ level: 0 })
+      // 生成表单数据
+      this.generateForm = { targetYearMonth: null, nodes: [] }
+      // 清空
+      this.selectedValue1 = []
       // 清空表单
       this.$refs['generateForm'].clearValidate()
     },
@@ -517,31 +554,6 @@
           this.form.employmentInsuranceCompany = res[0].employmentInsuranceCompany
         }
       })
-    },
-    // 获取部门数据
-    getDeptDatas(node, resolve) {
-      const sort = 'id,desc'
-      const params = { sort: sort }
-      if (node.level !== 0) {
-        crudUser.getByDept(node.level !== 0 ? node.data.id : null).then(res => {
-          if (resolve) {
-            resolve(res)
-          } else {
-            this.deptDatas = res.content
-          }
-        })
-      } else {
-        getDepts(params).then(res => {
-          if (resolve) {
-            resolve(res.content)
-          } else {
-            this.deptDatas = res.content
-          }
-        })
-      }
-    },
-    handleCheckChange(data, status) {
-      this.generateForm.nodes = status.checkedNodes
     }
   }
 }

--
Gitblit v1.9.3