This commit is contained in:
cun-nan 2024-10-29 17:29:49 +08:00
parent e76741bb13
commit 9bd50d00d5
7 changed files with 377 additions and 206 deletions

View File

@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/dev-api'
VUE_APP_PUBLIC_PATH = '/'
# 后端接口地址
VUE_APP_SERVER_URL = 'http://192.168.31.178:8080/'
VUE_APP_SERVER_URL = 'http://192.168.31.96:8080/'
# http://192.168.0.121:8080/

View File

@ -1,227 +1,92 @@
<template>
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="" prop="orderNumber">
<el-input v-model="queryParams.orderNumber" placeholder="业务单号" />
</el-form-item>
<el-form-item label="" v-model="queryParams.supplierId" prop="status">
<el-select
v-model="queryParams.supplierId"
placeholder="供应商"
clearable
style="width: 230px"
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="" v-model="queryParams.approvalStatus" prop="status">
<el-select v-model="queryParams.approvalStatus" placeholder="状态" style="150px" clearable>
<el-option
v-for="dict in dict.type.oilPurchasedStatus"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="日期选择" prop="status">
<el-date-picker
v-model="queryParams.dateRange"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item> -->
<el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="detailsAdd"
v-hasPermi="['convenienceStore:purchase:index:add']"
>新增采购订单</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="purchaseList"
:default-sort="defaultSort">
<el-table-column label="业务单号" align="center" prop="orderNumber"/>
<el-table-column label="供应商" align="center" prop="supplierName"/>
<el-table-column label="商品数量" align="center" prop="productQuantity"/>
<el-table-column label="单据金额" align="center" prop="totalAmount"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if ="scope.row.approvalStatus == 'await'" size="medium">待审核</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'qrts'" type="success" size="medium">已审核入库</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'yzf'" type="danger" size="medium">已作废</el-tag>
<el-tag v-if ="scope.row.approvalStatus == 'ysh'" type="success" size="medium">已审核</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="制单人" align="center" prop="createByName"/>
<el-table-column label="制单日期" align="center" prop="orderDate" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate) }}</span>
</template>
</el-table-column>
<el-table-column label="审核人" align="center" prop="approverName"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="dispose(scope.row)"
>
{{ scope.row.approvalStatus == 'qrts'?'查看单据':'处理单据' }}
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<div class="container">
<div class="tab-box">
<div class="f-box" v-for="(item,index) in tabList" :key="index" @click="activeIndex=index" :class="{ 'active' :activeIndex==index}">{{item.name}}</div>
</div>
<purchase v-if="activeIndex == '0'"></purchase>
<returns v-if="activeIndex == '1'"></returns>
</div>
</template>
<script>
import {delInventoryApi, getInventoryApi} from "@/api/oilConfig/oilInventory";
import {getPurchasePageApi} from "@/api/convenienceStore/purchase";
import {listSupplier} from "@/api/convenienceStore/supplier";
import purchase from "@/views/convenienceStore/purchase/purchase.vue";
import returns from "@/views/convenienceStore/returns/index.vue";
export default {
name: "index",
dicts: ['oilPurchasedStatus'],
data() {
return {
purchaseList:[],
//
supplierList:[],
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
orderNumber: "",
approvalStatus: "",
status: '',
supplierId: '',
dateRange: '',
page: null,
pageSize: null,
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
radio1: '商品列表',
activeIndex: 0,
tabList: [
{
name: '采购进货',
},
{
name: '采购退货',
},
]
}
},
async created() {
await this.getList();
this.getQueryList();
components: {
purchase,
returns
},
methods: {
//
getList(){
this.loading = true;
getPurchasePageApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.purchaseList = response.data.records;
this.total = response.data.total;
})
this.loading = false;
},
//
getQueryList(){
// selectTree().then(response => {
// this.cvsGoodList = response.data.records
// });
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
detailsAdd() {
this.$router.push({
name:'purchase-details',
});
},
//
dispose(data) {
this.$router.push({
name: 'purchase-details',
params: {
PpurchaseId: data.id,
PorderNumber: data.orderNumber,
PorderDate: data.orderDate,
PapprovalStatus: data.approvalStatus
},
});
},
//
resetQuery() {
this.queryParams = {}
this.getList()
},
//
handleDel(data) {
delInventoryApi(data).then(response => {
this.$modal.msgSuccess("删除成功");
this.getList();
})
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
handleClick(tab, event) {
console.log(tab, event);
}
}
}
</script>
<style scoped lang="scss">
.app-container{
.app-center {
width: 100%;
height: 100%;
background: #f6f8f9;
box-sizing: border-box;
padding: 10px;
}
.app-top {
width: 100%;
margin-bottom: 20px;
height: 60px;
box-sizing: border-box;
}
.tab-box {
width: 100%;
background: #fff;
display: flex;
box-sizing: border-box;
padding: 0px 50px;
}
.f-box {
height: 40px;
color: #999999;
margin-right: 50px;
display: flex;
align-items: center;
}
.active {
color: #FF9655 !important;
border-bottom: 2px solid #FF9655 !important;
}
.container {
background: #F4F5F9;
box-sizing: border-box;
//padding: 20px;
}
.tabder-box {
width: 85%;
}
</style>

View File

@ -0,0 +1,259 @@
<template>
<div class="app-container">
<div class="card-change">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="orderNumber">
<el-input v-model="queryParams.orderNumber" placeholder="请输入进货单号"/>
</el-form-item>
<el-form-item label="" v-model="queryParams.supplierId" prop="status">
<el-select
v-model="queryParams.supplierId"
placeholder="请选择供应商"
clearable
style="width: 230px"
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="" v-model="queryParams.approvalStatus" prop="status">
<el-select v-model="queryParams.approvalStatus" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.oilPurchasedStatus"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="">
<el-date-picker
v-model="beginTime"
style="width: 160px"
type="date"
placeholder="开始日期">
</el-date-picker>
<el-date-picker
v-model="endTime"
style="width: 160px"
type="date"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button
type="primary"
@click="detailsAdd"
v-hasPermi="['convenienceStore:purchase:index:add']"
>新增进货订单
</el-button>
</el-form-item>
</el-form>
<div style="height: 71vh;overflow: auto">
<el-table ref="tables" border
v-loading="loading"
:data="purchaseList"
:default-sort="defaultSort">
<el-table-column label="序号" align="center" type="index" width="60"/>
<el-table-column label="进货单号" align="center" prop="orderNumber"/>
<el-table-column label="供应商" align="center" prop="supplierName"/>
<el-table-column label="商品数量" align="center" prop="productQuantity"/>
<el-table-column label="单据金额" align="center" prop="totalAmount"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<div style="color: #FF9655" v-if="scope.row.approvalStatus == 'await'">待审核</div>
<div style="color: #0DC291" v-if="scope.row.approvalStatus == 'qrts'" >已审核入库</div>
<div style="color: #F44522" v-if="scope.row.approvalStatus == 'yzf'" >已作废</div>
<div style="color: #409EFF" v-if="scope.row.approvalStatus == 'ysh'" >已审核</div>
</div>
</template>
</el-table-column>
<el-table-column label="制单人" align="center" prop="createByName"/>
<el-table-column label="审核人" align="center" prop="approverName"/>
<el-table-column label="入库人" align="center" prop="storageName"/>
<el-table-column label="制单日期" align="center" prop="orderDate" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate) }}</span>
</template>
</el-table-column>
<el-table-column label="审核日期" align="center" prop="examineTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.examineTime) }}</span>
</template>
</el-table-column>
<el-table-column label="入库时间" align="center" prop="storageTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.storageTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
v-if="scope.row.approvalStatus == 'ysh'"
@click="dispose(scope.row)">
商品入库
</el-button>
<el-button
size="mini"
type="text"
v-else-if="scope.row.approvalStatus == 'await'"
@click="dispose(scope.row)">
采购审核
</el-button>
<el-button
size="mini"
type="text"
v-else
@click="dispose(scope.row)">
查看详情
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</div>
</template>
<script>
import {delInventoryApi, getInventoryApi} from "@/api/oilConfig/oilInventory";
import {getPurchasePageApi} from "@/api/convenienceStore/purchase";
import {listSupplier} from "@/api/convenienceStore/supplier";
export default {
name: "index",
dicts: ['oilPurchasedStatus'],
data() {
return {
purchaseList: [],
//
supplierList: [],
//
title: '',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
orderNumber: "",
approvalStatus: "",
status: '',
supplierId: '',
dateRange: '',
page: null,
pageSize: null,
},
beginTime: "",
endTime: "",
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
}
},
async created() {
await this.getList();
this.getQueryList();
},
methods: {
//
getList() {
this.loading = true;
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
getPurchasePageApi(this.addDateRange(this.queryParams, dateRange)).then(response => {
this.purchaseList = response.data.records;
this.total = response.data.total;
})
this.loading = false;
},
//
getQueryList() {
// selectTree().then(response => {
// this.cvsGoodList = response.data.records
// });
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
detailsAdd() {
this.$router.push({
name: 'purchase-details',
});
},
//
dispose(data) {
this.$router.push({
name: 'purchase-details',
params: {
PpurchaseId: data.id,
PorderNumber: data.orderNumber,
PorderDate: data.orderDate,
PapprovalStatus: data.approvalStatus
},
});
},
//
resetQuery() {
this.queryParams = {}
this.beginTime = ''
this.endTime = ''
this.getList()
},
//
handleDel(data) {
delInventoryApi(data).then(response => {
this.$modal.msgSuccess("删除成功");
this.getList();
})
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
}
}
</script>
<style scoped lang="scss">
.app-container {
width: 100%;
height: 100%;
background: #f6f8f9;
}
</style>

View File

@ -37,6 +37,10 @@ public class MtPurchase extends BaseEntity {
* 审核人
*/
private String approver;
/**
* 入库人
*/
private String storage;
private String status;
/**
* 总金额
@ -54,6 +58,16 @@ public class MtPurchase extends BaseEntity {
* 店铺ID
*/
private Integer storeId;
/**
* 审核时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date examineTime;
/**
* 入库时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date storageTime;
}

View File

@ -129,8 +129,11 @@
mp.product_quantity productQuantity,
mp.approval_status approvalStatus,
mp.order_date orderDate,
mp.examine_time examineTime,
mp.storage_time storageTime,
ms1.real_name createByName,
ms2.real_name approverName,
ms3.real_name storageName,
mp.create_time createTime
FROM
mt_purchase mp
@ -138,6 +141,7 @@
left join mt_goods mg ON mg.id = mpd.goods_id
LEFT JOIN mt_staff ms1 ON mp.create_by = ms1.id
LEFT JOIN mt_staff ms2 ON mp.approver = ms2.id
LEFT JOIN mt_staff ms3 ON mp.storage = ms3.id
<where>
mp.store_id = #{mtPurchase.storeId}
<if test="mtPurchase.approvalStatus != null and mtPurchase.approvalStatus != ''">
@ -150,6 +154,12 @@
<if test="mtPurchase.supplierId != null">
and mg.supplier_id = #{mtPurchase.supplierId}
</if>
<if test="mtPurchase.params.beginTime != null and mtPurchase.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(mp.order_date,'%y%m%d') &gt;= date_format(#{mtPurchase.params.beginTime},'%y%m%d')
</if>
<if test="mtPurchase.params.endTime != null and mtPurchase.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(mp.order_date,'%y%m%d') &lt;= date_format(#{mtPurchase.params.endTime},'%y%m%d')
</if>
</where>
GROUP BY
mp.id
@ -219,6 +229,9 @@
<if test="approver != null and approver != ''">
approver = #{approver},
</if>
<if test="storage != null and storage != ''">
storage = #{storage},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount},
</if>
@ -231,6 +244,12 @@
<if test="storeId != null">
store_id = #{storeId},
</if>
<if test="examineTime != null">
examine_time = #{examineTime},
</if>
<if test="storageTime != null">
storage_time = #{storageTime},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>

View File

@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static java.math.RoundingMode.HALF_DOWN;
@ -239,7 +240,7 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
}
// 2.将数据填充到
String status = "qrts";
boolean edit = edit(id);
boolean edit = edit1(id);
int i = mtPurchaseDao.editStateById(id, status);
return true;
}
@ -253,6 +254,18 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
MtPurchase mtPurchase = new MtPurchase();
mtPurchase.setApprover(nowAccountInfo.getStaffId().toString());
mtPurchase.setExamineTime(new Date());
mtPurchase.setId(id);
int update = mtPurchaseDao.update(mtPurchase);
return update>0;
}
// 修改入库人
public boolean edit1(Integer id){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
MtPurchase mtPurchase = new MtPurchase();
mtPurchase.setStorage(nowAccountInfo.getStaffId().toString());
mtPurchase.setStorageTime(new Date());
mtPurchase.setId(id);
int update = mtPurchaseDao.update(mtPurchase);
return update>0;

View File

@ -7,6 +7,7 @@ import lombok.Data;
public class MtPurchaseVO extends MtPurchase {
private String createByName;
private String approverName;
private String storageName;
private String supplierName;
private Integer detailsId;
private Integer supplierId;