Commit 7295179d authored by renjintao's avatar renjintao

material、index、sotreSelect、add...ing

parent 21a7ed91
<template>
<Select v-model="dep" :placeholder="placeholdeinfo" clearable @on-clear="onClear">
<Option
v-for="(item,index) in list"
:key="index"
:value="item.value"
style="display:none"
:label="item.label"
></Option>
<Tree key="mytree" :data="data1" ref="mytree" :render="renderContent"></Tree>
</Select>
</template>
<script>
export default {
name: "Add",
model: {
prop: "value",
event: "on-change"
},
data() {
return {
dep: "",
list: [],
data1: [],
selectdata: [],
placeholdeinfo: "请选择",
orderSearchForm: {
productId: null, //产品id
productName: "", //产品名称
drawingNo: "", //图号
bomId:null //bomId
}
};
},
props: {
value: [String, Number, Array],
placeholder: {
type: String,
default: "请选择部门"
},
multiple: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
mounted() {},
created() {
this.dep = this.value | "";
this.loadTree();
},
methods: {
handleSelect(data) {
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
if (data[0].isProduct == "1") {
this.list = [];
this.list.push({ label: data[0].title, value: data[0].id });
this.orderSearchForm.productName = data[0].title;
this.orderSearchForm.productId = data[0].productId;
this.orderSearchForm.drawingNo = data[0].drawingNo;
this.orderSearchForm.bomId = data[0].bomId;
this.$emit(
"on-change",
this.orderSearchForm.productId,
this.orderSearchForm
);
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
resetFields() {
this.orderSearchForm = {
productId: null, //产品id
productName: "", //产品名称
drawingNo: "", //图号
bomId:null
};
},
loadTree() {
//打开新增订单窗口加载产品
this.resetFields();
var sumData = [];
this.$http.order.getallselecttree().then(res => {
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = sumData;
} else {
this.$Message.error("加载产品树失败!");
}
});
},
renderContent(h, { root, node, data }) {
//渲染树的样式
return h(
"span",
{
style: {
color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式
cursor: "pointer"
},
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
}
}
},
data.title
);
},
onClear() {
this.list = [];
this.placeholdeinfo = "请选择";
this.resetFields();
this.$emit("on-change", null, this.orderSearchForm);
}
},
watch: {
value: {
handler(v, o) {
this.dep = v | "";
this.resetFields();
var sumData = [];
this.$http.order.getallselecttree().then(res => {
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = sumData;
let temData = this.$u.clone(this.data1);
this.list = [];
if (v != "" && v != null) {
let dataTemp = this.$u.treeToList(temData);
dataTemp.forEach(data => {
if (data.isProduct == 1 && data.id == this.dep) {
this.placeholdeinfo = data.title;
this.list.push({ label: data.title, value: data.id });
}
});
}
} else {
this.$Message.error("加载产品树失败!");
}
});
},
deep: true
}
}
};
</script>
...@@ -1543,5 +1543,30 @@ export default { ...@@ -1543,5 +1543,30 @@ export default {
level: '层级', level: '层级',
userName: '管理员', userName: '管理员',
userIds: '管理员Id', userIds: '管理员Id',
},
stock: {
creationTime: '创建时间',
creatorUserId: '创建人',
lastModificationTime: '更新时间',
lastModifierUserId: '更新人',
isDeleted: '删除人',
deletionTime: '删除时间',
deleterUserId: '删除人',
name: '物料名称',
materialId: '物料主键',
materialType: '物料类型',
total: '总数',
inputTotal: '入库数量',
storeId: '库位id',
storeTitle: '库位名称',
minNum: '最低库存',
brand: '牌号',
specifications: '规格',
batch: '批次',
certificateOfApproval: '合格证',
creator: '操作人',
unitPrice: '单价',
originalManufacturer: '原厂家',
remark: '备注',
} }
} }
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('name')" prop="materialCode">
<Materiel v-model="entity.materialId" @on-change="change"></Materiel>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<StoreSelect v-model="entity.storeId" ></StoreSelect>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('inputTotal')" prop="total">
<InputNumber v-model="entity.total"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('unitPrice')" prop="unitPrice">
<InputNumber v-model="entity.unitPrice"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batch')" prop="batch">
<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">
<Input v-model="entity.creator" :disabled="true"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</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";
export default {
name: "Add",
data() {
return {
disabled: false,
entity: {
creationTime: null,
creatorUserId: null,
lastModificationTime: null,
lastModifierUserId: null,
isDeleted: null,
deletionTime: null,
deleterUserId: null,
name: "",
materialId: "",
materialCode: "",
materialType: null,
total: null,
storeId: null,
storeTitle: "",
minNum: null,
brand: "",
specifications: "",
batch: "",
certificateOfApproval: "",
creator: "",
unitPrice: null,
originalManufacturer: "",
remark: ""
},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: {
v: Object,
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
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");
},
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;
},
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);
}
}
}
};
</script>
import Api from '@/plugins/request'
export default {
index: `${resourceUrl}/stock/paged`,
paged(params) {
return Api.post(`${resourceUrl}/stock/paged`, params);
},
get(params) {
return Api.get(`${resourceUrl}/stock/get`, params);
},
create(params) {
return Api.post(`${resourceUrl}/stock/create`, params);
},
update(params) {
return Api.post(`${resourceUrl}/stock/update`, params);
},
delete(id) {
return Api.delete(`${resourceUrl}/stock/delete`, {
params: {
id: id
}
});
},
deletes(params) {
return Api.post(`${resourceUrl}/stock/batchdelete`, 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>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: {
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "stock" + "." + key;
return this.$t(key);
}
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
}
}
};
</script>
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker type="date" v-model="entity.creationTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creatorUserId')" prop="creatorUserId">
<InputNumber v-model="entity.creatorUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModificationTime')" prop="lastModificationTime">
<DatePicker type="date" v-model="entity.lastModificationTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<InputNumber v-model="entity.lastModifierUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('isDeleted')" prop="isDeleted">
<InputNumber v-model="entity.isDeleted"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker type="date" v-model="entity.deletionTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('deleterUserId')" prop="deleterUserId">
<InputNumber v-model="entity.deleterUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('materialId')" prop="materialId">
<Input v-model="entity.materialId"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('materialType')" prop="materialType">
<InputNumber v-model="entity.materialType"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('total')" prop="total">
<InputNumber v-model="entity.total"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeId')" prop="storeId">
<InputNumber v-model="entity.storeId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input v-model="entity.storeTitle"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('minNum')" prop="minNum">
<InputNumber v-model="entity.minNum"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('brand')" prop="brand">
<Input v-model="entity.brand"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('specifications')" prop="specifications">
<Input v-model="entity.specifications"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('batch')" prop="batch">
<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('creator')" prop="creator">
<Input v-model="entity.creator"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('unitPrice')" prop="unitPrice">
<InputNumber v-model="entity.unitPrice"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('originalManufacturer')" prop="originalManufacturer">
<Input v-model="entity.originalManufacturer"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</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";
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: {
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
});
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
Api.update(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");
},
l(key) {
key = "stock" + "." + key;
return this.$t(key);
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
};
</script>
This diff is collapsed.
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show">
<FormItem :label="$t('id')" prop="id">
<Input v-model="condition.id.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.creationTime.show">
<FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.creatorUserId.show">
<FormItem :label="l('creatorUserId')" prop="creatorUserId">
<Input v-model="condition.creatorUserId.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.lastModificationTime.show">
<FormItem :label="l('lastModificationTime')" prop="lastModificationTime">
<DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show">
<FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<Input v-model="condition.lastModifierUserId.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.deletionTime.show">
<FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker type="daterange" v-model="condition.deletionTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.name.show">
<FormItem :label="l('name')" prop="name">
<Input v-model="condition.name.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.materialId.show">
<FormItem :label="l('materialId')" prop="materialId">
<Input v-model="condition.materialId.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.materialType.show">
<FormItem :label="l('materialType')" prop="materialType">
<Input v-model="condition.materialType.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.total.show">
<FormItem :label="l('total')" prop="total">
<Input v-model="condition.total.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.storeId.show">
<FormItem :label="l('storeId')" prop="storeId">
<Input v-model="condition.storeId.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.storeTitle.show">
<FormItem :label="l('storeTitle')" prop="storeTitle">
<Input v-model="condition.storeTitle.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.minNum.show">
<FormItem :label="l('minNum')" prop="minNum">
<Input v-model="condition.minNum.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.brand.show">
<FormItem :label="l('brand')" prop="brand">
<Input v-model="condition.brand.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.specifications.show">
<FormItem :label="l('specifications')" prop="specifications">
<Input v-model="condition.specifications.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.batch.show">
<FormItem :label="l('batch')" prop="batch">
<Input v-model="condition.batch.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.certificateOfApproval.show">
<FormItem :label="l('certificateOfApproval')" prop="certificateOfApproval">
<Input v-model="condition.certificateOfApproval.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.creator.show">
<FormItem :label="l('creator')" prop="creator">
<Input v-model="condition.creator.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.unitPrice.show">
<FormItem :label="l('unitPrice')" prop="unitPrice">
<Input v-model="condition.unitPrice.value"></Input>
</FormItem>
</Col>
<Col :span="12" :v-if="condition.originalManufacturer.show">
<FormItem :label="l('originalManufacturer')" prop="originalManufacturer">
<Input v-model="condition.originalManufacturer.value"></Input>
</FormItem>
</Col>
<Col :span="24" :v-if="condition.remark.show">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="condition.remark.value"></Input>
</FormItem>
</Col>
</Row>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
condition: {
id: { op: "Equal", value: null, show: true },
creationTime: { op: "Range", value: null, show: true },
creatorUserId: { op: "Equal", value: null, show: true },
lastModificationTime: { op: "Range", value: null, show: true },
lastModifierUserId: { op: "Equal", value: null, show: true },
deletionTime: { op: "Range", value: null, show: true },
name: { op: "Equal", value: null, show: true },
materialId: { op: "Equal", value: null, show: true },
materialType: { op: "Equal", value: null, show: true },
total: { op: "Equal", value: null, show: true },
storeId: { op: "Equal", value: null, show: true },
storeTitle: { op: "Equal", value: null, show: true },
minNum: { op: "Equal", value: null, show: true },
brand: { op: "Equal", value: null, show: true },
specifications: { op: "Equal", value: null, show: true },
batch: { op: "Equal", value: null, show: true },
certificateOfApproval: { op: "Equal", value: null, show: true },
creator: { op: "Equal", value: null, show: true },
unitPrice: { op: "Equal", value: null, show: true },
originalManufacturer: { op: "Equal", value: null, show: true },
remark: { op: "Equal", value: null, show: true }
}
};
},
methods: {
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "stock" + "." + key;
return this.$t(key);
}
}
};
</script>
...@@ -33,6 +33,8 @@ import workShopDefault from '@/components/page/workShopDefault.vue' ...@@ -33,6 +33,8 @@ import workShopDefault from '@/components/page/workShopDefault.vue'
import WorkShop from '@/components/page/workShop.vue' import WorkShop from '@/components/page/workShop.vue'
import EquipSelect from '@/components/page/equipSelect.vue' import EquipSelect from '@/components/page/equipSelect.vue'
import ResourceSelect from '@/components/page/resourceSelect.vue' import ResourceSelect from '@/components/page/resourceSelect.vue'
import StoreTree from '@/components/page/storeTree.vue'
import StoreSelect from '@/components/page/storeSelect.vue'
import clipboard from 'clipboard'; import clipboard from 'clipboard';
// import i18n from '@/i18n'; // import i18n from '@/i18n';
...@@ -117,6 +119,9 @@ Vue.component("DTSearch", DTSearch) ...@@ -117,6 +119,9 @@ Vue.component("DTSearch", DTSearch)
Vue.component("InputTime", InputTime) Vue.component("InputTime", InputTime)
Vue.component("OutputTime", OutputTime) Vue.component("OutputTime", OutputTime)
Vue.component("ViewerImg", ViewerImg) Vue.component("ViewerImg", ViewerImg)
Vue.component("StoreTree", StoreTree)
Vue.component("StoreSelect", StoreSelect)
//注入mock //注入mock
......
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