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
705b5f77
Commit
705b5f77
authored
Jun 12, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt
parents
c01fed9e
0c22ad29
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
230 additions
and
130 deletions
+230
-130
api.js
pages/materiel/classification/api.js
+4
-0
index.vue
pages/materiel/classification/index.vue
+47
-36
masterData.vue
pages/materiel/classification/masterData.vue
+73
-29
edit.vue
pages/materiel/masterData/edit.vue
+14
-12
index.vue
pages/materiel/masterData/index.vue
+34
-16
masterData.vue
pages/materiel/masterData/masterData.vue
+58
-37
No files found.
pages/materiel/classification/api.js
View file @
705b5f77
import
Api
from
'@/plugins/request'
export
default
{
index
:
`
${
systemUrl
}
/category/paged`
,
paged
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/category/paged`
,
params
);
},
listTable
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/custompropertydefinition/list`
,
params
);
},
...
...
pages/materiel/classification/index.vue
View file @
705b5f77
...
...
@@ -53,7 +53,7 @@
</a>
</div>
<Content
:class=
"!showMenu?'con_bord':''"
>
<MasterData
ref=
"dataTable"
@
on-edit=
"editRow"
/>
<MasterData
ref=
"dataTable"
@
on-edit=
"editRow"
:root=
"root"
@
on-ok=
"ok"
/>
</Content>
</Layout>
<Modal
v-model=
"modal"
:title=
"title"
width=
"1000"
footer-hide
:mask-closable=
"false"
>
...
...
@@ -79,6 +79,10 @@ export default {
name
:
"classification"
,
data
()
{
return
{
root
:
{
id
:
0
,
ids
:
[]
},
keys
:
""
,
expand
:
false
,
list
:
[],
...
...
@@ -106,13 +110,13 @@ export default {
this
.
loadTree
();
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
);
}
});
}
//
if (row) {
//
this.dataList.map((e, index) => {
//
if (e.id == row.id) {
//
this.$set(this.$refs.dataTable.dataColumns, index, row);
//
}
//
});
//
}
},
addNew
()
{
this
.
curId
=
0
;
...
...
@@ -186,34 +190,40 @@ export default {
}
}
},
data
.
title
data
.
title
+
"("
+
(
data
.
totalMaterialCount
==
undefined
?
"0"
:
data
.
totalMaterialCount
)
+
")"
);
},
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
;
}
//
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
()
{
let
conditions
=
[];
...
...
@@ -238,19 +248,20 @@ export default {
// console.log(v);
// console.log(b);
let
ids
=
[];
ids
.
push
(
b
.
value
);
ids
.
push
(
b
.
id
);
if
(
b
.
children
)
{
addId
(
b
.
children
);
function
addId
(
data
)
{
data
.
map
(
u
=>
{
ids
.
push
(
u
.
value
);
ids
.
push
(
u
.
id
);
if
(
u
.
children
)
{
addId
(
u
.
children
);
}
});
}
}
// this.$emit("on-select", b.value, b, ids);
this
.
root
.
ids
=
ids
;
this
.
root
.
id
=
b
.
id
;
},
hide
()
{
this
.
showMenu
=
false
;
...
...
pages/materiel/classification/masterData.vue
View file @
705b5f77
<
template
>
<div
class=
"master-data"
>
<Table
border
:columns=
"columns"
:data=
"dataColumns"
:height=
"tableHeight"
></Table>
<!--
<Table
border
:columns=
"columns"
:data=
"dataColumns"
:height=
"tableHeight"
></Table>
-->
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
:high=
"false"
:height=
"750"
>
<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="searchForm">
<Search />
</template>-->
<!-- <template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>-->
</DataGrid>
</div>
</template>
<
script
>
import
Api
from
"./api"
;
export
default
{
name
:
"masterData"
,
props
:
[
"root"
],
data
()
{
return
{
action
:
Api
.
index
,
tableHeight
:
""
,
dataColumns
:
[],
easySearch
:
{
keys
:
{
op
:
"code,name"
,
value
:
null
},
id
:
{
op
:
"In"
,
value
:
this
.
root
.
ids
}
},
columns
:
[
// {
// key: "index",
...
...
@@ -32,21 +62,18 @@ export default {
key
:
"status"
,
title
:
"状态"
,
align
:
"left"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"state"
,
{
props
:
{
code
:
"materail.category.status"
,
type
:
"text"
,
value
:
params
.
row
.
status
+
""
}
});
}
},
{
key
:
"banben"
,
title
:
"版本"
,
align
:
"left"
code
:
"materail.category.status"
// render: (h, params) => {
// return h("state", {
// props: {
// code: "materail.category.status",
// type: "text",
// value: params.row.status + ""
// }
// });
// }
},
{
key
:
"description"
,
title
:
"描述"
,
...
...
@@ -74,7 +101,7 @@ export default {
attrs
:
{
oprate
:
"delete"
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
.
id
)
}
},
params
.
row
.
children
==
0
?
"删除"
:
"
"
"删除
"
)
]);
}
...
...
@@ -98,26 +125,43 @@ export default {
};
},
methods
:
{
search
()
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
},
edit
(
row
)
{
this
.
$emit
(
"on-edit"
,
row
);
},
remove
(
id
)
{
this
.
$Modal
.
confirm
({
title
:
"删除"
,
content
:
"<p>您确定要删除吗?</p>"
,
onOk
:
()
=>
{
Api
.
delete
(
id
).
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
loadTree
();
this
.
$Message
.
success
(
"删除成功"
);
}
});
},
onCancel
:
()
=>
{
this
.
$Message
.
success
(
"取消删除"
);
Api
.
delete
(
id
).
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
$emit
(
"on-ok"
);
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
this
.
$Message
.
success
(
"删除成功"
);
}
});
}
// this.$Modal.confirm({
// title: "删除",
// content: "
<
p
>
您确定要删除吗?
<
/p>"
,
// onOk: () => {
// onCancel: () => {
// this.$Message.success("取消删除");
// }
// });
// }
},
watch
:
{
root
:
{
handler
(
newName
,
oldName
)
{
this
.
easySearch
.
id
.
value
=
newName
.
ids
;
if
(
newName
.
id
)
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
}
},
immediate
:
true
,
deep
:
true
}
}
};
</
script
>
...
...
pages/materiel/masterData/edit.vue
View file @
705b5f77
<
template
>
<div>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
...
...
@@ -46,12 +47,12 @@
<
script
>
import
Api
from
"./api"
;
export
default
{
props
:
[
"nodeInfo"
],
props
:
[
"nodeInfo"
,
'eid'
],
data
()
{
return
{
arr
:
[],
entity
:
{
id
:
this
.
nodeInfo
.
id
,
id
:
this
.
e
id
,
code
:
0
,
categoryId
:
this
.
nodeInfo
.
categoryId
,
//左侧树点击的id
customProperties
:
{},
...
...
@@ -71,7 +72,7 @@ export default {
},
methods
:
{
get
()
{
Api
.
get
({
id
:
this
.
nodeInfo
.
id
}).
then
(
r
=>
{
Api
.
get
({
id
:
this
.
e
id
}).
then
(
r
=>
{
if
(
r
.
result
)
{
this
.
entity
=
r
.
result
;
}
...
...
@@ -79,15 +80,16 @@ export default {
},
remove
(
index
,
row
)
{
if
(
row
.
add
==
0
)
{
//新增的删除,直接删
this
.
checkList
.
splice
(
index
,
1
);
}
else
{
row
.
action
=
2
;
//返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
this
.
$set
(
this
.
checkList
,
index
,
row
);
this
.
arr
.
push
(
row
);
this
.
checkList
.
splice
(
index
,
1
);
}
// if (row.add == 0) {
// //新增的删除,直接删
// this.checkList.splice(index, 1);
// } else {
// row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
// this.$set(this.checkList, index, row);
// this.arr.push(row);
// this.checkList.splice(index, 1);
// }
},
setRow
(
row
,
index
)
{
this
.
$set
(
this
.
checkList
,
index
,
row
);
...
...
pages/materiel/masterData/index.vue
View file @
705b5f77
...
...
@@ -34,7 +34,7 @@
</a>
</div>
<Content
:class=
"!showMenu?'con_bord':''"
>
<MasterData
ref=
"dataTable"
:nodeInfo=
"nodeInfo"
/>
<MasterData
ref=
"dataTable"
:nodeInfo=
"nodeInfo"
@
on-ok=
"ok"
/>
</Content>
</Layout>
</div>
...
...
@@ -55,7 +55,8 @@ export default {
list
:
[],
nodeInfo
:
{
categoryId
:
0
,
rootCategoryId
:
0
rootCategoryId
:
0
,
ids
:
[]
},
modal
:
false
,
title
:
"新增"
,
...
...
@@ -78,15 +79,15 @@ export default {
},
ok
(
row
)
{
this
.
loadTree
();
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
);
}
});
}
//
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
;
...
...
@@ -102,12 +103,15 @@ export default {
}
}
},
data
.
title
data
.
title
+
"("
+
(
data
.
totalMaterialCount
==
undefined
?
"0"
:
data
.
totalMaterialCount
)
+
")"
);
},
handleSelect
(
root
,
data
)
{
// console.log(root);
let
pid
=
null
;
//定义最顶级id
let
upId
=
data
.
upId
;
let
roots
=
root
;
...
...
@@ -124,7 +128,6 @@ export default {
});
}
addId
(
roots
,
upId
);
this
.
nodeInfo
.
categoryId
=
data
.
id
;
if
(
pid
==
null
)
{
this
.
nodeInfo
.
rootCategoryId
=
data
.
id
;
...
...
@@ -151,7 +154,22 @@ export default {
toggle
()
{
this
.
expand
=
!
this
.
expand
;
},
change
(
v
,
b
)
{},
change
(
v
,
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
.
nodeInfo
.
ids
=
ids
;
},
hide
()
{
this
.
showMenu
=
false
;
}
...
...
pages/materiel/masterData/masterData.vue
View file @
705b5f77
<
template
>
<div
class=
"master-data"
>
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
:initsearch=
"sets"
:high=
"false"
>
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
:initsearch=
"sets"
:high=
"false"
:height=
"750"
>
<template
slot=
"easySearch"
>
<Form
ref=
"formInline"
:model=
"easySearch"
inline
>
<FormItem
prop=
"keys"
>
...
...
@@ -56,15 +64,11 @@ export default {
v
.
rootCategoryId
=
this
.
nodeInfo
.
rootCategoryId
;
},
easySearch
:
{
keys
:
{
op
:
"Code,Name"
,
value
:
null
}
// categoryId: {
// op: "In",
// value: this.nodeInfo.categoryId
// },
// rootCategoryId: {
// op: "In",
// value: this.nodeInfo.rootCategoryId
// }
keys
:
{
op
:
"code,name"
,
value
:
null
},
categoryId
:
{
op
:
"In"
,
value
:
this
.
nodeInfo
.
ids
}
},
columns
:
[
// {
...
...
@@ -74,7 +78,7 @@ export default {
// width: 60
// },
{
key
:
"
C
ode"
,
key
:
"
c
ode"
,
title
:
"编码"
,
align
:
"left"
,
render
:
(
h
,
params
)
=>
{
...
...
@@ -86,17 +90,17 @@ export default {
click
:
()
=>
this
.
details
(
params
.
row
)
}
},
params
.
row
.
C
ode
params
.
row
.
c
ode
);
}
},
{
key
:
"
N
ame"
,
key
:
"
n
ame"
,
title
:
"名称"
,
align
:
"left"
},
{
key
:
"
S
tatus"
,
key
:
"
s
tatus"
,
title
:
"状态"
,
align
:
"left"
,
render
:
(
h
,
params
)
=>
{
...
...
@@ -104,18 +108,18 @@ export default {
props
:
{
code
:
"materail.category.status"
,
type
:
"text"
,
value
:
params
.
row
.
S
tatus
+
""
value
:
params
.
row
.
s
tatus
+
""
}
});
}
},
{
key
:
"
V
ersion"
,
key
:
"
v
ersion"
,
title
:
"版本"
,
align
:
"left"
},
{
key
:
"
D
escription"
,
key
:
"
d
escription"
,
title
:
"描述"
,
align
:
"left"
},
...
...
@@ -140,7 +144,7 @@ export default {
attrs
:
{
oprate
:
"delete"
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
.
id
)
}
},
params
.
row
.
children
==
0
?
"删除"
:
"
"
"删除
"
)
]);
}
...
...
@@ -151,7 +155,9 @@ export default {
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{},
created
()
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
},
methods
:
{
search
()
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
...
...
@@ -163,27 +169,37 @@ export default {
this
.
modal
=
true
;
},
edit
(
row
)
{
this
.
nodeInfo
.
id
=
row
.
Id
;
console
.
log
(
row
);
this
.
curId
=
row
.
id
;
this
.
title
=
"编辑"
;
this
.
detail
=
()
=>
import
(
"./edit"
);
this
.
modal
=
true
;
},
remove
(
id
)
{
this
.
$Modal
.
confirm
({
title
:
"删除"
,
content
:
"<p>您确定要删除吗?</p>"
,
onOk
:
()
=>
{
Api
.
delete
(
id
).
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
loadTree
();
this
.
$Message
.
success
(
"删除成功"
);
}
});
},
onCancel
:
()
=>
{
this
.
$Message
.
success
(
"取消删除"
);
alert
(
id
);
Api
.
delete
(
id
).
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
$emit
(
"on-ok"
);
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
this
.
$Message
.
success
(
"删除成功"
);
}
});
// this.$Modal.confirm({
// title: "删除",
// content: "
<
p
>
您确定要删除吗?
<
/p>"
,
// onOk: () => {
// alert(1);
// Api.delete({ id: this.eid }).then(r => {
// if (r.success) {
// this.$emit("on-ok");
// this.$Message.success("删除成功");
// }
// });
// },
// onCancel: () => {
// this.$Message.success("取消删除");
// }
// });
},
details
()
{
this
.
$router
.
push
({
...
...
@@ -201,10 +217,15 @@ export default {
}
},
watch
:
{
"nodeInfo.categoryId"
(
v
)
{
if
(
v
)
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
}
nodeInfo
:
{
handler
(
newName
,
oldName
)
{
this
.
easySearch
.
categoryId
.
value
=
newName
.
ids
;
if
(
newName
.
categoryId
)
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
}
},
immediate
:
true
,
deep
:
true
}
}
};
...
...
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