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
>
<
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
<Dictionary
code=
"User.base.status"
v-model=
"entity.status"
type=
"radio"
></Dictionary>
code=
"User.base.status"
</FormItem>
v-model=
"entity.status"
</Col>
type=
"radio"
<Col
:span=
"12"
>
></Dictionary>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
</FormItem>
<Dictionary
code=
"User.base.gender"
v-model=
"entity.gender"
type=
"radio"
></Dictionary>
</Col>
</FormItem>
<Col
:span=
"12"
>
</Col>
<FormItem
:label=
"l('gender')"
prop=
"gender"
>
<Col
:span=
"12"
>
<Dictionary
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
code=
"User.base.gender"
<DatePicker
type=
"date"
v-model=
"entity.birthday"
placeholder=
"请选择"
></DatePicker>
v-model=
"entity.gender"
</FormItem>
type=
"radio"
</Col>
></Dictionary>
<Col
:span=
"12"
>
</FormItem>
<FormItem
:label=
"l('degreeId')"
prop=
"degreeId"
>
</Col>
<Dictionary
code=
"User.base.degree"
v-model=
"entity.degreeId"
></Dictionary>
<Col
:span=
"12"
>
</FormItem>
<FormItem
:label=
"l('birthday')"
prop=
"birthday"
>
</Col>
<DatePicker
<Col
:span=
"12"
>
type=
"date"
<FormItem
:label=
"l('departmentTitle')"
prop=
"departmentTitle"
>
v-model=
"entity.birthday"
<DepartmentSelect
v-model=
"entity.departmentId"
@
on-change=
"setDepartmentTitle"
/>
placeholder=
"请选择"
</FormItem>
></DatePicker>
</Col>
</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"
>
<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
<Dictionary
code=
"User.base.position"
v-model=
"entity.positionId"
></Dictionary>
code=
"User.base.position"
</FormItem>
v-model=
"entity.positionId"
</Col>
></Dictionary>
<Col
:span=
"12"
>
</FormItem>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
</Col>
<Dictionary
code=
"User.base.jobtitle"
v-model=
"entity.titleId"
></Dictionary>
<Col
:span=
"12"
>
</FormItem>
<FormItem
:label=
"l('titleId')"
prop=
"titleId"
>
</Col>
<Dictionary
<Col
:span=
"12"
>
code=
"User.base.jobtitle"
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
v-model=
"entity.titleId"
<Dictionary
code=
"User.base.workLicense"
v-model=
"entity.licensedToWork"
></Dictionary>
></Dictionary>
</FormItem>
</FormItem>
</Col>
</Col>
<Col
:span=
"12"
>
<Col
:span=
"12"
>
<FormItem
:label=
"l('property')"
>
<FormItem
:label=
"l('licensedToWork')"
prop=
"licensedToWork"
>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
<Dictionary
</FormItem>
code=
"User.base.workLicense"
</Col>
v-model=
"entity.licensedToWork"
<Col
:span=
"24"
>
></Dictionary>
<FormItem
:label=
"l('remark')"
prop=
"remark"
>
</FormItem>
<Input
v-model=
"entity.remark"
type=
"textarea"
:rows=
"3"
></Input>
</Col>
</FormItem>
<Col
:span=
"12"
>
</Col>
<FormItem
:label=
"l('property')"
>
</Row>
<Checkbox
v-model=
"entity.property"
>
排产资源
</Checkbox>
<FormItem>
</FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
v-noClick
>
保存
</Button>
</Col>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
<Col
:span=
"24"
>
</FormItem>
<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>
</Form>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
Api
from
"./api"
;
import
Api
from
"./api"
;
import
util
from
"@/libs/util"
;
import
util
from
"@/libs/util"
;
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
{
return
{
showDeptTree
:
false
,
showDeptTree
:
false
,
entity
:
{
entity
:
{
gender
:
1
,
gender
:
1
,
status
:
1
,
status
:
1
,
property
:
false
,
property
:
false
,
},
userType
:
0
,
rules
:
{
},
userName
:
[
rules
:
{
{
userName
:
[{
required
:
true
,
required
:
true
,
message
:
"必填"
,
message
:
"必填"
,
trigger
:
"blur"
,
trigger
:
"blur"
,
},
},
],
],
cardNo
:
[{
cardNo
:
[
required
:
true
,
{
message
:
"必填"
,
required
:
true
,
trigger
:
"blur"
,
message
:
"必填"
,
},
trigger
:
"blur"
,
{
},
validator
:
validateCarNo
,
{
trigger
:
"blur"
,
validator
:
validateCarNo
,
},
trigger
:
"blur"
,
],
},
departmentTitle
:
[{
],
required
:
true
,
departmentTitle
:
[
message
:
"必选"
,
{
trigger
:
"change"
,
required
:
true
,
},
],
message
:
"必选"
,
// email: [
trigger
:
"change"
,
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
},
// ],
],
phone
:
[{
// email: [
validator
:
valideTel
,
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
required
:
true
,
// ],
trigger
:
"blur"
,
phone
:
[
},
],
{
// degreeId: [
validator
:
valideTel
,
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
required
:
true
,
// ],
trigger
:
"blur"
,
// phone: [{ required: true, message: '必填', trigger: 'blur' }]
},
},
],
};
// degreeId: [
},
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
props
:
{
// ],
v
:
Object
,
// phone: [{ required: true, message: '必填', trigger: 'blur' }]
},
},
methods
:
{
};
handleSubmit
()
{
},
this
.
$refs
.
form
.
validate
((
v
)
=>
{
props
:
{
if
(
v
)
{
v
:
Object
,
if
(
this
.
entity
.
property
)
{
},
this
.
entity
.
property
=
2
;
methods
:
{
}
else
{
handleSubmit
()
{
this
.
entity
.
property
=
""
;
this
.
$refs
.
form
.
validate
((
v
)
=>
{
}
if
(
v
)
{
if
(
this
.
entity
.
property
)
{
this
.
entity
.
property
=
2
;
}
else
{
this
.
entity
.
property
=
""
;
}
Api
.
create
(
this
.
entity
)
Api
.
create
(
this
.
entity
)
.
then
((
r
)
=>
{
.
then
((
r
)
=>
{
if
(
r
.
success
)
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
this
.
$Message
.
success
(
"保存成功"
);
//账户同步操作start
//账户同步操作start
let
parms
=
{
let
parms
=
{
userId
:
r
.
result
.
id
,
userId
:
r
.
result
.
id
,
loginName
:
this
.
entity
.
phone
,
//用户电话
loginName
:
this
.
entity
.
phone
,
//用户电话
status
:
this
.
entity
.
status
,
//状态
status
:
this
.
entity
.
status
,
//状态
// tenantCode: this.$store.state.userInfo.tenantCode, //商户号
// tenantCode: this.$store.state.userInfo.tenantCode, //商户号
tenantCode
:
util
.
cookies
.
get
(
"tenantCode"
),
//商户号
tenantCode
:
util
.
cookies
.
get
(
"tenantCode"
),
//商户号
name
:
this
.
entity
.
userName
,
name
:
this
.
entity
.
userName
,
};
};
Api
.
authAccount
(
parms
).
then
((
res
)
=>
{
Api
.
authAccount
(
parms
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"账户同步成功"
);
this
.
$Message
.
success
(
"账户同步成功"
);
//修改用户表的accountId start
//修改用户表的accountId start
let
parms1
=
{
let
parms1
=
{
userId
:
parms
.
userId
,
userId
:
parms
.
userId
,
accountId
:
res
.
result
,
accountId
:
res
.
result
,
};
};
Api
.
updateAccount
(
parms1
).
then
((
res1
)
=>
{
Api
.
updateAccount
(
parms1
).
then
((
res1
)
=>
{
if
(
res1
.
success
)
{
if
(
res1
.
success
)
{
this
.
$Message
.
success
(
"操作成功"
);
this
.
$Message
.
success
(
"操作成功"
);
this
.
$emit
(
"on-ok"
);
this
.
$emit
(
"on-ok"
);
}
else
{
}
else
{
this
.
$Message
.
error
(
"同步失败"
);
this
.
$Message
.
error
(
"同步失败"
);
}
}
});
});
//修改用户表的accountId end
//修改用户表的accountId end
}
}
});
});
//账户同步操作end
//账户同步操作end
}
else
{
}
else
{
this
.
$Message
.
error
(
r
.
error
.
message
);
this
.
$Message
.
error
(
r
.
error
.
message
);
}
}
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
// alert(JSON.stringify(err))
// alert(JSON.stringify(err))
console
.
warn
(
err
);
console
.
warn
(
err
);
this
.
$Message
.
error
(
err
.
error
.
message
);
this
.
$Message
.
error
(
err
.
error
.
message
);
});
}
});
});
}
},
});
handleClose
()
{
},
this
.
$emit
(
"on-close"
);
handleClose
()
{
},
this
.
$emit
(
"on-close"
);
l
(
key
)
{
},
key
=
"user"
+
"."
+
key
;
l
(
key
)
{
return
this
.
$t
(
key
);
key
=
"user"
+
"."
+
key
;
},
return
this
.
$t
(
key
);
setDepartmentTitle
(
v
,
item
)
{
},
this
.
entity
.
departmentTitle
=
item
.
name
;
setDepartmentTitle
(
v
,
item
)
{
},
this
.
entity
.
departmentTitle
=
item
.
name
;
selectDepart
()
{
},
this
.
showDeptTree
=
true
;
selectDepart
()
{
},
this
.
showDeptTree
=
true
;
getBirthday
(
value
)
{
},
this
.
entity
.
birthday
=
value
;
getBirthday
(
value
)
{
},
this
.
entity
.
birthday
=
value
;
},
},
},
watch
:
{
watch
:
{
v
()
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
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
>
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