Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周远喜
mes-ui
Commits
fa5f87e7
Commit
fa5f87e7
authored
Jun 10, 2020
by
仇晓婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zhu
parent
2d2effa6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
51 deletions
+93
-51
add.vue
pages/materiel/masterData/add.vue
+17
-15
api.js
pages/materiel/masterData/api.js
+3
-2
index.vue
pages/materiel/masterData/index.vue
+58
-30
masterData.vue
pages/materiel/masterData/masterData.vue
+15
-4
No files found.
pages/materiel/masterData/add.vue
View file @
fa5f87e7
<
template
>
<div>
{{
nodeInfo
}}
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
...
...
@@ -46,14 +47,15 @@
<
script
>
import
Api
from
"./api"
;
export
default
{
props
:
[
"nodeInfo"
],
data
()
{
return
{
arr
:
[],
entity
:
{
code
:
0
,
categoryId
:
0
,
//左侧树点击的id
categoryId
:
this
.
nodeInfo
.
categoryId
,
//左侧树点击的id
customProperties
:
{},
rootCategoryId
:
0
//左侧树点击的数据的最顶层id
rootCategoryId
:
this
.
nodeInfo
.
rootCategoryId
//左侧树点击的数据的最顶层id
},
disabled
:
false
,
...
...
@@ -113,19 +115,19 @@ export default {
if
(
v
)
{
// let categoryDto = this.entity;
// let pro = this.checkList.concat(this.arr);
// Api.create({ categoryDto: categoryDto, pro: pro }
)
//
.then(r => {
//
if (r.success) {
//
this.$Message.success("保存成功");
//
this.$emit("on-ok");
//
} else {
//
this.$Message.error("保存失败");
//
}
//
})
//
.catch(err => {
//
this.disabled = false;
//
this.$Message.error("保存失败");
//
});
Api
.
create
(
this
.
entity
)
.
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"保存失败"
);
}
})
.
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
"保存失败"
);
});
}
});
},
...
...
pages/materiel/masterData/api.js
View file @
fa5f87e7
import
Api
from
'@/plugins/request'
export
default
{
listTable
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/custompropertydefinition/list`
,
params
);
index
:
`
${
systemUrl
}
/material/paged`
,
paged
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/material/paged`
,
params
);
},
list
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/category/list`
,
params
);
...
...
pages/materiel/masterData/index.vue
View file @
fa5f87e7
...
...
@@ -34,19 +34,9 @@
</a>
</div>
<Content
:class=
"!showMenu?'con_bord':''"
>
<MasterData
ref=
"dataTable"
@
on-edit=
"edit
"
/>
<MasterData
ref=
"dataTable"
:nodeInfo=
"nodeInfo
"
/>
</Content>
</Layout>
<!--
<Modal
v-model=
"modal"
:title=
"title"
width=
"1000"
footer-hide
:mask-closable=
"false"
>
<component
:is=
"detail"
:eid=
"curId"
:nodeInfo=
"nodeInfo"
@
on-close=
"cancel"
@
on-ok=
"ok"
ref=
"chlidren"
/>
</Modal>
-->
</div>
</
template
>
<
script
>
...
...
@@ -63,7 +53,10 @@ export default {
keys
:
""
,
expand
:
false
,
list
:
[],
nodeInfo
:
{},
nodeInfo
:
{
categoryId
:
0
,
rootCategoryId
:
0
},
modal
:
false
,
title
:
"新增"
,
curId
:
0
,
...
...
@@ -105,14 +98,38 @@ export default {
{
on
:
{
click
:
()
=>
{
this
.
handleSelect
(
data
);
//手动选择树节点
this
.
handleSelect
(
root
,
data
);
//手动选择树节点
}
}
},
data
.
title
);
},
handleSelect
(
data
)
{},
handleSelect
(
root
,
data
)
{
// console.log(root);
// console.log(data);
let
pid
=
null
;
//定义最顶级id
let
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
;
}
else
{
upId
=
u
.
node
.
upId
;
addId
(
roots
,
upId
);
}
}
});
}
addId
(
roots
,
upId
);
console
.
log
(
pid
);
this
.
nodeInfo
.
categoryId
=
data
.
id
;
this
.
nodeInfo
.
rootCategoryId
=
pid
;
// this.$refs.dataTable.$refs.grid.reload(this.nodeInfo);
},
loadTree
()
{
let
conditions
=
[];
Api
.
list
({
conditions
:
conditions
}).
then
(
r
=>
{
...
...
@@ -133,22 +150,33 @@ export default {
this
.
expand
=
!
this
.
expand
;
},
change
(
v
,
b
)
{
console
.
log
(
v
);
console
.
log
(
b
);
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.$emit("on-select", b.value, b, ids);
// console.log(v);
// console.log(b);
// }
// var parentList = [];
// buildParentList(v);
// findParent(b.id);
// function buildParentList(arr) {
// arr.forEach(g => {
// console.log(g);
// if (g.upId != undefined) {
// let pid = g["upId"];
// let oid = g["id"];
// parentList[oid] = pid;
// }
// if (g.children != undefined) buildParentList(g["children"]);
// });
// }
// function findParent(idx) {
// alert(idx);
// alert(parentList[idx]);
// if (parentList[idx] != undefined) {
// let pid = parentList[idx];
// console.log(pid);
// findParent(pid);
// } else {
// }
// }
},
hide
()
{
this
.
showMenu
=
false
;
...
...
pages/materiel/masterData/masterData.vue
View file @
fa5f87e7
<
template
>
<div
class=
"master-data"
>
{{
nodeInfo
}}
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
>
<template
slot=
"easySearch"
>
<Form
ref=
"formInline"
:model=
"easySearch"
inline
>
...
...
@@ -43,6 +44,7 @@ export default {
components
:
{
// Search
},
props
:
[
"nodeInfo"
],
data
()
{
return
{
action
:
""
,
...
...
@@ -50,9 +52,16 @@ export default {
title
:
"新增"
,
curId
:
0
,
detail
:
null
,
nodeInfo
:
{},
easySearch
:
{
keys
:
{
op
:
"unicode,name,code"
,
value
:
null
}
keys
:
{
op
:
"categoryId,rootCategoryId"
,
value
:
null
},
categoryId
:
{
op
:
"In"
,
value
:
this
.
nodeInfo
.
categoryId
},
rootCategoryId
:
{
op
:
"In"
,
value
:
this
.
nodeInfo
.
rootCategoryId
}
},
columns
:
[
// {
...
...
@@ -124,8 +133,10 @@ export default {
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
// this.dataColumns = this.dataTable;
// console.log(this.dataColumns)
Api
.
paged
().
then
(
r
=>
{
if
(
r
.
success
)
{
}
});
},
methods
:
{
search
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment