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

入库物料过滤

parent 23752e78
......@@ -80,7 +80,7 @@
export default {
model: {
prop: "value",
event: "on-change"
event: "on-change",
},
data() {
return {
......@@ -89,7 +89,7 @@ export default {
departId: "",
group: [],
ids: [],
bId:this.bomId,
bId: this.bomId,
};
},
created() {
......@@ -102,48 +102,53 @@ export default {
value: [String, Number, Array],
placeholder: {
type: String,
default: "请选择物料"
default: "请选择物料",
},
multiple: {
type: Boolean,
default: false
default: false,
},
disabled: {
type: Boolean,
default: false
default: false,
},
theme: {
type: String,
default: "select"
default: "select",
},
type: {
type: Number,
default: 0
default: 0,
},
departmentId: {
type: Number,
default: 0
default: 0,
},
roleTitle: {
type: String,
default: ""
default: "",
},
datas: {
//自定义用户数据
type: Array,
default: null
default: null,
},
//物料bomid
bomId: {
type: Number,
default: null
}
default: null,
},
materialType: {
//物料类型
type: String,
default: "",
},
},
methods: {
change(val) {
console.log(val);
let entity = {};
this.data.forEach(e => {
this.data.forEach((e) => {
if (e.id == val) {
entity.name = e.name;
entity.mmcode = e.code;
......@@ -157,17 +162,25 @@ export default {
// 加载物料
materiallist() {
let url = `${material}/material/materiallist`;
let conditions = [];
if (this.materialType) {
conditions = [
{
conditionalType: "In",
fieldName: "categoryId",
fieldValue: this.materialType,
},
];
} else {
conditions = [];
}
this.$api
.post(url, {
// pageIndex: 1,
//departmentId: id,
type: this.type,
conditions: []
// roleTitle: this.roleTitle
// pageSize: 0
conditions: conditions,
})
.then(r => {
this.data = r.result.filter(u => u.status == 3);
.then((r) => {
this.data = r.result.filter((u) => u.status == 3);
if (this.theme == "list") {
this.departmentGroup();
}
......@@ -175,17 +188,16 @@ export default {
let url1 = `${technologyUrl}productinfo/getmaterialids`;
this.$api
.get(url1, {
Id: this.bId
Id: this.bId,
})
.then(res => {
.then((res) => {
if (res.success) {
this.ids = res.result;
let arr = [...this.data].filter(x =>
[...this.ids].some(y => y === x.id)
let arr = [...this.data].filter((x) =>
[...this.ids].some((y) => y === x.id)
);
this.data=arr
this.data = arr;
}
});
}
});
......@@ -194,11 +206,11 @@ export default {
var group = [];
var users = this.$u.clone(this.data);
if (this.name && this.name.length > 0) {
users.map(u => {
users.map((u) => {
u.checked = this.name.indexOf(u.id) > -1;
});
}
group = this.$u.group(users, u => {
group = this.$u.group(users, (u) => {
return u.departmentId;
});
var deps = [];
......@@ -208,7 +220,7 @@ export default {
departmentId: u[0].departmentId,
children: u,
opened: (i = 0),
checked: false
checked: false,
});
});
this.group = deps;
......@@ -226,7 +238,7 @@ export default {
removeItem(item) {
this.group.map((u, i) => {
if (u.departmentId == item.departmentId) {
u.children.map(p => {
u.children.map((p) => {
if (p.id == item.id) {
p.checked = false;
}
......@@ -239,13 +251,13 @@ export default {
//list 时,设置值。
listSetValue() {
var ids = [];
this.checkedItems.map(u => {
this.checkedItems.map((u) => {
ids.push(u.id);
});
this.$emit("on-change", ids);
},
checkAll(item, i) {
item.children.map(u => {
item.children.map((u) => {
u.checked = item.checked;
});
this.$set(this.group, i, this.group[i]);
......@@ -255,19 +267,19 @@ export default {
getSelectItems() {
var items = [];
if (this.theme == "list") {
this.checkedItems.map(u => {
this.checkedItems.map((u) => {
items.push(u);
});
} else {
if (!this.multiple) {
//单选时返回信息
if (this.datas && this.datas.length > 0) {
var item2 = this.datas.filter(u => u.value == this.value);
var item2 = this.datas.filter((u) => u.value == this.value);
if (item2 && item2[0]) {
items.push(item2[0]);
}
} else {
var item1 = this.dic.filter(u => u.value == this.value);
var item1 = this.dic.filter((u) => u.value == this.value);
if (item1 && item1[0]) {
items.push(item1[0]);
}
......@@ -275,15 +287,15 @@ export default {
} else {
//复选时返回
if (this.datas && this.datas.length > 0) {
this.value.forEach(v => {
var item3 = this.dic.filter(u => u.value == v);
this.value.forEach((v) => {
var item3 = this.dic.filter((u) => u.value == v);
if (item3 && item3[0]) {
items.push(item3[0]);
}
});
} else {
this.value.forEach(v => {
var item = this.dic.filter(u => u.value == v);
this.value.forEach((v) => {
var item = this.dic.filter((u) => u.value == v);
if (item && item[0]) {
items.push(item[0]);
}
......@@ -298,21 +310,21 @@ export default {
getSelectNames() {
var names = [];
if (this.theme == "list") {
this.checkedItems.map(u => {
this.checkedItems.map((u) => {
items.push(u.name);
});
} else {
this.getSelectItems().forEach(v => {
this.getSelectItems().forEach((v) => {
names.push(v.label);
});
}
return names;
}
},
},
computed: {
dic() {
let result = [];
this.data.forEach(u => {
this.data.forEach((u) => {
// result.push({
// value: u.id,
// label: u.userName
......@@ -324,43 +336,43 @@ export default {
},
checkedItems() {
var items = [];
this.group.map(u => {
u.children.map(l => {
this.group.map((u) => {
u.children.map((l) => {
if (l.checked) {
items.push(l);
}
});
});
return items;
}
},
},
filters: {
vvv: lis => {
vvv: (lis) => {
return 3;
// return lis.filter(u=>{
// return u.checked==true
// }).lenght;
}
},
},
watch: {
value: {
handler(v, o) {
this.name = v;
},
deep: true
deep: true,
},
departmentId: {
handler(v, o) {
this.getselectuser(v);
},
deep: true
deep: true,
},
datas(v) {
if (v) {
//alert(JSON.stringify(v))
}
}
}
},
},
};
</script>
<style lang="less">
......
......@@ -32,7 +32,7 @@ export default {
return {
keys: "",
expand: false,
list: []
list: [],
};
},
created() {
......@@ -45,19 +45,19 @@ export default {
{
fieldName: "title",
fieldValue: name,
conditionalType: "Like"
}
]
conditionalType: "Like",
},
],
};
this.$api
.post(`${resourceUrl}/storeroomlocation/paged`, params)
.then(r => {
.then((r) => {
let res = r.result.items;
var data = this.$u.toTree(
res,
0,
u => {
u.value=u.id
(u) => {
u.value = u.id;
u.expand = true;
u.selected = false;
u.checked = false;
......@@ -85,36 +85,39 @@ export default {
"span",
{
style: {
color: "#000"
}
color: "#000",
},
},
data.title
)
),
]);
},
change(v, b) {
// console.log(b);
let ids = [];
let productIds = [];
let rootName = [];
ids.push(b.id);
productIds.push(b.value);
if (b.children) {
addId(b.children);
function addId(data) {
data.map(u => {
data.map((u) => {
ids.push(u.id);
productIds.push(u.value);
if (u.children) {
addId(u.children);
}
});
}
}
this.$emit("on-select", b.bomId, b, productIds, ids);
var roots = this.$u.findRoots(this.list, b.id).reverse();
rootName = roots.map((u) => {
return u.title;
});
this.$emit("on-select", b, ids, rootName);
},
hide() {
this.$emit("on-hide");
}
},
},
computed: {
data() {
......@@ -123,7 +126,7 @@ export default {
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map(u => {
data.map((u) => {
if (keys.length < 2) {
u.expand = expand;
result.push(u);
......@@ -138,8 +141,8 @@ export default {
});
}
return result;
}
}
},
},
};
</script>
......
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col :span="12">
<FormItem :label="l('name')" prop="materialId">
<Materiel v-model="entity.materialId" @on-change="change"></Materiel>
<Materiel v-model="entity.materialId" @on-change="change" :materialType='materialType'></Materiel>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeId">
<StoreSelect v-model="entity.storeId" @on-change="storeChange"></StoreSelect>
<div style="color:#999">{{rootName}}</div>
<!-- <StoreSelect v-model="entity.storeId" @on-change="storeChange"></StoreSelect> -->
</FormItem>
</Col>
<Col :span="12">
......@@ -37,9 +38,7 @@
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creator')" prop="creator">
{{entity.creator}}
</FormItem>
<FormItem :label="l('creator')" prop="creator">{{entity.creator}}</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
......@@ -75,7 +74,7 @@ export default {
creator: this.$store.state.userInfo.userName,
unitPrice: null,
originalManufacturer: "",
remark: ""
remark: "",
},
rules: {
materialId: [
......@@ -83,44 +82,49 @@ export default {
required: true,
message: "请选择物料",
type: "string",
trigger: "change"
}
trigger: "change",
},
],
storeId: [
{
required: true,
message: "请选择库位",
type: "number",
trigger: "change"
}
],
total: [
// storeId: [
// {
// required: true,
// message: "请选择库位",
// type: "number",
// trigger: "change",
// },
// ],
total: [
{
required: true,
message: "请输入入库数量",
type: "number",
trigger: "change"
}
]
}
trigger: "change",
},
],
},
};
},
props: {
v: Object,
eid: Number
// v: Object,
eid: Number,
rootName: String,
storeTitle: String,
materialType: String,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
// if (this.eid > 0) {
// this.load(this.eid);
// }
},
methods: {
handleSubmit() {
this.$refs.form.validate(v => {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
this.entity.storeId = this.eid;
this.entity.storeTitle = this.storeTitle;
Api.create(this.entity)
.then(r => {
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
......@@ -129,7 +133,7 @@ export default {
this.$Message.error("保存失败");
}
})
.catch(err => {
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
......@@ -140,35 +144,36 @@ export default {
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.entity.id = 0;
});
},
// load(v) {
// Api.get({ id: v }).then((r) => {
// this.entity = r.result;
// this.entity.id = 0;
// });
// },
change(e) {
this.entity.name = e.name;
this.entity.materialId = e.materialId;
this.entity.materialCode = e.mmcode;
},
storeChange(v, item) {
this.entity.storeId = item.id;
this.entity.storeTitle = item.title;
},
// storeChange(v, item) {
// console.log(item.id)
// this.entity.storeId = item.id;
// this.entity.storeTitle = item.title;
// },
l(key) {
key = "stock" + "." + key;
return this.$t(key);
}
},
},
watch: {
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
}
}
// v() {
// this.entity = this.$u.clone(this.v);
// },
// eid(v) {
// if (v > 0) {
// this.load(v);
// }
// },
},
};
</script>
......@@ -24,8 +24,18 @@
<Button type="primary" @click="add">入库</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
<component :is="detail" :eid="curId" :storeId="storeId" :mcode="mCode" @on-close="cancel" @on-ok="ok" />
<Modal v-model="modal" :title="title" width="900" footer-hide :fullscreen="fscreeen">
<component
:is="detail"
:eid="curId"
:rootName="rootName"
:storeTitle="storeTitle"
:materialType="materialType"
:storeId="storeId"
:mcode="mCode"
@on-close="cancel"
@on-ok="ok"
/>
</Modal>
</Content>
</Layout>
......@@ -36,26 +46,29 @@ import Search from "./search";
export default {
name: "list",
components: {
Search
Search,
},
head: {
title: "库存表",
author: "henq",
description: "stock 7/13/2020 11:48:09 AM"
description: "stock 7/13/2020 11:48:09 AM",
},
data() {
return {
action: Api.index,
showMenu: true,
easySearch: {
keys: { op: "name,storeTitle,materialCode", value: null }
keys: { op: "name,storeTitle,materialCode", value: null },
},
fscreeen: false,
modal: false,
title: "新增",
detail: null,
curId: 0,
storeId:null,
storeId: null,
rootName: "",
storeTitle: "",
materialType: "",
mCode: "",
columns: [
{
......@@ -63,14 +76,14 @@ export default {
title: this.l("name"),
align: "left",
easy: true,
high: true
high: true,
},
{
{
key: "materialCode",
title: this.l("materialCode"),
align: "left",
easy: true,
high: true
high: true,
},
{
key: "total",
......@@ -88,13 +101,13 @@ export default {
props: {
content: "库存不足,总数小于" + minNum,
placement: "top",
disabled: params.row.total > minNum ? true : false
disabled: params.row.total > minNum ? true : false,
},
class: params.row.total > minNum ? "" : "red"
class: params.row.total > minNum ? "" : "red",
},
params.row.total
);
}
},
},
{
key: "minNum",
......@@ -103,14 +116,14 @@ export default {
high: true,
render: (h, params) => {
return h("div", {}, params.row.minNum ? params.row.minNum : "0");
}
},
},
{
key: "storeTitle",
title: this.l("storeTitle"),
align: "left",
easy: true,
high: true
high: true,
},
{
title: "操作",
......@@ -125,18 +138,18 @@ export default {
attrs: {
oprate: "detail",
},
on: { click: () => this.setNum(params.row) }
on: { click: () => this.setNum(params.row) },
},
"设置最低库存"
"预警"
),
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row) }
on: { click: () => this.view(params.row) },
},
"查看"
)
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
// h(
// "op",
......@@ -155,14 +168,14 @@ export default {
// "删除"
// )
]);
}
}
},
},
],
treeData: [],
ocolumn: [],
treeHeight: "",
ids: [],
list: []
list: [],
};
},
created() {
......@@ -193,11 +206,14 @@ export default {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.fscreeen = false;
this.modal = true;
if (this.curId) {
this.title = "新增";
this.detail = () => import("./add");
this.fscreeen = false;
this.modal = true;
} else {
this.$Message.error("请先选择库房库位");
}
},
copy(id) {
this.curId = id;
......@@ -207,27 +223,27 @@ export default {
},
view(row) {
this.curId = row.id;
this.storeId=row.storeId;
this.storeId = row.storeId;
this.mCode = row.materialCode;
this.title = "详情";
this.detail = () => import("./itemIndex");
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("删除成功");
}
});
},
// 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;
......@@ -240,13 +256,18 @@ export default {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(id, item, productIds, ids) {
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.title = "预警";
this.detail = () => import("./setNum");
this.fscreeen = false;
this.modal = true;
......@@ -258,7 +279,7 @@ export default {
//new tree start
initTree() {
var sumData = [];
this.$http.order.getallselecttree().then(res => {
this.$http.order.getallselecttree().then((res) => {
//alert(JSON.stringify(res))
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
......@@ -269,8 +290,8 @@ export default {
this.$Message.error("加载产品树失败!");
}
});
}
}
},
},
};
</script>
<style lang="less">
......
......@@ -203,6 +203,7 @@ export default {
},
proChange(id, data, listName, roots) {
console.log(listName)
this.entity.levelId = id;
this.entity.levelTitle = listName.join(" / ");
},
......
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