Browse Source

完善问题

master
djz236@163.com 2 years ago
parent
commit
97853696b5
  1. 1
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Location.java
  2. 9
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/api/InStoreHouseMainDto.java
  3. 13
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java
  4. 29
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java
  5. 2
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationService.java
  6. 5
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java
  7. 31
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java
  8. 5
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java
  9. 2
      warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml
  10. 8
      warehousing-system/project/wh-manage/src/main/resources/mappers/PurchasenewMapper.xml
  11. 423
      warehousing-system/project_web_ui/src/views/component/initial_value/add/locationAdd.vue
  12. 948
      warehousing-system/project_web_ui/src/views/component/instorehouse/add/purchaseAdd.vue

1
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Location.java

@ -18,4 +18,5 @@ public class Location {
private String type; //货位类型
private String status; //货位状态
private String storehouse; //所属仓库
private String storehouseid;
}

9
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/api/InStoreHouseMainDto.java

@ -24,6 +24,15 @@ public class InStoreHouseMainDto {
private String approvedRemark; // varchar 50
private List<InStorehouseListing> list;
private String purchaseSid;//采购申请单的sid
private String locationId;
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public String getNo() {
return no;

13
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java

@ -3,9 +3,12 @@ package com.wh.controller.initial;
import com.wh.pojo.Location;
import com.wh.pojo.LocationType;
import com.wh.pojo.Storehouse;
import com.wh.pojo.shstorehouse.ShStorehouse;
import com.wh.service.initial.LocationService;
import com.wh.service.shstorehouse.ShStorehouseService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -18,6 +21,8 @@ public class LocationController {
@Autowired
private LocationService locationService;
@Autowired
private ShStorehouseService shStorehouseService;
@GetMapping("list")
public SysResult getLocationList(PageResult pageResult){
@ -27,6 +32,14 @@ public class LocationController {
@PostMapping("addLocation")
public SysResult addLocation(@RequestBody Location location){
if(StringUtils.isBlank(location.getStorehouseid())){
return SysResult.fail();
}
ShStorehouse shStorehouse = shStorehouseService.fetchBySid(location.getStorehouseid());
if(shStorehouse==null){
return SysResult.fail();
}
location.setStorehouse(shStorehouse.getName());
locationService.addLocation(location);
return SysResult.success();
}

29
warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java

@ -20,6 +20,7 @@ import com.wh.pojo.purchasenewproduct.PurchasenewProduct;
import com.wh.pojo.purchasenewproduct.PurchasenewProductDto;
import com.wh.pojo.purchasenewproduct.PurchasenewProductVo;
import com.wh.service.api.prodstock.ProdStockService;
import com.wh.service.initial.LocationService;
import com.wh.service.purchasenew.PurchasenewService;
import com.wh.service.purchasenewproduct.PurchasenewProductService;
import com.yxt.common.base.service.MybatisBaseService;
@ -35,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -49,6 +51,8 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
@Autowired
private ProdStockService prodStockService;
@Autowired
private LocationService locationService;
@Autowired
private LocationMapper locationMapper;
@Autowired
private PurchasenewService purchasenewService;
@ -64,7 +68,10 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
if(StringUtils.isBlank(inStoreHouseMainDto.getNo())){
return r.setMsg("申请单编号不能为空");
}
if(StringUtils.isBlank(inStoreHouseMainDto.getLocationId())){
return r.setMsg("货位不能为空");
}
Location location = locationService.getLocationById(inStoreHouseMainDto.getLocationId());
QueryWrapper<Purchasenew> purchasenewWrapper = new QueryWrapper<>();
purchasenewWrapper.eq("purchase_no",inStoreHouseMainDto.getNo());
List<Purchasenew> list1 = purchasenewService.list(purchasenewWrapper);
@ -87,6 +94,9 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
for (PurchasenewProductVo purchasenewProductVo : purchasenewProductVos) {
PurchasenewProductDto d=new PurchasenewProductDto();
BeanUtil.copyProperties(purchasenewProductVo,d);
d.setStoreHouseName(location.getStorehouse());
d.setStoreHouseSid(location.getStorehouseid());
d.setLocationNumber(location.getName());
products.add(d);
}
dto.setProducts(products);
@ -113,7 +123,7 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
//申请单主表信息
baseMapper.insert(in);
addListing(in, list);
purchasenewService.updateStateToInputBySid(in.getPurchaseSid());
//purchasenewService.updateStateToInputBySid(in.getPurchaseSid());
return ResultBean.fireSuccess().setMsg("添加成功");
}
@ -192,8 +202,12 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
if(com.yxt.common.base.utils.StringUtils.isBlank(num)){
// log.info("{}",l.getProName()+"商品数量不能为空");
}
int i=Integer.valueOf(num)+Integer.valueOf(l.getNum());
prodStock.setNum(i+"");
BigDecimal i=new BigDecimal(num).add(new BigDecimal(l.getNum()));
prodStock.setNum(l.getNum());
prodStock.setStoreHouseName(l.getStoreHouseName());
prodStock.setStoreHouseSid(l.getStoreHouseSid());
// TODO 当系统调试通后需要做修改 将下一行代码注释去掉
// prodStock.setNum(i.toString());
prodStockService.updateById(prodStock);
}
@ -238,6 +252,7 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
stockQuery.setProModel(l.getProModel());
stockQuery.setProName(l.getProName());
stockQuery.setProSid(l.getProSid());
stockQuery.setStoreHouseSid(l.getStoreHouseSid());
pq.setParams(stockQuery);
PagerVo<ProdStock> proStocks = prodStockService.getProStocks(pq);
return proStocks;
@ -323,9 +338,9 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
public ResultBean deleteByMainSid(String sid){
ResultBean<Object> r = ResultBean.fireFail();
List<InStorehouseListing> inStorehouseListings = inStorehouseListingService.selectInStorehouseListingsByMainSid(sid);
inStorehouseListings.forEach(i->{
prodStockService.reduceNumByProdSidAndCustSid(i.getProSid(), i.getCusterSid(),i.getNum());
});
// inStorehouseListings.forEach(i->{
// prodStockService.reduceNumByProdSidAndCustSid(i.getProSid(), i.getCusterSid(),i.getNum());
// });
inStorehouseListingService.deleteByMainSid(sid);
Map<String,Object> params=new HashMap<>();
params.put("sid",sid);

2
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationService.java

@ -15,7 +15,7 @@ public interface LocationService {
void updataLocation(Location location);
void deleteLocation(String name);
Location getLocationById(String id);
List<Storehouse> getStorehouse();
List<LocationType> getType();

5
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java

@ -54,6 +54,11 @@ public class LocationServiceImpl implements LocationService{
locationMapper.deleteById(name);
}
@Override
public Location getLocationById(String id) {
return locationMapper.selectById(id);
}
@Override
public List<Storehouse> getStorehouse() {
return storehouseMapper.selectList(null);

31
warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java

@ -5,12 +5,15 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.wh.feign.enterpriseinformation.WhEnterpriseInformationFeign;
import com.wh.feign.enterpriseinformation.WhEnterpriseInformationVo;
import com.wh.mapper.purchasenew.PurchasenewMapper;
import com.wh.pojo.purchasenew.*;
import com.wh.pojo.purchasenewproduct.PurchasenewProduct;
import com.wh.pojo.purchasenewproduct.PurchasenewProductDto;
import com.wh.pojo.purchasenewproduct.PurchasenewProductVo;
import com.wh.service.api.instorehouse.InStorehouseMainService;
import com.wh.service.api.prodstock.ProdStockService;
import com.wh.service.purchasenewproduct.PurchasenewProductService;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
@ -31,7 +34,11 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Autowired
private PurchasenewProductService purchasenewProductService;
@Autowired
private ProdStockService prodStockService;
@Autowired
private InStorehouseMainService inStorehouseMainService;
@Autowired
private WhEnterpriseInformationFeign whEnterpriseInformationFeign;
private QueryWrapper<Purchasenew> createQueryWrapper(PurchasenewQuery query) {
// todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
@ -65,6 +72,16 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Transactional
public ResultBean saveOrUpdateDto(PurchasenewDto dto){
ResultBean rb = ResultBean.fireFail();
String custId = dto.getCustId();
ResultBean<List<WhEnterpriseInformationVo>> listResultBean = whEnterpriseInformationFeign.EnterpriseList();
List<WhEnterpriseInformationVo> data = listResultBean.getData();
data.forEach(d->{
String enterpriseName = d.getEnterpriseName();
String sid = d.getSid();
if(sid.equals(custId)){
dto.setCustName(enterpriseName);
}
});
String dtoSid = dto.getSid();
List<PurchasenewProductDto> products = dto.getProducts();
if(products.size()==0){
@ -116,8 +133,8 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
return rb.setMsg("主键信息不能为空");
}
Purchasenew entity = fetchBySid(dtoSid);
String status = entity.getStatus();
if("2".equals(status)){
int state = entity.getState();
if(2==state){
return rb.setMsg("采购订单已经入库不允许修改");
}
BeanUtil.copyProperties(dto, entity, "id", "sid");
@ -125,6 +142,7 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
//dto.setSid(entity.getSid());
purchasenewProductService.deleteByPurchaseSid(dtoSid);
addPurchasenewProduct(dto, rb, entity);
// TODO 当系统调试通后需要做修改 不能再 执行下一行代码了
return inStorehouseMainService.saveOrUpdateByPurchaseSid(dto,entity.getSid());
}
@ -135,6 +153,8 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
PurchasenewProduct pp=new PurchasenewProduct();
BeanUtil.copyProperties(p,pp,"id","sid");
pp.setMainSid(entity.getSid());
pp.setStoreHouseName(dto.getStorehouseName());
pp.setStoreHouseSid(dto.getStorehouseId());
l.add(pp);
});
boolean b = purchasenewProductService.saveBatch(l);
@ -158,11 +178,16 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Transactional
public int delByPurchasenewSids(String[] sids) {
for (String sid : sids) {
Purchasenew entity = fetchBySid(sid);
int state = entity.getState();
if(2==state){
continue;
}
Map<String,Object> params=new HashMap<>();
params.put("sid",sid);
baseMapper.deleteByMap(params);
purchasenewProductService.deleteByPurchaseSid(sid);
inStorehouseMainService.deleteByPurchaseSid(sid);
// inStorehouseMainService.deleteByPurchaseSid(sid);
}
return sids.length;
}

5
warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java

@ -82,7 +82,10 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper,
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
QueryWrapper<ShStorehouse> qw = new QueryWrapper<>();
if(StringUtils.isNotBlank(query.getCusterName())){
qw.like("custerName",query.getCusterName());
qw.like("custerName",query.getCusterName());
}
if(StringUtils.isNotBlank(query.getName())){
qw.like("name",query.getName());
}
if(StringUtils.isNotBlank(query.getCusterSid())){
qw.eq("custerSid",query.getCusterSid());

2
warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="log.base" value="logs/supervise-dispatchcenter" />
<property name="log.base" value="logs/supervise-warehousing" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

8
warehousing-system/project/wh-manage/src/main/resources/mappers/PurchasenewMapper.xml

@ -4,7 +4,13 @@
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo">
SELECT * FROM purchasenew <where> ${ew.sqlSegment} </where> order by id desc
SELECT sid, purchase_date,purchase_no,
purchase_person,purchase_person_sid,cust_id,
cust_name,supplier_name,
supplier_id, storehouse_name,
storehouse_id,
IF(state=1,'未入库','已入库') state
FROM purchasenew <where> ${ew.sqlSegment} </where> order by id desc
</select>
<select id="selectListAllVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo">

423
warehousing-system/project_web_ui/src/views/component/initial_value/add/locationAdd.vue

@ -1,212 +1,211 @@
<template>
<div>
<div class="tab-header webtop">
<!-- 标题 -->
<div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<el-card class="box-card">
<div class="item">
<span class="item_text">货位名称</span>
<el-input v-model="locationForm.name" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">货位编号</span>
<el-input v-model="locationForm.locationId" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">货位类型</span>
<el-select v-model="locationForm.type" class="item_input" placeholder="请选择" >
<el-option
v-for="(type,i) in typeList"
:key="i"
:label="type.type"
:value="type.type"
>
</el-option>
</el-select>
</div>
<div class="item">
<span class="item_text">所属仓库</span>
<el-select v-model="locationForm.storehouse" class="item_input" placeholder="请选择" >
<el-option
v-for="(storehouse,i) in storehouseList"
:key="i"
:label="storehouse.name"
:value="storehouse.name">
</el-option>
</el-select>
</div>
</el-card>
</div>
</div>
</template>
<script>
export default {
data() {
return {
submitdisabled: false,
locationForm: {
name: "",
locationId: "",
type: "",
status: "",
storehouse: ""
},
viewTitle: "【新增】仓库信息",
storehouseList: [],
typeList: [],
queryInfo: {
total: 0,
size: 10,
current: 1,
params: {
simpleName:''
},
},
}
},
created() {
this.getStorehouse()
this.geType()
},
methods: {
saveOrUpdate() {
if (this.viewTitle === "【新增】仓库信息") return this.addLocation()
if (this.viewTitle === "【修改】仓库信息") {
this.updataLocation()
}
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.clearList()
this.$emit('doback')
},
showAdd() {
this.viewTitle = "【新增】仓库信息";
this.clearList()
},
clearList(){
this.locationForm = {
name: "",
number: "",
code: "",
tankNumber:"",
tankSid:"",
}
},
async getStorehouse () {
const { data: result } = await this.$http.get('/v1/shstorehouse/listAll')
if (result.code == 200){
this.storehouseList = result.data
}
// const { data: result } = await this.$http.post(
// "/v1/shstorehouse/listPage",
// { params: this.queryInfo }
// );
// if (result.code == 200) this.total = result.data.total;
// this.storehouseList = result.data.records;
},
async geType () {
const { data: result } = await this.$http.get('/location/getType')
if (result.status !== 200) return this.$message.error('获取类型列表失败')
this.typeList = result.data
},
showEdit(row) {
this.viewTitle = "【修改】仓库信息";
this.locationForm=row
},
async addLocation () {
this.locationForm.status = '空闲'
const { data: result } = await this.$http.post('/location/addLocation', this.locationForm)
if (result.status !== 200) return this.$message.error('添加货位失败')
this.$message.success('成功添加货位')
this.handleReturn('true')
},
async updataLocation () {
const { data: result } = await this.$http.put('/location/updataLocation', this.locationForm)
if (result.status !== 200) return this.$message.error('修改货位失败')
this.$message.success('更新成功')
this.handleReturn('true')
},
}
}
</script>
<style lang="scss">
.box-card {
margin-left: 60px;
margin-right: 60px;
min-width: 70%;
margin-top: 20px;
.item {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 15px;
height: 40px;
line-height: 40px;
.item_text {
flex: 0.8;
font-size: 18px;
text-align: right;
}
.item_input {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 80px;
}
.item_left_input {
width: 20%;
}
.item_left_text {
height: 30px;
margin-left: 20px;
line-height: 30px;
color: #018AD2;
padding: 0px 15px;
border: 1.5px solid #018AD2;
border-radius: 5px;
}
.item_right {
flex: 1;
justify-items: center;
.item_right_list_text {
font-size: 16px;
}
.item_right_list_delect {
color: #5E94FF;
margin-left: 20px;
font-size: 16px;
text-decoration: underline;
}
}
}
}
</style>
<template>
<div>
<div class="tab-header webtop">
<!-- 标题 -->
<div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<el-card class="box-card">
<div class="item">
<span class="item_text">货位名称</span>
<el-input v-model="locationForm.name" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">货位编号</span>
<el-input v-model="locationForm.locationId" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">货位类型</span>
<el-select v-model="locationForm.type" class="item_input" placeholder="请选择" >
<el-option
v-for="(type,i) in typeList"
:key="i"
:label="type.type"
:value="type.type"
>
</el-option>
</el-select>
</div>
<div class="item">
<span class="item_text">所属仓库</span>
<el-select v-model="locationForm.storehouseid" class="item_input" placeholder="请选择" >
<el-option
v-for="(storehouse,i) in storehouseList"
:key="i"
:label="storehouse.name"
:value="storehouse.sid">
</el-option>
</el-select>
</div>
</el-card>
</div>
</div>
</template>
<script>
export default {
data() {
return {
submitdisabled: false,
locationForm: {
name: "",
locationId: "",
type: "",
status: "",
storehouse: ""
},
viewTitle: "【新增】仓库信息",
storehouseList: [],
typeList: [],
queryInfo: {
total: 0,
size: 10,
current: 1,
params: {
simpleName:''
},
},
}
},
created() {
this.getStorehouse()
this.geType()
},
methods: {
saveOrUpdate() {
if (this.viewTitle === "【新增】仓库信息") return this.addLocation()
if (this.viewTitle === "【修改】仓库信息") {
this.updataLocation()
}
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.clearList()
this.$emit('doback')
},
showAdd() {
this.viewTitle = "【新增】仓库信息";
this.clearList()
},
clearList(){
this.locationForm = {
name: "",
number: "",
code: "",
tankNumber:"",
tankSid:"",
}
},
async getStorehouse () {
const { data: result } = await this.$http.get('/v1/shstorehouse/listAll')
if (result.code == 200){
this.storehouseList = result.data
}
// const { data: result } = await this.$http.post(
// "/v1/shstorehouse/listPage",
// { params: this.queryInfo }
// );
// if (result.code == 200) this.total = result.data.total;
// this.storehouseList = result.data.records;
},
async geType () {
const { data: result } = await this.$http.get('/location/getType')
if (result.status !== 200) return this.$message.error('获取类型列表失败')
this.typeList = result.data
},
showEdit(row) {
this.viewTitle = "【修改】仓库信息";
this.locationForm=row
},
async addLocation () {
this.locationForm.status = '空闲'
const { data: result } = await this.$http.post('/location/addLocation', this.locationForm)
if (result.status !== 200) return this.$message.error('添加货位失败')
this.$message.success('成功添加货位')
this.handleReturn('true')
},
async updataLocation () {
const { data: result } = await this.$http.put('/location/updataLocation', this.locationForm)
if (result.status !== 200) return this.$message.error('修改货位失败')
this.$message.success('更新成功')
this.handleReturn('true')
},
}
}
</script>
<style lang="scss">
.box-card {
margin-left: 60px;
margin-right: 60px;
min-width: 70%;
margin-top: 20px;
.item {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 15px;
height: 40px;
line-height: 40px;
.item_text {
flex: 0.8;
font-size: 18px;
text-align: right;
}
.item_input {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 80px;
}
.item_left_input {
width: 20%;
}
.item_left_text {
height: 30px;
margin-left: 20px;
line-height: 30px;
color: #018AD2;
padding: 0px 15px;
border: 1.5px solid #018AD2;
border-radius: 5px;
}
.item_right {
flex: 1;
justify-items: center;
.item_right_list_text {
font-size: 16px;
}
.item_right_list_delect {
color: #5E94FF;
margin-left: 20px;
font-size: 16px;
text-decoration: underline;
}
}
}
}
</style>

948
warehousing-system/project_web_ui/src/views/component/instorehouse/add/purchaseAdd.vue

@ -1,468 +1,480 @@
<template>
<div>
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="primary" size="small" @click="saveOrUpdate"
>保存</el-button
>
<el-button type="info" size="small" @click="handleReturn()"
>返回</el-button
>
</div>
</div>
<div class="listconadd">
<el-form ref="dataForm" :model="purchaseForm" label-position="top" label-width="190px" class="formadd">
<div class="title" style="display: flex;align-items: center;justify-content: space-between;height:40px">
<div style="margin-left: 15px;">主体信息</div>
</div>
<el-row>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">订单日期</span>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="trightb_item">
<!-- <span>{{temp.bankName}}</span> -->
<el-date-picker v-model="purchaseForm.purchaseDate" type="date" style="width: 100%;"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="请选择" />
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">订单编号</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="trightb_item" prop="purchaseNo">
<el-input :disabled="true" v-model="purchaseForm.purchaseNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">供货商名称</span>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item prop="supplier" class="trightb_item">
<el-select v-model="purchaseForm.supplierName" placeholder="请选择" >
<el-option
v-for="(supplier,i) in supplierList"
:key="i"
:label="supplier.name"
:value="supplier.name">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">采购申请人</span>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="trightb_item">
<el-input v-model="purchaseForm.purchasePerson" placeholder="采购申请人" clearable />
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">客户名称</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="trightb_item">
<el-select v-model="purchaseForm.custName" placeholder="请选择" >
<el-option
v-for="(custName,i) in custList"
:key="i"
:label="custName.enterpriseName"
:value="custName.enterpriseName">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">仓库名称</span>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item class="trightb_item">
<el-select v-model="purchaseForm.storehouseName" placeholder="请选择" >
<el-option
v-for="(storehouse,i) in storehouseList"
:key="i"
:label="storehouse.name"
:value="storehouse.name">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-collapse v-model="activeNames">
<el-collapse-item name="1">
<template slot="title" >
<span style="margin-left: 15px;">商品信息</span><span class="span" @click.stop="add()">添加</span>
</template>
<el-table :data="purchaseForm.products" border style="width: 100%;"
:row-style="{height: '40px'}">
<!-- <el-table-column type="selection" align="center" width="50"/> -->
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="商品名称" width="120" prop="proName" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.proName" placeholder="请选择" >
<el-option
v-for="product in productList"
:key="product.name"
:label="product.name"
:value="product.name">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="商品品类" width="120" prop="productTypeName" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.productTypeName" placeholder="商品品类" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="商品品牌" width="120" prop="brandInfoName" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.brandInfoName" placeholder="商品品牌" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="规格(型号)" width="150" prop="proModel" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.proModel" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="单价" width="140" prop="estimateConfirmedPrice" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.estimateConfirmedPrice" @input="limitInput1($event,scope.$index)" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="数量" width="140" prop="estimateNum" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.estimateNum" @input="limitInput2($event,scope.$index)" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="总价值" width="150px" prop="estimateCalculatedValue" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.estimateCalculatedValue" :readonly="true" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="规格单位" width="130" prop="proUnit" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.proUnit" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="生成厂家" width="150" prop="manufacturer" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.manufacturer" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际数量" width="100px" prop="realityNum" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityNum" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际重量" width="100px" prop="realityWeight" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityWeight" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际质权人确认的单价" width="150px" prop="realityConfirmedPrice" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityConfirmedPrice" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际核算的价值" width="150px" prop="realityCalculatedValue" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityCalculatedValue" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="货位号" width="150px" prop="locationNumber" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.locationNumber" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="doCommoditylDel(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: "storehouseAdd",
components: {
},
data() {
return {
viewTitle: "【新增】采购订单",
purchaseForm: {
purchaseId: '',
product: '',
barCode: '',
purchaseDate:'',
purchaseNo:'',
supplier: '',
storehouseName:'',
supplierName:'',
count: '',
storehouse: '',
status: '',
products:[]
},
supplierList: [],
storehouseList: [],
productList: [],
productList2: [],
supplierList: [],
custList: [],
selectPurchaseList: [],
activeNames: ['1'],
rules: {
product: [
{ required: true, message: '请输入商品名', trigger: 'blur' }
],
supplier: [
{ required: true, message: '请输入供应商', trigger: 'blur' }
],
count: [
{ required: true, message: '请输入商品数量', trigger: 'blur' }
],
storehouse: [
{ required: true, message: '请输入所属仓库', trigger: 'blur' }
]
}
};
},
mounted() {
},
created() {
this.getProductList()
this.getSupplierList()
this.getStorehouseList()
this.getcustListList()
this.openAddPurchaseDialog()
},
methods: {
handleReturn(isreload) {
if (isreload === "true") this.$emit("reloadlist");
this.clearList()
this.$emit("doback");
},
clearList() {
this.purchaseForm={
purchaseId: '',
product: '',
barCode: '',
purchaseDate:'',
purchaseNo:'',
supplier: '',
storehouseName:'',
supplierName:'',
count: '',
storehouse: '',
status: '',
products:[]
}
},
saveOrUpdate(){
if (this.viewTitle === "【新增】采购订单") return this.addStorehouse();
if (this.viewTitle === "【修改】采购订单") {
this.addStorehouse();
}
},
showAdd() {
this.viewTitle = "【新增】采购订单";
this.clearList()
this.openAddPurchaseDialog()
},
async showEdit(row) {
this.viewTitle = "【修改】采购订单";
const _this = this
const { data: result } = await this.$http.get(`/purchasenew/fetchDetailsBySid/${row.sid}`)
if (result.code==200) {
_this.purchaseForm=result.data
}
},
addStorehouse(){
this.$refs.dataForm.validate(async validate => {
if (!validate) return this.$message.error('请填写必填项')
this.purchaseForm.status = '待审核'
const { data: result } = await this.$http.post('/purchasenew/save', this.purchaseForm)
if (result.code == 200) {
this.$message({ type: 'success', message: result.msg, showClose: true })
this.handleReturn('true')
this.clearList()
}
})
},
async getSupplierList () {
const { data: result } = await this.$http.get('/purchase/getSupplier')
if (result.status !== 200) return this.$message.error('获取列表失败')
this.supplierList = result.data
},
async getStorehouseList () {
const { data: result } = await this.$http.get("/v1/shstorehouse/listAll")
if (result.code == 200){
this.storehouseList = result.data
}
},
async getProductList () {
const { data: result } = await this.$http.get('/purchase/getProductList', { params: { name: this.purchaseForm.product } })
if (result.status !== 200) return this.$message.error('获取商品列表失败')
this.productList = result.data
this.purchaseForm.barCode = this.productList[0].barCode
},
async getcustListList () {
const { data: result } = await this.$http.get('/v1/shstorehouse/fetchEntList')
if (result.code == 200){
this.custList = result.data
}
},
openAddPurchaseDialog () {
var now = new Date()
this.purchaseForm.purchaseNo = 'IP' + now.getTime()
if (this.productList2.length == 0) this.productList2 = this.productList
this.add()
},
add(){
this.purchaseForm.products.push({
})
},
doCommoditylDel(index) {
const tip = '请确认是否删除所选记录?'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.purchaseForm.products.splice(index, 1);
})
},
getLists(){
let arrList=this.purchaseForm.products
for(let i=0;i<arrList.length;i++){
if(arrList[i].estimateNum && arrList[i].estimateConfirmedPrice){
let newValue=parseFloat(arrList[i].estimateNum) * parseFloat(arrList[i].estimateConfirmedPrice) || 0
let getValue=Math.floor(newValue*100)/100
this.$set(arrList[i], 'estimateCalculatedValue', getValue)
}else{
this.$set(arrList[i], 'estimateCalculatedValue', '')
}
}
},
limitInput1(value, index) {
this.purchaseForm.products[index].estimateConfirmedPrice =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
.replace(/^0+(\d)/, "$1") // 00
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
this.getLists()
},
limitInput2(value, index) {
this.purchaseForm.products[index].estimateNum =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
.replace(/^0+(\d)/, "$1") // 00
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
this.getLists()
},
},
};
</script>
<style scoped>
/deep/ .el-collapse-item__header {
height: 40px;
font-weight: bold;
font-size: 16px;
text-align: left;
color: #ffffff;
background-color: #0294d7;
}
/deep/ .el-collapse-item__content {
padding-bottom: 0;
}
.trightb {
display: flex;
align-items: center;
text-align: center;
justify-content: center;
}
.trightb_item {
padding-top: 5px;
}
.span {
margin-left: 50px;
font-size: 15px;
font-weight: 400;
}
.formadd {
padding: 10px 40px 0 40px;
font-size: 16px;
}
.formadd .title {
font-weight: bold;
font-size: 16px;
background-color: #0294d7;
text-align: left;
color: #ffffff;
}
.first_row{
border-top: 1px solid #e0e3eb;
}
.formadd .el-row {
display: flex;
flex-wrap: wrap;
border-left: 1px solid #e0e3eb;
}
.formadd .el-row .el-col {
border-right: 1px solid #e0e3eb;
border-bottom: 1px solid #e0e3eb;
padding: 0 15px;
min-height: 42px;
line-height: 1;
}
.formadd .el-row .el-col .el-form-item {
margin-bottom: 0;
line-height: 42px;
}
.addinputw {
width: 80%;
line-height: 42px;
}
.el-input__inner {
height: 36px;
}
</style>
<template>
<div>
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="primary" size="small" @click="saveOrUpdate"
>保存</el-button
>
<el-button type="info" size="small" @click="handleReturn()"
>返回</el-button
>
</div>
</div>
<div class="listconadd">
<el-form ref="dataForm" :model="purchaseForm" label-position="top" label-width="190px" class="formadd">
<div class="title" style="display: flex;align-items: center;justify-content: space-between;height:40px">
<div style="margin-left: 15px;">主体信息</div>
</div>
<el-row>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">订单日期</span>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="trightb_item">
<!-- <span>{{temp.bankName}}</span> -->
<el-date-picker v-model="purchaseForm.purchaseDate" type="date" style="width: 100%;"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="请选择" />
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">订单编号</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="trightb_item" prop="purchaseNo">
<el-input :disabled="true" v-model="purchaseForm.purchaseNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">供货商名称</span>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item prop="supplier" class="trightb_item">
<el-select v-model="purchaseForm.supplierId" placeholder="请选择" >
<el-option
v-for="(supplier,i) in supplierList"
:key="i"
:label="supplier.name"
:value="supplier.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">采购申请人</span>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="trightb_item">
<el-input v-model="purchaseForm.purchasePerson" placeholder="采购申请人" clearable />
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">客户名称</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="trightb_item">
<el-select v-model="purchaseForm.custId" placeholder="请选择" >
<el-option
v-for="(custName,i) in custList"
:key="i"
:label="custName.enterpriseName"
:value="custName.sid">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">仓库名称</span>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item class="trightb_item">
<el-select v-model="purchaseForm.storehouseId" placeholder="请选择" >
<el-option
v-for="(storehouse,i) in storehouseList"
:key="i"
:label="storehouse.name"
:value="storehouse.sid">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-collapse v-model="activeNames">
<el-collapse-item name="1">
<template slot="title" >
<span style="margin-left: 15px;">商品信息</span><span class="span" @click.stop="add()">添加</span>
</template>
<el-table :data="purchaseForm.products" border style="width: 100%;"
:row-style="{height: '40px'}">
<!-- <el-table-column type="selection" align="center" width="50"/> -->
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="商品名称" width="120" prop="proName" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.proName" placeholder="请选择" >
<el-option
v-for="product in productList"
:key="product.name"
:label="product.name"
:value="product.name">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="商品品类" width="120" prop="productTypeName" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.productTypeName" placeholder="商品品类" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="商品品牌" width="120" prop="brandInfoName" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.brandInfoName" placeholder="商品品牌" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="规格(型号)" width="150" prop="proModel" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.proModel" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="单价" width="140" prop="estimateConfirmedPrice" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.estimateConfirmedPrice" @input="limitInput1($event,scope.$index)" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="数量" width="140" prop="estimateNum" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.estimateNum" @input="limitInput2($event,scope.$index)" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="总价值" width="150px" prop="estimateCalculatedValue" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.estimateCalculatedValue" :readonly="true" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="规格单位" width="130" prop="proUnit" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.proUnit" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="生成厂家" width="150" prop="manufacturer" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.manufacturer" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际数量" width="100px" prop="realityNum" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityNum" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际重量" width="100px" prop="realityWeight" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityWeight" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际质权人确认的单价" width="150px" prop="realityConfirmedPrice" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityConfirmedPrice" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="实际核算的价值" width="150px" prop="realityCalculatedValue" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.realityCalculatedValue" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="货位号" width="150px" prop="locationNumber" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.locationNumber" placeholder="" clearable></el-input>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="doCommoditylDel(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: "storehouseAdd",
components: {
},
data() {
return {
viewTitle: "【新增】采购订单",
purchaseForm: {
purchaseId: '',
product: '',
barCode: '',
purchaseDate:'',
purchaseNo:'',
supplier: '',
storehouseName:'',
storehouseId:"",
supplierName:'',
supplierId:'',
count: '',
storehouse: '',
status: '',
products:[]
},
supplierList: [],
storehouseList: [],
productList: [],
productList2: [],
custList: [],
selectPurchaseList: [],
activeNames: ['1'],
rules: {
product: [
{ required: true, message: '请输入商品名', trigger: 'blur' }
],
supplier: [
{ required: true, message: '请输入供应商', trigger: 'blur' }
],
count: [
{ required: true, message: '请输入商品数量', trigger: 'blur' }
],
storehouse: [
{ required: true, message: '请输入所属仓库', trigger: 'blur' }
]
}
};
},
mounted() {
},
created() {
this.getProductList()
this.getSupplierList()
this.getStorehouseList()
this.getcustListList()
this.openAddPurchaseDialog()
},
methods: {
handleReturn(isreload) {
if (isreload === "true") this.$emit("reloadlist");
this.clearList()
this.$emit("doback");
},
clearList() {
this.purchaseForm={
purchaseId: '',
product: '',
barCode: '',
purchaseDate:'',
purchaseNo:'',
supplier: '',
storehouseName:'',
storehouseId:"",
supplierName:'',
supplierId:'',
count: '',
storehouse: '',
status: '',
products:[]
}
},
saveOrUpdate(){
this.storehouseList.forEach((v, i) => {
if(v.sid == this.purchaseForm.storehouseId){
this.purchaseForm.storehouseName = v.name
}
})
this.supplierList.forEach((v, i) => {
if(v.id == this.purchaseForm.supplierId){
this.purchaseForm.supplierName = v.name
}
})
if (this.viewTitle === "【新增】采购订单") return this.addStorehouse();
if (this.viewTitle === "【修改】采购订单") {
this.addStorehouse();
}
},
showAdd() {
this.viewTitle = "【新增】采购订单";
this.clearList()
this.openAddPurchaseDialog()
},
async showEdit(row) {
this.viewTitle = "【修改】采购订单";
const _this = this
const { data: result } = await this.$http.get(`/purchasenew/fetchDetailsBySid/${row.sid}`)
if (result.code==200) {
_this.purchaseForm=result.data
}
},
addStorehouse(){
this.$refs.dataForm.validate(async validate => {
if (!validate) return this.$message.error('请填写必填项')
this.purchaseForm.status = '待审核'
const { data: result } = await this.$http.post('/purchasenew/save', this.purchaseForm)
if (result.code == 200) {
this.$message({ type: 'success', message: result.msg, showClose: true })
this.handleReturn('true')
this.clearList()
}
})
},
async getSupplierList () {
const { data: result } = await this.$http.get('/purchase/getSupplier')
if (result.status !== 200) return this.$message.error('获取列表失败')
this.supplierList = result.data
},
async getStorehouseList () {
const { data: result } = await this.$http.get("/v1/shstorehouse/listAll")
if (result.code == 200){
this.storehouseList = result.data
}
},
async getProductList () {
const { data: result } = await this.$http.get('/purchase/getProductList', { params: { name: this.purchaseForm.product } })
if (result.status !== 200) return this.$message.error('获取商品列表失败')
this.productList = result.data
this.purchaseForm.barCode = this.productList[0].barCode
},
async getcustListList () {
const { data: result } = await this.$http.get('/v1/shstorehouse/fetchEntList')
if (result.code == 200){
this.custList = result.data
}
},
openAddPurchaseDialog () {
var now = new Date()
this.purchaseForm.purchaseNo = 'IP' + now.getTime()
if (this.productList2.length == 0) this.productList2 = this.productList
this.add()
},
add(){
this.purchaseForm.products.push({
})
},
doCommoditylDel(index) {
const tip = '请确认是否删除所选记录?'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.purchaseForm.products.splice(index, 1);
})
},
getLists(){
let arrList=this.purchaseForm.products
for(let i=0;i<arrList.length;i++){
if(arrList[i].estimateNum && arrList[i].estimateConfirmedPrice){
let newValue=parseFloat(arrList[i].estimateNum) * parseFloat(arrList[i].estimateConfirmedPrice) || 0
let getValue=Math.floor(newValue*100)/100
this.$set(arrList[i], 'estimateCalculatedValue', getValue)
}else{
this.$set(arrList[i], 'estimateCalculatedValue', '')
}
}
},
limitInput1(value, index) {
this.purchaseForm.products[index].estimateConfirmedPrice =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
.replace(/^0+(\d)/, "$1") // 00
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
this.getLists()
},
limitInput2(value, index) {
this.purchaseForm.products[index].estimateNum =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
.replace(/^0+(\d)/, "$1") // 00
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
this.getLists()
},
},
};
</script>
<style scoped>
/deep/ .el-collapse-item__header {
height: 40px;
font-weight: bold;
font-size: 16px;
text-align: left;
color: #ffffff;
background-color: #0294d7;
}
/deep/ .el-collapse-item__content {
padding-bottom: 0;
}
.trightb {
display: flex;
align-items: center;
text-align: center;
justify-content: center;
}
.trightb_item {
padding-top: 5px;
}
.span {
margin-left: 50px;
font-size: 15px;
font-weight: 400;
}
.formadd {
padding: 10px 40px 0 40px;
font-size: 16px;
}
.formadd .title {
font-weight: bold;
font-size: 16px;
background-color: #0294d7;
text-align: left;
color: #ffffff;
}
.first_row{
border-top: 1px solid #e0e3eb;
}
.formadd .el-row {
display: flex;
flex-wrap: wrap;
border-left: 1px solid #e0e3eb;
}
.formadd .el-row .el-col {
border-right: 1px solid #e0e3eb;
border-bottom: 1px solid #e0e3eb;
padding: 0 15px;
min-height: 42px;
line-height: 1;
}
.formadd .el-row .el-col .el-form-item {
margin-bottom: 0;
line-height: 42px;
}
.addinputw {
width: 80%;
line-height: 42px;
}
.el-input__inner {
height: 36px;
}
</style>

Loading…
Cancel
Save