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
2b147d97
Commit
2b147d97
authored
Oct 22, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user add userType: 0
parent
d68baf7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
225 additions
and
258 deletions
+225
-258
add.vue
pages/basicData/user/add.vue
+225
-258
No files found.
pages/basicData/user/add.vue
View file @
2b147d97
<
template
>
<div
class=
"addUser"
>
<div
class=
"addUser"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Row
class=
"rowTitle100"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('userName')"
prop=
"userName"
>
<Input
v-model=
"entity.userName"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('cardNo')"
prop=
"cardNo"
>
<Input
v-model=
"entity.cardNo"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('status')"
prop=
"status"
>
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
<DatePicker
type=
"date"
v-model=
"entity.birthday"
placeholder=
"请选择"
></DatePicker>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
</FormItem>
</Col>
<Row
class=
"rowTitle100"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('userName')"
prop=
"userName"
>
<Input
v-model=
"entity.userName"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('cardNo')"
prop=
"cardNo"
>
<Input
v-model=
"entity.cardNo"
></Input>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('status')"
prop=
"status"
>
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
<DatePicker
type=
"date"
v-model=
"entity.birthday"
placeholder=
"请选择"
></DatePicker>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('phone')"
prop=
"phone"
>
<Input
v-model=
"entity.phone"
/>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('email')"
>
<Input
v-model=
"entity.email"
/>
</FormItem>
</Col>
<!--
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('phone')"
prop=
"phone"
>
<Input
v-model=
"entity.phone"
/>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('email')"
>
<Input
v-model=
"entity.email"
/>
</FormItem>
</Col>
<!--
<Col
:span=
"12"
>
<FormItem
:label=
"l('enableEquip')"
prop=
"enableEquip"
>
<Input
v-model=
"entity.enableEquip"
></Input>
</FormItem>
</Col>
-->
<Col
:span=
"12"
>
<FormItem
:label=
"l('positionId')"
prop=
"positionId"
>
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('property')"
>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
</FormItem>
</Col>
<Col
:span=
"24"
>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
v-noClick
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
<Col
:span=
"12"
>
<FormItem
:label=
"l('positionId')"
prop=
"positionId"
>
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
</FormItem>
</Col>
<Col
:span=
"12"
>
<FormItem
:label=
"l('property')"
>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
</FormItem>
</Col>
<Col
:span=
"24"
>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
v-noClick
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Form>
</div>
</div>
</
template
>
<
script
>
import
Api
from
"./api"
;
import
util
from
"@/libs/util"
;
const
valideTel
=
(
rule
,
value
,
callback
)
=>
{
var
re
=
/^1
[
3-9
]{1}[
0-9
]{9}
/
;
if
(
value
===
""
||
value
===
null
)
{
callback
(
new
Error
(
"请输入手机号"
));
}
else
if
(
!
re
.
test
(
value
))
{
callback
(
new
Error
(
"请输入正确手机号"
));
}
else
{
callback
();
}
var
re
=
/^1
[
3-9
]{1}[
0-9
]{9}
/
;
if
(
value
===
""
||
value
===
null
)
{
callback
(
new
Error
(
"请输入手机号"
));
}
else
if
(
!
re
.
test
(
value
))
{
callback
(
new
Error
(
"请输入正确手机号"
));
}
else
{
callback
();
}
};
export
default
{
name
:
"Add"
,
components
:
{},
data
()
{
const
validateCarNo
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
return
callback
(
new
Error
(
"员工编号不能为空"
));
}
Api
.
list
(
value
).
then
((
r
)
=>
{
if
(
r
.
result
.
length
>
0
)
{
return
callback
(
new
Error
(
"员工编号已经存在"
));
}
else
{
callback
();
}
});
};
return
{
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
=
""
;
}
name
:
"Add"
,
components
:
{},
data
()
{
const
validateCarNo
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
return
callback
(
new
Error
(
"员工编号不能为空"
));
}
Api
.
list
(
value
).
then
((
r
)
=>
{
if
(
r
.
result
.
length
>
0
)
{
return
callback
(
new
Error
(
"员工编号已经存在"
));
}
else
{
callback
();
}
});
};
return
{
showDeptTree
:
false
,
entity
:
{
gender
:
1
,
status
:
1
,
property
:
false
,
userType
:
0
,
},
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
=
""
;
}
Api
.
create
(
this
.
entity
)
.
then
((
r
)
=>
{
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, //商户号
tenantCode
:
util
.
cookies
.
get
(
"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
}
});
Api
.
create
(
this
.
entity
)
.
then
((
r
)
=>
{
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, //商户号
tenantCode
:
util
.
cookies
.
get
(
"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
);
//账户同步操作end
}
else
{
this
.
$Message
.
error
(
r
.
error
.
message
);
}
})
.
catch
((
err
)
=>
{
// alert(JSON.stringify(err))
console
.
warn
(
err
);
this
.
$Message
.
error
(
err
.
error
.
message
);
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
;
},
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
;
},
},
},
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
},
},
},
};
</
script
>
<
style
lang=
"less"
>
.addUser {
.ivu-radio-wrapper {
vertical-align: top;
}
.ivu-radio-wrapper {
vertical-align: top;
}
}
</
style
>
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