Date.now();
@@ -1822,95 +1830,94 @@ export default {
/**
* 创建部门信息
*/
- async createDept() {
- if (!this.checkDeptData()) {
- return;
- }
- this.addDeptDisable = true;
- var thisApp = this;
- var array = new Array();
- array = this.deptData.arraySuper;
- var levelId = "";
- var superId = "";
- if (array.length > 0) {
- for (var i = 0; i < array.length; i++) {
- levelId = levelId + array[i];
- if (i < array.length - 1) {
- levelId = levelId + "-";
- } else {
- superId = array[i];
+ createDept() {
+ this.$refs['form'].validate(async (valid)=>{
+ if(!valid) return;
+ this.addDeptDisable = true;
+ var thisApp = this;
+ var array = new Array();
+ array = this.deptData.arraySuper;
+ var levelId = "";
+ var superId = "";
+ if (array.length > 0) {
+ for (var i = 0; i < array.length; i++) {
+ levelId = levelId + array[i];
+ if (i < array.length - 1) {
+ levelId = levelId + "-";
+ } else {
+ superId = array[i];
+ }
}
}
- }
- var parm = {
- deptName: this.deptData.deptName,
- companyId: sessionStorage.companyId,
- remark: "",
- // createUserId: sessionStorage.userId || '',
- // modifyUserId: sessionStorage.userId || '',
- levelId: levelId,
- superId: superId,
- };
- const res = await services.createDepartment(parm);
- const ifSucc = res.Code === 0;
- if (!ifSucc) {
- this.addDeptDisable = false;
- this.$notify.error({
- title: "溫馨提示",
- message: res.Msg,
+ var parm = {
+ deptName: this.deptData.deptName,
+ companyId: sessionStorage.companyId,
+ remark: "",
+ // createUserId: sessionStorage.userId || '',
+ // modifyUserId: sessionStorage.userId || '',
+ levelId: levelId,
+ superId: superId,
+ };
+ const res = await services.createDepartment(parm);
+ const ifSucc = res.Code === 0;
+ if (!ifSucc) {
+ this.addDeptDisable = false;
+ this.$notify.error({
+ message: res.Msg,
+ offset: 100,
+ duration: 5000,
+ });
+ return;
+ }
+ thisApp.addDeptDisable = false;
+ this.$notify({
+ message:`部门“${this.deptData.deptName}”已完成添加。`,
+ type: "success",
offset: 100,
- duration: 5000,
+ duration: 2500,
});
- return;
- }
- thisApp.addDeptDisable = false;
- this.$notify({
- title: " ",
- message: "添加成功",
- type: "success",
- offset: 100,
- duration: 2500,
- });
- thisApp.listDepts();
- this.currentPain = 1;
- this.el_formLabelcolor = "textlabelgray";
+ thisApp.listDepts();
+ this.currentPain = 1;
+ this.el_formLabelcolor = "textlabelgray";
+
+ })
+
},
/**
* 更新部门信息
*/
- async updateDept() {
- if (!this.checkDeptData()) {
- return;
- }
- var thisApp = this;
- this.deptData.modifyUserId = sessionStorage.userId;
- const deptData = this.deptData;
- const param = {
- Id: deptData.id,
- SuperId: deptData.superId,
- CompanyId: deptData.companyId,
- LevelId: deptData.arraySuper.join("-"),
- DeptName: deptData.deptName,
- };
- const res = await this.$fetchApi("dept/updateDept", param);
- const ifSucc = res.Code === 0;
- if (!ifSucc) {
- thisApp.$notify.error({
-
- message: res.Msg,
+ updateDept() {
+ this.$refs['form'].validate(async (valid)=>{
+ if(!valid) return;
+ var thisApp = this;
+ this.deptData.modifyUserId = sessionStorage.userId;
+ const deptData = this.deptData;
+ const param = {
+ Id: deptData.id,
+ SuperId: deptData.superId,
+ CompanyId: deptData.companyId,
+ LevelId: deptData.arraySuper.join("-"),
+ DeptName: deptData.deptName,
+ };
+ const res = await this.$fetchApi("dept/updateDept", param);
+ const ifSucc = res.Code === 0;
+ if (!ifSucc) {
+ thisApp.$notify.error({
+ message: res.Msg,
+ offset: 100,
+ duration: 5000,
+ });
+ }
+ thisApp.$notify({
+ message: "修改成功。",
+ type: "success",
offset: 100,
- duration: 5000,
+ duration: 2500,
});
- }
- thisApp.$notify({
- title: " ",
- message: "修改成功",
- type: "success",
- offset: 100,
- duration: 2500,
- });
- thisApp.listDepts();
- this.currentPain = 1;
+ thisApp.listDepts();
+ this.currentPain = 1;
+
+ })
// // todo
// this.$axios({
// method: "put",
@@ -1946,9 +1953,8 @@ export default {
*/
checkDeptData: function () {
if (this.deptData.deptName == null || this.deptData.deptName == "") {
- this.$notify({
-
- message: "请输入部门名称",
+ this.$notify({
+ message: "请输入部门名称。",
type: "warning",
offset: 100,
duration: 2500,
@@ -1961,7 +1967,7 @@ export default {
) {
this.$notify({
- message: "请选择上级部门",
+ message: "请选择上级部门。",
type: "warning",
offset: 100,
duration: 2500,
@@ -1976,7 +1982,7 @@ export default {
deleteDept: function (data) {
var deptName = data.label;
var thisApp = this;
- this.$confirm("删除部门:" + deptName + ", 是否继续?", "", {
+ this.$confirm(`部门删除后将无法恢复,是否继续删除部门“${deptName}”?`, "", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
@@ -1999,7 +2005,7 @@ export default {
}
thisApp.$notify({
title: " ",
- message: "删除成功!",
+ message:`部门“${deptName}”已删除。`,
type: "success",
offset: 100,
duration: 2500,
@@ -2019,13 +2025,6 @@ export default {
*/
addDept: function () {
if (this.multipleSelection[0] == null) {
- this.$notify({
-
- message: "请先选择用户",
- type: "warning",
- offset: 100,
- duration: 2500,
- });
return;
}
this.isDistWorkDeptDialog = true;
@@ -2086,7 +2085,7 @@ export default {
}
this.$notify({
title: " ",
- message: "修改成功",
+ message: "已完成指派。",
type: "success",
offset: 100,
duration: 2500,
@@ -2101,19 +2100,11 @@ export default {
deleteUsers: function () {
var thisApp = this;
if (thisApp.multipleSelection[0] == null) {
- this.$notify({
-
- message: "请先选择用户",
- type: "warning",
- offset: 100,
- duration: 2500,
- });
return;
}
if (thisApp.multipleSelection.some((user) => user.default === 1)) {
- this.$notify({
-
- message: "法人账号不能删除",
+ this.$notify({
+ message: "法人账号不能删除。",
type: "warning",
offset: 100,
duration: 2500,
@@ -2122,7 +2113,7 @@ export default {
}
var node = thisApp.$refs.tree.getCurrentNode();
thisApp
- .$confirm("用户被删除后将无法恢复,是否继续删除用户操作?", "", {
+ .$confirm("用户被删除后将无法恢复,是否继续?", "", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
@@ -2151,21 +2142,13 @@ export default {
}
thisApp.$notify({
title: " ",
- message: "删除成功",
+ message: "所选用户删除完成。",
type: "success",
offset: 100,
duration: 2500,
});
this.getUserList();
// thisApp.nodeClick(node || undefined);
- })
- .catch(() => {
- this.$notify.info({
-
- message: "已取消删除",
- offset: 100,
- duration: 2500,
- });
});
},
@@ -2173,29 +2156,13 @@ export default {
* 创建用户
* @param {boolean} ifcontinue 是否继续创建
*/
- async createUser(ifcontinue = false) {
+ createUser(ifcontinue = false) {
var thisApp = this;
- // 验证用户信息
- if (!this.checkUser(this.newUser)) {
- return;
- }
- if (
- this.newUser.arraySuper != null &&
- this.newUser.arraySuper.length > 0
- ) {
+ this.$refs['form'].validate(async (valid)=>{
+ if (!valid) return;
this.newUser.deptid = this.newUser.arraySuper[
this.newUser.arraySuper.length - 1
];
- } else {
- thisApp.$notify({
-
- message: "请选择职员所在部门",
- type: "warning",
- offset: 100,
- duration: 5000,
- });
- return;
- }
this.newUser.createUserId = sessionStorage.userId;
this.newUser.companyId = sessionStorage.companyId;
const res = await services.addUser(this.newUser);
@@ -2212,7 +2179,7 @@ export default {
// thisApp.newUser = {};
thisApp.$notify({
title: " ",
- message: "添加成功",
+ message: `${this.newUser.cnName}添加成功`,
type: "success",
offset: 100,
duration: 2500,
@@ -2224,83 +2191,7 @@ export default {
if (!ifcontinue) {
this.currentPain = 1;
}
- // this.$axios({
- // method: "post",
- // url: encodeURI(process.env.API_HOST + "sysinfo/userinfo"),
- // data: this.newUser,
- // })
- // .then((response) => {
- // if (response.data.state == 1) {
- // thisApp.newUser = {};
- // thisApp.$notify({
- // title: " ",
- // message: response.data.message,
- // type: "success",
- // offset: 100,
- // duration: 2500,
- // });
- // var node = this.$refs.tree.getCurrentNode();
- // this.newUser = { headImgUrl: "", isDeparture: 0 };
- // // this.listUsers(node.id);
- // this.getUserList(node);
- // } else {
- // thisApp.$notify.error({
- //
- // message: response.data.message,
- // offset: 100,
- // duration: 5000,
- // });
- // }
- // })
- // .catch((error) => {
- // console.log(error);
- // });
- },
- /**
- * 验证用户信息
- */
- checkUser: function (user) {
- if (user.cnName == undefined || user.cnName == "") {
- this.$notify({
-
- message: "请输入姓名",
- offset: 100,
- type: "warning",
- duration: 5000,
- });
- return false;
- }
- if (user.permission == undefined) {
- this.$notify({
-
- message: "请选择用户平台权限",
- type: "warning",
- offset: 100,
- duration: 5000,
- });
- return false;
- }
- if (user.backgroundPermission == undefined) {
- this.$notify({
-
- message: "请选择用户后台角色",
- type: "warning",
- offset: 100,
- duration: 5000,
- });
- return false;
- }
- if (user.phone == undefined || user.phone == "") {
- this.$notify({
-
- message: "请输入手机号",
- type: "warning",
- offset: 100,
- duration: 5000,
- });
- return false;
- }
- return true;
+ });
},
/**
* 保存用户信息
@@ -2499,26 +2390,11 @@ export default {
*/
async modifyUser() {
var thisApp = this;
- if (!this.checkUser(this.currentUser)) {
- return;
- }
- if (
- this.currentUser.arraySuper != null &&
- this.currentUser.arraySuper.length > 0
- ) {
+ this.$refs['form'].validate(async (valid)=>{
+ if(!valid) return;
this.currentUser.deptid = this.currentUser.arraySuper[
this.currentUser.arraySuper.length - 1
- ];
- } else {
- this.$notify({
-
- message: "请选择职员所在部门",
- type: "warning",
- offset: 100,
- duration: 5000,
- });
- return;
- }
+ ];
this.currentUser.modifyUserId = sessionStorage.userId;
const res = await services.updateUser(this.currentUser);
const ifSucc = res.Code === 0;
@@ -2532,8 +2408,7 @@ export default {
return;
}
thisApp.$notify({
- title: "修改成功",
- message: "",
+ message: "修改成功。",
type: "success",
offset: 100,
duration: 2500,
@@ -2541,38 +2416,8 @@ export default {
this.currentPain = 1;
this.editButtonGroup = 1;
// this.listUsers(this.$refs.tree.getCurrentNode().id);
- this.getUserList(this.$refs.tree.getCurrentNode());
-
- // this.$axios({
- // method: "put",
- // url: encodeURI(process.env.API_HOST + "sysinfo/userinfo"),
- // data: this.currentUser,
- // })
- // .then((response) => {
- // if (response.data.state == 1) {
- // thisApp.$notify({
- // title: " ",
- // message: response.data.message,
- // type: "success",
- // offset: 100,
- // duration: 2500,
- // });
- // this.currentPain = 1;
- // this.editButtonGroup = 1;
- // // this.listUsers(this.$refs.tree.getCurrentNode().id);
- // this.getUserList(this.$refs.tree.getCurrentNode());
- // } else {
- // thisApp.$notify.error({
- //
- // message: response.data.message,
- // offset: 100,
- // duration: 5000,
- // });
- // }
- // })
- // .catch((error) => {
- // console.log(error);
- // });
+ this.getUserList(this.$refs.tree.getCurrentNode());
+ });
},
/**
* 禁用用户
@@ -2606,7 +2451,7 @@ export default {
if (response.data.state == 1) {
thisApp.$notify({
title: " ",
- message: actionText + "成功",
+ message: `${this.currentUser.cnName}已${actionText}`,
type: "success",
offset: 100,
duration: 2500,
@@ -2624,14 +2469,6 @@ export default {
console.log(error);
});
})
- .catch(() => {
- thisApp.$notify.info({
-
- message: "已取消" + actionText,
- offset: 100,
- duration: 2500,
- });
- });
},
/**
* 删除用户信息
@@ -2639,9 +2476,7 @@ export default {
deleteUserInfo: function () {
var thisApp = this;
this.$confirm(
- "用户被删除后将无法恢复,是否继续删除用户:" +
- this.currentUser.cnName +
- " ?",
+ `账户删除后将无法恢复,是否继续删除“${this.currentUser.cnName}”的账户?`,
"",
{
confirmButtonText: "确定",
@@ -2701,14 +2536,6 @@ export default {
// .catch((error) => {
// console.log(error);
// });
- })
- .catch(() => {
- this.$notify.info({
-
- message: "已取消删除",
- offset: 100,
- duration: 2500,
- });
});
},
/**
@@ -2801,6 +2628,10 @@ export default {