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
4c158a8e
Commit
4c158a8e
authored
Aug 27, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tenantCode
parent
4b9a5ead
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
466 additions
and
432 deletions
+466
-432
add.vue
pages/basicData/user/add.vue
+231
-212
edit.vue
pages/basicData/user/edit.vue
+232
-217
index.vue
pages/basicData/user/index.vue
+2
-2
account.js
store/admin/account.js
+1
-1
No files found.
pages/basicData/user/add.vue
View file @
4c158a8e
<
template
>
<
template
>
<div
class=
"addUser"
>
<div
class=
"addUser"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Row
class=
"rowTitle100"
>
<Row
class=
"rowTitle100"
>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('userName')"
prop=
"userName"
>
<FormItem
:label=
"l('userName')"
prop=
"userName"
>
<Input
v-model=
"entity.userName"
></Input>
<Input
v-model=
"entity.userName"
></Input>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('cardNo')"
prop=
"cardNo"
>
<FormItem
:label=
"l('cardNo')"
prop=
"cardNo"
>
<Input
v-model=
"entity.cardNo"
></Input>
<Input
v-model=
"entity.cardNo"
></Input>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('status')"
prop=
"status"
>
<FormItem
:label=
"l('status')"
prop=
"status"
>
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
<DatePicker
type=
"date"
v-model=
"entity.birthday"
placeholder=
"请选择"
></DatePicker>
<DatePicker
type=
"date"
v-model=
"entity.birthday"
placeholder=
"请选择"
></DatePicker>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('phone')"
prop=
"phone"
>
<FormItem
:label=
"l('phone')"
prop=
"phone"
>
<Input
v-model=
"entity.phone"
/>
<Input
v-model=
"entity.phone"
/>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('email')"
>
<FormItem
:label=
"l('email')"
>
<Input
v-model=
"entity.email"
/>
<Input
v-model=
"entity.email"
/>
</FormItem>
</FormItem>
</Col>
</Col>
<!--
<Col
:span=
"12"
>
<!--
<Col
:span=
"12"
>
<FormItem
:label=
"l('enableEquip')"
prop=
"enableEquip"
>
<FormItem
:label=
"l('enableEquip')"
prop=
"enableEquip"
>
<Input
v-model=
"entity.enableEquip"
></Input>
<Input
v-model=
"entity.enableEquip"
></Input>
</FormItem>
</FormItem>
</Col>
-->
</Col>
-->
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('positionId')"
prop=
"positionId"
>
<FormItem
:label=
"l('positionId')"
prop=
"positionId"
>
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('property')"
>
<FormItem
:label=
"l('property')"
>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"24"
>
<Col
:span=
"24"
>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
</FormItem>
</FormItem>
</Col>
</Col>
</Row>
</Row>
<FormItem>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</FormItem>
</Form>
</Form>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
Api
from
"./api"
;
import
Api
from
"./api"
;
const
valideTel
=
(
rule
,
value
,
callback
)
=>
{
const
valideTel
=
(
rule
,
value
,
callback
)
=>
{
var
re
=
/^1
[
3-9
]{1}[
0-9
]{9}
/
;
var
re
=
/^1
[
3-9
]{1}[
0-9
]{9}
/
;
if
(
value
===
""
||
value
===
null
)
{
if
(
value
===
""
||
value
===
null
)
{
callback
(
new
Error
(
"请输入手机号"
));
callback
(
new
Error
(
"请输入手机号"
));
}
else
if
(
!
re
.
test
(
value
))
{
}
else
if
(
!
re
.
test
(
value
))
{
callback
(
new
Error
(
"请输入正确手机号"
));
callback
(
new
Error
(
"请输入正确手机号"
));
}
else
{
}
else
{
callback
();
callback
();
}
}
};
};
export
default
{
export
default
{
name
:
"Add"
,
name
:
"Add"
,
components
:
{},
components
:
{},
data
()
{
data
()
{
const
validateCarNo
=
(
rule
,
value
,
callback
)
=>
{
const
validateCarNo
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
if
(
!
value
)
{
return
callback
(
new
Error
(
"员工编号不能为空"
));
return
callback
(
new
Error
(
"员工编号不能为空"
));
}
}
Api
.
list
(
value
).
then
(
r
=>
{
Api
.
list
(
value
).
then
(
r
=>
{
if
(
r
.
result
.
length
>
0
)
{
if
(
r
.
result
.
length
>
0
)
{
return
callback
(
new
Error
(
"员工编号已经存在"
));
return
callback
(
new
Error
(
"员工编号已经存在"
));
}
else
{
}
else
{
callback
();
callback
();
}
}
});
};
return
{
disabled
:
false
,
showDeptTree
:
false
,
entity
:
{
gender
:
1
,
status
:
1
,
property
:
false
},
rules
:
{
userName
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
cardNo
:
[
{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
},
{
validator
:
validateCarNo
,
trigger
:
"blur"
}
],
departmentTitle
:
[
{
required
:
true
,
message
:
"必选"
,
trigger
:
"change"
}
],
// email: [
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
// ],
phone
:
[{
validator
:
valideTel
,
required
:
true
,
trigger
:
"blur"
}]
// degreeId: [
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
// ],
// phone: [{ required: true, message: '必填', trigger: 'blur' }]
}
};
},
props
:
{
v
:
Object
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
if
(
v
)
{
if
(
this
.
entity
.
property
)
{
this
.
entity
.
property
=
2
;
}
else
{
this
.
entity
.
property
=
""
;
}
this
.
disabled
=
true
;
Api
.
create
(
this
.
entity
)
.
then
(
r
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
//账户同步操作start
let
parms
=
{
userId
:
r
.
result
.
id
,
loginName
:
this
.
entity
.
phone
,
//用户电话
status
:
this
.
entity
.
status
,
//状态
tanantCode
:
this
.
$store
.
state
.
userInfo
.
tanantCode
,
//商户号
name
:
this
.
entity
.
userName
};
Api
.
authAccount
(
parms
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
//修改用户表的accountId start
let
parms1
=
{
userId
:
parms
.
userId
,
accountId
:
res
.
result
};
Api
.
updateAccount
(
parms1
).
then
(
res1
=>
{
if
(
res1
.
success
)
{
this
.
$Message
.
success
(
"操作成功"
);
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"同步失败"
);
}
});
//修改用户表的accountId end
}
});
//账户同步操作end
}
else
{
this
.
$Message
.
error
(
r
.
error
.
message
);
}
})
.
catch
(
err
=>
{
// alert(JSON.stringify(err))
console
.
warn
(
err
);
this
.
disabled
=
false
;
this
.
$Message
.
error
(
err
.
error
.
message
);
});
});
}
};
});
return
{
},
disabled
:
false
,
handleClose
()
{
showDeptTree
:
false
,
this
.
$emit
(
"on-close"
);
entity
:
{
},
gender
:
1
,
l
(
key
)
{
status
:
1
,
key
=
"user"
+
"."
+
key
;
property
:
false
return
this
.
$t
(
key
);
},
rules
:
{
userName
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
cardNo
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
},
{
validator
:
validateCarNo
,
trigger
:
"blur"
}
],
departmentTitle
:
[{
required
:
true
,
message
:
"必选"
,
trigger
:
"change"
}],
// email: [
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
// ],
phone
:
[{
validator
:
valideTel
,
required
:
true
,
trigger
:
"blur"
}]
// degreeId: [
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
// ],
// phone: [{ required: true, message: '必填', trigger: 'blur' }]
}
};
},
},
setDepartmentTitle
(
v
,
item
)
{
props
:
{
this
.
entity
.
departmentTitle
=
item
.
name
;
v
:
Object
},
},
selectDepart
()
{
methods
:
{
this
.
showDeptTree
=
true
;
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
if
(
v
)
{
if
(
this
.
entity
.
property
)
{
this
.
entity
.
property
=
2
;
}
else
{
this
.
entity
.
property
=
""
;
}
this
.
disabled
=
true
;
Api
.
create
(
this
.
entity
)
.
then
(
r
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
//账户同步操作start
let
parms
=
{
userId
:
r
.
result
.
id
,
loginName
:
this
.
entity
.
phone
,
//用户电话
status
:
this
.
entity
.
status
,
//状态
tenantCode
:
this
.
$store
.
state
.
userInfo
.
tenantCode
,
//商户号
name
:
this
.
entity
.
userName
};
Api
.
authAccount
(
parms
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
//修改用户表的accountId start
let
parms1
=
{
userId
:
parms
.
userId
,
accountId
:
res
.
result
};
Api
.
updateAccount
(
parms1
).
then
(
res1
=>
{
if
(
res1
.
success
)
{
this
.
$Message
.
success
(
"操作成功"
);
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"同步失败"
);
}
});
//修改用户表的accountId end
}
});
//账户同步操作end
}
else
{
this
.
$Message
.
error
(
r
.
error
.
message
);
}
})
.
catch
(
err
=>
{
// alert(JSON.stringify(err))
console
.
warn
(
err
);
this
.
disabled
=
false
;
this
.
$Message
.
error
(
err
.
error
.
message
);
});
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
l
(
key
)
{
key
=
"user"
+
"."
+
key
;
return
this
.
$t
(
key
);
},
setDepartmentTitle
(
v
,
item
)
{
this
.
entity
.
departmentTitle
=
item
.
name
;
},
selectDepart
()
{
this
.
showDeptTree
=
true
;
},
getBirthday
(
value
)
{
this
.
entity
.
birthday
=
value
;
}
},
},
getBirthday
(
value
)
{
watch
:
{
this
.
entity
.
birthday
=
value
;
v
()
{
}
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
},
}
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
}
}
}
};
};
</
script
>
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
>
.addUser {
.addUser {
.ivu-radio-wrapper {
.ivu-radio-wrapper {
vertical-align: top;
vertical-align: top;
}
}
}
}
</
style
>
</
style
>
pages/basicData/user/edit.vue
View file @
4c158a8e
<
template
>
<
template
>
<div
class=
"addUser"
>
<div
class=
"addUser"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Row
class=
"rowTitle100"
>
<Row
class=
"rowTitle100"
>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('userName')"
prop=
"userName"
>
<FormItem
:label=
"l('userName')"
prop=
"userName"
>
<Input
v-model=
"entity.userName"
></Input>
<Input
v-model=
"entity.userName"
></Input>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('cardNo')"
prop=
"cardNo"
>
<FormItem
:label=
"l('cardNo')"
prop=
"cardNo"
>
<span
v-text=
"entity.cardNo"
></span>
<span
v-text=
"entity.cardNo"
></span>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('status')"
prop=
"status"
>
<FormItem
:label=
"l('status')"
prop=
"status"
>
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
<DatePicker
type=
"date"
v-model=
"entity.birthday"
style=
"width:100%"
placeholder=
"请选择"
></DatePicker>
<DatePicker
type=
"date"
v-model=
"entity.birthday"
style=
"width:100%"
placeholder=
"请选择"
></DatePicker>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('phone')"
prop=
"phone"
>
<FormItem
:label=
"l('phone')"
prop=
"phone"
>
<Input
v-model=
"entity.phone"
/>
<Input
v-model=
"entity.phone"
/>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('email')"
>
<FormItem
:label=
"l('email')"
>
<Input
v-model=
"entity.email"
/>
<Input
v-model=
"entity.email"
/>
</FormItem>
</FormItem>
</Col>
</Col>
<!--
<Col
:span=
"12"
>
<!--
<Col
:span=
"12"
>
<FormItem
:label=
"l('enableEquip')"
prop=
"enableEquip"
>
<FormItem
:label=
"l('enableEquip')"
prop=
"enableEquip"
>
<Input
v-model=
"entity.enableEquip"
></Input>
<Input
v-model=
"entity.enableEquip"
></Input>
</FormItem>
</FormItem>
</Col>
-->
</Col>
-->
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('positionId')"
prop=
"positionId"
>
<FormItem
:label=
"l('positionId')"
prop=
"positionId"
>
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('property')"
>
<FormItem
:label=
"l('property')"
>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"24"
>
<Col
:span=
"24"
>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
</FormItem>
</FormItem>
</Col>
</Col>
</Row>
</Row>
<FormItem>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
type=
"primary"
@
click=
"handleSubmit"
:disabled=
"disabled"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</FormItem>
</Form>
</Form>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
Api
from
"./api"
;
import
Api
from
"./api"
;
const
valideTel
=
(
rule
,
value
,
callback
)
=>
{
const
valideTel
=
(
rule
,
value
,
callback
)
=>
{
var
re
=
/^1
[
3-9
]{1}[
0-9
]{9}
/
;
var
re
=
/^1
[
3-9
]{1}[
0-9
]{9}
/
;
if
(
value
===
""
||
value
===
null
)
{
if
(
value
===
""
||
value
===
null
)
{
callback
(
new
Error
(
"请输入手机号"
));
callback
(
new
Error
(
"请输入手机号"
));
}
else
if
(
!
re
.
test
(
value
))
{
}
else
if
(
!
re
.
test
(
value
))
{
callback
(
new
Error
(
"请输入正确手机号"
));
callback
(
new
Error
(
"请输入正确手机号"
));
}
else
{
}
else
{
callback
();
callback
();
}
}
};
};
export
default
{
export
default
{
name
:
"Edit"
,
name
:
"Edit"
,
data
()
{
data
()
{
return
{
return
{
disabled
:
false
,
disabled
:
false
,
showDeptTree
:
false
,
showDeptTree
:
false
,
entity
:
{},
entity
:
{},
rules
:
{
rules
:
{
userName
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
userName
:
[{
departmentTitle
:
[{
required
:
true
,
message
:
"必选"
,
trigger
:
"blur"
}],
required
:
true
,
//cardNo: [{ required: true, message: '必填', trigger: 'blur' }],
message
:
"必填"
,
// birthday: [{ required: true, message: '必填', trigger: 'change' }],
trigger
:
"blur"
// degreeId: [
}],
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
departmentTitle
:
[{
// ],
required
:
true
,
// email: [
message
:
"必选"
,
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
trigger
:
"blur"
// ],
}],
phone
:
[{
validator
:
valideTel
,
required
:
true
,
trigger
:
"blur"
}]
//cardNo: [{ required: true, message: '必填', trigger: 'blur' }],
}
// birthday: [{ required: true, message: '必填', trigger: 'change' }],
};
// degreeId: [
},
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
props
:
{
// ],
eid
:
Number
// email: [
},
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
methods
:
{
// ],
load
(
v
)
{
phone
:
[{
Api
.
get
({
id
:
v
}).
then
(
r
=>
{
validator
:
valideTel
,
this
.
entity
=
r
.
result
;
required
:
true
,
if
(
r
.
result
.
property
==
2
)
{
trigger
:
"blur"
this
.
entity
.
property
=
true
;
}]
}
else
{
}
this
.
entity
.
property
=
false
;
};
}
this
.
$emit
(
"on-load"
);
});
},
},
handleSubmit
()
{
props
:
{
this
.
$refs
.
form
.
validate
(
v
=>
{
eid
:
Number
if
(
v
)
{
},
this
.
disabled
=
true
;
methods
:
{
if
((
this
.
entity
.
property
=
true
))
{
load
(
v
)
{
this
.
entity
.
property
=
2
;
Api
.
get
({
}
else
{
id
:
v
this
.
entity
.
property
=
""
;
}).
then
(
r
=>
{
}
this
.
entity
=
r
.
result
;
Api
.
update
(
this
.
entity
)
if
(
r
.
result
.
property
==
2
)
{
.
then
(
r
=>
{
this
.
entity
.
property
=
true
;
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
//账户同步操作start
if
(
this
.
entity
.
accountId
>
0
)
{
//账户已同步的情况下
let
parms2
=
{
accountId
:
this
.
entity
.
accountId
,
userId
:
this
.
entity
.
id
,
loginName
:
this
.
entity
.
phone
,
//用户电话
status
:
this
.
entity
.
status
,
tanantCode
:
this
.
$store
.
state
.
userInfo
.
tanantCode
,
//商户号
name
:
this
.
entity
.
userName
};
Api
.
authAccount
(
parms2
).
then
(
res
=>
{
//同步电话信息等
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
}
else
{
this
.
$Message
.
error
(
"账户同步失败"
);
}
});
}
else
{
}
else
{
//账户新建后还未同步成功的情况下
this
.
entity
.
property
=
false
;
let
parms
=
{
}
userId
:
this
.
entity
.
id
,
this
.
$emit
(
"on-load"
);
loginName
:
this
.
entity
.
phone
,
//用户电话
});
status
:
this
.
entity
.
status
,
},
tanantCode
:
this
.
$store
.
state
.
userInfo
.
tanantCode
,
//商户号
handleSubmit
()
{
name
:
this
.
entity
.
userName
this
.
$refs
.
form
.
validate
(
v
=>
{
};
if
(
v
)
{
Api
.
authAccount
(
parms
).
then
(
res1
=>
{
this
.
disabled
=
true
;
if
(
res1
.
success
)
{
if
((
this
.
entity
.
property
=
true
))
{
this
.
$Message
.
success
(
"账户同步成功"
);
this
.
entity
.
property
=
2
;
//修改用户表的accountId start
}
else
{
let
parms1
=
{
this
.
entity
.
property
=
""
;
userId
:
parms
.
userId
,
accountId
:
res1
.
result
//账户同步成功后返回的accountId
};
Api
.
updateAccount
(
parms1
).
then
(
res2
=>
{
if
(
res2
.
success
)
{
this
.
$Message
.
success
(
"操作成功"
);
}
else
{
this
.
$Message
.
error
(
"操作失败"
);
}
});
//修改用户表的accountId end
}
}
});
Api
.
update
(
this
.
entity
)
.
then
(
r
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
//账户同步操作start
if
(
this
.
entity
.
accountId
>
0
)
{
//账户已同步的情况下
let
parms2
=
{
accountId
:
this
.
entity
.
accountId
,
userId
:
this
.
entity
.
id
,
loginName
:
this
.
entity
.
phone
,
//用户电话
status
:
this
.
entity
.
status
,
tenantCode
:
this
.
$store
.
state
.
userInfo
.
tenantCode
,
//商户号
name
:
this
.
entity
.
userName
};
Api
.
authAccount
(
parms2
).
then
(
res
=>
{
//同步电话信息等
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
}
else
{
this
.
$Message
.
error
(
"账户同步失败"
);
}
});
}
else
{
//账户新建后还未同步成功的情况下
let
parms
=
{
userId
:
this
.
entity
.
id
,
loginName
:
this
.
entity
.
phone
,
//用户电话
status
:
this
.
entity
.
status
,
tenantCode
:
this
.
$store
.
state
.
userInfo
.
tenantCode
,
//商户号
name
:
this
.
entity
.
userName
};
Api
.
authAccount
(
parms
).
then
(
res1
=>
{
if
(
res1
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
//修改用户表的accountId start
let
parms1
=
{
userId
:
parms
.
userId
,
accountId
:
res1
.
result
//账户同步成功后返回的accountId
};
Api
.
updateAccount
(
parms1
).
then
(
res2
=>
{
if
(
res2
.
success
)
{
this
.
$Message
.
success
(
"操作成功"
);
}
else
{
this
.
$Message
.
error
(
"操作失败"
);
}
});
//修改用户表的accountId end
}
});
}
//账户同步操作end
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"保存失败"
);
}
})
.
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
"保存失败"
);
console
.
warn
(
err
);
});
}
}
//账户同步操作end
this
.
$emit
(
"on-ok"
);
}
else
{
this
.
$Message
.
error
(
"保存失败"
);
}
})
.
catch
(
err
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
"保存失败"
);
console
.
warn
(
err
);
});
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
l
(
key
)
{
key
=
"user"
+
"."
+
key
;
return
this
.
$t
(
key
);
},
setDepartmentTitle
(
v
,
item
)
{
if
(
item
)
{
this
.
entity
.
departmentTitle
=
item
.
name
;
}
},
getBirthday
(
value
)
{
this
.
entity
.
birthday
=
value
;
}
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
},
l
(
key
)
{
watch
:
{
key
=
"user"
+
"."
+
key
;
eid
(
v
)
{
return
this
.
$t
(
key
);
if
(
v
!=
0
)
{
},
this
.
load
(
v
);
setDepartmentTitle
(
v
,
item
)
{
}
if
(
item
)
{
}
this
.
entity
.
departmentTitle
=
item
.
name
;
}
},
getBirthday
(
value
)
{
this
.
entity
.
birthday
=
value
;
}
},
watch
:
{
eid
(
v
)
{
if
(
v
!=
0
)
{
this
.
load
(
v
);
}
}
}
}
};
};
</
script
>
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
>
.addUser {
.addUser {
.ivu-radio-wrapper {
.ivu-radio-wrapper {
vertical-align: top;
vertical-align: top;
}
}
}
}
</
style
>
</
style
>
pages/basicData/user/index.vue
View file @
4c158a8e
...
@@ -494,7 +494,7 @@ export default {
...
@@ -494,7 +494,7 @@ export default {
let
parms
=
{
let
parms
=
{
userId
:
this
.
curId
,
userId
:
this
.
curId
,
accountId
:
this
.
selectRow
.
accountId
,
accountId
:
this
.
selectRow
.
accountId
,
tenantCode
:
util
.
cookies
.
get
(
"t
a
nantCode"
),
tenantCode
:
util
.
cookies
.
get
(
"t
e
nantCode"
),
isDeleted
:
true
,
isDeleted
:
true
,
name
:
this
.
selectRow
.
userName
,
name
:
this
.
selectRow
.
userName
,
};
};
...
@@ -649,7 +649,7 @@ export default {
...
@@ -649,7 +649,7 @@ export default {
userId
:
this
.
selectRow
.
id
,
userId
:
this
.
selectRow
.
id
,
loginName
:
this
.
selectRow
.
phone
,
loginName
:
this
.
selectRow
.
phone
,
status
:
this
.
selectRow
.
status
,
status
:
this
.
selectRow
.
status
,
tenantCode
:
util
.
cookies
.
get
(
"t
a
nantCode"
),
tenantCode
:
util
.
cookies
.
get
(
"t
e
nantCode"
),
name
:
this
.
selectRow
.
userName
,
name
:
this
.
selectRow
.
userName
,
};
};
if
(
this
.
selectRow
.
phone
&&
this
.
selectRow
.
phone
!=
""
)
{
if
(
this
.
selectRow
.
phone
&&
this
.
selectRow
.
phone
!=
""
)
{
...
...
store/admin/account.js
View file @
4c158a8e
...
@@ -41,7 +41,7 @@ export const actions = {
...
@@ -41,7 +41,7 @@ export const actions = {
if
(
res
.
result
)
{
if
(
res
.
result
)
{
util
.
cookies
.
set
(
'uuid'
,
res
.
result
.
userId
);
util
.
cookies
.
set
(
'uuid'
,
res
.
result
.
userId
);
util
.
cookies
.
set
(
't
anantCode'
,
res
.
result
.
ta
nantCode
);
util
.
cookies
.
set
(
't
enantCode'
,
res
.
result
.
te
nantCode
);
util
.
cookies
.
set
(
'token'
,
res
.
result
.
accessToken
);
util
.
cookies
.
set
(
'token'
,
res
.
result
.
accessToken
);
sessionStorage
.
setItem
(
'token'
,
res
.
result
.
accessToken
)
sessionStorage
.
setItem
(
'token'
,
res
.
result
.
accessToken
)
// // 设置 vuex 用户信息
// // 设置 vuex 用户信息
...
...
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