From 345d8cb53dbc07b83d237d3d3afd675ca75ab0d3 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 24 Aug 2021 11:01:59 +0800
Subject: [PATCH] 保安员证,社保记录

---
 src/views/securityGuard/securityGuardDetail.vue |  166 +++++++++++++
 src/api/social/social.js                        |   10 
 src/views/securityUnitChild/social.vue          |  497 +++++++++++++++++++++++++++++++++++++++++
 public/img/register/bazbj.png                   |    0 
 src/views/securityUnitChild/index.vue           |    7 
 public/img/register/ewm.png                     |    0 
 6 files changed, 674 insertions(+), 6 deletions(-)

diff --git a/public/img/register/bazbj.png b/public/img/register/bazbj.png
new file mode 100644
index 0000000..7ffef78
--- /dev/null
+++ b/public/img/register/bazbj.png
Binary files differ
diff --git a/public/img/register/ewm.png b/public/img/register/ewm.png
new file mode 100644
index 0000000..f99e4a4
--- /dev/null
+++ b/public/img/register/ewm.png
Binary files differ
diff --git a/src/api/social/social.js b/src/api/social/social.js
index 010e873..e00a1a9 100644
--- a/src/api/social/social.js
+++ b/src/api/social/social.js
@@ -2,7 +2,7 @@
 
 export const getList = (current, size, params) => {
   return request({
-    url: '/api1/social/list',
+    url: '/api/social/list',
     method: 'get',
     params: {
       ...params,
@@ -14,7 +14,7 @@
 
 export const getDetail = (id) => {
   return request({
-    url: '/api1/social/detail',
+    url: '/api/social/detail',
     method: 'get',
     params: {
       id
@@ -24,7 +24,7 @@
 
 export const remove = (ids) => {
   return request({
-    url: '/api1/social/remove',
+    url: '/api/social/remove',
     method: 'post',
     params: {
       ids,
@@ -34,7 +34,7 @@
 
 export const add = (row) => {
   return request({
-    url: '/api1/blade-social/social/submit',
+    url: '/api/social/submit',
     method: 'post',
     data: row
   })
@@ -42,7 +42,7 @@
 
 export const update = (row) => {
   return request({
-    url: '/api1/social/submit',
+    url: '/api/social/submit',
     method: 'post',
     data: row
   })
diff --git a/src/views/securityGuard/securityGuardDetail.vue b/src/views/securityGuard/securityGuardDetail.vue
index a606a3e..d9e4c90 100644
--- a/src/views/securityGuard/securityGuardDetail.vue
+++ b/src/views/securityGuard/securityGuardDetail.vue
@@ -27,6 +27,55 @@
       >
       </avue-crud>
     </span>
+    <span v-else-if="typeTABS.prop === 'tab4'">
+      <!-- 保安员证 -->
+      <div class="baoanzheng" id="baoanzheng">
+        <div class="baz-main">
+          <div class="baz-m-body" ref="baoanzheng">
+            <div class="bmb-heard">保安员证</div>
+            <div class="img">
+              <div v-if="!obj0.myPicture">暂无照片</div>
+              <img :src="obj0.myPicture" alt="" v-else />
+            </div>
+            <div class="imgs">
+              <!-- <div v-if="obj0.myPicture">暂无二维码</div> -->
+              <!-- <img :src="obj0.myPicture" alt="" v-else/> -->
+              <img src="/img/register/ewm.png" alt="" />
+            </div>
+
+            <!-- <img src="/img/mock/card/card-1.jpg" alt="" /> -->
+            <div class="bmb-b">
+              姓名:<span class="bmb-b-s">{{ obj0.realName }}</span>
+            </div>
+            <div class="bmb-b">
+              性别:<span class="bmb-b-s">{{ obj0.$sex }}</span>
+            </div>
+            <div class="bmb-b">
+              编号:<span class="bmb-b-s">{{ obj0.securitynumber }}</span>
+            </div>
+            <div class="bmb-b">
+              发证机关:<span class="bmb-b-s">南昌市公安局</span>
+            </div>
+            <div class="bmb-b">
+              发证日期:<span class="bmb-b-s">{{
+                obj0.paperTime.slice(0, 10)
+              }}</span>
+            </div>
+            <!-- <div class="bmb-b">
+              发证机关:<span class="bmb-b-s" style="margin-right: 15px"
+                >南昌市公安局</span
+              >发证日期:<span class="bmb-b-s">{{
+                obj0.createTime.slice(0, 10)
+              }}</span>
+            </div> -->
+          </div>
+          <span slot="footer" class="dialog-footer no-print PrintBut">
+            <el-button type="primary" @click="Print">打 印</el-button>
+            <!-- <el-button type="primary" @click="closePrint"> 取 消 </el-button> -->
+          </span>
+        </div>
+      </div>
+    </span>
   </div>
 </template> 
 
@@ -48,6 +97,7 @@
   data() {
     return {
       typeTABS: {}, //标签页
+      row: {}, //数据
       optionTABS: {
         column: [
           {
@@ -64,6 +114,11 @@
             // icon: "el-icon-info",
             label: "现实表现记录",
             prop: "tab3",
+          },
+          {
+            // icon: "el-icon-info",
+            label: "保安员证",
+            prop: "tab4",
           },
         ],
       },
@@ -142,6 +197,18 @@
     },
   },
   methods: {
+    Print() {
+      var printDom = document.getElementById("baoanzheng");
+      printDom.style.position = "fixed";
+      printDom.style.left = "-10%";
+      printDom.style.width = "120%";
+      printDom.style.height = "100%";
+      this.$Print(this.$refs.baoanzheng);
+      printDom.style.position = "relative";
+      printDom.style.left = "0";
+      printDom.style.width = "100%";
+      printDom.style.height = "calc(100% - 100px)";
+    },
     handleChangeTABS(column) {
       this.typeTABS = column;
       if (column.prop == "tab1") {
@@ -251,6 +318,7 @@
       this.name = row.name;
       this.dispatcherCompany = row.dispatcherCompany;
       this.id = row.id;
+      console.log(this.obj0);
     }
 
     var flag = false,
@@ -287,4 +355,102 @@
 // .el-tag--light {
 //   padding: 0 !important;
 // }
+
+.baoanzheng {
+  // position: fixed;
+  position: relative;
+  // top: 0;
+  top: 0;
+  // left: -10%;
+  left: 0;
+  // height: 0;
+  width: 100%;
+  height: calc(100% - 100px);
+  // background-color: rgba(0, 0, 0, 0.5);
+  background-color: #fff;
+  z-index: 9000;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.baz-main {
+  position: relative;
+  top: 15px;
+  // width: 441px;
+  // height: 358px;
+  width: 750px;
+  height: 550px;
+  // background-color: #004ca7;
+  background-color: #fff;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+}
+.baz-m-body {
+  width: 750px;
+  height: 550px;
+  background-image: url("/img/register/bazbj.png");
+  background-size: 100% 100%;
+  .bmb-heard {
+    font-size: 4rem;
+    width: 100%;
+    text-align: center;
+    letter-spacing: 1.4rem;
+    margin-bottom: 40px;
+    padding-left: 10px;
+    position: relative;
+    top: 20px;
+  }
+  .img {
+    width: 152px;
+    height: 205px;
+    border-radius: 10px;
+    position: absolute;
+    // border: 1px solid rgba($color: #888888, $alpha: 0.5);
+    top: 110px;
+    right: 80px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    img {
+      width: 100%;
+      height: 100%;
+    }
+  }
+  .imgs {
+    width: 110px;
+    height: 110px;
+    border-radius: 10px;
+    position: absolute;
+    border: 1px solid rgba($color: #888888, $alpha: 0.5);
+    top: 330px;
+    right: 103px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    img {
+      width: 100%;
+      height: 100%;
+    }
+  }
+  .bmb-b {
+    padding-left: 20px;
+    box-sizing: border-box;
+    height: 3.9rem;
+    margin-left: 3rem;
+    width: 100%;
+    font-size: 2rem;
+    font-weight: 300;
+    .bmb-b-s {
+      display: inline-block;
+      width: 20rem;
+      font-size: 2rem;
+      font-weight: 300;
+    }
+  }
+}
+.PrintBut {
+  margin-top: 15px;
+}
 </style>
\ No newline at end of file
diff --git a/src/views/securityUnitChild/index.vue b/src/views/securityUnitChild/index.vue
index 1661438..429d85d 100644
--- a/src/views/securityUnitChild/index.vue
+++ b/src/views/securityUnitChild/index.vue
@@ -132,7 +132,10 @@
       <!-- 许可证  -->
       <licence :row="obj0"></licence>
     </span>
-    <span v-else-if="typeTABS.prop === 'tab9'" class="tab"> 社保记录 </span>
+    <span v-else-if="typeTABS.prop === 'tab9'" class="tab">
+      <!-- 社保记录  -->
+      <social :deptid="obj0.departmentid"></social>
+    </span>
     <el-dialog
       title="出资人导入"
       append-to-body
@@ -197,6 +200,7 @@
 import gun from "../securityEquipment/gun.vue";
 import licence from "./licence.vue";
 import businessLicense from "./businessLicense.vue";
+import social from "./social.vue";
 
 export default {
   components: {
@@ -205,6 +209,7 @@
     gun: gun,
     licence: licence,
     businessLicense: businessLicense,
+    social: social,
   },
   data() {
     var DIC = {
diff --git a/src/views/securityUnitChild/social.vue b/src/views/securityUnitChild/social.vue
new file mode 100644
index 0000000..5a05171
--- /dev/null
+++ b/src/views/securityUnitChild/social.vue
@@ -0,0 +1,497 @@
+<template>
+  <basic-container>
+    <avue-crud
+      :option="option"
+      :table-loading="loading"
+      :data="data"
+      :page.sync="page"
+      :permission="permissionList"
+      :before-open="beforeOpen"
+      v-model="form"
+      ref="crud"
+      @row-update="rowUpdate"
+      @row-save="rowSave"
+      @row-del="rowDel"
+      @search-change="searchChange"
+      @search-reset="searchReset"
+      @selection-change="selectionChange"
+      @current-change="currentChange"
+      @size-change="sizeChange"
+      @refresh-change="refreshChange"
+      @on-load="onLoad"
+    >
+      <template slot="menuLeft">
+        <el-button
+          type="danger"
+          size="small"
+          icon="el-icon-delete"
+          plain
+          @click="handleDelete"
+          >删 除
+          <!-- v-if="permission.social_delete" -->
+        </el-button>
+        <el-button
+          type="success"
+          size="small"
+          plain
+          icon="el-icon-upload2"
+          @click="handleImport"
+          >批量导入
+        </el-button>
+      </template>
+    </avue-crud>
+    <el-dialog
+      title="用户数据导入"
+      append-to-body
+      :visible.sync="excelBox"
+      width="555px"
+    >
+      <avue-form
+        :option="excelOption"
+        v-model="excelForm"
+        :upload-after="uploadAfter"
+      >
+        <template slot="excelTemplate">
+          <el-button type="primary" @click="handleTemplate">
+            点击下载<i class="el-icon-download el-icon--right"></i>
+          </el-button>
+        </template>
+      </avue-form>
+    </el-dialog>
+  </basic-container>
+</template>
+
+<script>
+import { getList, getDetail, add, update, remove } from "@/api/social/social";
+import { mapGetters } from "vuex";
+import { getToken } from "@/util/auth";
+
+export default {
+  props: ["deptid"],
+  data() {
+    return {
+      form: {},
+      query: {},
+      loading: true,
+      excelBox: false,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      selectionList: [],
+      option: {
+        height: "auto",
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        align: "center",
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        viewBtn: true,
+        menu: false,
+        selection: true,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "姓名",
+            prop: "namb",
+
+            width: 65,
+            labelWidth: 110,
+
+            search: true,
+            searchLabelWidth: 45,
+            searchSpan: 4,
+
+            rules: [
+              {
+                required: true,
+                message: "请输入姓名",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "性别",
+            prop: "sex",
+            width: 55,
+            labelWidth: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入性别",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "民族",
+            prop: "nation",
+            width: 55,
+            labelWidth: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入民族",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "出生日期",
+            labelWidth: 110,
+            width: 90,
+            prop: "birthday",
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            rules: [
+              {
+                required: true,
+                message: "请输入出生日期",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "联系电话",
+            prop: "telephone",
+            labelWidth: 110,
+            width: 98,
+            rules: [
+              {
+                required: true,
+                message: "请输入联系电话",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "身份证号",
+            prop: "cardid",
+            labelWidth: 110,
+            width: 150,
+            rules: [
+              {
+                required: true,
+                message: "请输入身份证号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "户籍所在地址",
+            prop: "residence",
+            labelWidth: 110,
+            overHidden: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入户籍所在地址",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "居住地址  ",
+            prop: "address",
+            overHidden: true,
+            labelWidth: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入居住地址  ",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "户籍性质",
+            prop: "nature",
+            labelWidth: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入户籍性质",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "个人缴费额",
+            prop: "amount",
+            labelWidth: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入个人缴费额",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "参保时间",
+            labelWidth: 110,
+            width: 90,
+            prop: "insuredtime",
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            rules: [
+              {
+                required: true,
+                message: "请输入参保时间",
+                trigger: "blur",
+              },
+            ],
+          },
+          // {
+          //   label: "所属机构",
+          //   labelWidth: 110,
+          //   prop: "deptid",
+          //   addDisplay: false,
+          //   type: "select",
+          //   dicUrl: "/api/blade-system/dept/selectIn",
+          //   props: {
+          //     label: "deptname",
+          //     value: "deptid",
+          //   },
+          // },
+        ],
+      },
+      data: [],
+      excelForm: {},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: "模板上传",
+            prop: "excelFile",
+            type: "upload",
+            drag: true,
+            loadText: "模板上传中,请稍等",
+            span: 24,
+            propsHttp: {
+              res: "data",
+            },
+            tip: "请上传 .xls,.xlsx 标准格式文件",
+            action: "/api/social/import-user",
+          },
+          // {
+          //   label: "数据覆盖",
+          //   prop: "isCovered",
+          //   type: "switch",
+          //   align: "center",
+          //   hide: true,
+          //   width: 80,
+          //   dicData: [
+          //     {
+          //       label: "否",
+          //       value: 0,
+          //     },
+          //     {
+          //       label: "是",
+          //       value: 1,
+          //     },
+          //   ],
+          //   value: 0,
+          //   slot: true,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择是否覆盖",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          // },
+          {
+            label: "模板下载",
+            prop: "excelTemplate",
+            formslot: true,
+            span: 24,
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    "excelForm.isCovered"() {
+      console.log(123123);
+      if (this.excelForm.isCovered !== "") {
+        const column = this.findObject(this.excelOption.column, "excelFile");
+        column.action =
+          `/api/social/import-user?isCovered=${this.excelForm.isCovered}` +
+          "&deptid=" +
+          // this.userInfo.dept_id;
+          this.deptid;
+      }
+    },
+  },
+  computed: {
+    ...mapGetters(["permission", "userInfo"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.social_add, true),
+        viewBtn: this.vaildData(this.permission.social_view, false),
+        delBtn: this.vaildData(this.permission.social_delete, false),
+        editBtn: this.vaildData(this.permission.social_edit, false),
+      };
+    },
+    ids() {
+      let ids = [];
+      this.selectionList.forEach((ele) => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    },
+  },
+  methods: {
+    rowSave(row, done, loading) {
+      console.log(row);
+      row.deptid = this.deptid;
+      // return;
+      add(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          loading();
+          window.console.log(error);
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      console.log(row);
+      // return;
+      row.deptid = this.deptid;
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          loading();
+          console.log(error);
+        }
+      );
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
+    handleTemplate() {
+      window.open(
+        `/api/social/export-template?${this.website.tokenHeader}=${getToken()}`
+      );
+    },
+    uploadAfter(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox = false;
+      this.refreshChange();
+      done();
+    },
+    handleImport() {
+      this.excelBox = true;
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(this.ids);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then((res) => {
+          this.form = res.data.data;
+        });
+      }
+      done();
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      this.loading = true;
+      params["deptid"] = this.deptid;
+      getList(
+        page.currentPage,
+        page.pageSize,
+        Object.assign(params, this.query)
+      ).then((res) => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+        this.selectionClear();
+      });
+    },
+  },
+};
+</script>
+
+<style>
+</style>

--
Gitblit v1.9.3