|
|
|
@ -242,6 +242,7 @@ import {
|
|
|
|
|
} from "../../../api/auth/authRole";
|
|
|
|
|
import {getBussinessType} from "../../../api/basic/bussinessType";
|
|
|
|
|
import {getBussinessTypeRole, updateBussinessTypeRole} from "../../../api/basic/bussinessTypeRole";
|
|
|
|
|
import {isBlank} from "@/utils/strUtil";
|
|
|
|
|
|
|
|
|
|
const formJson = {
|
|
|
|
|
id: "",
|
|
|
|
@ -435,13 +436,10 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 刷新表单
|
|
|
|
|
resetForm() {
|
|
|
|
|
if (this.$refs["dataForm"]) {
|
|
|
|
|
// 清空验证信息表单
|
|
|
|
|
this.$refs["dataForm"].clearValidate();
|
|
|
|
|
// 刷新表单
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs["dataForm"].resetFields();
|
|
|
|
|
this.getList();
|
|
|
|
|
}
|
|
|
|
|
this.$refs["dataForm"].clearValidate();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 隐藏表单
|
|
|
|
|
hideForm() {
|
|
|
|
@ -451,6 +449,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 显示表单
|
|
|
|
|
handleForm(index, row) {
|
|
|
|
|
this.resetForm();
|
|
|
|
|
this.formVisible = true;
|
|
|
|
|
if (null != index) {
|
|
|
|
|
//编辑弹窗,禁用是否客户角色按钮
|
|
|
|
@ -469,37 +468,38 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
formSubmit() {
|
|
|
|
|
this.$refs["dataForm"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.formLoading = true;
|
|
|
|
|
let data = Object.assign({}, this.formData);
|
|
|
|
|
authRoleSave(data, this.formName)
|
|
|
|
|
.then(response => {
|
|
|
|
|
this.formLoading = false;
|
|
|
|
|
if (response.code !== 20000) {
|
|
|
|
|
this.$message.error(response.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
this.$message.success("操作成功");
|
|
|
|
|
this.formVisible = false;
|
|
|
|
|
if (this.formName === "add") {
|
|
|
|
|
// 向头部添加数据
|
|
|
|
|
if (response.data && response.data.id) {
|
|
|
|
|
data.id = response.data.id;
|
|
|
|
|
this.list.unshift(data);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.list.splice(this.index, 1, data);
|
|
|
|
|
}
|
|
|
|
|
// 刷新表单
|
|
|
|
|
this.resetForm();
|
|
|
|
|
this.getList();
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.formLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (isBlank(this.formData.name)) {
|
|
|
|
|
this.$message.error("角色名称为必填项!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.formLoading = true;
|
|
|
|
|
let data = Object.assign({}, this.formData);
|
|
|
|
|
authRoleSave(data, this.formName)
|
|
|
|
|
.then(response => {
|
|
|
|
|
this.formLoading = false;
|
|
|
|
|
if (response.code !== 20000) {
|
|
|
|
|
this.$message.error(response.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
this.$message.success("操作成功");
|
|
|
|
|
this.formVisible = false;
|
|
|
|
|
if (this.formName === "add") {
|
|
|
|
|
// 向头部添加数据
|
|
|
|
|
if (response.data && response.data.id) {
|
|
|
|
|
data.id = response.data.id;
|
|
|
|
|
this.list.unshift(data);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.list.splice(this.index, 1, data);
|
|
|
|
|
}
|
|
|
|
|
// 刷新表单
|
|
|
|
|
this.resetForm();
|
|
|
|
|
this.getList();
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.formLoading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 删除
|
|
|
|
|
handleDel(index, row) {
|
|
|
|
@ -526,7 +526,6 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.$message.info("取消删除");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|