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
01580748
Commit
01580748
authored
Jul 13, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storeIndex、sotreTree、storeSelect、setNum......
parent
7295179d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
267 additions
and
195 deletions
+267
-195
storeSelect.vue
components/page/storeSelect.vue
+47
-108
storeTree.vue
components/page/storeTree.vue
+11
-14
add.vue
pages/material/add.vue
+33
-7
api.js
pages/material/api.js
+4
-1
index.vue
pages/material/index.vue
+71
-65
setNum.vue
pages/material/setNum.vue
+101
-0
No files found.
components/page/storeSelect.vue
View file @
01580748
<
template
>
<Select
v-model=
"dep"
:placeholder=
"placeholdeinfo"
clearable
@
on-clear=
"onClear"
>
<Option
v-for=
"(item,index) in list"
:key=
"index"
:value=
"item.value"
style=
"display:none"
:label=
"item.label"
></Option>
<Tree
key=
"mytree"
:data=
"data1"
ref=
"mytree"
:render=
"renderContent"
></Tree>
</Select>
<TreeSelect
v-model=
"dep"
:data=
"list"
@
on-change=
"change"
:disabled=
"disabled"
:multiple=
"multiple"
:transfer=
"true"
/>
</
template
>
<
script
>
export
default
{
...
...
@@ -21,15 +19,8 @@ export default {
return
{
dep
:
""
,
list
:
[],
data1
:
[],
selectdata
:
[],
placeholdeinfo
:
"请选择"
,
orderSearchForm
:
{
productId
:
null
,
//产品id
productName
:
""
,
//产品名称
drawingNo
:
""
,
//图号
bomId
:
null
//bomId
}
tempList
:[],
placeholdeinfo
:
"请选择"
};
},
props
:
{
...
...
@@ -49,108 +40,56 @@ export default {
},
mounted
()
{},
created
()
{
this
.
dep
=
this
.
value
|
""
;
this
.
loadTree
();
},
methods
:
{
handleSelect
(
data
)
{
if
(
data
.
length
>
0
)
{
this
.
selectdata
=
[];
this
.
selectdata
=
data
;
if
(
data
[
0
].
isProduct
==
"1"
)
{
this
.
list
=
[];
this
.
list
.
push
({
label
:
data
[
0
].
title
,
value
:
data
[
0
].
id
});
this
.
orderSearchForm
.
productName
=
data
[
0
].
title
;
this
.
orderSearchForm
.
productId
=
data
[
0
].
productId
;
this
.
orderSearchForm
.
drawingNo
=
data
[
0
].
drawingNo
;
this
.
orderSearchForm
.
bomId
=
data
[
0
].
bomId
;
this
.
$emit
(
"on-change"
,
this
.
orderSearchForm
.
productId
,
this
.
orderSearchForm
);
}
else
{
this
.
$Message
.
error
(
"此节点不是产品,请选择产品节点!"
);
}
}
},
resetFields
()
{
this
.
orderSearchForm
=
{
productId
:
null
,
//产品id
productName
:
""
,
//产品名称
drawingNo
:
""
,
//图号
bomId
:
null
};
},
loadTree
()
{
//打开新增订单窗口加载产品
this
.
resetFields
();
var
sumData
=
[];
this
.
$http
.
order
.
getallselecttree
().
then
(
res
=>
{
if
(
res
.
result
)
{
for
(
var
i
=
0
;
i
<
res
.
result
.
length
;
i
++
)
{
sumData
=
sumData
.
concat
(
res
.
result
[
i
]);
}
this
.
data1
=
sumData
;
}
else
{
this
.
$Message
.
error
(
"加载产品树失败!"
);
}
});
},
renderContent
(
h
,
{
root
,
node
,
data
})
{
//渲染树的样式
return
h
(
"span"
,
{
style
:
{
color
:
data
.
isProduct
!=
"1"
?
"#249E91"
:
"#333"
,
//根据选中状态设置样式
cursor
:
"pointer"
},
on
:
{
click
:
()
=>
{
let
arrTree
=
[];
arrTree
.
push
(
data
);
this
.
handleSelect
(
arrTree
);
//手动选择树节点
}
let
params
=
{
conditions
:
[
{
fieldName
:
"title"
,
fieldValue
:
name
,
conditionalType
:
"Like"
}
},
data
.
title
);
]
};
this
.
$api
.
post
(
`
${
resourceUrl
}
/storeroomlocation/paged`
,
params
)
.
then
(
r
=>
{
let
res
=
r
.
result
.
items
;
this
.
tempList
=
this
.
$u
.
clone
(
r
.
result
.
items
);
var
data
=
this
.
$u
.
toTree
(
res
,
0
,
u
=>
{
u
.
value
=
u
.
id
;
u
.
expand
=
true
;
u
.
selected
=
false
;
u
.
checked
=
false
;
},
"upId"
);
this
.
list
=
this
.
$u
.
clone
(
data
);
});
},
onClear
()
{
this
.
list
=
[];
this
.
placeholdeinfo
=
"请选择"
;
this
.
resetFields
();
this
.
$emit
(
"on-change"
,
null
,
this
.
orderSearchForm
);
change
(
v
)
{
// console.log(v);
this
.
dep
=
v
;
var
item
;
var
items
=
this
.
tempList
.
filter
(
u
=>
{
return
u
.
id
==
v
;
});
if
(
items
&&
items
.
length
>
0
)
{
item
=
items
[
0
];
}
this
.
$emit
(
"on-change"
,
v
,
item
);
}
},
watch
:
{
value
:
{
handler
(
v
,
o
)
{
this
.
dep
=
v
|
""
;
this
.
resetFields
();
var
sumData
=
[];
this
.
$http
.
order
.
getallselecttree
().
then
(
res
=>
{
if
(
res
.
result
)
{
for
(
var
i
=
0
;
i
<
res
.
result
.
length
;
i
++
)
{
sumData
=
sumData
.
concat
(
res
.
result
[
i
]);
}
this
.
data1
=
sumData
;
let
temData
=
this
.
$u
.
clone
(
this
.
data1
);
this
.
list
=
[];
if
(
v
!=
""
&&
v
!=
null
)
{
let
dataTemp
=
this
.
$u
.
treeToList
(
temData
);
dataTemp
.
forEach
(
data
=>
{
if
(
data
.
isProduct
==
1
&&
data
.
id
==
this
.
dep
)
{
this
.
placeholdeinfo
=
data
.
title
;
this
.
list
.
push
({
label
:
data
.
title
,
value
:
data
.
id
});
}
});
}
}
else
{
this
.
$Message
.
error
(
"加载产品树失败!"
);
}
});
},
deep
:
true
}
...
...
components/page/storeTree.vue
View file @
01580748
...
...
@@ -57,6 +57,7 @@ export default {
res
,
0
,
u
=>
{
u
.
value
=
u
.
id
u
.
expand
=
true
;
u
.
selected
=
false
;
u
.
checked
=
false
;
...
...
@@ -72,14 +73,14 @@ export default {
renderContent
(
h
,
{
root
,
node
,
data
})
{
let
type
=
"md-folder"
;
return
h
(
"span"
,
[
h
(
"Icon"
,
{
props
:
{
type
:
type
},
style
:
{
marginRight
:
"8px"
}
}),
//
h("Icon", {
//
props: {
//
type: type
//
},
//
style: {
//
marginRight: "8px"
//
}
//
}),
h
(
"span"
,
{
...
...
@@ -95,17 +96,13 @@ export default {
// console.log(b);
let
ids
=
[];
let
productIds
=
[];
if
(
b
.
bomId
!==
0
)
{
ids
.
push
(
b
.
bomId
);
}
ids
.
push
(
b
.
id
);
productIds
.
push
(
b
.
value
);
if
(
b
.
children
)
{
addId
(
b
.
children
);
function
addId
(
data
)
{
data
.
map
(
u
=>
{
if
(
u
.
bomId
!==
0
)
{
ids
.
push
(
u
.
bomId
);
}
ids
.
push
(
u
.
id
);
productIds
.
push
(
u
.
value
);
if
(
u
.
children
)
{
addId
(
u
.
children
);
...
...
pages/material/add.vue
View file @
01580748
...
...
@@ -2,13 +2,13 @@
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"12"
>
<FormItem
:label=
"l('name')"
prop=
"material
Code
"
>
<FormItem
:label=
"l('name')"
prop=
"material
Id
"
>
<Materiel
v-model=
"entity.materialId"
@
on-change=
"change"
></Materiel>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('storeTitle')"
prop=
"store
Title
"
>
<StoreSelect
v-model=
"entity.storeId"
></StoreSelect>
<FormItem
:label=
"l('storeTitle')"
prop=
"store
Id
"
>
<StoreSelect
v-model=
"entity.storeId"
@
on-change=
"storeChange"
></StoreSelect>
</FormItem>
</Col>
<Col
:span=
"12"
>
...
...
@@ -38,7 +38,7 @@
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('creator')"
prop=
"creator"
>
<
Input
v-model=
"entity.creator"
:disabled=
"true"
></Input
>
<
User
:value=
"entity.creator"
/
>
</FormItem>
</Col>
<Col
:span=
"24"
>
...
...
@@ -75,18 +75,40 @@ export default {
total
:
null
,
storeId
:
null
,
storeTitle
:
""
,
minNum
:
null
,
brand
:
""
,
specifications
:
""
,
batch
:
""
,
certificateOfApproval
:
""
,
creator
:
""
,
creator
:
this
.
$store
.
state
.
userInfo
.
userId
,
unitPrice
:
null
,
originalManufacturer
:
""
,
remark
:
""
},
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}]
materialId
:
[
{
required
:
true
,
message
:
"请选择物料"
,
type
:
"string"
,
trigger
:
"change"
}
],
storeId
:
[
{
required
:
true
,
message
:
"请选择库位"
,
type
:
"number"
,
trigger
:
"change"
}
],
total
:
[
{
required
:
true
,
message
:
"请输入入库数量"
,
type
:
"number"
,
trigger
:
"change"
}
]
}
};
},
...
...
@@ -136,6 +158,10 @@ export default {
this
.
entity
.
materialId
=
e
.
materialId
;
this
.
entity
.
materialCode
=
e
.
mmcode
;
},
storeChange
(
v
,
item
)
{
this
.
entity
.
storeId
=
item
.
id
;
this
.
entity
.
storeTitle
=
item
.
title
;
},
l
(
key
)
{
key
=
"stock"
+
"."
+
key
;
return
this
.
$t
(
key
);
...
...
pages/material/api.js
View file @
01580748
...
...
@@ -22,5 +22,8 @@ export default {
},
deletes
(
params
)
{
return
Api
.
post
(
`
${
resourceUrl
}
/stock/batchdelete`
,
params
);
}
},
setminnum
(
params
)
{
return
Api
.
post
(
`
${
resourceUrl
}
/stock/setminnum`
,
params
);
},
}
pages/material/index.vue
View file @
01580748
...
...
@@ -9,16 +9,11 @@
</a>
</div>
<Content
class=
"content"
:class=
"!showMenu?'con_bord':''"
>
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
:conditions=
"easySearch"
>
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
:conditions=
"easySearch"
>
<template
slot=
"easySearch"
>
<Form
ref=
"formInline"
:model=
"easySearch"
inline
>
<FormItem
prop=
"keys"
>
<Input
placeholder=
"请输入
关键字物料名称/库位名称"
v-model=
"easySearch.keys.value
"
/>
<Input
placeholder=
"请输入
物料名称/库位名称"
v-model=
"easySearch.keys.value"
v-width=
"240
"
/>
</FormItem>
<FormItem>
<Button
type=
"primary"
@
click=
"search"
>
查询
</Button>
...
...
@@ -70,8 +65,40 @@ export default {
easy
:
true
,
high
:
true
},
{
key
:
"total"
,
title
:
this
.
l
(
"total"
),
align
:
"left"
,
high
:
true
},
{
key
:
"minNum"
,
title
:
this
.
l
(
"minNum"
),
align
:
"left"
,
high
:
true
},
{
key
:
"total"
,
title
:
this
.
l
(
"total"
),
align
:
"right"
,
high
:
true
,
render
:
(
h
,
params
)
=>
{
let
minNum
=
0
if
(
params
.
row
.
minNum
)
{
minNum
=
params
.
row
.
minNum
}
return
h
(
"Tooltip"
,
{
props
:
{
content
:
"库存不足,总数小于"
+
minNum
,
placement
:
"top"
,
disabled
:
params
.
row
.
total
>
minNum
?
true
:
false
},
class
:
params
.
row
.
total
>
minNum
?
""
:
"red"
},
params
.
row
.
total
);
}
},
{
key
:
"minNum"
,
title
:
this
.
l
(
"minNum"
),
align
:
"right"
,
high
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{},
params
.
row
.
minNum
?
params
.
row
.
minNum
:
"0"
);
}
},
{
key
:
"storeTitle"
,
title
:
this
.
l
(
"storeTitle"
),
...
...
@@ -82,58 +109,54 @@ export default {
{
title
:
"操作"
,
key
:
"action"
,
width
:
14
0
,
width
:
28
0
,
align
:
"center"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
},
on
:
{
click
:
()
=>
this
.
view
(
params
.
row
.
id
)
}
attrs
:
{
oprate
:
"detail"
,
title
:
"设置最低库存"
},
on
:
{
click
:
()
=>
this
.
setNum
(
params
.
row
)
}
},
"
查看
"
"
设置最低库存
"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h
(
"op"
,
{
attrs
:
{
oprate
:
"edit"
},
on
:
{
click
:
()
=>
this
.
edit
(
params
.
row
.
id
)
}
},
"编辑"
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"delete"
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
.
id
)
}
attrs
:
{
oprate
:
"detail"
},
on
:
{
click
:
()
=>
this
.
view
(
params
.
row
.
id
)
}
},
"
删除
"
"
查看
"
)
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
// h(
// "op",
// {
// attrs: { oprate: "edit" },
// on: { click: () => this.edit(params.row.id) }
// },
// "编辑"
// ),
// h(
// "op",
// {
// attrs: { oprate: "delete" },
// on: { click: () => this.remove(params.row.id) }
// },
// "删除"
// )
]);
}
}
],
treeData
:
[],
treeInputSearch
:
""
,
ocolumn
:
[],
treeHeight
:
""
,
tableHeight
:
""
,
ids
:
[],
orderSearchForm
:
{
productId
:
""
,
//产品id
productName
:
""
,
//产品名称
taskType
:
""
,
//任务类型
quantity
:
null
,
//数量
taskRequire
:
""
,
//任务接点要求
demandStartDate
:
""
,
//开始时间
demandFinishDate
:
""
,
//完成时间
remark
:
""
,
//备注
projectNumber
:
""
,
//项目号
batchNumber
:
""
,
//批次号
urgencyLevel
:
null
//紧急程度
},
list
:
[]
};
},
...
...
@@ -147,35 +170,13 @@ export default {
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
treeHeight
=
window
.
screenHeight
-
150
;
})();
};
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
computed
:
{
searchList
()
{
let
nodeList
=
this
.
treeData
;
var
text
=
this
.
treeInputSearch
;
var
newNodeList
=
[];
function
searchTree
(
nodeLists
,
value
)
{
for
(
let
i
=
0
;
i
<
nodeLists
.
length
;
i
++
)
{
if
(
nodeLists
[
i
].
title
.
indexOf
(
value
)
!=
-
1
)
{
newNodeList
.
push
(
nodeLists
[
i
]);
}
else
if
(
nodeLists
[
i
].
children
.
length
>
0
)
{
searchTree
(
nodeLists
[
i
].
children
,
value
);
}
}
}
if
(
text
!=
""
)
{
searchTree
(
nodeList
,
text
);
}
else
{
return
nodeList
;
}
return
newNodeList
;
}
},
computed
:
{},
methods
:
{
ok
()
{
this
.
$refs
.
grid
.
load
();
...
...
@@ -230,9 +231,15 @@ export default {
this
.
showMenu
=
true
;
},
productSearch
(
id
,
item
,
productIds
,
ids
)
{
let
where
=
{
bom
Id
:
{
op
:
"In"
,
value
:
ids
}
};
let
where
=
{
store
Id
:
{
op
:
"In"
,
value
:
ids
}
};
this
.
$refs
.
grid
.
reload
(
where
);
},
setNum
(
row
)
{
this
.
curId
=
row
.
id
;
this
.
title
=
"设置最低库存"
;
this
.
detail
=
()
=>
import
(
"./setNum"
);
this
.
modal
=
true
;
},
l
(
key
)
{
let
vkey
=
"stock"
+
"."
+
key
;
return
this
.
$t
(
vkey
)
||
key
;
...
...
@@ -246,7 +253,6 @@ export default {
for
(
var
i
=
0
;
i
<
res
.
result
.
length
;
i
++
)
{
sumData
=
sumData
.
concat
(
res
.
result
[
i
]);
}
this
.
treeData
=
sumData
;
this
.
data1
=
JSON
.
parse
(
JSON
.
stringify
(
sumData
));
}
else
{
this
.
$Message
.
error
(
"加载产品树失败!"
);
...
...
pages/material/setNum.vue
0 → 100644
View file @
01580748
<
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"
disabled
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('storeTitle')"
prop=
"storeTitle"
>
<Input
v-model=
"entity.storeTitle"
disabled
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('minNum')"
prop=
"minNum"
>
<InputNumber
v-model=
"entity.minNum"
></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
:
{
id
:
null
,
name
:
""
,
materialId
:
""
,
materialCode
:
""
,
storeId
:
null
,
storeTitle
:
""
,
minNum
:
null
},
rules
:
{}
};
},
props
:
{
v
:
Object
,
eid
:
Number
},
mounted
()
{
if
(
this
.
eid
>
0
)
{
this
.
load
(
this
.
eid
);
}
},
methods
:
{
handleSubmit
()
{
let
params
=
{
id
:
this
.
entity
.
id
,
minNum
:
this
.
entity
.
minNum
};
this
.
disabled
=
true
;
Api
.
setminnum
(
params
)
.
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
;
});
},
l
(
key
)
{
key
=
"stock"
+
"."
+
key
;
return
this
.
$t
(
key
);
}
},
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
},
eid
(
v
)
{
if
(
v
>
0
)
{
this
.
load
(
v
);
}
}
}
};
</
script
>
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