Commit ca559b17 authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 8aee2646 abc532dd
...@@ -100,6 +100,8 @@ export default { ...@@ -100,6 +100,8 @@ export default {
userConfig: null, //用户页面配置信息。, userConfig: null, //用户页面配置信息。,
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId, userId: this.$store.state.userInfo.userId,
treeData: [], //物料数据
codeRuleData: [], //物料编码
}; };
}, },
props: { props: {
...@@ -271,6 +273,9 @@ export default { ...@@ -271,6 +273,9 @@ export default {
this.$dragging.$on("dragend", (e) => { this.$dragging.$on("dragend", (e) => {
this.saveUserconfig(); this.saveUserconfig();
}); });
//物料加载类型数据
this.getTreeData();
this.getcodeRuleData();
}, },
methods: { methods: {
//数据加载 //数据加载
...@@ -513,6 +518,7 @@ export default { ...@@ -513,6 +518,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 +528,12 @@ export default { ...@@ -522,6 +528,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 +546,19 @@ export default { ...@@ -534,7 +546,19 @@ 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])
} else if (elcol1.code == 3) {
e[elcol1.key] = this.getType3(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 +569,57 @@ export default { ...@@ -545,6 +569,57 @@ 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
},
//获取编码名称
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: { computed: {
columnsNow() { columnsNow() {
......
...@@ -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>
...@@ -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", {
...@@ -442,6 +441,83 @@ export default { ...@@ -442,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: [], //临时存储原始数据
...@@ -461,6 +537,9 @@ export default { ...@@ -461,6 +537,9 @@ export default {
titleInfo: '', titleInfo: '',
noDataText: '暂无数据', noDataText: '暂无数据',
imBtn: true, imBtn: true,
//物料管理
treeData: [], //物料管理左侧类别树
codeRuleData: [], //物料编码等信息
}; };
}, },
props: { props: {
...@@ -479,6 +558,9 @@ export default { ...@@ -479,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 (() => {
...@@ -568,6 +650,7 @@ export default { ...@@ -568,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({
...@@ -575,6 +658,12 @@ export default { ...@@ -575,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) => {
...@@ -620,6 +709,7 @@ export default { ...@@ -620,6 +709,7 @@ export default {
); );
} }
}); });
}) })
this.dataIm = useData; this.dataIm = useData;
}, },
...@@ -763,6 +853,9 @@ export default { ...@@ -763,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);
} }
...@@ -789,6 +882,9 @@ export default { ...@@ -789,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);
} }
...@@ -882,6 +978,112 @@ export default { ...@@ -882,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) {
......
<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">
<h3> <h3>
<Dropdown @on-click="clickItem"> <Dropdown @on-click="clickItem">
<a href="javascript:void(0)"> <a href="javascript:void(0)">
{{downName}} {{downName}}
<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" </DropdownMenu>
:key="item.id" </Dropdown>
:name="item.id" <div class="fr mr10 mt10">
>{{ item.name }}</DropdownItem> <ButtonGroup class="fr ddi" size="small">
</DropdownMenu> <Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
</Dropdown> <Button icon="md-refresh" title="刷新" @click="loadTree(model8,nodeInfo.codeRuleType)"></Button>
<div class="fr mr10 mt10"> <Button icon="md-rewind" title="收起" @click="hide"></Button>
<ButtonGroup class="fr ddi" size="small"> </ButtonGroup>
<Button </div>
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" </h3>
@click="toggle" <div class="search">
title="展开/合并" <Input search placeholder="关键字" v-model="keys" clearable />
></Button> </div>
<Button <div class="fg">
icon="md-refresh" <div class="tree">
title="刷新" <Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
@click="loadTree(model8,nodeInfo.codeRuleType)" </div>
></Button> </div>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
</div> </div>
</h3> </Sider>
<div class="search"> <div v-if="!showMenu" class="show_menu">
<Input search placeholder="关键字" v-model="keys" clearable /> <a class="menu_play fr" @click="showMenuFn" title="展开">
</div> <Icon type="ios-arrow-forward" size="24" />
<div class="fg"> </a>
<div class="tree">
<Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
</div>
</div>
</div> </div>
</Sider> <Content :class="!showMenu?'con_bord':''">
<div v-if="!showMenu" class="show_menu"> <MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" />
<a class="menu_play fr" @click="showMenuFn" title="展开"> </Content>
<Icon type="ios-arrow-forward" size="24" />
</a>
</div>
<Content :class="!showMenu?'con_bord':''">
<MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" />
</Content>
</Layout> </Layout>
</div> </div>
</template> </template>
<script> <script>
...@@ -60,320 +48,325 @@ import MasterData from "./masterData.vue"; ...@@ -60,320 +48,325 @@ import MasterData from "./masterData.vue";
import Api from "./api"; import Api from "./api";
export default { export default {
components: { components: {
MasterData, MasterData,
},
name: "masterData",
data() {
return {
model8: "",
type: "",
keys: "",
cityList: [],
expand: false,
list: [],
nodeInfo: {
categoryId: 0,
rootCategoryId: 0,
rootCategoryName: "",
ids: [],
addChange: true,
codeRuleId: 0,
codeRuleType: "",
},
downName: "请选择类型",
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: [],
rootCategoryId: null,
categoryId: null,
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
// this.loadTree();
this.listSlecet();
},
methods: {
clickItem(val) {
console.log(val);
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
}
});
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
},
listSlecet() {
let data = {
conditions: [],
sortBy: "id",
isDesc: false,
};
Api.pagedSlecet(data).then((r) => {
this.cityList = r.result.items;
this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id;
this.nodeInfo.codeRuleType = this.cityList[0].type;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
});
}, },
name: "masterData",
data() {
return {
model8: "",
type: "",
keys: "",
cityList: [],
expand: false,
list: [],
nodeInfo: {
categoryId: 0,
rootCategoryId: 0,
rootCategoryName: "",
ids: [],
addChange: true,
codeRuleId: 0,
codeRuleType: "",
},
downName: "请选择类型",
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: [],
showMenuFn() { rootCategoryId: null,
//this.$Message.info("展开左侧树") categoryId: null,
this.showMenu = true; };
}, },
ok(row) { async fetch({
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType); store,
// this.modal = false; params
// this.curId = 0; }) {
// if (row) { await store.dispatch("loadDictionary"); // 加载数据字典
// this.dataList.map((e, index) => {
// if (e.id == row.id) {
// this.$set(this.$refs.dataTable.dataColumns, index, row);
// }
// });
// }
}, },
cancel() { created() {
this.curId = 0; // this.loadTree();
this.modal = false; this.listSlecet();
}, },
renderContent(h, { root, node, data }) { methods: {
return h( clickItem(val) {
"span", console.log(val);
{ this.nodeInfo.codeRuleId = val;
on: { this.model8 = val;
click: () => { this.cityList.forEach((e) => {
this.handleSelect(root, data); //手动选择树节点 if (val == e.id) {
}, this.downName = e.name;
}, this.nodeInfo.codeRuleType = e.type;
}
});
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
},
listSlecet() {
let data = {
conditions: [],
sortBy: "id",
isDesc: false,
};
Api.pagedSlecet(data).then((r) => {
this.cityList = r.result.items;
this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id;
this.nodeInfo.codeRuleType = this.cityList[0].type;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
});
}, },
data.title +
"(" +
(data.totalMaterialCount == undefined
? "0"
: data.totalMaterialCount) +
")"
);
},
handleSelect(root, data) {
let pid = -1; //定义最顶级id
var pname = "";
var upId = data.upId;
let roots = root;
function addId(roots, upId) { showMenuFn() {
roots.map((u) => { //this.$Message.info("展开左侧树")
if (u.node.id == upId) { this.showMenu = true;
if (u.node.upId == 0) { },
pid = u.node.id; ok(row) {
pname = u.node.name; this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
} else { // this.modal = false;
upId = u.node.upId; // this.curId = 0;
addId(roots, upId); // if (row) {
// this.dataList.map((e, index) => {
// if (e.id == row.id) {
// this.$set(this.$refs.dataTable.dataColumns, index, row);
// }
// });
// }
},
cancel() {
this.curId = 0;
this.modal = false;
},
renderContent(h, {
root,
node,
data
}) {
return h(
"span", {
on: {
click: () => {
this.handleSelect(root, data); //手动选择树节点
},
},
},
data.title +
"(" +
(data.totalMaterialCount == undefined ?
"0" :
data.totalMaterialCount) +
")"
);
},
handleSelect(root, data) {
let pid = -1; //定义最顶级id
var pname = "";
var upId = data.upId;
let roots = root;
function addId(roots, upId) {
roots.map((u) => {
if (u.node.id == upId) {
if (u.node.upId == 0) {
pid = u.node.id;
pname = u.node.name;
} else {
upId = u.node.upId;
addId(roots, upId);
}
}
});
} }
}
});
}
addId(roots, upId); addId(roots, upId);
this.nodeInfo.categoryId = data.id; this.nodeInfo.categoryId = data.id;
this.nodeInfo.rootCategoryName = data.name; this.nodeInfo.rootCategoryName = data.name;
if (pid == -1) { if (pid == -1) {
this.nodeInfo.rootCategoryId = data.id; this.nodeInfo.rootCategoryId = data.id;
this.nodeInfo.rootCategoryName = data.name; this.nodeInfo.rootCategoryName = data.name;
} else { } else {
this.nodeInfo.rootCategoryId = pid; this.nodeInfo.rootCategoryId = pid;
this.nodeInfo.rootCategoryName = pname; this.nodeInfo.rootCategoryName = pname;
} }
}, },
loadTree(id, codeRuleType) { loadTree(id, codeRuleType) {
let data = { let data = {
conditions: [ conditions: [{
{ fieldName: "codeRuleId",
fieldName: "codeRuleId", fieldValue: id,
fieldValue: id, conditionalType: "Equal",
conditionalType: "Equal", },
}, {
{ fieldName: "codeRuleType",
fieldName: "codeRuleType", fieldValue: codeRuleType,
fieldValue: codeRuleType, conditionalType: "Equal",
conditionalType: "Equal", },
}, ],
], sortBy: "code",
sortBy: "code", isDesc: false,
isDesc: false, };
}; Api.list(data).then((r) => {
Api.list(data).then((r) => { var data = this.$u.toTree(
var data = this.$u.toTree( r.result,
r.result, 0,
0, (u) => {
(u) => { u.title = u.code + u.name;
u.title = u.code + u.name; u.value = u.id;
u.value = u.id; u.expand = true;
u.expand = true; },
}, "upId"
"upId" );
); this.list = this.$u.clone(data);
this.list = this.$u.clone(data); });
}); },
}, toggle() {
toggle() { if (this.model8) {
if (this.model8) { this.expand = !this.expand;
this.expand = !this.expand; } else {
} else { this.$Message.error("请先选择类型");
this.$Message.error("请先选择类型"); }
} },
}, change(v, b) {
change(v, b) { if (b.level < b.ruleLevel && b.children.length > 0) {
if (b.level < b.ruleLevel && b.children.length > 0) { this.nodeInfo.addChange = false;
this.nodeInfo.addChange = false; } else {
} else { this.nodeInfo.addChange = true;
this.nodeInfo.addChange = true; }
} let ids = [];
let ids = []; ids.push(b.value);
ids.push(b.value); if (b.children) {
if (b.children) { addId(b.children);
addId(b.children);
function addId(data) { function addId(data) {
data.map((u) => { data.map((u) => {
ids.push(u.value); ids.push(u.value);
if (u.children) { if (u.children) {
addId(u.children); addId(u.children);
}
});
}
} }
}); this.nodeInfo.ids = ids;
} },
} hide() {
this.nodeInfo.ids = ids; this.showMenu = false;
}, },
hide() {
this.showMenu = false;
}, },
}, computed: {
computed: { data() {
data() { let items = this.$u.clone(this.list);
let items = this.$u.clone(this.list); let expand = this.expand;
let expand = this.expand; let result = [];
let result = []; search(this.keys, items);
search(this.keys, items);
function search(keys, data) { function search(keys, data) {
data.map((u) => { data.map((u) => {
if (keys.length < u.title) { if (keys.length < u.title) {
u.expand = expand; u.expand = expand;
result.push(u); result.push(u);
} else { } else {
u.expand = expand; u.expand = expand;
if (u.title.indexOf(keys) > -1) { if (u.title.indexOf(keys) > -1) {
result.push(u); result.push(u);
} else if (u.children) { } else if (u.children) {
search(keys, u.children); search(keys, u.children);
}
}
});
} }
} return result;
}); },
}
return result;
}, },
},
}; };
</script> </script>
<style lang="less"> <style lang="less">
.classification { .classification {
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
.ivu-layout-sider { .ivu-layout-sider {
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
margin-right: 10px; margin-right: 10px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15); box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
height: 88vh; height: 88vh;
h4 { h4 {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
background: #eee; background: #eee;
padding-left: 10px; padding-left: 10px;
} }
.p-list { .p-list {
h3 { h3 {
height: 50px; height: 50px;
font-size: 14px; font-size: 14px;
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
font-weight: bold; font-weight: bold;
line-height: 50px; line-height: 50px;
color: rgba(81, 90, 110, 1); color: rgba(81, 90, 110, 1);
background: rgba(245, 246, 250, 1); background: rgba(245, 246, 250, 1);
opacity: 1; opacity: 1;
padding-left: 10px; padding-left: 10px;
} }
.search { .search {
height: 50px; height: 50px;
padding: 5px 10px; padding: 5px 10px;
} }
.fg { .fg {
flex: none; flex: none;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding-left: 10px; padding-left: 10px;
} }
.tree { .tree {
height: calc(100vh - 215px); height: calc(100vh - 215px);
overflow: auto; overflow: auto;
} }
}
} }
}
.show_menu { .show_menu {
width: 30px; width: 30px;
height: 30px; height: 30px;
position: fixed; position: fixed;
top: 100px; top: 100px;
left: 0; left: 0;
z-index: 9; z-index: 9;
.menu_play { .menu_play {
width: 30px; width: 30px;
height: 30px; height: 30px;
line-height: 34px; line-height: 34px;
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
color: #515a6e; color: #515a6e;
border-top-right-radius: 5px; border-top-right-radius: 5px;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
background: #ffffff; background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px; box-shadow: #ccc 2px 2px 4px 1px;
} }
.menu_play:hover { .menu_play:hover {
background-color: #2d8cf0; background-color: #2d8cf0;
color: white; color: white;
}
} }
}
.ivu-layout-content { .ivu-layout-content {
// margin-left: 5px; // margin-left: 5px;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15); box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
overflow: auto; overflow: auto;
padding: 10px; padding: 10px;
height: 88vh; height: 88vh;
overflow-y: hidden; overflow-y: hidden;
} }
} }
</style> </style>
...@@ -47,6 +47,8 @@ export default { ...@@ -47,6 +47,8 @@ export default {
selectRows: [], selectRows: [],
rowsTable: [], rowsTable: [],
fullscreen: false, fullscreen: false,
treeData: [],
codeRuleData: [],
detail: null, detail: null,
temTitle: "物料管理", temTitle: "物料管理",
sets: v => { sets: v => {
...@@ -74,15 +76,40 @@ export default { ...@@ -74,15 +76,40 @@ 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: "大类",
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 +241,8 @@ export default { ...@@ -214,6 +241,8 @@ export default {
}); });
}, },
mounted() { mounted() {
this.getTreeData()
this.getcodeRuleData()
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -401,6 +430,7 @@ export default { ...@@ -401,6 +430,7 @@ 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
}; };
this.addCol.forEach(el => { this.addCol.forEach(el => {
obj[el.field] = ele[el.field] obj[el.field] = ele[el.field]
...@@ -417,6 +447,57 @@ export default { ...@@ -417,6 +447,57 @@ 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
},
//获取编码名称
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: { watch: {
nodeInfo: { nodeInfo: {
......
<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="请输入关键字物料名称" </FormItem>
v-model="easySearch.keys.value" <FormItem>
v-width="260" <Button type="primary" @click="search">查询</Button>
/> </FormItem>
</FormItem> </Form>
<FormItem> </template>
<Button type="primary" @click="search">查询</Button> <template slot="searchForm">
</FormItem> <Search :headid="hid" />
</Form> </template>
</template> <template slot="buttons">
<template slot="searchForm"> <Button type="primary" @click="add" v-show="headerStatus==0||headerStatus==4">新增</Button>
<Search :headid="hid"/> </template>
</template>
<template slot="buttons">
<Button type="primary" @click="add" v-show="headerStatus==0||headerStatus==4">新增</Button>
</template>
</DataGrid> </DataGrid>
<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";
export default { export default {
name: "list", name: "list",
components: { components: {
Search Search
}, },
head: { head: {
title: "工艺配套表", title: "工艺配套表",
author: "henq", author: "henq",
description: "routingsupporting 4/27/2020 10:35:33 AM" description: "routingsupporting 4/27/2020 10:35:33 AM"
}, },
props: ["headerid"], props: ["headerid"],
data() { data() {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { keys: {
op: op: "nameMaterial",
"nameMaterial", value: null
value: null },
}, routingHeaderId: {
routingHeaderId: { op: "Equal", value: -1 } op: "Equal",
}, value: -1
modal: false, }
title: "新增", },
detail: null, modal: false,
curId: 0, title: "新增",
hid: 0, detail: null,
columns: [ curId: 0,
{ hid: 0,
key: "routingDetailNo", columns: [{
title: this.l("routingDetailNo"), key: "routingDetailNo",
align: "left", title: this.l("routingDetailNo"),
high: true, align: "left",
width: 100, high: true,
sortable:true width: 100,
}, sortable: true
{ },
key: "routingDetailName",
title: this.l("routingDetailName"),
align: "left",
high: true
},
{
key: "quantity",
title: this.l("quantity"),
align: "right",
high: true,
width:80,
},
{
key: "materialType",
title: this.l("materialType"),
align: "center",
easy: true,
high: true,
code: "mes_xingchi_resource.material.materialReType",
width:100,
},
{
key: "materialNumber",
title: this.l("materialNumber"),
align: "left",
easy: true,
high: true
},
{
key: "nameMaterial",
title: this.l("nameMaterial"),
align: "left",
easy: true,
high: true,
},
{
key: "brand",
title: this.l("brand"),
align: "left",
easy: true,
high: true
},
{
key: "specifications",
title: this.l("specifications"),
align: "left",
easy: true,
high: true
},
{
key: "xhgg",
title: this.l("xhgg"),
align: "left",
easy: true,
high: true,
hide:true,
},
{
key: "texture",
title: this.l("texture"),
align: "left",
easy: true,
high: true
},
{
key: "procurementStandards",
title: this.l("procurementStandards"),
align: "left",
easy: true,
high: true
},
{
key: "qualityGrade",
title: this.l("qualityGrade"),
align: "left",
easy: true,
high: true
},
{
key: "drawNum",
title: this.l("drawNum"),
align: "left",
easy: true,
high: true
},
{
key: "creationTime",
title: this.l("creationTime"),
hide: true,
align: "left",
hide:true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: true,
align: "left",
hide:true,
type:'user',
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left",
hide:true,
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left",
hide:true,
type:'user',
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "detail" }, key: "routingDetailName",
on: { click: () => this.view(params.row.id) } title: this.l("routingDetailName"),
align: "left",
high: true
}, },
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "quantity",
on: { click: () => this.edit(params.row.id) } title: this.l("quantity"),
align: "right",
high: true,
width: 80,
}, },
this.headerStatus == 4||this.headerStatus == 0 ? "编辑" : ""
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "materialType",
on: { click: () => this.remove(params.row.id) } title: this.l("materialType"),
align: "center",
easy: true,
high: true,
code: "mes_xingchi_resource.material.materialReType",
width: 100,
}, },
this.headerStatus == 4||this.headerStatus == 0 ? "删除" : "" {
) key: "materialNumber",
]); title: this.l("materialNumber"),
} align: "left",
} easy: true,
], high: true
headerStatus:-1, },
productBomId:-1, {
}; key: "nameMaterial",
}, title: this.l("nameMaterial"),
created() { align: "left",
if (this.headerid != -1) { easy: true,
this.easySearch.routingHeaderId.value = this.headerid; high: true,
} else { },
this.easySearch.routingHeaderId.value = this.$route.query.id; {
} key: "brand",
this.hid=Number(this.easySearch.routingHeaderId.value) title: this.l("brand"),
this.headerStatus=this.$route.query.headerStatus align: "left",
this.productBomId=Number(this.$route.query.productBomId) easy: true,
}, high: true
mounted() { },
console.log(this); {
this.search(); key: "specifications",
}, title: this.l("specifications"),
async fetch({ store, params }) { align: "left",
await store.dispatch("loadDictionary"); // 加载数据字典 easy: true,
}, high: true
methods: { },
ok() { {
this.$refs.grid.load(); key: "xhgg",
this.modal = false; title: this.l("xhgg"),
this.curId = 0; align: "left",
}, easy: true,
search() { high: true,
this.$refs.grid.reload(this.easySearch); hide: true,
}, },
add() { {
this.curId = 0; key: "texture",
this.hid = Number(this.headerid); title: this.l("texture"),
this.title = "新增"; align: "left",
this.detail = () => import("./add"); easy: true,
this.modal = true; high: true
},
{
key: "procurementStandards",
title: this.l("procurementStandards"),
align: "left",
easy: true,
high: true
},
{
key: "qualityGrade",
title: this.l("qualityGrade"),
align: "left",
easy: true,
high: true
},
{
key: "drawNum",
title: this.l("drawNum"),
align: "left",
easy: true,
high: true
},
{
key: "creationTime",
title: this.l("creationTime"),
hide: true,
align: "left",
hide: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: true,
align: "left",
hide: true,
type: 'user',
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left",
hide: true,
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left",
hide: true,
type: 'user',
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"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)
}
},
this.headerStatus == 4 || this.headerStatus == 0 ? "编辑" : ""
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
this.headerStatus == 4 || this.headerStatus == 0 ? "删除" : ""
)
]);
}
}
],
headerStatus: -1,
productBomId: -1,
};
}, },
copy(id) { created() {
this.curId = id; if (this.headerid != -1) {
this.title = "克隆"; this.easySearch.routingHeaderId.value = this.headerid;
this.detail = () => import("./add"); } else {
this.modal = true; 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)
}, },
view(id) { mounted() {
this.curId = id; console.log(this);
this.title = "详情"; this.search();
this.detail = () => import("./detail");
this.modal = true;
}, },
edit(id) { async fetch({
this.curId = id; store,
this.hid = Number(this.headerid); params
this.title = "编辑"; }) {
this.detail = () => import("./edit"); await store.dispatch("loadDictionary"); // 加载数据字典
this.modal = true;
}, },
remove(id) { methods: {
Api.delete(id).then(r => { ok() {
if (r.success) { this.$refs.grid.load();
this.$refs.grid.load(); this.modal = false;
this.$Message.success("删除成功"); this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.hid = Number(this.headerid);
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.hid = Number(this.headerid);
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
let vkey = "routingsupporting" + "." + key;
return this.$t(vkey) || key;
} }
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
let vkey = "routingsupporting" + "." + key;
return this.$t(vkey) || key;
} }
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
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