1.添加货位管理页面

2.修改仓库id问题,添加仓库创建人功能实现
3.入库页面部分修改
master
王保桦 4 years ago
parent c7030888b2
commit 5757d71a60
  1. 5
      java/local/src/main/java/cn/toesbieya/jxc/controller/sys/EquipmentController.java
  2. 57
      java/local/src/main/java/cn/toesbieya/jxc/controller/sys/LocationController.java
  3. 7
      java/local/src/main/java/cn/toesbieya/jxc/controller/sys/StorehouseController.java
  4. 3
      java/local/src/main/java/cn/toesbieya/jxc/mapper/SysEquipmentMapper.java
  5. 8
      java/local/src/main/java/cn/toesbieya/jxc/mapper/SysLocationMapper.java
  6. 4
      java/local/src/main/java/cn/toesbieya/jxc/model/entity/SysEquipment.java
  7. 57
      java/local/src/main/java/cn/toesbieya/jxc/model/entity/SysLocation.java
  8. 6
      java/local/src/main/java/cn/toesbieya/jxc/model/entity/SysStorehouse.java
  9. 20
      java/local/src/main/java/cn/toesbieya/jxc/model/vo/LocationVo.java
  10. 1
      java/local/src/main/java/cn/toesbieya/jxc/model/vo/search/EquipmentSearch.java
  11. 18
      java/local/src/main/java/cn/toesbieya/jxc/model/vo/search/LocationSearch.java
  12. 1
      java/local/src/main/java/cn/toesbieya/jxc/service/sys/SysEquipmentService.java
  13. 106
      java/local/src/main/java/cn/toesbieya/jxc/service/sys/SysLocationService.java
  14. 6
      java/local/src/main/java/cn/toesbieya/jxc/service/sys/SysStorehouseService.java
  15. 9
      vue/full/src/api/system/location.js
  16. 3
      vue/full/src/api/system/storehouse.js
  17. 117
      vue/full/src/view/admin/purchase/inbound/component/ReagentSelector.vue
  18. 108
      vue/full/src/view/admin/purchase/inbound/detailPage.vue
  19. 2
      vue/full/src/view/admin/purchase/inbound/indexPage.vue
  20. 6
      vue/full/src/view/admin/system/equipment/indexPage.vue
  21. 150
      vue/full/src/view/admin/system/location/component/EditDialog.vue
  22. 43
      vue/full/src/view/admin/system/location/component/StorehouseSelector.vue
  23. 169
      vue/full/src/view/admin/system/location/indexPage.vue
  24. 4
      vue/full/src/view/admin/system/storehouse/indexPage.vue

@ -1,9 +1,11 @@
package cn.toesbieya.jxc.controller.sys;
import cn.toesbieya.jxc.model.entity.SysEquipment;
import cn.toesbieya.jxc.model.vo.UserVo;
import cn.toesbieya.jxc.model.vo.search.EquipmentSearch;
import cn.toesbieya.jxc.service.sys.SysEquipmentService;
import cn.toesbieya.jxc.model.vo.R;
import cn.toesbieya.jxc.util.SessionUtil;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -24,8 +26,11 @@ public class EquipmentController {
public R add(@RequestBody SysEquipment equipment) {
String errMsg = validateCreateParam(equipment);
if (errMsg != null) return R.fail("添加失败," + errMsg);
UserVo user = SessionUtil.get();
equipment.setId(null);
equipment.setCreateTime(System.currentTimeMillis());
equipment.setCreatorId(user.getId());
equipment.setCreatorName(user.getNickName());
return service.add(equipment);
}

@ -0,0 +1,57 @@
package cn.toesbieya.jxc.controller.sys;
import cn.toesbieya.jxc.model.entity.SysLocation;
import cn.toesbieya.jxc.model.vo.UserVo;
import cn.toesbieya.jxc.model.vo.search.LocationSearch;
import cn.toesbieya.jxc.service.sys.SysLocationService;
import cn.toesbieya.jxc.model.vo.R;
import cn.toesbieya.jxc.util.SessionUtil;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("system/location")
public class LocationController {
@Resource
private SysLocationService service;
@PostMapping("search")
public R search(@RequestBody LocationSearch vo) {
return R.success(service.search(vo));
}
@PostMapping("add")
public R add(@RequestBody SysLocation location) {
String errMsg = validateCreateParam(location);
if (errMsg != null) return R.fail("添加失败," + errMsg);
UserVo user = SessionUtil.get();
location.setId(null);
location.setCreateTime(System.currentTimeMillis());
location.setCreatorId(user.getId());
location.setCreatorName(user.getNickName());
return service.add(location);
}
@PostMapping("update")
public R update(@RequestBody SysLocation location) {
String errMsg = validateUpdateParam(location);
return errMsg == null ? service.update(location) : R.fail("修改失败," + errMsg);
}
@PostMapping("del")
public R del(@RequestBody SysLocation location) {
if (location.getId() == null) return R.fail("删除失败,参数错误");
return service.del(location);
}
private String validateCreateParam(SysLocation location) {
if (StringUtils.isEmpty(location.getName())) return "货位名称不能为空";
return null;
}
private String validateUpdateParam(SysLocation location) {
if (location.getId() == null) return "参数错误";
return validateCreateParam(location);
}
}

@ -17,6 +17,11 @@ public class StorehouseController {
@Resource
private SysStorehouseService service;
@GetMapping("get")
public R get() {
return R.success(service.get());
}
@PostMapping("search")
public R search(@RequestBody StorehouseSearch vo) {
return R.success(service.search(vo));
@ -30,8 +35,8 @@ public class StorehouseController {
//添加创建人、创建时间
UserVo user = SessionUtil.get();
storehouse.setCreatorId(user.getId());
storehouse.setCreatorName(user.getNickName());
storehouse.setCreateTime(System.currentTimeMillis());
return service.add(storehouse);
}

@ -1,12 +1,9 @@
package cn.toesbieya.jxc.mapper;
import cn.toesbieya.jxc.model.entity.SysEquipment;
import cn.toesbieya.jxc.model.vo.result.RegionValueResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
public interface SysEquipmentMapper extends BaseMapper<SysEquipment> {
List<RegionValueResult> getLimitRegion();
}

@ -0,0 +1,8 @@
package cn.toesbieya.jxc.mapper;
import cn.toesbieya.jxc.model.entity.SysLocation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface SysLocationMapper extends BaseMapper<SysLocation> {
}

@ -51,6 +51,10 @@ public class SysEquipment {
* 创建人id
*/
private Integer creatorId;
/**
* 创建人用户名
*/
private String creatorName;
/**
* 创建时间
*/

@ -0,0 +1,57 @@
package cn.toesbieya.jxc.model.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SysLocation {
/**
* 货位id
*/
private Integer id;
/**
* 货位名称
*/
private String name;
/**
* 仓位容量
*/
private int capacity;
/**
* 仓库name
*/
private String storehouseName;
/**
* 仓库id
*/
private Integer storehouseId;
/**
* 状态0停用1启用
*/
private boolean enable = false;
/**
* 创建人id
*/
private Integer creatorId;
/**
* 创建人昵称
*/
private String creatorName;
/**
* 创建时间
*/
private Long createTime;
/**
* 修改人id
*/
private Integer updateId;
/**
* 修改时间
*/
private Long updateTime;
}

@ -18,7 +18,7 @@ public class SysStorehouse {
* 仓库编码
*/
@Column
private String id;
private Integer id;
/**
* 名称
*/
@ -49,6 +49,10 @@ public class SysStorehouse {
*/
@Column
private Integer creatorId;
/**
* 创建人昵称
*/
private String creatorName;
/**
* 创建时间
*/

@ -0,0 +1,20 @@
package cn.toesbieya.jxc.model.vo;
import cn.toesbieya.jxc.model.entity.SysLocation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.beans.BeanUtils;
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class LocationVo extends SysLocation {
private String regionName;
public LocationVo(SysLocation parent) {
BeanUtils.copyProperties(parent, this);
}
}

@ -12,6 +12,7 @@ public class EquipmentSearch extends BaseSearch {
private String name;
private String spec;
private String introduction;
private String creatorName;
private String supplier;
private String manuDate;
private String buyDate;

@ -0,0 +1,18 @@
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 LocationSearch extends BaseSearch {
private Integer id;
private String name;
private String storehouseName;
private String creatorName;
private Boolean enable;
private Long startTime;
private Long endTime;
}

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@ -0,0 +1,106 @@
package cn.toesbieya.jxc.service.sys;
import cn.toesbieya.jxc.annoation.UserAction;
import cn.toesbieya.jxc.mapper.SysLocationMapper;
import cn.toesbieya.jxc.model.entity.SysLocation;
import cn.toesbieya.jxc.model.vo.LocationVo;
import cn.toesbieya.jxc.model.vo.R;
import cn.toesbieya.jxc.model.vo.result.PageResult;
import cn.toesbieya.jxc.model.vo.search.LocationSearch;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class SysLocationService {
@Resource
private SysLocationMapper LocationMapper;
public PageResult<LocationVo> search(LocationSearch vo){
Integer id = vo.getId();
String name = vo.getName();
String storehouseName = vo.getStorehouseName();
String creatorName = vo.getCreatorName();
Boolean enable = vo.getEnable();
Long startTime = vo.getStartTime();
Long endTime = vo.getEndTime();
Wrapper<SysLocation> wrapper =
Wrappers.lambdaQuery(SysLocation.class)
.eq(id != null,SysLocation::getId,id)
.like(!StringUtils.isEmpty(name),SysLocation::getName,name)
.like(!StringUtils.isEmpty(storehouseName),SysLocation::getStorehouseName,storehouseName)
.like(!StringUtils.isEmpty(creatorName),SysLocation::getCreatorName,creatorName)
.eq(enable != null,SysLocation::isEnable,enable)
.ge(startTime != null,SysLocation::getCreateTime,startTime)
.le(endTime != null,SysLocation::getCreateTime,endTime)
.orderByDesc(SysLocation::getCreateTime);
PageHelper.startPage(vo.getPage(), vo.getPageSize());
List<SysLocation> Locations = LocationMapper.selectList(wrapper);
PageResult<SysLocation> pageResult = new PageResult<>(Locations);
int LocationNum = Locations.size();
List<LocationVo> list = new ArrayList<>(LocationNum);
Locations.forEach(Location -> {
list.add(new LocationVo(Location));
});
return new PageResult<>(pageResult.getTotal(),list);
}
@UserAction("'添加货位:'+ #Location.name")
public R add(SysLocation Location){
if (isNameExist(Location.getName(), null)) {
return R.fail(String.format("添加失败,货位【%s】已存在", Location.getName()));
}
int rows = LocationMapper.insert(Location);
return rows > 0 ? R.success("添加成功") : R.fail("添加失败");
}
@UserAction("'修改货位' + #Location.name")
public R update(SysLocation Location){
Integer id = Location.getId();
String name = Location.getName();
if(isNameExist(name,id)) {
return R.fail(String.format("修改失败,货位【%s】已存在", name));
}
LocationMapper.update(
null,
Wrappers.lambdaUpdate(SysLocation.class)
.set(SysLocation::getName, name)
.set(SysLocation::isEnable, Location.isEnable())
.eq(SysLocation::getId, id)
);
return R.success("修改成功");
}
@UserAction("'删除货位:'+ #Location.name")
public R del(SysLocation Location) {
int rows = LocationMapper.delete(
Wrappers.lambdaQuery(SysLocation.class)
.eq(SysLocation::getId, Location.getId())
.eq(SysLocation::isEnable, false)
);
return rows > 0 ? R.success("删除成功") : R.fail("删除失败,请刷新重试");
}
private boolean isNameExist(String name, Integer id) {
Integer num = LocationMapper.selectCount(
Wrappers.lambdaQuery(SysLocation.class)
.eq(SysLocation::getName, name)
.ne(id != null, SysLocation::getId, id)
);
return num != null && num > 0;
}
}

@ -76,11 +76,11 @@ public class SysStorehouseService {
@UserAction("'修改仓库:'+ #storehouse.name")
public R update(SysStorehouse storehouse) {
String id = storehouse.getId();
Integer id = storehouse.getId();
String name = storehouse.getName();
if (isNameExist(name, id)) {
return R.fail(String.format("修改失败,供应商【%s】已存在", name));
return R.fail(String.format("修改失败,仓库【%s】已存在", name));
}
storehouseMapper.update(
@ -107,7 +107,7 @@ public class SysStorehouseService {
return rows > 0 ? R.success("删除成功") : R.fail("删除失败,请刷新重试");
}
private boolean isNameExist(String name, String id) {
private boolean isNameExist(String name, Integer id) {
Integer num = storehouseMapper.selectCount(
Wrappers.lambdaQuery(SysStorehouse.class)
.eq(SysStorehouse::getName, name)

@ -0,0 +1,9 @@
import {PostApi} from "@/api/request"
export const search = new PostApi(`/system/location/search`)
export const add = new PostApi(`/system/location/add`)
export const update = new PostApi(`/system/location/update`)
export const del = new PostApi(`/system/location/del`)

@ -1,4 +1,5 @@
import {PostApi} from "@/api/request"
import {GetApi} from "@/api/request"
export const search = new PostApi(`/system/storehouse/search`)
@ -7,3 +8,5 @@ export const add = new PostApi(`/system/storehouse/add`)
export const update = new PostApi(`/system/storehouse/update`)
export const del = new PostApi(`/system/storehouse/del`)
export const get = new GetApi(`/system/storehouse/get`)

@ -0,0 +1,117 @@
<template>
<el-dialog
v-drag-dialog
:visible="value"
append-to-body
title="选择供应商"
width="70%"
@close="cancel"
@open="search"
>
<el-row>
<el-button icon="el-icon-search" size="small" type="primary" @click="search"> </el-button>
<el-button size="small" type="primary" @click="confirm"> </el-button>
<el-button plain size="small" @click="closeDialog"> </el-button>
<el-button
plain
size="small"
type="dashed"
@click="goToSysSupplierPage"
>
添加供应商
</el-button>
</el-row>
<el-scrollbar>
<el-row class="table-container">
<liner-progress :show="config.loading"/>
<el-table
ref="table"
:data="tableData"
current-row-key="id"
highlight-current-row
row-key="id"
@row-click="rowClick"
@row-dblclick="dbclick"
>
<el-table-column align="center" label="#" type="index" width="80"/>
<el-table-column align="center" label="供应商" prop="name" show-overflow-tooltip/>
<el-table-column align="center" label="行政区域" prop="regionName" show-overflow-tooltip/>
<el-table-column align="center" label="地 址" prop="address" show-overflow-tooltip/>
<el-table-column align="center" label="联系人" prop="linkman" show-overflow-tooltip/>
<el-table-column align="center" label="联系电话" prop="linkphone" show-overflow-tooltip/>
<el-table-column align="center" label="创建时间" width="150">
<template v-slot="{row}">{{ row.ctime | timestamp2Date }}</template>
</el-table-column>
<el-table-column align="center" label="状 态" width="120">
<template v-slot="{row}">
<span :class="row.enable ? 'success' : 'error'" class="dot"/>
<span>{{ row.enable ? '启用' : '禁用' }}</span>
</template>
</el-table-column>
</el-table>
<abstract-pagination :model="searchForm" @current-change="pageChange"/>
</el-row>
</el-scrollbar>
</el-dialog>
</template>
<script>
import dialogMixin from "@/mixin/dialogMixin"
import tableMixin from '@/mixin/tablePageMixin'
import LinerProgress from '@/component/LinerProgress'
import {search} from "@/api/system/supplier"
import {elError} from "@/util/message"
export default {
name: "SupplierSelector",
mixins: [dialogMixin, tableMixin],
components: {LinerProgress},
props: {value: Boolean},
data() {
return {
searchForm: {
enable: true
}
}
},
methods: {
search() {
if (!this.value || this.config.loading) return
this.config.loading = true
this.row = null
search
.request(this.searchForm)
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})
.finally(() => this.config.loading = false)
},
dbclick(row) {
this.row = row
this.confirm()
},
confirm() {
if (!this.row) return elError('请选择一个供应商')
this.$emit('select', this.row)
this.cancel()
},
cancel() {
this.closeDialog()
this.tableData = []
},
goToSysSupplierPage() {
this.closeDialog()
this.$emit('jump')
this.$nextTick(() => this.$router.push('/system/supplier'))
}
}
}
</script>

@ -23,6 +23,86 @@
</el-input>
<template v-else>{{ form.pid }}</template>
</abstract-form-item>
<abstract-form-item label="基本信息" prop="pid">
<el-input v-if="canSave" :value="form.pid" readonly>
<template v-slot:append>
<el-button @click="reagentDialog=true">选择</el-button>
</template>
</el-input>
<template v-else>{{ form.pid }}</template>
</abstract-form-item>
<template>
<el-table :data="tabledatas" border>
<el-table-column label="试剂名称" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="试剂类型" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="规格" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="单位" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="批次" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="试剂厂商" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="生产日期" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="批号/保质期/过期日期" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="存放地" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="货位" align="center">
<template slot-scope="scope">
<el-input placeholder="请输入内容" v-show="scope.row.show" v-model="scope.row.tab2"></el-input>
<span v-show="!scope.row.show">{{scope.row.tab2}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<div>
<el-button @click="scope.row.show =true">编辑</el-button>
<el-button @click="scope.row.show =false">保存</el-button>
</div>
</template>
</el-table-column>
</el-table>
</template>
</collapse-card>
<collapse-card ref="goods" header="入库商品">
@ -71,12 +151,15 @@
</abstract-form>
<order-selector v-model="parentDialog" @select="selectParent"/>
<reagent-selector v-model="reagentDialog" @select="selectReagent"/>
</detail-page>
</template>
<script>
import docDetailMixin from "@/mixin/docDetailMixin"
import OrderSelector from './component/OrderSelector'
import ReagentSelector from "./component/ReagentSelector";
import {getById, add, update, commit, withdraw, pass, reject} from "@/api/doc/purchase/inbound"
import {getSubById as getParentSubById} from "@/api/doc/purchase/order"
import {isEmpty} from "@/util"
@ -88,12 +171,13 @@ export default {
mixins: [docDetailMixin],
components: {OrderSelector},
components: {OrderSelector,ReagentSelector},
data() {
this.docName = '采购入库单'
this.api = {getById, add, update, commit, withdraw, pass, reject}
return {
tabledatas: [],
form: {
pid: null
},
@ -109,6 +193,7 @@ export default {
{ref: 'history', label: '单据历史'}
],
parentDialog: false,
reagentDialog:false,
parentSubList: []
}
},
@ -135,6 +220,10 @@ export default {
if (this.type !== 'edit') return Promise.resolve()
return getParentSubById.request(this.form.pid).then(data => this.parentSubList = data)
},
selectReagent(row) {
this.form.sid = row.id
this.form.sname = row.name
},
selectParent(id, sub) {
this.parentSubList = sub
this.form.pid = id
@ -180,6 +269,21 @@ export default {
}
return null
}
}
},
created() {
// ,api
//demolist
// getlistApi().then(res => {
// let list = res.data.list
let list = [
{ tab1: 'tast2', tab2: 'tast333' },
{ tab1: 'aaa', tab2: 'bbb' },
]
list.forEach(element => {
element["show"] = false
});
this.tabledatas = list
// })
},
}
</script>

@ -4,7 +4,7 @@
<el-form-item label="单 号">
<el-input v-model="searchForm.idFuzzy" clearable maxlength="50"/>
</el-form-item>
<el-form-item label="采购订单">
<el-form-item label="入库订单">
<el-input v-model="searchForm.pidFuzzy" clearable maxlength="50"/>
</el-form-item>
<el-form-item label="创建人">

@ -59,7 +59,7 @@
<template v-slot="{row}">{{ row.buyDate | timestamp2Date }}</template>
</el-table-column>
<el-table-column align="center" label="存放位置" prop="location" show-overflow-tooltip/>
<el-table-column align="center" label="创建人" prop="spec" show-overflow-tooltip/>
<el-table-column align="center" label="创建人" prop="creatorName" show-overflow-tooltip/>
<el-table-column align="center" label="创建时间" width="150">
<template v-slot="{row}">{{ row.createTime | timestamp2Date }}</template>
</el-table-column>
@ -78,7 +78,6 @@
import tableMixin from '@/mixin/tablePageMixin'
import ListPage from '@/view/_common/ListPage'
import EditDialog from './EditDialog'
import RegionSelector from "@/component/RegionSelector"
import {add, update, del, search} from "@/api/system/equipment"
import {isEmpty} from '@/util'
import {wic} from "@/util/auth"
@ -89,13 +88,14 @@ export default {
mixins: [tableMixin],
components: {ListPage, EditDialog, RegionSelector},
components: {ListPage, EditDialog},
data() {
return {
searchForm: {
name: '',
spec: '',
creator:'',
introduction: '',
supplier: '',
manuDate: '',

@ -0,0 +1,150 @@
<template>
<abstract-dialog :loading="loading" :title="title" :value="value" @close="cancel" @open="open">
<abstract-form :model="form" :rules="rules">
<el-form-item label="货位名" prop="name">
<el-input v-model="form.name" :readonly="!canEdit" maxlength="20"/>
</el-form-item>
<el-form-item label="容 量" prop="capacity">
<el-input v-model="form.capacity" :readonly="!canEdit" maxlength="20"/>
</el-form-item>
<el-form-item label="所属仓库" prop="storehouseId">
<storehouse-selector
v-if="canEdit"
v-model="form.storehouseId"
@get-name="e => form.storehouseName = e"
/>
<template v-else>{{ form.storehouseName }}</template>
</el-form-item>
<el-form-item label="状 态" prop="enable">
<el-radio-group v-model="form.enable" :disabled="!canEdit">
<el-radio :label="true">启用</el-radio>
<el-radio :label="false">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备 注" prop="remark">
<el-input
v-model="form.remark"
:rows="4"
:readonly="!canEdit"
maxlength="200"
show-word-limit
type="textarea"
/>
</el-form-item>
</abstract-form>
<template v-slot:footer>
<el-button plain size="small" @click="closeDialog"> </el-button>
<el-button v-if="canEdit" size="small" type="primary" @click="confirm"> </el-button>
</template>
</abstract-dialog>
</template>
<script>
import dialogMixin from "@/mixin/dialogMixin"
import AbstractForm from "@/component/abstract/Form"
import AbstractDialog from '@/component/abstract/Dialog'
import {add, update} from "@/api/system/location"
import {isEmpty, mergeObj, resetObj} from '@/util'
import {elConfirm} from "@/util/message"
import StorehouseSelector from "./StorehouseSelector";
export default {
name: "EditDialog",
mixins: [dialogMixin],
components: {AbstractForm, AbstractDialog,StorehouseSelector},
props: {
value: Boolean,
type: {type: String, default: 'see'},
data: {
type: Object,
default: () => ({})
},
},
data() {
return {
loading: false,
form: {
id: null,
name: null,
capacity:null,
storehouse:null,
storehouseName:null,
storehouseId:null,
enable: false,
role: null,
},
rules: {
name: [{required: true, message: '名称不能为空', trigger: 'change'}],
capacity: [{required: true, message: '容量不能为空', trigger: 'change'}],
storehouse: [{required: true, message: '仓库不能为空', trigger: 'change'}],
location: [{required: true, message: '存放位置不能为空', trigger: 'change'}],
}
}
},
computed: {
title() {
if (isEmpty(this.type)) return ''
switch (this.type) {
case 'see':
return '货位信息'
case 'add':
return '添加货位'
case 'edit':
return '编辑货位'
}
},
confirmMessage() {
switch (this.type) {
case 'add':
return `确认添加新的货位【${this.form.name}】?`
case 'edit':
return `确认提交对【${this.data.name}】作出的修改?`
default:
return ''
}
},
canEdit() {
return ['add', 'edit'].includes(this.type)
}
},
methods: {
open() {
if (this.type !== 'add') mergeObj(this.form, this.data)
},
clearForm() {
resetObj(this.form)
this.$nextTick(() => this.$refs.form.clearValidate())
},
cancel() {
this.closeDialog()
this.clearForm()
},
confirm() {
if (this.loading) return
this.$refs.form.validate(v => {
if (!v) return
elConfirm(this.confirmMessage)
.then(() => {
this.loading = true
return this.type === 'add' ? add.request(this.form) : update.request(this.form)
})
.then(({msg}) => this.$emit('success', msg))
.finally(() => this.loading = false)
})
}
}
}
</script>

@ -0,0 +1,43 @@
<template>
<el-select :value="value" clearable @clear="() => emit(null)" @input="emit">
<el-option
v-for="item in storehouse"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</template>
<script>
import {get} from "@/api/system/storehouse"
export default {
name: "StorehouseSelector",
props: {value: Number},
data: () => ({storehouse: []}),
methods: {
init() {
get.request().then(({data}) => this.storehouse = data)
},
emit(v) {
this.$emit('input', v)
if (v === 0 || v) {
let item = this.storehouse.find(i => i.id === v)
this.$emit('get-name', item ? item.name : null)
}
else {
this.$emit('get-name', null)
}
}
},
mounted() {
this.init()
}
}
</script>

@ -0,0 +1,169 @@
<template>
<list-page :data="listPageConfig">
<template v-slot:searchForm>
<el-form-item label="货位名">
<el-input v-model="searchForm.name" clearable maxlength="50"/>
</el-form-item>
<el-form-item label="所属仓库">
<el-input v-model="searchForm.storehouseName" clearable maxlength="20"/>
</el-form-item>
<el-form-item label="状 态">
<el-select v-model="searchForm.enable" clearable @clear="searchForm.enable = null">
<el-option :value="true" label="启用"/>
<el-option :value="false" label="禁用"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="temp.createTime"
format="yyyy-MM-dd"
range-separator="-"
type="daterange"
value-format="timestamp"
/>
</el-form-item>
</template>
<template v-slot:tableColumn>
<el-table-column align="center" label="#" type="index" width="80"/>
<el-table-column align="center" label="货位名" prop="name" show-overflow-tooltip/>
<el-table-column align="center" label="容 量" prop="capacity" show-overflow-tooltip/>
<el-table-column align="center" label="所属仓库" prop="storehouseName" show-overflow-tooltip/>
<el-table-column align="center" label="创建人" prop="creatorName" show-overflow-tooltip/>
<el-table-column align="center" label="创建时间" width="150">
<template v-slot="{row}">{{ row.createTime | timestamp2Date }}</template>
</el-table-column>
<el-table-column align="center" label="状 态" width="120">
<template v-slot="{row}">
<span :class="row.enable ? 'success' : 'error'" class="dot"/>
<span>{{ row.enable ? '启用' : '禁用' }}</span>
</template>
</el-table-column>
</template>
<edit-dialog v-model="editDialog" :data="row" :type="type" @success="success"/>
</list-page>
</template>
<script>
import tableMixin from '@/mixin/tablePageMixin'
import ListPage from '@/view/_common/ListPage'
import EditDialog from './component/EditDialog'
import {add, update, del, search} from "@/api/system/location"
import {isEmpty} from '@/util'
import {wic} from "@/util/auth"
import {elConfirm, elError, elSuccess} from "@/util/message"
export default {
name: "locationManagement",
mixins: [tableMixin],
components: {ListPage, EditDialog},
data() {
return {
searchForm: {
name: '',
storehouse: '',
enable: null
},
temp: {
createTime: []
},
editDialog: false
}
},
computed: {
...wic({add, update, del}),
listPageConfig() {
return {
pageLoading: this.config.operating,
buttons: [
this.canAdd && {icon: 'el-icon-plus', e: this.add, content: '添 加'},
{icon: 'el-icon-view', e: this.see, content: '查 看'},
this.canUpdate && {icon: 'el-icon-edit', e: this.edit, content: '编 辑'},
this.canDel && {icon: 'el-icon-delete', e: this.del, content: '删 除'}
],
dataLoading: this.config.loading,
search: {
props: {model: this.searchForm},
on: {search: this.search}
},
table: {
props: {data: this.tableData},
on: {'row-click': this.rowClick}
},
pagination: {
props: {model: this.searchForm},
on: {'current-change': this.pageChange}
}
}
}
},
methods: {
mergeSearchForm() {
return {
...this.searchForm,
startTime: this.temp.createTime ? this.temp.createTime[0] : null,
endTime: this.temp.createTime ? this.temp.createTime[1] + 86400000 : null
}
},
search() {
if (this.config.loading) return
this.config.loading = true
this.row = null
this.type = 'see'
search
.request(this.mergeSearchForm())
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})
.finally(() => this.config.loading = false)
},
add() {
this.row = null
this.type = 'add'
this.editDialog = true
},
see() {
if (isEmpty(this.row)) return elError('请选择要查看的货位')
this.type = 'see'
this.editDialog = true
},
edit() {
if (isEmpty(this.row)) return elError('请选择要编辑的货位')
this.type = 'edit'
this.editDialog = true
},
del() {
if (isEmpty(this.row)) return elError('请选择要删除的货位')
if (this.row.enable) return elError('已货位的设备不能删除')
if (this.config.operating) return
elConfirm(`确定删除货位【${this.row.name}】?`)
.then(() => {
this.config.operating = true
return del.request({id: this.row.id, name: this.row.name})
})
.then(() => this.success('删除成功'))
.finally(() => this.config.operating = false)
},
success(msg) {
elSuccess(msg)
this.editDialog = false
this.search()
}
}
}
</script>

@ -44,9 +44,9 @@
</template>
</el-table-column>
<el-table-column align="center" label="创建人" prop="pname" show-overflow-tooltip/>
<el-table-column align="center" label="创建人" prop="creatorName" show-overflow-tooltip/>
<el-table-column align="center" label="创建时间" width="150">
<template v-slot="{row}">{{ row.ptime | timestamp2Date }}</template>
<template v-slot="{row}">{{ row.createTime | timestamp2Date }}</template>
</el-table-column>
</template>

Loading…
Cancel
Save