更新补贴发放功能

This commit is contained in:
czx 2021-02-04 17:42:05 +08:00
parent 642f65bab5
commit adaf6abd7b
4 changed files with 61 additions and 26 deletions

View File

@ -58,8 +58,9 @@ public class FtStaffInfoDaoController extends BaseController {
}
@GetMapping("/staffListWithDepart")
public AjaxResult staffListWithDepart(FtStaffInfoDao ftStaffInfoDao) {
return AjaxResult.success(iFtStaffInfoDaoService.selectStaffInfoWithDepart(ftStaffInfoDao));
public TableDataInfo staffListWithDepart(FtStaffInfoDao ftStaffInfoDao) {
startPage();
return getDataTable(iFtStaffInfoDaoService.selectStaffInfoWithDepart(ftStaffInfoDao));
}
/**

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.fantang.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -12,6 +13,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import com.ruoyi.system.fantang.domain.FtStaffSubsidyDao;
import com.ruoyi.system.fantang.domain.FtSubsidyDao;
import com.ruoyi.system.fantang.mapper.FtStaffInfoDaoMapper;
import com.ruoyi.system.fantang.service.IFtStaffInfoDaoService;
import com.ruoyi.system.fantang.service.IFtStaffSubsidyDaoService;
import com.ruoyi.system.fantang.vo.FtStaffSubsidyVo;
import lombok.RequiredArgsConstructor;
@ -19,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* 补贴流水查看Controller
@ -37,6 +37,8 @@ public class FtStaffSubsidyDaoController extends BaseController {
private final IFtStaffSubsidyDaoService iFtStaffSubsidyDaoService;
private final IFtStaffInfoDaoService staffInfoDaoService;
/**
* 查询补贴流水查看列表
*/
@ -120,8 +122,11 @@ public class FtStaffSubsidyDaoController extends BaseController {
public AjaxResult submitGiveOutSubsidy(@RequestBody FtStaffSubsidyVo ftStaffSubsidyVo) {
FtSubsidyDao subsidy = ftStaffSubsidyVo.getSubsidy();
List<FtStaffInfoDao> staffData = ftStaffSubsidyVo.getStaffData();
List<String> noGiveoutList = ftStaffSubsidyVo.getNoGiveoutList();
Date giveOutDate = ftStaffSubsidyVo.getGiveOutDate();
QueryWrapper<FtStaffInfoDao> wrapper = new QueryWrapper<>();
wrapper.notIn("staff_id",noGiveoutList);
List<FtStaffInfoDao> staffData = staffInfoDaoService.list(wrapper);
List<FtStaffSubsidyDao> ftStaffSubsidyDaoList = new ArrayList<>();

View File

@ -20,4 +20,6 @@ public class FtStaffSubsidyVo {
private FtSubsidyDao subsidy;
private List<String> noGiveoutList;
}

View File

@ -130,14 +130,6 @@
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 补贴发放弹出层-->
<el-dialog title="选择发放员工" :visible.sync="showPopupSubsidyGiveOut" width="1000px" align="center">
@ -184,6 +176,7 @@
<template slot-scope="scope">
<el-switch
v-model="scope.row.giveOutFlag"
@change="changeGiveoutFlag(scope.row.staffId, $event)"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="是"
@ -192,6 +185,14 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getAllStaffList"
/>
<br>
<el-button type="primary" @click="submitGiveOut">发放补贴</el-button>
</el-dialog>
@ -232,15 +233,17 @@
<script>
import {addSubsidy, delSubsidy, exportSubsidy, getSubsidy, listSubsidy, updateSubsidy} from "@/api/fantang/subsidy";
import {staffListWithDepart} from "@/api/fantang/staffInfo";
import {staffListWithDepart} from "../../../api/fantang/staffInfo";
import {listDepart} from "@/api/fantang/depart";
import {submitGiveOutSubsidy} from "@/api/fantang/staffSubsidy";
import {submitGiveOutSubsidy} from "../../../api/fantang/staffSubsidy";
export default {
name: "Subsidy",
components: {},
data() {
return {
//
noGiveoutList: [],
giveOutDate: null,
departOptions: [],
staffData: [],
@ -278,6 +281,8 @@ export default {
//
giveOutQueryParams: {
departId: null,
pageNum: 1,
pageSize: 10,
},
//
form: {},
@ -304,6 +309,20 @@ export default {
});
},
methods: {
changeGiveoutFlag(staffId, e) {
// console.log('row:', staffId, 'event:', e);
if (!e) {
if (this.noGiveoutList.find(item => item == staffId)) {
// console.log('find', staffId);
} else {
this.noGiveoutList.push(staffId)
// console.log('Notfind', staffId);
}
} else {
this.noGiveoutList = this.noGiveoutList.filter(item => item != staffId);
}
console.log('this.noGiveoutList',this.noGiveoutList.toString());
},
filterDepart() {
return row.tag === value;
@ -311,7 +330,7 @@ export default {
//
clickSubsidyGiveOut(row) {
this.getAllStaffList();
this.getAllStaffList(this.queryParams);
this.showPopupSubsidyGiveOut = true;
const subsidyId = row.subsidyId
getSubsidy(subsidyId).then(response => {
@ -337,12 +356,17 @@ export default {
},
getAllStaffList() {
staffListWithDepart().then(response => {
this.staffData = response.data;
staffListWithDepart(this.queryParams).then(response => {
this.staffData = response.rows;
this.staffData.forEach(item=> {
if (this.noGiveoutList.find(f=> f == item.staffId) ) {
item.giveOutFlag = false;
}
});
this.total = response.total;
// for (let i = 0; i < this.staffData.length; i++) {
// this.staffData[i].giveOutFlag = true;
// }
console.log('staffData-->', this.staffData);
})
listDepart().then(response => {
this.departOptions = response.rows;
@ -379,16 +403,18 @@ export default {
},
submitGiveOut() {
if (new Date() < this.giveOutDate) {
if (new Date() >= this.giveOutDate) {
let giveOutSubmitData = {
giveOutDate: this.giveOutDate,
staffData: this.staffData,
noGiveoutList: this.noGiveoutList,
subsidy: this.form
}
console.log('submitGiveOutSubsidy:',giveOutSubmitData.staffData)
submitGiveOutSubsidy(giveOutSubmitData).then(res => {
this.msgSuccess("发放成功")
})
});
}else {
this.msgError("发放日期不可小于当前日期")
}
@ -396,9 +422,10 @@ export default {
},
handleGiveOutQueryChange() {
// console.log("change")
staffListWithDepart(this.giveOutQueryParams).then(response => {
this.staffData = response.data;
this.staffData = response.rows;
this.total = response.total;
// for (let i = 0; i < this.staffData.length; i++) {
// this.staffData[i].giveOutFlag = true;
// }