Commit ec13edd4 authored by xinzhedeai's avatar xinzhedeai

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

parent d9d7c7a4
......@@ -3,19 +3,11 @@ import request from '@/utils/request'
// 查询人员信息列表
export function listInfo(query) {
return request({
url: '/person/info/getRemotePersonInfoList',
url: '/person/info/getPersonList',
method: 'get',
params: query
})
}
// 解绑卡
export function unbindCard(data) {
return request({
url: '/person/info/unbindCard',
method: 'put',
data: data
})
}
// 新增人员信息
export function addInfo(data) {
......
......@@ -68,6 +68,8 @@
</el-tag>
</template>
</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="操作"
......@@ -75,6 +77,20 @@
class-name="small-padding fixed-width"
>
<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
size="small"
type="primary"
......
......@@ -90,13 +90,7 @@
</template>
<script>
import {
listInfo,
delInfo,
addInfo,
updateInfo,
unbindCard,
} from "@/api/jinrun/renyuan";
import { listInfo } from "@/api/jinrun/renyuan";
import { getDict } from "@/api/jinrun/common";
export default {
......@@ -234,7 +228,7 @@ export default {
getList() {
this.loading = true;
listInfo(this.queryParams).then((response) => {
this.infoList = response.data;
this.infoList = response.records;
this.total = response.total;
this.loading = false;
});
......@@ -415,16 +409,6 @@ export default {
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/info/export",
{
...this.queryParams,
},
`info_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
......
......@@ -63,7 +63,7 @@
<el-table-column label="联系方式" align="center" prop="phone" />
<el-table-column label="身份证号" align="center" prop="idCard" />
<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="操作"
......@@ -73,10 +73,19 @@
width="180"
>
<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
size="mini"
type="text"
icon="el-icon-unlock"
v-if="scope.row.cardId"
@click="handleUnbindCard(scope.row)"
>定位卡解绑</el-button
>
......@@ -106,8 +115,7 @@
@pagination="getList"
/>
<!-- 添加或修改人员信息对话框 -->
<!-- 添加或修改人员信息对话框 -->
<!-- 添加或修改员工信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- 使用el-row和el-col实现一行两列布局 -->
......@@ -210,7 +218,7 @@
</el-form-item>
</el-col>
<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-form-item>
</el-col>
......@@ -238,6 +246,47 @@
<el-button @click="cancel">关 闭</el-button>
</div>
</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>
</template>
......@@ -256,6 +305,21 @@ export default {
name: "Info",
data() {
return {
// 绑定卡对话框
bindOpen: false,
// 绑定卡表单
bindForm: {
personId: null,
realName: null,
cardId: null,
personType: "staff",
},
// 绑定卡表单校验
bindRules: {
cardId: [
{ required: true, message: "请选择定位卡号", trigger: "change" },
],
},
dialogType: "",
// 人员类型下拉列表数据
personTypeOptions: [],
......@@ -271,7 +335,7 @@ export default {
showSearch: true,
// 总条数
total: 0,
// 人员信息表格数据
// 员工信息表格数据
infoList: [],
// 弹出层标题
title: "",
......@@ -310,6 +374,61 @@ export default {
},
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) {
this.reset();
......@@ -320,7 +439,7 @@ export default {
}).then((response) => {
this.form = response.data[0];
this.open = true;
this.title = "查看人员信息";
this.title = "查看员工信息";
this.dialogType = "view";
});
},
......@@ -357,7 +476,7 @@ export default {
};
reader.readAsDataURL(file.raw);
},
/** 查询人员信息列表 */
/** 查询员工信息列表 */
getList() {
this.loading = true;
listInfo(this.queryParams).then((response) => {
......@@ -474,7 +593,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = "添加人员信息";
this.title = "添加员工信息";
this.dialogType = "add";
},
/** 修改按钮操作 */
......@@ -487,7 +606,7 @@ export default {
}).then((response) => {
this.form = response.data[0];
this.open = true;
this.title = "修改人员信息";
this.title = "修改员工信息";
this.dialogType = "update";
});
......@@ -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) {
this.$modal
......@@ -545,47 +649,8 @@ export default {
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/info/export",
{
...this.queryParams,
},
`info_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<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>
\ 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