Commit 52a645b4 authored by 耿迪迪's avatar 耿迪迪

服务费用申请

parent 201eeeb2
......@@ -8,6 +8,7 @@ import com.zehong.common.utils.StringUtils;
import com.zehong.framework.web.service.TokenService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
......@@ -88,6 +89,12 @@ public class TAccountController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody TAccount tAccount)
{
TAccount accountInfo = new TAccount();
accountInfo.setDeptId(tAccount.getDeptId());
List<TAccount> existAccount = tAccountService.selectTAccountList(accountInfo);
if(!CollectionUtils.isEmpty(existAccount)){
return AjaxResult.error("部门账户已存在");
}
return toAjax(tAccountService.insertTAccount(tAccount));
}
......
......@@ -118,6 +118,8 @@ public class TPurchase extends BaseEntity
private String purchaseDeptManagerName;
private String purchaseType;
public void setPurchaseId(Long purchaseId)
{
this.purchaseId = purchaseId;
......@@ -278,6 +280,14 @@ public class TPurchase extends BaseEntity
this.purchaseDeptManagerName = purchaseDeptManagerName;
}
public String getPurchaseType() {
return purchaseType;
}
public void setPurchaseType(String purchaseType) {
this.purchaseType = purchaseType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="TPurchase" id="TPurchaseResult">
<result property="purchaseId" column="purchase_id" />
<result property="purchaseDeptId" column="purchase_dept_id" />
<result property="purchaseType" column="purchase_type" />
<result property="handledByUserId" column="handled_by_user_id" />
<result property="purchaseName" column="purchase_name" />
<result property="specifications" column="specifications" />
......@@ -35,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
p.purchase_id,
p.purchase_dept_id,
p.purchase_type,
p.handled_by_user_id,
p.purchase_name,
p.specifications,
......@@ -63,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select (select dept_name from sys_dept where dept_id =purchase_dept_id)purchase_dept_name,
t2.nick_name user_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = t.approved_user_id) approved_user_name,
t.purchase_id, t.handled_by_user_id,t.purchase_dept_id, t.purchase_name, t.specifications, t.model_type, t.application_description, t.user_id, price, count, total, purchase_dept_manager_id, approved_user_id, t.remark, t.create_time, t.is_del, t.update_time, t.purchase_status, t.approved_time from t_purchase t,sys_user t2
t.purchase_id, t.purchase_type,t.handled_by_user_id,t.purchase_dept_id, t.purchase_name, t.specifications, t.model_type, t.application_description, t.user_id, price, count, total, purchase_dept_manager_id, approved_user_id, t.remark, t.create_time, t.is_del, t.update_time, t.purchase_status, t.approved_time from t_purchase t,sys_user t2
<where>
t.user_id=t2.user_id
<if test="purchaseDeptId != null "> and t.purchase_dept_id = #{purchaseDeptId}</if>
......@@ -82,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null and isDel != ''"> and t.is_del = #{isDel}</if>
<if test="purchaseStatus != null and purchaseStatus != ''"> and t.purchase_status = #{purchaseStatus}</if>
<if test="approvedTime != null "> and t.approved_time = #{approvedTime}</if>
<if test="purchaseType != null and purchaseType != ''"> and purchase_type = #{purchaseType}</if>
</where>
</select>
......@@ -95,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="purchaseId != null">purchase_id,</if>
<if test="purchaseDeptId != null">purchase_dept_id,</if>
<if test="purchaseType != null">purchase_type,</if>
<if test="handledByUserId != null">handled_by_user_id,</if>
<if test="purchaseName != null">purchase_name,</if>
<if test="specifications != null">specifications,</if>
......@@ -116,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseId != null">#{purchaseId},</if>
<if test="purchaseDeptId != null">#{purchaseDeptId},</if>
<if test="purchaseType != null">#{purchaseType},</if>
<if test="handledByUserId != null">#{handledByUserId},</if>
<if test="purchaseName != null">#{purchaseName},</if>
<if test="specifications != null">#{specifications},</if>
......@@ -140,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update t_purchase
<trim prefix="SET" suffixOverrides=",">
<if test="purchaseDeptId != null">purchase_dept_id = #{purchaseDeptId},</if>
<if test="purchaseType != null">purchase_type = #{purchaseType},</if>
<if test="handledByUserId != null">handled_by_user_id = #{handledByUserId},</if>
<if test="purchaseName != null">purchase_name = #{purchaseName},</if>
<if test="specifications != null">specifications = #{specifications},</if>
......
......@@ -32,7 +32,7 @@
</el-form-item>
</el-form>
<!--<el-row :gutter="10" class="mb8">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
......@@ -43,7 +43,7 @@
v-hasPermi="['system:account:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<!--<el-col :span="1.5">
<el-button
type="success"
plain
......@@ -76,8 +76,8 @@
v-hasPermi="['system:account:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="accountList">
<el-table-column
......@@ -154,14 +154,25 @@
/>
<!-- 添加或修改账户对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="部门" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入部门" />
</el-form-item>
<el-form-item label="可用金额" prop="ableAmount">
<el-input v-model="form.ableAmount" placeholder="请输入可用金额" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="部门" prop="deptId">
<treeselect
v-model="form.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择部门"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="可用金额" prop="ableAmount">
<el-input v-model="form.ableAmount" type="number" placeholder="请输入可用金额" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
......@@ -455,6 +466,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加账户";
this.getTreeselect();
},
/** 修改按钮操作 */
handleUpdate(row) {
......
<template>
<div class="common">
<el-form label-width="100px">
<el-form-item label="采购名称">{{ purchaseData.purchaseName }}</el-form-item>
<el-form-item label="物品名称">{{ purchaseData.purchaseName }}</el-form-item>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
......
......@@ -80,7 +80,7 @@
this.$emit("getList");
this.$message.success("审核成功!");
if(this.$refs.currentCom.submitSuggestion().purchaseStatus == '3'){
sendNotice({noticeTitle:"您的采购申请被驳回",noticeType:"1",noticeContent:"您的采购申请被驳回",userId:this.purchaseInfo.handledByUserId});
sendNotice({noticeTitle:"您的物品采购申请被驳回",noticeType:"1",noticeContent:"您的物品采购申请被驳回",userId:this.purchaseInfo.handledByUserId});
}
}else{
this.$message.error("审核失败!");
......@@ -94,7 +94,7 @@
this.open = false;
this.$emit("getList");
this.$message.success("提交成功!");
sendNotice({noticeTitle:"您有新采购信息待审批",noticeType:"1",noticeContent:"您有新采购信息待审批",roles:"calculator"})
sendNotice({noticeTitle:"您有新物品采购信息待审批",noticeType:"1",noticeContent:"您有新物品采购信息待审批",roles:"calculator"})
}else{
this.$message.error("提交失败!");
}
......
......@@ -10,10 +10,10 @@
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="采购名称" prop="purchaseName">
<el-form-item label="物品名称" prop="purchaseName">
<el-input
v-model="queryParams.purchaseName"
placeholder="请输入采购名称"
placeholder="请输入物品名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
......@@ -120,7 +120,7 @@
<!--<el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="采购主键" align="center" prop="purchaseId" />-->
<!-- <el-table-column label="采购申请部门" align="center" prop="purchaseDeptName" />-->
<el-table-column label="采购名称" align="center" prop="purchaseName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="物品名称" align="center" prop="purchaseName" :show-overflow-tooltip="true" width="150"/>
<!-- <el-table-column label="规格" align="center" prop="specifications" />-->
<!-- <el-table-column label="型号" align="center" prop="modelType" />-->
<el-table-column label="用途说明" align="center" prop="applicationDescription" :show-overflow-tooltip="true"/>
......@@ -199,8 +199,8 @@
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="24">
<el-form-item label="采购名称" prop="purchaseName">
<el-input v-model="form.purchaseName" placeholder="请输入采购名称" />
<el-form-item label="物品名称" prop="purchaseName">
<el-input v-model="form.purchaseName" placeholder="请输入物品名称" />
</el-form-item>
</el-col>
</el-row>
......@@ -318,6 +318,7 @@ export default {
pageNum: 1,
pageSize: 10,
purchaseDeptId: null,
purchaseType: '0',
purchaseName: null,
specifications: null,
modelType: null,
......@@ -337,7 +338,7 @@ export default {
// 表单校验
rules: {
purchaseName: [
{ required: true, message: "采购名称不能为空", trigger: "blur" },
{ required: true, message: "物品名称不能为空", trigger: "blur" },
],
specifications: [
{ required: true, message: "规格不能为空", trigger: "blur" },
......@@ -467,7 +468,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = "添加外部采购(报销)申请";
this.title = "添加物品采购申请";
},
/** 修改按钮操作 */
handleUpdate(row) {
......@@ -476,7 +477,7 @@ export default {
getPurchase(purchaseId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改外部采购(报销)申请";
this.title = "修改物品采购申请";
});
},
/** 提交按钮 */
......@@ -502,13 +503,13 @@ export default {
},
//通知下一个人
noticeNext(){
sendNotice({noticeTitle:"您有新采购信息待确认",noticeType:"1",noticeContent:"您有新采购信息待确认",
sendNotice({noticeTitle:"您有新物品采购信息待确认",noticeType:"1",noticeContent:"您有新物品采购信息待确认",
deptId:this.$store.state.user.deptId,roles:"deptLeader"})
},
/** 删除按钮操作 */
handleDelete(row) {
const purchaseIds = row.purchaseId || this.ids;
this.$confirm('是否确认删除外部采购(报销)申请编号为"' + row.purchaseName + '"的数据项?', "警告", {
this.$confirm('是否确认删除物品采购申请名称为"' + row.purchaseName + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
......@@ -522,7 +523,7 @@ export default {
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有外部采购(报销)申请数据项?', "警告", {
this.$confirm('是否确认导出所有物品采购申请数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
......
<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 =this.getNowTime();
return param;
},
getNowTime(){
var date = new Date();
var seperator = "-";
var currentdate =date.getFullYear()+seperator+date.getMonth()+seperator+date.getDate() +" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
console.log(currentdate,"currentdate")
return currentdate;
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="common">
<el-form label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="费用名称">{{ purchaseData.purchaseName }}</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-row>
<el-col :span="12">
<el-form-item label="用途">{{ purchaseData.applicationDescription }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报销人">{{ purchaseData.userName }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-form-item label="备注">{{ purchaseData.remark==null?"-":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 style="display: inline-block;margin: 0px 5px">
<el-button type="text" @click="openPurchaseDialog" 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";
import { sendNotice } from "@/api/system/notice";
export default {
name: "operator-button",
components:{
calculate,
confirm,
purchaseDetail
},
props:{
operatorName: {
type: String
},
purchaseInfo: {
type: Object
}
},
created(){
this.currentTabComponent = this.operatorName;
},
data(){
return{
open: false,
currentTabComponent: "",
purchaseData: {}
}
},
methods:{
getOperatorName(){
switch(this.operatorName){
case "purchaseDetail":
return "详情";
case "confirm" :
return "部门长审核";
case "calculate":
return "核算部审批";
default:
return "";
}
},
openPurchaseDialog(){
getPurchase(this.purchaseInfo.purchaseId).then(res =>{
if(res.code == 200){
this.purchaseData = res.data;
this.open = true;
}
})
},
//重置意见
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("审核成功!");
if(this.$refs.currentCom.submitSuggestion().purchaseStatus == '3'){
sendNotice({noticeTitle:"您的服务费用申请被驳回",noticeType:"1",noticeContent:"您的服务费用申请被驳回",userId:this.purchaseInfo.handledByUserId});
}
}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("提交成功!");
sendNotice({noticeTitle:"您有新服务费用信息待审批",noticeType:"1",noticeContent:"您有新服务费用信息待审批",roles:"calculator"})
}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>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="费用名称" prop="purchaseName">
<el-input
v-model="queryParams.purchaseName"
placeholder="请输入费用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用途" prop="applicationDescription">
<el-input
v-model="queryParams.applicationDescription"
placeholder="请输入用途"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报销人" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入报销人"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="采购状态" prop="purchaseStatus">
<el-select v-model="queryParams.purchaseStatus" placeholder="请选择采购状态" clearable size="small">
<el-option
v-for="item in purchaseStatusList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:purchase:add']"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:purchase:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:purchase:remove']"
>删除</el-button>
</el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- :loading="exportLoading"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['system:purchase:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="purchaseList">
<el-table-column label="费用名称" align="center" prop="purchaseName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="金额" align="center" prop="total" />
<el-table-column label="用途" align="center" prop="applicationDescription" :show-overflow-tooltip="true"/>
<el-table-column label="报销人" align="center" prop="userName" />
<el-table-column label="申请时间" align="center" prop="createTime" width="150">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="审批人" align="center" prop="approvedUserName">
<template slot-scope="scope">
<span v-if="scope.row.approvedUserName == null">-</span>
<span v-else>{{scope.row.approvedUserName}}</span>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="purchaseStatus" :formatter="getPurchaseStatus" width="120"/>
<el-table-column label="审核时间" align="center" prop="approvedTime" width="150">
<template slot-scope="scope">
<span v-if="scope.row.approvedUserName == null">-</span>
<span v-else>{{ parseTime(scope.row.approvedTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:purchase:edit']"-->
<!-- >修改</el-button>-->
<OperatorButton
operatorName="purchaseDetail"
:purchaseInfo="scope.row"
@getList="getList"
/>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:purchase:remove']"
v-if="(scope.row.purchaseStatus == '0' || scope.row.purchaseStatus == '3') && scope.row.handledByUserId == $store.state.user.userId"
>删除</el-button>
<OperatorButton
v-for="item in scope.row.operators"
:key="item"
:operatorName="item"
:purchaseInfo="scope.row"
@getList="getList"
/>
</template>
</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="title" :visible.sync="open" width="800px" :close-on-click-modal="false" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="费用名称" prop="purchaseName">
<el-input v-model="form.purchaseName" placeholder="请输入费用名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="金额" prop="total">
<el-input v-model="form.total" type="number" placeholder="请输入金额" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="用途" prop="applicationDescription">
<el-input v-model="form.applicationDescription" placeholder="请输入用途" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="报销人" prop="userId">
<el-select v-model="form.userId" placeholder="请选择报销人" style="width: 100%">
<el-option v-for="item in usersList"
:key="item.userId"
:label="item.nickName"
:value="item.userId"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button
style="width: 150px; border-color: #1890ff; color: #1890ff"
@click="reset"
>内容重置</el-button>
<el-button type="primary" style="width: 150px" @click="submitForm"
>提交申请</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPurchase, getPurchase, delPurchase, addPurchase, updatePurchase, exportPurchase } from "@/api/transaction/purchase";
import { selectTransactorByDeptId } from "@/api/system/user";
import OperatorButton from "./components/OperatorButton";
import { sendNotice } from "@/api/system/notice";
export default {
name: "Purchase",
components: {
OperatorButton
},
data() {
return {
usersList: [],
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 外部采购(报销)申请表格数据
purchaseList: [],
purchaseStatusList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
purchaseDeptId: null,
purchaseType: '1',
purchaseName: null,
applicationDescription: null,
userId: null,
total: null,
purchaseDeptManagerId: null,
approvedUserId: null,
isDel: null,
purchaseStatus: null,
approvedTime: null
},
// 表单参数
form: {},
// 表单校验
rules: {
purchaseName: [
{ required: true, message: "费用名称不能为空", trigger: "blur" },
],
applicationDescription: [
{ required: true, message: "用途不能为空", trigger: "blur" },
],
userId: [
{ required: true, message: "请选择使用人", trigger: "change" },
],
total: [
{ required: true, message: "金额不能为空", trigger: "blur" },
]
}
};
},
created() {
this.getList();
this.getUsers();
this.getPurchaseStatusList();
},
methods: {
getPurchaseStatusList(){
this.getDicts("purchaseStatus").then((response) => {
this.purchaseStatusList = response.data;
});
},
//获取交易状态
getPurchaseStatus(row) {
return this.selectDictLabel(
this.purchaseStatusList,
row.purchaseStatus
);
},
/** 查询外部采购(报销)申请列表 */
getList() {
this.loading = true;
listPurchase(this.queryParams).then(response => {
this.purchaseList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
purchaseId: null,
purchaseDeptId: null,
purchaseName: null,
applicationDescription: null,
userId: null,
total: null,
purchaseDeptManagerId: null,
approvedUserId: null,
remark: null,
createTime: null,
isDel: null,
updateTime: null,
purchaseStatus: "0",
approvedTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.purchaseId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加服务费用申请";
this.form.purchaseType = "1";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const purchaseId = row.purchaseId || this.ids
getPurchase(purchaseId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改服务费用申请";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.purchaseId != null) {
updatePurchase(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPurchase(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
this.noticeNext();
});
}
}
});
},
//通知下一个人
noticeNext(){
sendNotice({noticeTitle:"您有新服务费用信息待确认",noticeType:"1",noticeContent:"您有新服务费用信息待确认",
deptId:this.$store.state.user.deptId,roles:"deptLeader"})
},
/** 删除按钮操作 */
handleDelete(row) {
const purchaseIds = row.purchaseId || this.ids;
this.$confirm('是否确认删除服务费用申请名称为"' + row.purchaseName + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delPurchase(purchaseIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有服务费用申请数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportPurchase(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
getUsers() {
this.form.userId = null;
selectTransactorByDeptId({ deptId: this.$store.state.user.deptId }).then(
(res) => {
this.usersList = res.data;
}
);
}
}
};
</script>
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