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: {
......
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