Commit bc203d29 authored by xinzhedeai's avatar xinzhedeai

add:员工接口对接 解绑、绑定 定位卡号列表

parent 716588d1
...@@ -11,6 +11,17 @@ export function listCard(query) { ...@@ -11,6 +11,17 @@ export function listCard(query) {
}) })
} }
export function listUnboundCard(query) {
return request({
url: '/person/card/getUnboundCardList',
method: 'GET',
// data: query
params: query
})
}
// 查询人员定位卡详细 // 查询人员定位卡详细
export function getCard(id) { export function getCard(id) {
return request({ return request({
......
...@@ -233,6 +233,8 @@ import { ...@@ -233,6 +233,8 @@ import {
getInfo, getInfo,
getCardList, // 引入获取定位卡号列表的接口 getCardList, // 引入获取定位卡号列表的接口
} from "@/api/jinrun/fangke"; } from "@/api/jinrun/fangke";
import { listUnboundCard } from "@/api/jinrun/card"; // 引入获取未绑定定位卡号列表的接口
import { getDict } from "@/api/jinrun/common"; import { getDict } from "@/api/jinrun/common";
export default { export default {
...@@ -312,7 +314,7 @@ export default { ...@@ -312,7 +314,7 @@ export default {
/** 获取定位卡号列表数据 */ /** 获取定位卡号列表数据 */
getCardIdList() { getCardIdList() {
getCardList() listUnboundCard()
.then((response) => { .then((response) => {
this.cardIdOptions = response.data || []; this.cardIdOptions = response.data || [];
}) })
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
size="small" size="small"
icon="el-icon-unlock" icon="el-icon-unlock"
v-if="scope.row.cardId" v-if="scope.row.cardId"
@click="handleUnbindCard(scope.row)" @click="handleUnbindCard1(scope.row)"
>定位卡解绑</el-button >定位卡解绑</el-button
> >
<el-button <el-button
...@@ -293,9 +293,8 @@ import { ...@@ -293,9 +293,8 @@ import {
addInfo, addInfo,
getInfo, // 引入获取人员信息的接口 getInfo, // 引入获取人员信息的接口
updateInfo, updateInfo,
unbindCard,
getCardList, // 引入获取定位卡号列表的接口
} from "@/api/jinrun/yuangong"; } from "@/api/jinrun/yuangong";
import { listUnboundCard } from "@/api/jinrun/card"; // 引入获取未绑定定位卡号列表的接口
import { getDict } from "@/api/jinrun/common"; import { getDict } from "@/api/jinrun/common";
import { getDept, getPosition } from "@/api/jinrun/zhongkong"; import { getDept, getPosition } from "@/api/jinrun/zhongkong";
...@@ -307,16 +306,7 @@ export default { ...@@ -307,16 +306,7 @@ export default {
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
deptOptions: [ deptOptions: [],
{
label: "部门1",
value: "1",
},
{
label: "部门2",
value: "2",
},
],
// 绑定卡对话框 // 绑定卡对话框
bindOpen: false, bindOpen: false,
// 绑定卡表单 // 绑定卡表单
...@@ -512,69 +502,42 @@ export default { ...@@ -512,69 +502,42 @@ export default {
})); }));
}); });
}, },
/** 获取部门列表 */
// getDeptList() {
// getDept({
// pageNum: 1,
// pageSize: 1000,
// }).then((response) => {
// console.log(response.data, "33333");
// this.deptOptions = response.data.data[0].children.map((item) => ({
// label: item.deptName,
// value: item.deptId,
// }));
// });
// },
/** 解绑卡按钮操作 */ /** 解绑卡按钮操作 */
handleUnbindCard(row) { handleUnbindCard1(row) {
const formData = { ...row };
formData.cardId = "";
this.$modal this.$modal
.confirm("是否确认解绑该人员的卡") .confirm("是否确认删除该数据项")
.then(function () { .then(function () {
return unbindCard({ return updateInfo(formData);
personId: row.personId,
personType: row.personType,
});
}) })
.then(() => { .then(() => {
this.$modal.msgSuccess("解绑成功");
this.bindOpen = false;
this.getList(); this.getList();
this.$modal.msgSuccess("解绑卡成功");
}) })
.catch(() => {}); .catch(() => {});
}, },
/** 绑定卡按钮操作 */ /** 绑定卡按钮操作 */
handleBindCard(row) { handleBindCard(row) {
this.bindForm = { this.bindForm = { ...row };
personId: row.personId,
realName: row.realName,
cardId: row.cardId || null,
personType: row.personType || "staff",
};
this.bindOpen = true; this.bindOpen = true;
}, },
/** 取消绑定卡对话框 */ /** 取消绑定卡对话框 */
cancelBind() { cancelBind() {
this.bindOpen = false; this.bindOpen = false;
this.bindForm = { this.bindForm = {};
personId: null,
realName: null,
cardId: null,
personType: "staff",
};
}, },
/** 提交绑定卡表单 */ /** 提交绑定卡表单 */
submitBindForm() { submitBindForm() {
this.$refs["bindForm"].validate((valid) => { this.$refs["bindForm"].validate((valid) => {
if (valid) { if (valid) {
bindCard(this.bindForm) updateInfo(this.bindForm).then((response) => {
.then((response) => {
this.$modal.msgSuccess("绑定成功"); this.$modal.msgSuccess("绑定成功");
this.bindOpen = false; this.bindOpen = false;
this.getList(); this.getList();
})
.catch((error) => {
this.$modal.msgError("绑定失败,请重试");
console.error("绑定卡失败:", error);
}); });
} }
}); });
...@@ -594,13 +557,8 @@ export default { ...@@ -594,13 +557,8 @@ export default {
}, },
/** 获取定位卡号列表数据 */ /** 获取定位卡号列表数据 */
getCardIdList() { getCardIdList() {
getCardList() listUnboundCard().then((response) => {
.then((response) => {
this.cardIdOptions = response.data || []; this.cardIdOptions = response.data || [];
})
.catch((error) => {
this.$modal.msgError("获取定位卡号列表失败");
console.error("获取定位卡号列表失败:", error);
}); });
}, },
...@@ -620,7 +578,9 @@ export default { ...@@ -620,7 +578,9 @@ export default {
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = {}; this.form = {
sex: "",
};
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
......
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