Commit f5c6af41 authored by renjintao's avatar renjintao

物料管理

parent 8018f5c3
<template>
<div class="classification">
<div class="classification">
<Layout>
<Sider width="300" v-if="showMenu">
<div class="p-list">
......@@ -10,21 +10,13 @@
<Icon type="ios-arrow-down"></Icon>
</a>
<DropdownMenu slot="list">
<DropdownItem
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
<DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem>
</DropdownMenu>
</Dropdown>
<div class="fr mr10 mt10">
<ButtonGroup class="fr" size="small">
<Button icon="md-add" title="新增顶级" @click="addNew"></Button>
<Button
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
<Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
......@@ -36,13 +28,7 @@
<div class="fg">
<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"
>
<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>
......@@ -69,17 +55,11 @@
</Content>
</Layout>
<Modal v-model="modal" :title="title" width="1500" footer-hide :mask-closable="false">
<component
:is="detail"
:eid="curId"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-ok="ok"
ref="chlidren"
/>
<component :is="detail" :eid="curId" :nodeInfo="nodeInfo" @on-close="cancel" @on-ok="ok" ref="chlidren" />
</Modal>
</div>
</div>
</template>
<script>
import MasterData from "./masterData.vue";
......@@ -112,7 +92,10 @@ export default {
dataList: []
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
......@@ -220,10 +203,13 @@ export default {
this.curId = 0;
this.modal = false;
},
renderContent(h, { root, node, data }) {
renderContent(h, {
root,
node,
data
}) {
return h(
"span",
{
"span", {
on: {
click: () => {
this.handleSelect(data); //手动选择树节点
......@@ -240,9 +226,9 @@ export default {
},
data.title +
"(" +
(data.totalMaterialCount == undefined
? "0"
: data.totalMaterialCount) +
(data.totalMaterialCount == undefined ?
"0" :
data.totalMaterialCount) +
")"
);
},
......@@ -274,9 +260,11 @@ export default {
},
loadTree(id) {
let data = {
conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" }
],
conditions: [{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal"
}],
sortBy: "code",
isDesc: false
};
......@@ -308,6 +296,7 @@ export default {
ids.push(b.id);
if (b.children) {
addId(b.children);
function addId(data) {
data.map(u => {
ids.push(u.id);
......@@ -331,6 +320,7 @@ export default {
let expand = this.expand;
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map(u => {
if (keys.length < u.title) {
......@@ -351,7 +341,8 @@ export default {
}
};
</script>
<style lang="less" >
<style lang="less">
.classification {
font-family: Microsoft YaHei;
......@@ -367,6 +358,7 @@ export default {
background: #eee;
padding-left: 10px;
}
.p-list {
h3 {
height: 50px;
......@@ -379,22 +371,26 @@ export default {
opacity: 1;
padding-left: 10px;
}
.search {
height: 50px;
padding: 5px 10px;
}
.fg {
flex: none;
height: 100%;
overflow: auto;
padding-left: 10px;
}
.tree {
height: calc(100vh - 215px);
overflow: auto;
}
}
}
.show_menu {
width: 30px;
height: 30px;
......@@ -402,6 +398,7 @@ export default {
top: 100px;
left: 0;
z-index: 9;
.menu_play {
width: 30px;
height: 30px;
......@@ -414,11 +411,13 @@ export default {
background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px;
}
.menu_play:hover {
background-color: #2d8cf0;
color: white;
}
}
.ivu-layout-content {
// margin-left: 5px;
background: rgba(255, 255, 255, 1);
......
<template>
<div class="master-data">
<div class="master-data">
<!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> -->
<DataGrid
:columns="columns"
ref="grid"
:conditions="easySearch"
:action="action"
:high="false"
:height="tableHeight"
>
<DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" :high="false" :height="tableHeight">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
......@@ -20,8 +13,9 @@
</Form>
</template>
</DataGrid>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
......@@ -33,8 +27,14 @@ export default {
tableHeight: "",
dataColumns: [],
easySearch: {
keys: { op: "code,name", value: null },
id: { op: "In", value: "" }
keys: {
op: "code,name",
value: null
},
id: {
op: "In",
value: ""
}
},
columns: [
// {
......@@ -71,20 +71,28 @@ export default {
width: 260,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) }
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
"删除"
)
......@@ -94,7 +102,10 @@ export default {
]
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
......@@ -143,6 +154,7 @@ export default {
}
};
</script>
<style lang="less" scoped>
.spare-parts {
width: 100%;
......
<template>
<div class="classification">
<div class="classification">
<Layout>
<Sider width="300" v-if="showMenu">
<div class="p-list">
......@@ -10,20 +10,12 @@
<Icon type="ios-arrow-down"></Icon>
</a>
<DropdownMenu slot="list">
<DropdownItem
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
<DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem>
</DropdownMenu>
</Dropdown>
<div class="fr mr10 mt10">
<ButtonGroup class="fr ddi" size="small">
<Button
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
<Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
......@@ -48,8 +40,9 @@
<MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" />
</Content>
</Layout>
</div>
</div>
</template>
<script>
import MasterData from "./masterData.vue";
......@@ -70,6 +63,7 @@ export default {
nodeInfo: {
categoryId: 0,
rootCategoryId: 0,
rootCategoryName: "",
ids: [],
addChange: true,
codeRuleId: 0,
......@@ -82,9 +76,14 @@ export default {
showMenu: true,
dataList: [],
codeRuleId: "",
rootCategoryId: null,
categoryId: null,
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
......@@ -138,10 +137,13 @@ export default {
this.curId = 0;
this.modal = false;
},
renderContent(h, { root, node, data }) {
renderContent(h, {
root,
node,
data
}) {
return h(
"span",
{
"span", {
on: {
click: () => {
this.handleSelect(root, data); //手动选择树节点
......@@ -150,21 +152,24 @@ export default {
},
data.title +
"(" +
(data.totalMaterialCount == undefined
? "0"
: data.totalMaterialCount) +
(data.totalMaterialCount == undefined ?
"0" :
data.totalMaterialCount) +
")"
);
},
handleSelect(root, data) {
let pid = null; //定义最顶级id
let upId = data.upId;
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);
......@@ -172,19 +177,25 @@ export default {
}
});
}
addId(roots, upId);
this.nodeInfo.categoryId = data.id;
if (pid == null) {
this.nodeInfo.rootCategoryName = data.name;
if (pid == -1) {
this.nodeInfo.rootCategoryId = data.id;
this.nodeInfo.rootCategoryName = data.name;
} else {
this.nodeInfo.rootCategoryId = pid;
this.nodeInfo.rootCategoryName = pname
}
},
loadTree(id) {
let data = {
conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" },
],
conditions: [{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal"
}, ],
sortBy: "code",
isDesc: false,
};
......@@ -219,6 +230,7 @@ export default {
ids.push(b.value);
if (b.children) {
addId(b.children);
function addId(data) {
data.map((u) => {
ids.push(u.value);
......@@ -240,6 +252,7 @@ export default {
let expand = this.expand;
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map((u) => {
if (keys.length < u.title) {
......@@ -260,7 +273,8 @@ export default {
},
};
</script>
<style lang="less" >
<style lang="less">
.classification {
font-family: Microsoft YaHei;
......@@ -276,6 +290,7 @@ export default {
background: #eee;
padding-left: 10px;
}
.p-list {
h3 {
height: 50px;
......@@ -288,22 +303,26 @@ export default {
opacity: 1;
padding-left: 10px;
}
.search {
height: 50px;
padding: 5px 10px;
}
.fg {
flex: none;
height: 100%;
overflow: auto;
padding-left: 10px;
}
.tree {
height: calc(100vh - 215px);
overflow: auto;
}
}
}
.show_menu {
width: 30px;
height: 30px;
......@@ -311,6 +330,7 @@ export default {
top: 100px;
left: 0;
z-index: 9;
.menu_play {
width: 30px;
height: 30px;
......@@ -323,11 +343,13 @@ export default {
background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px;
}
.menu_play:hover {
background-color: #2d8cf0;
color: white;
}
}
.ivu-layout-content {
// margin-left: 5px;
background: rgba(255, 255, 255, 1);
......
<template>
<div class="master-data">
<DataGrid
:columns="cols"
ref="grid"
:conditions="easySearch"
:action="action"
:initsearch="sets"
:high="false"
:format="formatFun"
:height="tableHeight"
@on-selection-change="onSelect"
>
<div class="master-data">
<DataGrid :columns="cols" ref="grid" :conditions="easySearch" :action="action" :initsearch="sets" :high="false" :format="formatFun" :height="tableHeight" @on-selection-change="onSelect" :exportTitle="exportTitle">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
placeholder="请输入编码/名称/状态"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
<Input placeholder="请输入编码/名称/状态" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
......@@ -29,33 +14,19 @@
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
<Button @click="openModalIm">导入</Button>
</template>
<template slot="batch">
<Button type="primary" @click="modalSchedule">批量送审</Button>
</template>
</DataGrid>
<Modal
v-model="modal"
: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 v-model="modal" :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>
</div>
<ImportExcel ref="importExcel" @on-get-data="getData" :columns="cols" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</div>
</template>
<script>
import Api from "./api";
// import Search from "./search";
......@@ -82,14 +53,16 @@ export default {
v.rootCategoryId = this.nodeInfo.rootCategoryId;
},
easySearch: {
keys: { op: "code,name", value: null },
keys: {
op: "code,name",
value: null
},
categoryId: {
op: "In",
value: this.nodeInfo.ids
}
},
columns: [
{
columns: [{
type: "selection",
width: 70,
align: "center"
......@@ -100,8 +73,7 @@ export default {
align: "left",
render: (h, params) => {
return h(
"a",
{
"a", {
props: {},
on: {
click: () => this.details(params.row)
......@@ -119,16 +91,8 @@ export default {
{
key: "status",
title: "状态",
align: "left",
render: (h, params) => {
return h("state", {
props: {
align: "center",
code: "material.main.status",
type: "text",
value: params.row.status + ""
}
});
}
},
{
key: "version",
......@@ -161,47 +125,65 @@ export default {
width: 150,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) }
"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) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.send(params.row)
}
},
(params.row.status == 0 || params.row.status == 1) &&
this.status == 0
? "送审"
: ""
this.status == 0 ?
"送审" :
""
)
]);
}
}
], //基础咧
cols: [], //
status: null
status: null,
ModalIm: false,
addCol: [],
exportTitle: '物料管理',
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 220;
if (this.nodeInfo.rootCategoryId == 0) {
this.cols = this.columns;
} else {
......@@ -254,13 +236,11 @@ export default {
this.$refs.grid.reload(this.easySearch);
},
initCols(delay) {
let conditions = [
{
let conditions = [{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}
];
}];
Api.listTable({
conditions: conditions,
......@@ -275,6 +255,7 @@ export default {
}) && u.dataType != 5
);
});
this.addCol = items;
this.cols = this.$u.clone(this.columns);
let extra = items.map(u => {
console.log(u);
......@@ -310,6 +291,7 @@ export default {
// console.log(this.cols)
}
});
this.exportTitle = "物料管理-" + this.nodeInfo.rootCategoryName;
},
add() {
if (this.nodeInfo.categoryId) {
......@@ -367,7 +349,57 @@ export default {
cancel() {
this.curId = 0;
this.modal = false;
},
//批量导入start
//导入功能
openModalIm() {
if (this.nodeInfo.categoryId) {
this.ModalIm = true
} else {
this.$Message.error("请先选择分类");
}
},
ModalImCancel() {
this.ModalIm = false
},
getData(val) {
let url = `${material}/materialimportservice/import`;
alert(JSON.stringify(this.cols))
this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val))
},
//根据页面二次处理数据
formatMethod(val) {
let tempData = this.$u.clone(val);
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: this.nodeInfo.status == 1 ? 3 : 0,
codeRuleId: this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
};
this.addCol.forEach(el => {
obj[el.field] = ele[el.field]
})
if (ele.name && ele.name != '') {
obj.ico = false
} else {
obj.ico = true
}
tempList.push(obj);
});
return tempList
},
//批量导入end
},
watch: {
nodeInfo: {
......@@ -391,7 +423,8 @@ export default {
}
};
</script>
<style lang="less" >
<style lang="less">
.master-data {
.ivu-footer-toolbar-right {
margin-right: 72% !important;
......
......@@ -27,7 +27,7 @@ window.apsUrl = `http://${systemApi.aps}:10111/api/services/app`;//aps排产(61)
window.technologyUrl =`http://${address}:10000/technology/`;//新工艺规程接口
window.iconImg = `/imgicon/`;
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.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