From 8ef98bfd45d97a4c7d494d5a4e51b573df8da268 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 10 Jul 2021 13:51:20 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises

---
 src/views/securityGuard/securityGuardRegistration.vue |  775 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 417 insertions(+), 358 deletions(-)

diff --git a/src/views/securityGuard/securityGuardRegistration.vue b/src/views/securityGuard/securityGuardRegistration.vue
index ea7862b..4e6e4e3 100644
--- a/src/views/securityGuard/securityGuardRegistration.vue
+++ b/src/views/securityGuard/securityGuardRegistration.vue
@@ -1,403 +1,462 @@
 <template>
-  <el-row>
-    <el-col>
-      <basic-container>
+    <el-dialog
+      :title="!form.id?'新增':'修改'"
+      width="60%"
+      modal-append-to-body='false'
+      append-to-body='true'
+      :close-on-click-model="true"
+      :visible.sync="visible"
+    >
         <avue-form :option="option" v-model="form" @submit="update">
-            <template slot-scope="{row}" slot="input">
-                <el-tag>{{row}}</el-tag>
-            </template>
+          <template slot-scope="{ row }" slot="input">
+            <el-tag>{{ row }}</el-tag>
+          </template>
         </avue-form>
-      </basic-container>
-    </el-col>
-  </el-row>
+    </el-dialog>
 </template>
 
 <script>
-  import {
-    getUser,
-    update,
-    getUserPractitionersInfo,
-    saveOrUpdateUserPractitionersInfo
-  } from "@/api/system/user";
-  import {getDeptLazyTree} from "@/api/system/dept";
+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 => {
+export default {
+  name: "securityGuardRegistration",
+  data() {
+    return {
+      loading: true,
+      userId: "",
+      visible: false,
+      init: {
+        deptTree: [],
+      },
+      props: {
+        label: "title",
+        value: "key",
+      },
+      roleGrantList: [],
+      roleTreeObj: [],
+      treeDeptId: "",
+      treeData: [],
+      form: {
+        UserPractitionersInfo: [],
+        title: "标题",
+      },
+      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'
-          }
+                  leaf: !item.hasChildren,
+                };
+              })
+            );
+          });
         },
-        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,
+        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: "",
+            prop: "title",
+            type: "title",
+            span: 24,
+            labelWidth: 140,
+            style: {
+              fontsize: 24,
+            },
+          },
+          {
+            label: "基础信息",
+            labelWidth: "110",
+            prop: "baseInfo",
+            icon: "el-icon-user-solid",
+            column: [
+              {
+                label: "所属组织机构",
+                prop: "deptId",
+                type: "tree",
+                dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
+                props: {
+                  label: "title",
+                  value: "id",
                 },
-                {
-                  label: "登录账号",
-                  prop: "account",
-                  disabled:true
-                },
-                {
-                  label: "用户姓名",
-                  prop: "realName",
-                  rules: [{
+                disabled: true,
+                span: 24,
+              },
+              {
+                label: "登录账号",
+                prop: "account",
+                disabled: true,
+              },
+              {
+                label: "用户姓名",
+                prop: "realName",
+                rules: [
+                  {
                     required: true,
                     message: "请输入用户姓名",
-                    trigger: "blur"
-                  }, {
+                    trigger: "blur",
+                  },
+                  {
                     min: 2,
                     max: 5,
-                    message: '姓名长度在2到5个字符'
-                  }]
-                },
-                {
-                  label: "用户昵称",
-                  prop: "name"
-                },
-                {
-                  label: "手机号码",
-                  prop: "phone",
-                  overHidden: true,
-                  rules: [{
+                    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: [{
+                    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"
+                    trigger: "blur",
                   },
-                  dataType: "number",
-                  slot: 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",
                 },
-                {
-                  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: [
+                dataType: "number",
+                slot: true
+              },
+              {
+                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: [
                     {
-                      label: "男",
-                      value: 1
+                      width: 200,
+                      label: "单位名称",
+                      prop: "companyname",
+                      formslot: true,
                     },
                     {
-                      label: "女",
-                      value: 2
+                      width: 200,
+                      label: "部门",
+                      prop: "department",
+                      formslot: true,
                     },
                     {
-                      label: "未知",
-                      value: 3
-                    }
-                  ]
+                      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,
+                    },
+                  ],
                 },
-                {
-                  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}`;
-        }
+      data: [],
+    };
+  },
+  watch: {
+    "form.tenantId"() {
+      if (this.form.tenantId !== "" && this.initFlag) {
+        this.initData(this.form.tenantId);
       }
     },
-    computed: {
+    "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}`;
+      }
     },
-    mounted() {
-      //获取userId
-      this.userId = JSON.parse(window.localStorage.getItem("saber-userInfo")).content.user_id;
-      //获取用户信息
-      this.getUserDetail();
+  },
+  computed: {},
+  mounted() {
+    //获取userId
+    this.userId = JSON.parse(
+      window.localStorage.getItem("saber-userInfo")
+    ).content.user_id;
+    //获取用户信息
+    this.getUserDetail();
+  },
+  methods: {
+    inits(id) {
+      this.form.id = id || 0;
+      this.visible = true;
     },
-    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);
-            });
+    //获取用户信息
+    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(",");
         }
-        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();
+        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 scope>
-  .box {
-    height: 850px;
-  }
+.box {
+  height: 850px;
+}
 
-  .el-card__body{
-    margin-bottom: 30px !important;
-  }
+.el-card__body {
+  margin-bottom: 30px !important;
+}
 
-  .el-scrollbar {
-    height: 100%;
-  }
+.el-scrollbar {
+  height: 100%;
+}
 
-  .box .el-scrollbar__wrap {
-    overflow: scroll;
-  }
+.box .el-scrollbar__wrap {
+  overflow: scroll;
+}
 
-  /* .el-form-item__content{
+/* .el-form-item__content{
       margin-left: 0px !important;
   } */
+
+
+.addorupdatetitle{
+  position: absolute;
+  left: 10px;
+  top: 70px;
+  width: 10px;
+  height: 10px;
+  font-size: 10px;
+  cursor: pointer;
+
+}
+.xx {
+  position: absolute;
+  right: 50px;
+  top: 70px;
+  height: 10px;
+  font-size: 24px;
+  z-index: 600;
+}
+.flaots {
+  width: 70%;
+  padding-top: 50px;
+  position: absolute;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3