| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | projectReimburseService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @PostMapping(value = "/batchApprove") |
| | | @Log("批量审核报销") |
| | | @ApiOperation("批量审核功能") |
| | | @PreAuthorize("@el.check('projectReimburse:approve')") |
| | | public ResponseEntity<Object> batchApproveProjectReimburse(@RequestParam(value = "type") String type, @RequestParam(value = "ids") List<Long> ids, @RequestParam(value = "reason") String reason) { |
| | | projectReimburseService.batchUpdateApprove(type, ids, reason); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| | |
| | | * @param resources / |
| | | */ |
| | | void updateApprove(ProjectReimburse resources); |
| | | |
| | | /** |
| | | * 批量审核报销 |
| | | * @param type / |
| | | * @param ids / |
| | | */ |
| | | void batchUpdateApprove(String type, List<Long> ids, String reason); |
| | | } |
| | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectReimburse; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.system.domain.Dict; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateApprove(ProjectReimburse resources) { |
| | | ProjectReimburse projectReimburse = projectReimburseRepository.findById(resources.getId()).orElseGet(ProjectReimburse::new); |
| | | ValidationUtil.isNull( projectReimburse.getId(),"ProjectReimburse","id",resources.getId()); |
| | | projectReimburse.copy(resources); |
| | | projectReimburseRepository.save(projectReimburse); |
| | | } |
| | | |
| | | /** |
| | | * 批量审核报销 |
| | | * |
| | | * @param type / |
| | | * @param ids / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void batchUpdateApprove(String type, List<Long> ids, String reason) { |
| | | if (type.equals(Constant.REIMBURSE_APPROVE_STATUS_AGREE) || type.equals(Constant.REIMBURSE_APPROVE_STATUS_REFUSE)) { |
| | | for (Long id : ids) { |
| | | ProjectReimburse projectReimburse = projectReimburseRepository.findById(id).orElseGet(ProjectReimburse::new); |
| | | ValidationUtil.isNull(projectReimburse.getId(), "ProjectReimburse", "id", id); |
| | | projectReimburse.setApprovalStatus(type); |
| | | if (type.equals(Constant.REIMBURSE_APPROVE_STATUS_REFUSE) && StringUtils.isNotBlank(reason)) { |
| | | projectReimburse.setApprovalDescription(Optional.ofNullable(projectReimburse.getApprovalDescription()).orElse("").concat(" ").concat(reason).trim()); |
| | | } |
| | | projectReimburseRepository.save(projectReimburse); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import request from '@/utils/request' |
| | | import qs from 'qs' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, approve } |
| | | export function batchApprove(params) { |
| | | return request({ |
| | | url: 'api/projectReimburse/batchApprove' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'post' |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, approve, batchApprove } |
| | |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!-- 如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right' --> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-circle-check" |
| | | :disabled="crud.selections.length < 1 || !crud.selections.every(item => item.approvalStatus === dictReimburseApproveStatusReviewed)" |
| | | style="margin-left: 4px !important;" |
| | | @click="batchApprove(1, crud.selections)" |
| | | > |
| | | 批量同意 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-error" |
| | | :disabled="crud.selections.length < 1 || !crud.selections.every(item => item.approvalStatus === dictReimburseApproveStatusReviewed)" |
| | | style="margin-left: 4px !important;" |
| | | @click="batchApprove(2, crud.selections)" |
| | | > |
| | | 批量拒绝 |
| | | </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"> |
| | |
| | | that.$refs[`popover_${id}`].showPopper = false |
| | | }, |
| | | |
| | | // 取消撤销 |
| | | // 执行撤销 |
| | | handleRevoke(data) { |
| | | const that = this |
| | | |
| | |
| | | that.approveModal.visible = false |
| | | }, |
| | | |
| | | // 批量审核 |
| | | batchApprove(type, data) { |
| | | const that = this |
| | | |
| | | const msg = type === 2 ? '批量拒绝' : '批量同意' |
| | | const msgType = type === 2 ? 'error' : 'success' |
| | | const msgConfig = type === 2 ? { |
| | | showInput: true, |
| | | inputValidator: (val) => { |
| | | return val !== null && val.trim() !== '' |
| | | }, |
| | | inputErrorMessage: '请输入拒绝原因' |
| | | } : { |
| | | showInput: false |
| | | } |
| | | // 确认框 |
| | | that.$prompt('此操作将' + msg + '审核内容是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: msgType, |
| | | ...msgConfig |
| | | }).then(reasonVal => { |
| | | const ids = [] |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | if (data[i].wecomSpNo) { |
| | | continue |
| | | } |
| | | ids.push(data[i].id) |
| | | } |
| | | const paramType = type === 2 ? that.dictReimburseApproveStatusRefuse : that.dictReimburseApproveStatusAgree |
| | | that.crud.crudMethod.batchApprove({ type: paramType, ids: ids, reason: reasonVal.value ? reasonVal.value.trim() : undefined }).then(res => { |
| | | // 消息提示 |
| | | that.$message({ |
| | | type: 'success', |
| | | message: msg + '!' |
| | | }) |
| | | // 刷新数据 |
| | | that.crud.refresh() |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | // 获取文件信息 |
| | | getFileInfo(info) { |
| | | const that = this |