<template>
|
<basic-container class="tablesss">
|
<avue-crud
|
v-if="visible"
|
:option="option"
|
:table-loading="loading"
|
:data="data"
|
:page.sync="page"
|
:search.sync="search"
|
ref="crud"
|
@row-del="rowDel"
|
v-model="form"
|
:permission="permissionList"
|
@row-update="rowUpdate"
|
@row-save="rowSave"
|
:before-open="beforeOpen"
|
@filter="filterChange"
|
@search-change="searchChange"
|
@search-reset="searchReset"
|
@selection-change="selectionChange"
|
@current-change="currentChange"
|
@size-change="sizeChange"
|
@refresh-change="refreshChange"
|
@on-load="onLoad"
|
>
|
<template slot-scope="{ type, size, row }" slot="menu">
|
<el-button
|
icon="icon-zhengjian"
|
:size="size"
|
:type="type"
|
class="zhengJian-icon"
|
@click.stop="rowUps(row)"
|
>更新</el-button
|
>
|
<el-button
|
icon="icon-zhengjian"
|
:size="size"
|
:type="type"
|
class="zhengJian-icon"
|
@click.stop="heardrowUps(row)"
|
>手动签到</el-button
|
>
|
</template>
|
</avue-crud>
|
</basic-container>
|
</template>
|
|
<script>
|
import { mapGetters } from "vuex";
|
import { getList, upData, getZhiwen } from "@/api/qiandao/qiandao";
|
export default {
|
data() {
|
return {
|
visible: true,
|
page: {
|
pageSize: 10,
|
currentPage: 1,
|
total: 0
|
},
|
query: {},
|
data: [],
|
form: {},
|
search: {},
|
option: {
|
// card: true,
|
// tip: false,
|
// searchSize: "mini",
|
searchMenuSpan: 6,
|
height: "auto",
|
index: true,
|
// selectable: (row, index) => {
|
// console.log(row, index);
|
// if (row.auditStatus == 4 && row.cancel == 1) {
|
// return true;
|
// } else {
|
// return false;
|
// }
|
// },
|
labelWidth: "120",
|
menuWidth: 115,
|
align: "center",
|
refreshBtn: false,
|
columnBtn: false,
|
emptyBtnText: " ",
|
searchBtnText: " ",
|
searchShowBtn: false,
|
// reserveSelection: true,
|
// selection: true,
|
column: [
|
{
|
label: "姓名",
|
prop: "realName",
|
search: true,
|
searchSpan: 5,
|
searchLabelWidth: 45,
|
width: 70
|
},
|
{
|
label: "公司",
|
prop: "deptName",
|
search: true,
|
searchSpan: 6,
|
searchLabelWidth: 45
|
},
|
{
|
label: "身份证号码",
|
prop: "idCardNo",
|
search: true,
|
searchSpan: 8,
|
searchLabelWidth: 90,
|
// searchRange: true,
|
// searchValue: this.getuserid(),
|
width: 180
|
}
|
],
|
delBtn: false,
|
editBtn: false,
|
addBtn: false
|
}
|
};
|
},
|
computed: {
|
...mapGetters([
|
"userInfo",
|
"cardInfor",
|
"permission",
|
"haveCardid",
|
"useZhiWen"
|
])
|
// permissionList() {
|
// return {
|
// addBtn: this.vaildData(this.permission.notice_add, false),
|
// viewBtn: this.vaildData(this.permission.notice_view, false),
|
// delBtn: this.vaildData(this.permission.notice_delete, false),
|
// editBtn: this.vaildData(this.permission.notice_edit, false),
|
// };
|
// },
|
},
|
watch: {
|
haveCardid() {
|
if (this.haveCardid) {
|
this.query = {};
|
this.search["realName"] = "";
|
this.search["deptName"] = "";
|
this.search["idCardNo"] = this.cardInfor.id;
|
this.onLoad(
|
this.page,
|
{
|
idCardNo: this.cardInfor.id
|
},
|
"shibie"
|
);
|
}
|
}
|
},
|
mounted() {
|
// let dom = document.getElementsByClassName("el-table--small");
|
// console.log((dom[0].clientHeight = 100), 9);
|
// console.log(1545);
|
// if (window.name == "baoming") {
|
// let old = JSON.parse(window.localStorage.getItem("baoming"));
|
// this.choiceName = old;
|
// console.log(old);
|
// console.log("刷新");
|
// } else {
|
// window.name = "baoming";
|
// console.log("不刷新");
|
// }
|
let t = this;
|
window.addEventListener("resize", function() {
|
t.resetHeight();
|
});
|
t.resetHeight();
|
},
|
methods: {
|
heardrowUps(row) {
|
//手动签到
|
this.upDataMain(row);
|
},
|
// getuserid() {
|
// console.log(12345);
|
// console.log(this.haveCardid);
|
// if (this.haveCardid) {
|
// return this.cardInfor.id;
|
// } else {
|
// return;
|
// }
|
// },
|
resetHeight() {
|
//表格自适应高度
|
let windowHeight = document.body.clientHeight;
|
let table = document.getElementsByClassName("tablesss");
|
let heard = table[0].getElementsByClassName("avue-crud__search");
|
this.option.height = windowHeight - (heard[0].clientHeight + 220);
|
this.visible = false;
|
this.$nextTick(() => {
|
this.visible = true;
|
this.onLoad(this.page, this.search);
|
});
|
},
|
rowUps(row, msg) {
|
row["cell"] = "2";
|
let zhiwenData = this.useZhiWen("outZhiwenData");
|
let card = this.cardInfor;
|
// console.log(card);
|
// console.log(row);
|
// console.log(zhiwenData);
|
if (this.haveCardid) {
|
if (msg == "once") {
|
this.getZhiwen(row);
|
return;
|
}
|
// console.log(zhiwenData, 456);
|
// if (
|
// zhiwenData.imgSRC != "" &&
|
// zhiwenData.imgSRC != undefined &&
|
// zhiwenData.imgBMP != "" &&
|
// zhiwenData.imgBMP != undefined &&
|
// zhiwenData.featuredata != "" &&
|
// zhiwenData.featuredata != undefined &&
|
// zhiwenData.isoks
|
// ) {
|
// console.log("存在指纹");
|
row.realName = card.name;
|
row.cardid = card.id;
|
row.sex = card.sex == "男" ? "1" : card.sex == "女" ? "2" : "3";
|
row.nation = card.national;
|
row.registered = card.certAddress;
|
row.fingerprint = zhiwenData.imgBMP;
|
row.myPicture = zhiwenData.featuredata;
|
this.upDataMain(row);
|
// } else {
|
// // this.msg("warning", "无指纹信息,请添加指纹信息后重试!");
|
// this.$confirm("检测到无指纹信息,是否确定修改?", "确认信息", {
|
// distinguishCancelAndClose: true,
|
// confirmButtonText: "保存",
|
// cancelButtonText: "放弃修改",
|
// })
|
// .then(() => {
|
// row.realName = card.name;
|
// row.cardid = card.id;
|
// row.sex = card.sex == "男" ? "1" : card.sex == "女" ? "2" : "3";
|
// row.nation = card.national;
|
// row.registered = card.certAddress;
|
// row.fingerprint = zhiwenData.imgBMP;
|
// row.myPicture = zhiwenData.featuredata;
|
// this.upDataMain(row);
|
// // this.$message({
|
// // type: "info",
|
// // message: "保存修改",
|
// // });
|
// })
|
// .catch((action) => {
|
// // this.$message({
|
// // type: "info",
|
// // message:
|
// // action === "cancel" ? "放弃保存并离开页面" : "停留在当前页面",
|
// // });
|
// });
|
// }
|
} else {
|
this.msg("warning", "请读取身份证后重试!");
|
}
|
},
|
getZhiwen(row) {
|
let that = this;
|
getZhiwen(row.userId).then(res => {
|
// console.log(res);
|
let zhiwen = {
|
featuredatas: res.data.data.myPicture,
|
imgBMP: res.data.data.fingerprint,
|
// url: row.fingerprint,
|
isoks: false
|
};
|
if (
|
zhiwen.featuredatas != "" &&
|
zhiwen.featuredatas != undefined &&
|
zhiwen.imgBMP != "" &&
|
zhiwen.imgBMP != undefined
|
) {
|
zhiwen.isoks = true;
|
that.useZhiWen("setZhiwenData", zhiwen);
|
that.rowUps(row);
|
} else {
|
// useZhiwen();
|
zhiwen.isoks = false;
|
that.useZhiWen("setZhiwenData", zhiwen);
|
// that.msg("warning", "无指纹信息,请添加指纹信息后更新!");
|
// 若无指纹,提醒要录入指纹,再手动点击更新;
|
}
|
});
|
},
|
upDataMain(row) {
|
let b = {
|
id: row.userId,
|
realName: row.realName,
|
cardid: row.cardid,
|
sex: row.sex,
|
nation: row.nation,
|
registered: row.registered,
|
fingerprint: row.fingerprint,
|
myPicture: row.myPicture,
|
candidateNo: row.candidateNo
|
};
|
upData(b).then(res => {
|
const data = res.data;
|
// console.log(data);
|
if (data.code == 200) {
|
// this.msg("success", data.msg);
|
this.$confirm("签到成功!", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "指纹采集",
|
type: "success"
|
})
|
.then(() => {
|
this.$message({
|
type: "success",
|
message: "请继续放入身份证进行识别!"
|
});
|
this.$store.commit("setIsClears", true);
|
// this.$store.commit("setCardidState", false);
|
// let zhiwen = {
|
// featuredatas: "",
|
// imgBMP: "",
|
// url: "",
|
// isoks: false,
|
// clear: true,
|
// };
|
// this.useZhiWen("setZhiwenData", zhiwen);
|
})
|
.catch(() => {
|
// this.$message({
|
// type: "info",
|
// message: "已取消删除",
|
// });
|
this.$message({
|
type: "success",
|
message: "请采集指纹并点击更新进行签到!"
|
});
|
});
|
} else {
|
this.msg("warning", data.msg);
|
}
|
});
|
},
|
sizeChange(val) {
|
this.page.pageSize = val;
|
},
|
currentChange(val) {
|
this.page.currentPage = val;
|
},
|
rowSave(form, done, loading) {
|
// var that = this;
|
// adddata(form).then(
|
// (res) => {
|
// this.onLoad(this.page);
|
// if (res.data.data == 201) {
|
// this.$message({
|
// type: "warning",
|
// message: "已报名,不能重复报名",
|
// });
|
// } else if (res.data.data == 201) {
|
// this.$message({
|
// type: "warning",
|
// message: "报名失败",
|
// });
|
// } else {
|
// this.$message({
|
// type: "success",
|
// message: "报名成功",
|
// });
|
// }
|
// done();
|
// },
|
// (error) => {
|
// window.console.log(error);
|
// loading();
|
// }
|
// );
|
},
|
searchChange(params, done) {
|
this.query = params;
|
this.page.currentPage = 1;
|
this.onLoad(this.page, params);
|
done();
|
},
|
searchReset() {
|
// console.log(5454);
|
this.query = {};
|
this.onLoad(this.page);
|
this.search["cardid"] = "";
|
},
|
rowUpdate(row, index, done, loading) {
|
// update(row).then(
|
// () => {
|
// this.onLoad(this.page);
|
// this.$message({
|
// type: "success",
|
// message: "操作成功!",
|
// });
|
// done();
|
// },
|
// (error) => {
|
// window.console.log(error);
|
// loading();
|
// }
|
// );
|
},
|
rowDel(row) {
|
// this.$confirm("确定将选择数据删除?", {
|
// confirmButtonText: "确定",
|
// cancelButtonText: "取消",
|
// type: "warning",
|
// })
|
// .then(() => {
|
// return remove(row.id);
|
// })
|
// .then(() => {
|
// this.onLoad(this.page);
|
// this.$message({
|
// type: "success",
|
// message: "操作成功!",
|
// });
|
// });
|
},
|
selectionChange(list) {
|
// this.selectionList = list;
|
// this.choiceName = [];
|
// // console.log(window.name);
|
// for (let k in list) {
|
// this.choiceName.push({
|
// label: list[k].realName,
|
// value: list[k].id,
|
// });
|
// }
|
// window.localStorage.setItem("baoming", JSON.stringify(this.choiceName));
|
// console.log(this.choiceName);
|
},
|
refreshChange() {
|
this.onLoad(this.page, this.query);
|
},
|
msg: function(type, msg) {
|
this.$message({
|
message: msg,
|
type: type
|
});
|
},
|
onLoad(page, params = {}, shibie) {
|
params["auditStatus"] = "1";
|
params["cancel"] = "1";
|
params["isExam"] = "1";
|
params["trainingUnitId"] = this.userInfo.dept_id;
|
let values = Object.assign(params, this.query);
|
// console.log(values);
|
if (values.realName || values.deptName || values.idCardNo) {
|
// // console.log(values, 1);
|
} else {
|
// // console.log(values, 2);
|
this.data = [];
|
this.page.total = 0;
|
return;
|
}
|
getList(page.currentPage, page.pageSize, values).then(res => {
|
// console.log(res);
|
const data = res.data.data;
|
this.page.total = data.total;
|
this.data = data.records;
|
// // console.log(this.data);
|
if (shibie == "shibie") {
|
if (data.total == 0) {
|
this.msg("warning", "查无此人");
|
let zhiwen = {
|
featuredatas: "",
|
imgBMP: "",
|
url: "",
|
isoks: false
|
};
|
this.useZhiWen("setZhiwenData", zhiwen);
|
} else if (data.total == 1) {
|
//查询出一个人 将数据覆盖
|
// console.log(value[0])
|
this.rowUps(data.records[0]);
|
} else {
|
this.msg("warning", "查无此人");
|
let zhiwen = {
|
featuredatas: "",
|
imgBMP: "",
|
url: "",
|
isoks: false
|
};
|
this.useZhiWen("setZhiwenData", zhiwen);
|
this.msg("warning", "查询出多人,请选择对应人员更新!");
|
}
|
}
|
this.loading = false;
|
});
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.tablesss {
|
height: 100% !important;
|
}
|
</style>
|