Commit 2ab2fbcc authored by renjintao's avatar renjintao

bom

parent be2de13a
<template> <template>
<div> <div>
<DataGrid <DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" exportTitle="工艺Bom">
:columns="columns" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:conditions="easySearch" <FormItem prop="keys">
:action="action" <Input placeholder="请输入关键字物料名称" v-model="easySearch.keys.value" clearable />
exportTitle="工艺Bom" </FormItem>
> <FormItem>
<template slot="easySearch"> <Button type="primary" @click="search">查询</Button>
<Form ref="formInline" :model="easySearch" inline> </FormItem>
<FormItem prop="keys"> </Form>
<Input placeholder="请输入关键字物料名称" v-model="easySearch.keys.value" clearable /> </template>
</FormItem> <template slot="searchForm">
<FormItem> <Search :headid="hid" />
<Button type="primary" @click="search">查询</Button> </template>
</FormItem> <template slot="buttons">
</Form> <Button type="primary" @click="add" v-if="headerStatus==0||headerStatus==4">新增</Button>
</template> <Button @click="openModalIm">导入</Button>
<template slot="searchForm"> </template>
<Search :headid="hid" />
</template>
<template slot="buttons">
<Button type="primary" @click="add" v-if="headerStatus==0||headerStatus==4">新增</Button>
<Button @click="openModalIm">导入</Button>
</template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="850" footer-hide> <Modal v-model="modal" :title="title" width="850" footer-hide>
<component <component :is="detail" :eid="curId" :headid="hid" :productBomId="productBomId" :materialId="materialId" @on-close="cancel" @on-ok="ok" />
:is="detail"
:eid="curId"
:headid="hid"
:productBomId="productBomId"
:materialId="materialId"
@on-close="cancel"
@on-ok="ok"
/>
</Modal> </Modal>
<ImportExcel <ImportExcel ref="importExcel" @on-get-data="getData" :modalTitle="temTitle" :columns="columns" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
ref="importExcel" </div>
@on-get-data="getData"
:modalTitle="temTitle"
:columns="columns"
:open="ModalIm"
@on-cancel="ModalImCancel"
@on-ok="ok"
/>
</div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
export default { export default {
name: "list", name: "list",
components: { components: {
Search, Search,
}, },
head: { head: {
title: "工艺配套表", title: "工艺配套表",
author: "henq", author: "henq",
description: "routingsupporting 4/27/2020 10:35:33 AM", description: "routingsupporting 4/27/2020 10:35:33 AM",
}, },
props: ["headerid"], props: ["headerid"],
data() { data() {
return { return {
materialId: null, materialId: null,
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { keys: {
op: "nameMaterial", op: "nameMaterial",
value: null, value: null,
},
// routingHeaderId: { op: "Equal", value: this.headerid },
routingHeaderId: {
op: "Equal",
value: -1,
},
},
modal: false,
title: "新增",
detail: null,
curId: 0,
hid: 0,
columns: [{
key: "routingDetailNo",
title: this.l("routingDetailNo"),
align: "left",
high: true,
width: 100,
sortable: true,
},
{
key: "routingHeaderId",
title: this.l("routingHeaderName"),
hide: true,
import: true,
techKey: "1",
render: (h, params) => {
return h(
"span", {},
this.getRoutingHeaderName(params.row.routingHeaderId)
);
},
},
{
key: "routingDetailName",
title: this.l("routingDetailName"),
align: "left",
high: true,
},
{
key: "routingDetailId",
title: this.l("routingDetailId"),
hide: true,
import: true,
},
{
key: "materialType",
title: this.l("materialType"),
align: "center",
easy: true,
high: true,
code: "mes_xingchi_resource.material.materialReType",
width: 100,
},
{
key: "materialNumber",
title: this.l("materialNumber"),
align: "left",
easy: true,
high: true,
},
{
key: "materialId",
title: this.l("materialId"),
align: "left",
hide: true,
import: true,
},
{
key: "nameMaterial",
title: this.l("nameMaterial"),
align: "left",
easy: true,
high: true,
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: false,
type: "user",
align: "left",
},
{
key: "quantity",
title: this.l("quantity"),
high: true,
width: 80,
},
{
key: "brand",
title: this.l("brand"),
align: "left",
easy: true,
high: true,
},
{
key: "specifications",
title: this.l("specifications"),
align: "left",
easy: true,
high: true,
},
{
key: "xhgg",
title: this.l("xhgg"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "texture",
title: this.l("texture"),
align: "left",
easy: true,
high: true,
},
{
key: "procurementStandards",
title: this.l("procurementStandards"),
align: "left",
easy: true,
high: true,
},
{
key: "qualityGrade",
title: this.l("qualityGrade"),
align: "left",
easy: true,
high: true,
},
{
key: "drawNum",
title: this.l("drawNum"),
align: "left",
easy: true,
high: true,
},
{
key: "creationTime",
title: this.l("creationTime"),
hide: true,
align: "left",
hide: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: true,
align: "left",
hide: true,
type: "user",
},
// {
// key: "lastModificationTime",
// title: this.l("lastModificationTime"),
// hide: true,
// align: "left",
// hide: true,
// },
// {
// key: "lastModifierUserId",
// title: this.l("lastModifierUserId"),
// hide: true,
// align: "left",
// hide: true,
// type: "user",
// },
{
title: "操作",
key: "action",
width: 180,
align: "center",
render: (h, params) => {
return h(
"div", {
class: "action",
},
[
h(
"op", {
attrs: {
oprate: "detail",
},
on: {
click: () => this.view(params.row),
},
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op", {
attrs: {
oprate: "edit",
},
on: {
click: () => this.edit(params.row.id),
},
},
this.headerStatus == 4 || this.headerStatus == 0 ? "编辑" : ""
),
h(
"op", {
attrs: {
oprate: "delete",
},
on: {
click: () => this.remove(params.row.id),
},
},
this.headerStatus == 4 || this.headerStatus == 0 ? "删除" : ""
),
]
);
},
},
],
headerStatus: -1,
productBomId: -1,
ModalIm: false,
temTitle: "工艺Bom",
routingHeaderData: [],
};
},
created() {
this.hid = this.easySearch.routingHeaderId.value;
this.headerStatus = this.$route.query.headerStatus;
this.productBomId = Number(this.$route.query.productBomId);
if (this.headerid != -1) {
this.easySearch.routingHeaderId.value = this.headerid;
} else {
this.easySearch.routingHeaderId.value = this.$route.query.id;
}
},
mounted() {
console.log(this);
this.getRoutingHeaderData();
this.search();
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
}, },
// routingHeaderId: { op: "Equal", value: this.headerid }, search() {
routingHeaderId: { this.$refs.grid.reload(this.easySearch);
op: "Equal",
value: -1,
}, },
}, add() {
modal: false, this.curId = 0;
title: "新增", this.hid = Number(this.headerid);
detail: null, this.title = "新增";
curId: 0, this.detail = () => import("./add");
hid: 0, this.modal = true;
columns: [
{
key: "routingDetailNo",
title: this.l("routingDetailNo"),
align: "left",
high: true,
width: 100,
sortable: true,
}, },
// { copy(id) {
// key: "routingHeaderId", this.curId = id;
// title: this.l("routingHeaderName"), this.title = "克隆";
// hide: true, this.detail = () => import("./add");
// import: true, this.modal = true;
// techKey: "1",
// render: (h, params) => {
// return h(
// "span",
// {},
// this.getRoutingHeaderName(params.row.routingHeaderId)
// );
// },
// },
{
key: "routingDetailName",
title: this.l("routingDetailName"),
align: "left",
high: true,
}, },
// { view(row) {
// key: "routingDetailId", this.curId = row.id;
// title: this.l("routingDetailId"), this.materialId = row.materialId;
// hide: true, this.title = "查看详情";
// import: true, this.detail = () => import("./detail");
// }, this.modal = true;
// {
// key: "materialType",
// title: this.l("materialType"),
// align: "center",
// easy: true,
// high: true,
// code: "mes_xingchi_resource.material.materialReType",
// width: 100,
// },
{
key: "materialNumber",
title: this.l("materialNumber"),
align: "left",
easy: true,
high: true,
}, },
// { edit(id) {
// key: "materialId", this.curId = id;
// title: this.l("materialId"), this.hid = Number(this.headerid);
// align: "left", this.title = "编辑";
// hide: true, this.detail = () => import("./edit");
// import: true, this.modal = true;
// },
{
key: "nameMaterial",
title: this.l("nameMaterial"),
align: "left",
easy: true,
high: true,
}, },
{ remove(id) {
key: "creationTime", Api.delete(id).then((r) => {
title: this.l("creationTime"), if (r.success) {
align: "left", this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
}, },
{ cancel() {
key: "creatorUserId", this.curId = 0;
title: this.l("creatorUserId"), this.modal = false;
hide: false,
type: "user",
align: "left",
}, },
{ //批量导入start
key: "quantity", //导入功能
title: this.l("quantity"), openModalIm() {
high: true, this.ModalIm = true;
width: 80,
}, },
// { ModalImCancel() {
// key: "brand", this.ModalIm = false;
// title: this.l("brand"), },
// align: "left", getData(val) {
// easy: true, let url = `${technologyUrl}productinfoimportservice/import`;
// high: true, this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val));
// }, },
// { //根据页面二次处理数据
// key: "specifications", formatMethod(val) {
// title: this.l("specifications"), // alert(JSON.stringify(val))
// align: "left", let tempData = this.$u.clone(val);
// easy: true, let tempList = [];
// high: true, tempData.forEach((ele) => {
// }, let obj = {
// { routingHeaderId: Number(this.headerid),
// key: "xhgg", routingDetailId: ele.routingDetailId ?
// title: this.l("xhgg"), Number(ele.routingDetailId) : null,
// align: "left", routingDetailNo: ele.routingDetailNo ?
// easy: true, Number(ele.routingDetailNo) : null,
// high: true, routingDetailName: ele.routingDetailName ? ele.routingDetailName : "",
// hide: true, routingStepId: 0,
// }, quantity: ele.quantity ? Number(ele.quantity) : 0,
// { materialId: ele.materialId ? ele.materialId : "",
// key: "texture", materialType: ele.materialType ? Number(ele.materialType) : "",
// title: this.l("texture"), materialNumber: ele.materialNumber ? ele.materialNumber : "",
// align: "left", nameMaterial: ele.nameMaterial ? ele.nameMaterial : "",
// easy: true, brand: ele.brand ? ele.brand : "",
// high: true, specifications: ele.specifications ? ele.specifications : "",
// }, xhgg: ele.xhgg ? ele.xhgg : "",
// { texture: ele.texture ? ele.texture : "",
// key: "procurementStandards", procurementStandards: ele.procurementStandards ?
// title: this.l("procurementStandards"), ele.procurementStandards : "",
// align: "left", qualityGrade: ele.qualityGrade ? ele.qualityGrade : "",
// easy: true, state: null,
// high: true, extend: "",
// }, remark: "",
// { drawNum: ele.drawNum ? ele.drawNum : "",
// key: "qualityGrade", };
// title: this.l("qualityGrade"), if (ele.routingDetailId && ele.routingDetailId != null) {
// align: "left", obj.ico = false;
// easy: true, } else {
// high: true, obj.ico = true;
// }, }
// { tempList.push(obj);
// key: "drawNum", });
// title: this.l("drawNum"), return tempList;
// align: "left", },
// easy: true, //批量导入end
// high: true, //工艺规程id和name之间的转换
// }, //获取工艺规程信息
// { getRoutingHeaderData() {
// key: "creationTime", let data = {
// title: this.l("creationTime"), conditions: [],
// hide: true, };
// align: "left", Api.getRoutingheaderList(data).then((r) => {
// hide: true, if (r.success) {
// }, this.routingHeaderData = r.result || [];
// { }
// key: "creatorUserId", });
// title: this.l("creatorUserId"), },
// hide: true, //根据工艺规程ID获得name
// align: "left", getRoutingHeaderName(val) {
// hide: true, let routingHeaderDataList = this.$u.clone(this.routingHeaderData);
// type: "user", let routingHeaderName = "";
// }, routingHeaderDataList.forEach((ele) => {
// { if (ele.id == Number(val)) {
// key: "lastModificationTime", routingHeaderName = ele.name;
// title: this.l("lastModificationTime"), }
// hide: true, });
// align: "left", return routingHeaderName;
// hide: true, },
// }, l(key) {
// { let vkey = "routingsupporting" + "." + key;
// key: "lastModifierUserId", return this.$t(vkey) || key;
// title: this.l("lastModifierUserId"),
// hide: true,
// align: "left",
// hide: true,
// type: "user",
// },
{
title: "操作",
key: "action",
width: 180,
align: "center",
render: (h, params) => {
return h(
"div",
{
class: "action",
},
[
h(
"op",
{
attrs: {
oprate: "detail",
},
on: {
click: () => this.view(params.row),
},
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{
attrs: {
oprate: "edit",
},
on: {
click: () => this.edit(params.row.id),
},
},
this.headerStatus == 4 || this.headerStatus == 0 ? "编辑" : ""
),
h(
"op",
{
attrs: {
oprate: "delete",
},
on: {
click: () => this.remove(params.row.id),
},
},
this.headerStatus == 4 || this.headerStatus == 0 ? "删除" : ""
),
]
);
},
}, },
],
headerStatus: -1,
productBomId: -1,
ModalIm: false,
temTitle: "工艺Bom",
routingHeaderData: [],
};
},
created() {
this.hid = this.easySearch.routingHeaderId.value;
this.headerStatus = this.$route.query.headerStatus;
this.productBomId = Number(this.$route.query.productBomId);
if (this.headerid != -1) {
this.easySearch.routingHeaderId.value = this.headerid;
} else {
this.easySearch.routingHeaderId.value = this.$route.query.id;
}
},
mounted() {
console.log(this);
this.getRoutingHeaderData();
this.search();
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.hid = Number(this.headerid);
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(row) {
this.curId = row.id;
this.materialId = row.materialId;
this.title = "查看详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.hid = Number(this.headerid);
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;
},
//批量导入start
//导入功能
openModalIm() {
this.ModalIm = true;
},
ModalImCancel() {
this.ModalIm = false;
},
getData(val) {
let url = `${technologyUrl}productinfoimportservice/import`;
this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val));
},
//根据页面二次处理数据
formatMethod(val) {
// alert(JSON.stringify(val))
let tempData = this.$u.clone(val);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
routingHeaderId: Number(this.headerid),
routingDetailId: ele.routingDetailId
? Number(ele.routingDetailId)
: null,
routingDetailNo: ele.routingDetailNo
? Number(ele.routingDetailNo)
: null,
routingDetailName: ele.routingDetailName ? ele.routingDetailName : "",
routingStepId: 0,
quantity: ele.quantity ? Number(ele.quantity) : 0,
materialId: ele.materialId ? ele.materialId : "",
materialType: ele.materialType ? Number(ele.materialType) : "",
materialNumber: ele.materialNumber ? ele.materialNumber : "",
nameMaterial: ele.nameMaterial ? ele.nameMaterial : "",
brand: ele.brand ? ele.brand : "",
specifications: ele.specifications ? ele.specifications : "",
xhgg: ele.xhgg ? ele.xhgg : "",
texture: ele.texture ? ele.texture : "",
procurementStandards: ele.procurementStandards
? ele.procurementStandards
: "",
qualityGrade: ele.qualityGrade ? ele.qualityGrade : "",
state: null,
extend: "",
remark: "",
drawNum: ele.drawNum ? ele.drawNum : "",
};
if (ele.routingDetailId && ele.routingDetailId != null) {
obj.ico = false;
} else {
obj.ico = true;
}
tempList.push(obj);
});
return tempList;
},
//批量导入end
//工艺规程id和name之间的转换
//获取工艺规程信息
getRoutingHeaderData() {
let data = {
conditions: [],
};
Api.getRoutingheaderList(data).then((r) => {
if (r.success) {
this.routingHeaderData = r.result || [];
}
});
},
//根据工艺规程ID获得name
getRoutingHeaderName(val) {
let routingHeaderDataList = this.$u.clone(this.routingHeaderData);
let routingHeaderName = "";
routingHeaderDataList.forEach((ele) => {
if (ele.id == Number(val)) {
routingHeaderName = ele.name;
}
});
return routingHeaderName;
},
l(key) {
let vkey = "routingsupporting" + "." + key;
return this.$t(vkey) || key;
}, },
},
}; };
</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