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