新增库存管理页面(未添加查询功能)

master
强子烨 4 years ago
parent a17677dfd0
commit 8812ddc61b
  1. 25
      java/local/src/main/java/cn/toesbieya/jxc/controller/ReagentController.java
  2. 24
      java/local/src/main/java/cn/toesbieya/jxc/mapper/ReagentMapper.java
  3. 114
      java/local/src/main/java/cn/toesbieya/jxc/model/entity/ReagentInfo.java
  4. 13
      java/local/src/main/java/cn/toesbieya/jxc/model/vo/result/ReagentResult.java
  5. 17
      java/local/src/main/java/cn/toesbieya/jxc/model/vo/search/ReagentSearch.java
  6. 93
      java/local/src/main/java/cn/toesbieya/jxc/service/ReagentService.java
  7. 55
      java/local/src/main/resources/mapper/Reagent.xml
  8. 6
      vue/full/src/api/stock/current.js
  9. 6
      vue/full/src/router/module/admin/child/stock.js
  10. 53
      vue/full/src/view/admin/stock/reagent/DetailDialog.vue
  11. 121
      vue/full/src/view/admin/stock/reagent/indexPage.vue

@ -1,29 +1,30 @@
package cn.toesbieya.jxc.controller; package cn.toesbieya.jxc.controller;
import cn.toesbieya.jxc.model.vo.search.StockSearch;
import cn.toesbieya.jxc.service.BizStockService;
import cn.toesbieya.jxc.model.vo.R; import cn.toesbieya.jxc.model.vo.R;
import cn.toesbieya.jxc.model.vo.search.ReagentSearch;
import cn.toesbieya.jxc.service.ReagentService;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@RestController @RestController
@RequestMapping("stock/current") @RequestMapping("stock/reagent")
public class BizStockController { public class ReagentController {
@Resource @Resource
private BizStockService service; private ReagentService service;
@PostMapping("search") @PostMapping("search")
public R search(@RequestBody StockSearch vo) { public R search(@RequestBody ReagentSearch vo) {
return R.success(service.search(vo)); return R.success(service.search(vo));
} }
@GetMapping("getDetail") @GetMapping("getDetail")
public R getDetail(@RequestParam String cids) { public R getDetail(@RequestParam String name) {
if (StringUtils.isEmpty(cids)) return R.fail("参数错误"); if (StringUtils.isEmpty(name)) return R.fail("参数错误");
return R.success(service.getDetail(cids)); return R.success(service.getDetail(name));
} }
@GetMapping("getDetailById") @GetMapping("getDetailById")
@ -32,8 +33,8 @@ public class BizStockController {
return R.success(service.getDetailById(ids)); return R.success(service.getDetailById(ids));
} }
@PostMapping("export") /*@PostMapping("export")
public void export(@RequestBody StockSearch vo, HttpServletResponse response) throws Exception { public void export(@RequestBody StockSearch vo, HttpServletResponse response) throws Exception {
service.export(vo, response); service.export(vo, response);
} }*/
} }

@ -0,0 +1,24 @@
package cn.toesbieya.jxc.mapper;
import cn.toesbieya.jxc.model.entity.ReagentInfo;
import cn.toesbieya.jxc.model.vo.result.ReagentResult;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import java.util.List;
public interface ReagentMapper extends BaseMapper<ReagentInfo> {
//List<ReagentResult> search(@Param(Constants.WRAPPER) Wrapper<ReagentInfo> wrapper);
/*
// List<StockExport> export(@Param(Constants.WRAPPER) Wrapper<BizStock> wrapper);
int insertBatch(@Param("list") List<DetailInfo> list);
int outbound(@Param("id") Integer id, @Param("quantity") Integer num);
*/
}

@ -0,0 +1,114 @@
package cn.toesbieya.jxc.model.entity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.Column;
import java.io.Serializable;
/**
* reagent_info
* @author 强子烨
*/
@Getter
@Setter
@ToString
public class ReagentInfo implements Serializable {
/**
* 试剂id
*/
private Integer id;
/**
* 名称
*/
private String name;
/**
* 生产日期
*/
private Long productionDate;
/**
* 有效期
*/
private Integer effective;
/**
* 产品批次
*/
private String batch;
/**
* 数量
*/
private Integer quantity;
/**
* 货位
*/
private String location;
/**
* 仓库
*/
private String storehouse;
/**
* 规格
*/
private String specification;
/**
* 单位
*/
private String unit;
/**
* 状态0停用1启用
*/
private Boolean enable = false;
/**
* 创建人id
*/
private Integer creatorId;
/**
* 创建时间
*/
private Long createTime;
/**
* 修改人id
*/
private Integer updateId;
/**
* 修改时间
*/
private Long updateTime;
/**
* 备注
*/
private String remark;
/**
* 试剂厂商
*/
@Column
private String manufacture;
/**
* 试剂类型
*/
@Column
private String type;
/**
* 危险说明
*/
@Column
private String risk;
}

@ -0,0 +1,13 @@
package cn.toesbieya.jxc.model.vo.result;
import lombok.Data;
@Data
public class ReagentResult {
private Integer id;
private String name; //试剂名称(名称不唯一)
private String storehouse; //仓库名称
private String location; //货位名称
private Integer quantity; //库存数量
private String unit; //单位
}

@ -0,0 +1,17 @@
package cn.toesbieya.jxc.model.vo.search;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class ReagentSearch extends BaseSearch{
private String name;
private String manufacture;
private String type;
private String risk;
}

@ -0,0 +1,93 @@
package cn.toesbieya.jxc.service;
import cn.toesbieya.jxc.mapper.ReagentMapper;
import cn.toesbieya.jxc.model.entity.ReagentInfo;
import cn.toesbieya.jxc.model.vo.result.PageResult;
import cn.toesbieya.jxc.model.vo.search.ReagentSearch;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
public class ReagentService {
@Resource
private ReagentMapper mapper;
/*private final ExcelUtil.CommonMergeOptions mergeOptions =
new ExcelUtil.CommonMergeOptions(
new String[]{"id", "cname", "totalNum", "totalPrice", "cgddid", "cgPrice", "cgNum"},
"cid",
"id"
);*/
public PageResult<ReagentInfo> search(ReagentSearch vo) {
PageHelper.startPage(vo.getPage(), vo.getPageSize());
return new PageResult<>(getByCondition(vo));
}
public List<ReagentInfo> getByCondition(ReagentSearch vo) {
return mapper.selectList(getSearchCondition(vo));
}
public List<ReagentInfo> getDetail(String name) {
return mapper.selectList(
Wrappers.lambdaQuery(ReagentInfo.class)
.eq(!StringUtils.isEmpty(name), ReagentInfo::getName, name)
.gt(ReagentInfo::getQuantity, 0)
//.orderByDesc(ReagentInfo::getCgddid, ReagentInfo::getCgrkid)
);
}
public List<ReagentInfo> getDetailById(String ids) {
return mapper.selectList(
Wrappers.lambdaQuery(ReagentInfo.class)
.inSql(!StringUtils.isEmpty(ids), ReagentInfo::getId, ids)
);
}
/*public void export(ReagentSearch vo, HttpServletResponse response) throws Exception {
List<ReagentExport> list = mapper.export(getSearchCondition(vo));
ExcelUtil.export(list, response, "库存导出", mergeOptions);
}*/
private Wrapper<ReagentInfo> getSearchCondition(ReagentSearch vo) {
String name = vo.getName();
String manufacture = vo.getManufacture();
String type = vo.getType();
String risk = vo.getRisk();
return Wrappers.lambdaQuery(ReagentInfo.class)
.inSql(!StringUtils.isEmpty(name), ReagentInfo::getId, name)
.inSql(!StringUtils.isEmpty(manufacture), ReagentInfo::getManufacture, manufacture)
.inSql(!StringUtils.isEmpty(type), ReagentInfo::getType, type)
.inSql(!StringUtils.isEmpty(risk), ReagentInfo::getRisk, risk);
/*String ids = vo.getIds();
String cids = vo.getCids();
String cgddids = vo.getCgddids();
String cgrkids = vo.getCgrkids();
Long startTime = vo.getStartTime();
Long endTime = vo.getEndTime();
return Wrappers.lambdaQuery(ReagentInfo.class)
.inSql(!StringUtils.isEmpty(ids), ReagentInfo::getId, ids)
.inSql(!StringUtils.isEmpty(cids), ReagentInfo::getCid, cids)
.inSql(!StringUtils.isEmpty(cgddids), ReagentInfo::getCgddid, cgddids)
.inSql(!StringUtils.isEmpty(cgrkids), ReagentInfo::getCgrkid, cgrkids)
.gt(ReagentInfo::getNum, 0)
.ge(startTime != null, ReagentInfo::getCtime, startTime)
.le(endTime != null, ReagentInfo::getCtime, endTime);*/
}
}

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.toesbieya.jxc.mapper.ReagentMapper">
<!--<select id="search" resultType="cn.toesbieya.jxc.model.vo.result.ReagentResult">
select name,
locationId,
quantity,
unit
from detail_info ${ew.customSqlSegment}
group by id
</select>-->
<!--<select id="export" parameterType="cn.toesbieya.jxc.model.vo.search.StockSearch"
resultType="cn.toesbieya.jxc.model.vo.export.StockExport">
select a.cid,
a.cname,
a.total_num,
a.total_price,
b.cgddid,
b.cgrkid,
b.price cg_price,
from_unixtime(b.ctime / 1000, '%Y-%m-%d %H:%m:%s') ctime,
c.num rk_num,
d.num cg_num
from (
select cid,
cname,
sum(num) total_num,
sum(num * price) total_price
from biz_stock ${ew.customSqlSegment}
group by cid
) a
join biz_stock b using (cid)
left join biz_purchase_inbound_sub c on c.cid = a.cid and c.pid = b.cgrkid
left join biz_purchase_order_sub d on c.cid = d.cid and d.pid = b.cgddid
order by a.cid, b.cgddid desc, b.cgrkid desc
</select>
<insert id="insertBatch" keyColumn="id" keyProperty="id" parameterType="cn.toesbieya.jxc.model.entity.BizStock"
useGeneratedKeys="true">
insert into biz_stock (cid, cname, num, price, ctime, cgrkid, cgddid) values
<foreach collection="list" item="item" separator=",">
(#{item.cid,jdbcType=INTEGER}, #{item.cname,jdbcType=VARCHAR}, #{item.num,jdbcType=DECIMAL},
#{item.price,jdbcType=DECIMAL}, #{item.ctime,jdbcType=BIGINT}, #{item.cgrkid,jdbcType=VARCHAR},
#{item.cgddid,jdbcType=VARCHAR})
</foreach>
</insert>
<update id="outbound">
update biz_stock
set num = num - #{num,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
and num <![CDATA[ >= ]]> #{num,jdbcType=DECIMAL}
</update>-->
</mapper>

@ -1,7 +1,7 @@
import {GetApi, PostApi} from "@/api/request" import {GetApi, PostApi} from "@/api/request"
export const search = new PostApi(`/stock/current/search`) export const search = new PostApi(`/stock/reagent/search`)
export const getDetail = new GetApi(`/stock/current/getDetail`, cids => ({params: {cids}})) export const getDetail = new GetApi(`/stock/reagent/getDetail`, name => ({params: {name}}))
export const getDetailById = new GetApi(`/stock/current/getDetailById`, ids => ({params: {ids}})) export const getDetailById = new GetApi(`/stock/reagent/getDetailById`, id => ({params: {id}}))

@ -1,9 +1,9 @@
/*路由表:库存管理*/ /*路由表:库存管理*/
const router = { const router = {
path: 'current', path: 'reagent',
name: 'currentStock', name: 'reagentStock',
component: 'admin/stock/current/', component: 'admin/stock/reagent/',
meta: {title:'库存管理', icon: 'svg-stock'}, meta: {title:'库存管理', icon: 'svg-stock'},
} }

@ -1,7 +1,6 @@
<template> <template>
<abstract-dialog :value="value" :loading="false" :title="title" width="70%" @close="cancel" @open="search"> <abstract-dialog :value="value" :loading="false" :title="title" width="70%" @close="cancel" @open="search">
<liner-progress :show="loading"/> <liner-progress :show="loading"/>
<abstract-table <abstract-table
:data="tableData" :data="tableData"
:highlight-current-row="false" :highlight-current-row="false"
@ -10,7 +9,17 @@
:summary-method="summary" :summary-method="summary"
:span-method="span" :span-method="span"
> >
<el-table-column align="center" label="采购订单" show-overflow-tooltip> <el-table-column align="center" label="试剂" prop="name" show-overflow-tooltip/>
<el-table-column align="center" label="产品批次" prop="batch" show-overflow-tooltip/>
<el-table-column align="center" label="规格" prop="specification" show-overflow-tooltip/>
<el-table-column align="center" label="生产日期" prop="productionDate" show-overflow-tooltip/>
<el-table-column align="center" label="有效期(天)" prop="effective" show-overflow-tooltip/>
<el-table-column align="center" label="生产厂商" prop="manufacture" show-overflow-tooltip/>
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip/>
<el-table-column align="center" label="危险说明" prop="risk" show-overflow-tooltip/>
<el-table-column align="center" label="状态" prop="enable" show-overflow-tooltip/>
<!-- <el-table-column align="center" label="采购订单" show-overflow-tooltip>
<router-link <router-link
slot-scope="{row}" slot-scope="{row}"
:to="`/purchase/order/detail/see/${row.cgddid}`" :to="`/purchase/order/detail/see/${row.cgddid}`"
@ -28,13 +37,15 @@
> >
{{ row.cgrkid }} {{ row.cgrkid }}
</router-link> </router-link>
</el-table-column> </el-table-column>-->
<el-table-column align="center" label="入库时间" show-overflow-tooltip>
<template v-slot="{row}">{{ row.ctime | timestamp2Date }}</template> <!-- <el-table-column align="center" label="入库人" prop="num" show-overflow-tooltip/>
</el-table-column> <el-table-column align="center" label="入库时间" show-overflow-tooltip>
<el-table-column align="center" label="库存数量" prop="num" show-overflow-tooltip/> <template v-slot="{row}">{{ row.ctime | timestamp2Date }}</template>
<el-table-column align="center" label="总 值" prop="total" show-overflow-tooltip/> </el-table-column>-->
<!-- <el-table-column align="center" label="总 值" prop="total" show-overflow-tooltip/>-->
</abstract-table> </abstract-table>
</abstract-dialog> </abstract-dialog>
</template> </template>
@ -54,7 +65,7 @@ export default {
components: {AbstractTable, LinerProgress, AbstractDialog}, components: {AbstractTable, LinerProgress, AbstractDialog},
props: {value: Boolean, title: String, cid: Number}, props: {value: Boolean, title: String, name: String},
data() { data() {
return { return {
@ -65,10 +76,10 @@ export default {
methods: { methods: {
summary({data}) { summary({data}) {
let sum = ['合计', '', '', '', 0, 0] let sum = ['合计', '', '', '', '', '', '', 0, 0]
data.forEach(i => { data.forEach(i => {
sum[4] = plus(sum[4], i.num) sum[4] = plus(sum[4], i.num)
sum[5] = plus(sum[5], i.total) //sum[5] = plus(sum[5], i.total)
}) })
return sum return sum
}, },
@ -80,31 +91,31 @@ export default {
}, },
search() { search() {
this.tableData = [] if (!this.value || isEmpty(this.name) || this.loading) return
if (!this.value || isEmpty(this.cid) || this.loading) return
this.loading = true this.loading = true
getDetail getDetail
.request(this.cid) .request(this.name)
.then(({data}) => { .then(({data}) => {
this.prepareData(data) //this.prepareData(data)
this.tableData = data this.tableData = data
}) })
.finally(() => this.loading = false) .finally(() => this.loading = false)
}, },
prepareData(data) { prepareData(data) {
data.sort((a, b) => { //id
/*data.sort((a, b) => {
if (a.cgddid > b.cgddid) return -1 if (a.cgddid > b.cgddid) return -1
if (a.cgddid < b.cgddid) return 1 if (a.cgddid < b.cgddid) return 1
return 0 return 0
}) })*/
const count = {} const count = {}
data.forEach(i => { data.forEach(i => {
i.total = mul(i.num, i.price) //i.total = mul(i.num, i.price)
i._span = {rowspan: 0, colspan: 0} i._span = {rowspan: 0, colspan: 0}
count[i.cgddid] ? count[i.cgddid]++ : count[i.cgddid] = 1 //count[i.cgddid] ? count[i.cgddid]++ : count[i.cgddid] = 1
}) })
for (let i = 0; i < data.length; i++) { /*for (let i = 0; i < data.length; i++) {
let num = count[data[i].cgddid] let num = count[data[i].cgddid]
if (num === 1) { if (num === 1) {
data[i]._span = {rowspan: 1, colspan: 1} data[i]._span = {rowspan: 1, colspan: 1}
@ -113,7 +124,7 @@ export default {
data[i]._span = {rowspan: num, colspan: 1} data[i]._span = {rowspan: num, colspan: 1}
i += num - 1 i += num - 1
} }
} }*/
}, },
cancel() { cancel() {

@ -5,7 +5,7 @@
<el-input <el-input
v-model="temp.filter" v-model="temp.filter"
size="small" size="small"
placeholder="筛选分类" placeholder="筛选试剂"
clearable clearable
suffix-icon="el-icon-search" suffix-icon="el-icon-search"
style="margin-bottom: 10px" style="margin-bottom: 10px"
@ -14,17 +14,36 @@
<category-tree ref="tree" :filter-node-method="filterNode" @node-click="nodeClick"/> <category-tree ref="tree" :filter-node-method="filterNode" @node-click="nodeClick"/>
</template> </template>
<search-form v-model="searchForm" @search="search" @reset="clearCidSearch"> <search-form v-model="searchForm" @search="search" @reset="clearNameSearch">
<el-form-item label="商品分类"> <el-form-item label="试 剂">
<el-input :value="temp.cname" maxlength="100" clearable @clear="clearCidSearch"/> <el-input :value="temp.name" maxlength="100" clearable @clear="clearNameSearch"/>
</el-form-item> </el-form-item>
<el-form-item label="采购订单"> <el-form-item label="厂 商">
<el-input v-model="searchForm.cgddid" maxlength="100" clearable/> <el-select v-model="searchForm.manufacture" clearable @clear="searchForm.manufacture = null">
<el-option :value="searchForm.manufacture" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="采购入库单"> <!-- <el-form-item label="行政区域">
<el-input v-model="searchForm.cgrkid" maxlength="100" clearable/> <region-selector
:value="temp.regionName"
limit
:limit-api="getLimitRegion"
get-children-on-select
@clear="clearSidSearch"
@select="selectRegion"
/>
</el-form-item>-->
<el-form-item label="分 类">
<el-select v-model="searchForm.type" clearable @clear="searchForm.type = null">
<el-option :value="searchForm.type" />
</el-select>
</el-form-item>
<el-form-item label="危险说明">
<el-select v-model="searchForm.risk" clearable @clear="searchForm.risk = null">
<el-option :value="searchForm.risk" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="入库时间"> <!-- <el-form-item label="入库时间">
<el-date-picker <el-date-picker
v-model="temp.ctime" v-model="temp.ctime"
format="yyyy-MM-dd" format="yyyy-MM-dd"
@ -32,7 +51,7 @@
type="daterange" type="daterange"
value-format="timestamp" value-format="timestamp"
/> />
</el-form-item> </el-form-item>-->
</search-form> </search-form>
<el-row class="button-group"> <el-row class="button-group">
@ -47,18 +66,25 @@
:summary-method="summary" :summary-method="summary"
> >
<el-table-column align="center" label="#" type="index" width="80"/> <el-table-column align="center" label="#" type="index" width="80"/>
<el-table-column align="center" label="商品分类">
<a slot-scope="{row}" type="primary" @click="() => more(row)">{{ row.cname }}</a> <el-table-column align="center" label="试 剂">
<a slot-scope="{row}" type="primary" @click="() => more(row)">{{ row.name }}</a>
</el-table-column> </el-table-column>
<el-table-column align="center" label="库存数量" prop="totalNum" show-overflow-tooltip/>
<el-table-column align="center" label="总 值" prop="totalPrice" show-overflow-tooltip/> <el-table-column align="center" label="货位" prop="location" show-overflow-tooltip/>
<el-table-column align="center" label="仓库" prop="storehouse" show-overflow-tooltip/>
<el-table-column align="center" label="库存数量" prop="quantity" show-overflow-tooltip/>
<el-table-column align="center" label="单位" prop="unit" show-overflow-tooltip/>
<!-- <el-table-column align="center" label="总 值" prop="totalPrice" show-overflow-tooltip/> -->
</abstract-table> </abstract-table>
<abstract-pagination :model="searchForm" @current-change="pageChange"/> <abstract-pagination :model="searchForm" @current-change="pageChange"/>
</el-row> </el-row>
</extra-area> </extra-area>
<detail-dialog v-model="detailDialog" :title="title" :cid="cid"/> <detail-dialog v-model="detailDialog" :title="title" :name="name"/>
</el-card> </el-card>
</template> </template>
@ -75,7 +101,7 @@ import {plus} from "@/util/math"
import {getNodeId} from "@/util/tree" import {getNodeId} from "@/util/tree"
export default { export default {
name: "currentStock", name: "reagentStock",
mixins: [tableMixin], mixins: [tableMixin],
@ -84,50 +110,52 @@ export default {
data() { data() {
return { return {
searchForm: { searchForm: {
cids: null, names: null,
cgddids: null, manufacture: null,
cgrkids: null type: null,
risk: null
}, },
temp: { temp: {
filter: '', filter: '',
cname: null, names: null,
cids: null,
ctime: []
}, },
detailDialog: false, detailDialog: false,
//
excel: { excel: {
columns: [ columns: [
{header: '序号', prop: 'id', width: 20, merge: true}, {header: '序号', prop: 'id', width: 20, merge: true},
{header: '分类名称', prop: 'cname', width: 20, merge: true}, {header: '试剂', prop: 'name', width: 20, merge: true},
{header: '货位', prop: 'location', width: 20, merge: true},
{header: '仓库', prop: 'storehouse', width: 20, merge: true},
{header: '库存总数', prop: 'totalNum', width: 20, merge: true}, {header: '库存总数', prop: 'totalNum', width: 20, merge: true},
{header: '库存总值', prop: 'totalPrice', width: 20, merge: true}, {header: '单位', prop: 'unit', width: 20, merge: true},
{header: '采购订单号', prop: 'cgddid', width: 20, merge: true},
{header: '采购单价', prop: 'cgPrice', width: 20, merge: true}, {header: '产品批次', prop: 'batch', width: 20, merge: true},
{header: '采购数量', prop: 'cgNum', width: 20, merge: true}, {header: '规格', prop: 'specification', width: 20, merge: true},
{header: '采购入库单号', prop: 'cgrkid', width: 20}, {header: '生产日期', prop: 'productionDate', width: 20, merge: true},
{header: '入库时间', prop: 'ctime', width: 20}, {header: '有效期(天)', prop: 'effective', width: 20, merge: true},
{header: '入库数量', prop: 'rkNum', width: 20},
], ],
merge: {primaryKey: 'cid', orderKey: 'id'} merge: {primaryKey: 'name', orderKey: 'id'}
} }
} }
}, },
computed: { computed: {
title() { title() {
return this.row ? `库存详细(${this.row.cname})` : '' return this.row ? `库存详细(${this.row.name})` : ''
}, },
cid() { name() {
return this.row ? this.row.cid : null return this.row ? this.row.name : null
} }
}, },
methods: { methods: {
summary({data}) { summary({data}) {
let sum = ['合计', '', '', 0] let sum = ['合计', '', '', '', '', '']
data.forEach(i => { data.forEach(i => {
sum[3] = plus(sum[3], i.totalPrice) sum[4] = plus(sum[4], i.totalNum) //
}) })
return sum return sum
}, },
@ -141,19 +169,19 @@ export default {
this.$refs.tree.filter(v) this.$refs.tree.filter(v)
}, },
mergeSearchForm() { /*mergeSearchForm() {
return { return {
...this.searchForm, ...this.searchForm,
startTime: this.temp.ctime ? this.temp.ctime[0] : null, //startTime: this.temp.ctime ? this.temp.ctime[0] : null,
endTime: this.temp.ctime ? this.temp.ctime[1] + 86400000 : null //endTime: this.temp.ctime ? this.temp.ctime[1] + 86400000 : null
} }
}, },*/
search() { search() {
if (this.config.loading) return if (this.config.loading) return
this.config.loading = true this.config.loading = true
search search
.request(this.mergeSearchForm()) .request(this.searchForm)
.then(({data: {list, total}}) => { .then(({data: {list, total}}) => {
this.searchForm.total = total this.searchForm.total = total
this.tableData = list this.tableData = list
@ -168,13 +196,13 @@ export default {
nodeClick(obj) { nodeClick(obj) {
const ids = getNodeId(obj.children) const ids = getNodeId(obj.children)
ids.unshift(obj.id) ids.unshift(obj.id)
this.searchForm.cids = ids.join(',') this.searchForm.names = ids.join(',')
this.temp.cname = obj.name this.temp.name = obj.name
}, },
clearCidSearch() { clearNameSearch() {
this.searchForm.cids = null this.searchForm.names = null
this.temp.cname = null this.temp.name = null
let tree = this.$refs.tree.$refs.tree let tree = this.$refs.tree.$refs.tree
tree.setCurrentKey() tree.setCurrentKey()
}, },
@ -182,6 +210,7 @@ export default {
more(row) { more(row) {
this.row = row this.row = row
this.detailDialog = true this.detailDialog = true
} }
}, },
Loading…
Cancel
Save