1 line
16 KiB
JSON
1 line
16 KiB
JSON
{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js!E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!E:\\hz-zhhq-web\\src\\views\\canteen\\staff\\addStaff\\index.vue?vue&type=script&lang=js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\views\\canteen\\staff\\addStaff\\index.vue","mtime":1737610069407},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.split\";\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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { modifyCanteenStaff, addCanteenStaff } from \"@/api/getdata\";\nimport Popup from \"@/views/estate/examine/dialog/popup.vue\";\nimport { constants } from \"crypto\";\nexport default {\n components: {\n Popup: Popup\n },\n data: function data() {\n var valCARD = function valCARD(rule, val, callback) {\n var p = /^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$/;\n var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];\n var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];\n var code = val.substring(17);\n if (p.test(val)) {\n var sum = 0;\n for (var i = 0; i < 17; i++) {\n sum += val[i] * factor[i];\n }\n if (parity[sum % 11] == code.toUpperCase()) {\n callback();\n } else {\n callback(new Error('请输入正确身份证号码'));\n }\n callback();\n } else {\n callback(new Error('请输入正确身份证号码'));\n }\n };\n var orderTelRule = function orderTelRule(rule, value, callback) {\n var isPhone = /^1(3|4|5|7|8|9)\\d{9}$/;\n var isMob = /^\\d{8}$/;\n // var isMob = /^\\d{2,5}-\\d{7,8}$/\n if (isMob.test(value) || isPhone.test(value)) {\n callback();\n } else {\n callback(new Error(\"请输入正确格式的手机号码\"));\n }\n };\n return {\n indexCall: this.$route.query.index ? this.$route.query.index : window.localStorage.getItem(\"pageIndex\"),\n validation: false,\n completeTitle: \"\",\n nav: \"\",\n imgData: {},\n dialogImageUrl: \"\",\n dialogVisible: false,\n view: false,\n timeUpdate: \"\",\n ruleForm: {\n STAFF_NAME: \"\",\n SEX: \"\",\n CARD: \"\",\n PHONE: \"\",\n HEALTH: \"\",\n HEALTH_PHOTO: [],\n OPERATE_PHOTO: []\n },\n cardDesenShow: true,\n cardDesen: \"\",\n til: \"添加\",\n id: \"\",\n rules: {\n STAFF_NAME: [{\n required: true,\n message: \"请输入姓名\",\n trigger: \"blur\"\n }],\n SEX: [{\n required: true,\n message: \"请选择性别\",\n trigger: \"change\"\n }],\n CARD: [{\n required: true,\n message: \"请输入身份证号码\",\n trigger: \"blur\"\n }, {\n validator: valCARD,\n trigger: \"blur\"\n }],\n PHONE: [{\n required: true,\n message: \"请输入手机号码\",\n trigger: \"blur\"\n }, {\n validator: orderTelRule,\n trigger: \"blur\"\n }],\n HEALTH: [{\n required: true,\n message: \"请选择健康状态\",\n trigger: \"change\"\n }]\n },\n healthStatus: [],\n parentData: []\n };\n },\n created: function created() {},\n mounted: function mounted() {\n this.healthStatus = JSON.parse(this.$route.query.healthStatus);\n var data = this.$route.query.rowdata;\n console.log(data);\n if (data) {\n this.ruleForm.STAFF_NAME = data.STAFF_NAME;\n this.ruleForm.SEX = data.SEX;\n this.ruleForm.CARD = data.CARD;\n this.cardDesen = this.regular.tmIdCard(data.CARD);\n this.ruleForm.PHONE = data.PHONE;\n this.ruleForm.HEALTH = data.HEALTH;\n this.ruleForm.HEALTH_PHOTO = data.HEALTH_PHOTO ? data.HEALTH_PHOTO : [];\n this.ruleForm.OPERATE_PHOTO = data.OPERATE_PHOTO ? data.OPERATE_PHOTO : [];\n this.id = data.ID;\n this.til = data.til;\n //仅适用查看\n this.view = data ? data.view : false;\n }\n },\n methods: {\n cardBlur: function cardBlur(captain) {\n //*脱敏\n this.cardDesen = captain ? this.regular.tmIdCard(captain) : \"\"; //脱敏\n this.cardDesenShow = true;\n },\n /**返回上一级 */comeBack: function comeBack() {\n this.$router.push({\n name: \"canteen-staff-index\",\n params: {\n index: this.indexCall\n }\n });\n },\n submitForm: function submitForm(formName) {\n var _this2 = this;\n this.$refs[formName].validate(function (valid) {\n if (valid) {\n if (_this2.til == \"编辑\") {\n _this2.validation = true;\n _this2.completeTitle = \"编辑\";\n _this2.nav = \"是否编辑?\";\n } else {\n _this2.validation = true;\n _this2.completeTitle = \"添加\";\n _this2.nav = \"是否添加?\";\n }\n }\n });\n },\n closeDialogDel: function closeDialogDel(val) {\n var _this3 = this;\n if (val == \"2\") {\n var Content = {\n STAFF_NAME: this.ruleForm.STAFF_NAME,\n SEX: this.ruleForm.SEX,\n CARD: this.ruleForm.CARD,\n PHONE: this.ruleForm.PHONE,\n HEALTH: this.ruleForm.HEALTH,\n HEALTH_PHOTO: this.ruleForm.HEALTH_PHOTO.join(\"&#&\"),\n OPERATE_PHOTO: this.ruleForm.OPERATE_PHOTO.join(\"&#&\"),\n ID: this.id\n };\n // console.log(this.ruleForm.picture)\n modifyCanteenStaff(Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this3.$message({\n message: res.returnMsg,\n type: \"success\"\n });\n _this3.$router.push({\n name: \"canteen-staff-index\",\n params: {\n index: _this3.indexCall\n }\n });\n } else {\n _this3.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(err);\n });\n } else if (val == \"3\") {\n var _Content = {\n STAFF_NAME: this.ruleForm.STAFF_NAME,\n SEX: this.ruleForm.SEX,\n CARD: this.ruleForm.CARD,\n PHONE: this.ruleForm.PHONE,\n HEALTH: this.ruleForm.HEALTH,\n HEALTH_PHOTO: this.ruleForm.HEALTH_PHOTO.join(\"&#&\"),\n OPERATE_PHOTO: this.ruleForm.OPERATE_PHOTO.join(\"&#&\")\n };\n console.log(_Content);\n addCanteenStaff(_Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this3.$message({\n message: res.returnMsg,\n type: \"success\"\n });\n if (_this3.completeTitle == \"添加\") {\n _this3.$router.push({\n name: \"canteen-staff-index\",\n params: {\n index: 1\n }\n });\n }\n } else {\n _this3.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(err);\n });\n }\n // this.$refs[\"ruleForm\"].resetFields();\n this.validation = false;\n },\n handlePictureCardPreview: function handlePictureCardPreview(file) {\n this.dialogImageUrl = file.url;\n this.dialogVisible = true;\n },\n deleteImgs: function deleteImgs(index) {\n this.ruleForm.HEALTH_PHOTO.splice(index, 1);\n },\n changeFile: function changeFile(options, fileList) {\n // console.log(1111)\n var that = this;\n // 获取文件对象\n var file = options.raw;\n //判断图片类型\n if (file.type == \"image/jpeg\" || file.type == \"image/png\" || file.type == \"image/JPG\") {\n var isJPG = true;\n } else {\n isJPG = false;\n }\n // 判断图片大小\n var isLt2M = file.size / 1024 / 1024 < 2;\n if (!isJPG) {\n this.$message.error(\"上传产品图片只能是 JPG/PNG/JPEG 格式!\");\n }\n if (!isLt2M) {\n this.$message.error(\"上传产品图片大小不能超过 2MB!\");\n }\n // 创建一个HTML5的FileReader对象\n var reader = new FileReader();\n //创建一个img对象\n var img = new Image();\n var filename = options.filename;\n if (file) {\n reader.readAsDataURL(file);\n }\n if (isJPG && isLt2M) {\n reader.onload = function (e) {\n var base64Str = reader.result.split(\",\")[1];\n var newUrl;\n img.src = e.target.result;\n if (file.size / 1024 < 20) {\n that.$set(that.ruleForm.HEALTH_PHOTO, that.ruleForm.HEALTH_PHOTO.length, e.target.result);\n return;\n }\n // base64地址图片加载完毕后执行\n img.onload = function () {\n var _this = this;\n // 缩放图片需要的canvas(也可以在DOM中直接定义canvas标签,这样就能把压缩完的图片不转base64也能直接显示出来)\n var canvas = document.createElement(\"canvas\");\n var context = canvas.getContext(\"2d\");\n var wid = img.width;\n var hei = img.height;\n // 最大尺寸限制\n\n var maxWidth = 400,\n maxHeight = 400;\n if (wid > maxWidth || hei > maxHeight) {\n if (wid / hei > maxWidth / maxHeight) {\n maxHeight = Math.round(maxWidth * (hei / wid));\n } else {\n maxWidth = Math.round(maxHeight * (wid / hei));\n }\n } else {\n maxWidth = wid;\n maxHeight = hei;\n }\n\n // canvas对图片进行缩放\n canvas.width = maxWidth;\n canvas.height = maxHeight;\n context.drawImage(img, 0, 0, maxWidth, maxHeight);\n newUrl = canvas.toDataURL(\"image/jpeg\");\n var str = newUrl.replace(\"data:image/png;base64,\", \"\");\n // 找到等号,把等号也去掉\n var equalIndex = str.indexOf(\"=\");\n if (str.indexOf(\"=\") > 0) {\n str = str.substring(0, equalIndex);\n }\n var strLength = str.length;\n var fileLength = parseInt(strLength - strLength / 8 * 2);\n var size = \"\";\n size = (fileLength / 1024).toFixed(2);\n console.log(size);\n that.$set(that.ruleForm.HEALTH_PHOTO, that.ruleForm.HEALTH_PHOTO.length, newUrl);\n };\n };\n }\n },\n deleteImgs2: function deleteImgs2(index) {\n this.ruleForm.OPERATE_PHOTO.splice(index, 1);\n },\n changeFile2: function changeFile2(options, fileList) {\n // console.log(1111)\n var that = this;\n // 获取文件对象\n var file = options.raw;\n //判断图片类型\n if (file.type == \"image/jpeg\" || file.type == \"image/png\" || file.type == \"image/JPG\") {\n var isJPG = true;\n } else {\n isJPG = false;\n }\n // 判断图片大小\n var isLt2M = file.size / 1024 / 1024 < 2;\n if (!isJPG) {\n this.$message.error(\"上传产品图片只能是 JPG/PNG/JPEG 格式!\");\n }\n if (!isLt2M) {\n this.$message.error(\"上传产品图片大小不能超过 2MB!\");\n }\n // 创建一个HTML5的FileReader对象\n var reader = new FileReader();\n //创建一个img对象\n var img = new Image();\n var filename = options.filename;\n if (file) {\n reader.readAsDataURL(file);\n }\n if (isJPG && isLt2M) {\n reader.onload = function (e) {\n var base64Str = reader.result.split(\",\")[1];\n var newUrl;\n img.src = e.target.result;\n if (file.size / 1024 < 20) {\n that.$set(that.ruleForm.OPERATE_PHOTO, that.ruleForm.OPERATE_PHOTO.length, e.target.result);\n return;\n }\n // base64地址图片加载完毕后执行\n img.onload = function () {\n var _this = this;\n // 缩放图片需要的canvas(也可以在DOM中直接定义canvas标签,这样就能把压缩完的图片不转base64也能直接显示出来)\n var canvas = document.createElement(\"canvas\");\n var context = canvas.getContext(\"2d\");\n var wid = img.width;\n var hei = img.height;\n // 最大尺寸限制\n\n var maxWidth = 400,\n maxHeight = 400;\n if (wid > maxWidth || hei > maxHeight) {\n if (wid / hei > maxWidth / maxHeight) {\n maxHeight = Math.round(maxWidth * (hei / wid));\n } else {\n maxWidth = Math.round(maxHeight * (wid / hei));\n }\n } else {\n maxWidth = wid;\n maxHeight = hei;\n }\n\n // canvas对图片进行缩放\n canvas.width = maxWidth;\n canvas.height = maxHeight;\n context.drawImage(img, 0, 0, maxWidth, maxHeight);\n newUrl = canvas.toDataURL(\"image/jpeg\");\n var str = newUrl.replace(\"data:image/png;base64,\", \"\");\n // 找到等号,把等号也去掉\n var equalIndex = str.indexOf(\"=\");\n if (str.indexOf(\"=\") > 0) {\n str = str.substring(0, equalIndex);\n }\n var strLength = str.length;\n var fileLength = parseInt(strLength - strLength / 8 * 2);\n var size = \"\";\n size = (fileLength / 1024).toFixed(2);\n console.log(size);\n that.$set(that.ruleForm.OPERATE_PHOTO, that.ruleForm.OPERATE_PHOTO.length, newUrl);\n };\n };\n }\n },\n resetForm: function resetForm(formName) {\n if (!this.view) {\n this.$refs[formName].resetFields();\n }\n this.$router.push({\n name: \"canteen-staff-index\",\n params: {\n index: this.indexCall\n }\n });\n if (!this.view) {\n this.$message({\n message: \"取消成功\",\n type: \"success\",\n duration: 800\n });\n }\n },\n // 上传图片\n handleAvatarSuccess: function handleAvatarSuccess(res, file) {\n this.OPERATE_PHOTO = file;\n }\n }\n};",null]} |