From 3db2c302eb1717a77e8b706b1664ed829767e610 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 09 Jul 2021 08:46:05 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises

---
 src/views/securityGuard/securityGuardRegistration.vue |  399 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 399 insertions(+), 0 deletions(-)

diff --git a/src/views/securityGuard/securityGuardRegistration.vue b/src/views/securityGuard/securityGuardRegistration.vue
new file mode 100644
index 0000000..a87668a
--- /dev/null
+++ b/src/views/securityGuard/securityGuardRegistration.vue
@@ -0,0 +1,399 @@
+<template>
+  <el-row>
+    <el-col>
+      <basic-container>
+        <avue-form :option="option" v-model="form" @submit="update">
+            <template slot-scope="{row}" slot="input">
+                <el-tag>{{row}}</el-tag>
+            </template>
+        </avue-form>
+      </basic-container>
+    </el-col>
+  </el-row>
+</template>
+
+<script>
+  import {
+    getUser,
+    update,
+    getUserPractitionersInfo,
+    saveOrUpdateUserPractitionersInfo
+  } from "@/api/system/user";
+  import {getDeptLazyTree} from "@/api/system/dept";
+
+  export default {
+    data() {
+      return {
+        loading: true,
+        userId:"",
+        init: {
+          deptTree: [],
+        },
+        props: {
+          label: "title",
+          value: "key"
+        },
+        roleGrantList: [],
+        roleTreeObj: [],
+        treeDeptId: '',
+        treeData: [],
+        form:{
+            UserPractitionersInfo:[]
+        },
+        treeOption: {
+          nodeKey: 'id',
+          lazy: true,
+          treeLoad: function (node, resolve) {
+            const parentId = (node.level === 0) ? 0 : node.data.id;
+            getDeptLazyTree(parentId).then(res => {
+              resolve(res.data.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                }
+              }))
+            });
+          },
+          addBtn: false,
+          menu: false,
+          size: 'small',
+          props: {
+            labelText: '标题',
+            label: 'title',
+            value: 'value',
+            children: 'children'
+          }
+        },
+        option: {
+          height: 'auto',
+          calcHeight: 54,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: false,
+          stripe: true,
+          index: true,
+          selection: true,
+          dialogClickModal: false,
+          group: [
+            {
+              label: '基础信息',
+              labelWidth:"110",
+              prop: 'baseInfo',
+              icon: 'el-icon-user-solid',
+              column: [
+                {
+                  label: "所属保安单位",
+                  prop: "tenantId",
+                  type: "tree",
+                  dicUrl: "/api/blade-system/tenant/select",
+                  props: {
+                    label: "tenantName",
+                    value: "tenantId"
+                  },
+                  disabled:true,
+                  span: 24,
+                },
+                {
+                  label: "登录账号",
+                  prop: "account",
+                  disabled:true
+                },
+                {
+                  label: "用户姓名",
+                  prop: "realName",
+                  rules: [{
+                    required: true,
+                    message: "请输入用户姓名",
+                    trigger: "blur"
+                  }, {
+                    min: 2,
+                    max: 5,
+                    message: '姓名长度在2到5个字符'
+                  }]
+                },
+                {
+                  label: "用户昵称",
+                  prop: "name"
+                },
+                {
+                  label: "手机号码",
+                  prop: "phone",
+                  overHidden: true,
+                  rules: [{
+                    required: true,
+                    message: "请输入手机号",
+                    trigger: "blur"
+                  }]
+                },
+                {
+                  label: "电子邮箱",
+                  prop: "email"
+                },
+                {
+                  label: "身份证号",
+                  prop: "cardid",
+                  hide: true,
+                  overHidden: true,
+                  rules: [{
+                    required: true,
+                    message: "请输入身份证号",
+                    trigger: "blur"
+                  }]
+                },
+                {
+                  label: "籍贯",
+                  prop: "nativeplace"
+                },
+                {
+                  label: "民族",
+                  prop: "nation"
+                },
+                {
+                  label: "最高学历",
+                  prop: "education",
+                  type: "select",
+                  dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
+                  props: {
+                    label: "dictValue",
+                    value: "dictKey"
+                  },
+                  dataType: "number",
+                  slot: true,
+                  rules: [{
+                    required: true,
+                    message: "请选择学历",
+                    trigger: "blur"
+                  }]
+                },
+                {
+                  label: "政治面貌",
+                  prop: "politicaloutlook"
+                },
+                {
+                  label: "身高",
+                  prop: "height"
+                },
+                {
+                  label: "联系地址",
+                  prop: "address"
+                },
+                {
+                  label: "户口所在地",
+                  prop: "registered"
+                },
+                {
+                  label: "入职时间",
+                  prop: "rtime",
+                  type:'date',
+                  format: "yyyy-MM-dd",
+                  valueFormat: "yyyy-MM-dd"
+                },
+                {
+                  label: "用户性别",
+                  prop: "sex",
+                  type: "select",
+                  dicData: [
+                    {
+                      label: "男",
+                      value: 1
+                    },
+                    {
+                      label: "女",
+                      value: 2
+                    },
+                    {
+                      label: "未知",
+                      value: 3
+                    }
+                  ]
+                },
+                {
+                  label: "用户生日",
+                  type: "date",
+                  prop: "birthday"
+                }
+              ]
+            },
+            {
+              label: '从业信息',
+              prop: 'detailInfo',
+              icon: 'el-icon-s-order',
+              column: [
+                    {
+                    prop: 'UserPractitionersInfo',
+                    type: 'dynamic',
+                    border: false,
+                    span:24,
+                    children: {
+                        align: 'left',
+                        headerAlign: 'center',
+                        type:'form',
+                        rowAdd:(done)=>{
+                            console.log(done,111);
+                            done({
+                                input:'默认值'
+                            });
+                        },
+                        rowDel:(row,done)=>{
+                            console.log(row,222);
+                            done();
+                        },
+                        column: [
+                                {
+                                    width: 200,
+                                    label: '单位名称',
+                                    prop: "companyname",
+                                    formslot: true,
+                                }, {
+                                    width: 200,
+                                    label: '部门',
+                                    prop: "department",
+                                    formslot: true,
+                                }, {
+                                    width: 200,
+                                    label: '岗位',
+                                    prop: "post",
+                                    formslot: true,
+                                },  {
+                                    width: 200,
+                                    label: '岗位职责',
+                                    prop: "responsibilities",
+                                    formslot: true,
+                                },  {
+                                    width: 200,
+                                    label: '入职时间',
+                                    type:'date',
+                                    format: "yyyy-MM-dd",
+                                    valueFormat: "yyyy-MM-dd",
+                                    prop: "entryTime",
+                                    formslot: true,
+                                },  {
+                                    width: 200,
+                                    label: '离职时间',
+                                    type:'date',
+                                    format: "yyyy-MM-dd",
+                                    valueFormat: "yyyy-MM-dd",
+                                    prop: "departureTime",
+                                    formslot: true,
+                                },  {
+                                    width: 200,
+                                    label: '离职原因',
+                                    prop: "leaving",
+                                    formslot: true,
+                                }
+                            ]
+                        }
+                    },
+
+                ]
+            }
+          ]
+        },
+        data: []
+      };
+    },
+    watch: {
+      'form.tenantId'() {
+        if (this.form.tenantId !== '' && this.initFlag) {
+          this.initData(this.form.tenantId);
+        }
+      },
+      'excelForm.isCovered'() {
+        if (this.excelForm.isCovered !== '') {
+          const column = this.findObject(this.excelOption.column, "excelFile");
+          column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
+        }
+      }
+    },
+    computed: {
+    },
+    mounted() {
+      //获取userId
+      this.userId = JSON.parse(window.localStorage.getItem("saber-userInfo")).content.user_id;
+      //获取用户信息
+      this.getUserDetail();
+    },
+    methods: {
+      //获取用户信息
+      getUserDetail(){
+         var that = this;
+          //获取用户基本信息
+         getUser(this.userId).then(res => {
+            this.form = res.data.data;
+            var userInfo = res.data.data;
+            //获取用户从业信息
+            getUserPractitionersInfo(userInfo.cardid).then(res1 =>{
+               that.form.UserPractitionersInfo = res1.data.data;
+            })
+            if (this.form.hasOwnProperty("deptId")) {
+              this.form.deptId = this.form.deptId.split(",");
+            }
+            if (this.form.hasOwnProperty("postId")) {
+              this.form.postId = this.form.postId.split(",");
+            }
+         });
+      },
+      //新增用户信息(包含从业信息)
+      update(row, index, done, loading) {
+        const userPractitionersList = [];
+        var userPractitionersInfo = row.UserPractitionersInfo;
+        if(userPractitionersInfo.length>0){
+            userPractitionersInfo.forEach(item => {
+                const info = {
+                    companyname: item.companyname,
+                    department: item.department,
+                    departureTime: item.departureTime,
+                    entryTime: item.entryTime,
+                    name:row.realName,
+                    leaving: item.leaving,
+                    cardid:row.cardid,
+                    post: item.post,
+                    responsibilities: item.responsibilities
+                }
+                userPractitionersList.push(info);
+            });
+        }
+        var IdCardNo = row.cardid; 
+        row.deptId = row.deptId.join(",");
+        row.postId = row.postId.join(",");
+        update(row).then(() => {
+           const experience = {
+               cardid:IdCardNo,
+               userPractitionersInfo:userPractitionersList
+           }
+           //更新从业信息
+            saveOrUpdateUserPractitionersInfo(experience).then(()=>{
+                this.$message({
+                    type: "success",
+                    message: "操作成功!"
+                 });
+            })
+           this.loading = false;
+          done();
+        }, error => {
+          window.console.log(error,111);
+          loading();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+  .box {
+    height: 800px;
+  }
+
+  .el-scrollbar {
+    height: 100%;
+  }
+
+  .box .el-scrollbar__wrap {
+    overflow: scroll;
+  }
+
+  /* .el-form-item__content{
+      margin-left: 0px !important;
+  } */
+</style>
\ No newline at end of file

--
Gitblit v1.9.3