123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <!--
- * @Author: your name
- * @Date: 2021-09-16 11:27:35
- * @LastEditTime: 2021-12-09 13:56:51
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: \hyyfClient\src\views\BioSafety\PersonAdmin.vue
- -->
- <template>
- <div class="person-admin">
- <!-- 顶部的按钮选择 -->
- <head-btns
- :btnNames="btnNames"
- :btnSelected="btnSelected"
- @btnSelected="getBtnSelected"
- >
- </head-btns>
- <!-- 筛选条件 -->
- <query-conditions
- :formItems="formItems"
- :propFormData="propFormData"
- :defaultEmit="true"
- @getQueryParams="handleQuery"
- >
- </query-conditions>
- <!-- 表格 -->
- <new-table
- :title="title"
- :listData="listData"
- :tableItems="tableItems"
- :shows="tableShows"
- :height="475"
- >
- <template v-slot:right>
- <!-- <template v-if="btnSelected === 1">
- <div>
- <el-button size="mini">添加人员</el-button>
- <el-button size="mini">添加区域</el-button>
- </div>
- </template>
- <template v-else-if="btnSelected === 2">
- <div>
- <el-button size="mini">黑名单</el-button>
- </div>
- </template>
- <template v-else>
- <div>
- <el-button size="mini">添加赶猪人员</el-button>
- </div>
- </template> -->
- </template>
- <!-- 人员门禁 -->
- <template v-slot:recordImage="slotProps">
- <img
- :src="slotProps.row.recordImage"
- alt="人员门禁"
- width="100"
- @click="clickImg(slotProps.row.recordImage)"
- />
- </template>
- <template v-slot:personName="slotProps">
- {{ slotProps.row.personName ? slotProps.row.personName : "未知 " }}
- </template>
- <!-- 档案管理 -->
- <template v-slot:personBiosignatures="slotProps">
- <img
- :src="slotProps.row.personBiosignatures[0].path"
- alt="人员门禁"
- width="100"
- @click="clickImg(slotProps.row.personBiosignatures[0].path)"
- />
- </template>
- <template #sex="slotProps">
- <span>{{ personSex[slotProps.row.sex] }}</span>
- </template>
- <template #status="slotProps">
- <span>{{ personStatus[slotProps.row.status] }}</span>
- </template>
- </new-table>
- <table-footer
- :totals="total"
- :size="size"
- @sizeChange="sizeChange"
- @pageChange="pageChange"
- >
- </table-footer>
- <el-dialog title="人脸图片" :visible.sync="dialogVisible" width="40%">
- <img :src="imgUrl" alt="人脸图片" width="100%" />
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">
- 确 定
- </el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import HeadBtns from "components/bioSafety/Btns";
- import QueryConditions from "components/bioSafety/QueryConditions";
- import NewTable from "components/newTable/NewTable";
- import TableFooter from "../../components/TableFooter";
- import { timeDate } from "../../utils/index";
- import { formItems, propFormData } from "./personAdmin/queryCondition.config";
- import { titles, tableItems, tableShows } from "./personAdmin/table.config";
- import { getFaceToken, getFaceGuard } from "../../utils/api";
- import { getFaceGuardTotal, getPersonFiles } from "../../utils/chenApi";
- export default {
- name: "PersonAdmin",
- components: {
- HeadBtns,
- QueryConditions,
- NewTable,
- TableFooter,
- },
- data() {
- return {
- btnNames: [
- // 按钮情况
- { id: 1, name: "档案管理" },
- { id: 2, name: "人脸门禁" },
- // { id: 3, name: '赶猪监管' }
- ],
- btnSelected: 1, // 选中的按钮
- formItems: [], // 传给 QueryCondition 组件的 formItems
- propFormData: {}, // 传给 QueryCondition 组件的 propFormData
- title: "", // 传给 BioTable 组件的 title
- listData: [], // 传给 BioTable 组件的表格展示的值 listData
- tableItems: [], // 传给 BioTable 组件的表格的列表 tableItems
- tableShows: {},
- // table的翻页
- total: 0,
- size: 20,
- pageNum: 1,
- selectId: "",
- params: {},
- personStatus: ["已删除", "正常", "冻结"], // 档案管理 - 人员状态
- personSex: ["未知", "男", "女"], // 档案管理 - 性别
- dialogVisible: false, // 图片放大,也不知道得多老眼昏花,这么大的图片还要再大
- imgUrl: "", // 点击图片后放大的图片路径
- };
- },
- mounted() {
- this.formItems = formItems[this.btnSelected - 1];
- this.propFormData = propFormData[this.btnSelected - 1];
- this.title = titles[this.btnSelected - 1];
- this.tableItems = tableItems[this.btnSelected - 1];
- this.tableShows = tableShows;
- this.initPersonFiles();
- },
- methods: {
- // 获取选中的按钮情况
- getBtnSelected(id) {
- this.btnSelected = id;
- this.formItems = formItems[id - 1];
- this.propFormData = propFormData[id - 1];
- this.title = titles[id - 1];
- this.tableItems = tableItems[id - 1];
- this.chooseApi();
- },
- // 按钮选中情况 --> 对应的 api
- chooseApi(flag = true) {
- if (this.btnSelected === 1) {
- if (flag) {
- this.pageNum = 1;
- }
- this.initPersonFiles();
- } else {
- if (flag) {
- this.pageNum = 1;
- this.faceGuardTotal();
- }
- this.faceGuard();
- }
- },
- // 获取查询条件
- handleQuery(params) {
- this.params = params;
- this.chooseApi();
- },
- // 修改size
- sizeChange(val) {
- this.size = val;
- this.chooseApi(false);
- },
- // 修改页数
- pageChange(val) {
- this.pageNum = val;
- this.chooseApi(false);
- },
- init() {
- let params = {
- pageNum: this.pageNum,
- pageSize: this.size,
- searchStr: this.keyword,
- };
- console.log(params);
- // 获取后端数据
- },
- // 人脸门禁的查询
- faceGuard() {
- if (!this.params.time) {
- this.params.time = [
- timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
- timeDate(new Date().getTime()),
- ];
- }
- let queryParams = {
- pageNum: this.pageNum,
- pageSize: this.size,
- personName: this.params.name || undefined,
- startSwingTime: this.params.time[0] + " 00:00:00",
- endSwingTime: this.params.time[1] + " 23:59:59",
- openType: 61, // 进门,刷脸
- };
- getFaceGuard(queryParams).then(async (res) => {
- console.log("res:", res);
- console.log(JSON.parse(res.result));
- // 结果是 JSON 格式
- this.listData = JSON.parse(res.result).data.pageData;
- const { token } = await getFaceToken();
- this.listData.forEach((item) => {
- item.channelName = item.channelName.split("人脸门禁")[0];
- // item.recordImage = `https://36.26.62.70:447/evo-pic/${item.recordImage}?token=${token}&oss_addr=172.16.3.223:8925`;
- item.recordImage = `http://192.168.1.171:8089/picture/get?alarmPicture=${item.recordImage}`
- });
- console.log(this.listData)
- console.log("token:", token);
- });
- },
- // 人脸门禁总条数
- faceGuardTotal() {
- if (!this.params.time) {
- this.params.time = [
- timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
- timeDate(new Date().getTime()),
- ];
- }
- let queryParams = {
- personName: this.params.name || undefined,
- startSwingTime: this.params.time[0] + " 00:00:00",
- endSwingTime: this.params.time[1] + " 23:59:59",
- openType: 61, // 进门,刷脸
- };
- getFaceGuardTotal(queryParams).then((res) => {
- console.log("total:", JSON.parse(res.result));
- this.total = JSON.parse(res.result).data;
- });
- },
- // 档案管理
- initPersonFiles() {
- getPersonFiles({
- searchKey: "",
- pageNum: this.pageNum,
- pageSize: this.size,
- departmentId: this.params.departmentId || 5,
- isContain: true,
- statusList: [1, 2],
- }).then(async ({ success, result }) => {
- if (success) {
- const listData = JSON.parse(result);
- this.listData = listData.data.pageData;
- this.total = listData.data.totalRows;
- const { token } = await getFaceToken();
- this.listData.forEach((item) => {
- item.personBiosignatures[0].path = `https://36.26.62.70:447/evo-pic/${item.personBiosignatures[0].path}?token=${token}&oss_addr=172.16.3.223:9876`;
- });
- }
- });
- },
- // 点击图片放大
- clickImg(url) {
- this.dialogVisible = true;
- this.imgUrl = url;
- },
- },
- };
- </script>
- <style scoped>
- .person-admin {
- width: 100%;
- height: 100%;
- box-sizing: border-box;
- padding: 20px;
- }
- </style>
|