1 line
10 KiB
JSON
1 line
10 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\\main-navbar-update-info.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\main-navbar-update-info.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\nimport debounce from 'lodash/debounce'\nimport { isEmail, isMobile } from '@/utils/validate'\nimport { clearLoginInfo } from '@/utils'\nexport default {\n data () {\n return {\n visible: false,\n loading:false,\n roleList: [],\n roleIdListDefault: [],\n dataForm: {\n realName: '',\n mobile: '',\n email: ''\n }\n }\n },\n computed: {\n dataRule () {\n var validateEmail = (rule, value, callback) => {\n if (!isEmail(value)) {\n return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.email') })))\n }\n callback()\n }\n var validateMobile = (rule, value, callback) => {\n if (!isMobile(value)) {\n return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.mobile') })))\n }\n callback()\n }\n return {\n realName: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n email: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' },\n { validator: isEmail, trigger: 'blur' }\n ],\n mobile: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' },\n { validator: isMobile, trigger: 'blur' }\n ]\n }\n }\n },\n created(){\n this.dataForm.id=this.$store.state.user.id;\n },\n methods: {\n init () {\n this.visible = true\n this.$nextTick(() => {\n this.$refs['dataForm'].resetFields();\n this.roleIdListDefault = [];\n Promise.all([\n this.getRoleList()\n ]).then(() => {\n if (this.dataForm.id) {\n this.getInfo()\n }\n })\n })\n },\n // 获取角色列表\n getRoleList () {\n return this.$http.get('/sys/role/list').then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.roleList = res.data\n }).catch(() => {})\n },\n getInfo(){\n this.$http.get(`/sys/user/${this.dataForm.id}`).then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.dataForm = {\n ...this.dataForm,\n ...res.data,\n roleIdList: []\n }\n // 角色配置, 区分是否为默认角色\n for (var i = 0; i < res.data.roleIdList.length; i++) {\n if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) {\n this.dataForm.roleIdList.push(res.data.roleIdList[i])\n continue\n }\n this.roleIdListDefault.push(res.data.roleIdList[i])\n }\n }).catch(() => {})\n },\n // 表单提交\n dataFormSubmitHandle: debounce(function () {\n this.$refs['dataForm'].validate((valid) => {\n if (!valid) {\n return false\n }\n this.loading=true;\n this.$http['put']('/sys/user', {\n ...this.dataForm,\n roleIdList: [\n ...this.dataForm.roleIdList,\n ...this.roleIdListDefault\n ]\n }).then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.$message({\n message: this.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: () => {\n this.visible = false\n this.$emit('refreshDataList')\n }\n })\n })\n .finally(()=>{\n this.loading=true;\n })\n })\n }, 1000, { 'leading': true, 'trailing': false })\n }\n}\n",{"version":3,"sources":["main-navbar-update-info.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"main-navbar-update-info.vue","sourceRoot":"src/views","sourcesContent":["<template>\n <el-dialog\n :visible.sync=\"visible\"\n title=\"修改个人信息\"\n :close-on-click-modal=\"false\"\n :close-on-press-escape=\"false\"\n :append-to-body=\"true\">\n <el-form :model=\"dataForm\" :rules=\"dataRule\" ref=\"dataForm\" label-width=\"120px\">\n <el-form-item prop=\"realName\" :label=\"$t('user.realName')\">\n <el-input v-model=\"dataForm.realName\" :placeholder=\"$t('user.realName')\"></el-input>\n </el-form-item>\n <el-form-item prop=\"mobile\" label=\"联系电话\">\n <el-input v-model=\"dataForm.mobile\" :placeholder=\"$t('user.mobile')\"></el-input>\n </el-form-item>\n <el-form-item prop=\"email\" label=\"邮箱\">\n <el-input v-model=\"dataForm.email\" :placeholder=\"$t('user.email')\"></el-input>\n </el-form-item>\n </el-form>\n <template slot=\"footer\">\n <el-button @click=\"visible = false\">{{ $t('cancel') }}</el-button>\n <el-button type=\"primary\" v-loading=\"loading\" @click=\"dataFormSubmitHandle()\">{{ $t('confirm') }}</el-button>\n </template>\n </el-dialog>\n</template>\n\n<script>\nimport debounce from 'lodash/debounce'\nimport { isEmail, isMobile } from '@/utils/validate'\nimport { clearLoginInfo } from '@/utils'\nexport default {\n data () {\n return {\n visible: false,\n loading:false,\n roleList: [],\n roleIdListDefault: [],\n dataForm: {\n realName: '',\n mobile: '',\n email: ''\n }\n }\n },\n computed: {\n dataRule () {\n var validateEmail = (rule, value, callback) => {\n if (!isEmail(value)) {\n return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.email') })))\n }\n callback()\n }\n var validateMobile = (rule, value, callback) => {\n if (!isMobile(value)) {\n return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.mobile') })))\n }\n callback()\n }\n return {\n realName: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n email: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' },\n { validator: isEmail, trigger: 'blur' }\n ],\n mobile: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' },\n { validator: isMobile, trigger: 'blur' }\n ]\n }\n }\n },\n created(){\n this.dataForm.id=this.$store.state.user.id;\n },\n methods: {\n init () {\n this.visible = true\n this.$nextTick(() => {\n this.$refs['dataForm'].resetFields();\n this.roleIdListDefault = [];\n Promise.all([\n this.getRoleList()\n ]).then(() => {\n if (this.dataForm.id) {\n this.getInfo()\n }\n })\n })\n },\n // 获取角色列表\n getRoleList () {\n return this.$http.get('/sys/role/list').then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.roleList = res.data\n }).catch(() => {})\n },\n getInfo(){\n this.$http.get(`/sys/user/${this.dataForm.id}`).then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.dataForm = {\n ...this.dataForm,\n ...res.data,\n roleIdList: []\n }\n // 角色配置, 区分是否为默认角色\n for (var i = 0; i < res.data.roleIdList.length; i++) {\n if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) {\n this.dataForm.roleIdList.push(res.data.roleIdList[i])\n continue\n }\n this.roleIdListDefault.push(res.data.roleIdList[i])\n }\n }).catch(() => {})\n },\n // 表单提交\n dataFormSubmitHandle: debounce(function () {\n this.$refs['dataForm'].validate((valid) => {\n if (!valid) {\n return false\n }\n this.loading=true;\n this.$http['put']('/sys/user', {\n ...this.dataForm,\n roleIdList: [\n ...this.dataForm.roleIdList,\n ...this.roleIdListDefault\n ]\n }).then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.$message({\n message: this.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: () => {\n this.visible = false\n this.$emit('refreshDataList')\n }\n })\n })\n .finally(()=>{\n this.loading=true;\n })\n })\n }, 1000, { 'leading': true, 'trailing': false })\n }\n}\n</script>\n"]}]} |