Commit 988b6e2c authored by 仇晓婷's avatar 仇晓婷

自定义物料入库

parent b1345c05
<template> <template>
<Form ref="form" :model="entity" :rules="rules" :label-width="100"> <Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row> <Row>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeId">
<div style="color:#999">{{rootName}}</div>
<!-- <StoreSelect v-model="entity.storeId" @on-change="storeChange"></StoreSelect> -->
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creator')" prop="creator">{{entity.creator}}</FormItem>
</Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('name')" prop="materialId"> <FormItem :label="l('name')" prop="materialId">
<Materiel v-model="entity.materialId" @on-change="change" :materialType='materialType'></Materiel> <Materiel v-model="entity.materialId" @on-change="change" :materialType="materialType"></Materiel>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeId"> <FormItem :label="l('certificateOfApproval')" prop="certificateOfApproval">
<div style="color:#999">{{rootName}}</div> <Input v-model="entity.certificateOfApproval"></Input>
<!-- <StoreSelect v-model="entity.storeId" @on-change="storeChange"></StoreSelect> -->
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('inputTotal')" prop="total"> <FormItem :label="l('inputTotal')" prop="total">
<InputNumber v-model="entity.total"></InputNumber> <InputNumber v-model="entity.total" style="width:280px"></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('unitPrice')" prop="unitPrice"> <FormItem :label="l('unitPrice')" prop="unitPrice">
<InputNumber v-model="entity.unitPrice"></InputNumber> <InputNumber v-model="entity.unitPrice" style="width:280px"></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
...@@ -27,25 +35,52 @@ ...@@ -27,25 +35,52 @@
<Input v-model="entity.batch"></Input> <Input v-model="entity.batch"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12">
<FormItem :label="l('certificateOfApproval')" prop="certificateOfApproval">
<Input v-model="entity.certificateOfApproval"></Input>
</FormItem>
</Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('originalManufacturer')" prop="originalManufacturer"> <FormItem :label="l('originalManufacturer')" prop="originalManufacturer">
<Input v-model="entity.originalManufacturer"></Input> <Input v-model="entity.originalManufacturer"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12">
<FormItem :label="l('creator')" prop="creator">{{entity.creator}}</FormItem>
</Col>
<Col :span="24"> <Col :span="24">
<FormItem :label="l('remark')" prop="remark"> <FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input> <Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<div>
<Divider orientation="left">物料属性</Divider>
</div>
<Row>
<Col v-for="li in fileds" :key="li.field" :span="li.span">
<FormItem :label="li.title" :prop="li.name">
<Input v-if="li.dataType==0" v-model="entity[li.field]"></Input>
<InputNumber
v-if="li.dataType==1||li.dataType==2"
v-model="entity[li.field]"
class="w100"
></InputNumber>
<Dictionary v-if="li.dataType==3" v-model="entity[li.field]" :code="li.note"></Dictionary>
<Input v-if="li.dataType==5" type="textarea" v-model="entity[li.filed]"></Input>
<DatePicker
v-if="li.dataType==4"
v-model="entity[li.field]"
type="date"
:placeholder="'选择'+li.title"
></DatePicker>
<InputFile v-if="li.dataType==6" v-model="entity[li.field]"></InputFile>
<!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> -->
<InputFile v-if="li.dataType==7" v-model="entity[li.field]"></InputFile>
<Input v-if="li.dataType==8" type="textarea" v-model="entity[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> <FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button> <Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
...@@ -54,11 +89,13 @@ ...@@ -54,11 +89,13 @@
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "Add", name: "add",
data() { data() {
return { return {
disabled: false, disabled: false,
fileds: [], //扩展属性
entity: { entity: {
name: "", name: "",
materialId: "", materialId: "",
...@@ -76,6 +113,7 @@ export default { ...@@ -76,6 +113,7 @@ export default {
originalManufacturer: "", originalManufacturer: "",
remark: "", remark: "",
}, },
materialId: null,
rules: { rules: {
materialId: [ materialId: [
{ {
...@@ -85,14 +123,6 @@ export default { ...@@ -85,14 +123,6 @@ export default {
trigger: "change", trigger: "change",
}, },
], ],
// storeId: [
// {
// required: true,
// message: "请选择库位",
// type: "number",
// trigger: "change",
// },
// ],
total: [ total: [
{ {
required: true, required: true,
...@@ -152,8 +182,31 @@ export default { ...@@ -152,8 +182,31 @@ export default {
// }, // },
change(e) { change(e) {
this.entity.name = e.name; this.entity.name = e.name;
this.materialId = e.materialId;
this.entity.materialId = e.materialId; this.entity.materialId = e.materialId;
this.entity.materialCode = e.mmcode; this.entity.materialCode = 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;
});
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);
});
}
}
);
}, },
// storeChange(v, item) { // storeChange(v, item) {
// console.log(item.id) // console.log(item.id)
......
...@@ -30,4 +30,7 @@ export default { ...@@ -30,4 +30,7 @@ export default {
pagedStockitem(params) { pagedStockitem(params) {
return Api.post(`${resourceUrl}/stockitem/paged`, params); return Api.post(`${resourceUrl}/stockitem/paged`, params);
}, },
getmaterialdefinitionproperty(params){
return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params);
},
} }
<template> <template>
<div class="detail"> <div>
<Row> <span class="mr20">物料名称:{{materialName}}</span>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed> <span class="mr20">物料编码:{{mcode}}</span>
<Filed :span="12" :name="l('creatorUserId')">{{entity.creatorUserId}}</Filed> <span>库位:{{storeTitle}}</span>
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed> <DataGrid
<Filed :span="12" :name="l('lastModifierUserId')">{{entity.lastModifierUserId}}</Filed> :columns="columns"
<Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed> ref="grid"
<Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed> :action="action"
<Filed :span="12" :name="l('deleterUserId')">{{entity.deleterUserId}}</Filed> :conditions="easySearch"
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed> :tool="false"
<Filed :span="12" :name="l('materialId')">{{entity.materialId}}</Filed> :height="treeHeight"
<Filed :span="12" :name="l('materialType')">{{entity.materialType}}</Filed> ></DataGrid>
<Filed :span="12" :name="l('total')">{{entity.total}}</Filed>
<Filed :span="12" :name="l('storeId')">{{entity.storeId}}</Filed>
<Filed :span="12" :name="l('storeTitle')">{{entity.storeTitle}}</Filed>
<Filed :span="12" :name="l('minNum')">{{entity.minNum}}</Filed>
<Filed :span="12" :name="l('brand')">{{entity.brand}}</Filed>
<Filed :span="12" :name="l('specifications')">{{entity.specifications}}</Filed>
<Filed :span="12" :name="l('batch')">{{entity.batch}}</Filed>
<Filed :span="12" :name="l('certificateOfApproval')">{{entity.certificateOfApproval}}</Filed>
<Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('unitPrice')">{{entity.unitPrice}}</Filed>
<Filed :span="12" :name="l('originalManufacturer')">{{entity.originalManufacturer}}</Filed>
<Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed>
</Row>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "Add", name: "list",
head: {
title: "入库明细",
author: "henq",
description: "stock_item 7/13/2020 6:04:18 PM"
},
data() { data() {
return { return {
entity: {}, action: Api.indexStockitem,
rules: { easySearch: {
name: [{ required: true, message: "必填", trigger: "blur" }], materialCode: { op: "Equal", value: this.mcode },
code: [{ required: true, message: "必填", trigger: "blur" }] storeId: { op: "In", value: this.storeId }
} },
data: [],
treeHeight: 300,
curId: 0,
columns: [
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true
},
{ key: "total", title: this.l("total"), align: "right", high: true },
{
key: "nowTotal",
title: this.l("nowTotal"),
align: "right",
high: true
},
{ key: "batch", title: this.l("batch"), align: "left", high: true },
{
key: "certificateOfApproval",
title: this.l("certificateOfApproval"),
align: "left",
high: true
},
{
key: "unitPrice",
title: this.l("unitPrice"),
align: "right",
high: true
},
{
key: "originalManufacturer",
title: this.l("originalManufacturer"),
align: "left",
high: true
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "center",
high: true
},
{
key: "creator",
title: this.l("creatorUserId"),
align: "left",
high: true,
},
{
key: "remark",
title: this.l("remark"),
align: "left",
high: true,
tooltip: true
}
],
materialName: "",
storeTitle: ""
}; };
}, },
props: { props: {
eid: Number eid: Number,
storeId: Number,
mcode: String
},
created() {
this.treeHeight = window.innerHeight - 150;
}, },
mounted() { mounted() {
if (this.eid > 0) { this.load();
this.load(this.eid); window.onresize = () => {
} ///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
})();
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
load(v) { load() {
Api.get({ id: v }).then(r => { Api.get({ id: this.eid }).then(r => {
this.entity = r.result; this.materialName = r.result.name;
this.$emit("on-load"); this.storeTitle = r.result.storeTitle;
}); });
}, },
handleClose() { ok() {
this.$emit("on-close"); this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
cancel() {
this.curId = 0;
this.modal = false;
}, },
l(key) { l(key) {
key = "stock" + "." + key; let vkey = "stock_item" + "." + key;
return this.$t(key); return this.$t(vkey) || key;
} }
}, },
watch: { watch: {
eid(v) { eid(v) {
if (v > 0) { if (v != 0) {
this.load(v); // this.load(v);
} }
} }
} }
}; };
</script> </script>
<style lang="less">
</style>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<Button type="primary" @click="add">入库</Button> <Button type="primary" @click="add">入库</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="900" footer-hide :fullscreen="fscreeen"> <Modal v-model="modal" :title="title" width="800" footer-hide :fullscreen="fscreeen">
<component <component
:is="detail" :is="detail"
:eid="curId" :eid="curId"
...@@ -88,7 +88,6 @@ export default { ...@@ -88,7 +88,6 @@ export default {
{ {
key: "total", key: "total",
title: this.l("total"), title: this.l("total"),
align: "right",
high: true, high: true,
render: (h, params) => { render: (h, params) => {
let minNum = 0; let minNum = 0;
...@@ -112,12 +111,18 @@ export default { ...@@ -112,12 +111,18 @@ export default {
{ {
key: "minNum", key: "minNum",
title: this.l("minNum"), title: this.l("minNum"),
align: "right",
high: true, high: true,
render: (h, params) => { render: (h, params) => {
return h("div", {}, params.row.minNum ? params.row.minNum : "0"); return h("div", {}, params.row.minNum ? params.row.minNum : "0");
}, },
}, },
{
key: "unitPrice",
title: this.l("unitPrice"),
easy: true,
high: true,
},
{ {
key: "storeTitle", key: "storeTitle",
title: this.l("storeTitle"), title: this.l("storeTitle"),
...@@ -200,7 +205,7 @@ export default { ...@@ -200,7 +205,7 @@ export default {
this.$refs.grid.load(); this.$refs.grid.load();
this.modal = false; this.modal = false;
this.fscreeen = false; this.fscreeen = false;
this.curId = 0; // this.curId = 0;
}, },
search() { search() {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
...@@ -226,7 +231,7 @@ export default { ...@@ -226,7 +231,7 @@ export default {
this.storeId = row.storeId; this.storeId = row.storeId;
this.mCode = row.materialCode; this.mCode = row.materialCode;
this.title = "详情"; this.title = "详情";
this.detail = () => import("./itemIndex"); this.detail = () => import("./detail");
this.fscreeen = true; this.fscreeen = true;
this.modal = true; this.modal = true;
}, },
......
<template>
<div>
<span class="mr20">物料名称:{{materialName}}</span>
<span class="mr20">物料编码:{{mcode}}</span>
<span>库位:{{storeTitle}}</span>
<DataGrid
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:tool="false"
:height="treeHeight"
></DataGrid>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "list",
head: {
title: "入库明细",
author: "henq",
description: "stock_item 7/13/2020 6:04:18 PM"
},
data() {
return {
action: Api.indexStockitem,
easySearch: {
materialCode: { op: "Equal", value: this.mcode },
storeId: { op: "In", value: this.storeId }
},
data: [],
treeHeight: 300,
curId: 0,
columns: [
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true
},
{ key: "total", title: this.l("total"), align: "right", high: true },
{
key: "nowTotal",
title: this.l("nowTotal"),
align: "right",
high: true
},
{ key: "batch", title: this.l("batch"), align: "left", high: true },
{
key: "certificateOfApproval",
title: this.l("certificateOfApproval"),
align: "left",
high: true
},
{
key: "unitPrice",
title: this.l("unitPrice"),
align: "right",
high: true
},
{
key: "originalManufacturer",
title: this.l("originalManufacturer"),
align: "left",
high: true
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "center",
high: true
},
{
key: "creator",
title: this.l("creatorUserId"),
align: "left",
high: true,
},
{
key: "remark",
title: this.l("remark"),
align: "left",
high: true,
tooltip: true
}
],
materialName: "",
storeTitle: ""
};
},
props: {
eid: Number,
storeId: Number,
mcode: String
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
this.load();
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
})();
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
load() {
Api.get({ id: this.eid }).then(r => {
this.materialName = r.result.name;
this.storeTitle = r.result.storeTitle;
});
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
let vkey = "stock_item" + "." + key;
return this.$t(vkey) || key;
}
},
watch: {
eid(v) {
if (v != 0) {
// this.load(v);
}
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
<template>
<div>
<div>
<Divider orientation="left">物料属性</Divider>
</div>
<Row>
<Col v-for="li in fileds" :key="li.field" :span="li.span">
<FormItem :label="li.title" :prop="li.name">
<Input v-if="li.dataType==0" v-model="entity[li.field]"></Input>
<InputNumber
v-if="li.dataType==1||li.dataType==2"
v-model="entity[li.field]"
class="w100"
></InputNumber>
<Dictionary v-if="li.dataType==3" v-model="entity[li.field]" :code="li.note"></Dictionary>
<Input v-if="li.dataType==5" type="textarea" v-model="entity[li.filed]"></Input>
<DatePicker
v-if="li.dataType==4"
v-model="entity[li.field]"
type="date"
:placeholder="'选择'+li.title"
></DatePicker>
<InputFile v-if="li.dataType==6" v-model="entity[li.field]"></InputFile>
<!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> -->
<InputFile v-if="li.dataType==7" v-model="entity[li.field]"></InputFile>
<Input v-if="li.dataType==8" type="textarea" v-model="entity[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>
<!-- <Col :span="24">
<div v-html="entity"></div>
</Col>-->
<!-- <Col :span="24" style="text-align: right;">
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Col>-->
</Row>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "",
data() {
return {
fileds: [], //扩展属性
};
},
props: {
materialId: Number,
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {},
methods: {
initFiled(v) {
Api.getmaterialdefinitionproperty({ materialId: v }).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;
});
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);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "stock" + "." + key;
return this.$t(key);
},
},
watch: {
materialId(v) {
if (v) {
this.initFiled(v);
}
},
},
};
</script>
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
<Row> <Row>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('name')" prop="name"> <FormItem :label="l('name')" prop="name">
<Input v-model="entity.name" disabled></Input> <div style="color:#999">{{entity.name}}</div>
<!-- <Input v-model="entity.name" disabled></Input> -->
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle"> <FormItem :label="l('storeTitle')" prop="storeTitle">
<Input v-model="entity.storeTitle" disabled></Input> <div style="color:#999">{{entity.storeTitle}}</div>
<!-- <Input v-model="entity.storeTitle" disabled></Input> -->
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
...@@ -37,14 +39,14 @@ export default { ...@@ -37,14 +39,14 @@ export default {
materialCode: "", materialCode: "",
storeId: null, storeId: null,
storeTitle: "", storeTitle: "",
minNum: null minNum: null,
}, },
rules: {} rules: {},
}; };
}, },
props: { props: {
v: Object, v: Object,
eid: Number eid: Number,
}, },
mounted() { mounted() {
if (this.eid > 0) { if (this.eid > 0) {
...@@ -53,18 +55,17 @@ export default { ...@@ -53,18 +55,17 @@ export default {
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
if(this.entity.minNum==0) if (this.entity.minNum == 0) {
{
this.$Message.error("设置最低库存不能小于1"); this.$Message.error("设置最低库存不能小于1");
return return;
} }
let params = { let params = {
id: this.entity.id, id: this.entity.id,
minNum: this.entity.minNum minNum: this.entity.minNum,
}; };
this.disabled = true; this.disabled = true;
Api.setminnum(params) Api.setminnum(params)
.then(r => { .then((r) => {
this.disabled = false; this.disabled = false;
if (r.success) { if (r.success) {
this.$Message.success("设置成功"); this.$Message.success("设置成功");
...@@ -73,7 +74,7 @@ export default { ...@@ -73,7 +74,7 @@ export default {
this.$Message.error("设置失败失败"); this.$Message.error("设置失败失败");
} }
}) })
.catch(err => { .catch((err) => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error("保存失败");
console.warn(err); console.warn(err);
...@@ -83,7 +84,7 @@ export default { ...@@ -83,7 +84,7 @@ export default {
this.$emit("on-close"); this.$emit("on-close");
}, },
load(v) { load(v) {
Api.get({ id: v }).then(r => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
if (!r.result.minNum) { if (!r.result.minNum) {
this.entity.minNum = 0; this.entity.minNum = 0;
...@@ -93,7 +94,7 @@ export default { ...@@ -93,7 +94,7 @@ export default {
l(key) { l(key) {
key = "stock" + "." + key; key = "stock" + "." + key;
return this.$t(key); return this.$t(key);
} },
}, },
watch: { watch: {
v() { v() {
...@@ -103,7 +104,7 @@ export default { ...@@ -103,7 +104,7 @@ export default {
if (v > 0) { if (v > 0) {
this.load(v); this.load(v);
} }
} },
} },
}; };
</script> </script>
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