|
@@ -203,49 +203,63 @@ export default {
|
|
|
){
|
|
|
this.$message.error("存在空值!");
|
|
|
}else{
|
|
|
-
|
|
|
- //新增用户
|
|
|
- this.$store.dispatch('system/usersManage/addUser',formData)
|
|
|
+ //判断RMS_PERSONNEL表中是否存在该人员信息,存在提示存在,否则开始赋权新增
|
|
|
+ this.axios.post('/api/v1/rms/isInHere?personnelJobNumber='+this.form1.personnelJobNumber)
|
|
|
.then((res)=>{
|
|
|
- console.log("role",res)
|
|
|
- //再新增RMS_PERSONNEL表信息
|
|
|
- let rmsPersonnel = {
|
|
|
- personnelJobNumber : this.form1.personnelJobNumber,
|
|
|
- personnelPost : this.form1.personnelPost,
|
|
|
- personnelName : this.form1.personnelName,
|
|
|
- personnelDepartmentId : this.form1.shipperId,
|
|
|
- // personnelWorkshopid : this.form1.personnelWorkshopid,
|
|
|
- personnelShifts : this.form1.personnelShifts,
|
|
|
- personnelTeam : this.form1.personnelTeam,
|
|
|
- personnelSsoId : res.data.userId
|
|
|
- }
|
|
|
- // console.log("rmsPersonnel",rmsPersonnel)
|
|
|
- this.axios.post('/api/v1/rms/addPersonnel',rmsPersonnel)
|
|
|
- .then((res)=>{
|
|
|
- // console.log("Personnel",res)
|
|
|
- if (res.data.code == 200) {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "新增成功!",
|
|
|
- });
|
|
|
- // this.$refs.table.refreshData();
|
|
|
- } else {
|
|
|
- this.$message.error("新增失败,可能存在重复!");
|
|
|
- }
|
|
|
- // this.$refs['table'].resetField();
|
|
|
- })
|
|
|
+ console.log("res",res);
|
|
|
+ if(res.data==0){
|
|
|
+ this.$message.error("新增失败,该账号已存在!");
|
|
|
+ }else{
|
|
|
+ //开始赋权新增
|
|
|
+ //新增用户表
|
|
|
+ this.$store.dispatch('system/usersManage/addUser',formData)
|
|
|
+ .then((res)=>{
|
|
|
+ //console.log("role",res)
|
|
|
+ //保存权限表中的用户主键Id
|
|
|
+ this.personnelSsoId = res.data.userId;
|
|
|
+ //再新增RMS_PERSONNEL表信息
|
|
|
+ let rmsPersonnel = {
|
|
|
+ personnelJobNumber : this.form1.personnelJobNumber,
|
|
|
+ personnelPost : this.form1.personnelPost,
|
|
|
+ personnelName : this.form1.personnelName,
|
|
|
+ personnelDepartmentId : this.form1.shipperId,
|
|
|
+ // personnelWorkshopid : this.form1.personnelWorkshopid,
|
|
|
+ personnelShifts : this.form1.personnelShifts,
|
|
|
+ personnelTeam : this.form1.personnelTeam,
|
|
|
+ personnelSsoId : this.personnelSsoId
|
|
|
+ }
|
|
|
+ // console.log("rmsPersonnel",rmsPersonnel)
|
|
|
+ this.axios.post('/api/v1/rms/addPersonnel',rmsPersonnel)
|
|
|
+ .then((res)=>{
|
|
|
+ // console.log("Personnel",res)
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "新增成功!",
|
|
|
+ });
|
|
|
+ // this.$refs.table.refreshData();
|
|
|
+
|
|
|
+ //最后新增角色赋权表
|
|
|
|
|
|
- //最后新增角色赋权表
|
|
|
+ this.axios.post('pass/v1/sysuserroles/addUserroles?userId='
|
|
|
+ +this.personnelSsoId+'&userCode='+this.form1.personnelJobNumber+'&roleId='+this.value3)
|
|
|
+ .then((res)=>{
|
|
|
+ // console.log("success")
|
|
|
+ this.$router.go(-1);
|
|
|
+ })
|
|
|
|
|
|
- this.axios.post('pass/v1/sysuserroles/addUserroles?userId='
|
|
|
- +res.data.userId+'&userCode='+this.form1.personnelJobNumber+'&roleId='+this.value3)
|
|
|
- .then((res)=>{
|
|
|
- // console.log("success")
|
|
|
- this.$router.go(-1);
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ this.$message.error("新增失败,可能存在重复!");
|
|
|
+ }
|
|
|
+ // this.$refs['table'].resetField();
|
|
|
+ })
|
|
|
|
|
|
- });//end
|
|
|
- }
|
|
|
+ });//end
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }//else
|
|
|
|
|
|
},
|
|
|
// 取消
|