|
|
|
@ -39,11 +39,10 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-table v-loading="loading" :data="list" style="width: 100%">
|
|
|
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
|
|
|
<el-table-column label="用户账号" prop="userName" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="用户名称" prop="employeeName" fixed>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="状态" fixed="">
|
|
|
|
|
<el-table-column type="index" width="50" label="序号"></el-table-column>
|
|
|
|
|
<el-table-column label="用户账号" prop="userName"></el-table-column>
|
|
|
|
|
<el-table-column label="用户名称" prop="employeeName"></el-table-column>
|
|
|
|
|
<el-table-column label="状态">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-tag :type="scope.row.userFlag | statusFilterType">{{
|
|
|
|
|
scope.row.userFlag | statusFilterName
|
|
|
|
@ -122,7 +121,7 @@
|
|
|
|
|
type="password"
|
|
|
|
|
size="small"
|
|
|
|
|
v-model="formData.passWord"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
:disabled="formName === 'add'"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</div>
|
|
|
|
@ -135,13 +134,15 @@
|
|
|
|
|
type="password"
|
|
|
|
|
size="small"
|
|
|
|
|
v-model="formData.checkPassword"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
:disabled="formName === 'add'"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<span v-if="formName === 'add'"
|
|
|
|
|
style="font-size: 14px; color: red;">新增用户默认密码为: 123456,登录后请及时修改</span>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click.native="hideForm" size="small">取消</el-button>
|
|
|
|
@ -184,22 +185,6 @@ export default {
|
|
|
|
|
currentCustomer: ""
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
let validatePass = (rule, value, callback) => {
|
|
|
|
|
if (value === "") {
|
|
|
|
|
callback(new Error("请输入密码"));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
let validatePass2 = (rule, value, callback) => {
|
|
|
|
|
if (value === "") {
|
|
|
|
|
callback(new Error("请再次输入密码"));
|
|
|
|
|
} else if (value !== this.formData.passWord) {
|
|
|
|
|
callback(new Error("两次输入密码不一致!"));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
roles: [],
|
|
|
|
|
query: {
|
|
|
|
@ -232,21 +217,6 @@ export default {
|
|
|
|
|
formRules: {},
|
|
|
|
|
addRules: {
|
|
|
|
|
userName: [{required: true, message: "请输入姓名", trigger: "blur"}],
|
|
|
|
|
passWord: [
|
|
|
|
|
{required: true, message: "请输入密码", trigger: "blur"},
|
|
|
|
|
{validator: validatePass, trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
checkPassword: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请再次输入密码",
|
|
|
|
|
trigger: "blur"
|
|
|
|
|
},
|
|
|
|
|
{validator: validatePass2, trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
userFlag: [
|
|
|
|
|
{required: true, message: "请选择状态", trigger: "change"}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
editRules: {
|
|
|
|
|
userName: [{required: true, message: "请输入姓名", trigger: "blur"}],
|
|
|
|
@ -359,44 +329,51 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
formSubmit() {
|
|
|
|
|
this.$refs["dataForm"].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.formLoading = true;
|
|
|
|
|
if (this.formName === 'add') {
|
|
|
|
|
this.formData.passWord = '123456';
|
|
|
|
|
this.formData.checkPassword = this.formData.passWord;
|
|
|
|
|
} else {
|
|
|
|
|
if (this.formData.passWord != this.formData.checkPassword) {
|
|
|
|
|
this.$message.error("两次输入的密码不同!");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.formLoading = true;
|
|
|
|
|
|
|
|
|
|
this.formData.userFlag = 1;
|
|
|
|
|
this.formData.roles = this.userInfo.roles;
|
|
|
|
|
this.formData.customerId = this.currentCustomer;
|
|
|
|
|
let data = Object.assign({}, this.formData);
|
|
|
|
|
let savequery = {
|
|
|
|
|
id: this.formData.id,
|
|
|
|
|
userFlag: 1,
|
|
|
|
|
roles: this.userInfo.roles,
|
|
|
|
|
customerId: this.currentCustomer,
|
|
|
|
|
passWord: this.formData.passWord,
|
|
|
|
|
userName: this.formData.userName,
|
|
|
|
|
employeeName: this.formData.employeeName
|
|
|
|
|
};
|
|
|
|
|
authAdminSave(savequery, 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.formData.userFlag = 1;
|
|
|
|
|
this.formData.roles = this.userInfo.roles;
|
|
|
|
|
this.formData.customerId = this.currentCustomer;
|
|
|
|
|
let data = Object.assign({}, this.formData);
|
|
|
|
|
let savequery = {
|
|
|
|
|
id: this.formData.id,
|
|
|
|
|
userFlag: 1,
|
|
|
|
|
roles: this.userInfo.roles,
|
|
|
|
|
customerId: this.currentCustomer,
|
|
|
|
|
passWord: this.formData.passWord,
|
|
|
|
|
userName: this.formData.userName,
|
|
|
|
|
employeeName: this.formData.employeeName,
|
|
|
|
|
checkPassword: this.formData.checkPassword
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
authAdminSave(savequery, 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();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 删除
|
|
|
|
@ -459,7 +436,7 @@ export default {
|
|
|
|
|
this.query.customerId = this.currentCustomer;
|
|
|
|
|
this.getList();
|
|
|
|
|
if (this.$store.getters.customerId == 110) {
|
|
|
|
|
this.addEnable = false;
|
|
|
|
|
this.addEnable = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|