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
a91d33f2
Commit
a91d33f2
authored
Jun 09, 2020
by
仇晓婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物料主数据
parent
900731c6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
848 additions
and
158 deletions
+848
-158
add.vue
pages/materiel/classification/add.vue
+1
-1
index.vue
pages/materiel/classification/index.vue
+7
-6
masterData.vue
pages/materiel/classification/masterData.vue
+18
-25
add.vue
pages/materiel/classification/masterData/add.vue
+0
-116
add.vue
pages/materiel/masterData/add.vue
+135
-0
api.js
pages/materiel/masterData/api.js
+22
-0
edit.vue
pages/materiel/masterData/edit.vue
+245
-0
index.vue
pages/materiel/masterData/index.vue
+246
-10
masterData.vue
pages/materiel/masterData/masterData.vue
+174
-0
No files found.
pages/materiel/classification/add.vue
View file @
a91d33f2
...
...
@@ -184,7 +184,7 @@ export default {
if
(
r
.
result
)
{
var
arr
=
r
.
result
;
this
.
checkList
=
arr
.
filter
(
function
(
item
)
{
delete
item
[
"id"
];
delete
item
[
"id"
];
//删除属性id
return
item
;
});
}
...
...
pages/materiel/classification/index.vue
View file @
a91d33f2
...
...
@@ -53,7 +53,7 @@
</a>
</div>
<Content
:class=
"!showMenu?'con_bord':''"
>
<MasterData
ref=
"dataTable"
@
on-edit=
"edit"
/>
<MasterData
ref=
"dataTable"
@
on-edit=
"edit
Row
"
/>
</Content>
</Layout>
<Modal
v-model=
"modal"
:title=
"title"
width=
"1000"
footer-hide
:mask-closable=
"false"
>
...
...
@@ -69,7 +69,7 @@
</div>
</
template
>
<
script
>
import
MasterData
from
"./masterData"
;
import
MasterData
from
"./masterData
.vue
"
;
import
Api
from
"./api"
;
export
default
{
...
...
@@ -127,10 +127,11 @@ export default {
this
.
detail
=
()
=>
import
(
"./sonAdd"
);
this
.
modal
=
true
;
},
edit
(
row
)
{
if
(
row
)
{
this
.
nodeInfo
=
row
;
}
editRow
(
row
)
{
this
.
nodeInfo
=
row
;
this
.
edit
();
},
edit
()
{
if
(
this
.
nodeInfo
.
upId
==
0
)
{
this
.
detail
=
()
=>
import
(
"./edit"
);
this
.
$refs
.
chlidren
.
arr
=
[];
...
...
pages/materiel/classification/masterData
/index
.vue
→
pages/materiel/classification/masterData.vue
View file @
a91d33f2
<
template
>
<div
class=
"master-data"
>
<Table
stripe
:columns=
"columns"
:data=
"dataColumns
"
></Table>
<Table
border
:columns=
"columns"
:data=
"dataColumns"
:height=
"tableHeight
"
></Table>
</div>
</
template
>
<
script
>
import
Api
from
".
.
/api"
;
import
Api
from
"./api"
;
export
default
{
name
:
"masterData"
,
data
()
{
return
{
action
:
""
,
detail
:
null
,
modal
:
false
,
curId
:
0
,
tableHeight
:
""
,
dataColumns
:
[],
title
:
""
,
columns
:
[
// {
// key: "index",
...
...
@@ -46,6 +42,11 @@ export default {
});
}
},
{
key
:
"banben"
,
title
:
"版本"
,
align
:
"left"
},
{
key
:
"description"
,
title
:
"描述"
,
...
...
@@ -85,8 +86,16 @@ export default {
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
// this.dataColumns = this.dataTable;
// console.log(this.dataColumns)
this
.
tableHeight
=
window
.
innerHeight
-
150
;
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
tableHeight
=
window
.
innerHeight
-
150
;
})();
};
},
methods
:
{
edit
(
row
)
{
...
...
@@ -108,22 +117,6 @@ export default {
this
.
$Message
.
success
(
"取消删除"
);
}
});
},
add
()
{
this
.
modal
=
true
;
this
.
detail
=
()
=>
import
(
"./add"
);
},
search
()
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
},
ok
()
{
// this.$refs.grid.load();
this
.
modal
=
false
;
this
.
curId
=
0
;
},
cancel
()
{
this
.
curId
=
0
;
this
.
modal
=
false
;
}
}
};
...
...
pages/materiel/classification/masterData/add.vue
deleted
100644 → 0
View file @
900731c6
<
template
>
<div>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
<FormItem
label=
"编码"
prop=
"userUnit"
>
<Input
v-model=
"entity.userUnit"
placeholder=
"请输入"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
label=
"名称"
prop=
"taskBased"
>
<Input
v-model=
"entity.taskBased"
placeholder=
"请输入"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
label=
"状态"
prop=
"productName"
placeholder=
"请选择"
>
<Select
v-model=
"entity.productName"
style=
"width:200px"
>
<Option
value=
"0"
>
New York
</Option>
<Option
value=
"1"
disabled
>
London
</Option>
<Option
value=
"2"
>
Sydney
</Option>
</Select>
</FormItem>
</Col>
<Col
:span=
"24"
>
<FormItem
label=
"描述"
prop=
"productName"
>
<Input
v-model=
"entity.productName"
type=
"textarea"
placeholder=
"请输入..."
></Input>
</FormItem>
</Col>
<Col
:span=
"24"
>
<h4>
属性配置
</h4>
</Col>
<Col
:span=
"24"
style=
"padding:20px 0 0px 10px;margin-bottom:10px;"
class=
"table-solt"
>
<Table
border
:columns=
"columns"
:data=
"checkList"
class=
"tableCommon"
>
<template
slot-scope=
"
{ row, index }" slot="name">
<Input
v-model=
"row.name"
placeholder=
"请输入"
@
on-blur=
"setRow(row,index)"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"require"
>
<Input
v-model=
"row.require"
placeholder=
"请输入"
@
on-blur=
"setRow(row,index)"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"result"
>
<Input
v-model=
"row.result"
placeholder=
"请输入"
@
on-blur=
"setRow(row,index)"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"pash"
>
<inputFile
v-model=
"row.file"
:files=
"true"
:parms=
"getParams(row.fileId)"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"remark"
>
<Input
v-model=
"row.remark"
placeholder=
"请输入"
@
on-blur=
"setRow(row,index)"
/>
</
template
>
</Table>
</Col>
<Col
:span=
"24"
style=
"margin-bottom:20px;"
>
<Button
type=
"primary"
long
@
click=
"addNew"
class=
"mt10"
>
添加
</Button>
</Col>
<Col
:span=
"24"
style=
"text-align: right;"
>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<
script
>
export
default
{
data
()
{
return
{
entity
:
{},
disabled
:
false
,
columns
:
[
{
title
:
"序号"
,
type
:
"index"
,
width
:
80
,
align
:
"center"
},
{
title
:
"检验项目"
,
key
:
"name"
,
align
:
"center"
,
slot
:
"name"
},
{
title
:
"要求"
,
key
:
"require"
,
align
:
"center"
,
slot
:
"require"
},
{
title
:
"预测结果"
,
key
:
"result"
,
align
:
"center"
,
slot
:
"result"
}
],
checkList
:
[],
rules
:
{
businessName
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
businessCode
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
}
};
},
methods
:
{
setRow
()
{
this
.
checkList
=
r
.
result
;
},
addNew
()
{},
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{});
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
}
}
};
</
script
>
pages/materiel/masterData/add.vue
0 → 100644
View file @
a91d33f2
<
template
>
<div>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
<FormItem
label=
"编码"
prop=
"code"
>
<Input
v-model=
"entity.code"
placeholder=
"请输入"
disabled
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
label=
"名称"
prop=
"name"
>
<Input
v-model=
"entity.name"
placeholder=
"请输入"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
label=
"状态"
prop=
"status"
placeholder=
"请选择"
>
<Dictionary
code=
"materail.category.status"
v-model=
"entity.status"
type=
"select"
:value=
"entity.status"
:key=
"entity.status"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
label=
"版本"
prop=
"banben"
>
<Input
v-model=
"entity.banben"
placeholder=
"请输入"
></Input>
</FormItem>
</Col>
<Col
:span=
"24"
>
<FormItem
label=
"描述"
prop=
"description"
>
<Input
v-model=
"entity.description"
type=
"textarea"
placeholder=
"请输入..."
></Input>
</FormItem>
</Col>
<Col
:span=
"24"
style=
"text-align: right;"
>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</
template
>
<
script
>
import
Api
from
"./api"
;
export
default
{
data
()
{
return
{
arr
:
[],
entity
:
{
upId
:
0
,
code
:
0
},
disabled
:
false
,
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
}
};
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
mounted
()
{
// this.tableData();
},
methods
:
{
tableData
()
{
let
conditions
=
[
{
conditionalType
:
"In"
,
fieldName
:
"fieldType"
,
fieldValue
:
"1,2"
},
{
conditionalType
:
"Equal"
,
fieldName
:
"categoryId"
,
fieldValue
:
"0"
}
];
Api
.
listTable
({
conditions
:
conditions
}).
then
(
r
=>
{
if
(
r
.
result
)
{
var
arr
=
r
.
result
;
this
.
checkList
=
arr
.
filter
(
function
(
item
)
{
delete
item
[
"id"
];
return
item
;
});
}
});
},
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
);
}
},
setRow
(
row
,
index
)
{
this
.
$set
(
this
.
checkList
,
index
,
row
);
},
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
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("保存失败");
// });
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
}
}
};
</
script
>
pages/materiel/masterData/api.js
0 → 100644
View file @
a91d33f2
import
Api
from
'@/plugins/request'
export
default
{
listTable
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/custompropertydefinition/list`
,
params
);
},
list
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/category/list`
,
params
);
},
get
(
params
){
return
Api
.
get
(
`
${
systemUrl
}
/category/get`
,
params
);
},
create
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/category/create`
,
params
);
},
update
(
params
){
return
Api
.
post
(
`
${
systemUrl
}
/category/update`
,
params
);
},
delete
(
id
)
{
return
Api
.
delete
(
`
${
systemUrl
}
/category/delete`
,{
params
:{
id
:
id
}});
},
}
\ No newline at end of file
pages/materiel/masterData/edit.vue
0 → 100644
View file @
a91d33f2
<
template
>
<div>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<!--
<Col
:span=
"12"
>
<FormItem
label=
"编码"
prop=
"code"
>
<Input
v-model=
"entity.code"
placeholder=
"请输入"
disabled
></Input>
</FormItem>
</Col>
-->
<Col
:span=
"12"
>
<FormItem
label=
"名称"
prop=
"name"
>
<Input
v-model=
"entity.name"
placeholder=
"请输入"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
label=
"状态"
prop=
"status"
placeholder=
"请选择"
>
<Dictionary
code=
"materail.category.status"
v-model=
"entity.status"
type=
"select"
:value=
"entity.status"
:key=
"entity.status"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"24"
>
<FormItem
label=
"描述"
prop=
"description"
>
<Input
v-model=
"entity.description"
type=
"textarea"
placeholder=
"请输入..."
></Input>
</FormItem>
</Col>
<Col
:span=
"24"
>
<h4>
属性配置
</h4>
</Col>
<Col
:span=
"24"
style=
"padding:20px 0 0px 10px;margin-bottom:10px;"
class=
"table-solt"
>
<!--fieldType 1.固有,2.默认,3自定义; -->
<Table
border
:columns=
"columns"
:data=
"checkList"
class=
"tableCommon"
height=
"300"
>
<template
slot-scope=
"
{ row, index }" slot="title">
<div
v-if=
"row.fieldType==1||row.fieldType==2"
>
{{
row
.
title
}}
</div>
<Input
v-else
v-model=
"row.title"
placeholder=
"请输入"
@
on-blur=
"setRow(row,index)"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"note"
>
<div
v-if=
"row.fieldType==1"
>
{{
row
.
note
}}
</div>
<Input
v-model=
"row.note"
placeholder=
"请输入"
@
on-blur=
"setRow(row,index)"
v-else
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"dataType"
>
<state
v-if=
"row.fieldType==1"
code=
"materail.category.dataType"
:value=
"row.dataType"
type=
"text"
></state>
<Dictionary
v-else
code=
"materail.category.dataType"
type=
"select"
:value=
"row.dataType"
:key=
"row.dataType"
></Dictionary>
</
template
>
<!-- <template slot-scope="{ row, index }" slot="result">
<Input v-model="row.result" placeholder="请输入" @on-blur="setRow(row,index)" />
</template>-->
<
template
slot-scope=
"{ row, index }"
slot=
"required"
>
<Checkbox
v-model=
"row.required"
@
on-change=
"setRow(row,index)"
></Checkbox>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"isUnique"
>
<Checkbox
v-model=
"row.isUnique"
@
on-change=
"setRow(row,index)"
></Checkbox>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"action"
v-if=
"row.fieldType==2||row.fieldType==3"
>
<a
@
click=
"remove(index,row)"
style=
"color:#FF7A8B"
>
删除
</a>
</
template
>
</Table>
</Col>
<Col
:span=
"24"
style=
"margin-bottom:20px;"
>
<Button
type=
"primary"
long
@
click=
"addNew"
class=
"mt10"
>
添加
</Button>
</Col>
<Col
:span=
"24"
style=
"text-align: right;"
>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<
script
>
import
Api
from
"./api"
;
export
default
{
props
:
[
"nodeInfo"
],
data
()
{
return
{
entity
:
{
upId
:
0
,
code
:
0
},
arr
:
[],
disabled
:
false
,
columns
:
[
{
title
:
"序号"
,
type
:
"index"
,
width
:
80
,
align
:
"center"
},
{
title
:
"属性名称"
,
key
:
"title"
,
align
:
"center"
,
slot
:
"title"
},
{
title
:
"备注"
,
key
:
"note"
,
align
:
"center"
,
slot
:
"note"
},
{
title
:
"属性类型"
,
key
:
"dataType"
,
align
:
"center"
,
slot
:
"dataType"
},
// {
// title: "是否显示",
// key: "result",
// align: "center",
// slot: "result"
// },
{
title
:
"是否必填"
,
key
:
"required"
,
align
:
"center"
,
slot
:
"required"
},
{
title
:
"是否唯一属性"
,
key
:
"isunique"
,
align
:
"center"
,
slot
:
"isunique"
},
{
title
:
"操作"
,
slot
:
"action"
,
width
:
100
,
align
:
"center"
}
],
checkList
:
[],
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
}
};
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
mounted
()
{
this
.
get
();
},
methods
:
{
get
()
{
Api
.
get
({
id
:
this
.
nodeInfo
.
id
}).
then
(
r
=>
{
if
(
r
.
result
)
{
this
.
entity
=
r
.
result
;
this
.
tableData
();
}
});
},
tableData
()
{
let
conditions
=
[
{
conditionalType
:
"Equal"
,
fieldName
:
"categoryId"
,
fieldValue
:
this
.
nodeInfo
.
id
}
];
Api
.
listTable
({
conditions
:
conditions
}).
then
(
r
=>
{
if
(
r
.
result
)
{
console
.
log
(
r
);
this
.
checkList
=
r
.
result
;
}
});
},
remove
(
index
,
row
)
{
if
(
row
.
add
==
0
)
{
this
.
checkList
.
splice
(
index
,
1
);
}
else
{
row
.
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
);
},
addNew
()
{
let
arr
=
this
.
$u
.
clone
(
this
.
checkList
);
let
obj
=
{
title
:
""
,
note
:
""
,
dataType
:
""
,
required
:
false
,
isunique
:
false
,
fieldType
:
3
,
categoryId
:
0
,
action
:
1
,
add
:
0
};
arr
.
push
(
obj
);
this
.
checkList
=
arr
;
},
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
if
(
v
)
{
let
categoryDto
=
this
.
entity
;
let
pro
=
this
.
checkList
.
concat
(
this
.
arr
);
Api
.
update
({
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
(
"保存失败"
);
});
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
}
}
};
</
script
>
pages/materiel/masterData/index.vue
View file @
a91d33f2
<
template
>
<div
class=
"master-data"
>
<Button
type=
"dashed"
@
click=
"datail"
>
详情
</Button>
<div
class=
"classification"
>
<Layout>
<Sider
width=
"300"
v-if=
"showMenu"
>
<div
class=
"p-list"
>
<h3>
零部件库
<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=
"md-refresh"
title=
"刷新"
@
click=
"loadTree"
></Button>
<Button
icon=
"md-rewind"
title=
"收起"
@
click=
"hide"
></Button>
</ButtonGroup>
</div>
</h3>
<div
class=
"search"
>
<Input
search
placeholder=
"关键字"
v-model=
"keys"
clearable
/>
</div>
<div
class=
"fg"
>
<div
class=
"tree"
>
<Tree
:data=
"data"
ref=
"tree"
@
on-select-change=
"change"
:render=
"renderContent"
></Tree>
</div>
</div>
</div>
</Sider>
<div
v-if=
"!showMenu"
class=
"show_menu"
>
<a
class=
"menu_play fr"
@
click=
"showMenuFn"
title=
"展开"
>
<Icon
type=
"ios-arrow-forward"
size=
"24"
/>
</a>
</div>
<Content
:class=
"!showMenu?'con_bord':''"
>
<MasterData
ref=
"dataTable"
@
on-edit=
"edit"
/>
</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
>
import
MasterData
from
"./masterData.vue"
;
import
Api
from
"./api"
;
export
default
{
components
:
{
MasterData
},
name
:
"masterData"
,
data
()
{
return
{};
return
{
keys
:
""
,
expand
:
false
,
list
:
[],
nodeInfo
:
{},
modal
:
false
,
title
:
"新增"
,
curId
:
0
,
detail
:
null
,
showMenu
:
true
,
dataList
:
[]
};
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
this
.
loadTree
();
},
methods
:
{
datail
()
{
this
.
$router
.
push
({
path
:
"/materiel/masterData/details"
showMenuFn
()
{
//this.$Message.info("展开左侧树")
this
.
showMenu
=
true
;
},
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
);
}
});
}
},
cancel
()
{
this
.
curId
=
0
;
this
.
modal
=
false
;
},
renderContent
(
h
,
{
root
,
node
,
data
})
{
return
h
(
"span"
,
{
on
:
{
click
:
()
=>
{
this
.
handleSelect
(
data
);
//手动选择树节点
}
}
},
data
.
title
);
},
handleSelect
(
data
)
{},
loadTree
()
{
let
conditions
=
[];
Api
.
list
({
conditions
:
conditions
}).
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
()
{
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);
},
hide
()
{
this
.
showMenu
=
false
;
}
},
computed
:
{
data
()
{
let
items
=
this
.
$u
.
clone
(
this
.
list
);
let
expand
=
this
.
expand
;
let
result
=
[];
search
(
this
.
keys
,
items
);
function
search
(
keys
,
data
)
{
data
.
map
(
u
=>
{
if
(
keys
.
length
<
u
.
title
)
{
u
.
expand
=
expand
;
result
.
push
(
u
);
}
else
{
u
.
expand
=
expand
;
if
(
u
.
title
.
indexOf
(
keys
)
>
-
1
)
{
result
.
push
(
u
);
}
else
if
(
u
.
children
)
{
search
(
keys
,
u
.
children
);
}
}
});
}
return
result
;
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.master-data {
width: 100%;
height: 100%;
<
style
lang=
"less"
>
.classification {
font-family: Microsoft YaHei;
.ivu-layout-sider {
background: rgba(255, 255, 255, 1);
margin-right: 10px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
height: 87vh;
h4 {
height: 30px;
line-height: 30px;
background: #eee;
padding-left: 10px;
}
.p-list {
h3 {
height: 50px;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: bold;
line-height: 50px;
color: rgba(81, 90, 110, 1);
background: rgba(245, 246, 250, 1);
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;
position: fixed;
top: 100px;
left: 0;
z-index: 9;
.menu_play {
width: 30px;
height: 30px;
line-height: 34px;
font-size: 14px;
text-align: center;
color: #515a6e;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
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);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
overflow: auto;
padding: 10px;
height: 87vh;
overflow-y: hidden;
}
}
</
style
>
\ No newline at end of file
pages/materiel/masterData/masterData.vue
0 → 100644
View file @
a91d33f2
<
template
>
<div
class=
"master-data"
>
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
>
<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>
<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
>
import
Api
from
"./api"
;
// import Search from "./search";
export
default
{
name
:
"masterData"
,
components
:
{
// Search
},
data
()
{
return
{
action
:
""
,
modal
:
false
,
title
:
"新增"
,
curId
:
0
,
detail
:
null
,
easySearch
:
{
keys
:
{
op
:
"unicode,name,code"
,
value
:
null
}
},
columns
:
[
// {
// key: "index",
// title: "#",
// align: "left",
// width: 60
// },
{
key
:
"code"
,
title
:
"编码"
,
align
:
"left"
},
{
key
:
"name"
,
title
:
"名称"
,
align
:
"left"
},
{
key
:
"status"
,
title
:
"状态"
,
align
:
"left"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"state"
,
{
props
:
{
code
:
"materail.category.status"
,
type
:
"text"
,
value
:
params
.
row
.
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"
},
on
:
{
click
:
()
=>
this
.
edit
(
params
.
row
)
}
},
"编辑"
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"delete"
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
.
id
)
}
},
params
.
row
.
children
==
0
?
"删除"
:
""
)
]);
}
}
]
};
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
// this.dataColumns = this.dataTable;
// console.log(this.dataColumns)
},
methods
:
{
search
()
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
},
add
()
{
this
.
curId
=
0
;
this
.
title
=
"新增"
;
this
.
detail
=
()
=>
import
(
"./Add"
);
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
(
"取消删除"
);
}
});
},
ok
()
{
// this.loadTree();
this
.
modal
=
false
;
this
.
curId
=
0
;
},
cancel
()
{
this
.
curId
=
0
;
this
.
modal
=
false
;
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.spare-parts {
width: 100%;
height: 100%;
}
</
style
>
\ No newline at end of file
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