management/front/dkha-web-sz-main/node_modules/.cache/vue-loader/1c65fd0e753ae6a3f15743920f1...

1 line
24 KiB
JSON

{"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":["<template>\n\t<el-dialog :title=\"type=='post'?'新建':'编辑'\" :visible.sync=\"dialogVisible\" :close-on-click-modal=\"false\">\n\t\t<div>\n\t\t\t<el-form ref=\"dataForm\" :model=\"dataForm\" :rules=\"rules\" label-width=\"100px\">\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col>\n\t\t\t\t\t\t<el-form-item class=\"block-item\" label=\"照片\" prop=\"vrPhoneimg\">\n\t\t\t\t\t\t\t<el-upload class=\"avatar-uploader\" :action=\"uploadUrl\" :headers=\"uploadHeaders\" :show-file-list=\"false\"\n\t\t\t\t\t\t\t :on-success=\"handleUploadSuccess\" :before-upload=\"beforeUpload\" :data=\"{folderName:'visitor'}\">\n\t\t\t\t\t\t\t\t<img v-if=\"dataForm.vrPhoneimg\" :src=\"$ImgServerUrl+dataForm.vrPhoneimg\" class=\"avatar\" />\n\t\t\t\t\t\t\t\t<i v-else class=\"el-icon-plus avatar-uploader-icon\"></i>\n\t\t\t\t\t\t\t</el-upload>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col :span=\"12\">\n\t\t\t\t\t\t<el-form-item label=\"姓名\" prop=\"vrName\">\n\t\t\t\t\t\t\t<el-input v-model=\"dataForm.vrName\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"11\" :offset=\"1\">\n\t\t\t\t\t\t<el-form-item label=\"身份证号\" prop=\"vrIdno\">\n\t\t\t\t\t\t\t<el-input v-model=\"dataForm.vrIdno\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col :span=\"12\">\n\t\t\t\t\t\t<el-form-item label=\"UWB标签\" prop=\"vrUwbid\">\n\t\t\t\t\t\t\t<el-input v-model=\"dataForm.vrUwbid\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"11\" :offset=\"1\">\n\t\t\t\t\t\t<el-form-item label=\"性别\" prop=\"vrSex\">\n\t\t\t\t\t\t\t<el-radio-group v-model=\"dataForm.vrSex\" placeholder=\"请输入\">\n\t\t\t\t\t\t\t\t<el-radio disabled v-for=\"item in genderList\" :key=\"item.dictLable\" :label=\"item.dictValue\">{{item.dictLabel}}</el-radio>\n\t\t\t\t\t\t\t</el-radio-group>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col :span=\"12\">\n\t\t\t\t\t\t<el-form-item label=\"被访人员\" prop=\"vrInterviewed\">\n\t\t\t\t\t\t\t<el-select v-model=\"dataForm.vrInterviewed\" clearable placeholder=\"请选择\" filterable @change=\"getPhoneHandle\">\n\t\t\t\t\t\t\t\t<el-option v-for=\"item in staffList\" :label=\"item.scWaname\" :value=\"item.scWaid\" :key=\"item.scWaid\"></el-option>\n\t\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"11\" :offset=\"1\">\n\t\t\t\t\t\t<el-form-item label=\"访客体温\" prop=\"vrTemperature\">\n\t\t\t\t\t\t\t<el-input-number :controls=\"false\" v-model=\"dataForm.vrTemperature\" placeholder=\"请输入\" clearable></el-input-number>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col :span=\"12\">\n\t\t\t\t\t\t<el-form-item label=\"被访人电话\" prop=\"vrInterviewedPhone\">\n\t\t\t\t\t\t\t<el-input v-model=\"dataForm.vrInterviewedPhone\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"11\" :offset=\"1\">\n\t\t\t\t\t\t<el-form-item label=\"访客电话\" prop=\"vrPhone\">\n\t\t\t\t\t\t\t<el-input v-model=\"dataForm.vrPhone\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col :span=\"12\">\n\t\t\t\t\t\t<el-form-item label=\"访问地址\" prop=\"vrAddress\">\n\t\t\t\t\t\t\t<el-input v-model=\"dataForm.vrAddress\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"11\" :offset=\"1\">\n\t\t\t\t\t\t<el-form-item label=\"访问楼层\" prop=\"dfFloorid\">\n\t\t\t\t\t\t\t<el-cascader v-model=\"dataForm.dfFloorid\" :props=\"{ value: 'df_floorid', label: 'df_floorname',emitPath:false}\"\n\t\t\t\t\t\t\t clearable placeholder=\"请选择\" :options=\"FloorList\" style=\"width: 100%;\"></el-cascader>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col>\n\t\t\t\t\t\t<el-form-item label=\"访问事由\" prop=\"vrReasons\">\n\t\t\t\t\t\t\t<el-input type=\"textarea\" :rows=\"3\" resize=\"none\" v-model=\"dataForm.vrReasons\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t\t\t\t</el-form-item>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t</el-form>\n\t\t</div>\n\t\t<div slot=\"footer\">\n\t\t\t<el-button @click=\"dialogVisible = false\">取 消</el-button>\n\t\t\t<el-button type=\"primary\" v-loading=\"loading\" @click=\"submitInfo\">确 定</el-button>\n\t\t</div>\n\t</el-dialog>\n</template>\n<script>\n\timport {\n\t\tgetDictDataList\n\t} from '@/utils'\n\timport {\n\t\tisMobile,\n\t\tidCardValidate\n\t} from '@/utils/validate'\n\timport {\n\t\ttreeDataTranslate\n\t} from '@/utils'\n\timport debounce from 'lodash/debounce'\n\timport Cookies from 'js-cookie'\n\timport {\n\t\tmapGetters\n\t} from 'vuex'\n\texport default {\n\t\tcomputed: {\n\t\t\t...mapGetters(['uwbId']),\n\t\t},\n\t\twatch: {\n\t\t\t'dataForm.vrIdno': {\n\t\t\t\timmediate: true,\n\t\t\t\thandler(val) {\n\t\t\t\t\tlet gender = '0';\n\t\t\t\t\tif (val && val.length == 18) {\n\t\t\t\t\t\tgender = val[16] % 2 == 0 ? '0' : '1';\n\t\t\t\t\t}\n\t\t\t\t\tthis.dataForm.vrSex = gender\n\t\t\t\t}\n\t\t\t},\n\t\t\tuwbId(val) {\n\t\t\t\t// 覆盖到当前id绑定\n\t\t\t\tif (val) {\n\t\t\t\t\tthis.dataForm.vrUwbid = val;\n\t\t\t\t\tthis.$store.commit(\"visitor/UPDATE_VISITOR\", '')\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdata() {\n\t\t\tconst asyncValidate = (rule, value, callback) => {\n\t\t\t\tthis.$http({\n\t\t\t\t\turl: \"/system/globalValidation/checkUwb\",\n\t\t\t\t\tmethod: \"get\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tid: null,\n\t\t\t\t\t\tuwb: value\n\t\t\t\t\t}\n\t\t\t\t}).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res) {\n\t\t\t\t\t\tcallback()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcallback(new Error('UWB标签重复'))\n\t\t\t\t\t}\n\t\t\t\t}).catch(err => {\n\t\t\t\t\tcallback(new Error(err.msg))\n\t\t\t\t})\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tdialogVisible: false,\n\t\t\t\tloading: false,\n\t\t\t\ttype: 'post',\n\t\t\t\tFloorList: [], // 楼栋、楼层级联\n\t\t\t\tstaffList: [], // 教职工列表 \n\t\t\t\tdataForm: {\n\t\t\t\t\tvrPhoneimg: '',\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\tdfFloorid: [],\n\t\t\t\t\tvrReasons: '',\n\t\t\t\t\tvrInterviewed: \"\", // 被访人员ID\n\t\t\t\t\tvrInterviewedPhone: \"\", // 被访问人员电话\n\t\t\t\t\tvrPhone: \"\", // 访客电话\n\t\t\t\t},\n\t\t\t\tgenderList: getDictDataList('gender').filter(item => item.dictValue < 2),\n\t\t\t\trules: {\n\t\t\t\t\tvrName: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tvrInterviewed: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tvrSex: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请选择',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tvrIdno: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tscWaid: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}, ],\n\t\t\t\t\tvrUwbid: [{\n\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\tvalidator: (rule, value, callback) => {\n\t\t\t\t\t\t\t\tif (!/^[0-9]+$/.test(value)) {\n\t\t\t\t\t\t\t\t\treturn callback(new Error(\"UWB标签只能是数字\"));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcallback()\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttrigger: ['change']\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\tvalidator: asyncValidate,\n\t\t\t\t\t\t\ttrigger: ['change']\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tvrPhone: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalidator: isMobile,\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tvrAddress: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tvrReasons: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tvrTemperature: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tdfFloorid: [{\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 (value.length === 0) {\n\t\t\t\t\t\t\t\treturn callback(new Error(\"请选择\"));\n\t\t\t\t\t\t\t} else if (value.length === 1) {\n\t\t\t\t\t\t\t\treturn callback(new Error(\"请选择楼层\"));\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn callback();\n\t\t\t\t\t\t\t}\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},\n\t\t\t\tuploadHeaders: {},\n\t\t\t\tuploadUrl: window.SITE_CONFIG['apiURL'] + '/system/upload',\n\t\t\t}\n\t\t},\n\t\tcreated() {\n\t\t\tthis.uploadHeaders = {\n\t\t\t\tAuthorization: 'Bearer ' + Cookies.get('access_token') || ''\n\t\t\t}\n\t\t},\n\t\tmethods: {\n\t\t\tinit(data) {\n\t\t\t\tthis.dialogVisible = true;\n\t\t\t\tthis.getTfSetupaddrList() // 获取楼栋、楼层\n\t\t\t\tthis.getStaffList() // 获取职工信息\n\t\t\t\t// 编辑\n\t\t\t\tif (data) {\n\t\t\t\t\tthis.type = \"put\";\n\t\t\t\t\tthis.dataForm = {\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\tvrSex: String(data.vrSex),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 新增\n\t\t\t\telse {\n\t\t\t\t\tthis.type = \"post\";\n\t\t\t\t\tthis.dataForm = {\n\t\t\t\t\t\tvrPhoneimg: '',\n\t\t\t\t\t\tvrPhone: \"\",\n\t\t\t\t\t\tvrName: '',\n\t\t\t\t\t\tvrIdno: '',\n\t\t\t\t\t\tvrSex: '0',\n\t\t\t\t\t\tvrUwbid: '',\n\t\t\t\t\t\tscWaid: '',\n\t\t\t\t\t\tvrTemperature: undefined,\n\t\t\t\t\t\tvrAddress: '',\n\t\t\t\t\t\tvrReasons: '',\n\t\t\t\t\t\tdfFloorid: [],\n\t\t\t\t\t\tvrInterviewed: \"\", // 被访人员ID\n\t\t\t\t\t\tvrInterviewedPhone: \"\", // 被访问人员电话\n\t\t\t\t\t\tscPhonenum: \"\", // 访客电话\n\n\t\t\t\t\t};\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$refs['dataForm'].clearValidate();\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t\t// 获取楼栋和楼层的cascader\n\t\t\tgetTfSetupaddrList() {\n\t\t\t\t// -1是获取所有楼栋\n\t\t\t\tthis.$http.get(`/system/scdormitoryfloor/tree/-1`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.FloorList = treeDataTranslate(res.data, 'df_floorid', 'df_parentid')\n\t\t\t\t}).catch(() => {})\n\t\t\t},\n\t\t\t// 获取职工信息\n\t\t\tgetStaffList() {\n\t\t\t\tthis.$http.get(`/system/scworkersarchives/getAll`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.staffList = res.data\n\t\t\t\t}).catch(() => {})\n\t\t\t},\n\t\t\t// 根据职工联动手机号码\n\t\t\tgetPhoneHandle(e) {\n\t\t\t\tif (e) {\n\t\t\t\t\tthis.staffList.forEach(item => {\n\t\t\t\t\t\tif (e === item.scWaid) {\n\t\t\t\t\t\t\tthis.dataForm.vrInterviewedPhone = item.scPhonenum\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthis.dataForm.vrInterviewedPhone = \"\"\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmitInfo: debounce(function() {\n\t\t\t\tthis.$refs['dataForm'].validate((valid) => {\n\t\t\t\t\tif (!valid) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tthis.loading = true;\n\t\t\t\t\tthis.dataForm.vrTemperature = this.dataForm.vrTemperature.toFixed(2)\n\t\t\t\t\tthis.$http({\n\t\t\t\t\t\turl: \"/system/scvisitorrecord\",\n\t\t\t\t\t\tmethod: this.type,\n\t\t\t\t\t\tdata: this.dataForm\n\t\t\t\t\t}).then(({\n\t\t\t\t\t\tdata\n\t\t\t\t\t}) => {\n\t\t\t\t\t\tif (data.code != 0) {\n\t\t\t\t\t\t\treturn this.$message.error(data.msg)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.dialogVisible = false;\n\t\t\t\t\t\tif (this.type == 'post') {\n\t\t\t\t\t\t\tthis.$parent.$parent.resetQuery();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.$parent.$parent.search();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.$message.success(data.msg)\n\t\t\t\t\t}).finally(() => {\n\t\t\t\t\t\tthis.loading = false\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\t}, 1000),\n\t\t\thandleUploadSuccess(res) {\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.dataForm.vrPhoneimg = res.data.path\n\t\t\t},\n\t\t\tbeforeUpload(file) {\n\t\t\t\tconst isJPG = file.type == 'image/jpeg' || file.type == 'image/png';\n\t\t\t\tconst isLess2M = file.size / 1024 / 1024 < 2;\n\t\t\t\tif (!isJPG) {\n\t\t\t\t\tthis.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');\n\t\t\t\t}\n\t\t\t\tif (!isLess2M) {\n\t\t\t\t\tthis.$message.error('上传头像图片大小不能超过 2MB!');\n\t\t\t\t}\n\t\t\t\treturn isJPG && isLess2M;\n\t\t\t}\n\t\t}\n\t}\n</script>\n<style lang=\"scss\" scoped>\n\t.el-dialog {\n\t\t.el-form {\n\t\t\t.el-form-item {\n\n\t\t\t\t.el-date-editor--date,\n\t\t\t\t.el-input-number,\n\t\t\t\t.el-select {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t/deep/ .el-upload {\n\t\t\t\t\tborder: 1px dashed #d9d9d9;\n\t\t\t\t\tborder-radius: 6px;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\tposition: relative;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tmargin-left: 20px;\n\n\t\t\t\t\t.avatar-uploader-icon {\n\t\t\t\t\t\tfont-size: 28px;\n\t\t\t\t\t\tcolor: #fff;\n\t\t\t\t\t\theight: 150px;\n\t\t\t\t\t\twidth: 106px;\n\t\t\t\t\t\tline-height: 150px;\n\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t}\n\n\t\t\t\t\t.avatar {\n\t\t\t\t\t\theight: 150px;\n\t\t\t\t\t\twidth: 106px;\n\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n</style>\n"]}]}