parent
3161c599dd
commit
f6fb0c3db8
@ -0,0 +1,62 @@ |
|||||||
|
package cn.toesbieya.jxc.controller.sys; |
||||||
|
|
||||||
|
import cn.toesbieya.jxc.model.entity.ReagentInfo; |
||||||
|
import cn.toesbieya.jxc.model.vo.R; |
||||||
|
import cn.toesbieya.jxc.model.vo.UserVo; |
||||||
|
import cn.toesbieya.jxc.model.vo.search.ReagentSearch; |
||||||
|
import cn.toesbieya.jxc.service.sys.SysReagentInfoService; |
||||||
|
import cn.toesbieya.jxc.util.SessionUtil; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/reagent") |
||||||
|
public class ReagentInfoController { |
||||||
|
@Resource |
||||||
|
private SysReagentInfoService service; |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public R search(@RequestBody ReagentSearch vo) { |
||||||
|
return R.success(service.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public R add(@RequestBody ReagentInfo reagent) { |
||||||
|
String errMsg = validateCreateParam(reagent); |
||||||
|
if (errMsg != null) return R.fail("添加失败," + errMsg); |
||||||
|
UserVo user = SessionUtil.get(); |
||||||
|
reagent.setId(null); |
||||||
|
reagent.setCreateTime(System.currentTimeMillis()); |
||||||
|
reagent.setCreatorId(user.getId()); |
||||||
|
reagent.setCreator(user.getNickName()); |
||||||
|
return service.add(reagent); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public R update(@RequestBody ReagentInfo reagent) { |
||||||
|
String errMsg = validateUpdateParam(reagent); |
||||||
|
return errMsg == null ? service.update(reagent) : R.fail("修改失败," + errMsg); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public R del(@RequestBody ReagentInfo reagent) { |
||||||
|
if (reagent.getId() == null) return R.fail("删除失败,参数错误"); |
||||||
|
return service.del(reagent); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateCreateParam(ReagentInfo reagent) { |
||||||
|
if (StringUtils.isEmpty(reagent.getName())) return "货位名称不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdateParam(ReagentInfo reagent) { |
||||||
|
if (reagent.getId() == null) return "参数错误"; |
||||||
|
return validateCreateParam(reagent); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package cn.toesbieya.jxc.model.vo; |
||||||
|
|
||||||
|
import cn.toesbieya.jxc.model.entity.ReagentInfo; |
||||||
|
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 ReagentVo extends ReagentInfo { |
||||||
|
|
||||||
|
public ReagentVo(ReagentInfo parent) { |
||||||
|
super(); |
||||||
|
BeanUtils.copyProperties(parent, this); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,112 @@ |
|||||||
|
package cn.toesbieya.jxc.service.sys; |
||||||
|
|
||||||
|
import cn.toesbieya.jxc.annoation.UserAction; |
||||||
|
import cn.toesbieya.jxc.mapper.ReagentMapper; |
||||||
|
import cn.toesbieya.jxc.model.entity.ReagentInfo; |
||||||
|
import cn.toesbieya.jxc.model.vo.ReagentVo; |
||||||
|
import cn.toesbieya.jxc.model.vo.search.ReagentSearch; |
||||||
|
import cn.toesbieya.jxc.model.vo.R; |
||||||
|
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||||
|
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 SysReagentInfoService { |
||||||
|
@Resource |
||||||
|
private ReagentMapper ReagentMapper; |
||||||
|
|
||||||
|
public PageResult<ReagentVo> search(ReagentSearch vo){ |
||||||
|
Integer id = vo.getId(); |
||||||
|
String name = vo.getName(); |
||||||
|
String supplier = vo.getSupplierName(); |
||||||
|
String risk = vo.getRisk(); |
||||||
|
String batch = vo.getBatch(); |
||||||
|
String location = vo.getLocationName(); |
||||||
|
String storehouse = vo.getStorehouse(); |
||||||
|
String creator = vo.getCreator(); |
||||||
|
Boolean enable = vo.getEnable(); |
||||||
|
|
||||||
|
Wrapper<ReagentInfo> wrapper = |
||||||
|
Wrappers.lambdaQuery(ReagentInfo.class) |
||||||
|
.eq(id != null,ReagentInfo::getId,id) |
||||||
|
.like(!StringUtils.isEmpty(name),ReagentInfo::getName,name) |
||||||
|
.like(!StringUtils.isEmpty(supplier),ReagentInfo::getSupplierId,supplier) |
||||||
|
.like(!StringUtils.isEmpty(risk),ReagentInfo::getRisk,risk) |
||||||
|
.like(!StringUtils.isEmpty(batch),ReagentInfo::getBatch,batch) |
||||||
|
.like(!StringUtils.isEmpty(location),ReagentInfo::getLocationId,location) |
||||||
|
.like(!StringUtils.isEmpty(storehouse),ReagentInfo::getStorehouse,storehouse) |
||||||
|
.like(!StringUtils.isEmpty(creator),ReagentInfo::getCreator,creator) |
||||||
|
.eq(enable != null,ReagentInfo::isEnable,enable) |
||||||
|
.orderByDesc(ReagentInfo::getCreateTime); |
||||||
|
|
||||||
|
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||||
|
|
||||||
|
List<ReagentInfo> Reagents = ReagentMapper.selectList(wrapper); |
||||||
|
|
||||||
|
PageResult<ReagentInfo> pageResult = new PageResult<>(Reagents); |
||||||
|
|
||||||
|
int ReagentNum = Reagents.size(); |
||||||
|
|
||||||
|
List<ReagentVo> list = new ArrayList<>(ReagentNum); |
||||||
|
|
||||||
|
Reagents.forEach(ReagentInfo -> { |
||||||
|
list.add(new ReagentVo(ReagentInfo)); |
||||||
|
}); |
||||||
|
|
||||||
|
return new PageResult<>(pageResult.getTotal(),list); |
||||||
|
} |
||||||
|
|
||||||
|
@UserAction("'添加试剂:'+ #Reagent.name") |
||||||
|
public R add(ReagentInfo Reagent){ |
||||||
|
if (isNameExist(Reagent.getName(), null)) { |
||||||
|
return R.fail(String.format("添加失败,试剂【%s】已存在", Reagent.getName())); |
||||||
|
} |
||||||
|
int rows = ReagentMapper.insert(Reagent); |
||||||
|
return rows > 0 ? R.success("添加成功") : R.fail("添加失败"); |
||||||
|
} |
||||||
|
|
||||||
|
@UserAction("'修改试剂' + #Reagent.name") |
||||||
|
public R update(ReagentInfo Reagent){ |
||||||
|
Integer id = Reagent.getId(); |
||||||
|
String name = Reagent.getName(); |
||||||
|
|
||||||
|
if(isNameExist(name,id)) { |
||||||
|
return R.fail(String.format("修改失败,试剂【%s】已存在", name)); |
||||||
|
} |
||||||
|
ReagentMapper.update( |
||||||
|
null, |
||||||
|
Wrappers.lambdaUpdate(ReagentInfo.class) |
||||||
|
.set(ReagentInfo::getName, name) |
||||||
|
.set(ReagentInfo::isEnable, Reagent.isEnable()) |
||||||
|
.eq(ReagentInfo::getId, id) |
||||||
|
); |
||||||
|
return R.success("修改成功"); |
||||||
|
} |
||||||
|
|
||||||
|
@UserAction("'删除试剂:'+ #Reagent.name") |
||||||
|
public R del(ReagentInfo Reagent) { |
||||||
|
int rows = ReagentMapper.delete( |
||||||
|
Wrappers.lambdaQuery(ReagentInfo.class) |
||||||
|
.eq(ReagentInfo::getId, Reagent.getId()) |
||||||
|
.eq(ReagentInfo::isEnable, false) |
||||||
|
); |
||||||
|
return rows > 0 ? R.success("删除成功") : R.fail("删除失败,请刷新重试"); |
||||||
|
} |
||||||
|
|
||||||
|
private boolean isNameExist(String name, Integer id) { |
||||||
|
Integer num = ReagentMapper.selectCount( |
||||||
|
Wrappers.lambdaQuery(ReagentInfo.class) |
||||||
|
.eq(ReagentInfo::getName, name) |
||||||
|
.ne(id != null, ReagentInfo::getId, id) |
||||||
|
); |
||||||
|
|
||||||
|
return num != null && num > 0; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
import {PostApi} from "@/api/request" |
||||||
|
|
||||||
|
export const search = new PostApi(`/system/reagent/search`) |
||||||
|
|
||||||
|
export const add = new PostApi(`/system/reagent/add`) |
||||||
|
|
||||||
|
export const update = new PostApi(`/system/reagent/update`) |
||||||
|
|
||||||
|
export const del = new PostApi(`/system/reagent/del`) |
||||||
@ -0,0 +1,207 @@ |
|||||||
|
<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="supplierId"> |
||||||
|
<supplier-selector |
||||||
|
v-if="canEdit" |
||||||
|
v-model="form.supplierId" |
||||||
|
@get-name="e => form.supplierName = e" |
||||||
|
/> |
||||||
|
<template v-else>{{ form.supplierName }}</template> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="试剂类型" prop="tape"> |
||||||
|
<el-input v-model="form.tape" :readonly="!canEdit" maxlength="50"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="危险说明" prop="risk"> |
||||||
|
<el-input v-model="form.risk " :readonly="!canEdit" maxlength="20"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="货 位" prop="locationId"> |
||||||
|
<supplier-selector |
||||||
|
v-if="canEdit" |
||||||
|
v-model="form.locationId" |
||||||
|
@get-name="e => form.locationName = e" |
||||||
|
/> |
||||||
|
<template v-else>{{ form.locationName }}</template> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="生产日期" prop="createTime"> |
||||||
|
<el-input v-model="form.createTime" :readonly="!canEdit" maxlength="20"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="有限期(天)" prop="effective "> |
||||||
|
<el-input v-model="form.effective " :readonly="!canEdit" maxlength="20"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="产品批次" prop="batch"> |
||||||
|
<el-input v-model="form.batch" :readonly="!canEdit" maxlength="20"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="规 格" prop="specification"> |
||||||
|
<el-input v-model="form.specification" :readonly="!canEdit" maxlength="20"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="状 态" prop="state"> |
||||||
|
<el-radio-group v-model="form.state" :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="unit"> |
||||||
|
<el-radio-group v-model="form.unit" :disabled="!canEdit"> |
||||||
|
<el-radio :label="true">瓶</el-radio> |
||||||
|
<el-radio :label="false">ml</el-radio> |
||||||
|
<el-radio :label="false">mg</el-radio> |
||||||
|
<el-radio :label="false">箱</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/reagent" |
||||||
|
import {isEmpty, mergeObj, resetObj} from '@/util' |
||||||
|
import {elConfirm} from "@/util/message" |
||||||
|
import SupplierSelector from "./component/SupplierSelector" |
||||||
|
import LocationSelector from "./component/LocationSelector" |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "EditDialog", |
||||||
|
|
||||||
|
mixins: [dialogMixin], |
||||||
|
|
||||||
|
components: { SupplierSelector, AbstractForm, AbstractDialog,LocationSelector}, |
||||||
|
|
||||||
|
props: { |
||||||
|
value: Boolean, |
||||||
|
type: {type: String, default: 'see'}, |
||||||
|
data: { |
||||||
|
type: Object, |
||||||
|
default: () => ({}) |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
data() { |
||||||
|
return { |
||||||
|
loading: false, |
||||||
|
form: { |
||||||
|
id: null, |
||||||
|
name: null, |
||||||
|
supplierName : null, |
||||||
|
tape:null, |
||||||
|
risk : null, |
||||||
|
createTime: null, |
||||||
|
batch: null, |
||||||
|
effective : null, |
||||||
|
enable: false, |
||||||
|
location :null, |
||||||
|
specification:null, |
||||||
|
unit:null, |
||||||
|
state:null, |
||||||
|
remark: null |
||||||
|
}, |
||||||
|
rules: { |
||||||
|
name: [{required: true, message: '名称不能为空', trigger: 'change'}], |
||||||
|
/* tape: [{required: true, message: '试剂类型不能为空', trigger: 'change'}], |
||||||
|
risk: [{required: true, message: '危险说明不能为空', trigger: 'change'}], |
||||||
|
createTime: [{required: true, message: '生产时间不能为空', trigger: 'change'}],*/ |
||||||
|
batch: [{required: true, message: '生产批次不能为空', trigger: 'change'}], |
||||||
|
/* |
||||||
|
effective: [{required: true, message: '有效期(天)不能为空', trigger: 'change'}], |
||||||
|
*/ |
||||||
|
location: [{required: true, message: '试剂货位不能为空', trigger: 'change'}], |
||||||
|
specification: [{required: true, message: '试剂规格不能为空', trigger: 'change'}], |
||||||
|
unit: [{required: true, message: '试剂单位不能为空', trigger: 'change'}], |
||||||
|
enable: [{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: { |
||||||
|
clearRegion() { |
||||||
|
this.form.region = null |
||||||
|
this.form.regionName = null |
||||||
|
}, |
||||||
|
|
||||||
|
selectRegion(obj) { |
||||||
|
this.form.region = obj.id |
||||||
|
this.form.regionName = obj.fullname |
||||||
|
}, |
||||||
|
|
||||||
|
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 Location" |
||||||
|
:key="item.id" |
||||||
|
:label="item.name" |
||||||
|
:value="item.id" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import {get} from "@/api/system/Location" |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "LocationSelector", |
||||||
|
|
||||||
|
props: {value: Number}, |
||||||
|
|
||||||
|
data: () => ({Location: []}), |
||||||
|
|
||||||
|
methods: { |
||||||
|
init() { |
||||||
|
get.request().then(({data}) => this.Location = data) |
||||||
|
}, |
||||||
|
|
||||||
|
emit(v) { |
||||||
|
this.$emit('input', v) |
||||||
|
if (v === 0 || v) { |
||||||
|
let item = this.Location.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,43 @@ |
|||||||
|
<template> |
||||||
|
<el-select :value="value" clearable @clear="() => emit(null)" @input="emit"> |
||||||
|
<el-option |
||||||
|
v-for="item in supplier" |
||||||
|
:key="item.id" |
||||||
|
:label="item.name" |
||||||
|
:value="item.id" |
||||||
|
/> |
||||||
|
</el-select> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import {get} from "@/api/system/supplier" |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "SupplierSelector", |
||||||
|
|
||||||
|
props: {value: Number}, |
||||||
|
|
||||||
|
data: () => ({supplier: []}), |
||||||
|
|
||||||
|
methods: { |
||||||
|
init() { |
||||||
|
get.request().then(({data}) => this.supplier = data) |
||||||
|
}, |
||||||
|
|
||||||
|
emit(v) { |
||||||
|
this.$emit('input', v) |
||||||
|
if (v === 0 || v) { |
||||||
|
let item = this.supplier.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,219 @@ |
|||||||
|
<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="厂 商" prop="manufacture"> |
||||||
|
<el-input v-model="searchForm.manufacture " maxlength="100"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="试剂类型" prop="tape"> |
||||||
|
<el-input v-model="searchForm.tape" maxlength="50"/> |
||||||
|
</el-form-item> |
||||||
|
|
||||||
|
<el-form-item label="货 位" prop="location"> |
||||||
|
<el-input v-model="searchForm.location " maxlength="20"/> |
||||||
|
</el-form-item> |
||||||
|
|
||||||
|
<el-form-item label="产品批次" prop="batch"> |
||||||
|
<el-input v-model="searchForm.batch" 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="单 位" prop="unit"> |
||||||
|
<el-radio-group v-model="searchForm.unit" > |
||||||
|
<el-radio :label="true">瓶</el-radio> |
||||||
|
<el-radio :label="false">ml</el-radio> |
||||||
|
<el-radio :label="false">mg</el-radio> |
||||||
|
<el-radio :label="false">箱</el-radio> |
||||||
|
<el-radio :label="false">包</el-radio> |
||||||
|
</el-radio-group> |
||||||
|
</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="tape" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="厂 商" prop="supplierName" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="危险说明" prop="risk" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="生产日期" prop="createTime" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="生产批次" prop="batch" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="有效期(天)" prop="effective" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="试剂货位" prop="locationName" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="试剂数量" prop="quantity" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="试剂规格" prop="specifitation" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="试剂单位" prop="unit" show-overflow-tooltip/> |
||||||
|
<el-table-column align="center" label="试剂状态" prop="enable" 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> |
||||||
|
</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 './EditDialog' |
||||||
|
import {add, update, del, search} from "@/api/system/reagent" |
||||||
|
import {isEmpty} from '@/util' |
||||||
|
import {wic} from "@/util/auth" |
||||||
|
import {elConfirm, elError, elSuccess} from "@/util/message" |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "reagentManagement", |
||||||
|
|
||||||
|
mixins: [tableMixin], |
||||||
|
|
||||||
|
components: {ListPage,EditDialog}, |
||||||
|
|
||||||
|
data() { |
||||||
|
return { |
||||||
|
searchForm: { |
||||||
|
name: '', |
||||||
|
manufacture: '', |
||||||
|
tape: '', |
||||||
|
enable: null, |
||||||
|
unit: '', |
||||||
|
specifitation: '', |
||||||
|
quantity: '', |
||||||
|
location: '', |
||||||
|
ffective: '', |
||||||
|
batch: '', |
||||||
|
createTime: '', |
||||||
|
risk: '', |
||||||
|
}, |
||||||
|
temp: { |
||||||
|
ctime: [] |
||||||
|
}, |
||||||
|
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: { |
||||||
|
/*/!*getLimitRegion() { |
||||||
|
return getLimitRegion.request().then(data => data.data) |
||||||
|
},*!/ |
||||||
|
|
||||||
|
clearSidSearch() { |
||||||
|
/!*this.searchForm.region = null |
||||||
|
this.temp.regionName = null*!/ |
||||||
|
}, |
||||||
|
|
||||||
|
selectRegion(obj, ids) { |
||||||
|
/!*this.searchForm.region = ids.join(',') |
||||||
|
this.temp.regionName = obj.fullname*!/ |
||||||
|
},*/ |
||||||
|
|
||||||
|
mergeSearchForm() { |
||||||
|
return { |
||||||
|
...this.searchForm, |
||||||
|
startTime: this.temp.ctime ? this.temp.ctime[0] : null, |
||||||
|
endTime: this.temp.ctime ? this.temp.ctime[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.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> |
||||||
Loading…
Reference in new issue