Commit 45742500 authored by 吴卿华's avatar 吴卿华

Merge remote-tracking branch 'origin/master'

parents 3e6b4708 0d4ed904
package com.zehong.web.controller.transaction; package com.zehong.web.controller.transaction;
import java.util.List; import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.exception.BusinessException;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.SecurityUtils; import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.ServletUtils; import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.framework.web.service.TokenService; import com.zehong.framework.web.service.TokenService;
import com.zehong.system.service.ITAccountService; import com.zehong.system.domain.TAccount;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TPurchase; import com.zehong.system.domain.TPurchase;
import com.zehong.system.service.ITAccountService;
import com.zehong.system.service.ITPurchaseService; import com.zehong.system.service.ITPurchaseService;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.system.service.impl.purchase.PurchaseOperateStrategy;
import com.zehong.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 外部采购(报销)申请Controller * 外部采购(报销)申请Controller
...@@ -57,9 +54,20 @@ public class TPurchaseController extends BaseController ...@@ -57,9 +54,20 @@ public class TPurchaseController extends BaseController
} }
startPage(); startPage();
List<TPurchase> list = tPurchaseService.selectTPurchaseList(tPurchase); List<TPurchase> list = tPurchaseService.selectTPurchaseList(tPurchase);
setOperate(list);
return getDataTable(list); return getDataTable(list);
} }
/**
* 设置查询权限
* @param purchaseList 采购列表
*/
private void setOperate (List<TPurchase> purchaseList){
purchaseList.stream().forEach(purchase ->{
new PurchaseOperateStrategy().purchaseOperateStrategy(purchase);
});
}
/** /**
* 导出外部采购(报销)申请列表 * 导出外部采购(报销)申请列表
*/ */
...@@ -120,4 +128,18 @@ public class TPurchaseController extends BaseController ...@@ -120,4 +128,18 @@ public class TPurchaseController extends BaseController
{ {
return toAjax(tPurchaseService.deleteTPurchaseByIds(purchaseIds)); return toAjax(tPurchaseService.deleteTPurchaseByIds(purchaseIds));
} }
/**
* 核算部审批
* @param tPurchase
* @return
*/
@PostMapping("/approvalPurchase")
public AjaxResult approvalPurchase(@RequestBody TPurchase tPurchase){
try{
return toAjax(tPurchaseService.approvalPurchase(tPurchase));
}catch (BusinessException e){
return AjaxResult.error(e.getMessage());
}
}
} }
package com.zehong.common.core.exception;
/**
* 业务异常处理
*/
public class BusinessException extends RuntimeException {
/**
* 异常对应的返回码
*/
private int code;
/**
* 异常对应的描述信息
*/
private String message;
private Throwable throwable;
public BusinessException() {
super();
}
public BusinessException(String message) {
super(message);
this.message = message;
}
public BusinessException(Integer code, String message) {
super(message);
this.code = code;
this.message = message;
}
public BusinessException(String message, Throwable cause) {
super(message, cause);
this.message = String.format("%s %s", message, cause.getMessage());
}
public BusinessException(int code, String message, Throwable throwable) {
super(message);
this.code = code;
this.message = message;
this.throwable = throwable;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
@Override public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.zehong.system.domain; package com.zehong.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -106,6 +109,15 @@ public class TPurchase extends BaseEntity ...@@ -106,6 +109,15 @@ public class TPurchase extends BaseEntity
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date approvedTime; private Date approvedTime;
/**
* 操作权限
*/
private List<String> operators = new ArrayList<>();
private String approvedUserName;
private String purchaseDeptManagerName;
public void setPurchaseId(Long purchaseId) public void setPurchaseId(Long purchaseId)
{ {
this.purchaseId = purchaseId; this.purchaseId = purchaseId;
...@@ -242,6 +254,30 @@ public class TPurchase extends BaseEntity ...@@ -242,6 +254,30 @@ public class TPurchase extends BaseEntity
return approvedTime; return approvedTime;
} }
public List<String> getOperators() {
return operators;
}
public void setOperators(List<String> operators) {
this.operators = operators;
}
public String getApprovedUserName() {
return approvedUserName;
}
public void setApprovedUserName(String approvedUserName) {
this.approvedUserName = approvedUserName;
}
public String getPurchaseDeptManagerName() {
return purchaseDeptManagerName;
}
public void setPurchaseDeptManagerName(String purchaseDeptManagerName) {
this.purchaseDeptManagerName = purchaseDeptManagerName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -58,4 +58,6 @@ public interface ITPurchaseService ...@@ -58,4 +58,6 @@ public interface ITPurchaseService
* @return 结果 * @return 结果
*/ */
public int deleteTPurchaseById(Long purchaseId); public int deleteTPurchaseById(Long purchaseId);
int approvalPurchase(TPurchase tPurchase);
} }
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.exception.BusinessException;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils; import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TAccount;
import com.zehong.system.domain.TCashOperate;
import com.zehong.system.mapper.TAccountMapper;
import com.zehong.system.mapper.TCashOperateMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TPurchaseMapper; import com.zehong.system.mapper.TPurchaseMapper;
import com.zehong.system.domain.TPurchase; import com.zehong.system.domain.TPurchase;
import com.zehong.system.service.ITPurchaseService; import com.zehong.system.service.ITPurchaseService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
/** /**
* 外部采购(报销)申请Service业务层处理 * 外部采购(报销)申请Service业务层处理
...@@ -23,6 +34,12 @@ public class TPurchaseServiceImpl implements ITPurchaseService ...@@ -23,6 +34,12 @@ public class TPurchaseServiceImpl implements ITPurchaseService
@Autowired @Autowired
private TPurchaseMapper tPurchaseMapper; private TPurchaseMapper tPurchaseMapper;
@Resource
private TAccountMapper tAccountMapper;
@Resource
private TCashOperateMapper tCashOperateMapper;
/** /**
* 查询外部采购(报销)申请 * 查询外部采购(报销)申请
* *
...@@ -99,4 +116,52 @@ public class TPurchaseServiceImpl implements ITPurchaseService ...@@ -99,4 +116,52 @@ public class TPurchaseServiceImpl implements ITPurchaseService
{ {
return tPurchaseMapper.deleteTPurchaseById(purchaseId); return tPurchaseMapper.deleteTPurchaseById(purchaseId);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public int approvalPurchase(TPurchase tPurchase){
if ("2".equals(tPurchase.getPurchaseStatus())){
//校验及更新可用金额
checkAccount(tPurchase);
//更新操作记录
insertOperateLog(tPurchase);
}
tPurchase.setUpdateTime(DateUtils.getNowDate());
return tPurchaseMapper.updateTPurchase(tPurchase);
}
/**
* 校验部门可用金额
* @param tPurchase 采购信息
* @return
*/
private boolean checkAccount(TPurchase tPurchase){
//更新账户可用金额
TAccount tAccount=new TAccount();
tAccount.setDeptId(tPurchase.getPurchaseDeptId());
List<TAccount> rst= tAccountMapper.selectTAccountList(tAccount);
if(!CollectionUtils.isEmpty(rst)){
TAccount accountInfo = rst.get(0);
if(accountInfo.getAbleAmount().compareTo(tPurchase.getTotal()) == -1){
throw new BusinessException("账户可用金额不足!");
}
accountInfo.setAbleAmount(accountInfo.getAbleAmount().subtract(tPurchase.getTotal()));
tAccountMapper.updateTAccount(accountInfo);
}
return true;
}
/**
* 记录资金变动
* @param tPurchase 采购信息
*/
private void insertOperateLog(TPurchase tPurchase){
TCashOperate operate = new TCashOperate();
operate.setOperateDeptId(tPurchase.getPurchaseDeptId());
operate.setOperateAmount(tPurchase.getTotal());
operate.setOperateTime(new Date());
operate.setRelationDoc(String.valueOf(tPurchase.getPurchaseId()));
operate.setOperateType("4");
tCashOperateMapper.insertTCashOperate(operate);
}
} }
package com.zehong.system.service.impl.purchase;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TPurchase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author geng
* 采购操作权限策略
*/
public class PurchaseOperateStrategy {
private final Map<String,JSONObject> operateMap = new HashMap<String,JSONObject>(){{
put(PurchaseStatus.confirm.getStatus(),new JSONObject(){{
put("deptLeader","confirm");
}});
put(PurchaseStatus.approval.getStatus(),new JSONObject(){{
put("calculator","calculate");
}});
}};
public void purchaseOperateStrategy(TPurchase purchase){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
roles.stream().forEach(item ->{
if(operateMap.containsKey(purchase.getPurchaseStatus())){
String operate = (String) operateMap.get(purchase.getPurchaseStatus()).get(item.getRoleKey());
if(StringUtils.isNotEmpty(operate)){
purchase.getOperators().add(operate);
}
}
});
}
/**
* 采购审核
*/
private enum PurchaseStatus{
confirm("0"),approval("1"),complete("2"),reject("3");
private String status;
public String getStatus() {
return status;
}
PurchaseStatus(String status) {
this.status = status;
}
}
}
...@@ -25,16 +25,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -25,16 +25,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="approvedTime" column="approved_time" /> <result property="approvedTime" column="approved_time" />
<result property="purchaseDeptName" column="purchase_dept_name" /> <result property="purchaseDeptName" column="purchase_dept_name" />
<result property="userName" column="user_name" /> <result property="userName" column="user_name" />
<result property="approvedUserName" column="approved_user_name"/>
<result property="purchaseDeptManagerName" column="purchase_dept_manager_name"/>
</resultMap> </resultMap>
<sql id="selectTPurchaseVo"> <sql id="selectTPurchaseVo">
select purchase_id, purchase_dept_id, purchase_name, specifications, model_type, application_description, user_id, price, count, total, purchase_dept_manager_id, approved_user_id, remark, create_time, is_del, update_time, purchase_status, approved_time from t_purchase SELECT
p.purchase_id,
p.purchase_dept_id,
p.purchase_name,
p.specifications,
p.model_type,
p.application_description,
p.user_id,
p.price,
p.count,
p.total,
p.purchase_dept_manager_id,
p.approved_user_id,
p.remark,
p.create_time,
p.is_del,
p.update_time,
p.purchase_status,
p.approved_time,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.user_id) user_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.approved_user_id) approved_user_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.purchase_dept_manager_id) purchase_dept_manager_name
FROM
t_purchase p
</sql> </sql>
<select id="selectTPurchaseList" parameterType="TPurchase" resultMap="TPurchaseResult"> <select id="selectTPurchaseList" parameterType="TPurchase" resultMap="TPurchaseResult">
select (select dept_name from sys_dept where dept_id =purchase_dept_id)purchase_dept_name, select (select dept_name from sys_dept where dept_id =purchase_dept_id)purchase_dept_name,
(select t1.nick_name from sys_user t1 where t1.user_id=t.user_id )user_name, (select t1.nick_name from sys_user t1 where t1.user_id=t.user_id )user_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = t.approved_user_id) approved_user_name,
purchase_id, purchase_dept_id, purchase_name, specifications, model_type, application_description, user_id, price, count, total, purchase_dept_manager_id, approved_user_id, remark, create_time, is_del, update_time, purchase_status, approved_time from t_purchase t purchase_id, purchase_dept_id, purchase_name, specifications, model_type, application_description, user_id, price, count, total, purchase_dept_manager_id, approved_user_id, remark, create_time, is_del, update_time, purchase_status, approved_time from t_purchase t
<where> <where>
<if test="purchaseDeptId != null "> and purchase_dept_id = #{purchaseDeptId}</if> <if test="purchaseDeptId != null "> and purchase_dept_id = #{purchaseDeptId}</if>
...@@ -56,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -56,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTPurchaseById" parameterType="Long" resultMap="TPurchaseResult"> <select id="selectTPurchaseById" parameterType="Long" resultMap="TPurchaseResult">
<include refid="selectTPurchaseVo"/> <include refid="selectTPurchaseVo"/>
where purchase_id = #{purchaseId} where p.purchase_id = #{purchaseId}
</select> </select>
<insert id="insertTPurchase" parameterType="TPurchase"> <insert id="insertTPurchase" parameterType="TPurchase">
......
...@@ -50,4 +50,12 @@ export function exportPurchase(query) { ...@@ -50,4 +50,12 @@ export function exportPurchase(query) {
method: 'get', method: 'get',
params: query params: query
}) })
} }
\ No newline at end of file
export function approvalPurchase(data) {
return request({
url: '/system/purchase/approvalPurchase',
method: 'post',
data: data
})
}
...@@ -191,6 +191,27 @@ ...@@ -191,6 +191,27 @@
width="800px" width="800px"
append-to-body append-to-body
> >
<el-form :model="queryAccountDetailParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="操作类型" prop="transactionProjectName">
<el-select v-model="queryAccountDetailParams.operateType" placeholder="请选择操作类型" clearable>
<el-option label="收入" value="1"/>
<el-option label="支出" value="2" />
<el-option label="尾款扣除" value="3" />
</el-select>
</el-form-item>
<!-- <el-form-item label="部门" prop="deptId">-->
<!-- <div style="width: 200px">-->
<!-- <treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" :disabled="disabled"/>-->
<!-- </div>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getOperateList">搜索</el-button>
</el-form-item>
</el-form>
<el-table :data="cashOperateList"> <el-table :data="cashOperateList">
<el-table-column label="序号" width="50px" align="center"> <el-table-column label="序号" width="50px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
......
<template>
<div>
<CommonInfo :purchaseData="purchaseData"/>
<div style="margin: 11px 30px;color: #1890ff;">部门长审核</div>
<el-form label-width="100px">
<el-form-item label="审核人">{{ purchaseData.purchaseDeptManagerName }}</el-form-item>
</el-form>
<el-divider></el-divider>
<div style="margin: 11px 30px;color: #1890ff;">核算部审批</div>
<el-row style="margin-left:97px">
<el-col :span="10">
<el-row>
<el-col :span="6">
<el-radio v-model="radio" label="1">通过</el-radio>
</el-col>
<el-col :span="6">
<el-radio v-model="radio" label="2">不通过</el-radio>
</el-col>
</el-row>
</el-col>
<el-col :span="10">
<el-row>
<el-col :span="5">审核人</el-col>
<el-col :span="16"><el-input :value="$store.state.user.nickName" style="width: 90px" disabled/></el-col>
</el-row>
</el-col>
</el-row>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "calculate",
props: {
purchaseData:{
type: Object
}
},
components:{
CommonInfo
},
watch:{
radio(newVal,oldVal){
if(newVal== "1"){
this.purchaseStatus = "2";
}
if(newVal== "2"){
this.purchaseStatus = "3";
}
}
},
data(){
return{
radio: "1",
purchaseStatus: "2"
}
},
methods:{
resetSuggestion(){
this.radio = "1";
},
checkParam(){
return false;
},
submitSuggestion(){
let param = {...this.purchaseData};
param.purchaseStatus = this.purchaseStatus;
param.approvedUserId = this.$store.state.user.userId;
param.approvedTime = new Date();
return param;
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="common">
<el-form label-width="100px">
<el-form-item label="采购名称">{{ purchaseData.purchaseName }}</el-form-item>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="规格">{{ purchaseData.specifications }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="型号">{{ purchaseData.modelType }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-form-item label="用途说明">{{ purchaseData.applicationDescription }}</el-form-item>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="使用人">{{ purchaseData.userName }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价">{{ purchaseData.price }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="数量">{{ purchaseData.count }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价">{{ purchaseData.total }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-form-item label="备注">{{ purchaseData.remark }}</el-form-item>
<el-divider></el-divider>
</el-form>
</div>
</template>
<script>
export default {
name: "common-info",
props: {
purchaseData:{
type: Object
}
},
}
</script>
<style>
.common{
.el-form-item {
margin-bottom: 0px;
}
.el-divider--horizontal {
margin: 5px 0;
}
}
</style>
<style scoped>
</style>
<template>
<div>
<CommonInfo :purchaseData="purchaseData"/>
<el-row style="margin-left:95px">
<el-col :span="8" style="margin-top: 15px">
<el-checkbox v-model="checked">我已知晓</el-checkbox>
</el-col>
<el-col :span="8" style="margin-top: 10px">
<span style="margin: 0px 5px;">审批人</span>
<el-input :value="$store.state.user.nickName" style="width: 130px" disabled/>
</el-col>
</el-row>
<el-divider></el-divider>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "confirm",
props: {
purchaseData:{
type: Object
}
},
components:{
CommonInfo
},
data(){
return{
checked: false
}
},
methods:{
resetSuggestion(){
this.checked = false;
},
checkParam(){
if(!this.checked){
this.$message.error("请勾选须知!");
return true;
}
return false;
},
submitSuggestion(){
return {purchaseId:this.purchaseData.purchaseId,purchaseStatus:"1",purchaseDeptManagerId:this.$store.state.user.userId};
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-button type="text" @click="open=true" size="mini">{{getOperatorName()}}</el-button>
<el-dialog :title="getOperatorName()" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
<component :is="currentTabComponent" :purchaseData="purchaseData" ref="currentCom" v-if="open"></component>
<div slot="footer" class="dialog-footer" style="text-align: center" v-if="operatorName != 'purchaseDetail'">
<el-button style="width: 150px;border-color: #1890ff;color: #1890ff;" @click="resetSuggestion">重置意见</el-button>
<el-button type="primary" style="width: 150px" @click="submitSuggestion">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getPurchase, updatePurchase, approvalPurchase } from "@/api/transaction/purchase";
import calculate from "./Calculate";
import confirm from "./Confirm";
import purchaseDetail from "./PurchaseDetail";
export default {
name: "operator-button",
components:{
calculate,
confirm,
purchaseDetail
},
props:{
operatorName: {
type: String
},
purchaseInfo: {
type: Object
}
},
created(){
this.currentTabComponent = this.operatorName;
},
watch: {
open(newVal,oldVal){
if(newVal){
this.getPurchaseInfo();
}
}
},
data(){
return{
open: false,
currentTabComponent: "",
purchaseData: {}
}
},
methods:{
getOperatorName(){
switch(this.operatorName){
case "purchaseDetail":
return "详情";
case "confirm" :
return "部门长审核";
case "calculate":
return "核算部审批";
default:
return "";
}
},
getPurchaseInfo(){
getPurchase(this.purchaseInfo.purchaseId).then(res =>{
if(res.code == 200){
this.purchaseData = res.data;
}
})
},
//重置意见
resetSuggestion(){
this.$refs.currentCom.resetSuggestion();
},
//提交
submitSuggestion(){
if(this.$refs.currentCom.checkParam()){
return;
}
if("calculate" == this.operatorName){
approvalPurchase(this.$refs.currentCom.submitSuggestion()).then(res =>{
if(res.code == 200){
this.open = false;
this.$emit("getList");
this.$message.success("审核成功!");
}else{
this.$message.error("审核失败!");
}
});
return;
}
updatePurchase(this.$refs.currentCom.submitSuggestion()).then(res =>{
if(res.code == 200){
this.open = false;
this.$emit("getList");
this.$message.success("提交成功!");
}else{
this.$message.error("提交失败!");
}
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="detail">
<CommonInfo :purchaseData="purchaseData"/>
<div v-if="purchaseData.purchaseStatus > 0">
<div style="margin: 11px 30px;color: #1890ff;">部门长审核</div>
<el-form label-width="100px">
<el-form-item label="审核人">{{ purchaseData.purchaseDeptManagerName }}</el-form-item>
</el-form>
<el-divider></el-divider>
<div v-if="purchaseData.purchaseStatus > 1">
<div style="margin: 11px 30px;color: #1890ff;">核算部审批</div>
<el-form label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item>
<el-radio v-model="this.purchaseData.purchaseStatus =='2'?radio ='1':radio='2'" label="1" disabled>通过</el-radio>
<el-radio v-model="radio" label="2" disabled>不通过</el-radio>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核人">{{purchaseData.approvedUserName}}</el-form-item>
</el-col>
<el-col :span="8"></el-col>
</el-row>
</el-form>
<el-divider></el-divider>
</div>
</div>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "purchase-detail",
props: {
purchaseData:{
type: Object
}
},
components:{
CommonInfo
}
}
</script>
<style scoped lang="scss">
.detail{
height: 460px;
overflow-y: auto;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
</style>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<!-- v-hasPermi="['system:purchase:edit']"--> <!-- v-hasPermi="['system:purchase:edit']"-->
<!-- >修改</el-button>--> <!-- >修改</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:purchase:remove']" v-hasPermi="['system:purchase:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>-->
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="warning"--> <!-- type="warning"-->
...@@ -116,8 +116,8 @@ ...@@ -116,8 +116,8 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="purchaseList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="purchaseList">
<el-table-column type="selection" width="55" align="center" /> <!--<el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="采购主键" align="center" prop="purchaseId" />--> <!-- <el-table-column label="采购主键" align="center" prop="purchaseId" />-->
<!-- <el-table-column label="采购申请部门" align="center" prop="purchaseDeptName" />--> <!-- <el-table-column label="采购申请部门" align="center" prop="purchaseDeptName" />-->
<el-table-column label="采购名称" align="center" prop="purchaseName" /> <el-table-column label="采购名称" align="center" prop="purchaseName" />
...@@ -128,17 +128,17 @@ ...@@ -128,17 +128,17 @@
<el-table-column label="单价" align="center" prop="price" /> <el-table-column label="单价" align="center" prop="price" />
<el-table-column label="数量" align="center" prop="count" /> <el-table-column label="数量" align="center" prop="count" />
<el-table-column label="总价" align="center" prop="total" /> <el-table-column label="总价" align="center" prop="total" />
<el-table-column label="申请时间" align="center" prop="createTime" width="110"> <el-table-column label="申请时间" align="center" prop="createTime" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <!-- <el-table-column label="备注" align="center" prop="remark" />-->
<el-table-column label="审批人" align="center" prop="approvedUserId" /> <el-table-column label="审批人" align="center" prop="approvedUserName" />
<el-table-column label="审批状态" align="center" prop="purchaseStatus" :formatter="getPurchaseStatus"/> <el-table-column label="审批状态" align="center" prop="purchaseStatus" :formatter="getPurchaseStatus" width="120"/>
<el-table-column label="审核时间" align="center" prop="approvedTime" width="180"> <el-table-column label="审核时间" align="center" prop="approvedTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.approvedTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.approvedTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
...@@ -150,6 +150,11 @@ ...@@ -150,6 +150,11 @@
<!-- @click="handleUpdate(scope.row)"--> <!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:purchase:edit']"--> <!-- v-hasPermi="['system:purchase:edit']"-->
<!-- >修改</el-button>--> <!-- >修改</el-button>-->
<OperatorButton
operatorName="purchaseDetail"
:purchaseInfo="scope.row"
@getList="getList"
/>
<el-button <el-button
size="mini" size="mini"
...@@ -157,7 +162,15 @@ ...@@ -157,7 +162,15 @@
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:purchase:remove']" v-hasPermi="['system:purchase:remove']"
v-if="(scope.row.purchaseStatus == '0' || scope.row.purchaseStatus == '3') && scope.row.applyId == $store.state.user.userId"
>删除</el-button> >删除</el-button>
<OperatorButton
v-for="item in scope.row.operators"
:key="item"
:operatorName="item"
:purchaseInfo="scope.row"
@getList="getList"
/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -263,10 +276,11 @@ ...@@ -263,10 +276,11 @@
<script> <script>
import { listPurchase, getPurchase, delPurchase, addPurchase, updatePurchase, exportPurchase } from "@/api/transaction/purchase"; import { listPurchase, getPurchase, delPurchase, addPurchase, updatePurchase, exportPurchase } from "@/api/transaction/purchase";
import { selectTransactorByDeptId } from "@/api/system/user"; import { selectTransactorByDeptId } from "@/api/system/user";
import OperatorButton from "./components/OperatorButton";
export default { export default {
name: "Purchase", name: "Purchase",
components: { components: {
OperatorButton
}, },
data() { data() {
return { return {
......
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
} }
}, },
methods:{ methods:{
resetSuggestion(){
this.radio = "1";
},
checkParam(){ checkParam(){
return false; return false;
}, },
......
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
} }
}, },
methods:{ methods:{
resetSuggestion(){
this.checked = false;
},
checkParam(){ checkParam(){
if(!this.checked){ if(!this.checked){
this.$message.error("请勾选须知!"); this.$message.error("请勾选须知!");
......
...@@ -35,7 +35,13 @@ ...@@ -35,7 +35,13 @@
}, },
created(){ created(){
this.currentTabComponent = this.operatorName; this.currentTabComponent = this.operatorName;
this.getTradeInfo(); },
watch: {
open(newVal,oldVal){
if(newVal){
this.getTradeInfo();
}
}
}, },
data(){ data(){
return{ return{
...@@ -82,7 +88,7 @@ ...@@ -82,7 +88,7 @@
this.$emit("getList"); this.$emit("getList");
this.$message.success("复核成功!"); this.$message.success("复核成功!");
}else{ }else{
this.$message.success("复核失败!"); this.$message.error("复核失败!");
} }
}) })
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment