Commit 44312e7a authored by 仇晓婷's avatar 仇晓婷

制造资源

parent c53b13f9
<template>
<div>
<Table border :columns="columns" :data="cartList" class="tableCommon" height="300">
<template slot-scope="{ row, index }" slot="numberAvailable">
<template slot-scope="{ row, index }" slot="count">
<InputNumber
:max="row.numberAvailable1"
:max="row.numberAvailable"
:min="1"
v-model="row.numberAvailable"
v-model="row.count"
@on-change="inputOrderCat(row,index)"
></InputNumber>
</template>
......@@ -92,7 +92,7 @@ export default {
},
{
key: "numberAvailable",
title: "借出数",
title: this.l("numberAvailable"),
align: "left",
easy: true,
},
......@@ -123,10 +123,10 @@ export default {
},
},
{
title: this.l("numberAvailable"),
key: "numberAvailable",
title: this.l("count"),
key: "count",
width: 100,
slot: "numberAvailable",
slot: "count",
},
{
title: this.l("action"),
......@@ -181,6 +181,7 @@ export default {
this.resource.customer = name;
},
handleSubmit() {
if (this.cartList.length > 0) {
var items = [];
let count = 0;
this.cartList.forEach((data) => {
......@@ -190,7 +191,7 @@ export default {
objList.resourceId = data.resourceId;
objList.resourceCode = data.resourceCode;
objList.resourceMainId = data.id;
objList.count = data.numberAvailable;
objList.count = data.count;
items.push(objList);
count += 1;
});
......@@ -208,6 +209,9 @@ export default {
});
}
});
} else {
this.$Message.error("借出车不能为空");
}
},
handleClose() {
this.$emit("on-close");
......
......@@ -22,7 +22,7 @@
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入资源名称/资源编码" v-model="easySearch.keys.value" v-width="260" />
<Input clearable placeholder="请输入资源名称/资源编码/编码" v-model.trim="easySearch.keys.value" v-width="260" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
......@@ -79,7 +79,7 @@ export default {
action: Api.index,
showMenu: true,
easySearch: {
keys: { op: "name,storeTitle,materialCode", value: null },
keys: { op: "nameOfResource,code,resourceCode", value: null },
},
fscreeen: false,
modal: false,
......@@ -378,29 +378,32 @@ export default {
this.$Message.error("资源无库存");
}
} else {
this.$Message.success("已加入借出车,请在借出车查看");
let a = [];
let n = []; //一个新的临时数组
a = this.selectRows.concat(this.cartList);
//遍历当前数组
for (var i = 0; i < a.length; i++) {
//如果当前数组的第i已经保存进了临时数组,那么跳过,
//否则把当前项push到临时数组里面
if (n.indexOf(a[i]) == -1) n.push(a[i]);
// this.$Message.success("已加入借出车,请在借出车查看");
let arr = this.selectRows.concat(this.cartList); //两个数组对象合并
let newArr = []; //盛放去重后数据的新数组
arr.forEach(function (item) {
let hasPush = false;
newArr.forEach((item2, index, thisArr) => {
if (item.id == item2.id) {
hasPush = true;
thisArr[index] = { ...item, ...item2 };
return;
}
console.log(n);
this.cartList = n;
this.cartListCount = n.length;
});
!hasPush && newArr.push(item);
});
this.cartList = newArr;
this.cartListCount = newArr.length;
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
this.$refs.grid.load();
this.$refs.grid.footerToolbar = false;
}
},
//移除借出车
substr(value, index) {
console.log(value);
console.log(index);
// console.log(value);
// console.log(index);
if (index > -1) {
this.cartListCount -= value;
this.cartList.splice(index, 1);
......@@ -417,8 +420,8 @@ export default {
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
}
console.log(this.$store.state.count);
console.log(this.$store.state.cart);
// console.log(this.$store.state.count);
// console.log(this.$store.state.cart);
},
showCart() {
if (this.$store.state.count > 0) {
......
......@@ -61,6 +61,11 @@ export default {
title: "领料人",
key: "customer",
},
{
title: "状态",
key: "status",
code: "resource.record.status",
},
{
title: this.l("action"),
key: "action",
......
......@@ -5,7 +5,7 @@
enter-button
placeholder="请输入借出人/名称/编码"
@on-search="easySearch"
v-model="search.name"
v-model.trim="search.name"
style="width:240px"
/>&nbsp;
<Table
......@@ -15,7 +15,16 @@
class="tableCommon"
@on-selection-change="selectInfo"
height="300"
></Table>
>
<template slot-scope="{ row, index }" slot="count">
<InputNumber
:max="row.count"
: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>
......@@ -92,6 +101,7 @@ export default {
title: this.l("count"),
key: "count",
width: 120,
slot: "count",
},
],
search: {
......@@ -111,10 +121,24 @@ export default {
this.get();
},
methods: {
get() {
Api.paged({ trollerId: this.eid }).then((r) => {
get(name) {
let data = { trollerId: this.eid };
if (name) {
data.name = name;
}
Api.paged(data).then((r) => {
if (r.success) {
this.dataList = r.result.items;
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;
}
});
},
......@@ -143,15 +167,8 @@ export default {
return this.$t(vkey) || key;
},
easySearch() {
Api.paged({ trollerId: this.eid, name: $.trim(this.search.name) }).then(
(r) => {
if (r.success) {
this.dataList = r.result.items;
}
}
);
this.get(this.search.name);
},
},
watch: {},
};
......
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