Commit f578aa44 authored by 仇晓婷's avatar 仇晓婷

资源

parent ab18ca7a
......@@ -313,14 +313,13 @@ export default {
if (this.initsearch) {
this.initsearch(this.search);
}
this.$api.post(this.action, this.search).then((r) => {
this.$api.post(this.action, this.search).then((r) => {
if (this.format) {
this.list = this.format(r.result.items);
} else {
this.list = r.result.items;
}
this.search.total = r.result.totalCount || r.result.count;
});
}
},
......@@ -487,7 +486,7 @@ export default {
this.footerToolbar = items.length > 0;
},
onSelect(rows, row) {
this.$emit("on-selection-change", rows, row);
this.$emit("on-change", rows, row);
},
intY() {
if (this.$refs.table != undefined) {
......
......@@ -8,7 +8,7 @@
:high="false"
@on-drag-drop="onDragDrop"
:page="false"
@on-selection-change="onSelect"
@on-change="onSelect"
:batch="true"
:border="true"
:easy="true"
......
<template>
<div class="addform">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('nameOfResource')" prop="nameOfResource">
<Input v-model="entity.nameOfResource"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('specifications')" >
<Input v-model="entity.specifications"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('totalNum')" prop="totalNum">
<InputNumber v-model="entity.totalNum" :min="1"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('measuringUnit')" >
<Input v-model="entity.measuringUnit"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('qualityCharacteristics')" >
<Input v-model="entity.qualityCharacteristics"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batchNo')" >
<Input v-model="entity.batchNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input v-model="entity.storeTitle" readonly clearable @on-clear="clear" placeholder="请选择..." style="width:274px">
<Button slot="append" @click="selectStoreHouse">选择</Button>
<label slot="append" v-if="false">{{entity.storeId}}</label>
</Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('resourceType')" >
<Dictionary
code="mes_xingchi_resource.resource.resource_type"
v-model="entity.resourceType"
style="width:274px"
></Dictionary>
</FormItem>
</Col>
</Row>
<Row>
<Col span="18">&nbsp;</Col>
<Col span="6">
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit">保存</Button>
</Col>
</Row>
</Form>
<StoreHouse
:show.sync="showStoreHouseTree"
:value.sync="entity.storeId"
:text.sync="entity.storeTitle"
:type='4'
/>
</div>
</template>
<script>
import Api from './api'
import StoreHouse from '@/components/modalTree/storeHouse.vue'
export default {
name: 'Add',
components: {
StoreHouse
},
data() {
return {
entity: {
totalNum:1,
},
rules: {
nameOfResource: [{ required: true, message: '必填', trigger: 'blur' }],
specifications: [{ required: true, message: '必填', trigger: 'blur' }],
totalNum: [{required: true, message: '必填', trigger: 'blur',type: "number" }],
measuringUnit: [{ required: true, message: '必填', trigger: 'blur' }],
qualityCharacteristics: [{ required: true, message: '必填', trigger: 'blur' }],
batchNo: [{ required: true, message: '必填', trigger: 'blur' }],
storeTitle: [{ required: true, message: '必填', trigger: 'blur'}],
resourceType: [{ required: true, message: '必填', trigger: 'blur' }],
},
showStoreHouseTree: false
}
},
props: {
v: Object
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.entity.state="1"
Api.create(this.entity).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
}
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'resource' + '.' + key
return this.$t(key)
},
//清空库房库位控件信息
clear()
{
this.entity.storeId=null
this.entity.storeTitle=''
},
selectStoreHouse() {
this.showStoreHouseTree = true
}
},
watch: {
v() {
this.entity = this.$clone(this.v)
}
}
}
</script>
import Api from '@/plugins/request'
export default {
// index: `${resourceUrl}/resource/paged`,
index: `${resourceUrl}/resource/pagelist`,
paged(params) {
return Api.post(`${resourceUrl}/resource/paged`, params);
},
get(params) {
return Api.get(`${resourceUrl}/resource/get`, params);
},
create(params) {
return Api.post(`${resourceUrl}/resource/create`, params);
},
update(params) {
return Api.post(`${resourceUrl}/resource/update`, params);
},
//删除:
delete(params) {
return Api.delete(`${resourceUrl}/resource/delete`, {
params: params
});
},
getTree(params) {
let url = `${systemUrl}/storeroomlocation/getlocationfilterperson`;
return Api.get(url,params)
},
//借出
cartCreate(params) {
return Api.post(`${resourceUrl}/trolley/create`, params);
},
//归还列表
cartGetList(params) {
return Api.post(`${resourceUrl}/trolleyitem/paged`, params);
},
//归还
cartGiveBack(params) {
return Api.post(`${resourceUrl}/trolley/giveback`, params);
},
//历史操作
getHistory(params) {
return Api.get(`${resourceUrl}/resourcehistory/gethistory`, params);
},
}
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index:`${resourceUrl}/resource/paged`,
paged(params){
return Api.post(`${resourceUrl}/resource/paged`,params);
},
get(params){
return Api.get(`${resourceUrl}/resource/get`,params);
},
create(params){
return Api.post(`${resourceUrl}/resource/create`,params);
},
update(params){
return Api.post(`${resourceUrl}/resource/update`,params);
},
//删除:
delete(params) {
return Api.delete(`${resourceUrl}/resource/delete`,params);
},
}
\ No newline at end of file
<template>
<div>
<Table border :columns="columns" :data="cartList" class="tableCommon" height="300">
<template slot-scope="{ row, index }" slot="numberAvailable">
<InputNumber
:max="row.numberAvailable1"
:min="1"
v-model="row.numberAvailable"
@on-change="inputOrderCat(row,index)"
></InputNumber>
</template>
</Table>
<Form :model="resource" :label-width="110" class="mt20 mb20" :rules="rules" ref="form">
<Row>
<Col span="9">&nbsp;</Col>
<Col span="8">
<FormItem label="库管员">
<Input v-model="resource.libraryTube" disabled></Input>
</FormItem>
</Col>
<Col span="7">
<FormItem label="领料人" style="width:100%" prop="customerId">
<UserSelect ref="userSelected" v-model="resource.customerId" :type="0" />
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">&nbsp;</Col>
<Col span="4">
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit">借出</Button>
</Col>
</Row>
</Form>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
let userInfo=this.$store.state.admin.user.info;
return {
columns: [
{
key: 'resourceId',
title: this.l('resourceId'),
width: 180
},
{
title: this.l('nameOfResource'),
key: 'nameOfResource'
},
{
title: this.l('specifications'),
key: 'specifications',
width: 100
},
{
title: this.l('measuringUnit'),
key: 'measuringUnit',
width: 100
},
{
title: this.l('qualityCharacteristics'),
key: 'qualityCharacteristics',
width: 100
},
{
title: this.l('batchNo'),
key: 'batchNo',
width: 100
},
{
title: this.l('storeTitle'),
key: 'storeTitle',
width: 100
},
{
title: this.l('numberAvailable'),
key: 'numberAvailable',
width: 120,
slot: 'numberAvailable'
},
{
title: this.l('action'),
key: 'action',
width: 100,
align: 'center',
render: (h, params) => {
return h('div', { class: 'action' }, [
h(
'a',
{
class: 'remove',
on: { click: () => this.remove(params.row.id) }
},
'删除'
)
])
}
}
],
resource: {
libraryTube: userInfo.userName, //库管员
libraryTubeId: userInfo.userId, //库管员ID
customer: '', //领料人
customerId: null, //领料人ID
category: 0, //类别
state: 2, //状态
item: []
},
rules: {
customerId: [
{ required: true, message: '请选择', trigger: 'blur', type: 'number' }
]
}
}
},
props: {
cartList: {
type: [Array],
default: ()=>{
return []
}
}
},
methods: {
handleSubmit() {
var items = []
let count = 0
this.cartList.forEach((data) => {
let objList = Object.assign({}, this.resource)
delete objList.item
objList.resourceId = data.id
objList.count = data.numberAvailable
items.push(objList)
count += 1
})
this.resource.item = items
if (this.resource.customerId == 0) {
}
this.$refs.form.validate((v) => {
if (v) {
Api.cartCreate(this.resource).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('substr', count, -1)
this.$emit('on-ok')
}
})
}
})
},
handleClose() {
this.$emit('on-close')
},
remove(id) {
const index = this.cartList.findIndex(function(item) {
return item.id === id
})
this.cartList.splice(index, 1)
this.$emit('substr', 1, index)
},
l(key) {
let vkey = 'resource' + '.' + key
return this.$t(vkey) || key
},
changeCustom(val) {
this.resource.customerId = val + ''
//this.resource.customer = this.arry2Name(this.userList1, val)
},
arry2Name(arryList, values) {
//类别转换
var codes = arryList
var name = ''
for (let i in codes) {
if (values == codes[i].value) {
name = codes[i].name
}
}
return name
},
inputOrderCat(row, index) {
this.cartList[index].numberAvailable = row.numberAvailable
}
},
watch: {}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('resourceId')">{{entity.resourceId}}</Filed>
<Filed :span="12" :name="l('nameOfResource')">{{entity.nameOfResource}}</Filed>
<Filed :span="12" :name="l('specifications')">{{entity.specifications}}</Filed>
<Filed :span="12" :name="l('measuringUnit')">{{entity.measuringUnit}}</Filed>
<Filed :span="12" :name="l('qualityCharacteristics')">{{entity.qualityCharacteristics}}</Filed>
<Filed :span="12" :name="l('batchNo')">{{entity.batchNo}}</Filed>
<Filed :span="12" :name="l('storeTitle')">{{entity.storeTitle}}</Filed>
<Filed :span="12" :name="l('resourceType')">
<state
code="mes_xingchi_resource.resource.resource_type"
:value="entity.resourceType"
type="text"
></state>
</Filed>
</Row>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {
resourceType:''
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.entity.resourceType = r.result.resourceType + ''
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'resource' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
<template>
<div class="addform">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('resourceId')" prop="resourceId">
<Input v-model="entity.resourceId" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('nameOfResource')" prop="nameOfResource">
<Input v-model="entity.nameOfResource"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('specifications')" >
<Input v-model="entity.specifications"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('totalNum')" prop="totalNum">
<InputNumber v-model="entity.totalNum" :disabled="numdisabled"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('measuringUnit')" >
<Input v-model="entity.measuringUnit"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('qualityCharacteristics')" >
<Input v-model="entity.qualityCharacteristics"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batchNo')" >
<Input v-model="entity.batchNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input
v-model="entity.storeTitle"
readonly
clearable
@on-clear="clear"
placeholder="请选择..."
style="width:274px"
>
<Button slot="append" @click="selectStoreHouse">选择</Button>
</Input>
<label slot="append" v-if="false">{{entity.storeId}}</label>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('resourceType')" >
<Dictionary
code="mes_xingchi_resource.resource.resource_type"
v-model="entity.resourceType"
style="width:274px"
></Dictionary>
</FormItem>
</Col>
</Row>
<Row>
<Col span="16">&nbsp;</Col>
<Col span="8">
<FormItem>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit">保存</Button>
</FormItem>
</Col>
</Row>
</Form>
<StoreHouse
:show.sync="showStoreHouseTree"
:value.sync="entity.storeId"
:text.sync="entity.storeTitle"
:type='4'
/>
</div>
</template>
<script>
import Api from './api'
import StoreHouse from '@/components/modalTree/storeHouse.vue'
export default {
name: 'Edit',
components: {
StoreHouse
},
data() {
return {
entity: {
color: ''
},
rules: {
nameOfResource: [{ required: true, message: '必填', trigger: 'blur' }],
specifications: [{ required: true, message: '必填', trigger: 'blur' }],
totalNum: [
{ required: true, message: '必填', trigger: 'blur', type: 'number' }
],
measuringUnit: [{ required: true, message: '必填', trigger: 'blur' }],
qualityCharacteristics: [
{ required: true, message: '必填', trigger: 'blur' }
],
batchNo: [{ required: true, message: '必填', trigger: 'blur' }],
storeTitle: [{ required: true, message: '必填', trigger: 'blur' }],
resourceType: [{ required: true, message: '必填', trigger: 'blur', type: 'number' }]
},
showStoreHouseTree: false,
numdisabled: false
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.entity.resourceType = r.result.resourceType + ''
if (r.result.totalNum != r.result.numberAvailable) {
this.numdisabled = true
} else {
this.numdisabled = false
}
this.entity.resourceType=parseInt(r.result.resourceType)
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.entity.state = '1'
if (!this.numdisabled) {
this.entity.numberAvailable = this.entity.totalNum
}
Api.update(this.entity).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
}
})
}
})
},
//清空库房库位控件信息
clear() {
this.entity.storeId = null
this.entity.storeTitle = ''
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'resource' + '.' + key
return this.$t(key)
},
selectStoreHouse() {
this.showStoreHouseTree = true
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
<template>
<Layout class="full">
<Sider hide-trigger :style="{background: '#fff'}" class="menu" width="240" style=" flex:0;">
<StoreHouseLeft @storeIds="storeIds" :type="4"></StoreHouseLeft>
</Sider>
<Content class="content manyTabs">
<Tabs :animated="false" @on-click="tab">
<TabPane label="量具">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
style="margin-top: 45px;"
:height="tdHeight"
:conditions="easySearch"
>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="addModal=true">添加</Button>
<Button type="primary" @click="returnModel=true">归还</Button>
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button>
</Badge>
</template>
</DataGrid>
</TabPane>
</Tabs>
<Modal v-model="addModal" title="新增" footer-hide width="800">
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide width="800">
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="detailModal" title="详情" width="800">
<Detail :eid="curId" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
<Modal v-model="cartModel" title="借出车" footer-hide width="70">
<Cart
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="cartOk"
@substr="substr"
/>
</Modal>
<Modal v-model="returnModel" title="归还车" footer-hide width="1000">
<Return @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="logModel" title="查看日志" width="800">
<Log :eid="curId" @on-close="cancel" />
</Modal>
</Content>
</Layout>
</template>
<script>
import Api from "./api";
import Add from "./add";
import Edit from "./edit";
import Detail from "./detail";
import Search from "./search";
import Cart from "./cart";
import Return from "./return";
import Log from "./log";
import StoreHouseLeft from "@/components/modalTree/storeHouseLeft.vue";
const root = {
id: 0,
typeId: -1,
title: "顶级节点",
code: ""
};
export default {
name: "list",
components: {
Add,
Edit,
Detail,
Search,
Cart,
Return,
Log,
StoreHouseLeft
},
data() {
return {
node: root,
expand: false,
tree: [],
action: Api.index,
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
cartModel: false, //借出车
returnModel: false, //归还车
logModel: false, //查看日志
tdHeight: "",
curId: 0,
easySearch: {
keys: { op: "nameOfResource,resourceId", value: "", default: true },
storeId: { op: "In", value: "" }
},
columns: [
{
key: "id",
title: this.l("id"),
hide: true,
align: "left",
sortable: true
},
{
key: "creationTime",
title: this.l("creationTime"),
sortable: true,
hide: true,
align: "left"
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: false,
type: "user",
align: "left",
width: 120
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left"
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left"
},
{
key: "isDeleted",
title: this.l("isDeleted"),
hide: true,
align: "left"
},
{
key: "deletionTime",
title: this.l("deletionTime"),
hide: true,
align: "left"
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
hide: true,
align: "left"
},
{
key: "ico",
title: " ",
align: "center",
easy: true,
high: true,
width: 60,
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
attrs: {
icon: "ios-cart-outline",
type: "icon"
},
on: { click: () => this.addCart(params.row) }
})
]);
}
},
{
key: "resourceId",
title: this.l("resourceId"),
align: "left",
easy: true,
high: true,
width: 180,
render: (h, params) => {
return h(
"a",
{
props: {},
style: {},
on: { click: () => this.detail(params.row.id) }
},
params.row.resourceId
);
}
},
{
key: "nameOfResource",
title: this.l("nameOfResource"),
align: "left",
easy: true,
high: true,
tooltip: true,
width: 150
},
{
key: "specifications",
title: this.l("specifications"),
align: "left",
easy: true,
high: true
},
{
key: "totalNum",
title: this.l("totalNum"),
align: "left",
easy: true,
high: true,
width: 100
},
{
key: "numberAvailable",
title: this.l("numberAvailable"),
align: "left",
easy: true,
high: true,
width: 100
},
{
key: "measuringUnit",
title: this.l("measuringUnit"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "qualityCharacteristics",
title: this.l("qualityCharacteristics"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "batchNo",
title: this.l("batchNo"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "storeId",
title: this.l("storeId"),
align: "left",
high: true,
hide: true
},
{
key: "storeTitle",
title: this.l("storeTitle"),
align: "left",
high: true,
hide: true
},
{
key: "state",
title: this.l("state"),
align: "left",
high: true,
code: "mes_xingchi_resource.resource.state",
hide: true
},
{
key: "resourceType",
title: this.l("resourceType"),
align: "left",
high: true,
code: "mes_xingchi_resource.resource.resource_type"
},
{
title: "操作",
width: 190,
align: "center",
hide: false,
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: {
oprate: "detail",title: "修改"
},
on: { click: () => this.edit(params.row.id) }
},
"修改"
),
h(
"op",
{
attrs: {
oprate: "delete",title: "删除"
},
class:
params.row.totalNum === params.row.numberAvailable
? "remove"
: "disable",
on: { click: () => this.remove(params.row) }
},
"删除"
),
h(
"op",
{
attrs: {
oprate: "detail",title: "查看日志"
},
on: { click: () => this.logDetail(params.row.id) }
},
"查看日志"
)
]);
}
}
],
cartList: [],
cartListCount: 0,
tabIndex: 1,
ids: []
};
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tdHeight = window.screenHeight - 250;
})();
};
},
created() {
this.tdHeight = window.innerHeight - 250;
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//选项卡切换
tab(data) {
this.tabIndex = data + 1;
// this.search(this.searchForm)
},
addOk() {
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.cartModel = false;
this.returnModel = false;
this.logModel = false;
this.curId = 0;
},
cartOk() {
this.$refs.grid.load();
this.cartList = [];
this.cartModel = false;
this.curId = 0;
},
detail(id) {
this.detailModal = true;
this.curId = id;
},
edit(id) {
this.editModal = true;
this.curId = id;
},
logDetail(id) {
this.logModel = true;
this.curId = id;
},
remove(row) {
if (row.totalNum != row.numberAvailable) {
this.$Message.error("资源有借出不能删除");
} else {
this.deletelModal = true;
this.curId = row.id;
}
},
removeOk() {
Api.delete({ id: this.curId }).then(r => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
},
removeCancel() {
this.deletelModal = false;
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.cartModel = false;
this.returnModel = false;
this.logModel = false;
},
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
storeIds(val) {
this.easySearch.storeId.value = val;
this.$refs.grid.easySearch();
},
showCart() {
if (this.$store.state.count > 0) {
this.cartModel = true;
} else {
this.$Message.error("请将资源加入借出车");
}
},
//加入借出车
addCart(arr) {
let id = arr.id;
this.cartListCount = this.$store.state.count;
this.cartList = this.$store.state.cart;
if (arr.numberAvailable > 0) {
const index = this.$store.state.cart.findIndex(function(item) {
return item.id === id;
});
if (index == -1) {
arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量
this.cartList.push(arr);
this.cartListCount += 1;
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
this.$Message.success("加入借出车成功");
} else {
this.$Message.error("已加入借出车");
}
} else {
this.$Message.error("资源无库存");
}
},
//移除借出车
substr(value, index) {
if (index > -1) {
this.cartListCount -= value;
this.cartList.splice(index, 1);
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
} else {
this.cartListCount = 0;
this.cartList = [];
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
}
}
},
computed: {}
};
</script>
<style lang="less" scoped>
.full {
margin-top: 0;
}
</style>
\ No newline at end of file
<template>
<div>
<Table border :columns="columns" :data="data" class="tableCommon" height="300"></Table>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'log',
data() {
return {
data: [],
columns: [
{
title: this.l('action'),
key: 'action',
width: 120,
align:"center",
render: (h, params) => {
return h('state', {
props: {
code: 'mes_xingchi_resource.resource.life_state',
type: 'text',
value: params.row.action + ''
}
})
}
},
{
title: this.l('count'),
key: 'count',
width: 120,
align: 'right'
},
{
title: this.l('numberAvailable'),
key: 'numberAvailable',
width: 120,
align: 'right'
},
{
title: this.l('creationTime'),
key: 'creationTime',
width: 200,
align:"center"
},
{
title: this.l('libraryTube'),
key: 'libraryTube',
align:"center",
}
]
}
},
props: { eid: Number },
methods: {
//数据初始化
load(v) {
Api.getHistory({ id: v }).then((r) => {
if (r.success) {
this.data = r.result
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
let vkey = 'resource' + '.' + key
return this.$t(vkey) || key
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div>
<Input
search
enter-button
placeholder="请输入借出人/名称/编码"
@on-search="easySearch"
v-model="search.name"
style="width:240px"
/>&nbsp;
<Table
border
:columns="columns"
:data="dataList"
class="tableCommon"
@on-selection-change="selectInfo"
height="300"
>
<template slot-scope="{ row, index }" slot="count">
<InputNumber
:max="row.count1"
:min="1"
v-model="row.count"
@on-change="inputOrderCat(row,index)"
></InputNumber>
</template>
</Table>
<Form :label-width="110" class="mt20 mb20">
<Row>
<Col span="15">&nbsp;</Col>
<Col span="9">
<FormItem label="库管员">
<Input v-model="libraryTube" disabled></Input>
</FormItem>
</Col>
</Row>
<Row>
<Col span="16">&nbsp;</Col>
<Col span="8">
<FormItem>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit">归还</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
dataList: [],
columns: [
{
type: 'selection',
width: 70,
align: 'center'
},
{
key: 'resourceCode',
title: this.l('resourceCode'),
width: 180
},
{
title: this.l('nameOfResource'),
key: 'nameOfResource'
},
{
title: this.l('specifications'),
key: 'specifications',
width: 100
},
{
title: this.l('measuringUnit'),
key: 'measuringUnit',
width: 100
},
{
title: this.l('qualityCharacteristics'),
key: 'qualityCharacteristics',
width: 100
},
{
title: this.l('batchNo'),
key: 'batchNo',
width: 100
},
{
title: this.l('storeTitle'),
key: 'storeTitle',
width: 100
},
{
title: this.l('count'),
key: 'count',
width: 120,
slot: 'count'
}
],
search: {
name: '',
pageSize: 0,
pageIndex: 0
},
resource: [],
selectList: [],
libraryTube: this.$store.state.userInfo.userName //库管员
}
},
props: {},
methods: {
handleSubmit() {
if (JSON.stringify(this.selectList) != '[]') {
this.resource = this.selectList
Api.cartGiveBack(this.resource).then((r) => {
if (r.success) {
this.$Message.success('归还成功')
this.$emit('on-ok')
}
})
} else {
this.$Message.error('请选择归还的资源')
}
},
handleClose() {
this.$emit('on-close')
},
selectInfo(value) {
this.selectList = []
this.selectList = value
},
l(key) {
let vkey = 'resource' + '.' + key
return this.$t(vkey) || key
},
easySearch() {
this.dataList = []
Api.cartGetList(this.search).then((r) => {
if (r.success) {
let items = []
let dataList1 = []
dataList1 = r.result.items
dataList1.forEach((data) => {
let objList = data
objList.count1 = parseFloat(data.count)
objList.count = parseFloat(data.count)
objList.state = '3'
items.push(objList)
})
this.dataList = items
}
})
},
inputOrderCat(row, index) {
this.dataList[index].count = row.count
}
},
watch: {}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div>
<Form ref="form" :model="condition" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('resourceId')" prop="resourceId">
<Input v-model="condition.resourceId.value"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('nameOfResource')" prop="nameOfResource">
<Input v-model="condition.nameOfResource.value"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('specifications')" prop="specifications">
<Input v-model="condition.specifications.value"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('measuringUnit')" prop="measuringUnit">
<Input v-model="condition.measuringUnit.value"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('qualityCharacteristics')" prop="qualityCharacteristics">
<Input v-model="condition.qualityCharacteristics.value"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batchNo')" prop="batchNo">
<Input v-model="condition.batchNo.value"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input
v-model="condition.storeTitle.value"
readonly
placeholder="请选择..."
style="width:274px"
>
<Button slot="append" @click="selectStoreHouse">选择</Button>
<label slot="append" v-if="false">{{condition.storeId.value}}</label>
</Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('state')" prop="state">
<Dictionary
code="mes_xingchi_resource.resource.state"
v-model="condition.state.value"
style="width:274px"
></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('resourceType')" prop="resourceType">
<Dictionary
code="mes_xingchi_resource.resource.resource_type"
v-model="condition.resourceType.value"
:multiple="true"
style="width:274px"
></Dictionary>
</FormItem>
</Col>
<!-- <Col :span="12">
<FormItem :label="l('CreationTime')" prop="CreationTime">
<DatePicker
type="daterange"
v-model="condition.CreationTime.value"
placement="bottom-end"
></DatePicker>
</FormItem>
</Col> -->
</Row>
</Form>
<StoreHouse
:show.sync="showStoreHouseTree"
:value.sync="condition.storeId.value"
:text.sync="condition.storeTitle.value"
style="z-index:999999;position: absolute;"
/>
</div>
</template>
<script>
import Api from './api'
import StoreHouse from '@/components/modalTree/storeHouse.vue'
export default {
name: 'Search',
components: {
StoreHouse
},
data() {
return {
condition: {
resourceId: { op: 'Like', value: null },
nameOfResource: { op: 'Equal', value: null },
specifications: { op: 'Equal', value: null },
measuringUnit: { op: 'Equal', value: null },
qualityCharacteristics: { op: 'Equal', value: null },
batchNo: { op: 'Equal', value: null },
storeId: { op: 'Equal', value: null },
storeTitle: { op: 'Equal', value: null },
state: { op: 'Equal', value: null },
resourceType: { op: 'In', value: null },
CreationTime: { op: 'Range', value: null }
},
showStoreHouseTree: false
}
},
props: {
v: Object
},
methods: {
search() {
alert('未实现')
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'resource' + '.' + key
return this.$t(key)
},
selectStoreHouse() {
this.showStoreHouseTree = true
}
},
watch: {
v() {
this.condition = this.$clone(this.v)
}
}
}
</script>
<template>
<div class="addform">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('nameOfResource')" prop="nameOfResource">
<Input v-model="entity.nameOfResource"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('specifications')" >
<Input v-model="entity.specifications"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('totalNum')" prop="totalNum">
<InputNumber v-model="entity.totalNum" :min="1"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('measuringUnit')" >
<Input v-model="entity.measuringUnit"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('qualityCharacteristics')" >
<Input v-model="entity.qualityCharacteristics"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batchNo')" >
<Input v-model="entity.batchNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input v-model="entity.storeTitle" readonly clearable @on-clear="clear" placeholder="请选择..." style="width:274px">
<Button slot="append" @click="selectStoreHouse">选择</Button>
<label slot="append" v-if="false">{{entity.storeId}}</label>
</Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('resourceType')" >
<Dictionary
code="mes_xingchi_resource.resource.resource_type"
v-model="entity.resourceType"
style="width:274px"
></Dictionary>
</FormItem>
</Col>
</Row>
<Row>
<Col span="18">&nbsp;</Col>
<Col span="6">
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit">保存</Button>
</Col>
</Row>
</Form>
<StoreHouse
:show.sync="showStoreHouseTree"
:value.sync="entity.storeId"
:text.sync="entity.storeTitle"
:type='4'
/>
</div>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col :span="12">
<FormItem :label="l('storeTitle')+':'">
<div style="color:#515a6e">{{rootName}}</div>
<!-- <StoreSelect v-model="entity.storeId" @on-change="storeChange"></StoreSelect> -->
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creator')+':'">{{entity.creator}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('name')" prop="resourceId">
<Materiel v-model="entity.resourceId" @on-change="change" :materialType="materialType"></Materiel>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('inputTotal')" prop="totalNum">
<InputNumber v-model="entity.totalNum" style="width:280px"></InputNumber>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
</Row>
<Divider orientation="left">资源属性</Divider>
<Col :span="12" v-if="entity.resourceId">
<FormItem label="资源名称:">
<span>{{entity.nameOfResource}}</span>
</FormItem>
</Col>
<Col :span="12" v-if="entity.resourceId">
<FormItem label="资源编码:">
<span>{{entity.resourceCode}}</span>
</FormItem>
</Col>
<Row>
<Col v-for="li in fileds" :key="li.field" :span="li.span">
<FormItem :label="li.title" :prop="li.name" v-if="li.title!='资源名称'&&li.title!='资源编码'">
<Input v-if="li.dataType==0" v-model="entity.json[li.field]"></Input>
<InputNumber
v-if="li.dataType==1||li.dataType==2"
v-model="entity.json[li.field]"
class="w100"
></InputNumber>
<Dictionary v-if="li.dataType==3" v-model="entity.json[li.field]" :code="li.note"></Dictionary>
<Input v-if="li.dataType==5" type="textarea" v-model="entity.json[li.filed]"></Input>
<DatePicker
v-if="li.dataType==4"
v-model="entity.json[li.field]"
type="date"
:placeholder="'选择'+li.title"
></DatePicker>
<InputFile v-if="li.dataType==6" v-model="entity.json[li.field]"></InputFile>
<!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> -->
<InputFile v-if="li.dataType==7" v-model="entity.json[li.field]"></InputFile>
<Input v-if="li.dataType==8" type="textarea" v-model="entity.json[li.field]"></Input>
<state
v-if="li.unitName&&(li.dataType==1||li.dataType==2)"
:value="li.unitName"
code="material.main.unitName"
type="tag"
></state>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
import StoreHouse from '@/components/modalTree/storeHouse.vue'
<script>
import Api from "./api";
export default {
name: 'Add',
components: {
StoreHouse
},
name: "add",
data() {
return {
disabled: false,
fileds: [], //扩展属性
entity: {
totalNum:1,
nameOfResource: "",
resourceId: "",
resourceCode: "",
materialType: null,
totalNum: null,
storeId: null,
storeTitle: "",
brand: "",
specifications: "",
batch: "",
certificateOfApproval: "",
creator: this.$store.state.userInfo.userName,
unitPrice: null,
originalManufacturer: "",
remark: "",
state: 1,
numberAvailable: 0,
json: {},
},
rules: {
nameOfResource: [{ required: true, message: '必填', trigger: 'blur' }],
specifications: [{ required: true, message: '必填', trigger: 'blur' }],
totalNum: [{required: true, message: '必填', trigger: 'blur',type: "number" }],
measuringUnit: [{ required: true, message: '必填', trigger: 'blur' }],
qualityCharacteristics: [{ required: true, message: '必填', trigger: 'blur' }],
batchNo: [{ required: true, message: '必填', trigger: 'blur' }],
storeTitle: [{ required: true, message: '必填', trigger: 'blur'}],
resourceType: [{ required: true, message: '必填', trigger: 'blur' }],
resourceId: [
{
required: true,
message: "请选择物料",
type: "string",
trigger: "change",
},
],
totalNum: [
{
required: true,
message: "请输入入库数量",
type: "number",
trigger: "change",
},
],
},
showStoreHouseTree: false
}
};
},
props: {
v: Object
// v: Object,
eid: Number,
rootName: String,
storeTitle: String,
materialType: String,
},
mounted() {},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.entity.state="1"
Api.create(this.entity).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
}
})
this.disabled = true;
this.entity.storeId = this.eid;
this.entity.storeTitle = this.storeTitle;
this.entity.numberAvailable = this.entity.totalNum;
Api.create(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
})
});
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
l(key) {
key = 'resource' + '.' + key
return this.$t(key)
change(e) {
this.entity.nameOfResource = e.name;
this.entity.resourceId = e.materialId;
this.entity.resourceCode = e.mmcode;
this.entity.json.nameOfResource = e.name;
this.entity.json.resourceCode = e.mmcode;
Api.getmaterialdefinitionproperty({ materialId: e.materialId }).then(
(r) => {
if (r.result) {
this.fileds = r.result.filter(function (item) {
item.span = 12;
if (item.dataType > 4) {
item.span = 24;
}
delete item["id"];
// return item.fieldType != 1;
return item.fieldType;
});
this.fileds.map((u) => {
let v = "";
if (u.dataType == 1 || u.dataType == 2) {
v = 0;
}
// this.$set(this.entity.customProperties,u.filed,v)
this.$set(this.entity, u.filed, v);
});
}
}
);
},
//清空库房库位控件信息
clear()
{
this.entity.storeId=null
this.entity.storeTitle=''
l(key) {
key = "stock" + "." + key;
return this.$t(key);
},
selectStoreHouse() {
this.showStoreHouseTree = true
}
},
watch: {
v() {
this.entity = this.$clone(this.v)
}
}
}
watch: {},
};
</script>
import Api from '@/plugins/request'
export default {
// index: `${resourceUrl}/resource/paged`,
index: `${resourceUrl}/resource/pagelist`,
index: `${resourceUrl}/resourcenew/paged`,
paged(params) {
return Api.post(`${resourceUrl}/resource/paged`, params);
},
get(params) {
return Api.get(`${resourceUrl}/resource/get`, params);
return Api.get(`${resourceUrl}/resourcenew/get`, params);
},
create(params) {
return Api.post(`${resourceUrl}/resource/create`, params);
},
update(params) {
return Api.post(`${resourceUrl}/resource/update`, params);
return Api.post(`${resourceUrl}/resourcenew/create`, params);
},
// update(params) {
// return Api.post(`${resourceUrl}/resourcenew/update`, params);
// },
//删除:
delete(params) {
return Api.delete(`${resourceUrl}/resource/delete`, {
return Api.delete(`${resourceUrl}/resourcenew/delete`, {
params: params
});
},
......@@ -40,5 +40,8 @@ export default {
getHistory(params) {
return Api.get(`${resourceUrl}/resourcehistory/gethistory`, params);
},
getmaterialdefinitionproperty(params){
return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params);
},
}
\ No newline at end of file
<template>
<Layout class="full">
<Sider hide-trigger :style="{background: '#fff'}" class="menu" width="240" style=" flex:0;">
<StoreHouseLeft @storeIds="storeIds" :type="4"></StoreHouseLeft>
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<StoreTree @on-hide="onHide" @on-select="productSearch" />
</Sider>
<Content class="content manyTabs">
<Tabs :animated="false" @on-click="tab">
<TabPane label="量具">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
style="margin-top: 45px;"
:height="tdHeight"
:conditions="easySearch"
>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="addModal=true">添加</Button>
<Button type="primary" @click="returnModel=true">归还</Button>
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button>
</Badge>
</template>
</DataGrid>
</TabPane>
</Tabs>
<Modal v-model="addModal" title="新增" footer-hide width="800">
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide width="800">
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="detailModal" title="详情" width="800">
<Detail :eid="curId" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
<Modal v-model="cartModel" title="借出车" footer-hide width="70">
<Cart
<div v-if="!showMenu" class="show_menu">
<a class="menu_play fr" @click="showMenuFn" title="展开">
<Icon type="ios-arrow-forward" size="24" />
</a>
</div>
{{this.$store.state.count}}
<Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:batch="true"
:format="checkData"
@on-change="onChange"
@on-selection-change="onSelect"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入资源名称/资源编码" v-model="easySearch.keys.value" v-width="260" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add">入库</Button>
<!-- <Button type="primary" @click="returnModel=true">归还</Button> -->
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button>
</Badge>
</template>
<template slot="batch">
<Button type="primary" class="mr10 ml10" @click="removeOk">加入借出车</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
<component
:is="detail"
:eid="curId"
:rootName="rootName"
:storeTitle="storeTitle"
:materialType="materialType"
:storeId="storeId"
:mcode="mCode"
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="cartOk"
@on-ok="ok"
@substr="substr"
/>
</Modal>
<Modal v-model="returnModel" title="归还车" footer-hide width="1000">
<Return @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="logModel" title="查看日志" width="800">
<Log :eid="curId" @on-close="cancel" />
</Modal>
</Content>
</Layout>
</template>
<script>
import Api from "./api";
import Add from "./add";
import Edit from "./edit";
import Detail from "./detail";
import Search from "./search";
import Cart from "./cart";
import Return from "./return";
import Log from "./log";
import StoreHouseLeft from "@/components/modalTree/storeHouseLeft.vue";
const root = {
id: 0,
typeId: -1,
title: "顶级节点",
code: ""
};
export default {
name: "list",
components: {
Add,
Edit,
Detail,
Search,
Cart,
Return,
Log,
StoreHouseLeft
},
head: {
title: "库存表",
author: "henq",
description: "stock 7/13/2020 11:48:09 AM",
},
data() {
return {
node: root,
expand: false,
tree: [],
action: Api.index,
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
cartModel: false, //借出车
returnModel: false, //归还车
logModel: false, //查看日志
tdHeight: "",
curId: 0,
showMenu: true,
easySearch: {
keys: { op: "nameOfResource,resourceId", value: "", default: true },
storeId: { op: "In", value: "" }
keys: { op: "name,storeTitle,materialCode", value: null },
},
fscreeen: false,
modal: false,
title: "新增",
detail: null,
curId: 0,
storeId: null,
rootName: "",
storeTitle: "",
materialType: "",
mCode: "",
columns: [
{
key: "selection",
type: "selection",
width: 50,
align: "center",
},
{
key: "id",
title: this.l("id"),
hide: true,
align: "left",
sortable: true
},
{
key: "creationTime",
title: this.l("creationTime"),
sortable: true,
hide: true,
align: "left"
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: false,
type: "user",
align: "left",
width: 120
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left"
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left"
},
{
key: "isDeleted",
title: this.l("isDeleted"),
hide: true,
align: "left"
},
{
key: "deletionTime",
title: this.l("deletionTime"),
hide: true,
align: "left"
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
hide: true,
align: "left"
},
{
key: "ico",
title: " ",
......@@ -165,66 +113,109 @@ export default {
width: 60,
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
h(params.row.numberAvailable > 0 ? "op" : "", {
attrs: {
icon: "ios-cart-outline",
type: "icon"
type: "icon",
},
on: { click: () => this.addCart(params.row) }
})
on: { click: () => this.addCart(params.row) },
}),
]);
}
},
},
{
key: "resourceId",
key: "resourceCode",
title: this.l("resourceId"),
align: "left",
easy: true,
high: true,
width: 180,
render: (h, params) => {
return h(
"a",
{
props: {},
style: {},
on: { click: () => this.detail(params.row.id) }
on: { click: () => this.detail(params.row.id) },
},
params.row.resourceId
params.row.resourceCode
);
}
},
},
{
key: "nameOfResource",
title: this.l("nameOfResource"),
align: "left",
easy: true,
high: true,
tooltip: true,
width: 150
},
{
key: "specifications",
title: this.l("specifications"),
key: "code",
title: "编码",
align: "left",
},
// {
// key: "creationTime",
// title: this.l("creationTime"),
// sortable: true,
// hide: true,
// align: "left",
// },
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: false,
type: "user",
align: "left",
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left",
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left",
},
{
key: "isDeleted",
title: this.l("isDeleted"),
hide: true,
align: "left",
},
{
key: "deletionTime",
title: this.l("deletionTime"),
hide: true,
align: "left",
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
hide: true,
align: "left",
easy: true,
high: true
},
// {
// key: "specifications",
// title: this.l("specifications"),
// align: "left",
// easy: true,
// high: true,
// },
{
key: "totalNum",
title: this.l("totalNum"),
align: "left",
easy: true,
high: true,
width: 100
},
{
key: "numberAvailable",
title: this.l("numberAvailable"),
align: "left",
easy: true,
high: true,
width: 100
},
{
key: "measuringUnit",
......@@ -232,7 +223,7 @@ export default {
align: "left",
easy: true,
high: true,
hide: true
hide: true,
},
{
key: "qualityCharacteristics",
......@@ -240,7 +231,7 @@ export default {
align: "left",
easy: true,
high: true,
hide: true
hide: true,
},
{
key: "batchNo",
......@@ -248,37 +239,33 @@ export default {
align: "left",
easy: true,
high: true,
hide: true
hide: true,
},
{
key: "storeId",
title: this.l("storeId"),
align: "left",
high: true,
hide: true
hide: true,
},
{
key: "storeTitle",
title: this.l("storeTitle"),
align: "left",
high: true,
hide: true
},
{
key: "state",
title: this.l("state"),
align: "left",
high: true,
code: "mes_xingchi_resource.resource.state",
hide: true
},
{
key: "resourceType",
title: this.l("resourceType"),
align: "left",
high: true,
code: "mes_xingchi_resource.resource.resource_type"
},
// {
// key: "resourceType",
// title: this.l("resourceType"),
// align: "left",
// high: true,
// code: "mes_xingchi_resource.resource.resource_type",
// },
{
title: "操作",
width: 190,
......@@ -290,9 +277,10 @@ export default {
"op",
{
attrs: {
oprate: "detail",title: "修改"
oprate: "detail",
title: "修改",
},
on: { click: () => this.edit(params.row.id) }
on: { click: () => this.edit(params.row.id) },
},
"修改"
),
......@@ -300,13 +288,14 @@ export default {
"op",
{
attrs: {
oprate: "delete",title: "删除"
oprate: "delete",
title: "删除",
},
class:
params.row.totalNum === params.row.numberAvailable
? "remove"
: "disable",
on: { click: () => this.remove(params.row) }
on: { click: () => this.remove(params.row) },
},
"删除"
),
......@@ -314,115 +303,95 @@ export default {
"op",
{
attrs: {
oprate: "detail",title: "查看日志"
oprate: "detail",
title: "查看日志",
},
on: { click: () => this.logDetail(params.row.id) }
on: { click: () => this.logDetail(params.row.id) },
},
"查看日志"
)
),
]);
}
}
},
},
],
treeData: [],
ocolumn: [],
treeHeight: "",
ids: [],
list: [],
cartList: [],
cartListCount: 0,
tabIndex: 1,
ids: []
arrPartPkId: [],
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
this.initTree();
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tdHeight = window.screenHeight - 250;
this.treeHeight = window.screenHeight - 150;
})();
};
},
created() {
this.tdHeight = window.innerHeight - 250;
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
computed: {},
methods: {
//选项卡切换
tab(data) {
this.tabIndex = data + 1;
// this.search(this.searchForm)
},
addOk() {
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.cartModel = false;
this.returnModel = false;
this.logModel = false;
this.curId = 0;
},
cartOk() {
this.$refs.grid.load();
this.cartList = [];
this.cartModel = false;
this.curId = 0;
},
detail(id) {
this.detailModal = true;
this.curId = id;
},
edit(id) {
this.editModal = true;
this.curId = id;
},
logDetail(id) {
this.logModel = true;
this.curId = id;
},
remove(row) {
if (row.totalNum != row.numberAvailable) {
this.$Message.error("资源有借出不能删除");
} else {
this.deletelModal = true;
this.curId = row.id;
onChange(a, b) {
console.log(a);
console.log(b);
if (b.numberAvailable == 0) {
this.$Message.error("资源无库存");
}
},
removeOk() {
Api.delete({ id: this.curId }).then(r => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
checkData(items) {
console.warn("items", items);
return items.map((u) => {
u._disabled = u.numberAvailable <= 0;
return u;
});
},
removeCancel() {
this.deletelModal = false;
onSelect(a) {
//批量选择
console.log(a);
// console.log(b);
let selectRows = a;
// this.arrPartPkId = [];
// selectRows.forEach((e) => {
// this.arrPartPkId.push(e.part_task_pk);
// });
// let id = arr.id;
// this.cartListCount = this.$store.state.count;
// this.cartList = this.$store.state.cart;
// console.log(this.cartList);
// if (arr.numberAvailable > 0) {
// const index = this.$store.state.cart.findIndex(function (item) {
// return item.id === id;
// });
// console.log(index);
// if (index == -1) {
// arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量
// this.cartList.push(arr);
// this.cartListCount += 1;
// this.$store.commit("setCart", this.cartList);
// this.$store.commit("setCartCount", this.cartListCount);
// this.$Message.success("加入借出车成功");
// } else {
// this.$Message.error("已加入借出车");
// }
// } else {
// this.$Message.error("资源无库存");
// }
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.cartModel = false;
this.returnModel = false;
this.logModel = false;
},
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
storeIds(val) {
this.easySearch.storeId.value = val;
this.$refs.grid.easySearch();
},
showCart() {
if (this.$store.state.count > 0) {
this.cartModel = true;
} else {
this.$Message.error("请将资源加入借出车");
}
removeOk() {
//批量选择移出排产池
this.remove(this.arrPartPkId);
},
//加入借出车
addCart(arr) {
......@@ -430,9 +399,10 @@ export default {
this.cartListCount = this.$store.state.count;
this.cartList = this.$store.state.cart;
if (arr.numberAvailable > 0) {
const index = this.$store.state.cart.findIndex(function(item) {
const index = this.$store.state.cart.findIndex(function (item) {
return item.id === id;
});
console.log(index);
if (index == -1) {
arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量
this.cartList.push(arr);
......@@ -460,13 +430,128 @@ export default {
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
}
}
},
showCart() {
if (this.$store.state.count > 0) {
this.title = "借出车";
this.detail = () => import("./cart");
this.fscreeen = false;
this.modal = true;
} else {
this.$Message.error("请将资源加入借出车");
}
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.fscreeen = false;
this.cartList = [];
// this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
if (this.curId) {
this.title = "新增";
this.detail = () => import("./add");
this.fscreeen = false;
this.modal = true;
} else {
this.$Message.error("请先选择库房库位");
}
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(row) {
this.curId = row.id;
this.storeId = row.storeId;
this.mCode = row.materialCode;
this.title = "详情";
this.detail = () => import("./detail");
this.fscreeen = true;
this.modal = true;
},
// edit(id) {
// this.curId = id;
// this.title = "编辑";
// this.detail = () => import("./edit");
// this.modal = true;
// },
// remove(id) {
// Api.delete(id).then((r) => {
// if (r.success) {
// this.$refs.grid.load();
// this.$Message.success("删除成功");
// }
// });
// },
cancel() {
this.curId = 0;
this.modal = false;
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(item, ids, rootName) {
console.log(item);
this.curId = item.id;
this.storeTitle = item.title;
this.rootName = rootName.join(" / ");
this.materialType = item.materialType;
let where = { storeId: { op: "In", value: ids } };
this.$refs.grid.reload(where);
},
setNum(row) {
this.curId = row.id;
this.title = "预警";
// this.detail = () => import("./setNum");
this.fscreeen = false;
this.modal = true;
},
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
},
//new tree start
initTree() {
var sumData = [];
this.$http.order.getallselecttree().then((res) => {
//alert(JSON.stringify(res))
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = JSON.parse(JSON.stringify(sumData));
} else {
this.$Message.error("加载产品树失败!");
}
});
},
},
computed: {}
};
</script>
<style lang="less" scoped>
<style lang="less">
.full {
margin-top: 0;
.content {
margin-top: 10px;
padding-top: 10px;
.ivu-icon-ios-add:before {
content: "\f341";
}
.ivu-icon-ios-remove:before {
content: "\f33d";
}
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment