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

自定义物料入库

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