{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\visitor\\visitor-add-or-update.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\visitor\\visitor-add-or-update.vue","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport {\n\tgetDictDataList\n} from '@/utils'\nimport {\n\tisMobile,\n\tidCardValidate\n} from '@/utils/validate'\nimport {\n\ttreeDataTranslate\n} from '@/utils'\nimport debounce from 'lodash/debounce'\nimport Cookies from 'js-cookie'\nimport {\n\tmapGetters\n} from 'vuex'\nexport default {\n\tcomputed: {\n\t\t...mapGetters(['uwbId']),\n\t},\n\twatch: {\n\t\t'dataForm.vrIdno': {\n\t\t\timmediate: true,\n\t\t\thandler(val) {\n\t\t\t\tlet gender = '0';\n\t\t\t\tif (val && val.length == 18) {\n\t\t\t\t\tgender = val[16] % 2 == 0 ? '0' : '1';\n\t\t\t\t}\n\t\t\t\tthis.dataForm.vrSex = gender\n\t\t\t}\n\t\t},\n\t\tuwbId(val) {\n\t\t\t// 覆盖到当前id绑定\n\t\t\tif (val) {\n\t\t\t\tthis.dataForm.vrUwbid = val;\n\t\t\t\tthis.$store.commit(\"visitor/UPDATE_VISITOR\", '')\n\t\t\t}\n\t\t}\n\t},\n\tdata() {\n\t\tconst asyncValidate = (rule, value, callback) => {\n\t\t\tthis.$http({\n\t\t\t\turl: \"/system/globalValidation/checkUwb\",\n\t\t\t\tmethod: \"get\",\n\t\t\t\tparams: {\n\t\t\t\t\tid: null,\n\t\t\t\t\tuwb: value\n\t\t\t\t}\n\t\t\t}).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res) {\n\t\t\t\t\tcallback()\n\t\t\t\t} else {\n\t\t\t\t\tcallback(new Error('UWB标签重复'))\n\t\t\t\t}\n\t\t\t}).catch(err => {\n\t\t\t\tcallback(new Error(err.msg))\n\t\t\t})\n\t\t};\n\t\treturn {\n\t\t\tdialogVisible: false,\n\t\t\tloading: false,\n\t\t\ttype: 'post',\n\t\t\tFloorList: [], // 楼栋、楼层级联\n\t\t\tstaffList: [], // 教职工列表 \n\t\t\tdataForm: {\n\t\t\t\tvrPhoneimg: '',\n\t\t\t\tvrName: '',\n\t\t\t\tvrIdno: '',\n\t\t\t\tvrSex: '0',\n\t\t\t\tvrUwbid: '',\n\t\t\t\tscWaid: '',\n\t\t\t\tvrTemperature: undefined,\n\t\t\t\tvrAddress: '',\n\t\t\t\tdfFloorid: [],\n\t\t\t\tvrReasons: '',\n\t\t\t\tvrInterviewed: \"\", // 被访人员ID\n\t\t\t\tvrInterviewedPhone: \"\", // 被访问人员电话\n\t\t\t\tvrPhone: \"\", // 访客电话\n\t\t\t},\n\t\t\tgenderList: getDictDataList('gender').filter(item => item.dictValue < 2),\n\t\t\trules: {\n\t\t\t\tvrName: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tvrInterviewed: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tvrSex: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请选择',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tvrIdno: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tscWaid: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}, ],\n\t\t\t\tvrUwbid: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalidator: (rule, value, callback) => {\n\t\t\t\t\t\t\tif (!/^[0-9]+$/.test(value)) {\n\t\t\t\t\t\t\t\treturn callback(new Error(\"UWB标签只能是数字\"));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallback()\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttrigger: ['change']\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalidator: asyncValidate,\n\t\t\t\t\t\ttrigger: ['change']\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tvrPhone: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalidator: isMobile,\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tvrAddress: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tvrReasons: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tvrTemperature: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t}],\n\t\t\t\tdfFloorid: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalidator: (rule, value, callback) => {\n\t\t\t\t\t\tif (value.length === 0) {\n\t\t\t\t\t\t\treturn callback(new Error(\"请选择\"));\n\t\t\t\t\t\t} else if (value.length === 1) {\n\t\t\t\t\t\t\treturn callback(new Error(\"请选择楼层\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn callback();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t},\n\t\t\tuploadHeaders: {},\n\t\t\tuploadUrl: window.SITE_CONFIG['apiURL'] + '/system/upload',\n\t\t}\n\t},\n\tcreated() {\n\t\tthis.uploadHeaders = {\n\t\t\tAuthorization: 'Bearer ' + Cookies.get('access_token') || ''\n\t\t}\n\t},\n\tmethods: {\n\t\tinit(data) {\n\t\t\tthis.dialogVisible = true;\n\t\t\tthis.getTfSetupaddrList() // 获取楼栋、楼层\n\t\t\tthis.getStaffList() // 获取职工信息\n\t\t\t// 编辑\n\t\t\tif (data) {\n\t\t\t\tthis.type = \"put\";\n\t\t\t\tthis.dataForm = {\n\t\t\t\t\t...data,\n\t\t\t\t\tvrSex: String(data.vrSex),\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 新增\n\t\t\telse {\n\t\t\t\tthis.type = \"post\";\n\t\t\t\tthis.dataForm = {\n\t\t\t\t\tvrPhoneimg: '',\n\t\t\t\t\tvrPhone: \"\",\n\t\t\t\t\tvrName: '',\n\t\t\t\t\tvrIdno: '',\n\t\t\t\t\tvrSex: '0',\n\t\t\t\t\tvrUwbid: '',\n\t\t\t\t\tscWaid: '',\n\t\t\t\t\tvrTemperature: undefined,\n\t\t\t\t\tvrAddress: '',\n\t\t\t\t\tvrReasons: '',\n\t\t\t\t\tdfFloorid: [],\n\t\t\t\t\tvrInterviewed: \"\", // 被访人员ID\n\t\t\t\t\tvrInterviewedPhone: \"\", // 被访问人员电话\n\t\t\t\t\tscPhonenum: \"\", // 访客电话\n\n\t\t\t\t};\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$refs['dataForm'].clearValidate();\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t// 获取楼栋和楼层的cascader\n\t\tgetTfSetupaddrList() {\n\t\t\t// -1是获取所有楼栋\n\t\t\tthis.$http.get(`/system/scdormitoryfloor/tree/-1`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.FloorList = treeDataTranslate(res.data, 'df_floorid', 'df_parentid')\n\t\t\t}).catch(() => {})\n\t\t},\n\t\t// 获取职工信息\n\t\tgetStaffList() {\n\t\t\tthis.$http.get(`/system/scworkersarchives/getAll`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.staffList = res.data\n\t\t\t}).catch(() => {})\n\t\t},\n\t\t// 根据职工联动手机号码\n\t\tgetPhoneHandle(e) {\n\t\t\tif (e) {\n\t\t\t\tthis.staffList.forEach(item => {\n\t\t\t\t\tif (e === item.scWaid) {\n\t\t\t\t\t\tthis.dataForm.vrInterviewedPhone = item.scPhonenum\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tthis.dataForm.vrInterviewedPhone = \"\"\n\t\t\t}\n\t\t},\n\t\tsubmitInfo: debounce(function() {\n\t\t\tthis.$refs['dataForm'].validate((valid) => {\n\t\t\t\tif (!valid) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tthis.loading = true;\n\t\t\t\tthis.dataForm.vrTemperature = this.dataForm.vrTemperature.toFixed(2)\n\t\t\t\tthis.$http({\n\t\t\t\t\turl: \"/system/scvisitorrecord\",\n\t\t\t\t\tmethod: this.type,\n\t\t\t\t\tdata: this.dataForm\n\t\t\t\t}).then(({\n\t\t\t\t\tdata\n\t\t\t\t}) => {\n\t\t\t\t\tif (data.code != 0) {\n\t\t\t\t\t\treturn this.$message.error(data.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.dialogVisible = false;\n\t\t\t\t\tif (this.type == 'post') {\n\t\t\t\t\t\tthis.$parent.$parent.resetQuery();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.$parent.$parent.search();\n\t\t\t\t\t}\n\t\t\t\t\tthis.$message.success(data.msg)\n\t\t\t\t}).finally(() => {\n\t\t\t\t\tthis.loading = false\n\t\t\t\t})\n\t\t\t})\n\n\t\t}, 1000),\n\t\thandleUploadSuccess(res) {\n\t\t\tif (res.code != 0) {\n\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t}\n\t\t\tthis.dataForm.vrPhoneimg = res.data.path\n\t\t},\n\t\tbeforeUpload(file) {\n\t\t\tconst isJPG = file.type == 'image/jpeg' || file.type == 'image/png';\n\t\t\tconst isLess2M = file.size / 1024 / 1024 < 2;\n\t\t\tif (!isJPG) {\n\t\t\t\tthis.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');\n\t\t\t}\n\t\t\tif (!isLess2M) {\n\t\t\t\tthis.$message.error('上传头像图片大小不能超过 2MB!');\n\t\t\t}\n\t\t\treturn isJPG && isLess2M;\n\t\t}\n\t}\n}\n",{"version":3,"sources":["visitor-add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"visitor-add-or-update.vue","sourceRoot":"src/views/modules/visitor","sourcesContent":["\n\n\n"]}]}