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
1ed98213
Commit
1ed98213
authored
Aug 27, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user
parent
488c9b1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
936 additions
and
936 deletions
+936
-936
package-lock.json
package-lock.json
+4
-4
index.vue
pages/basicData/user/index.vue
+932
-932
No files found.
package-lock.json
View file @
1ed98213
...
@@ -2627,7 +2627,7 @@
...
@@ -2627,7 +2627,7 @@
},
},
"adler-32"
:
{
"adler-32"
:
{
"version"
:
"1.2.0"
,
"version"
:
"1.2.0"
,
"resolved"
:
"https://registry.npm
.taobao.org/adler-32/download
/adler-32-1.2.0.tgz"
,
"resolved"
:
"https://registry.npm
js.org/adler-32/-
/adler-32-1.2.0.tgz"
,
"integrity"
:
"sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU="
,
"integrity"
:
"sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU="
,
"requires"
:
{
"requires"
:
{
"exit-on-epipe"
:
"~1.0.1"
,
"exit-on-epipe"
:
"~1.0.1"
,
...
@@ -4774,7 +4774,7 @@
...
@@ -4774,7 +4774,7 @@
},
},
"codepage"
:
{
"codepage"
:
{
"version"
:
"1.14.0"
,
"version"
:
"1.14.0"
,
"resolved"
:
"https://registry.npm
.taobao.org/codepage/download
/codepage-1.14.0.tgz"
,
"resolved"
:
"https://registry.npm
js.org/codepage/-
/codepage-1.14.0.tgz"
,
"integrity"
:
"sha1-jL4lSBMjVZ19MHVxsP/5HnodL5k="
,
"integrity"
:
"sha1-jL4lSBMjVZ19MHVxsP/5HnodL5k="
,
"requires"
:
{
"requires"
:
{
"commander"
:
"~2.14.1"
,
"commander"
:
"~2.14.1"
,
...
@@ -6226,7 +6226,7 @@
...
@@ -6226,7 +6226,7 @@
},
},
"echarts"
:
{
"echarts"
:
{
"version"
:
"4.8.0"
,
"version"
:
"4.8.0"
,
"resolved"
:
"https://registry.npm.taobao.org/echarts/download/echarts-4.8.0.tgz
?cache=0&sync_timestamp=1596215792462&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fecharts%2Fdownload%2Fecharts-4.8.0.tgz
"
,
"resolved"
:
"https://registry.npm.taobao.org/echarts/download/echarts-4.8.0.tgz"
,
"integrity"
:
"sha1-ssHPuSKbE9No7hBPyO6mALV01MQ="
,
"integrity"
:
"sha1-ssHPuSKbE9No7hBPyO6mALV01MQ="
,
"requires"
:
{
"requires"
:
{
"zrender"
:
"4.3.1"
"zrender"
:
"4.3.1"
...
@@ -20598,7 +20598,7 @@
...
@@ -20598,7 +20598,7 @@
},
},
"zrender"
:
{
"zrender"
:
{
"version"
:
"4.3.1"
,
"version"
:
"4.3.1"
,
"resolved"
:
"https://registry.npm.taobao.org/zrender/download/zrender-4.3.1.tgz?cache=0&sync_timestamp=159
6718989769
&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fzrender%2Fdownload%2Fzrender-4.3.1.tgz"
,
"resolved"
:
"https://registry.npm.taobao.org/zrender/download/zrender-4.3.1.tgz?cache=0&sync_timestamp=159
7683748542
&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fzrender%2Fdownload%2Fzrender-4.3.1.tgz"
,
"integrity"
:
"sha1-uviqbcgYei+BlpLX1fm+36K5D6M="
"integrity"
:
"sha1-uviqbcgYei+BlpLX1fm+36K5D6M="
}
}
}
}
...
...
pages/basicData/user/index.vue
View file @
1ed98213
<
template
>
<
template
>
<Layout
class=
"full"
>
<Layout
class=
"full"
>
<Sider
<Sider
hide-trigger
:style=
"
{background: '#fff'}" width="260" class="menu" style=" flex:0;border:none">
hide-trigger
<div
class=
"zh-tree"
:style=
"
{height:treeHeight+'px'}">
:style=
"
{background: '#fff'}"
<h3
class=
"zh-title"
>
部门结构
</h3>
width="260"
<div
class=
"zh-box"
>
class="menu"
<Input
search
placeholder=
"请输入查询条件"
v-model=
"treeInputSearch"
/>
style=" flex:0;border:none"
<Tree
:data=
"searchList"
class=
"tree-content"
@
on-select-change=
"selectTreeNode"
></Tree>
>
</div>
<div
class=
"zh-tree"
:style=
"
{height:treeHeight+'px'}">
<h3
class=
"zh-title"
>
部门结构
</h3>
<div
class=
"zh-box"
>
<Input
search
placeholder=
"请输入查询条件"
v-model=
"treeInputSearch"
/>
<Tree
:data=
"searchList"
class=
"tree-content"
@
on-select-change=
"selectTreeNode"
></Tree>
</div>
</div>
</div>
</Sider>
</Sider>
<Content
class=
"content"
>
<Content
class=
"content"
>
<DataGrid
<DataGrid
:columns=
"columns"
ref=
"grid"
:action=
"action"
:conditions=
"easySearch"
placeholder=
"请输入姓名/员工编号"
:high=
"true"
:height=
"tdHeight"
>
:columns=
"columns"
<template
slot=
"searchForm"
>
ref=
"grid"
<Search
/>
:action=
"action"
</
template
>
:conditions=
"easySearch"
<
template
slot=
"buttons"
>
placeholder=
"请输入姓名/员工编号"
<Button
type=
"primary"
@
click=
"addModal=true"
>
新增
</Button>
:high=
"true"
<Button
@
click=
"import2Excel"
>
导入
</Button>
:height=
"tdHeight"
<Button
@
click=
"export2Excel"
>
导出
</Button>
>
</
template
>
<template
slot=
"searchForm"
>
</DataGrid>
<Search
/>
<Modal
v-model=
"addModal"
title=
"新增"
footer-hide
width=
"800"
>
</
template
>
<Add
@
on-close=
"cancel"
@
on-ok=
"addOk"
/>
<
template
slot=
"buttons"
>
</Modal>
<Button
type=
"primary"
@
click=
"addModal=true"
>
新增
</Button>
<Modal
v-model=
"editModal"
title=
"编辑"
footer-hide
width=
"800"
>
<Button
@
click=
"import2Excel"
>
导入
</Button>
<Edit
:eid=
"curId"
@
on-close=
"cancel"
@
on-ok=
"addOk"
/>
<Button
@
click=
"export2Excel"
>
导出
</Button>
</Modal>
</
template
>
<Modal
v-model=
"detailModal"
title=
"详情"
width=
"900"
>
</DataGrid>
<Detail
:eid=
"curId"
/>
<Modal
v-model=
"addModal"
title=
"新增"
footer-hide
width=
"800"
>
</Modal>
<Add
@
on-close=
"cancel"
@
on-ok=
"addOk"
/>
<Modal
v-model=
"deletelModal"
title=
"删除"
@
on-ok=
"removeOk"
@
on-cancel=
"cancel"
>
</Modal>
<p>
确定删除?
</p>
<Modal
v-model=
"editModal"
title=
"编辑"
footer-hide
width=
"800"
>
</Modal>
<Edit
:eid=
"curId"
@
on-close=
"cancel"
@
on-ok=
"addOk"
/>
<!-- 重置密码 -->
</Modal>
<Modal
v-model=
"show7"
title=
"提示"
:mask-closable=
"false"
ok-text=
"确定"
cancel-text=
"取消"
@
on-ok=
"reset"
>
此操作将密码重置为初始密码, 是否继续?
</Modal>
<Modal
v-model=
"detailModal"
title=
"详情"
width=
"900"
>
<!-- 授权 -->
<Detail
:eid=
"curId"
/>
<Modal
v-model=
"show3"
title=
"授权-当前用户"
:width=
"800"
:mask-closable=
"false"
ok-text=
"保存"
cancel-text=
"取消"
@
on-ok=
"authOk"
@
on-cancel=
"authCancle"
>
</Modal>
<div
style=
"max-height:400px;overflow:auto"
>
<Modal
v-model=
"deletelModal"
title=
"删除"
@
on-ok=
"removeOk"
@
on-cancel=
"cancel"
>
<Form
:model=
"authModel"
:label-width=
"70"
>
<p>
确定删除?
</p>
<Row>
</Modal>
<Col
span=
"24"
>
<!-- 重置密码 -->
默认角色
<Modal
<!-- <Input type="textarea" size="large" :rows="2" v-model="defaultRole" placeholder="暂无数据"/>
v-model=
"show7"
title=
"提示"
:mask-closable=
"false"
ok-text=
"确定"
cancel-text=
"取消"
@
on-ok=
"reset"
>
此操作将密码重置为初始密码, 是否继续?
</Modal>
<!-- 授权 -->
<Modal
v-model=
"show3"
title=
"授权-当前用户"
:width=
"800"
:mask-closable=
"false"
ok-text=
"保存"
cancel-text=
"取消"
@
on-ok=
"authOk"
@
on-cancel=
"authCancle"
>
<div
style=
"max-height:400px;overflow:auto"
>
<Form
:model=
"authModel"
:label-width=
"70"
>
<Row>
<Col
span=
"24"
>
默认角色
<!-- <Input type="textarea" size="large" :rows="2" v-model="defaultRole" placeholder="暂无数据"/>
-->
-->
<div
style=
"width:750px;border:2px solid #E8EAEC;margin-top:10px"
>
<div
style=
"width:750px;border:2px solid #E8EAEC;margin-top:10px"
>
<Row>
<Row>
<CheckboxGroup
v-model=
"authModel.default"
>
<CheckboxGroup
v-model=
"authModel.default"
>
<Col
<Col
span=
"5"
offset=
"1"
v-for=
"(item,index) in authList1"
:key=
"index"
style=
"line-height:33px;font-size:14px;"
>
span=
"5"
<Checkbox
:label=
"item.id"
>
{{item.name}}
</Checkbox>
offset=
"1"
</Col>
v-for=
"(item,index) in authList1"
</CheckboxGroup>
:key=
"index"
</Row>
style=
"line-height:33px;font-size:14px;"
</div>
>
</Col>
<Checkbox
:label=
"item.id"
>
{{item.name}}
</Checkbox>
</Row>
</Col>
</CheckboxGroup>
</Row>
</div>
</Col>
</Row>
<Row>
<Col
span=
"24"
>
<div
style=
"margin-top:10px;"
>
自定义角色
<div
style=
"width:750px;border:2px solid #E8EAEC;margin-top:10px"
>
<Row>
<Row>
<CheckboxGroup
v-model=
"authModel.extra"
>
<Col
span=
"24"
>
<Col
<div
style=
"margin-top:10px;"
>
span=
"5"
自定义角色
offset=
"1"
<div
style=
"width:750px;border:2px solid #E8EAEC;margin-top:10px"
>
v-for=
"(item,index) in authList"
<Row>
:key=
"index"
<CheckboxGroup
v-model=
"authModel.extra"
>
style=
"line-height:33px;font-size:14px;"
<Col
span=
"5"
offset=
"1"
v-for=
"(item,index) in authList"
:key=
"index"
style=
"line-height:33px;font-size:14px;"
>
>
<Checkbox
:label=
"item.id"
>
{{item.name}}
</Checkbox>
<Checkbox
:label=
"item.id"
>
{{item.name}}
</Checkbox>
</Col>
</CheckboxGroup>
</Row>
</div>
</div>
</Col>
</Col>
</CheckboxGroup>
</Row>
</Row>
</div>
</Form>
</div>
</div>
</Col>
</Modal>
</Row>
<Modal
v-model=
"syncAccountModal"
title=
"同步账户"
@
on-ok=
"syncAccountOk"
@
on-cancel=
"cancel"
>
</Form>
<p>
确定同步账户?
</p>
</div>
</Modal>
</Modal>
<Modal
v-model=
"modalImport"
title=
"导入excel"
fullscreen
hidefooter
>
<Modal
v-model=
"syncAccountModal"
title=
"同步账户"
@
on-ok=
"syncAccountOk"
@
on-cancel=
"cancel"
>
<Upload
action
:before-upload=
"beforeUpload"
ref=
"uploadfile"
:format=
"formatList"
>
<p>
确定同步账户?
</p>
<Button
icon=
"ios-cloud-upload-outline"
>
上传Excel文件
</Button>
</Modal>
</Upload>
<Modal
v-model=
"modalImport"
title=
"导入excel"
fullscreen
hidefooter
>
<DataGrid
border
:height=
"tdHeightExcel"
:columns=
"columnsImport"
:data=
"excelData"
:tool=
"false"
:page=
"false"
:set=
"false"
></DataGrid>
<Upload
action
:before-upload=
"beforeUpload"
ref=
"uploadfile"
:format=
"formatList"
>
<div
slot=
"footer"
>
<Button
icon=
"ios-cloud-upload-outline"
>
上传Excel文件
</Button>
<span
v-if=
"excelData.length>0"
>
共 {{excelData.length}} 条数据
</span>
</Upload>
<Button
@
click=
"cancelExcel"
>
取消
</Button>
<DataGrid
<Button
type=
"primary"
@
click=
"importOk"
>
确定导入
</Button>
border
</div>
:height=
"tdHeightExcel"
</Modal>
: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>
</Content>
</Content>
</Layout>
</Layout>
</template>
</template>
<
script
>
<
script
>
import
Api
from
"./api"
;
import
Api
from
"./api"
;
import
ApiDepart
from
"../department/api"
;
import
ApiDepart
from
"../department/api"
;
...
@@ -149,849 +100,898 @@ import Detail from "./detail";
...
@@ -149,849 +100,898 @@ import Detail from "./detail";
import
Search
from
"./search"
;
import
Search
from
"./search"
;
import
service
from
"@/plugins/request"
;
import
service
from
"@/plugins/request"
;
import
util
from
"@/libs/util"
;
import
util
from
"@/libs/util"
;
import
{
Time
}
from
"view-design"
;
import
{
Time
}
from
"view-design"
;
import
XLSX
from
"xlsx"
;
import
XLSX
from
"xlsx"
;
export
default
{
export
default
{
name
:
"list"
,
name
:
"list"
,
components
:
{
components
:
{
Add
,
Add
,
Edit
,
Edit
,
Detail
,
Detail
,
Search
,
Search
,
},
},
data
()
{
data
()
{
return
{
return
{
action
:
Api
.
index
,
action
:
Api
.
index
,
easySearch
:
{
easySearch
:
{
keys
:
{
keys
:
{
op
:
op
:
"userName,cardNo,national,phone,email,enableEquip,jobNo,remark,departmentTitle,roleTitles"
,
"userName,cardNo,national,phone,email,enableEquip,jobNo,remark,departmentTitle,roleTitles"
,
value
:
null
,
value
:
null
,
default
:
true
,
default
:
true
,
},
},
departmentId
:
{
departmentId
:
{
op
:
"In"
,
value
:
""
},
op
:
"In"
,
},
value
:
""
treeData
:
[],
},
tdHeight
:
""
,
},
tdHeightExcel
:
""
,
treeData
:
[],
treeInputSearch
:
""
,
tdHeight
:
""
,
treeHeight
:
""
,
tdHeightExcel
:
""
,
tableHeight
:
""
,
treeInputSearch
:
""
,
show7
:
false
,
//重置密码
treeHeight
:
""
,
show3
:
false
,
//授权角色
tableHeight
:
""
,
authList
:
[],
show7
:
false
,
//重置密码
authList1
:
[],
show3
:
false
,
//授权角色
authModel
:
{
default
:
[],
extra
:
[]
},
authList
:
[],
ids
:
[],
authList1
:
[],
addModal
:
false
,
authModel
:
{
editModal
:
false
,
default
:
[],
detailModal
:
false
,
extra
:
[]
deletelModal
:
false
,
},
syncAccountModal
:
false
,
ids
:
[],
curId
:
0
,
addModal
:
false
,
columns
:
[
editModal
:
false
,
// {
detailModal
:
false
,
// title: '序号',
deletelModal
:
false
,
// type: 'index',
syncAccountModal
:
false
,
// width: 80,
curId
:
0
,
// align: 'center'
columns
:
[
// },
// {
{
key
:
"id"
,
title
:
this
.
l
(
"id"
),
hide
:
true
,
align
:
"left"
},
// title: '序号',
{
// type: 'index',
key
:
"userName"
,
// width: 80,
title
:
this
.
l
(
"userName"
),
// align: 'center'
align
:
"left"
,
// },
easy
:
true
,
high
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
h
(
"op"
,
{
{
attrs
:
{
oprate
:
"detail"
},
key
:
"id"
,
on
:
{
click
:
()
=>
this
.
detail
(
params
.
row
.
id
)
},
title
:
this
.
l
(
"id"
),
hide
:
true
,
align
:
"left"
},
},
params
.
row
.
userName
{
),
key
:
"userName"
,
]);
title
:
this
.
l
(
"userName"
),
},
align
:
"left"
,
},
easy
:
true
,
// {
high
:
true
,
// key: 'cardTypeId',
render
:
(
h
,
params
)
=>
{
// title: this.l('cardTypeId'),
return
h
(
"div"
,
{
// align: 'left',
class
:
"action"
// high: true,
},
[
// hide: true
h
(
// },
"op"
,
{
{
attrs
:
{
key
:
"cardNo"
,
oprate
:
"detail"
title
:
this
.
l
(
"cardNo"
),
},
align
:
"left"
,
on
:
{
easy
:
true
,
click
:
()
=>
this
.
detail
(
params
.
row
.
id
)
high
:
true
,
},
},
params
.
row
.
userName
),
]);
},
},
// {
// key: 'cardTypeId',
// title: this.l('cardTypeId'),
// align: 'left',
// high: true,
// hide: true
// },
{
key
:
"cardNo"
,
title
:
this
.
l
(
"cardNo"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
},
{
key
:
"gender"
,
title
:
this
.
l
(
"gender"
),
align
:
"center"
,
high
:
true
,
code
:
"User.base.gender"
,
},
{
key
:
"birthday"
,
title
:
this
.
l
(
"birthday"
),
align
:
"center"
,
high
:
true
,
type
:
"date"
,
},
{
key
:
"degreeId"
,
title
:
this
.
l
(
"degreeId"
),
align
:
"left"
,
high
:
true
,
code
:
"User.base.degree"
,
},
{
key
:
"status"
,
title
:
this
.
l
(
"status"
),
align
:
"center"
,
high
:
true
,
code
:
"User.base.status"
,
},
{
key
:
"departmentId"
,
title
:
this
.
l
(
"departmentId"
),
align
:
"right"
,
easy
:
true
,
high
:
true
,
},
{
key
:
"departmentTitle"
,
title
:
this
.
l
(
"departmentTitle"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
},
{
key
:
"roleTitles"
,
title
:
this
.
l
(
"roleTitles"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
hide
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
,
class
:
params
.
row
.
roleTitles
==
null
||
params
.
row
.
roleTitles
==
""
?
"empower"
:
"detail"
,
},
on
:
{
click
:
()
=>
this
.
authorize
(
params
.
row
.
id
)
},
},
params
.
row
.
roleTitles
==
null
||
params
.
row
.
roleTitles
==
""
?
"授权"
:
params
.
row
.
roleTitles
),
]);
},
},
{
key
:
"accountId"
,
title
:
this
.
l
(
"accountId"
),
hide
:
true
,
align
:
"left"
,
},
// {
// key: 'userType',
// title: this.l('userType'),
// hide: true,
// align: 'left'
// },
{
key
:
"phone"
,
title
:
this
.
l
(
"phone"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
},
{
key
:
"email"
,
title
:
this
.
l
(
"email"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
},
{
key
:
"licensedToWork"
,
title
:
this
.
l
(
"licensedToWork"
),
align
:
"left"
,
},
{
key
:
"positionId"
,
title
:
this
.
l
(
"positionId"
),
align
:
"left"
,
high
:
true
,
code
:
"User.base.position"
,
},
{
key
:
"titleId"
,
title
:
this
.
l
(
"titleId"
),
align
:
"left"
,
high
:
true
,
code
:
"User.base.jobtitle"
,
},
{
key
:
"creatorUserId"
,
title
:
this
.
l
(
"creatorUserId"
),
align
:
"left"
,
import
:
false
,
hide
:
true
,
},
{
key
:
"creationTime"
,
title
:
this
.
l
(
"creationTime"
),
align
:
"left"
,
import
:
false
,
hide
:
true
,
},
{
key
:
"lastModifierUserId"
,
title
:
this
.
l
(
"lastModifierUserId"
),
align
:
"left"
,
import
:
false
,
hide
:
true
,
},
{
key
:
"lastModificationTime"
,
title
:
this
.
l
(
"lastModificationTime"
),
align
:
"left"
,
import
:
false
,
hide
:
true
,
},
{
title
:
"操作"
,
key
:
"action"
,
width
:
180
,
align
:
"right"
,
import
:
false
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
,
class
:
"empower"
,
},
on
:
{
click
:
()
=>
this
.
syncAccount
(
params
.
row
)
},
},
params
.
row
.
accountId
==
0
?
"同步"
:
""
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"edit"
},
on
:
{
click
:
()
=>
this
.
edit
(
params
.
row
.
id
)
},
},
"编辑"
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"remove"
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
)
},
},
"删除"
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
,
},
on
:
{
click
:
()
=>
this
.
openReset
(
params
.
row
)
},
},
"重置密码"
),
]);
},
},
],
selectRow
:
{},
//删除时选中的行数据
//导入导出时使用start
formatList
:
[
"xlsx"
],
searchs
:
{
pageIndex
:
1
,
pageSize
:
1000
,
conditions
:
[],
},
list
:
[],
modalImport
:
false
,
excelData
:
[],
departArr
:
[],
//部门list
columnsImport
:
[],
//导入导出时使用end
};
},
created
()
{
this
.
treeHeight
=
window
.
innerHeight
-
150
;
this
.
tdHeight
=
window
.
innerHeight
-
240
;
this
.
tdHeightExcel
=
window
.
innerHeight
-
240
;
//导出对列表头进行预加载start
let
tempCol
=
this
.
$u
.
clone
(
this
.
columns
);
tempCol
.
forEach
((
ele
,
index
)
=>
{
if
(
ele
.
key
==
"action"
)
{
ele
.
hide
=
true
;
}
});
this
.
columnsImport
=
tempCol
;
//导出对列表头进行预加载end
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
treeHeight
=
window
.
screenHeight
-
150
;
this
.
tdHeight
=
window
.
screenHeight
-
240
;
this
.
tdHeightExcel
=
window
.
innerHeight
-
240
;
})();
};
this
.
initTree
();
this
.
loadrole
(
0
);
this
.
loadrole
(
1
);
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
methods
:
{
addOk
()
{
this
.
$refs
.
grid
.
load
();
// this.$refs.grid.reload(this.easySearch)
this
.
addModal
=
false
;
this
.
detailModal
=
false
;
this
.
editModal
=
false
;
this
.
curId
=
0
;
//this.$refs.grid.easySearch()
},
},
{
search
()
{
key
:
"gender"
,
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
title
:
this
.
l
(
"gender"
),
align
:
"center"
,
high
:
true
,
code
:
"User.base.gender"
,
},
},
{
detail
(
id
)
{
key
:
"birthday"
,
this
.
detailModal
=
true
;
title
:
this
.
l
(
"birthday"
),
this
.
curId
=
id
;
align
:
"center"
,
high
:
true
,
type
:
"date"
,
},
},
{
edit
(
id
)
{
key
:
"degreeId"
,
this
.
editModal
=
true
;
title
:
this
.
l
(
"degreeId"
),
this
.
curId
=
id
;
align
:
"left"
,
high
:
true
,
code
:
"User.base.degree"
,
},
},
{
key
:
"status"
,
remove
(
row
)
{
title
:
this
.
l
(
"status"
),
this
.
deletelModal
=
true
;
align
:
"center"
,
this
.
curId
=
row
.
id
;
high
:
true
,
this
.
selectRow
=
row
;
code
:
"User.base.status"
,
},
},
{
removeOk
()
{
key
:
"departmentId"
,
Api
.
delete
({
title
:
this
.
l
(
"departmentId"
),
id
:
this
.
curId
align
:
"right"
,
}).
then
((
r
)
=>
{
easy
:
true
,
if
(
r
.
success
)
{
high
:
true
,
this
.
$refs
.
grid
.
load
();
this
.
deletelModal
=
false
;
if
(
this
.
selectRow
.
accountId
>
0
)
{
//删除成功后更新auth start
let
parms
=
{
userId
:
this
.
curId
,
accountId
:
this
.
selectRow
.
accountId
,
tenantCode
:
util
.
cookies
.
get
(
"tanantCode"
),
isDeleted
:
true
,
name
:
this
.
selectRow
.
userName
,
};
Api
.
authAccount
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
}
});
}
//删除成功后更新auth end
this
.
$Message
.
success
(
"删除成功"
);
}
});
},
},
{
removeCancel
()
{
key
:
"departmentTitle"
,
this
.
deletelModal
=
false
;
title
:
this
.
l
(
"departmentTitle"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
},
},
cancel
()
{
{
this
.
curId
=
0
;
key
:
"roleTitles"
,
this
.
addModal
=
false
;
title
:
this
.
l
(
"roleTitles"
),
this
.
detailModal
=
false
;
align
:
"left"
,
this
.
editModal
=
false
;
easy
:
true
,
this
.
deletedlModal
=
false
;
high
:
true
,
this
.
syncAccountModal
=
false
;
hide
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
,
class
:
params
.
row
.
roleTitles
==
null
||
params
.
row
.
roleTitles
==
""
?
"empower"
:
"detail"
,
},
on
:
{
click
:
()
=>
this
.
authorize
(
params
.
row
.
id
)
},
},
params
.
row
.
roleTitles
==
null
||
params
.
row
.
roleTitles
==
""
?
"授权"
:
params
.
row
.
roleTitles
),
]);
},
},
},
{
l
(
key
)
{
key
:
"accountId"
,
let
vkey
=
"user"
+
"."
+
key
;
title
:
this
.
l
(
"accountId"
),
return
this
.
$t
(
vkey
)
||
key
;
hide
:
true
,
align
:
"left"
,
},
},
// {
initTree
()
{
// key: 'userType',
this
.
$http
.
department
.
getDepartmentTree
(
this
.
treeData
);
// title: this.l('userType'),
// hide: true,
// align: 'left'
// },
{
key
:
"phone"
,
title
:
this
.
l
(
"phone"
),
align
:
"left"
,
easy
:
true
,
high
:
true
,
},
},
{
selectTreeNode1
(
value
)
{
key
:
"email"
,
if
(
value
!=
""
)
{
title
:
this
.
l
(
"email"
),
this
.
searchObj
.
departmentId
=
null
;
align
:
"left"
,
this
.
searchObj
.
level_Desc
=
value
[
0
].
value
;
easy
:
true
,
this
.
mDatas
.
splice
(
0
);
high
:
true
,
this
.
$http
.
sysUser
.
getSearchTable2
(
this
.
mDatas
,
this
.
searchObj
);
}
},
},
{
selectTreeNode
(
value
)
{
key
:
"licensedToWork"
,
if
(
value
.
length
>
0
)
{
title
:
this
.
l
(
"licensedToWork"
),
this
.
ids
=
[];
align
:
"left"
,
this
.
getAllIds
(
value
);
if
(
this
.
ids
.
length
>
0
)
{
this
.
easySearch
.
departmentId
.
value
=
this
.
ids
;
}
else
{
this
.
easySearch
.
departmentId
.
value
=
[
-
1
];
}
this
.
$refs
.
grid
.
easySearch
();
}
},
},
{
getAllIds
(
trees
)
{
key
:
"positionId"
,
trees
.
forEach
((
data
,
index
)
=>
{
title
:
this
.
l
(
"positionId"
),
var
that
=
this
;
align
:
"left"
,
this
.
ids
.
push
(
data
.
value
);
high
:
true
,
if
(
data
.
children
.
length
>
0
)
{
code
:
"User.base.position"
,
this
.
getAllIds
(
data
.
children
);
}
});
},
},
{
//重置密碼
key
:
"titleId"
,
openReset
(
row
)
{
title
:
this
.
l
(
"titleId"
),
this
.
show7
=
true
;
align
:
"left"
,
this
.
curId
=
row
.
id
;
high
:
true
,
this
.
selectRow
=
row
;
code
:
"User.base.jobtitle"
,
},
},
{
reset
()
{
key
:
"creatorUserId"
,
let
parms
=
{
title
:
this
.
l
(
"creatorUserId"
),
userId
:
this
.
curId
,
align
:
"left"
,
accountId
:
this
.
selectRow
.
accountId
,
import
:
false
,
};
hide
:
true
,
Api
.
authResetpassword
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"重置成功!"
);
}
else
{
this
.
$Message
.
error
(
"重置失败!"
);
}
});
},
},
{
//授权角色
key
:
"creationTime"
,
loadrole
(
type
)
{
title
:
this
.
l
(
"creationTime"
),
var
url
=
`
${
systemUrl
}
/MyRole/GetRolesAsync`
;
align
:
"left"
,
var
data
=
[];
import
:
false
,
service
.
get
(
`
${
url
}
`
,
{
hide
:
true
,
role_type
:
type
}).
then
((
response
)
=>
{
data
=
response
.
result
.
items
;
if
(
type
==
1
)
{
this
.
authList
=
data
;
}
if
(
type
==
0
)
{
this
.
authList1
=
data
;
}
});
},
},
{
authorize
(
id
)
{
key
:
"lastModifierUserId"
,
//授权
title
:
this
.
l
(
"lastModifierUserId"
),
this
.
authModel
.
default
=
[];
align
:
"left"
,
this
.
authModel
.
extra
=
[];
import
:
false
,
this
.
curId
=
id
;
hide
:
true
,
this
.
show3
=
true
;
var
url
=
`
${
systemUrl
}
/MyUserRole/GetPaged`
;
service
.
get
(
`
${
url
}
`
,
{
userId
:
id
}).
then
((
response
)
=>
{
var
data
=
response
.
result
.
items
;
var
dt1
=
data
.
filter
(
function
(
ite
)
{
return
ite
.
role_type
==
0
;
});
var
dt2
=
data
.
filter
(
function
(
ite
)
{
return
ite
.
role_type
==
1
;
});
dt1
.
forEach
((
item
,
i
)
=>
{
this
.
authModel
.
default
.
push
(
item
.
roleId
);
});
dt2
.
forEach
((
item
,
i
)
=>
{
this
.
authModel
.
extra
.
push
(
item
.
roleId
);
});
});
},
},
{
authOk
()
{
key
:
"lastModificationTime"
,
var
url
=
`
${
systemUrl
}
/MyUserRole/CreateOrUpdate`
;
title
:
this
.
l
(
"lastModificationTime"
),
service
align
:
"left"
,
.
post
(
`
${
url
}
`
,
{
import
:
false
,
myUserRole
:
{
hide
:
true
,
userId
:
this
.
curId
,
RoleIds
:
this
.
allChecked
.
join
(
","
),
},
})
.
then
((
response
)
=>
{
if
(
response
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
this
.
authModel
.
extra
=
[];
this
.
authModel
.
default
=
[];
this
.
$refs
.
grid
.
easySearch
();
}
})
.
catch
((
error
)
=>
{
this
.
$Message
.
error
(
"保存失败"
);
});
},
},
{
authCancle
()
{},
title
:
"操作"
,
//同步账户start
key
:
"action"
,
syncAccount
(
row
)
{
width
:
180
,
this
.
syncAccountModal
=
true
;
align
:
"right"
,
this
.
selectRow
=
row
;
import
:
false
,
render
:
(
h
,
params
)
=>
{
return
h
(
"div"
,
{
class
:
"action"
},
[
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
,
class
:
"empower"
,
},
on
:
{
click
:
()
=>
this
.
syncAccount
(
params
.
row
)
},
},
params
.
row
.
accountId
==
0
?
"同步"
:
""
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"edit"
},
on
:
{
click
:
()
=>
this
.
edit
(
params
.
row
.
id
)
},
},
"编辑"
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"remove"
},
on
:
{
click
:
()
=>
this
.
remove
(
params
.
row
)
},
},
"删除"
),
h
(
"op"
,
{
attrs
:
{
oprate
:
"detail"
,
},
on
:
{
click
:
()
=>
this
.
openReset
(
params
.
row
)
},
},
"重置密码"
),
]);
},
},
},
],
syncAccountOk
()
{
selectRow
:
{},
//删除时选中的行数据
//导入导出时使用start
formatList
:
[
"xlsx"
],
searchs
:
{
pageIndex
:
1
,
pageSize
:
1000
,
conditions
:
[],
},
list
:
[],
modalImport
:
false
,
excelData
:
[],
departArr
:
[],
//部门list
columnsImport
:
[],
//导入导出时使用end
};
},
created
()
{
this
.
treeHeight
=
window
.
innerHeight
-
150
;
this
.
tdHeight
=
window
.
innerHeight
-
240
;
this
.
tdHeightExcel
=
window
.
innerHeight
-
240
;
//导出对列表头进行预加载start
let
tempCol
=
this
.
$u
.
clone
(
this
.
columns
);
tempCol
.
forEach
((
ele
,
index
)
=>
{
if
(
ele
.
key
==
"action"
)
{
ele
.
hide
=
true
;
}
});
this
.
columnsImport
=
tempCol
;
//导出对列表头进行预加载end
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
treeHeight
=
window
.
screenHeight
-
150
;
this
.
tdHeight
=
window
.
screenHeight
-
240
;
this
.
tdHeightExcel
=
window
.
innerHeight
-
240
;
})();
};
this
.
initTree
();
this
.
loadrole
(
0
);
this
.
loadrole
(
1
);
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
methods
:
{
addOk
()
{
this
.
$refs
.
grid
.
load
();
// this.$refs.grid.reload(this.easySearch)
this
.
addModal
=
false
;
this
.
detailModal
=
false
;
this
.
editModal
=
false
;
this
.
curId
=
0
;
//this.$refs.grid.easySearch()
},
search
()
{
this
.
$refs
.
grid
.
reload
(
this
.
easySearch
);
},
detail
(
id
)
{
this
.
detailModal
=
true
;
this
.
curId
=
id
;
},
edit
(
id
)
{
this
.
editModal
=
true
;
this
.
curId
=
id
;
},
remove
(
row
)
{
this
.
deletelModal
=
true
;
this
.
curId
=
row
.
id
;
this
.
selectRow
=
row
;
},
removeOk
()
{
Api
.
delete
({
id
:
this
.
curId
}).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
$refs
.
grid
.
load
();
this
.
deletelModal
=
false
;
if
(
this
.
selectRow
.
accountId
>
0
)
{
//删除成功后更新auth start
let
parms
=
{
let
parms
=
{
userId
:
this
.
curI
d
,
userId
:
this
.
selectRow
.
i
d
,
accountId
:
this
.
selectRow
.
accountId
,
loginName
:
this
.
selectRow
.
phone
,
tanantCode
:
util
.
cookies
.
get
(
"tanantCode"
)
,
status
:
this
.
selectRow
.
status
,
isDeleted
:
true
,
tenantCode
:
util
.
cookies
.
get
(
"tanantCode"
)
,
name
:
this
.
selectRow
.
userName
,
name
:
this
.
selectRow
.
userName
,
};
};
Api
.
authAccount
(
parms
).
then
((
res
)
=>
{
if
(
this
.
selectRow
.
phone
&&
this
.
selectRow
.
phone
!=
""
)
{
if
(
res
.
success
)
{
Api
.
authAccount
(
parms
).
then
((
res
)
=>
{
this
.
$Message
.
success
(
"账户同步成功"
);
if
(
res
.
success
)
{
}
this
.
$Message
.
success
(
"账户同步成功"
);
});
let
parms1
=
{
}
userId
:
parms
.
userId
,
//删除成功后更新auth end
accountId
:
res
.
result
,
};
Api
.
updateAccount
(
parms1
).
then
((
res1
)
=>
{
if
(
res1
.
success
)
{
this
.
$Message
.
success
(
"操作成功"
);
this
.
$refs
.
grid
.
easySearch
();
}
else
{
this
.
$Message
.
error
(
"同步失败"
);
}
});
}
});
}
else
{
this
.
$Message
.
error
(
"请完善个人电话信息"
);
}
},
//同步账户end
//导出excel
export2Excel
()
{
//当前显示数据
var
where
=
[];
var
conditions
=
this
.
easySearch
;
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
)
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
}
});
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
)
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
}
}
});
}
this
.
searchs
.
pageIndex
=
1
;
this
.
searchs
.
conditions
=
where
;
this
.
searchs
.
pageSize
=
1000
;
this
.
$Message
.
success
(
"删除成功"
);
this
.
$api
.
post
(
this
.
action
,
this
.
searchs
).
then
((
r
)
=>
{
}
this
.
list
=
r
.
result
.
items
;
});
const
tHeader
=
[];
// 设置Excel的表格第一行的标题
},
const
filterVal
=
[];
//list里对象的属性
removeCancel
()
{
var
tempCol
=
[];
this
.
deletelModal
=
false
;
var
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
//导出列标题信息griddata this.$refs.grid.columnsCur
},
columnsCur
.
forEach
((
el
)
=>
{
cancel
()
{
if
((
el
.
hide
&&
!
el
.
import
)
||
(
!
el
.
hide
&&
el
.
key
!=
"action"
))
{
this
.
curId
=
0
;
if
(
el
.
code
)
{
this
.
addModal
=
false
;
//tHeader.push(el.key + "DirName");
this
.
detailModal
=
false
;
//filterVal.push(el.key + "DirName");
this
.
editModal
=
false
;
//tempCol.push({ key: el.key + "DirName", code: el.code }); //临时存放code数据字典的字段及对应的数据字典code
this
.
deletedlModal
=
false
;
tempCol
.
push
({
this
.
syncAccountModal
=
false
;
key
:
el
.
key
,
},
code
:
el
.
code
l
(
key
)
{
});
//临时存放code数据字典的字段及对应的数据字典code
let
vkey
=
"user"
+
"."
+
key
;
}
return
this
.
$t
(
vkey
)
||
key
;
tHeader
.
push
(
this
.
l
(
el
.
key
));
},
filterVal
.
push
(
el
.
key
);
initTree
()
{
}
this
.
$http
.
department
.
getDepartmentTree
(
this
.
treeData
);
});
},
this
.
list
.
forEach
((
e
)
=>
{
selectTreeNode1
(
value
)
{
//给导出数据增加数据字典对应的name
if
(
value
!=
""
)
{
tempCol
.
forEach
((
ele
)
=>
{
this
.
searchObj
.
departmentId
=
null
;
e
[
ele
.
key
]
=
this
.
$u
.
dirName
(
this
.
searchObj
.
level_Desc
=
value
[
0
].
value
;
this
.
$store
.
getters
.
dictionaryByKey
(
ele
.
code
),
this
.
mDatas
.
splice
(
0
);
e
[
ele
.
key
]
this
.
$http
.
sysUser
.
getSearchTable2
(
this
.
mDatas
,
this
.
searchObj
);
);
}
});
},
});
selectTreeNode
(
value
)
{
let
nowDate
=
this
.
$u
.
getNowTime
();
//年月日时分秒yyyyMMddhhmmss
if
(
value
.
length
>
0
)
{
//获取导出数据结束
this
.
ids
=
[];
this
.
$u
.
outExcel
(
this
.
getAllIds
(
value
);
"用户管理("
+
nowDate
+
")"
,
if
(
this
.
ids
.
length
>
0
)
{
tHeader
,
this
.
easySearch
.
departmentId
.
value
=
this
.
ids
;
filterVal
,
}
else
{
this
.
list
this
.
easySearch
.
departmentId
.
value
=
[
-
1
];
);
}
});
this
.
$refs
.
grid
.
easySearch
();
},
}
//导入excel
},
//打开弹出层
getAllIds
(
trees
)
{
import2Excel
()
{
trees
.
forEach
((
data
,
index
)
=>
{
this
.
modalImport
=
true
;
var
that
=
this
;
this
.
excelData
=
[];
this
.
ids
.
push
(
data
.
value
);
this
.
$refs
.
uploadfile
.
clearFiles
();
if
(
data
.
children
.
length
>
0
)
{
ApiDepart
.
getpaged
().
then
((
r
)
=>
{
this
.
getAllIds
(
data
.
children
);
this
.
departArr
=
r
.
result
.
items
;
}
});
});
},
},
//导入excel文件
//重置密碼
async
beforeUpload
(
file
)
{
openReset
(
row
)
{
this
.
excelData
=
[];
this
.
show7
=
true
;
this
.
$refs
.
uploadfile
.
clearFiles
();
//清除上一次上传文件列表
this
.
curId
=
row
.
id
;
var
tempColums
=
this
.
$u
.
clone
(
this
.
columnsImport
);
this
.
selectRow
=
row
;
const
workbook
=
await
this
.
$u
.
readXLSX
(
file
);
},
const
sheet2JSONOpts
=
{
reset
()
{
defval
:
""
,
//给defval赋值为空的字符串
let
parms
=
{
userId
:
this
.
curId
,
accountId
:
this
.
selectRow
.
accountId
,
};
Api
.
authResetpassword
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"重置成功!"
);
}
else
{
this
.
$Message
.
error
(
"重置失败!"
);
}
});
},
//授权角色
loadrole
(
type
)
{
var
url
=
`
${
systemUrl
}
/MyRole/GetRolesAsync`
;
var
data
=
[];
service
.
get
(
`
${
url
}
`
,
{
role_type
:
type
}).
then
((
response
)
=>
{
data
=
response
.
result
.
items
;
if
(
type
==
1
)
{
this
.
authList
=
data
;
}
if
(
type
==
0
)
{
this
.
authList1
=
data
;
}
});
},
authorize
(
id
)
{
//授权
this
.
authModel
.
default
=
[];
this
.
authModel
.
extra
=
[];
this
.
curId
=
id
;
this
.
show3
=
true
;
var
url
=
`
${
systemUrl
}
/MyUserRole/GetPaged`
;
service
.
get
(
`
${
url
}
`
,
{
userId
:
id
}).
then
((
response
)
=>
{
var
data
=
response
.
result
.
items
;
var
dt1
=
data
.
filter
(
function
(
ite
)
{
return
ite
.
role_type
==
0
;
});
var
dt2
=
data
.
filter
(
function
(
ite
)
{
return
ite
.
role_type
==
1
;
});
dt1
.
forEach
((
item
,
i
)
=>
{
this
.
authModel
.
default
.
push
(
item
.
roleId
);
});
dt2
.
forEach
((
item
,
i
)
=>
{
this
.
authModel
.
extra
.
push
(
item
.
roleId
);
});
});
},
authOk
()
{
var
url
=
`
${
systemUrl
}
/MyUserRole/CreateOrUpdate`
;
service
.
post
(
`
${
url
}
`
,
{
myUserRole
:
{
userId
:
this
.
curId
,
RoleIds
:
this
.
allChecked
.
join
(
","
),
},
})
.
then
((
response
)
=>
{
if
(
response
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
this
.
authModel
.
extra
=
[];
this
.
authModel
.
default
=
[];
this
.
$refs
.
grid
.
easySearch
();
}
})
.
catch
((
error
)
=>
{
this
.
$Message
.
error
(
"保存失败"
);
});
},
authCancle
()
{},
//同步账户start
syncAccount
(
row
)
{
this
.
syncAccountModal
=
true
;
this
.
selectRow
=
row
;
},
syncAccountOk
()
{
let
parms
=
{
userId
:
this
.
selectRow
.
id
,
loginName
:
this
.
selectRow
.
phone
,
status
:
this
.
selectRow
.
status
,
tanantCode
:
util
.
cookies
.
get
(
"tanantCode"
),
name
:
this
.
selectRow
.
userName
,
};
if
(
this
.
selectRow
.
phone
&&
this
.
selectRow
.
phone
!=
""
)
{
Api
.
authAccount
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
let
parms1
=
{
userId
:
parms
.
userId
,
accountId
:
res
.
result
,
};
};
Api
.
updateAccount
(
parms1
).
then
((
res1
)
=>
{
var
csv
=
XLSX
.
utils
.
sheet_to_csv
(
if
(
res1
.
success
)
{
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]],
this
.
$Message
.
success
(
"操作成功"
);
sheet2JSONOpts
this
.
$refs
.
grid
.
easySearch
();
);
}
else
{
var
lines
=
csv
.
split
(
"
\n
"
);
//第一行标题
this
.
$Message
.
error
(
"同步失败"
);
var
headers
=
lines
[
0
].
split
(
","
);
}
var
arrTi
=
[];
//转换到colum后的list表头start
headers
.
forEach
((
elHead
)
=>
{
tempColums
.
forEach
((
elCol
)
=>
{
if
(
elHead
==
elCol
.
title
)
{
//elHead=elCol.key
arrTi
.
push
(
elCol
.
key
);
}
});
});
});
}
headers
=
arrTi
;
});
//转换到colum后的list表头end
}
else
{
var
result
=
[];
this
.
$Message
.
error
(
"请完善个人电话信息"
);
for
(
var
i
=
1
;
i
<
lines
.
length
-
1
;
i
++
)
{
}
var
obj
=
{};
},
var
currentline
=
lines
[
i
].
split
(
","
);
//同步账户end
for
(
var
j
=
0
;
j
<
headers
.
length
;
j
++
)
{
//导出excel
obj
[
headers
[
j
]]
=
currentline
[
j
];
export2Excel
()
{
//当前显示数据
var
where
=
[];
var
conditions
=
this
.
easySearch
;
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
)
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
}
}
});
result
.
push
(
obj
);
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
)
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
}
}
}
//对读取的excel文件数据进行处理
});
}
this
.
searchs
.
pageIndex
=
1
;
this
.
searchs
.
conditions
=
where
;
this
.
searchs
.
pageSize
=
1000
;
this
.
$api
.
post
(
this
.
action
,
this
.
searchs
).
then
((
r
)
=>
{
var
arrTitleUse
=
[];
//使用数据字典的字段
this
.
list
=
r
.
result
.
items
;
tempColums
.
forEach
((
elCode
)
=>
{
const
tHeader
=
[];
// 设置Excel的表格第一行的标题
if
(
elCode
.
code
)
{
const
filterVal
=
[];
//list里对象的属性
arrTitleUse
.
push
({
var
tempCol
=
[];
key
:
elCode
.
key
,
var
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
//导出列标题信息griddata this.$refs.grid.columnsCur
code
:
elCode
.
code
columnsCur
.
forEach
((
el
)
=>
{
});
if
((
el
.
hide
&&
!
el
.
import
)
||
(
!
el
.
hide
&&
el
.
key
!=
"action"
))
{
}
if
(
el
.
code
)
{
});
//tHeader.push(el.key + "DirName");
//filterVal.push(el.key + "DirName");
//tempCol.push({ key: el.key + "DirName", code: el.code }); //临时存放code数据字典的字段及对应的数据字典code
tempCol
.
push
({
key
:
el
.
key
,
code
:
el
.
code
});
//临时存放code数据字典的字段及对应的数据字典code
}
tHeader
.
push
(
this
.
l
(
el
.
key
));
filterVal
.
push
(
el
.
key
);
}
});
this
.
list
.
forEach
((
e
)
=>
{
//给导出数据增加数据字典对应的name
tempCol
.
forEach
((
ele
)
=>
{
e
[
ele
.
key
]
=
this
.
$u
.
dirName
(
this
.
$store
.
getters
.
dictionaryByKey
(
ele
.
code
),
e
[
ele
.
key
]
);
});
});
let
nowDate
=
this
.
$u
.
getNowTime
();
//年月日时分秒yyyyMMddhhmmss
//获取导出数据结束
this
.
$u
.
outExcel
(
"用户管理("
+
nowDate
+
")"
,
tHeader
,
filterVal
,
this
.
list
);
});
},
//导入excel
//打开弹出层
import2Excel
()
{
this
.
modalImport
=
true
;
this
.
excelData
=
[];
this
.
$refs
.
uploadfile
.
clearFiles
();
ApiDepart
.
getpaged
().
then
((
r
)
=>
{
this
.
departArr
=
r
.
result
.
items
;
});
},
//导入excel文件
async
beforeUpload
(
file
)
{
this
.
excelData
=
[];
this
.
$refs
.
uploadfile
.
clearFiles
();
//清除上一次上传文件列表
var
tempColums
=
this
.
$u
.
clone
(
this
.
columnsImport
);
const
workbook
=
await
this
.
$u
.
readXLSX
(
file
);
const
sheet2JSONOpts
=
{
defval
:
""
,
//给defval赋值为空的字符串
};
var
csv
=
XLSX
.
utils
.
sheet_to_csv
(
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]],
sheet2JSONOpts
);
var
lines
=
csv
.
split
(
"
\n
"
);
//第一行标题
var
headers
=
lines
[
0
].
split
(
","
);
var
arrTi
=
[];
//转换到colum后的list表头start
headers
.
forEach
((
elHead
)
=>
{
tempColums
.
forEach
((
elCol
)
=>
{
if
(
elHead
==
elCol
.
title
)
{
//elHead=elCol.key
arrTi
.
push
(
elCol
.
key
);
}
});
});
headers
=
arrTi
;
//转换到colum后的list表头end
var
result
=
[];
for
(
var
i
=
1
;
i
<
lines
.
length
-
1
;
i
++
)
{
var
obj
=
{};
var
currentline
=
lines
[
i
].
split
(
","
);
for
(
var
j
=
0
;
j
<
headers
.
length
;
j
++
)
{
obj
[
headers
[
j
]]
=
currentline
[
j
];
}
result
.
push
(
obj
);
}
//对读取的excel文件数据进行处理
var
arrTitleUse
=
[];
//使用数据字典的字段
result
.
forEach
((
ele
)
=>
{
tempColums
.
forEach
((
elCode
)
=>
{
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if
(
elCode
.
code
)
{
if
(
arrTitleUse
.
push
({
key
:
elCode
.
key
,
code
:
elCode
.
code
});
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
;
}
});
}
result
.
forEach
((
ele
)
=>
{
//对列表里的数据字典项进行处理
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
arrTitleUse
.
forEach
((
elem
)
=>
{
if
(
if
(
ele
[
elem
.
key
]
&&
ele
[
elem
.
key
]
!=
""
&&
ele
[
elem
.
key
]
!=
null
)
{
ele
.
departmentTitle
&&
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
ele
.
departmentTitle
!=
""
&&
ele
[
elem
.
key
]
=
this
.
$u
.
dirCode
(
(
!
ele
.
departmentId
||
ele
.
departmentId
==
""
)
this
.
$store
.
getters
.
dictionaryByKey
(
elem
.
code
),
)
{
ele
[
elem
.
key
]
this
.
departArr
.
forEach
((
e
)
=>
{
);
if
(
ele
.
departmentTitle
&&
ele
.
departmentTitle
==
e
.
name
)
{
}
ele
.
departmentId
=
e
.
id
;
});
}
});
});
this
.
excelData
=
result
;
}
else
if
(
//console.log(workbook);
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
return
false
;
ele
.
departmentId
&&
},
ele
.
departmentId
+
""
!=
""
&&
//确定批量导入
(
!
ele
.
departmentTitle
||
ele
.
departmentTitle
==
""
)
importOk
()
{
)
{
let
tempData
=
this
.
$u
.
clone
(
this
.
excelData
);
this
.
departArr
.
forEach
((
e
)
=>
{
let
tempList
=
[];
if
(
ele
.
departmentId
&&
ele
.
departmentId
==
e
.
id
)
{
tempData
.
forEach
((
ele
)
=>
{
ele
.
departmentTitle
=
e
.
name
;
let
obj
=
{
}
userName
:
ele
.
userName
,
});
cardNo
:
ele
.
cardNo
,
}
gender
:
ele
.
gender
,
birthday
:
ele
.
birthday
,
degreeId
:
ele
.
degreeId
,
departmentId
:
ele
.
departmentId
,
status
:
ele
.
status
,
phone
:
ele
.
phone
,
email
:
ele
.
email
,
licensedToWork
:
ele
.
licensedToWork
,
positionId
:
ele
.
positionId
,
titleId
:
ele
.
titleId
,
departmentTitle
:
ele
.
departmentTitle
,
};
tempList
.
push
(
obj
);
});
let
parms
=
{
list
:
tempList
,
};
Api
.
accountreset
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"批量导入成功!"
);
this
.
$refs
.
grid
.
load
();
this
.
cancelExcel
();
}
else
{
this
.
$Message
.
error
(
"批量导入失败!"
);
}
});
},
//取消导入excel
cancelExcel
()
{
this
.
modalImport
=
false
;
this
.
excelData
=
[];
this
.
$refs
.
uploadfile
.
clearFiles
();
},
//旧方法,设置dirname,通过取excel第一行的数据定义colums
async
beforeUploadOld
(
file
)
{
this
.
excelData
=
[];
this
.
$refs
.
uploadfile
.
clearFiles
();
//清除上一次上传文件列表
//对列表里的数据字典项进行处理
const
workbook
=
await
this
.
$u
.
readXLSX
(
file
);
arrTitleUse
.
forEach
((
elem
)
=>
{
const
sheet2JSONOpts
=
{
if
(
ele
[
elem
.
key
]
&&
ele
[
elem
.
key
]
!=
""
&&
ele
[
elem
.
key
]
!=
null
)
{
defval
:
""
,
//给defval赋值为空的字符串
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
};
ele
[
elem
.
key
]
=
this
.
$u
.
dirCode
(
var
tempList
=
XLSX
.
utils
.
sheet_to_json
(
this
.
$store
.
getters
.
dictionaryByKey
(
elem
.
code
)
,
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]]
,
ele
[
elem
.
key
]
sheet2JSONOpts
);
);
}
//对读取的excel文件数据进行处理
});
var
tempColums
=
this
.
$u
.
clone
(
this
.
columnsImport
);
});
var
arrTitles
=
Object
.
keys
(
tempList
[
0
]);
//获取列表title
this
.
excelData
=
result
;
var
arrTitleUse
=
[];
//使用数据字典的字段
//console.log(workbook);
tempColums
.
forEach
((
elCode
)
=>
{
return
false
;
if
(
elCode
.
code
)
{
},
arrTitleUse
.
push
({
//确定批量导入
key
:
elCode
.
key
,
importOk
()
{
code
:
elCode
.
code
let
tempData
=
this
.
$u
.
clone
(
this
.
excelData
);
});
let
tempList
=
[];
}
tempData
.
forEach
((
ele
)
=>
{
});
let
obj
=
{
userName
:
ele
.
userName
,
cardNo
:
ele
.
cardNo
,
gender
:
ele
.
gender
,
birthday
:
ele
.
birthday
,
degreeId
:
ele
.
degreeId
,
departmentId
:
ele
.
departmentId
,
status
:
ele
.
status
,
phone
:
ele
.
phone
,
email
:
ele
.
email
,
licensedToWork
:
ele
.
licensedToWork
,
positionId
:
ele
.
positionId
,
titleId
:
ele
.
titleId
,
departmentTitle
:
ele
.
departmentTitle
,
};
tempList
.
push
(
obj
);
});
let
parms
=
{
list
:
tempList
,
};
Api
.
accountreset
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"批量导入成功!"
);
this
.
$refs
.
grid
.
load
();
this
.
cancelExcel
();
}
else
{
this
.
$Message
.
error
(
"批量导入失败!"
);
}
});
},
//取消导入excel
cancelExcel
()
{
this
.
modalImport
=
false
;
this
.
excelData
=
[];
this
.
$refs
.
uploadfile
.
clearFiles
();
},
//旧方法,设置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
)
=>
{
tempList
.
forEach
((
ele
)
=>
{
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if
(
if
(
ele
.
departmentTitle
&&
ele
.
departmentTitle
&&
ele
.
departmentTitle
!=
""
&&
ele
.
departmentTitle
!=
""
&&
(
!
ele
.
departmentId
||
ele
.
departmentId
==
""
)
(
!
ele
.
departmentId
||
ele
.
departmentId
==
""
)
)
{
)
{
this
.
departArr
.
forEach
((
e
)
=>
{
this
.
departArr
.
forEach
((
e
)
=>
{
if
(
ele
.
departmentTitle
&&
ele
.
departmentTitle
==
e
.
name
)
{
if
(
ele
.
departmentTitle
&&
ele
.
departmentTitle
==
e
.
name
)
{
ele
.
departmentId
=
e
.
id
;
ele
.
departmentId
=
e
.
id
;
}
}
});
});
}
else
if
(
}
else
if
(
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
ele
.
departmentId
&&
ele
.
departmentId
&&
ele
.
departmentId
+
""
!=
""
&&
ele
.
departmentId
+
""
!=
""
&&
(
!
ele
.
departmentTitle
||
ele
.
departmentTitle
==
""
)
(
!
ele
.
departmentTitle
||
ele
.
departmentTitle
==
""
)
)
{
)
{
this
.
departArr
.
forEach
((
e
)
=>
{
this
.
departArr
.
forEach
((
e
)
=>
{
if
(
ele
.
departmentId
&&
ele
.
departmentId
==
e
.
id
)
{
if
(
ele
.
departmentId
&&
ele
.
departmentId
==
e
.
id
)
{
ele
.
departmentTitle
=
e
.
name
;
ele
.
departmentTitle
=
e
.
name
;
}
}
});
});
}
}
//对列表里的数据字典项进行处理
//对列表里的数据字典项进行处理
arrTitleUse
.
forEach
((
elem
)
=>
{
arrTitleUse
.
forEach
((
elem
)
=>
{
if
(
ele
[
elem
.
key
]
&&
ele
[
elem
.
key
]
!=
""
&&
ele
[
elem
.
key
]
!=
null
)
{
if
(
ele
[
elem
.
key
]
&&
ele
[
elem
.
key
]
!=
""
&&
ele
[
elem
.
key
]
!=
null
)
{
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
ele
[
elem
.
key
]
=
this
.
$u
.
dirName
(
ele
[
elem
.
key
]
=
this
.
$u
.
dirName
(
this
.
$store
.
getters
.
dictionaryByKey
(
elem
.
code
),
this
.
$store
.
getters
.
dictionaryByKey
(
elem
.
code
),
ele
[
elem
.
key
]
ele
[
elem
.
key
]
);
);
}
}
});
});
});
});
this
.
excelData
=
tempList
;
this
.
excelData
=
tempList
;
console
.
log
(
workbook
);
console
.
log
(
workbook
);
return
false
;
return
false
;
},
},
},
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
;
},
},
allChecked
:
function
()
{
computed
:
{
return
[...
this
.
authModel
.
extra
,
...
this
.
authModel
.
default
];
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
;
},
allChecked
:
function
()
{
return
[...
this
.
authModel
.
extra
,
...
this
.
authModel
.
default
];
},
},
},
},
};
};
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.full {
.full {
margin-top: 0;
margin-top: 0;
.content {
margin-top: 10px;
.content {
}
margin-top: 10px;
}
}
}
</
style
>
</
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