Commit f5c6af41 authored by renjintao's avatar renjintao

物料管理

parent 8018f5c3
<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" size="small">
</DropdownMenu> <Button icon="md-add" title="新增顶级" @click="addNew"></Button>
</Dropdown> <Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
<div class="fr mr10 mt10"> <Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button>
<ButtonGroup class="fr" size="small"> <Button icon="md-rewind" title="收起" @click="hide"></Button>
<Button icon="md-add" title="新增顶级" @click="addNew"></Button> </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 icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button> <div class="fg">
<Button icon="md-rewind" title="收起" @click="hide"></Button> <div class="tree">
</ButtonGroup> <Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
<Dropdown transfer ref="contentMenu" style="display: none;" trigger="click" placement="right-start">
<DropdownMenu slot="list" ref="ppp" style="min-width: 80px;">
<DropdownItem @click.native="add">
<a>添加</a>
</DropdownItem>
<DropdownItem name="edit" @click.native="edit">
<a>修改</a>
</DropdownItem>
<DropdownItem name="del" @click.native="remove">
<a>删除</a>
</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
</div>
</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>
<Dropdown
transfer
ref="contentMenu"
style="display: none;"
trigger="click"
placement="right-start"
>
<DropdownMenu slot="list" ref="ppp" style="min-width: 80px;">
<DropdownItem @click.native="add">
<a>添加</a>
</DropdownItem>
<DropdownItem name="edit" @click.native="edit">
<a>修改</a>
</DropdownItem>
<DropdownItem name="del" @click.native="remove">
<a>删除</a>
</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
</div>
</div> </div>
</Sider> <Content :class="!showMenu?'con_bord':''">
<div v-if="!showMenu" class="show_menu"> <MasterData ref="dataTable" @on-edit="editRow" :root="root" @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" @on-edit="editRow" :root="root" @on-ok="ok" />
</Content>
</Layout> </Layout>
<Modal v-model="modal" :title="title" width="1500" footer-hide :mask-closable="false"> <Modal v-model="modal" :title="title" width="1500" footer-hide :mask-closable="false">
<component <component :is="detail" :eid="curId" :nodeInfo="nodeInfo" @on-close="cancel" @on-ok="ok" ref="chlidren" />
:is="detail"
:eid="curId"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-ok="ok"
ref="chlidren"
/>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import MasterData from "./masterData.vue"; import MasterData from "./masterData.vue";
import Api from "./api"; import Api from "./api";
export default { export default {
components: { components: {
MasterData MasterData
},
name: "classification",
data() {
return {
model8: "",
root: {
id: 0,
ids: []
},
downName: "请选择类型",
cityList: [],
keys: "",
expand: false,
list: [],
nodeInfo: {
codeRuleId: ""
},
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: []
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
// this.loadTree();
this.listSlecet();
},
methods: {
clickItem(val) {
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId);
this.cityList.forEach(e => {
if (val == e.id) {
this.downName = e.name;
}
});
this.model8 = val;
},
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.loadTree(this.nodeInfo.codeRuleId);
});
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
ok(row) {
this.loadTree(this.nodeInfo.codeRuleId);
this.modal = false;
this.curId = 0;
// if (row) {
// this.dataList.map((e, index) => {
// if (e.id == row.id) {
// this.$set(this.$refs.dataTable.dataColumns, index, row);
// }
// });
// }
},
addNew() {
if (this.model8) {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
this.$refs.chlidren.arr = [];
} else {
this.$Message.error("请先选择类型");
}
}, },
add() { name: "classification",
this.curId = 0; data() {
this.title = "新增"; return {
this.detail = () => import("./sonAdd"); model8: "",
this.modal = true; root: {
id: 0,
ids: []
},
downName: "请选择类型",
cityList: [],
keys: "",
expand: false,
list: [],
nodeInfo: {
codeRuleId: ""
},
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: []
};
}, },
editRow(row) { async fetch({
this.nodeInfo = row; store,
this.edit(); params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
}, },
edit() { created() {
if (this.nodeInfo.upId == 0) { // this.loadTree();
this.detail = () => import("./edit"); this.listSlecet();
this.$refs.chlidren.arr = [];
} else {
this.detail = () => import("./sonEdit");
}
this.curId = this.nodeInfo.id;
this.title = "编辑";
this.modal = true;
}, },
remove() { methods: {
// console.log(this.nodeInfo); clickItem(val) {
if (this.nodeInfo.children.length > 1) { this.nodeInfo.codeRuleId = val;
this.$Message.error("因为有子级,不能直接删除"); this.model8 = val;
} else { this.loadTree(this.nodeInfo.codeRuleId);
this.$Modal.confirm({ this.cityList.forEach(e => {
title: "删除", if (val == e.id) {
content: "<p>您确定要删除吗?</p>", this.downName = e.name;
onOk: () => { }
Api.delete(this.nodeInfo.id).then(r => { });
if (r.success) { this.model8 = val;
},
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.loadTree(this.nodeInfo.codeRuleId); this.loadTree(this.nodeInfo.codeRuleId);
this.$Message.success("删除成功");
}
}); });
}, },
onCancel: () => {
this.$Message.success("取消删除"); showMenuFn() {
} //this.$Message.info("展开左侧树")
}); this.showMenu = true;
} },
}, ok(row) {
cancel() { this.loadTree(this.nodeInfo.codeRuleId);
this.curId = 0; this.modal = false;
this.modal = false; this.curId = 0;
}, // if (row) {
renderContent(h, { root, node, data }) { // this.dataList.map((e, index) => {
return h( // if (e.id == row.id) {
"span", // this.$set(this.$refs.dataTable.dataColumns, index, row);
{ // }
on: { // });
click: () => { // }
this.handleSelect(data); //手动选择树节点 },
}, addNew() {
//右键点击事件 if (this.model8) {
contextmenu: e => { this.curId = 0;
e.preventDefault(); this.title = "新增";
this.$refs.contentMenu.$refs.reference = event.target; this.detail = () => import("./add");
this.$refs.contentMenu.currentVisible = !this.$refs.contentMenu this.modal = true;
.currentVisible; this.$refs.chlidren.arr = [];
this.nodeInfo = data; } else {
this.$Message.error("请先选择类型");
} }
}
}, },
data.title + add() {
"(" + this.curId = 0;
(data.totalMaterialCount == undefined this.title = "新增";
? "0" this.detail = () => import("./sonAdd");
: data.totalMaterialCount) + this.modal = true;
")" },
); editRow(row) {
}, this.nodeInfo = row;
handleSelect(data) { this.edit();
// let tableData = []; },
// let obj = {}; edit() {
// let children = 0; if (this.nodeInfo.upId == 0) {
// if (data.upId == 0 && data.children.length > 0) { this.detail = () => import("./edit");
// data.children.forEach(e => { this.$refs.chlidren.arr = [];
// if (e.children.length > 0) { } else {
// children = 1; this.detail = () => import("./sonEdit");
// } else { }
// children = 0; this.curId = this.nodeInfo.id;
// } this.title = "编辑";
// obj = { this.modal = true;
// id: e.id, },
// name: e.name, remove() {
// code: e.code, // console.log(this.nodeInfo);
// status: e.status, if (this.nodeInfo.children.length > 1) {
// children: children, this.$Message.error("因为有子级,不能直接删除");
// upId: e.upId, } else {
// description: e.description this.$Modal.confirm({
// }; title: "删除",
// tableData.push(obj); content: "<p>您确定要删除吗?</p>",
// }); onOk: () => {
// this.dataList = tableData; Api.delete(this.nodeInfo.id).then(r => {
// this.$refs.dataTable.dataColumns = tableData; if (r.success) {
// } this.loadTree(this.nodeInfo.codeRuleId);
}, this.$Message.success("删除成功");
loadTree(id) { }
let data = { });
conditions: [ },
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" } onCancel: () => {
], this.$Message.success("取消删除");
sortBy: "code", }
isDesc: false });
}; }
Api.list(data).then(r => { },
var data = this.$u.toTree( cancel() {
r.result, this.curId = 0;
0, this.modal = false;
u => { },
u.title = u.code + u.name; renderContent(h, {
u.value = u.id; root,
u.expand = true; node,
}, data
"upId" }) {
); return h(
this.list = this.$u.clone(data); "span", {
}); on: {
}, click: () => {
toggle() { this.handleSelect(data); //手动选择树节点
if (this.model8) { },
this.expand = !this.expand; //右键点击事件
} else { contextmenu: e => {
this.$Message.error("请先选择类型"); e.preventDefault();
} this.$refs.contentMenu.$refs.reference = event.target;
}, this.$refs.contentMenu.currentVisible = !this.$refs.contentMenu
change(v, b) { .currentVisible;
// console.log(v); this.nodeInfo = data;
// alert(JSON.stringify(b)); }
let ids = []; }
ids.push(b.id); },
if (b.children) { data.title +
addId(b.children); "(" +
function addId(data) { (data.totalMaterialCount == undefined ?
data.map(u => { "0" :
ids.push(u.id); data.totalMaterialCount) +
if (u.children) { ")"
addId(u.children); );
},
handleSelect(data) {
// let tableData = [];
// let obj = {};
// let children = 0;
// if (data.upId == 0 && data.children.length > 0) {
// data.children.forEach(e => {
// if (e.children.length > 0) {
// children = 1;
// } else {
// children = 0;
// }
// obj = {
// id: e.id,
// name: e.name,
// code: e.code,
// status: e.status,
// children: children,
// upId: e.upId,
// description: e.description
// };
// tableData.push(obj);
// });
// this.dataList = tableData;
// this.$refs.dataTable.dataColumns = tableData;
// }
},
loadTree(id) {
let data = {
conditions: [{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal"
}],
sortBy: "code",
isDesc: false
};
Api.list(data).then(r => {
var data = this.$u.toTree(
r.result,
0,
u => {
u.title = u.code + u.name;
u.value = u.id;
u.expand = true;
},
"upId"
);
this.list = this.$u.clone(data);
});
},
toggle() {
if (this.model8) {
this.expand = !this.expand;
} else {
this.$Message.error("请先选择类型");
}
},
change(v, b) {
// console.log(v);
// alert(JSON.stringify(b));
let ids = [];
ids.push(b.id);
if (b.children) {
addId(b.children);
function addId(data) {
data.map(u => {
ids.push(u.id);
if (u.children) {
addId(u.children);
}
});
}
} }
}); this.root.ids = ids;
this.root.id = b.id;
// this.root.codeRuleId=b.codeRuleId
},
hide() {
this.showMenu = false;
} }
}
this.root.ids = ids;
this.root.id = b.id;
// this.root.codeRuleId=b.codeRuleId
}, },
hide() { computed: {
this.showMenu = false; data() {
} let items = this.$u.clone(this.list);
}, let expand = this.expand;
computed: { let result = [];
data() { search(this.keys, items);
let items = this.$u.clone(this.list);
let expand = this.expand; function search(keys, data) {
let result = []; data.map(u => {
search(this.keys, items); if (keys.length < u.title) {
function search(keys, data) { u.expand = expand;
data.map(u => { result.push(u);
if (keys.length < u.title) { } else {
u.expand = expand; u.expand = expand;
result.push(u); if (u.title.indexOf(keys) > -1) {
} else { result.push(u);
u.expand = expand; } else if (u.children) {
if (u.title.indexOf(keys) > -1) { search(keys, u.children);
result.push(u); }
} else if (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: 87vh; height: 87vh;
h4 { h4 {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
background: #eee; background: #eee;
padding-left: 10px; padding-left: 10px;
} }
.p-list {
h3 { .p-list {
height: 50px; h3 {
font-size: 14px; height: 50px;
font-family: Microsoft YaHei; font-size: 14px;
font-weight: bold; font-family: Microsoft YaHei;
line-height: 50px; font-weight: bold;
color: rgba(81, 90, 110, 1); line-height: 50px;
background: rgba(245, 246, 250, 1); color: rgba(81, 90, 110, 1);
opacity: 1; background: rgba(245, 246, 250, 1);
padding-left: 10px; opacity: 1;
} padding-left: 10px;
.search { }
height: 50px;
padding: 5px 10px; .search {
} height: 50px;
.fg { padding: 5px 10px;
flex: none; }
height: 100%;
overflow: auto; .fg {
padding-left: 10px; flex: none;
} height: 100%;
.tree { overflow: auto;
height: calc(100vh - 215px); padding-left: 10px;
overflow: auto; }
}
.tree {
height: calc(100vh - 215px);
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 {
width: 30px; .menu_play {
height: 30px; width: 30px;
line-height: 34px; height: 30px;
font-size: 14px; line-height: 34px;
text-align: center; font-size: 14px;
color: #515a6e; text-align: center;
border-top-right-radius: 5px; color: #515a6e;
border-bottom-right-radius: 5px; border-top-right-radius: 5px;
background: #ffffff; border-bottom-right-radius: 5px;
box-shadow: #ccc 2px 2px 4px 1px; background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px;
}
.menu_play:hover {
background-color: #2d8cf0;
color: white;
}
} }
.menu_play:hover {
background-color: #2d8cf0; .ivu-layout-content {
color: white; // margin-left: 5px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
overflow: auto;
padding: 10px;
height: 87vh;
overflow-y: hidden;
} }
}
.ivu-layout-content {
// margin-left: 5px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
overflow: auto;
padding: 10px;
height: 87vh;
overflow-y: hidden;
}
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="master-data"> <div class="master-data">
<!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> --> <!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> -->
<DataGrid <DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" :high="false" :height="tableHeight">
:columns="columns" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:conditions="easySearch" <FormItem prop="keys">
:action="action" <Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
:high="false" </FormItem>
:height="tableHeight" <FormItem>
> <Button type="primary" @click="search">查询</Button>
<template slot="easySearch"> </FormItem>
<Form ref="formInline" :model="easySearch" inline> </Form>
<FormItem prop="keys"> </template>
<Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
</DataGrid> </DataGrid>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "masterData", name: "masterData",
props: ["root"], props: ["root"],
data() { data() {
return { return {
action: Api.index, action: Api.index,
tableHeight: "", tableHeight: "",
dataColumns: [], dataColumns: [],
easySearch: { easySearch: {
keys: { op: "code,name", value: null }, keys: {
id: { op: "In", value: "" } op: "code,name",
}, value: null
columns: [ },
// { id: {
// key: "index", op: "In",
// title: "#", value: ""
// align: "left", }
// width: 60 },
// }, columns: [
{ // {
key: "code", // key: "index",
title: "编码", // title: "#",
align: "left" // align: "left",
}, // width: 60
{ // },
key: "name",
title: "名称",
align: "left"
},
{
key: "status",
title: "状态",
align: "left",
code: "materail.category.status"
},
{
key: "description",
title: "描述",
align: "left"
},
{
title: "操作",
key: "action",
width: 260,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "code",
on: { click: () => this.edit(params.row) } title: "编码",
align: "left"
}, },
"编辑"
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "name",
on: { click: () => this.remove(params.row.id) } title: "名称",
align: "left"
}, },
"删除" {
) key: "status",
]); title: "状态",
} align: "left",
} code: "materail.category.status"
] },
};
}, {
async fetch({ store, params }) { key: "description",
await store.dispatch("loadDictionary"); // 加载数据字典 title: "描述",
}, align: "left"
created() { },
this.tableHeight = window.innerHeight - 220; {
}, title: "操作",
mounted() { key: "action",
window.onresize = () => { width: 260,
///浏览器窗口大小变化 align: "left",
return (() => { render: (h, params) => {
window.screenHeight = window.innerHeight; return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
"删除"
)
]);
}
}
]
};
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 220; this.tableHeight = window.innerHeight - 220;
})();
};
},
methods: {
search() {
// alert(JSON.stringify(this.easySearch));
console.log(this.easySearch);
this.$refs.grid.reload(this.easySearch);
}, },
edit(row) { mounted() {
this.$emit("on-edit", row); window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tableHeight = window.innerHeight - 220;
})();
};
}, },
remove(id) { methods: {
Api.delete(id).then(r => { search() {
if (r.success) { // alert(JSON.stringify(this.easySearch));
this.$refs.grid.reload(this.easySearch); console.log(this.easySearch);
this.$Message.success("删除成功"); this.$refs.grid.reload(this.easySearch);
},
edit(row) {
this.$emit("on-edit", row);
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功");
}
});
} }
}); },
} watch: {
}, root: {
watch: { handler(newName, oldName) {
root: { if (newName.id) {
handler(newName, oldName) { this.easySearch.id.value = newName.ids;
if (newName.id) { this.$refs.grid.reload(this.easySearch);
this.easySearch.id.value = newName.ids; } else {
this.$refs.grid.reload(this.easySearch); this.easySearch.id.value = "-1";
} else { }
this.easySearch.id.value = "-1"; },
immediate: true,
deep: true
} }
},
immediate: true,
deep: true
} }
}
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.spare-parts { .spare-parts {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
\ No newline at end of file
<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)"></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 icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button> <div class="fg">
<Button icon="md-rewind" title="收起" @click="hide"></Button> <div class="tree">
</ButtonGroup> <Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
</div>
</div>
</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>
import MasterData from "./masterData.vue"; 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,
ids: [],
addChange: true,
codeRuleId: 0,
},
downName: "请选择类型",
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: [],
codeRuleId: "",
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
// this.loadTree();
this.listSlecet();
},
methods: {
clickItem(val) {
this.codeRuleId = val;
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.loadTree(this.codeRuleId);
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
}
});
},
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.loadTree(this.nodeInfo.codeRuleId);
});
}, },
name: "masterData",
showMenuFn() { data() {
//this.$Message.info("展开左侧树") return {
this.showMenu = true; model8: "",
type: "",
keys: "",
cityList: [],
expand: false,
list: [],
nodeInfo: {
categoryId: 0,
rootCategoryId: 0,
rootCategoryName: "",
ids: [],
addChange: true,
codeRuleId: 0,
},
downName: "请选择类型",
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: [],
codeRuleId: "",
rootCategoryId: null,
categoryId: null,
};
}, },
ok(row) { async fetch({
this.loadTree(this.codeRuleId); 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", this.codeRuleId = val;
{ this.nodeInfo.codeRuleId = val;
on: { this.model8 = val;
click: () => { this.loadTree(this.codeRuleId);
this.handleSelect(root, data); //手动选择树节点 this.cityList.forEach((e) => {
}, if (val == e.id) {
}, this.downName = e.name;
}
});
}, },
data.title + listSlecet() {
"(" + let data = {
(data.totalMaterialCount == undefined conditions: [],
? "0" sortBy: "id",
: data.totalMaterialCount) + isDesc: false,
")" };
); Api.pagedSlecet(data).then((r) => {
}, this.cityList = r.result.items;
handleSelect(root, data) { this.downName = this.cityList[0].name;
let pid = null; //定义最顶级id this.model8 = this.cityList[0].id;
let upId = data.upId; this.nodeInfo.codeRuleId = this.cityList[0].id;
let roots = root; this.loadTree(this.nodeInfo.codeRuleId);
function addId(roots, upId) { });
roots.map((u) => { },
if (u.node.id == upId) {
if (u.node.upId == 0) { showMenuFn() {
pid = u.node.id; //this.$Message.info("展开左侧树")
this.showMenu = true;
},
ok(row) {
this.loadTree(this.codeRuleId);
// this.modal = false;
// this.curId = 0;
// 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);
this.nodeInfo.categoryId = data.id;
this.nodeInfo.rootCategoryName = data.name;
if (pid == -1) {
this.nodeInfo.rootCategoryId = data.id;
this.nodeInfo.rootCategoryName = data.name;
} else { } else {
upId = u.node.upId; this.nodeInfo.rootCategoryId = pid;
addId(roots, upId); this.nodeInfo.rootCategoryName = pname
} }
} },
}); loadTree(id) {
} let data = {
addId(roots, upId); conditions: [{
this.nodeInfo.categoryId = data.id; fieldName: "codeRuleId",
if (pid == null) { fieldValue: id,
this.nodeInfo.rootCategoryId = data.id; conditionalType: "Equal"
} else { }, ],
this.nodeInfo.rootCategoryId = pid; sortBy: "code",
} isDesc: false,
}, };
loadTree(id) { Api.list(data).then((r) => {
let data = { var data = this.$u.toTree(
conditions: [ r.result,
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" }, 0,
], (u) => {
sortBy: "code", u.title = u.code + u.name;
isDesc: false, u.value = u.id;
}; u.expand = true;
Api.list(data).then((r) => { },
var data = this.$u.toTree( "upId"
r.result, );
0, this.list = this.$u.clone(data);
(u) => { });
u.title = u.code + u.name; },
u.value = u.id; toggle() {
u.expand = true; if (this.model8) {
}, this.expand = !this.expand;
"upId" } else {
); this.$Message.error("请先选择类型");
this.list = this.$u.clone(data);
});
},
toggle() {
if (this.model8) {
this.expand = !this.expand;
} else {
this.$Message.error("请先选择类型");
}
},
change(v, b) {
if (b.level < b.ruleLevel && b.children.length > 0) {
this.nodeInfo.addChange = false;
} else {
this.nodeInfo.addChange = true;
}
let ids = [];
ids.push(b.value);
if (b.children) {
addId(b.children);
function addId(data) {
data.map((u) => {
ids.push(u.value);
if (u.children) {
addId(u.children);
} }
}); },
} change(v, b) {
} if (b.level < b.ruleLevel && b.children.length > 0) {
this.nodeInfo.ids = ids; this.nodeInfo.addChange = false;
}, } else {
hide() { this.nodeInfo.addChange = true;
this.showMenu = false; }
let ids = [];
ids.push(b.value);
if (b.children) {
addId(b.children);
function addId(data) {
data.map((u) => {
ids.push(u.value);
if (u.children) {
addId(u.children);
}
});
}
}
this.nodeInfo.ids = ids;
},
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 {
h3 { .p-list {
height: 50px; h3 {
font-size: 14px; height: 50px;
font-family: Microsoft YaHei; font-size: 14px;
font-weight: bold; font-family: Microsoft YaHei;
line-height: 50px; font-weight: bold;
color: rgba(81, 90, 110, 1); line-height: 50px;
background: rgba(245, 246, 250, 1); color: rgba(81, 90, 110, 1);
opacity: 1; background: rgba(245, 246, 250, 1);
padding-left: 10px; opacity: 1;
} padding-left: 10px;
.search { }
height: 50px;
padding: 5px 10px; .search {
} height: 50px;
.fg { padding: 5px 10px;
flex: none; }
height: 100%;
overflow: auto; .fg {
padding-left: 10px; flex: none;
} height: 100%;
.tree { overflow: auto;
height: calc(100vh - 215px); padding-left: 10px;
overflow: auto; }
}
.tree {
height: calc(100vh - 215px);
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 {
width: 30px; .menu_play {
height: 30px; width: 30px;
line-height: 34px; height: 30px;
font-size: 14px; line-height: 34px;
text-align: center; font-size: 14px;
color: #515a6e; text-align: center;
border-top-right-radius: 5px; color: #515a6e;
border-bottom-right-radius: 5px; border-top-right-radius: 5px;
background: #ffffff; border-bottom-right-radius: 5px;
box-shadow: #ccc 2px 2px 4px 1px; background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px;
}
.menu_play:hover {
background-color: #2d8cf0;
color: white;
}
} }
.menu_play:hover {
background-color: #2d8cf0; .ivu-layout-content {
color: white; // margin-left: 5px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
overflow: auto;
padding: 10px;
height: 88vh;
overflow-y: hidden;
} }
}
.ivu-layout-content {
// margin-left: 5px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
overflow: auto;
padding: 10px;
height: 88vh;
overflow-y: hidden;
}
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="master-data"> <div class="master-data">
<DataGrid <DataGrid :columns="cols" ref="grid" :conditions="easySearch" :action="action" :initsearch="sets" :high="false" :format="formatFun" :height="tableHeight" @on-selection-change="onSelect" :exportTitle="exportTitle">
:columns="cols" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:conditions="easySearch" <FormItem prop="keys">
:action="action" <Input placeholder="请输入编码/名称/状态" v-width="200" v-model="easySearch.keys.value" clearable />
:initsearch="sets" </FormItem>
:high="false" <FormItem>
:format="formatFun" <Button type="primary" @click="search">查询</Button>
:height="tableHeight" </FormItem>
@on-selection-change="onSelect" </Form>
> </template>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
placeholder="请输入编码/名称/状态"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add">新增</Button> <Button type="primary" @click="add">新增</Button>
</template> <Button @click="openModalIm">导入</Button>
<template slot="batch"> </template>
<Button type="primary" @click="modalSchedule">批量送审</Button> <template slot="batch">
</template> <Button type="primary" @click="modalSchedule">批量送审</Button>
</template>
</DataGrid> </DataGrid>
<Modal <Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false" :fullscreen="fullscreen">
v-model="modal" <component :is="detail" :eid="curId" :rootCategoryId="rootCategoryId" :rowsTable="rowsTable" :nodeInfo="nodeInfo" @on-close="cancel" @on-cancel="cancel" @on-ok="ok" ref="chlidren" />
:title="title"
width="1000"
footer-hide
:mask-closable="false"
:fullscreen="fullscreen"
>
<component
:is="detail"
:eid="curId"
:rootCategoryId="rootCategoryId"
:rowsTable="rowsTable"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-cancel="cancel"
@on-ok="ok"
ref="chlidren"
/>
</Modal> </Modal>
</div> <ImportExcel ref="importExcel" @on-get-data="getData" :columns="cols" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</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: "masterData", name: "masterData",
components: { components: {
// Search // Search
}, },
props: ["nodeInfo"], props: ["nodeInfo"],
data() { data() {
return { return {
action: Api.index, action: Api.index,
tableHeight: "", tableHeight: "",
modal: false, modal: false,
title: "新增", title: "新增",
curId: 0, curId: 0,
rootCategoryId: 0, rootCategoryId: 0,
selectRows: [], selectRows: [],
rowsTable: [], rowsTable: [],
fullscreen: false, fullscreen: false,
detail: null, detail: null,
sets: v => { sets: v => {
v.categoryId = this.nodeInfo.categoryId; v.categoryId = this.nodeInfo.categoryId;
v.rootCategoryId = this.nodeInfo.rootCategoryId; v.rootCategoryId = this.nodeInfo.rootCategoryId;
}, },
easySearch: { easySearch: {
keys: { op: "code,name", value: null }, keys: {
categoryId: { op: "code,name",
op: "In", value: null
value: this.nodeInfo.ids },
} categoryId: {
}, op: "In",
columns: [ value: this.nodeInfo.ids
{
type: "selection",
width: 70,
align: "center"
},
{
key: "code",
title: "编码",
align: "left",
render: (h, params) => {
return h(
"a",
{
props: {},
on: {
click: () => this.details(params.row)
} }
}, },
!params.row.code ? "未分配" : params.row.code columns: [{
); type: "selection",
} width: 70,
}, align: "center"
{ },
key: "name",
title: "名称",
align: "left"
},
{
key: "status",
title: "状态",
align: "left",
render: (h, params) => {
return h("state", {
props: {
code: "material.main.status",
type: "text",
value: params.row.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"
},
{
title: "操作",
key: "action",
width: 150,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "code",
on: { click: () => this.edit(params.row) } title: "编码",
align: "left",
render: (h, params) => {
return h(
"a", {
props: {},
on: {
click: () => this.details(params.row)
}
},
!params.row.code ? "未分配" : params.row.code
);
}
}, },
"编辑"
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "name",
on: { click: () => this.remove(params.row.id) } title: "名称",
align: "left"
}, },
params.row.status == 3 ? "" : "删除"
),
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "status",
on: { click: () => this.send(params.row) } title: "状态",
align: "center",
code: "material.main.status",
}, },
(params.row.status == 0 || params.row.status == 1) && {
this.status == 0 key: "version",
? "送审" title: "版本",
: "" align: "left",
) code: "material.main.version"
]); },
} {
} key: "drawing",
], //基础咧 title: "图号",
cols: [], // align: "left"
status: null },
}; {
}, key: "creationTime",
async fetch({ store, params }) { title: "创建时间",
await store.dispatch("loadDictionary"); // 加载数据字典 hide: true,
}, align: "left",
created() { type: "date"
this.tableHeight = window.innerHeight - 220; },
if (this.nodeInfo.rootCategoryId == 0) { {
this.cols = this.columns; key: "creatorUserId",
} else { title: "创建人",
this.initCols(); hide: true,
} align: "left",
Api.getbyid({ type: "user"
id: "b6303ddc-8b5e-40a3-a51b-294657d1d913" },
}).then(r => { {
this.status = r.result.status; //status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮 title: "操作",
this.nodeInfo.status = this.status; key: "action",
}); width: 150,
}, align: "left",
mounted() { render: (h, params) => {
window.onresize = () => { return h("div", {
///浏览器窗口大小变化 class: "action"
return (() => { }, [
window.screenHeight = window.innerHeight; h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
params.row.status == 3 ? "" : "删除"
),
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.send(params.row)
}
},
(params.row.status == 0 || params.row.status == 1) &&
this.status == 0 ?
"送审" :
""
)
]);
}
}
], //基础咧
cols: [], //
status: null,
ModalIm: false,
addCol: [],
exportTitle: '物料管理',
};
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 220; this.tableHeight = window.innerHeight - 220;
})();
}; if (this.nodeInfo.rootCategoryId == 0) {
}, this.cols = this.columns;
methods: {
//格式化原始数据
formatFun(data) {
data.map(e => {
if (e.status == 0) {
e._disabled = false;
} else { } else {
e._disabled = true; this.initCols();
} }
}); Api.getbyid({
return data; id: "b6303ddc-8b5e-40a3-a51b-294657d1d913"
}, }).then(r => {
onSelect(a, b) { this.status = r.result.status; //status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮
// console.log(a); this.nodeInfo.status = this.status;
// console.log(b); });
//批量选择
this.rootCategoryId = a[0].rootCategoryId;
this.selectRows = a;
}, },
modalSchedule() { mounted() {
this.fullscreen = true; window.onresize = () => {
this.rowsTable = this.selectRows; ///浏览器窗口大小变化
this.title = "物料送审"; return (() => {
this.curId = 0; window.screenHeight = window.innerHeight;
this.detail = () => import("./submit"); this.tableHeight = window.innerHeight - 220;
this.modal = true; })();
};
}, },
search() { methods: {
this.$refs.grid.reload(this.easySearch); //格式化原始数据
}, formatFun(data) {
initCols(delay) { data.map(e => {
let conditions = [ if (e.status == 0) {
{ e._disabled = false;
conditionalType: "Equal", } else {
fieldName: "categoryId", e._disabled = true;
fieldValue: this.nodeInfo.rootCategoryId }
} });
]; return data;
},
onSelect(a, b) {
// console.log(a);
// console.log(b);
//批量选择
this.rootCategoryId = a[0].rootCategoryId;
this.selectRows = a;
},
modalSchedule() {
this.fullscreen = true;
this.rowsTable = this.selectRows;
this.title = "物料送审";
this.curId = 0;
this.detail = () => import("./submit");
this.modal = true;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
initCols(delay) {
let conditions = [{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}];
Api.listTable({
conditions: conditions,
sortBy: "id",
isDesc: false
}).then(r => {
if (r.result) {
var items = r.result.filter(u => {
return (
!this.columns.some(p => {
return p.key == u.field;
}) && u.dataType != 5
);
});
this.addCol = items;
this.cols = this.$u.clone(this.columns);
let extra = items.map(u => {
console.log(u);
var col = {
key: u.field,
title: u.title
};
if (u.dataType == 3) {
col.code = u.note;
}
if (u.dataType == 4) {
col.type = "date";
}
if (u.unitName && (u.dataType == 1 || u.dataType == 2)) {
var units = this.$store.getters.dictionaryByKey(
"material.main.unitName"
);
Api.listTable({ let item = units.filter(p => {
conditions: conditions, return p.code == u.unitName;
sortBy: "id", });
isDesc: false // console.log(units, item);
}).then(r => { col.title += "(" + item[0].name + ")";
if (r.result) { }
var items = r.result.filter(u => { return col;
return ( });
!this.columns.some(p => { this.cols = this.cols.concat(extra);
return p.key == u.field; var action = this.cols.splice(this.columns.length - 1, 1);
}) && u.dataType != 5 this.cols.push(this.columns[this.columns.length - 1]);
); if (delay) {
}); delay();
this.cols = this.$u.clone(this.columns); }
let extra = items.map(u => { // console.log(this.cols)
console.log(u); }
var col = { });
key: u.field, this.exportTitle = "物料管理-" + this.nodeInfo.rootCategoryName;
title: u.title },
}; add() {
if (u.dataType == 3) { if (this.nodeInfo.categoryId) {
col.code = u.note; if (this.nodeInfo.addChange == true) {
this.fullscreen = false;
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
} else {
this.$Message.error("请在设置的分类层级数下添加物料");
}
} else {
this.$Message.error("请先选择分类");
} }
if (u.dataType == 4) { },
col.type = "date"; edit(row) {
this.fullscreen = false;
this.curId = row.id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功");
}
});
},
details(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "详情";
this.detail = () => import("./details");
this.rowsTable = [];
this.modal = true;
},
send(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "物料送审";
this.detail = () => import("./submit");
this.rowsTable = [];
this.modal = true;
},
ok() {
this.$refs.grid.reload(this.easySearch);
this.modal = false;
this.curId = 0;
},
cancel() {
this.curId = 0;
this.modal = false;
},
//批量导入start
//导入功能
openModalIm() {
if (this.nodeInfo.categoryId) {
this.ModalIm = true
} else {
this.$Message.error("请先选择分类");
} }
if (u.unitName && (u.dataType == 1 || u.dataType == 2)) {
var units = this.$store.getters.dictionaryByKey(
"material.main.unitName"
);
let item = units.filter(p => { },
return p.code == u.unitName; ModalImCancel() {
}); this.ModalIm = false
// console.log(units, item); },
col.title += "(" + item[0].name + ")"; getData(val) {
} let url = `${material}/materialimportservice/import`;
return col; alert(JSON.stringify(this.cols))
}); this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val))
this.cols = this.cols.concat(extra); },
var action = this.cols.splice(this.columns.length - 1, 1); //根据页面二次处理数据
this.cols.push(this.columns[this.columns.length - 1]); formatMethod(val) {
if (delay) { let tempData = this.$u.clone(val);
delay(); let tempList = [];
} tempData.forEach((ele) => {
// console.log(this.cols) let obj = {
} name: ele.name ? ele.name : '',
}); version: ele.version ? Number(ele.version) : '',
}, drawing: ele.drawing ? ele.drawing : '',
add() { description: ele.description ? ele.description : "",
if (this.nodeInfo.categoryId) { code: 0,
if (this.nodeInfo.addChange == true) { status: this.nodeInfo.status == 1 ? 3 : 0,
this.fullscreen = false; codeRuleId: this.nodeInfo.codeRuleId,
this.curId = 0; categoryId: this.nodeInfo.categoryId, //左侧树点击的id
this.title = "新增"; customProperties: {},
this.detail = () => import("./add"); rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
this.modal = true; };
} else { this.addCol.forEach(el => {
this.$Message.error("请在设置的分类层级数下添加物料"); obj[el.field] = ele[el.field]
} })
} else { if (ele.name && ele.name != '') {
this.$Message.error("请先选择分类"); obj.ico = false
} } else {
}, obj.ico = true
edit(row) { }
this.fullscreen = false; tempList.push(obj);
this.curId = row.id;
this.title = "编辑"; });
this.detail = () => import("./edit"); return tempList
this.modal = true;
}, },
remove(id) { //批量导入end
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功");
}
});
},
details(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "详情";
this.detail = () => import("./details");
this.rowsTable = [];
this.modal = true;
},
send(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "物料送审";
this.detail = () => import("./submit");
this.rowsTable = [];
this.modal = true;
},
ok() {
this.$refs.grid.reload(this.easySearch);
this.modal = false;
this.curId = 0;
}, },
cancel() { watch: {
this.curId = 0; nodeInfo: {
this.modal = false; handler(newName, oldName) {
} // console.log("ovo", newName, oldName);
}, if (newName.rootCategoryId) {
watch: { this.initCols(() => {
nodeInfo: { if (newName.categoryId) {
handler(newName, oldName) { this.easySearch.categoryId.value = newName.ids;
// console.log("ovo", newName, oldName); this.$refs.grid.reload(this.easySearch);
if (newName.rootCategoryId) { }
this.initCols(() => { });
if (newName.categoryId) { }
this.easySearch.categoryId.value = newName.ids; if (!newName.categoryId) {
this.$refs.grid.reload(this.easySearch); this.easySearch.categoryId.value = "-1";
} }
}); },
} immediate: true,
if (!newName.categoryId) { deep: true
this.easySearch.categoryId.value = "-1";
} }
},
immediate: true,
deep: true
} }
}
}; };
</script> </script>
<style lang="less" >
<style lang="less">
.master-data { .master-data {
.ivu-footer-toolbar-right { .ivu-footer-toolbar-right {
margin-right: 72% !important; margin-right: 72% !important;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -27,7 +27,7 @@ window.apsUrl = `http://${systemApi.aps}:10111/api/services/app`;//aps排产(61) ...@@ -27,7 +27,7 @@ window.apsUrl = `http://${systemApi.aps}:10111/api/services/app`;//aps排产(61)
window.technologyUrl =`http://${address}:10000/technology/`;//新工艺规程接口 window.technologyUrl =`http://${address}:10000/technology/`;//新工艺规程接口
window.iconImg = `/imgicon/`; window.iconImg = `/imgicon/`;
window.mncImg = `/images/mnc/`;//mnc图片 window.mncImg = `/images/mnc/`;//mnc图片
window.material = `http://${address}:10000/material`; //物料管理 window.material = `http://${address}:10000/material`; //物料管理 10032
window.Platform = `http://${address}:10000/platform`; //计划管理10131 window.Platform = `http://${address}:10000/platform`; //计划管理10131
/* window.systemUrl = `http://${address}:10020/api/services/app`; //System-api 系统管理(基础数据) /* window.systemUrl = `http://${address}:10020/api/services/app`; //System-api 系统管理(基础数据)
......
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