Commit 0a7df8a0 authored by renjintao's avatar renjintao

物料管理

parent b582466d
...@@ -100,6 +100,7 @@ export default { ...@@ -100,6 +100,7 @@ export default {
userConfig: null, //用户页面配置信息。, userConfig: null, //用户页面配置信息。,
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId, userId: this.$store.state.userInfo.userId,
treeData: [], //物料数据
}; };
}, },
props: { props: {
...@@ -271,6 +272,8 @@ export default { ...@@ -271,6 +272,8 @@ export default {
this.$dragging.$on("dragend", (e) => { this.$dragging.$on("dragend", (e) => {
this.saveUserconfig(); this.saveUserconfig();
}); });
//物料加载类型数据
this.getTreeData()
}, },
methods: { methods: {
//数据加载 //数据加载
...@@ -513,6 +516,7 @@ export default { ...@@ -513,6 +516,7 @@ export default {
const tHeader = []; // 设置Excel的表格第一行的标题 const tHeader = []; // 设置Excel的表格第一行的标题
const filterVal = []; //list里对象的属性 const filterVal = []; //list里对象的属性
var tempCol = []; var tempCol = [];
var tempCol1 = [];
var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => { columnsCur.forEach((el) => {
if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection" && el.key != "ico")) { if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection" && el.key != "ico")) {
...@@ -522,6 +526,12 @@ export default { ...@@ -522,6 +526,12 @@ export default {
code: el.code code: el.code
}); //临时存放code数据字典的字段及对应的数据字典code }); //临时存放code数据字典的字段及对应的数据字典code
} }
if (el.materialKey) {
tempCol1.push({
key: el.key,
code: el.materialKey
}); //临时存放物料管理大类和子类列表
}
tHeader.push(el.title); tHeader.push(el.title);
filterVal.push(el.key); filterVal.push(el.key);
} }
...@@ -534,7 +544,16 @@ export default { ...@@ -534,7 +544,16 @@ export default {
e[ele.key] 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])
}
}); });
});
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束 //获取导出数据结束
this.$u.outExcel(this.exportTitle + this.$u.outExcel(this.exportTitle +
...@@ -545,6 +564,36 @@ export default { ...@@ -545,6 +564,36 @@ export default {
); );
}); });
}, },
//物料大类和子类的解析start
getTreeData() {
let data = {
conditions: []
};
this.$api.post(`${material}/category/list`, data).then((r) => {
this.treeData = r.result
});
},
getType1(val) {
let tempTreeList = this.$u.clone(this.treeData)
let rootName = ""
tempTreeList.forEach(ele => {
if (ele.upId == 0 && ele.id == val) {
rootName = ele.name
}
})
return rootName
},
getType2(val) {
let tempTreeList = this.$u.clone(this.treeData)
let childrenName = ""
tempTreeList.forEach(ele => {
if (ele.upId > 0 && ele.id == val) {
childrenName = ele.name
}
})
return childrenName
},
//物料大类和子类的解析end
}, },
computed: { computed: {
columnsNow() { columnsNow() {
......
...@@ -236,7 +236,6 @@ export default { ...@@ -236,7 +236,6 @@ export default {
} }
}); });
} }
arrTitleUse.forEach((elem) => { arrTitleUse.forEach((elem) => {
if (eles[elem.key] && eles[elem.key] != "" && eles[elem.key] != null) { if (eles[elem.key] && eles[elem.key] != "" && eles[elem.key] != null) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值 //如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
...@@ -246,9 +245,9 @@ export default { ...@@ -246,9 +245,9 @@ export default {
); );
} }
}); });
}) })
this.dataIm = useData; this.dataIm = useData;
let tempData = this.$u.clone(this.dataIm); let tempData = this.$u.clone(this.dataIm);
this.$emit("on-get-data", tempData) this.$emit("on-get-data", tempData)
}, },
......
...@@ -233,28 +233,28 @@ export default { ...@@ -233,28 +233,28 @@ export default {
key: "creatorUserId", key: "creatorUserId",
title: this.l("creatorUserId"), title: this.l("creatorUserId"),
align: "left", align: "left",
import: false, import: true,
hide: true, hide: true,
}, },
{ {
key: "creationTime", key: "creationTime",
title: this.l("creationTime"), title: this.l("creationTime"),
align: "left", align: "left",
import: false, import: true,
hide: true, hide: true,
}, },
{ {
key: "lastModifierUserId", key: "lastModifierUserId",
title: this.l("lastModifierUserId"), title: this.l("lastModifierUserId"),
align: "left", align: "left",
import: false, import: true,
hide: true, hide: true,
}, },
{ {
key: "lastModificationTime", key: "lastModificationTime",
title: this.l("lastModificationTime"), title: this.l("lastModificationTime"),
align: "left", align: "left",
import: false, import: true,
hide: true, hide: true,
}, },
{ {
...@@ -262,7 +262,6 @@ export default { ...@@ -262,7 +262,6 @@ export default {
key: "action", key: "action",
width: 180, width: 180,
align: "right", align: "right",
import: false,
render: (h, params) => { render: (h, params) => {
return h( return h(
"div", { "div", {
......
<template> <template>
<div class="classification"> <div class="classification">
<Layout> <Layout>
<Sider width="300" v-if="showMenu"> <Sider width="300" v-if="showMenu">
<div class="p-list"> <div class="p-list">
...@@ -10,25 +10,13 @@ ...@@ -10,25 +10,13 @@
<Icon type="ios-arrow-down"></Icon> <Icon type="ios-arrow-down"></Icon>
</a> </a>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem <DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem>
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
<div class="fr mr10 mt10"> <div class="fr mr10 mt10">
<ButtonGroup class="fr ddi" size="small"> <ButtonGroup class="fr ddi" size="small">
<Button <Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" <Button icon="md-refresh" title="刷新" @click="loadTree(model8,nodeInfo.codeRuleType)"></Button>
@click="toggle"
title="展开/合并"
></Button>
<Button
icon="md-refresh"
title="刷新"
@click="loadTree(model8,nodeInfo.codeRuleType)"
></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button> <Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup> </ButtonGroup>
</div> </div>
...@@ -52,7 +40,7 @@ ...@@ -52,7 +40,7 @@
<MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" /> <MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" />
</Content> </Content>
</Layout> </Layout>
</div> </div>
</template> </template>
<script> <script>
...@@ -93,7 +81,10 @@ export default { ...@@ -93,7 +81,10 @@ export default {
categoryId: null, categoryId: null,
}; };
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
...@@ -149,10 +140,13 @@ export default { ...@@ -149,10 +140,13 @@ export default {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false;
}, },
renderContent(h, { root, node, data }) { renderContent(h, {
root,
node,
data
}) {
return h( return h(
"span", "span", {
{
on: { on: {
click: () => { click: () => {
this.handleSelect(root, data); //手动选择树节点 this.handleSelect(root, data); //手动选择树节点
...@@ -161,9 +155,9 @@ export default { ...@@ -161,9 +155,9 @@ export default {
}, },
data.title + data.title +
"(" + "(" +
(data.totalMaterialCount == undefined (data.totalMaterialCount == undefined ?
? "0" "0" :
: data.totalMaterialCount) + data.totalMaterialCount) +
")" ")"
); );
}, },
...@@ -200,8 +194,7 @@ export default { ...@@ -200,8 +194,7 @@ export default {
}, },
loadTree(id, codeRuleType) { loadTree(id, codeRuleType) {
let data = { let data = {
conditions: [ conditions: [{
{
fieldName: "codeRuleId", fieldName: "codeRuleId",
fieldValue: id, fieldValue: id,
conditionalType: "Equal", conditionalType: "Equal",
......
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
selectRows: [], selectRows: [],
rowsTable: [], rowsTable: [],
fullscreen: false, fullscreen: false,
treeData: [],
detail: null, detail: null,
temTitle: "物料管理", temTitle: "物料管理",
sets: v => { sets: v => {
...@@ -76,13 +77,27 @@ export default { ...@@ -76,13 +77,27 @@ export default {
}, },
{ {
key: "rootCategoryId", key: "rootCategoryId",
title: "大类编号", title: "大类",
align: "right", align: "right",
materialKey: '1',
render: (h, params) => {
return h(
"span", {},
this.getType1(params.row.rootCategoryId)
);
}
}, },
{ {
key: "categoryId", key: "categoryId",
title: "子类编号", title: "子类",
align: "right", align: "right",
materialKey: '2',
render: (h, params) => {
return h(
"span", {},
this.getType2(params.row.categoryId)
);
}
}, },
{ {
key: "code", key: "code",
...@@ -214,6 +229,7 @@ export default { ...@@ -214,6 +229,7 @@ export default {
}); });
}, },
mounted() { mounted() {
this.getTreeData()
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -401,6 +417,8 @@ export default { ...@@ -401,6 +417,8 @@ export default {
categoryId: this.nodeInfo.categoryId, //左侧树点击的id categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {}, customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
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]
...@@ -417,6 +435,36 @@ export default { ...@@ -417,6 +435,36 @@ export default {
}, },
//批量导入end //批量导入end
//物料大类和子类的解析start
getTreeData() {
let data = {
conditions: []
};
Api.list(data).then((r) => {
this.treeData = r.result
});
},
getType1(val) {
let tempTreeList = this.$u.clone(this.treeData)
let rootName = ""
tempTreeList.forEach(ele => {
if (ele.upId == 0 && ele.id == val) {
rootName = ele.name
}
})
return rootName
},
getType2(val) {
let tempTreeList = this.$u.clone(this.treeData)
let childrenName = ""
tempTreeList.forEach(ele => {
if (ele.upId > 0 && ele.id == val) {
childrenName = ele.name
}
})
return childrenName
},
//物料大类和子类的解析end
}, },
watch: { watch: {
nodeInfo: { nodeInfo: {
......
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