Commit abc532dd authored by renjintao's avatar renjintao

process

parent 98daad6c
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId, userId: this.$store.state.userInfo.userId,
treeData: [], //物料数据 treeData: [], //物料数据
codeRuleData: [], //物料编码
}; };
}, },
props: { props: {
...@@ -273,7 +274,8 @@ export default { ...@@ -273,7 +274,8 @@ export default {
this.saveUserconfig(); this.saveUserconfig();
}); });
//物料加载类型数据 //物料加载类型数据
this.getTreeData() this.getTreeData();
this.getcodeRuleData();
}, },
methods: { methods: {
//数据加载 //数据加载
...@@ -544,11 +546,14 @@ export default { ...@@ -544,11 +546,14 @@ export default {
e[ele.key] e[ele.key]
); );
}); });
//导出数据增加对应的物料管理信息
tempCol1.forEach((elcol1) => { tempCol1.forEach((elcol1) => {
if (elcol1.code == 1) { if (elcol1.code == 1) {
e[elcol1.key] = this.getType1(e[elcol1.key]) e[elcol1.key] = this.getType1(e[elcol1.key])
} else if (elcol1.code == 2) { } else if (elcol1.code == 2) {
e[elcol1.key] = this.getType2(e[elcol1.key]) e[elcol1.key] = this.getType2(e[elcol1.key])
} else if (elcol1.code == 3) {
e[elcol1.key] = this.getType3(e[elcol1.key])
} }
}); });
...@@ -593,6 +598,27 @@ export default { ...@@ -593,6 +598,27 @@ export default {
}) })
return childrenName return childrenName
}, },
//获取编码名称
getcodeRuleData() {
let data = {
conditions: []
};
this.$api.post(`${material}/coderule/paged`, data).then((r) => {
if (r.success) {
this.codeRuleData = r.result.items || []
}
});
},
getType3(val) {
let codeRuleDataList = this.$u.clone(this.codeRuleData)
let codeRuleName = ""
codeRuleDataList.forEach(ele => {
if (ele.id == val) {
codeRuleName = ele.name
}
})
return codeRuleName
},
//物料大类和子类的解析end //物料大类和子类的解析end
}, },
computed: { computed: {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</FormItem> </FormItem>
</Form> </Form>
</FooterToolbar> </FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen> <Modal v-model="infoModal" :title="modalTitles" fullscreen>
<DataGrid :tool="false" :page="false" :columns="colsIm" :data="dataIm" :height="tdHeightExcel+30" ref="dataImport"></DataGrid> <DataGrid :tool="false" :page="false" :columns="colsIm" :data="dataIm" :height="tdHeightExcel+30" ref="dataImport"></DataGrid>
<div slot="footer"> <div slot="footer">
<Button @click="infoModal=false">关闭</Button> <Button @click="infoModal=false">关闭</Button>
......
...@@ -441,6 +441,83 @@ export default { ...@@ -441,6 +441,83 @@ export default {
code: "mes_xingchi_resource.resource.state", code: "mes_xingchi_resource.resource.state",
} }
], ],
columns4: [{
key: "codeRuleType",
title: "类型",
align: "center",
code: "material.code.type"
},
{
key: "codeRuleId",
title: "编码名称",
materialKey: '3',
},
{
key: "rootCategoryId",
title: "大类",
align: "right",
materialKey: '1',
},
{
key: "categoryId",
title: "子类",
align: "right",
materialKey: '2',
},
{
key: "code",
title: "编码",
align: "left",
render: (h, params) => {
return h(
"a", {
props: {},
on: {
click: () => this.details(params.row)
}
},
!params.row.code || params.row.code == 0 ? "未分配" : params.row.code
);
}
},
{
key: "name",
title: "名称",
align: "left"
},
{
key: "status",
title: "状态",
align: "center",
code: "material.main.status",
},
{
key: "version",
title: "版本",
align: "left",
code: "material.main.version"
},
{
key: "drawing",
title: "图号",
align: "left"
},
{
key: "creationTime",
title: "创建时间",
hide: true,
align: "left",
type: "date"
},
{
key: "creatorUserId",
title: "创建人",
hide: true,
align: "left",
type: "user"
}
],
tdHeightExcel: "", tdHeightExcel: "",
excelData: [], excelData: [],
excelDataBack: [], //临时存储原始数据 excelDataBack: [], //临时存储原始数据
...@@ -460,6 +537,9 @@ export default { ...@@ -460,6 +537,9 @@ export default {
titleInfo: '', titleInfo: '',
noDataText: '暂无数据', noDataText: '暂无数据',
imBtn: true, imBtn: true,
//物料管理
treeData: [], //物料管理左侧类别树
codeRuleData: [], //物料编码等信息
}; };
}, },
props: { props: {
...@@ -478,6 +558,9 @@ export default { ...@@ -478,6 +558,9 @@ export default {
if (this.eid > 0) { if (this.eid > 0) {
this.load(this.eid); this.load(this.eid);
} }
//物料加载类型数据
this.getTreeData();
this.getcodeRuleData();
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -567,6 +650,7 @@ export default { ...@@ -567,6 +650,7 @@ export default {
temData = this.$u.clone(this.$refs.comExcel.excelData) temData = this.$u.clone(this.$refs.comExcel.excelData)
} }
let arrTitleUse = []; ////使用数据字典的字段 let arrTitleUse = []; ////使用数据字典的字段
let arrTitleUse1 = []; ////使用物料编码的字段
temColPage.forEach((elCode) => { temColPage.forEach((elCode) => {
if (elCode.code) { if (elCode.code) {
arrTitleUse.push({ arrTitleUse.push({
...@@ -574,6 +658,12 @@ export default { ...@@ -574,6 +658,12 @@ export default {
code: elCode.code, code: elCode.code,
}); });
} }
if (elCode.materialKey) { //临时存放物料管理大类和子类列表
arrTitleUse1.push({
key: elCode.key,
code: elCode.materialKey
});
}
}); });
let useData = []; //重新组织list列表数据 let useData = []; //重新组织list列表数据
temData.forEach((elData, index) => { temData.forEach((elData, index) => {
...@@ -619,6 +709,7 @@ export default { ...@@ -619,6 +709,7 @@ export default {
); );
} }
}); });
}) })
this.dataIm = useData; this.dataIm = useData;
}, },
...@@ -762,6 +853,9 @@ export default { ...@@ -762,6 +853,9 @@ export default {
case 3: case 3:
this.loadColum(this.columns3); this.loadColum(this.columns3);
break; break;
case 4:
this.loadColum(this.columns4);
break;
default: default:
this.loadColum(this.columns0); this.loadColum(this.columns0);
} }
...@@ -788,6 +882,9 @@ export default { ...@@ -788,6 +882,9 @@ export default {
case 3: case 3:
this.importResource(); this.importResource();
break; break;
case 4:
this.importMateriel();
break;
default: default:
//this.loadColum(this.columns1); //this.loadColum(this.columns1);
} }
...@@ -881,6 +978,112 @@ export default { ...@@ -881,6 +978,112 @@ export default {
}); });
} }
}, },
//插入物料管理start
importMateriel() {
let tempData = this.$u.clone(this.dataIm);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
name: ele.name ? ele.name : '',
version: ele.version ? Number(ele.version) : '',
drawing: ele.drawing ? ele.drawing : '',
description: ele.description ? ele.description : "",
code: 0,
status: ele.status ? Number(ele.status) : '',
customProperties: {},
categoryId: this.getType2(ele.categoryId) ? this.getType2(ele.categoryId) : 1, //左侧树点击的id
rootCategoryId: this.getType1(ele.rootCategoryId) ? this.getType1(ele.rootCategoryId) : 1, //左侧树点击的数据的最顶层id
codeRuleId: this.getType3(ele.codeRuleId) ? this.getType3(ele.codeRuleId) : 1, //类别编码名称
codeRuleType: ele.codeRuleType ? Number(ele.codeRuleType) : 1 //类别codeType
};
if (ele.codeRuleId && this.getType3(ele.codeRuleId) != "" && ele.codeRuleType && ele.codeRuleType != "" && ele.codeRuleType != null && ele.rootCategoryId && this.getType1(ele.rootCategoryId) != "" && ele.name && ele.name != "") {
tempList.push(obj);
}
});
if (tempList.length == 0) {
this.$Message.error("所有导入的数据均不合法!");
} else {
let parms = {
list: tempList,
};
let url = `${material}/materialimportservice/import`
this.$api.post(url, parms).then((r) => {
if (r.success) {
this.$Message.success("成功批量导入物料管理模块 " + tempList.length + " 条数据");
this.imBtn = false;
this.cancelExcel();
} else {
this.$Message.error("批量导入失败")
}
}).catch(err => {
this.$Message.error("数据异常!");
});
}
},
//物料大类和子类的解析start
getTreeData() {
let data = {
conditions: []
};
this.$api.post(`${material}/category/list`, data).then((r) => {
if (r.success) {
this.treeData = r.result || []
}
});
},
getType1(val) {
let tempTreeList = this.$u.clone(this.treeData)
let rootId = ""
if (val && val != "" && val != null) {
tempTreeList.forEach(ele => {
if (ele.upId == 0 && ele.name == val) {
rootId = ele.id
}
})
}
return rootId
},
getType2(val) {
let tempTreeList = this.$u.clone(this.treeData)
let childrenId = ""
if (val && val != "" && val != null) {
tempTreeList.forEach(ele => {
if (ele.upId > 0 && ele.name == val) {
childrenId = ele.id
}
})
}
return childrenId
},
//物料大类和子类的解析end
//获取编码名称等start
getcodeRuleData() {
let data = {
conditions: []
};
this.$api.post(`${material}/coderule/paged`, data).then((r) => {
if (r.success) {
this.codeRuleData = r.result.items || []
}
});
},
getType3(val) {
let codeRuleDataList = this.$u.clone(this.codeRuleData)
let codeRuleId = ""
if (val && val != "" && val != null) {
codeRuleDataList.forEach(ele => {
if (ele.name == val) {
codeRuleId = ele.id
}
})
}
return codeRuleId
},
//获取编码名称等end
//插入物料管理end
//切换列表和excel按钮 //切换列表和excel按钮
changeExcel(val) { changeExcel(val) {
if (val == 1) { if (val == 1) {
......
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
rowsTable: [], rowsTable: [],
fullscreen: false, fullscreen: false,
treeData: [], treeData: [],
codeRuleData: [],
detail: null, detail: null,
temTitle: "物料管理", temTitle: "物料管理",
sets: v => { sets: v => {
...@@ -75,6 +76,17 @@ export default { ...@@ -75,6 +76,17 @@ export default {
align: "center", align: "center",
code: "material.code.type" code: "material.code.type"
}, },
{
key: "codeRuleId",
title: "编码名称",
materialKey: '3',
render: (h, params) => {
return h(
"span", {},
this.getType3(params.row.codeRuleId)
);
}
},
{ {
key: "rootCategoryId", key: "rootCategoryId",
title: "大类", title: "大类",
...@@ -230,6 +242,7 @@ export default { ...@@ -230,6 +242,7 @@ export default {
}, },
mounted() { mounted() {
this.getTreeData() this.getTreeData()
this.getcodeRuleData()
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -418,7 +431,6 @@ export default { ...@@ -418,7 +431,6 @@ export default {
customProperties: {}, customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
codeRuleType: this.nodeInfo.codeRuleType codeRuleType: this.nodeInfo.codeRuleType
//codeRuleType: ele.codeRuleType ? Number(ele.codeRuleType) : ''
}; };
this.addCol.forEach(el => { this.addCol.forEach(el => {
obj[el.field] = ele[el.field] obj[el.field] = ele[el.field]
...@@ -464,6 +476,27 @@ export default { ...@@ -464,6 +476,27 @@ export default {
}) })
return childrenName return childrenName
}, },
//获取编码名称
getcodeRuleData() {
let data = {
conditions: []
};
Api.pagedSlecet(data).then((r) => {
if (r.success) {
this.codeRuleData = r.result.items || []
}
});
},
getType3(val) {
let codeRuleDataList = this.$u.clone(this.codeRuleData)
let codeRuleName = ""
codeRuleDataList.forEach(ele => {
if (ele.id == val) {
codeRuleName = ele.name
}
})
return codeRuleName
},
//物料大类和子类的解析end //物料大类和子类的解析end
}, },
watch: { watch: {
......
<template> <template>
<div> <div>
<DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action"> <DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" exportTitle="工艺Bom">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input <Input placeholder="请输入关键字物料名称" v-model="easySearch.keys.value" v-width="260" />
placeholder="请输入关键字物料名称"
v-model="easySearch.keys.value"
v-width="260"
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
...@@ -16,7 +12,7 @@ ...@@ -16,7 +12,7 @@
</Form> </Form>
</template> </template>
<template slot="searchForm"> <template slot="searchForm">
<Search :headid="hid"/> <Search :headid="hid" />
</template> </template>
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add" v-show="headerStatus==0||headerStatus==4">新增</Button> <Button type="primary" @click="add" v-show="headerStatus==0||headerStatus==4">新增</Button>
...@@ -25,8 +21,9 @@ ...@@ -25,8 +21,9 @@
<Modal v-model="modal" :title="title" width="1200" footer-hide> <Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" :headid="hid" :productBomId="productBomId" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" :headid="hid" :productBomId="productBomId" @on-close="cancel" @on-ok="ok" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
...@@ -46,25 +43,26 @@ export default { ...@@ -46,25 +43,26 @@ export default {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { keys: {
op: op: "nameMaterial",
"nameMaterial",
value: null value: null
}, },
routingHeaderId: { op: "Equal", value: -1 } routingHeaderId: {
op: "Equal",
value: -1
}
}, },
modal: false, modal: false,
title: "新增", title: "新增",
detail: null, detail: null,
curId: 0, curId: 0,
hid: 0, hid: 0,
columns: [ columns: [{
{
key: "routingDetailNo", key: "routingDetailNo",
title: this.l("routingDetailNo"), title: this.l("routingDetailNo"),
align: "left", align: "left",
high: true, high: true,
width: 100, width: 100,
sortable:true sortable: true
}, },
{ {
key: "routingDetailName", key: "routingDetailName",
...@@ -77,7 +75,7 @@ export default { ...@@ -77,7 +75,7 @@ export default {
title: this.l("quantity"), title: this.l("quantity"),
align: "right", align: "right",
high: true, high: true,
width:80, width: 80,
}, },
{ {
key: "materialType", key: "materialType",
...@@ -86,7 +84,7 @@ export default { ...@@ -86,7 +84,7 @@ export default {
easy: true, easy: true,
high: true, high: true,
code: "mes_xingchi_resource.material.materialReType", code: "mes_xingchi_resource.material.materialReType",
width:100, width: 100,
}, },
{ {
key: "materialNumber", key: "materialNumber",
...@@ -122,7 +120,7 @@ export default { ...@@ -122,7 +120,7 @@ export default {
align: "left", align: "left",
easy: true, easy: true,
high: true, high: true,
hide:true, hide: true,
}, },
{ {
key: "texture", key: "texture",
...@@ -157,30 +155,30 @@ export default { ...@@ -157,30 +155,30 @@ export default {
title: this.l("creationTime"), title: this.l("creationTime"),
hide: true, hide: true,
align: "left", align: "left",
hide:true, hide: true,
}, },
{ {
key: "creatorUserId", key: "creatorUserId",
title: this.l("creatorUserId"), title: this.l("creatorUserId"),
hide: true, hide: true,
align: "left", align: "left",
hide:true, hide: true,
type:'user', type: 'user',
}, },
{ {
key: "lastModificationTime", key: "lastModificationTime",
title: this.l("lastModificationTime"), title: this.l("lastModificationTime"),
hide: true, hide: true,
align: "left", align: "left",
hide:true, hide: true,
}, },
{ {
key: "lastModifierUserId", key: "lastModifierUserId",
title: this.l("lastModifierUserId"), title: this.l("lastModifierUserId"),
hide: true, hide: true,
align: "left", align: "left",
hide:true, hide: true,
type:'user', type: 'user',
}, },
{ {
title: "操作", title: "操作",
...@@ -188,38 +186,49 @@ export default { ...@@ -188,38 +186,49 @@ export default {
width: 140, width: 140,
align: "center", align: "center",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "detail" }, oprate: "detail"
on: { click: () => this.view(params.row.id) } },
on: {
click: () => this.view(params.row.id)
}
}, },
"查看" "查看"
), ),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'), //h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit"
on: { click: () => this.edit(params.row.id) } },
on: {
click: () => this.edit(params.row.id)
}
}, },
this.headerStatus == 4||this.headerStatus == 0 ? "编辑" : "" this.headerStatus == 4 || this.headerStatus == 0 ? "编辑" : ""
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "delete" }, oprate: "delete"
on: { click: () => this.remove(params.row.id) } },
on: {
click: () => this.remove(params.row.id)
}
}, },
this.headerStatus == 4||this.headerStatus == 0 ? "删除" : "" this.headerStatus == 4 || this.headerStatus == 0 ? "删除" : ""
) )
]); ]);
} }
} }
], ],
headerStatus:-1, headerStatus: -1,
productBomId:-1, productBomId: -1,
}; };
}, },
created() { created() {
...@@ -228,15 +237,18 @@ export default { ...@@ -228,15 +237,18 @@ export default {
} else { } else {
this.easySearch.routingHeaderId.value = this.$route.query.id; this.easySearch.routingHeaderId.value = this.$route.query.id;
} }
this.hid=Number(this.easySearch.routingHeaderId.value) this.hid = Number(this.easySearch.routingHeaderId.value)
this.headerStatus=this.$route.query.headerStatus this.headerStatus = this.$route.query.headerStatus
this.productBomId=Number(this.$route.query.productBomId) this.productBomId = Number(this.$route.query.productBomId)
}, },
mounted() { mounted() {
console.log(this); console.log(this);
this.search(); this.search();
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
...@@ -293,5 +305,6 @@ export default { ...@@ -293,5 +305,6 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
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