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
7cd863e9
Commit
7cd863e9
authored
Oct 31, 2020
by
仇晓婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
87bug
parent
2395cf89
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
543 additions
and
504 deletions
+543
-504
masterData.vue
pages/materiel/masterData/masterData.vue
+543
-504
No files found.
pages/materiel/masterData/masterData.vue
View file @
7cd863e9
<
template
>
<div
class=
"master-data"
>
<DataGrid
:columns=
"cols"
ref=
"grid"
:conditions=
"easySearch"
:action=
"action"
:initsearch=
"sets"
:high=
"false"
:format=
"formatFun"
:height=
"tableHeight"
@
on-selection-change=
"onSelect"
:exportTitle=
"exportTitle"
>
<div
class=
"master-data"
>
<DataGrid
:columns=
"cols"
ref=
"grid"
:conditions=
"easySearch"
:action=
"action"
:initsearch=
"sets"
:high=
"false"
:format=
"formatFun"
:height=
"tableHeight"
@
on-selection-change=
"onSelect"
:exportTitle=
"exportTitle"
>
<template
slot=
"easySearch"
>
<Form
ref=
"formInline"
:model=
"easySearch"
inline
>
<FormItem
prop=
"keys"
>
<Input
placeholder=
"请输入编码/名称/状态"
v-width=
"200"
v-model=
"easySearch.keys.value"
clearable
/>
<Input
placeholder=
"请输入编码/名称/状态"
v-width=
"200"
v-model=
"easySearch.keys.value"
clearable
/>
</FormItem>
<FormItem>
<Button
type=
"primary"
@
click=
"search"
>
查询
</Button>
...
...
@@ -20,11 +36,36 @@
<Button
type=
"primary"
@
click=
"modalSchedule"
>
批量送审
</Button>
</
template
>
</DataGrid>
<Modal
v-model=
"modal"
:title=
"title"
width=
"1000"
footer-hide
:mask-closable=
"false"
:fullscreen=
"fullscreen"
>
<component
:is=
"detail"
:eid=
"curId"
:rootCategoryId=
"rootCategoryId"
:rowsTable=
"rowsTable"
:nodeInfo=
"nodeInfo"
@
on-close=
"cancel"
@
on-cancel=
"cancel"
@
on-ok=
"ok"
ref=
"chlidren"
/>
<Modal
v-model=
"modal"
:title=
"title"
width=
"1000"
footer-hide
:mask-closable=
"false"
:fullscreen=
"fullscreen"
>
<component
:is=
"detail"
:eid=
"curId"
:rootCategoryId=
"rootCategoryId"
:rowsTable=
"rowsTable"
:nodeInfo=
"nodeInfo"
@
on-close=
"cancel"
@
on-cancel=
"cancel"
@
on-ok=
"ok"
ref=
"chlidren"
/>
</Modal>
<ImportExcel
ref=
"importExcel"
@
on-get-data=
"getData"
:modalTitle=
"temTitle"
:columns=
"cols"
:open=
"ModalIm"
@
on-cancel=
"ModalImCancel"
@
on-ok=
"ok"
/>
</div>
<ImportExcel
ref=
"importExcel"
@
on-get-data=
"getData"
:modalTitle=
"temTitle"
:columns=
"cols"
:open=
"ModalIm"
@
on-cancel=
"ModalImCancel"
@
on-ok=
"ok"
/>
</div>
</template>
<
script
>
...
...
@@ -51,24 +92,25 @@ export default {
codeRuleData
:
[],
detail
:
null
,
temTitle
:
"物料管理"
,
sets
:
v
=>
{
sets
:
(
v
)
=>
{
v
.
categoryId
=
this
.
nodeInfo
.
categoryId
;
v
.
rootCategoryId
=
this
.
nodeInfo
.
rootCategoryId
;
},
easySearch
:
{
keys
:
{
op
:
"code,name"
,
value
:
null
value
:
null
,
},
categoryId
:
{
op
:
"In"
,
value
:
this
.
nodeInfo
.
ids
}
value
:
this
.
nodeInfo
.
ids
,
},
},
columns
:
[{
columns
:
[
{
type
:
"selection"
,
width
:
70
,
align
:
"center"
align
:
"center"
,
},
{
key
:
"codeRuleType"
,
...
...
@@ -81,43 +123,34 @@ export default {
{
key
:
"codeRuleId"
,
title
:
"编码名称"
,
materialKey
:
'3'
,
materialKey
:
"3"
,
import
:
true
,
hide
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
{},
this
.
getType3
(
params
.
row
.
codeRuleId
)
);
}
return
h
(
"span"
,
{},
this
.
getType3
(
params
.
row
.
codeRuleId
));
},
},
{
key
:
"rootCategoryId"
,
title
:
"大类"
,
align
:
"right"
,
materialKey
:
'1'
,
materialKey
:
"1"
,
import
:
true
,
hide
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
{},
this
.
getType1
(
params
.
row
.
rootCategoryId
)
);
}
return
h
(
"span"
,
{},
this
.
getType1
(
params
.
row
.
rootCategoryId
));
},
},
{
key
:
"categoryId"
,
title
:
"子类"
,
align
:
"right"
,
materialKey
:
'2'
,
materialKey
:
"2"
,
import
:
true
,
hide
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
{},
this
.
getType2
(
params
.
row
.
categoryId
)
);
}
return
h
(
"span"
,
{},
this
.
getType2
(
params
.
row
.
categoryId
));
},
},
{
key
:
"code"
,
...
...
@@ -125,20 +158,23 @@ export default {
align
:
"left"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"a"
,
{
"a"
,
{
props
:
{},
on
:
{
click
:
()
=>
this
.
details
(
params
.
row
)
}
click
:
()
=>
this
.
details
(
params
.
row
),
},
!
params
.
row
.
code
||
params
.
row
.
code
==
0
?
"未分配"
:
params
.
row
.
code
},
!
params
.
row
.
code
||
params
.
row
.
code
==
0
?
"未分配"
:
params
.
row
.
code
);
}
},
},
{
key
:
"name"
,
title
:
"名称"
,
align
:
"left"
align
:
"left"
,
},
{
key
:
"status"
,
...
...
@@ -150,26 +186,26 @@ export default {
key
:
"version"
,
title
:
"版本"
,
align
:
"left"
,
code
:
"material.main.version"
code
:
"material.main.version"
,
},
{
key
:
"drawing"
,
title
:
"图号"
,
align
:
"left"
align
:
"left"
,
},
{
key
:
"creationTime"
,
title
:
"创建时间"
,
hide
:
true
,
align
:
"left"
,
type
:
"date"
type
:
"date"
,
},
{
key
:
"creatorUserId"
,
title
:
"创建人"
,
hide
:
true
,
align
:
"left"
,
type
:
"user"
type
:
"user"
,
},
{
title
:
"操作"
,
...
...
@@ -177,60 +213,64 @@ export default {
width
:
150
,
align
:
"left"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
return
h
(
"div"
,
{
class
:
"action"
,
},
[
h
(
"op"
,
{
"op"
,
{
attrs
:
{
oprate
:
"edit"
oprate
:
"edit"
,
},
on
:
{
click
:
()
=>
this
.
edit
(
params
.
row
)
}
click
:
()
=>
this
.
edit
(
params
.
row
),
},
},
"编辑"
params
.
row
.
status
==
3
?
""
:
"编辑"
),
h
(
"op"
,
{
"op"
,
{
attrs
:
{
oprate
:
"delete"
oprate
:
"delete"
,
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
.
id
)
}
click
:
()
=>
this
.
remove
(
params
.
row
.
id
),
},
},
params
.
row
.
status
==
3
?
""
:
"删除"
),
h
(
"op"
,
{
"op"
,
{
attrs
:
{
oprate
:
"edit"
oprate
:
"edit"
,
},
on
:
{
click
:
()
=>
this
.
send
(
params
.
row
)
}
click
:
()
=>
this
.
send
(
params
.
row
),
},
},
(
params
.
row
.
status
==
0
||
params
.
row
.
status
==
1
)
&&
this
.
status
==
0
?
"送审"
:
""
)
]);
}
}
this
.
status
==
0
?
"送审"
:
""
),
]
);
},
},
],
//基础咧
cols
:
[],
//
status
:
null
,
ModalIm
:
false
,
addCol
:
[],
exportTitle
:
'物料管理'
,
exportTitle
:
"物料管理"
,
};
},
async
fetch
({
store
,
params
})
{
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
...
...
@@ -242,15 +282,15 @@ export default {
this
.
initCols
();
}
Api
.
getbyid
({
id
:
"b6303ddc-8b5e-40a3-a51b-294657d1d913"
}).
then
(
r
=>
{
id
:
"b6303ddc-8b5e-40a3-a51b-294657d1d913"
,
}).
then
((
r
)
=>
{
this
.
status
=
r
.
result
.
status
;
//status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮
this
.
nodeInfo
.
status
=
this
.
status
;
});
},
mounted
()
{
this
.
getTreeData
()
this
.
getcodeRuleData
()
this
.
getTreeData
();
this
.
getcodeRuleData
();
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
...
...
@@ -262,7 +302,7 @@ export default {
methods
:
{
//格式化原始数据
formatFun
(
data
)
{
data
.
map
(
e
=>
{
data
.
map
((
e
)
=>
{
if
(
e
.
status
==
0
)
{
e
.
_disabled
=
false
;
}
else
{
...
...
@@ -290,32 +330,34 @@ export default {
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
},
initCols
(
delay
)
{
let
conditions
=
[{
let
conditions
=
[
{
conditionalType
:
"Equal"
,
fieldName
:
"categoryId"
,
fieldValue
:
this
.
nodeInfo
.
rootCategoryId
}];
fieldValue
:
this
.
nodeInfo
.
rootCategoryId
,
},
];
Api
.
listTable
({
conditions
:
conditions
,
sortBy
:
"id"
,
isDesc
:
false
}).
then
(
r
=>
{
isDesc
:
false
,
}).
then
((
r
)
=>
{
if
(
r
.
result
)
{
var
items
=
r
.
result
.
filter
(
u
=>
{
var
items
=
r
.
result
.
filter
((
u
)
=>
{
return
(
!
this
.
columns
.
some
(
p
=>
{
!
this
.
columns
.
some
((
p
)
=>
{
return
p
.
key
==
u
.
field
;
})
&&
u
.
dataType
!=
5
);
});
this
.
addCol
=
items
;
this
.
cols
=
this
.
$u
.
clone
(
this
.
columns
);
let
extra
=
items
.
map
(
u
=>
{
let
extra
=
items
.
map
((
u
)
=>
{
// console.log(u);
var
col
=
{
key
:
u
.
field
,
title
:
u
.
title
title
:
u
.
title
,
};
if
(
u
.
dataType
==
3
)
{
col
.
code
=
u
.
note
;
...
...
@@ -328,7 +370,7 @@ export default {
"material.main.unitName"
);
let
item
=
units
.
filter
(
p
=>
{
let
item
=
units
.
filter
((
p
)
=>
{
return
p
.
code
==
u
.
unitName
;
});
// console.log(units, item);
...
...
@@ -370,7 +412,7 @@ export default {
this
.
modal
=
true
;
},
remove
(
id
)
{
Api
.
delete
(
id
).
then
(
r
=>
{
Api
.
delete
(
id
).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
this
.
$Message
.
success
(
"删除成功"
);
...
...
@@ -409,18 +451,17 @@ export default {
//导入功能
openModalIm
()
{
if
(
this
.
nodeInfo
.
categoryId
)
{
this
.
ModalIm
=
true
this
.
ModalIm
=
true
;
}
else
{
this
.
$Message
.
error
(
"请先选择分类"
);
}
},
ModalImCancel
()
{
this
.
ModalIm
=
false
this
.
ModalIm
=
false
;
},
getData
(
val
)
{
let
url
=
`
${
material
}
/materialimportservice/import`
;
this
.
$refs
.
importExcel
.
deelData
(
url
,
this
.
cols
,
this
.
formatMethod
(
val
))
this
.
$refs
.
importExcel
.
deelData
(
url
,
this
.
cols
,
this
.
formatMethod
(
val
));
},
//根据页面二次处理数据
formatMethod
(
val
)
{
...
...
@@ -428,9 +469,9 @@ export default {
let
tempList
=
[];
tempData
.
forEach
((
ele
)
=>
{
let
obj
=
{
name
:
ele
.
name
?
ele
.
name
:
''
,
version
:
ele
.
version
?
Number
(
ele
.
version
)
:
''
,
drawing
:
ele
.
drawing
?
ele
.
drawing
:
''
,
name
:
ele
.
name
?
ele
.
name
:
""
,
version
:
ele
.
version
?
Number
(
ele
.
version
)
:
""
,
drawing
:
ele
.
drawing
?
ele
.
drawing
:
""
,
description
:
ele
.
description
?
ele
.
description
:
""
,
code
:
0
,
status
:
this
.
nodeInfo
.
status
==
1
?
3
:
0
,
...
...
@@ -438,72 +479,70 @@ export default {
categoryId
:
this
.
nodeInfo
.
categoryId
,
//左侧树点击的id
customProperties
:
{},
rootCategoryId
:
this
.
nodeInfo
.
rootCategoryId
,
//左侧树点击的数据的最顶层id
codeRuleType
:
this
.
nodeInfo
.
codeRuleType
codeRuleType
:
this
.
nodeInfo
.
codeRuleType
,
};
this
.
addCol
.
forEach
(
el
=>
{
obj
[
el
.
field
]
=
ele
[
el
.
field
]
})
if
(
ele
.
name
&&
ele
.
name
!=
''
)
{
obj
.
ico
=
false
this
.
addCol
.
forEach
((
el
)
=>
{
obj
[
el
.
field
]
=
ele
[
el
.
field
];
});
if
(
ele
.
name
&&
ele
.
name
!=
""
)
{
obj
.
ico
=
false
;
}
else
{
obj
.
ico
=
true
obj
.
ico
=
true
;
}
tempList
.
push
(
obj
);
});
return
tempList
return
tempList
;
},
//批量导入end
//物料大类和子类的解析start
getTreeData
()
{
let
data
=
{
conditions
:
[]
conditions
:
[],
};
Api
.
list
(
data
).
then
((
r
)
=>
{
this
.
treeData
=
r
.
result
this
.
treeData
=
r
.
result
;
});
},
getType1
(
val
)
{
let
tempTreeList
=
this
.
$u
.
clone
(
this
.
treeData
)
let
rootName
=
""
tempTreeList
.
forEach
(
ele
=>
{
let
tempTreeList
=
this
.
$u
.
clone
(
this
.
treeData
);
let
rootName
=
""
;
tempTreeList
.
forEach
((
ele
)
=>
{
if
(
ele
.
upId
==
0
&&
ele
.
id
==
val
)
{
rootName
=
ele
.
name
rootName
=
ele
.
name
;
}
})
return
rootName
});
return
rootName
;
},
getType2
(
val
)
{
let
tempTreeList
=
this
.
$u
.
clone
(
this
.
treeData
)
let
childrenName
=
""
tempTreeList
.
forEach
(
ele
=>
{
let
tempTreeList
=
this
.
$u
.
clone
(
this
.
treeData
);
let
childrenName
=
""
;
tempTreeList
.
forEach
((
ele
)
=>
{
if
(
ele
.
upId
>
0
&&
ele
.
id
==
val
)
{
childrenName
=
ele
.
name
childrenName
=
ele
.
name
;
}
})
return
childrenName
});
return
childrenName
;
},
//获取编码名称
getcodeRuleData
()
{
let
data
=
{
conditions
:
[]
conditions
:
[],
};
Api
.
pagedSlecet
(
data
).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
codeRuleData
=
r
.
result
.
items
||
[]
this
.
codeRuleData
=
r
.
result
.
items
||
[];
}
});
},
getType3
(
val
)
{
let
codeRuleDataList
=
this
.
$u
.
clone
(
this
.
codeRuleData
)
let
codeRuleName
=
""
codeRuleDataList
.
forEach
(
ele
=>
{
let
codeRuleDataList
=
this
.
$u
.
clone
(
this
.
codeRuleData
);
let
codeRuleName
=
""
;
codeRuleDataList
.
forEach
((
ele
)
=>
{
if
(
ele
.
id
==
val
)
{
codeRuleName
=
ele
.
name
codeRuleName
=
ele
.
name
;
}
})
return
codeRuleName
});
return
codeRuleName
;
},
//物料大类和子类的解析end
},
...
...
@@ -511,7 +550,7 @@ export default {
nodeInfo
:
{
handler
(
newName
,
oldName
)
{
// console.log("ovo", newName, oldName);
this
.
temTitle
=
"物料管理("
+
newName
.
rootCategoryName
+
")"
this
.
temTitle
=
"物料管理("
+
newName
.
rootCategoryName
+
")"
;
if
(
newName
.
rootCategoryId
)
{
this
.
initCols
(()
=>
{
if
(
newName
.
categoryId
)
{
...
...
@@ -525,9 +564,9 @@ export default {
}
},
immediate
:
true
,
deep
:
true
deep
:
true
,
},
},
}
};
</
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