|
@@ -14,7 +14,7 @@
|
|
|
<!-- <el-button type="info" circle icon="el-icon-search icons" @click="search()"></el-button> -->
|
|
|
</el-col>
|
|
|
<el-col :span="1">
|
|
|
- <el-button type="success" @click="openAlert('add')">新增HR</el-button>
|
|
|
+ <el-button type="success" @click="openAlert('add')" v-if="is_admin">新增HR</el-button>
|
|
|
</el-col>
|
|
|
</template>
|
|
|
<template v-slot:main>
|
|
@@ -24,7 +24,7 @@
|
|
|
<el-table-column align="center" prop="mobile" label="联系电话" width="200"> </el-table-column>
|
|
|
<el-table-column align="center" prop="operation" label="操作">
|
|
|
<template v-slot="scoped">
|
|
|
- <el-row :gutter="1" class="row-bg" type="flex" align="middle" justify="center">
|
|
|
+ <el-row :gutter="1" class="row-bg" type="flex" align="middle" justify="center" v-if="judUser(scoped.row)">
|
|
|
<el-col :span="8">
|
|
|
<el-button size="mini" type="text" @click="openAlert('update', scoped.row)">修改密码</el-button>
|
|
|
</el-col>
|
|
@@ -32,7 +32,7 @@
|
|
|
<el-button size="mini" type="text" @click="toBind(scoped.row)">更绑微信</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-button size="mini" type="text" @click="toDelete(scoped.row)">注销用户</el-button>
|
|
|
+ <el-button size="mini" type="text" @click="toDelete(scoped.row)" v-if="judDelete(scoped.row)">注销用户</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</template>
|
|
@@ -124,6 +124,7 @@ export default {
|
|
|
pwInput: '',
|
|
|
mobile: '',
|
|
|
bindDialog: false,
|
|
|
+ is_admin: false,
|
|
|
}),
|
|
|
created() {
|
|
|
this.search();
|
|
@@ -141,6 +142,10 @@ export default {
|
|
|
} else {
|
|
|
result = await this.hrOperation({ type: 'list', data: this.user.corpid });
|
|
|
this.$set(this, `dataList`, result.data);
|
|
|
+ let res = this.dataList.filter(fil => fil.role === '0');
|
|
|
+ for (const item of res) {
|
|
|
+ if (item.mobile === this.user.sub) this.$set(this, `is_admin`, true);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
@@ -186,7 +191,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async toDelete(item) {
|
|
|
- console.log(item);
|
|
|
this.$confirm('您确定注销此HR吗?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -194,7 +198,6 @@ export default {
|
|
|
})
|
|
|
.then(async () => {
|
|
|
let result = await this.hrOperation({ type: 'delete', data: { id: item._id } });
|
|
|
- console.log(result);
|
|
|
if (`${result.errcode}` === '0') {
|
|
|
this.$message.success('注销成功');
|
|
|
this.search();
|
|
@@ -206,6 +209,17 @@ export default {
|
|
|
this.mobile = JSON.parse(JSON.stringify(item.mobile));
|
|
|
this.bindDialog = true;
|
|
|
},
|
|
|
+ judDelete(item) {
|
|
|
+ //管理员,不能注销
|
|
|
+ if (item.role === '0') return false;
|
|
|
+ //此hr不是管理员,看当前用户是不是管理员,是管理员则允许
|
|
|
+ else if (this.is_admin) return true;
|
|
|
+ else return false;
|
|
|
+ },
|
|
|
+ judUser(item) {
|
|
|
+ if (this.is_admin) return true;
|
|
|
+ else return item.mobile === this.user.sub;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|