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
65630c91
Commit
65630c91
authored
May 25, 2020
by
仇晓婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品结构
parent
f28b0b07
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
349 additions
and
202 deletions
+349
-202
productSelect1.vue
components/page/productSelect1.vue
+44
-25
zh-CN.js
i18n/locale/zh-CN.js
+6
-0
add.vue
pages/technology/productMix/product/add.vue
+30
-7
index.vue
pages/technology/productMix/product/index.vue
+6
-15
add.vue
pages/technology/productMix/productTree/add.vue
+87
-79
edit.vue
pages/technology/productMix/productTree/edit.vue
+78
-71
index.vue
pages/technology/productMix/productTree/index.vue
+98
-5
No files found.
components/page/productSelect1.vue
View file @
65630c91
...
...
@@ -82,42 +82,60 @@ export default {
});
this
.
orderSearchForm
.
productName
=
data
[
0
].
name
;
this
.
orderSearchForm
.
productId
=
data
[
0
].
id
;
let
listData
=
this
.
$u
.
clone
(
this
.
data1
);
let
result
=
[];
var
nodeId
=
data
.
id
;
//
let listData = this.$u.clone(this.data1);
//
let result = [];
//
var nodeId = data.id;
// //传入参数:需要遍历的json,需要匹配的id
function
findPnodeId
(
listData
,
nodeId
)
{
//设置结果
if
(
!
listData
)
{
return
;
//如果data传空,直接返回
}
for
(
var
i
=
0
;
i
<
listData
.
children
.
length
;
i
++
)
{
let
item
=
listData
.
children
[
i
];
if
(
item
.
id
==
nodeId
)
{
result
.
unshift
(
data
.
name
);
//找到id相等的则返回父id
return
result
;
}
else
if
(
!!
item
.
children
)
{
findPnodeId
(
item
.
children
,
nodeId
);
}
}
//如果执行循环中都没有return,则在此return
return
result
;
var
roots
=
[];
var
cur
=
data
;
while
(
cur
)
{
roots
.
push
(
cur
);
cur
=
cur
.
father
;
}
console
.
log
(
result
);
this
.
$emit
(
"on-change"
,
this
.
orderSearchForm
);
// // //传入参数:需要遍历的json,需要匹配的id
// function findPnodeId(listData, nodeId) {
// //设置结果
// if (!listData) {
// return; //如果listData传空,直接返回
// }
// for (var i = 0; i
<
listData
.
children
.
length
;
i
++
)
{
// let item = listData.children[i];
// if (item.id == nodeId) {
// //找到id相等的则返回父id
// result.unshift(data.name);
// return result;
// } else if (!!item.children) {
// // findPnodeId(item.children, nodeId);
// }
// }
// //如果执行循环中都没有return,则在此return
// return result;
// }
// console.log(result);
// console.warn("roots", data, roots);
this
.
$emit
(
"on-change"
,
this
.
orderSearchForm
,
data
,
roots
);
}
},
loadTree
()
{
//打开新增订单窗口加载产品
var
sumData
=
[];
Api
.
getleveltree
().
then
(
r
=>
{
if
(
r
.
result
)
{
setFather
(
r
.
result
,
null
);
function
setFather
(
u
,
father
)
{
u
.
map
(
u
=>
{
if
(
father
)
{
u
.
father
=
father
;
}
if
(
u
.
children
&&
u
.
children
.
length
>
0
)
{
setFather
(
u
.
children
,
u
);
}
});
}
this
.
data1
=
r
.
result
;
}
else
{
this
.
$Message
.
error
(
"加载产品树失败!"
);
...
...
@@ -134,6 +152,7 @@ export default {
watch
:
{
value
:
{
handler
(
v
,
o
)
{
this
.
dep
=
v
|
""
;
Api
.
getleveltree
().
then
(
res
=>
{
if
(
res
.
result
)
{
...
...
i18n/locale/zh-CN.js
View file @
65630c91
...
...
@@ -1449,5 +1449,11 @@ export default {
endTime
:
'结束时间'
,
planEndTime
:
'计划结束时间'
,
action
:
'操作'
},
product_level
:{
name
:
'名称'
,
upId
:
'上级id'
,
creatorUserId
:
0
,
id
:
0
,
}
}
pages/technology/productMix/product/add.vue
View file @
65630c91
...
...
@@ -11,7 +11,7 @@
<Col
:span=
"12"
>
<FormItem
label=
"上级所属"
prop=
"parentName"
>
<!--
<Input
v-model=
"entity.parentName"
disabled
></Input>
-->
<productSelect1
v-model=
"entity.levelId"
@
on-change=
"proChange"
/>
<productSelect1
v-model=
"entity.levelId"
@
on-change=
"proChange"
/>
</FormItem>
</Col>
<Col
:span=
"12"
>
...
...
@@ -82,11 +82,13 @@ export default {
// status: null,
remark
:
""
,
madeCompany
:
""
,
extend
:
""
,
madeCompanyTitle
:
""
,
// extend: "",
productUrl
:
""
,
productUrlList
:
""
,
levelId
:
null
,
parentName
:
this
.
parents
.
parentName
levelId
:
this
.
parents
.
parentId
,
// parentName: this.parents.parentName,
levelTitle
:
""
},
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
...
...
@@ -109,6 +111,7 @@ export default {
}
},
mounted
()
{
alert
(
this
.
parents
.
parentId
);
if
(
this
.
eid
>
0
)
{
this
.
load
(
this
.
eid
);
}
...
...
@@ -129,7 +132,7 @@ export default {
}
else
{
this
.
entity
.
productUrlList
=
""
;
}
this
.
entity
.
levelId
=
this
.
parents
.
parentId
;
Api
.
create
(
this
.
entity
)
.
then
(
r
=>
{
this
.
disabled
=
false
;
...
...
@@ -157,9 +160,27 @@ export default {
this
.
entity
.
id
=
0
;
});
},
proChange
(
item
s
)
{
proChange
(
items
,
data
,
root
s
)
{
this
.
entity
.
levelId
=
items
.
productId
;
let
listName
=
[];
let
root
=
roots
[
0
];
if
(
root
)
{
// console.log(root[0]);
listName
.
unshift
(
root
[
0
].
name
);
if
(
root
[
0
].
father
)
{
var
obj
=
root
[
0
].
father
;
listName
.
unshift
(
obj
.
name
);
// for (let key in obj) {
// if(key==name){
// listName.unshift(obj[key])
// console.log(obj[key])
// }
// }
}
else
{
}
}
this
.
entity
.
levelTitle
=
listName
.
join
(
","
);
},
l
(
key
)
{
key
=
"product_info"
+
"."
+
key
;
...
...
@@ -169,7 +190,9 @@ export default {
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
this
.
entity
=
this
.
parents
.
parentId
;
},
eid
(
v
)
{
if
(
v
>
0
)
{
this
.
load
(
v
);
...
...
pages/technology/productMix/product/index.vue
View file @
65630c91
...
...
@@ -33,7 +33,9 @@
</Row>
<Row
class=
"row-down"
>
<Col
span=
"7"
>
<div
class=
"img-i"
>
图片
</div>
<div
class=
"img-i"
>
<img
:src=
"row.productUrl"
width=
"100%"
height=
"100%"
/>
</div>
</Col>
<Col
span=
"17"
class=
"c"
>
<div>
产品分类:
{{
row
.
productClass
}}
</div>
...
...
@@ -126,6 +128,7 @@ export default {
this
.
title
=
"新增"
;
this
.
detail
=
()
=>
import
(
"./add"
);
this
.
modal
=
true
;
this
.
parents
.
parentId
=
this
.
parent
.
id
;
this
.
parents
.
parentName
=
this
.
parent
.
parentName
;
},
...
...
@@ -160,20 +163,6 @@ export default {
this
.
modal
=
false
;
},
l
(
key
)
{
/*
product_info:{
mmcode:'物料编号',
drawingNo:'图号',
name:'名称',
productCode:'',
status:'',
remark:'',
madeCompany:'主承制单位',
extend:'',
productUrl:'产品图像url',
productUrlList:'产品图象列表',
}
*/
let
vkey
=
"product_info"
+
"."
+
key
;
return
this
.
$t
(
vkey
)
||
key
;
}
...
...
@@ -208,6 +197,8 @@ export default {
.row-down {
padding: 10px;
.img-i {
width: 90px;
height: 100px;
background: #eee;
height: 90px;
margin-right: 15px;
...
...
pages/technology/productMix/productTree/add.vue
View file @
65630c91
<
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
><FormItem
:label=
"l('name')"
prop=
"name"
>
<Input
v-model=
"entity.name"
>
</Input>
</FormItem></Col>
<Col
:span=
"12"
><FormItem
:label=
"l('upId')"
prop=
"upId"
>
<InputNumber
v-model=
"entity.upId"
></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Form>
</
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
<FormItem
:label=
"l('name')"
prop=
"name"
>
<Input
v-model=
"entity.name"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('upId')"
prop=
"upId"
>
<InputNumber
v-model=
"entity.upId"
></InputNumber>
</FormItem>
</Col>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Form>
</
template
>
<
script
>
import
Api
from
'./api'
export
default
{
name
:
'Add'
,
data
()
{
return
{
disabled
:
false
,
entity
:
{
name
:
""
,
upId
:
null
},
rules
:
{
name
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}]
}
}
},
props
:
{
v
:
Object
,
eid
:
Number
},
mounted
()
{
if
(
this
.
eid
>
0
)
{
this
.
load
(
this
.
eid
);
}
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
((
v
)
=>
{
if
(
v
)
{
this
.
disabled
=
true
;
Api
.
create
(
this
.
entity
).
then
((
r
)
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
'保存成功'
)
this
.
$emit
(
'on-ok'
)
}
else
{
this
.
$Message
.
error
(
'保存失败'
)
}
}).
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
'保存失败'
)
console
.
warn
(
err
)
})
}
})
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
},
load
(
v
)
{
Api
.
get
({
id
:
v
}).
then
(
r
=>
{
this
.
entity
=
r
.
result
;
this
.
entity
.
id
=
0
;
});
},
l
(
key
)
{
key
=
"product_level"
+
"."
+
key
;
return
this
.
$t
(
key
)
import
Api
from
"./api"
;
export
default
{
name
:
"Add"
,
data
()
{
return
{
disabled
:
false
,
entity
:
{
name
:
""
,
upId
:
this
.
nodeInfo
.
id
?
this
.
nodeInfo
.
id
:
0
},
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
}
},
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
)
},
eid
(
v
)
{
if
(
v
>
0
)
{
this
.
load
(
v
);
}
}
};
},
props
:
{
v
:
Object
,
eid
:
Number
,
nodeInfo
:
Object
},
mounted
()
{
if
(
this
.
eid
>
0
)
{
this
.
load
(
this
.
eid
);
}
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
if
(
v
)
{
this
.
disabled
=
true
;
Api
.
create
(
this
.
entity
)
.
then
(
r
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"保存失败"
);
}
})
.
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
"保存失败"
);
console
.
warn
(
err
);
});
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
load
(
v
)
{
Api
.
get
({
id
:
v
}).
then
(
r
=>
{
this
.
entity
=
r
.
result
;
this
.
entity
.
id
=
0
;
});
},
l
(
key
)
{
key
=
"product_level"
+
"."
+
key
;
return
this
.
$t
(
key
);
}
},
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
},
eid
(
v
)
{
if
(
v
>
0
)
{
this
.
load
(
v
);
}
}
</
script
>
\ No newline at end of file
}
};
</
script
>
\ No newline at end of file
pages/technology/productMix/productTree/edit.vue
View file @
65630c91
<
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
><FormItem
:label=
"l('name')"
prop=
"name"
>
<Input
v-model=
"entity.name"
>
</Input>
</FormItem></Col>
<Col
:span=
"12"
><FormItem
:label=
"l('upId')"
prop=
"upId"
>
<InputNumber
v-model=
"entity.upId"
></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
<FormItem
:label=
"l('name')"
prop=
"name"
>
<Input
v-model=
"entity.name"
></Input>
</FormItem>
</Form>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('upId')"
prop=
"upId"
>
<InputNumber
v-model=
"entity.upId"
></InputNumber>
</FormItem>
</Col>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Form>
</
template
>
<
script
>
import
Api
from
'./api'
export
default
{
name
:
'Edit'
,
data
()
{
return
{
disabled
:
false
,
entity
:
{
},
rules
:
{
name
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}]
}
}
},
props
:
{
eid
:
Number
},
mounted
()
{
if
(
this
.
eid
>
0
)
{
this
.
load
(
this
.
eid
);
}
},
methods
:
{
load
(
v
)
{
Api
.
get
({
id
:
v
}).
then
(
r
=>
{
this
.
entity
=
r
.
result
;
})
},
handleSubmit
()
{
this
.
$refs
.
form
.
validate
((
v
)
=>
{
if
(
v
)
{
this
.
disabled
=
true
;
Api
.
update
(
this
.
entity
).
then
((
r
)
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
'保存成功'
)
this
.
$emit
(
'on-ok'
)
}
else
{
this
.
$Message
.
error
(
'保存失败'
)
}
}).
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
'保存失败'
)
console
.
warn
(
err
)
})
}
})
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
},
l
(
key
)
{
key
=
"product_level"
+
"."
+
key
;
return
this
.
$t
(
key
)
import
Api
from
"./api"
;
export
default
{
name
:
"Edit"
,
data
()
{
return
{
disabled
:
false
,
entity
:
{},
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
}
},
watch
:
{
eid
(
v
)
{
if
(
v
!=
0
)
{
this
.
load
(
v
);
}
}
};
},
props
:
{
eid
:
Number
},
mounted
()
{
if
(
this
.
eid
>
0
)
{
this
.
load
(
this
.
eid
);
}
},
methods
:
{
load
(
v
)
{
Api
.
get
({
id
:
v
}).
then
(
r
=>
{
this
.
entity
=
r
.
result
;
});
},
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
if
(
v
)
{
this
.
disabled
=
true
;
Api
.
update
(
this
.
entity
)
.
then
(
r
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"保存失败"
);
}
})
.
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
"保存失败"
);
console
.
warn
(
err
);
});
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
l
(
key
)
{
key
=
"product_level"
+
"."
+
key
;
return
this
.
$t
(
key
);
}
},
watch
:
{
eid
(
v
)
{
if
(
v
!=
0
)
{
this
.
load
(
v
);
}
}
}
};
</
script
>
\ No newline at end of file
pages/technology/productMix/productTree/index.vue
View file @
65630c91
...
...
@@ -4,6 +4,7 @@
产品列表
<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"
...
...
@@ -19,9 +20,31 @@
</div>
<div
class=
"fg"
>
<div
class=
"tree"
>
<Tree
:data=
"data"
ref=
"tree"
@
on-select-change=
"change"
></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>
<a
@
click=
"add"
>
添加
</a>
</DropdownItem>
<DropdownItem
name=
"edit"
>
<a
@
click=
"edit"
>
修改
</a>
</DropdownItem>
<DropdownItem
name=
"del"
>
<a
@
click=
"remove"
>
删除
</a>
</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
</div>
<Modal
v-model=
"modal"
:title=
"title"
width=
"800"
footer-hide
>
<component
:is=
"detail"
:eid=
"curId"
:nodeInfo=
"nodeInfo"
@
on-close=
"cancel"
@
on-ok=
"ok"
/>
</Modal>
</div>
</
template
>
...
...
@@ -33,14 +56,84 @@ export default {
return
{
keys
:
""
,
expand
:
false
,
list
:
[]
list
:
[],
nodeInfo
:
{},
modal
:
false
,
title
:
"新增"
,
curId
:
0
,
detail
:
null
};
},
created
()
{
this
.
loadTree
();
},
methods
:
{
ok
()
{
this
.
loadTree
();
this
.
modal
=
false
;
this
.
curId
=
0
;
},
addNew
()
{
this
.
nodeInfo
.
id
=
0
;
this
.
add
();
},
add
()
{
this
.
curId
=
0
;
this
.
title
=
"新增"
;
this
.
detail
=
()
=>
import
(
"./add"
);
this
.
modal
=
true
;
},
edit
()
{
this
.
curId
=
this
.
nodeInfo
.
id
;
this
.
title
=
"编辑"
;
this
.
detail
=
()
=>
import
(
"./edit"
);
this
.
modal
=
true
;
},
remove
()
{
console
.
log
(
this
.
nodeInfo
);
if
(
this
.
nodeInfo
.
children
.
length
>
1
)
{
this
.
$Message
.
error
(
"因为有子级,不能直接删除"
);
}
else
{
this
.
$Modal
.
confirm
({
title
:
"删除"
,
content
:
"<p>您确定要删除吗?</p>"
,
onOk
:
()
=>
{
Api
.
delete
(
this
.
nodeInfo
.
id
).
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
loadTree
();
this
.
$Message
.
success
(
"删除成功"
);
}
});
},
onCancel
:
()
=>
{
this
.
$Message
.
success
(
"取消删除"
);
}
});
}
},
cancel
()
{
this
.
curId
=
0
;
this
.
modal
=
false
;
},
renderContent
(
h
,
{
root
,
node
,
data
})
{
return
h
(
"span"
,
{
on
:
{
//右键点击事件
contextmenu
:
e
=>
{
e
.
preventDefault
();
this
.
$refs
.
contentMenu
.
$refs
.
reference
=
event
.
target
;
this
.
$refs
.
contentMenu
.
currentVisible
=
!
this
.
$refs
.
contentMenu
.
currentVisible
;
this
.
nodeInfo
=
data
;
}
}
},
data
.
title
);
},
loadTree
()
{
Api
.
getleveltree
().
then
(
r
=>
{
setTree
(
r
.
result
);
...
...
@@ -61,8 +154,8 @@ export default {
this
.
expand
=
!
this
.
expand
;
},
change
(
v
,
b
)
{
console
.
log
(
v
)
console
.
log
(
b
)
console
.
log
(
v
)
;
console
.
log
(
b
);
let
ids
=
[];
ids
.
push
(
b
.
value
);
if
(
b
.
children
)
{
...
...
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