|
|
|
@ -18,6 +18,7 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="4">
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button-group>
|
|
|
|
|
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
|
|
|
|
@ -25,11 +26,11 @@
|
|
|
|
|
<el-button type="primary" @click.native="handleForm(null, null)">新增</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="list" border style="width: 100%">
|
|
|
|
|
<el-table-column label="序号" type="index" width="50" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="用户账号" prop="userName" fixed></el-table-column>
|
|
|
|
@ -131,50 +132,50 @@ import {
|
|
|
|
|
authAdminList,
|
|
|
|
|
authCustomerRoles,
|
|
|
|
|
authAdminSave,
|
|
|
|
|
authAdminDelete,
|
|
|
|
|
} from "../../api/auth/authAdmin";
|
|
|
|
|
authAdminDelete
|
|
|
|
|
} from '../../api/auth/authAdmin'
|
|
|
|
|
|
|
|
|
|
import {userInfo} from "../../api/auth/login";
|
|
|
|
|
import { userInfo } from '../../api/auth/login'
|
|
|
|
|
|
|
|
|
|
const formJson = {
|
|
|
|
|
id: "",
|
|
|
|
|
passWord: "",
|
|
|
|
|
userName: "",
|
|
|
|
|
checkPassword: "",
|
|
|
|
|
employeeName: "",
|
|
|
|
|
id: '',
|
|
|
|
|
passWord: '',
|
|
|
|
|
userName: '',
|
|
|
|
|
checkPassword: '',
|
|
|
|
|
employeeName: '',
|
|
|
|
|
userFlag: 1,
|
|
|
|
|
customerId: "",
|
|
|
|
|
comments: "",
|
|
|
|
|
roles: [],
|
|
|
|
|
};
|
|
|
|
|
customerId: '',
|
|
|
|
|
comments: '',
|
|
|
|
|
roles: []
|
|
|
|
|
}
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
let validatePass = (rule, value, callback) => {
|
|
|
|
|
if (value === "") {
|
|
|
|
|
callback(new Error("请输入密码"));
|
|
|
|
|
if (value === '') {
|
|
|
|
|
callback(new Error('请输入密码'))
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
let validatePass2 = (rule, value, callback) => {
|
|
|
|
|
if (value === "") {
|
|
|
|
|
callback(new Error("请再次输入密码"));
|
|
|
|
|
if (value === '') {
|
|
|
|
|
callback(new Error('请再次输入密码'))
|
|
|
|
|
} else if (value !== this.formData.passWord) {
|
|
|
|
|
callback(new Error("两次输入密码不一致!"));
|
|
|
|
|
callback(new Error('两次输入密码不一致!'))
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
roles: [],
|
|
|
|
|
query: {
|
|
|
|
|
userName: "",
|
|
|
|
|
userFlag: "",
|
|
|
|
|
userName: '',
|
|
|
|
|
userFlag: '',
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 20,
|
|
|
|
|
roleId: "",
|
|
|
|
|
customerId: "",
|
|
|
|
|
companyName: "",
|
|
|
|
|
roleId: '',
|
|
|
|
|
customerId: this.$store.getters.customerId,
|
|
|
|
|
companyName: ''
|
|
|
|
|
},
|
|
|
|
|
list: [],
|
|
|
|
|
total: 0,
|
|
|
|
@ -182,98 +183,97 @@ export default {
|
|
|
|
|
index: null,
|
|
|
|
|
formName: null,
|
|
|
|
|
formMap: {
|
|
|
|
|
add: "新增",
|
|
|
|
|
edit: "编辑",
|
|
|
|
|
add: '新增',
|
|
|
|
|
edit: '编辑'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
userInfo: {
|
|
|
|
|
customerId: "",
|
|
|
|
|
companyName: "",
|
|
|
|
|
userId: "",
|
|
|
|
|
roles: [],
|
|
|
|
|
customerId: '',
|
|
|
|
|
companyName: '',
|
|
|
|
|
userId: '',
|
|
|
|
|
roles: []
|
|
|
|
|
},
|
|
|
|
|
formLoading: false,
|
|
|
|
|
formVisible: false,
|
|
|
|
|
formData: formJson,
|
|
|
|
|
formRules: {},
|
|
|
|
|
addRules: {
|
|
|
|
|
userName: [{required: true, message: "请输入姓名", trigger: "blur"}],
|
|
|
|
|
userName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
|
|
|
|
passWord: [
|
|
|
|
|
{required: true, message: "请输入密码", trigger: "blur"},
|
|
|
|
|
{validator: validatePass, trigger: "blur"},
|
|
|
|
|
{ required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
|
|
{ validator: validatePass, trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
checkPassword: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请再次输入密码",
|
|
|
|
|
trigger: "blur",
|
|
|
|
|
message: '请再次输入密码',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
},
|
|
|
|
|
{validator: validatePass2, trigger: "blur"},
|
|
|
|
|
],
|
|
|
|
|
{ validator: validatePass2, trigger: 'blur' }
|
|
|
|
|
]
|
|
|
|
|
// userFlag: [
|
|
|
|
|
// { required: true, message: "请选择状态", trigger: "change" },
|
|
|
|
|
// ],
|
|
|
|
|
},
|
|
|
|
|
editRules: {
|
|
|
|
|
userName: [{required: true, message: "请输入姓名", trigger: "blur"}],
|
|
|
|
|
userName: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
|
|
|
|
|
// userFlag: [
|
|
|
|
|
// { required: true, message: "请选择状态", trigger: "change" },
|
|
|
|
|
// ],
|
|
|
|
|
},
|
|
|
|
|
deleteLoading: false,
|
|
|
|
|
};
|
|
|
|
|
deleteLoading: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onReset() {
|
|
|
|
|
this.$router.push({
|
|
|
|
|
path: "",
|
|
|
|
|
});
|
|
|
|
|
path: ''
|
|
|
|
|
})
|
|
|
|
|
this.query = {
|
|
|
|
|
userName: "",
|
|
|
|
|
userFlag: "",
|
|
|
|
|
userName: '',
|
|
|
|
|
userFlag: '',
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 20,
|
|
|
|
|
roleId: "",
|
|
|
|
|
customerId: this.userInfo.customerId,
|
|
|
|
|
companyName: this.userInfo.companyName,
|
|
|
|
|
};
|
|
|
|
|
this.getList();
|
|
|
|
|
roleId: '',
|
|
|
|
|
customerId: this.$store.getters.customerId
|
|
|
|
|
}
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
onSubmit() {
|
|
|
|
|
this.$router.push({
|
|
|
|
|
path: "",
|
|
|
|
|
query: this.query,
|
|
|
|
|
});
|
|
|
|
|
this.query.page = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
path: '',
|
|
|
|
|
query: this.query
|
|
|
|
|
})
|
|
|
|
|
this.query.page = 1
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
handleCurrentChange(val) {
|
|
|
|
|
this.query.page = val.page;
|
|
|
|
|
this.getList();
|
|
|
|
|
this.query.page = val.page
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.loading = true
|
|
|
|
|
authAdminList(this.query)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.list = response.data.list || [];
|
|
|
|
|
this.total = response.data.total || 0;
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.list = response.data.list || []
|
|
|
|
|
this.total = response.data.total || 0
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.list = [];
|
|
|
|
|
this.total = 0;
|
|
|
|
|
this.roles = [];
|
|
|
|
|
});
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.list = []
|
|
|
|
|
this.total = 0
|
|
|
|
|
this.roles = []
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getRoleList() {
|
|
|
|
|
authCustomerRoles(this.query)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.roles = response.data.list || [];
|
|
|
|
|
this.roles = response.data.list || []
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.roles = [];
|
|
|
|
|
});
|
|
|
|
|
this.roles = []
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getUserInfo() {
|
|
|
|
@ -283,60 +283,60 @@ export default {
|
|
|
|
|
customerId: response.data.customerId,
|
|
|
|
|
companyName: response.data.companyName,
|
|
|
|
|
userId: response.data.id,
|
|
|
|
|
roles: response.data.roleIds,
|
|
|
|
|
};
|
|
|
|
|
this.query.customerId = response.data.customerId;
|
|
|
|
|
this.query.companyName = response.data.companyName;
|
|
|
|
|
roles: response.data.roleIds
|
|
|
|
|
}
|
|
|
|
|
this.query.customerId = response.data.customerId
|
|
|
|
|
this.query.companyName = response.data.companyName
|
|
|
|
|
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getList()
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.customerId = "";
|
|
|
|
|
this.companyName = "";
|
|
|
|
|
});
|
|
|
|
|
this.customerId = ''
|
|
|
|
|
this.companyName = ''
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 刷新表单
|
|
|
|
|
resetForm() {
|
|
|
|
|
if (this.$refs["dataForm"]) {
|
|
|
|
|
if (this.$refs['dataForm']) {
|
|
|
|
|
// 清空验证信息表单
|
|
|
|
|
this.$refs["dataForm"].clearValidate();
|
|
|
|
|
this.$refs['dataForm'].clearValidate()
|
|
|
|
|
// 刷新表单
|
|
|
|
|
this.$refs["dataForm"].resetFields();
|
|
|
|
|
this.$refs['dataForm'].resetFields()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 隐藏表单
|
|
|
|
|
hideForm() {
|
|
|
|
|
// 更改值
|
|
|
|
|
this.formVisible = !this.formVisible;
|
|
|
|
|
this.formVisible = !this.formVisible
|
|
|
|
|
// 清空表单
|
|
|
|
|
this.$refs["dataForm"].resetFields();
|
|
|
|
|
return true;
|
|
|
|
|
this.$refs['dataForm'].resetFields()
|
|
|
|
|
return true
|
|
|
|
|
},
|
|
|
|
|
// 显示表单
|
|
|
|
|
handleForm(index, row) {
|
|
|
|
|
this.formVisible = true;
|
|
|
|
|
this.formData = JSON.parse(JSON.stringify(formJson));
|
|
|
|
|
this.formVisible = true
|
|
|
|
|
this.formData = JSON.parse(JSON.stringify(formJson))
|
|
|
|
|
if (row !== null) {
|
|
|
|
|
this.formData = Object.assign({}, row);
|
|
|
|
|
this.formData = Object.assign({}, row)
|
|
|
|
|
}
|
|
|
|
|
this.formName = "add";
|
|
|
|
|
this.formRules = this.addRules;
|
|
|
|
|
this.formName = 'add'
|
|
|
|
|
this.formRules = this.addRules
|
|
|
|
|
if (index !== null) {
|
|
|
|
|
this.index = index;
|
|
|
|
|
this.formName = "edit";
|
|
|
|
|
this.formRules = this.addRules;
|
|
|
|
|
this.index = index
|
|
|
|
|
this.formName = 'edit'
|
|
|
|
|
this.formRules = this.addRules
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
formSubmit() {
|
|
|
|
|
this.$refs["dataForm"].validate((valid) => {
|
|
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.formLoading = true;
|
|
|
|
|
this.formData.userFlag = 1;
|
|
|
|
|
this.formData.roles = this.userInfo.roles;
|
|
|
|
|
this.formData.customerId = this.userInfo.customerId;
|
|
|
|
|
this.formData.companyName = this.userInfo.companyName;
|
|
|
|
|
let data = Object.assign({}, this.formData);
|
|
|
|
|
this.formLoading = true
|
|
|
|
|
this.formData.userFlag = 1
|
|
|
|
|
this.formData.roles = this.userInfo.roles
|
|
|
|
|
this.formData.customerId = this.userInfo.customerId
|
|
|
|
|
this.formData.companyName = this.userInfo.companyName
|
|
|
|
|
let data = Object.assign({}, this.formData)
|
|
|
|
|
let savequery = {
|
|
|
|
|
id: this.formData.id,
|
|
|
|
|
userFlag: 1,
|
|
|
|
@ -346,88 +346,90 @@ export default {
|
|
|
|
|
passWord: this.formData.passWord,
|
|
|
|
|
userName: this.formData.userName,
|
|
|
|
|
employeeName: this.formData.employeeName,
|
|
|
|
|
comments: this.formData.comments,
|
|
|
|
|
};
|
|
|
|
|
comments: this.formData.comments
|
|
|
|
|
}
|
|
|
|
|
authAdminSave(savequery, this.formName).then((response) => {
|
|
|
|
|
this.formLoading = false;
|
|
|
|
|
this.formLoading = false
|
|
|
|
|
if (response.code !== 20000) {
|
|
|
|
|
this.$message.error(response.message);
|
|
|
|
|
return false;
|
|
|
|
|
this.$message.error(response.message)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
this.$message.success("操作成功");
|
|
|
|
|
this.formVisible = false;
|
|
|
|
|
if (this.formName === "add") {
|
|
|
|
|
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);
|
|
|
|
|
data.id = response.data.id
|
|
|
|
|
this.list.unshift(data)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.list.splice(this.index, 1, data);
|
|
|
|
|
this.list.splice(this.index, 1, data)
|
|
|
|
|
}
|
|
|
|
|
// 刷新表单
|
|
|
|
|
this.resetForm();
|
|
|
|
|
});
|
|
|
|
|
this.resetForm()
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 删除
|
|
|
|
|
handleDel(index, row) {
|
|
|
|
|
if (row.id === this.userInfo.userId) {
|
|
|
|
|
this.$message.warning("不能删除自己");
|
|
|
|
|
this.$message.warning('不能删除自己')
|
|
|
|
|
} else if (row.id) {
|
|
|
|
|
this.$confirm("确认删除该记录吗?", "提示", {
|
|
|
|
|
type: "warning",
|
|
|
|
|
this.$confirm('确认删除该记录吗?', '提示', {
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
let para = {id: row.id};
|
|
|
|
|
this.deleteLoading = true;
|
|
|
|
|
let para = { id: row.id }
|
|
|
|
|
this.deleteLoading = true
|
|
|
|
|
authAdminDelete(para)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.deleteLoading = false;
|
|
|
|
|
this.deleteLoading = false
|
|
|
|
|
if (response.code !== 20000) {
|
|
|
|
|
this.$message.error(response.message);
|
|
|
|
|
return false;
|
|
|
|
|
this.$message.error(response.message)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
this.$message.success("操作成功");
|
|
|
|
|
this.$message.success('操作成功')
|
|
|
|
|
// 刷新数据
|
|
|
|
|
this.list.splice(index, 1);
|
|
|
|
|
this.list.splice(index, 1)
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.deleteLoading = false;
|
|
|
|
|
});
|
|
|
|
|
this.deleteLoading = false
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.$message.info("取消删除");
|
|
|
|
|
});
|
|
|
|
|
this.$message.info('取消删除')
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
filters: {
|
|
|
|
|
statusFilterType(status) {
|
|
|
|
|
const statusMap = {
|
|
|
|
|
0: "gray",
|
|
|
|
|
1: "success",
|
|
|
|
|
2: "danger",
|
|
|
|
|
};
|
|
|
|
|
return statusMap[status];
|
|
|
|
|
0: 'gray',
|
|
|
|
|
1: 'success',
|
|
|
|
|
2: 'danger'
|
|
|
|
|
}
|
|
|
|
|
return statusMap[status]
|
|
|
|
|
},
|
|
|
|
|
statusFilterName(status) {
|
|
|
|
|
const statusMap = {
|
|
|
|
|
0: "禁用",
|
|
|
|
|
1: "正常",
|
|
|
|
|
2: "未验证",
|
|
|
|
|
};
|
|
|
|
|
return statusMap[status];
|
|
|
|
|
},
|
|
|
|
|
0: '禁用',
|
|
|
|
|
1: '正常',
|
|
|
|
|
2: '未验证'
|
|
|
|
|
}
|
|
|
|
|
return statusMap[status]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
this.getList()
|
|
|
|
|
debugger
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style type="text/scss" lang="scss">
|
|
|
|
|