Commit ec13edd4 authored by xinzhedeai's avatar xinzhedeai

add:人员接口对接,员工页面开发

parent d9d7c7a4
...@@ -3,19 +3,11 @@ import request from '@/utils/request' ...@@ -3,19 +3,11 @@ import request from '@/utils/request'
// 查询人员信息列表 // 查询人员信息列表
export function listInfo(query) { export function listInfo(query) {
return request({ return request({
url: '/person/info/getRemotePersonInfoList', url: '/person/info/getPersonList',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 解绑卡
export function unbindCard(data) {
return request({
url: '/person/info/unbindCard',
method: 'put',
data: data
})
}
// 新增人员信息 // 新增人员信息
export function addInfo(data) { export function addInfo(data) {
......
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="身份证号" align="center" prop="idNumber" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column <el-table-column
label="操作" label="操作"
...@@ -75,6 +77,20 @@ ...@@ -75,6 +77,20 @@
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-link"
@click="handleBindCard(scope.row)"
>定位卡绑定</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-unlock"
@click="handleUnbindCard(scope.row)"
>定位卡解绑</el-button
>
<el-button <el-button
size="small" size="small"
type="primary" type="primary"
......
...@@ -90,13 +90,7 @@ ...@@ -90,13 +90,7 @@
</template> </template>
<script> <script>
import { import { listInfo } from "@/api/jinrun/renyuan";
listInfo,
delInfo,
addInfo,
updateInfo,
unbindCard,
} from "@/api/jinrun/renyuan";
import { getDict } from "@/api/jinrun/common"; import { getDict } from "@/api/jinrun/common";
export default { export default {
...@@ -234,7 +228,7 @@ export default { ...@@ -234,7 +228,7 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listInfo(this.queryParams).then((response) => { listInfo(this.queryParams).then((response) => {
this.infoList = response.data; this.infoList = response.records;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
...@@ -415,16 +409,6 @@ export default { ...@@ -415,16 +409,6 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
this.download(
"system/info/export",
{
...this.queryParams,
},
`info_${new Date().getTime()}.xlsx`
);
},
}, },
}; };
</script> </script>
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<el-table-column label="联系方式" align="center" prop="phone" /> <el-table-column label="联系方式" align="center" prop="phone" />
<el-table-column label="身份证号" align="center" prop="idCard" /> <el-table-column label="身份证号" align="center" prop="idCard" />
<el-table-column label="所在部门1" align="center" prop="dept" /> <el-table-column label="所在部门1" align="center" prop="dept" />
<el-table-column label="岗位名称" align="center" prop="idCard" /> <el-table-column label="岗位名称1" align="center" prop="idCard" />
<el-table-column label="定位卡号" align="center" prop="cardId" /> <el-table-column label="定位卡号" align="center" prop="cardId" />
<el-table-column <el-table-column
label="操作" label="操作"
...@@ -73,10 +73,19 @@ ...@@ -73,10 +73,19 @@
width="180" width="180"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-link"
v-if="!scope.row.cardId"
@click="handleBindCard(scope.row)"
>定位卡绑定</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-unlock" icon="el-icon-unlock"
v-if="scope.row.cardId"
@click="handleUnbindCard(scope.row)" @click="handleUnbindCard(scope.row)"
>定位卡解绑</el-button >定位卡解绑</el-button
> >
...@@ -106,8 +115,7 @@ ...@@ -106,8 +115,7 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改人员信息对话框 --> <!-- 添加或修改员工信息对话框 -->
<!-- 添加或修改人员信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- 使用el-row和el-col实现一行两列布局 --> <!-- 使用el-row和el-col实现一行两列布局 -->
...@@ -210,7 +218,7 @@ ...@@ -210,7 +218,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工龄" prop="seniority"> <el-form-item label="家庭住址11" prop="seniority">
<el-input v-model="form.seniority" placeholder="" /> <el-input v-model="form.seniority" placeholder="" />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -238,6 +246,47 @@ ...@@ -238,6 +246,47 @@
<el-button @click="cancel">关 闭</el-button> <el-button @click="cancel">关 闭</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 定位卡绑定对话框 -->
<el-dialog
:title="'定位卡绑定 - ' + bindForm.realName"
:visible.sync="bindOpen"
width="500px"
append-to-body
>
<el-form
ref="bindForm"
:model="bindForm"
:rules="bindRules"
label-width="80px"
>
<el-form-item label="姓名" prop="realName">
<el-input
v-model="bindForm.realName"
disabled
placeholder="人员姓名"
/>
</el-form-item>
<el-form-item label="定位卡号" prop="cardId">
<el-select
v-model="bindForm.cardId"
placeholder="请选择定位卡号"
clearable
>
<el-option
v-for="item in cardIdOptions"
:key="item.cardId"
:label="item.cardId"
:value="item.cardId"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBindForm">确 定</el-button>
<el-button @click="cancelBind">关 闭</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
...@@ -256,6 +305,21 @@ export default { ...@@ -256,6 +305,21 @@ export default {
name: "Info", name: "Info",
data() { data() {
return { return {
// 绑定卡对话框
bindOpen: false,
// 绑定卡表单
bindForm: {
personId: null,
realName: null,
cardId: null,
personType: "staff",
},
// 绑定卡表单校验
bindRules: {
cardId: [
{ required: true, message: "请选择定位卡号", trigger: "change" },
],
},
dialogType: "", dialogType: "",
// 人员类型下拉列表数据 // 人员类型下拉列表数据
personTypeOptions: [], personTypeOptions: [],
...@@ -271,7 +335,7 @@ export default { ...@@ -271,7 +335,7 @@ export default {
showSearch: true, showSearch: true,
// 总条数 // 总条数
total: 0, total: 0,
// 人员信息表格数据 // 员工信息表格数据
infoList: [], infoList: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
...@@ -310,6 +374,61 @@ export default { ...@@ -310,6 +374,61 @@ export default {
}, },
methods: { methods: {
/** 解绑卡按钮操作 */
handleUnbindCard(row) {
this.$modal
.confirm("是否确认解绑该人员的卡?")
.then(function () {
return unbindCard({
personId: row.personId,
personType: row.personType,
});
})
.then(() => {
this.getList();
this.$modal.msgSuccess("解绑卡成功");
})
.catch(() => {});
},
/** 绑定卡按钮操作 */
handleBindCard(row) {
this.bindForm = {
personId: row.personId,
realName: row.realName,
cardId: row.cardId || null,
personType: row.personType || "staff",
};
this.bindOpen = true;
},
/** 提交绑定卡表单 */
submitBindForm() {
this.$refs["bindForm"].validate((valid) => {
if (valid) {
bindCard(this.bindForm)
.then((response) => {
this.$modal.msgSuccess("绑定成功");
this.bindOpen = false;
this.getList();
})
.catch((error) => {
this.$modal.msgError("绑定失败,请重试");
console.error("绑定卡失败:", error);
});
}
});
},
/** 取消绑定卡对话框 */
cancelBind() {
this.bindOpen = false;
this.bindForm = {
personId: null,
realName: null,
cardId: null,
personType: "staff",
};
},
/** 查看按钮操作 */ /** 查看按钮操作 */
handleView(row) { handleView(row) {
this.reset(); this.reset();
...@@ -320,7 +439,7 @@ export default { ...@@ -320,7 +439,7 @@ export default {
}).then((response) => { }).then((response) => {
this.form = response.data[0]; this.form = response.data[0];
this.open = true; this.open = true;
this.title = "查看人员信息"; this.title = "查看员工信息";
this.dialogType = "view"; this.dialogType = "view";
}); });
}, },
...@@ -357,7 +476,7 @@ export default { ...@@ -357,7 +476,7 @@ export default {
}; };
reader.readAsDataURL(file.raw); reader.readAsDataURL(file.raw);
}, },
/** 查询人员信息列表 */ /** 查询员工信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listInfo(this.queryParams).then((response) => { listInfo(this.queryParams).then((response) => {
...@@ -474,7 +593,7 @@ export default { ...@@ -474,7 +593,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加人员信息"; this.title = "添加员工信息";
this.dialogType = "add"; this.dialogType = "add";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
...@@ -487,7 +606,7 @@ export default { ...@@ -487,7 +606,7 @@ export default {
}).then((response) => { }).then((response) => {
this.form = response.data[0]; this.form = response.data[0];
this.open = true; this.open = true;
this.title = "修改人员信息"; this.title = "修改员工信息";
this.dialogType = "update"; this.dialogType = "update";
}); });
...@@ -513,22 +632,7 @@ export default { ...@@ -513,22 +632,7 @@ export default {
} }
}); });
}, },
/** 解绑卡按钮操作 */
handleUnbindCard(row) {
this.$modal
.confirm("是否确认解绑该人员的卡?")
.then(function () {
return unbindCard({
personId: row.personId,
personType: row.personType,
});
})
.then(() => {
this.getList();
this.$modal.msgSuccess("解绑卡成功");
})
.catch(() => {});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal this.$modal
...@@ -545,47 +649,8 @@ export default { ...@@ -545,47 +649,8 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
this.download(
"system/info/export",
{
...this.queryParams,
},
`info_${new Date().getTime()}.xlsx`
);
},
}, },
}; };
</script> </script>
<style scoped> <style scoped>
/* 照片上传样式 */
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 150px;
height: 150px;
line-height: 150px;
text-align: center;
}
.avatar {
width: 150px;
height: 150px;
display: block;
}
.upload-tip {
margin-top: 10px;
color: #909399;
font-size: 12px;
}
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment