Commit abc532dd authored by renjintao's avatar renjintao

process

parent 98daad6c
......@@ -101,6 +101,7 @@ export default {
// userId: 1
userId: this.$store.state.userInfo.userId,
treeData: [], //物料数据
codeRuleData: [], //物料编码
};
},
props: {
......@@ -273,7 +274,8 @@ export default {
this.saveUserconfig();
});
//物料加载类型数据
this.getTreeData()
this.getTreeData();
this.getcodeRuleData();
},
methods: {
//数据加载
......@@ -544,11 +546,14 @@ export default {
e[ele.key]
);
});
//导出数据增加对应的物料管理信息
tempCol1.forEach((elcol1) => {
if (elcol1.code == 1) {
e[elcol1.key] = this.getType1(e[elcol1.key])
} else if (elcol1.code == 2) {
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 {
})
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
},
computed: {
......
......@@ -50,7 +50,7 @@
</FormItem>
</Form>
</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>
<div slot="footer">
<Button @click="infoModal=false">关闭</Button>
......
......@@ -441,6 +441,83 @@ export default {
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: "",
excelData: [],
excelDataBack: [], //临时存储原始数据
......@@ -460,6 +537,9 @@ export default {
titleInfo: '',
noDataText: '暂无数据',
imBtn: true,
//物料管理
treeData: [], //物料管理左侧类别树
codeRuleData: [], //物料编码等信息
};
},
props: {
......@@ -478,6 +558,9 @@ export default {
if (this.eid > 0) {
this.load(this.eid);
}
//物料加载类型数据
this.getTreeData();
this.getcodeRuleData();
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
......@@ -567,6 +650,7 @@ export default {
temData = this.$u.clone(this.$refs.comExcel.excelData)
}
let arrTitleUse = []; ////使用数据字典的字段
let arrTitleUse1 = []; ////使用物料编码的字段
temColPage.forEach((elCode) => {
if (elCode.code) {
arrTitleUse.push({
......@@ -574,6 +658,12 @@ export default {
code: elCode.code,
});
}
if (elCode.materialKey) { //临时存放物料管理大类和子类列表
arrTitleUse1.push({
key: elCode.key,
code: elCode.materialKey
});
}
});
let useData = []; //重新组织list列表数据
temData.forEach((elData, index) => {
......@@ -619,6 +709,7 @@ export default {
);
}
});
})
this.dataIm = useData;
},
......@@ -762,6 +853,9 @@ export default {
case 3:
this.loadColum(this.columns3);
break;
case 4:
this.loadColum(this.columns4);
break;
default:
this.loadColum(this.columns0);
}
......@@ -788,6 +882,9 @@ export default {
case 3:
this.importResource();
break;
case 4:
this.importMateriel();
break;
default:
//this.loadColum(this.columns1);
}
......@@ -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按钮
changeExcel(val) {
if (val == 1) {
......
......@@ -48,6 +48,7 @@ export default {
rowsTable: [],
fullscreen: false,
treeData: [],
codeRuleData: [],
detail: null,
temTitle: "物料管理",
sets: v => {
......@@ -75,6 +76,17 @@ export default {
align: "center",
code: "material.code.type"
},
{
key: "codeRuleId",
title: "编码名称",
materialKey: '3',
render: (h, params) => {
return h(
"span", {},
this.getType3(params.row.codeRuleId)
);
}
},
{
key: "rootCategoryId",
title: "大类",
......@@ -230,6 +242,7 @@ export default {
},
mounted() {
this.getTreeData()
this.getcodeRuleData()
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
......@@ -418,7 +431,6 @@ export default {
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
codeRuleType: this.nodeInfo.codeRuleType
//codeRuleType: ele.codeRuleType ? Number(ele.codeRuleType) : ''
};
this.addCol.forEach(el => {
obj[el.field] = ele[el.field]
......@@ -464,6 +476,27 @@ export default {
})
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
},
watch: {
......
<template>
<div>
<DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action">
<div>
<DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" exportTitle="工艺Bom">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
placeholder="请输入关键字物料名称"
v-model="easySearch.keys.value"
v-width="260"
/>
<Input placeholder="请输入关键字物料名称" v-model="easySearch.keys.value" v-width="260" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
......@@ -16,7 +12,7 @@
</Form>
</template>
<template slot="searchForm">
<Search :headid="hid"/>
<Search :headid="hid" />
</template>
<template slot="buttons">
<Button type="primary" @click="add" v-show="headerStatus==0||headerStatus==4">新增</Button>
......@@ -25,8 +21,9 @@
<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" />
</Modal>
</div>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
......@@ -46,25 +43,26 @@ export default {
action: Api.index,
easySearch: {
keys: {
op:
"nameMaterial",
op: "nameMaterial",
value: null
},
routingHeaderId: { op: "Equal", value: -1 }
routingHeaderId: {
op: "Equal",
value: -1
}
},
modal: false,
title: "新增",
detail: null,
curId: 0,
hid: 0,
columns: [
{
columns: [{
key: "routingDetailNo",
title: this.l("routingDetailNo"),
align: "left",
high: true,
width: 100,
sortable:true
sortable: true
},
{
key: "routingDetailName",
......@@ -77,7 +75,7 @@ export default {
title: this.l("quantity"),
align: "right",
high: true,
width:80,
width: 80,
},
{
key: "materialType",
......@@ -86,7 +84,7 @@ export default {
easy: true,
high: true,
code: "mes_xingchi_resource.material.materialReType",
width:100,
width: 100,
},
{
key: "materialNumber",
......@@ -122,7 +120,7 @@ export default {
align: "left",
easy: true,
high: true,
hide:true,
hide: true,
},
{
key: "texture",
......@@ -157,30 +155,30 @@ export default {
title: this.l("creationTime"),
hide: true,
align: "left",
hide:true,
hide: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: true,
align: "left",
hide:true,
type:'user',
hide: true,
type: 'user',
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left",
hide:true,
hide: true,
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left",
hide:true,
type:'user',
hide: true,
type: 'user',
},
{
title: "操作",
......@@ -188,38 +186,49 @@ export default {
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) }
"op", {
attrs: {
oprate: "detail"
},
on: {
click: () => this.view(params.row.id)
}
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row.id)
}
},
this.headerStatus == 4||this.headerStatus == 0 ? "编辑" : ""
this.headerStatus == 4 || this.headerStatus == 0 ? "编辑" : ""
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) }
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
this.headerStatus == 4||this.headerStatus == 0 ? "删除" : ""
this.headerStatus == 4 || this.headerStatus == 0 ? "删除" : ""
)
]);
}
}
],
headerStatus:-1,
productBomId:-1,
headerStatus: -1,
productBomId: -1,
};
},
created() {
......@@ -228,15 +237,18 @@ export default {
} else {
this.easySearch.routingHeaderId.value = this.$route.query.id;
}
this.hid=Number(this.easySearch.routingHeaderId.value)
this.headerStatus=this.$route.query.headerStatus
this.productBomId=Number(this.$route.query.productBomId)
this.hid = Number(this.easySearch.routingHeaderId.value)
this.headerStatus = this.$route.query.headerStatus
this.productBomId = Number(this.$route.query.productBomId)
},
mounted() {
console.log(this);
this.search();
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
......@@ -293,5 +305,6 @@ export default {
}
};
</script>
<style lang="less">
</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