|
@@ -18,15 +18,14 @@
|
|
|
prefix-icon="el-icon-search"
|
|
prefix-icon="el-icon-search"
|
|
|
clearable
|
|
clearable
|
|
|
@clear="getData(1)"
|
|
@clear="getData(1)"
|
|
|
- >
|
|
|
|
|
- </el-input>
|
|
|
|
|
|
|
+ ></el-input>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-button type="primary" @click="getData(1)">查询</el-button>
|
|
<el-button type="primary" @click="getData(1)">查询</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="right">
|
|
<div class="right">
|
|
|
- <el-button type="primary" @click="handleAdd">添加账号</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="handleAdd" v-if="$store.state.user.userType==1">添加账号</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 表格区域 -->
|
|
<!-- 表格区域 -->
|
|
@@ -43,15 +42,9 @@
|
|
|
background: 'rgba(240, 243, 247, 1)',
|
|
background: 'rgba(240, 243, 247, 1)',
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
|
- <el-table-column
|
|
|
|
|
- prop="username"
|
|
|
|
|
- align="center"
|
|
|
|
|
- label="员工姓名(账号)"
|
|
|
|
|
- >
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+ <el-table-column prop="username" align="center" label="员工姓名(账号)"></el-table-column>
|
|
|
|
|
|
|
|
- <el-table-column prop="phone" label="手机号" align="center">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+ <el-table-column prop="phone" label="手机号" align="center"></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column align="center" label="角色">
|
|
<el-table-column align="center" label="角色">
|
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
@@ -63,12 +56,8 @@
|
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
|
<el-row v-if="row.identity == '超级管理员'">/</el-row>
|
|
<el-row v-if="row.identity == '超级管理员'">/</el-row>
|
|
|
<el-row v-else>
|
|
<el-row v-else>
|
|
|
- <el-button type="text" @click="handleEdit(row)">
|
|
|
|
|
- 编辑
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button type="text" @click="handleDelete(row.id)"
|
|
|
|
|
- >删除
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ <el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
|
|
|
|
+ <el-button type="text" @click="handleDelete(row.id)">删除</el-button>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -83,8 +72,7 @@
|
|
|
:page-size="pageSize"
|
|
:page-size="pageSize"
|
|
|
:total="total"
|
|
:total="total"
|
|
|
@current-change="handleCurrentChange"
|
|
@current-change="handleCurrentChange"
|
|
|
- >
|
|
|
|
|
- </el-pagination>
|
|
|
|
|
|
|
+ ></el-pagination>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -107,18 +95,12 @@
|
|
|
<el-row :gutter="85">
|
|
<el-row :gutter="85">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="员工姓名" prop="username">
|
|
<el-form-item label="员工姓名" prop="username">
|
|
|
- <el-input
|
|
|
|
|
- v-model="ruleForm.username"
|
|
|
|
|
- placeholder="请输入员工姓名"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="ruleForm.username" placeholder="请输入员工姓名"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="手机号码" prop="phone">
|
|
<el-form-item label="手机号码" prop="phone">
|
|
|
- <el-input
|
|
|
|
|
- v-model="ruleForm.phone"
|
|
|
|
|
- placeholder="请输入手机号码"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="ruleForm.phone" placeholder="请输入手机号码"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -128,25 +110,27 @@
|
|
|
<el-form-item label="角色" prop="adminType">
|
|
<el-form-item label="角色" prop="adminType">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="ruleForm.adminType"
|
|
v-model="ruleForm.adminType"
|
|
|
|
|
+ @change="adminTypeSelect"
|
|
|
placeholder="请选择角色"
|
|
placeholder="请选择角色"
|
|
|
>
|
|
>
|
|
|
- <el-option label="超级管理员" value="1"></el-option>
|
|
|
|
|
|
|
+ <el-option label="超级管理员" value="1" v-if="$store.state.user.userType==1"></el-option>
|
|
|
<el-option label="管理员" value="2"></el-option>
|
|
<el-option label="管理员" value="2"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="密码" prop="password">
|
|
<el-form-item label="密码" prop="password">
|
|
|
- <el-input
|
|
|
|
|
|
|
+ <el-input v-model="ruleForm.password" placeholder="请输入密码"></el-input>
|
|
|
|
|
+ <!-- <el-input
|
|
|
v-model="ruleForm.password"
|
|
v-model="ruleForm.password"
|
|
|
placeholder="请输入密码"
|
|
placeholder="请输入密码"
|
|
|
:disabled="popTitle == '编辑账号'"
|
|
:disabled="popTitle == '编辑账号'"
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ ></el-input>-->
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- <!-- <el-form-item label="权限分配" prop="statu">
|
|
|
|
|
- <el-checkbox-group v-model="ruleForm.statu">
|
|
|
|
|
|
|
+ <el-form-item label="权限分配" prop="authority">
|
|
|
|
|
+ <el-checkbox-group v-model="ruleForm.authority" :min="1" @change="privilege">
|
|
|
<el-checkbox label="房态管理" name="type"></el-checkbox>
|
|
<el-checkbox label="房态管理" name="type"></el-checkbox>
|
|
|
<el-checkbox label="订单管理" name="type"></el-checkbox>
|
|
<el-checkbox label="订单管理" name="type"></el-checkbox>
|
|
|
<el-checkbox label="员工管理" name="type"></el-checkbox>
|
|
<el-checkbox label="员工管理" name="type"></el-checkbox>
|
|
@@ -154,14 +138,12 @@
|
|
|
<el-checkbox label="统计报表" name="type"></el-checkbox>
|
|
<el-checkbox label="统计报表" name="type"></el-checkbox>
|
|
|
<el-checkbox label="系统设置" name="type"></el-checkbox>
|
|
<el-checkbox label="系统设置" name="type"></el-checkbox>
|
|
|
</el-checkbox-group>
|
|
</el-checkbox-group>
|
|
|
- </el-form-item> -->
|
|
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="handleConfirm('ruleForm')"
|
|
|
|
|
- >确 定
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="handleConfirm('ruleForm')">确 定</el-button>
|
|
|
</span>
|
|
</span>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</el-card>
|
|
</el-card>
|
|
@@ -188,18 +170,20 @@ export default {
|
|
|
pageSize: 8,
|
|
pageSize: 8,
|
|
|
// 总条数
|
|
// 总条数
|
|
|
total: null,
|
|
total: null,
|
|
|
|
|
+ roles: [],
|
|
|
|
|
+ id: "",
|
|
|
// 添加账号弹窗表格绑定数据
|
|
// 添加账号弹窗表格绑定数据
|
|
|
ruleForm: {
|
|
ruleForm: {
|
|
|
username: "",
|
|
username: "",
|
|
|
phone: "",
|
|
phone: "",
|
|
|
adminType: "",
|
|
adminType: "",
|
|
|
password: "",
|
|
password: "",
|
|
|
- // statu: [],
|
|
|
|
|
|
|
+ authority: []
|
|
|
},
|
|
},
|
|
|
// 添加账号弹窗表格验证规则
|
|
// 添加账号弹窗表格验证规则
|
|
|
rules: {
|
|
rules: {
|
|
|
username: [
|
|
username: [
|
|
|
- { required: true, message: "请输入员工姓名", trigger: "blur" },
|
|
|
|
|
|
|
+ { required: true, message: "请输入员工姓名", trigger: "blur" }
|
|
|
],
|
|
],
|
|
|
phone: [
|
|
phone: [
|
|
|
{ required: true, message: "请输入手机号码", trigger: "blur" },
|
|
{ required: true, message: "请输入手机号码", trigger: "blur" },
|
|
@@ -207,30 +191,30 @@ export default {
|
|
|
min: 3,
|
|
min: 3,
|
|
|
max: 11,
|
|
max: 11,
|
|
|
message: "长度在 3 到 11 个字符",
|
|
message: "长度在 3 到 11 个字符",
|
|
|
- trigger: "blur",
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ trigger: "blur"
|
|
|
|
|
+ }
|
|
|
],
|
|
],
|
|
|
password: [
|
|
password: [
|
|
|
{ required: true, message: "请输入密码", trigger: "blur" },
|
|
{ required: true, message: "请输入密码", trigger: "blur" },
|
|
|
- // {
|
|
|
|
|
- // min: 3,
|
|
|
|
|
- // max: 11,
|
|
|
|
|
- // message: "长度在 3 到 11 个字符",
|
|
|
|
|
- // trigger: "blur",
|
|
|
|
|
- // },
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ min: 6,
|
|
|
|
|
+ // max: 12,
|
|
|
|
|
+ message: "长度应大于等于 6 字符",
|
|
|
|
|
+ trigger: "blur"
|
|
|
|
|
+ }
|
|
|
],
|
|
],
|
|
|
adminType: [
|
|
adminType: [
|
|
|
- { required: true, message: "请选择角色", trigger: "change" },
|
|
|
|
|
|
|
+ { required: true, message: "请选择角色", trigger: "change" }
|
|
|
],
|
|
],
|
|
|
- // statu: [
|
|
|
|
|
- // {
|
|
|
|
|
- // type: "array",
|
|
|
|
|
- // required: true,
|
|
|
|
|
- // message: "请至少选择一个活动性质",
|
|
|
|
|
- // trigger: "change",
|
|
|
|
|
- // },
|
|
|
|
|
- // ],
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ authority: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: "array",
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: "请至少选择一个活动性质",
|
|
|
|
|
+ trigger: "change"
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -243,6 +227,8 @@ export default {
|
|
|
curPage: curPage || this.currentPage,
|
|
curPage: curPage || this.currentPage,
|
|
|
pageSize: this.pageSize,
|
|
pageSize: this.pageSize,
|
|
|
keyword: this.searchValue,
|
|
keyword: this.searchValue,
|
|
|
|
|
+ userType: this.$store.state.user.userType.toString(),
|
|
|
|
|
+ telPhone: this.$store.state.user.telPhone
|
|
|
};
|
|
};
|
|
|
let res = await this.API.hotelAdmin.hotelStaffList(params);
|
|
let res = await this.API.hotelAdmin.hotelStaffList(params);
|
|
|
// console.log(res);
|
|
// console.log(res);
|
|
@@ -260,7 +246,10 @@ export default {
|
|
|
adminType: "",
|
|
adminType: "",
|
|
|
password: "",
|
|
password: "",
|
|
|
username: "",
|
|
username: "",
|
|
|
|
|
+ statu: "1",
|
|
|
|
|
+ authority: []
|
|
|
};
|
|
};
|
|
|
|
|
+ this.roles = [];
|
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
|
this.popTitle = "添加账号";
|
|
this.popTitle = "添加账号";
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -271,9 +260,46 @@ export default {
|
|
|
handleEdit(row) {
|
|
handleEdit(row) {
|
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
|
this.popTitle = "编辑账号";
|
|
this.popTitle = "编辑账号";
|
|
|
|
|
+ // console.log(row);
|
|
|
|
|
+ let roles = row.authority.split("/");
|
|
|
|
|
+ // console.log(roles);
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.$refs.ruleForm.resetFields();
|
|
this.$refs.ruleForm.resetFields();
|
|
|
- this.ruleForm = { ...row };
|
|
|
|
|
|
|
+ let data = [];
|
|
|
|
|
+ let title = [];
|
|
|
|
|
+ row.authority.split("/").forEach(item => {
|
|
|
|
|
+ if (item == "home") {
|
|
|
|
|
+ data.push("home_1");
|
|
|
|
|
+ title.push("房态管理");
|
|
|
|
|
+ } else if (item == "order") {
|
|
|
|
|
+ data.push("order_2");
|
|
|
|
|
+ title.push("订单管理");
|
|
|
|
|
+ } else if (item == "staff") {
|
|
|
|
|
+ data.push("staff_3");
|
|
|
|
|
+ title.push("员工管理");
|
|
|
|
|
+ } else if (item == "account") {
|
|
|
|
|
+ data.push("account_4");
|
|
|
|
|
+ title.push("账号管理");
|
|
|
|
|
+ } else if (item == "stat") {
|
|
|
|
|
+ data.push("stat_5");
|
|
|
|
|
+ title.push("统计报表");
|
|
|
|
|
+ } else if (item == "system") {
|
|
|
|
|
+ data.push("system_6");
|
|
|
|
|
+ title.push("系统设置");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.roles = data;
|
|
|
|
|
+ this.id = row.id;
|
|
|
|
|
+ this.ruleForm = {
|
|
|
|
|
+ username: row.username,
|
|
|
|
|
+ phone: row.phone,
|
|
|
|
|
+ adminType: row.adminType,
|
|
|
|
|
+ statu: row.statu,
|
|
|
|
|
+ password: row.password,
|
|
|
|
|
+ authority: title
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // console.log(data);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
// 删除按钮回调
|
|
// 删除按钮回调
|
|
@@ -281,7 +307,7 @@ export default {
|
|
|
this.$confirm("确定删除吗?", "提示", {
|
|
this.$confirm("确定删除吗?", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
|
|
|
|
+ type: "warning"
|
|
|
})
|
|
})
|
|
|
.then(async () => {
|
|
.then(async () => {
|
|
|
let res = await this.API.hotelAdmin.hotelStaffDelete([id]);
|
|
let res = await this.API.hotelAdmin.hotelStaffDelete([id]);
|
|
@@ -308,7 +334,8 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 添加账号/编辑账号 弹窗确定按钮回调
|
|
// 添加账号/编辑账号 弹窗确定按钮回调
|
|
|
handleConfirm(formName) {
|
|
handleConfirm(formName) {
|
|
|
- this.$refs[formName].validate(async (valid) => {
|
|
|
|
|
|
|
+ // console.log(formName);
|
|
|
|
|
+ this.$refs[formName].validate(async valid => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
let rsaPassWord = RSAencrypt(this.ruleForm.password);
|
|
let rsaPassWord = RSAencrypt(this.ruleForm.password);
|
|
|
let data = {
|
|
let data = {
|
|
@@ -316,17 +343,25 @@ export default {
|
|
|
username: this.ruleForm.username,
|
|
username: this.ruleForm.username,
|
|
|
adminType: this.ruleForm.adminType,
|
|
adminType: this.ruleForm.adminType,
|
|
|
password: rsaPassWord,
|
|
password: rsaPassWord,
|
|
|
- statu: 1,
|
|
|
|
|
|
|
+ statu: "1",
|
|
|
|
|
+ authority: this.roles
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ if (this.ruleForm.password.length > 20) {
|
|
|
|
|
+ rsaPassWord = "";
|
|
|
|
|
+ }
|
|
|
let data1 = {
|
|
let data1 = {
|
|
|
- id: this.ruleForm.id,
|
|
|
|
|
|
|
+ id: this.id,
|
|
|
phone: this.ruleForm.phone,
|
|
phone: this.ruleForm.phone,
|
|
|
username: this.ruleForm.username,
|
|
username: this.ruleForm.username,
|
|
|
adminType: this.ruleForm.adminType,
|
|
adminType: this.ruleForm.adminType,
|
|
|
- statu: 1,
|
|
|
|
|
|
|
+ statu: "1",
|
|
|
|
|
+ authority: this.roles,
|
|
|
|
|
+ password: rsaPassWord
|
|
|
};
|
|
};
|
|
|
// 添加账号请求
|
|
// 添加账号请求
|
|
|
if (this.popTitle == "添加账号") {
|
|
if (this.popTitle == "添加账号") {
|
|
|
|
|
+ // console.log("添加账号", data);
|
|
|
let res = await this.API.hotelAdmin.hotelStaffAdd(data);
|
|
let res = await this.API.hotelAdmin.hotelStaffAdd(data);
|
|
|
// console.log(res);
|
|
// console.log(res);
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
@@ -338,6 +373,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
// 编辑账号请求
|
|
// 编辑账号请求
|
|
|
else {
|
|
else {
|
|
|
|
|
+ // console.log("编辑账号", data1);
|
|
|
let res = await this.API.hotelAdmin.hotelStaffUpdate(data1);
|
|
let res = await this.API.hotelAdmin.hotelStaffUpdate(data1);
|
|
|
// console.log(res);
|
|
// console.log(res);
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
@@ -354,13 +390,60 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ // 权限分配
|
|
|
|
|
+ privilege(value) {
|
|
|
|
|
+ // console.log(value);
|
|
|
|
|
+ let data = [];
|
|
|
|
|
+ value.forEach(item => {
|
|
|
|
|
+ // console.log(item);
|
|
|
|
|
+ if (item == "房态管理") {
|
|
|
|
|
+ data.push("home_1");
|
|
|
|
|
+ } else if (item == "订单管理") {
|
|
|
|
|
+ data.push("order_2");
|
|
|
|
|
+ } else if (item == "员工管理") {
|
|
|
|
|
+ data.push("staff_3");
|
|
|
|
|
+ } else if (item == "账号管理") {
|
|
|
|
|
+ data.push("account_4");
|
|
|
|
|
+ } else if (item == "统计报表") {
|
|
|
|
|
+ data.push("stat_5");
|
|
|
|
|
+ } else if (item == "系统设置") {
|
|
|
|
|
+ data.push("system_6");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.roles = data;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 改变管理员状态
|
|
|
|
|
+ adminTypeSelect(value) {
|
|
|
|
|
+ // console.log(value);
|
|
|
|
|
+ // let roles = [];
|
|
|
|
|
+ // let role = [];
|
|
|
|
|
+ // if (value == 2) {
|
|
|
|
|
+ // role = this.ruleForm.authority.filter(item => {
|
|
|
|
|
+ // return item != "账号管理";
|
|
|
|
|
+ // });
|
|
|
|
|
+ // roles = this.roles.filter(item => {
|
|
|
|
|
+ // return item != "account_4";
|
|
|
|
|
+ // });
|
|
|
|
|
+ // this.ruleForm.authority = role;
|
|
|
|
|
+ // this.roles = roles;
|
|
|
|
|
+ // } else if (value == 1) {
|
|
|
|
|
+ // let index = this.ruleForm.authority.indexOf("账号管理");
|
|
|
|
|
+ // let index2 = this.roles.indexOf("account_4");
|
|
|
|
|
+ // if (index < 0) {
|
|
|
|
|
+ // this.ruleForm.authority.push("账号管理");
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (index2 < 0) {
|
|
|
|
|
+ // this.roles.indexOf("account_4");
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ },
|
|
|
// 表格样式设置回调
|
|
// 表格样式设置回调
|
|
|
rowbg(row) {
|
|
rowbg(row) {
|
|
|
if (row.rowIndex % 2 != 0) {
|
|
if (row.rowIndex % 2 != 0) {
|
|
|
return { background: "rgba(240, 243, 247, 1)", "border-radius": "5px" };
|
|
return { background: "rgba(240, 243, 247, 1)", "border-radius": "5px" };
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|