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
3123dc0c
Commit
3123dc0c
authored
Sep 26, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getUser
parent
f6f70e2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
81 deletions
+48
-81
dataGrid.vue
components/page/dataGrid.vue
+48
-2
index.vue
pages/basicData/user/index.vue
+0
-79
No files found.
components/page/dataGrid.vue
View file @
3123dc0c
...
...
@@ -102,6 +102,7 @@ export default {
treeData
:
[],
//物料数据
codeRuleData
:
[],
//物料编码
routingHeaderData
:
[],
//工艺规程
allUser
:
[]
};
},
props
:
{
...
...
@@ -277,6 +278,7 @@ export default {
//this.getTreeData();
//this.getcodeRuleData();
//this.getRoutingHeaderData();
this
.
getAllUser
()
},
methods
:
{
//数据加载
...
...
@@ -477,6 +479,36 @@ export default {
this
.
footerToolbar
=
false
;
this
.
$refs
.
table
.
selectAll
(
false
);
},
//获取所有用户信息
getAllUser
()
{
this
.
$api
.
post
(
`
${
systemUrl
}
/user/paged`
,
{
conditions
:
[],
pageIndex
:
1
,
pageSize
:
1000
,
})
.
then
((
r
)
=>
{
if
(
r
.
success
)
{
let
tempUserInfo
=
r
.
result
.
items
tempUserInfo
.
forEach
(
ele
=>
{
let
temObj
=
{
userId
:
ele
.
id
,
name
:
ele
.
userName
}
this
.
allUser
.
push
(
temObj
)
})
}
})
},
getUserName
(
id
)
{
let
name
=
''
this
.
allUser
.
forEach
(
ele
=>
{
if
(
id
==
ele
.
userId
)
{
name
=
ele
.
name
}
})
return
name
},
//导出excel
export2Excel
()
{
...
...
@@ -520,6 +552,7 @@ export default {
const
tHeader
=
[];
// 设置Excel的表格第一行的标题
const
filterVal
=
[];
//list里对象的属性
var
tempCol
=
[];
var
tempColUser
=
[];
var
columnsCur
=
this
.
$u
.
clone
(
this
.
columnsCur
);
//导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur
.
forEach
((
el
)
=>
{
if
(
...
...
@@ -535,7 +568,12 @@ export default {
code
:
el
.
code
,
});
//临时存放code数据字典的字段及对应的数据字典code
}
if
(
el
.
type
&&
el
.
type
==
"user"
)
{
tempColUser
.
push
({
key
:
el
.
key
,
code
:
el
.
type
,
});
//临时存放user列
}
tHeader
.
push
(
el
.
title
);
filterVal
.
push
(
el
.
key
);
}
...
...
@@ -579,6 +617,15 @@ export default {
}
}
});
tempColUser
.
forEach
(
eluser
=>
{
if
(
e
[
eluser
.
key
]
&&
e
[
eluser
.
key
]
!=
""
&&
e
[
eluser
.
key
]
!=
null
)
{
e
[
eluser
.
key
]
=
this
.
getUserName
(
e
[
eluser
.
key
])
}
})
});
let
nowDate
=
this
.
$u
.
getNowTime
();
//年月日时分秒yyyyMMddhhmmss
...
...
@@ -591,7 +638,6 @@ export default {
);
});
},
},
computed
:
{
columnsNow
()
{
...
...
pages/basicData/user/index.vue
View file @
3123dc0c
...
...
@@ -75,17 +75,6 @@
<Modal
v-model=
"syncAccountModal"
title=
"同步账户"
@
on-ok=
"syncAccountOk"
@
on-cancel=
"cancel"
>
<p>
确定同步账户?
</p>
</Modal>
<Modal
v-model=
"modalImport"
title=
"导入excel"
fullscreen
hidefooter
>
<Upload
action
:before-upload=
"beforeUpload"
ref=
"uploadfile"
:format=
"formatList"
>
<Button
icon=
"ios-cloud-upload-outline"
>
上传Excel文件
</Button>
</Upload>
<DataGrid
border
:height=
"tdHeightExcel"
:columns=
"columnsImport"
:data=
"excelData"
:tool=
"false"
:page=
"false"
:set=
"false"
></DataGrid>
<div
slot=
"footer"
>
<span
v-if=
"excelData.length>0"
>
共 {{excelData.length}} 条数据
</span>
<Button
@
click=
"cancelExcel"
>
取消
</Button>
<Button
type=
"primary"
@
click=
"importOk"
>
确定导入
</Button>
</div>
</Modal>
<ImportExcel
ref=
"importExcel"
@
on-get-data=
"getData"
:modalTitle=
"temTitle"
:columns=
"columns"
:open=
"ModalIm"
@
on-cancel=
"ModalImCancel"
@
on-ok=
"ok"
/>
</Content>
</Layout>
...
...
@@ -698,74 +687,6 @@ export default {
//同步账户end
//导入excel
//旧方法,设置dirname,通过取excel第一行的数据定义colums
async
beforeUploadOld
(
file
)
{
this
.
excelData
=
[];
this
.
$refs
.
uploadfile
.
clearFiles
();
//清除上一次上传文件列表
const
workbook
=
await
this
.
$u
.
readXLSX
(
file
);
const
sheet2JSONOpts
=
{
defval
:
""
,
//给defval赋值为空的字符串
};
var
tempList
=
XLSX
.
utils
.
sheet_to_json
(
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]],
sheet2JSONOpts
);
//对读取的excel文件数据进行处理
var
tempColums
=
this
.
$u
.
clone
(
this
.
columnsImport
);
var
arrTitles
=
Object
.
keys
(
tempList
[
0
]);
//获取列表title
var
arrTitleUse
=
[];
//使用数据字典的字段
tempColums
.
forEach
((
elCode
)
=>
{
if
(
elCode
.
code
)
{
arrTitleUse
.
push
({
key
:
elCode
.
key
,
code
:
elCode
.
code
});
}
});
tempList
.
forEach
((
ele
)
=>
{
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if
(
ele
.
departmentTitle
&&
ele
.
departmentTitle
!=
""
&&
(
!
ele
.
departmentId
||
ele
.
departmentId
==
""
)
)
{
this
.
departArr
.
forEach
((
e
)
=>
{
if
(
ele
.
departmentTitle
&&
ele
.
departmentTitle
==
e
.
name
)
{
ele
.
departmentId
=
e
.
id
;
}
});
}
else
if
(
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
ele
.
departmentId
&&
ele
.
departmentId
+
""
!=
""
&&
(
!
ele
.
departmentTitle
||
ele
.
departmentTitle
==
""
)
)
{
this
.
departArr
.
forEach
((
e
)
=>
{
if
(
ele
.
departmentId
&&
ele
.
departmentId
==
e
.
id
)
{
ele
.
departmentTitle
=
e
.
name
;
}
});
}
//对列表里的数据字典项进行处理
arrTitleUse
.
forEach
((
elem
)
=>
{
if
(
ele
[
elem
.
key
]
&&
ele
[
elem
.
key
]
!=
""
&&
ele
[
elem
.
key
]
!=
null
)
{
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
ele
[
elem
.
key
]
=
this
.
$u
.
dirName
(
this
.
$store
.
getters
.
dictionaryByKey
(
elem
.
code
),
ele
[
elem
.
key
]
);
}
});
});
this
.
excelData
=
tempList
;
console
.
log
(
workbook
);
return
false
;
},
//导入功能
openModalIm
()
{
this
.
ModalIm
=
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