{"remainingRequest":"D:\\HTC\\program\\善行少年\\security-enterprise-admin\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\HTC\\program\\善行少年\\security-enterprise-admin\\src\\views\\modules\\sys\\role-add-or-update.vue?vue&type=script&lang=js","dependencies":[{"path":"D:\\HTC\\program\\善行少年\\security-enterprise-admin\\src\\views\\modules\\sys\\role-add-or-update.vue","mtime":1581948666000},{"path":"D:\\HTC\\program\\善行少年\\security-enterprise-admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\HTC\\program\\善行少年\\security-enterprise-admin\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"D:\\HTC\\program\\善行少年\\security-enterprise-admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\HTC\\program\\善行少年\\security-enterprise-admin\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["\r\nimport debounce from 'lodash/debounce'\r\nexport default {\r\n data () {\r\n return {\r\n visible: false,\r\n menuList: [],\r\n deptList: [],\r\n dataForm: {\r\n id: '',\r\n name: '',\r\n menuIdList: [],\r\n deptIdList: [],\r\n remark: ''\r\n }\r\n }\r\n },\r\n computed: {\r\n dataRule () {\r\n return {\r\n name: [\r\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\r\n ]\r\n }\r\n }\r\n },\r\n methods: {\r\n init () {\r\n this.visible = true\r\n this.$nextTick(() => {\r\n this.$refs['dataForm'].resetFields()\r\n this.$refs.menuListTree.setCheckedKeys([])\r\n this.$refs.deptListTree.setCheckedKeys([])\r\n Promise.all([\r\n this.getMenuList(),\r\n this.getDeptList()\r\n ]).then(() => {\r\n if (this.dataForm.id) {\r\n this.getInfo()\r\n }\r\n })\r\n })\r\n },\r\n // 获取菜单列表\r\n getMenuList () {\r\n return this.$http.get('/sys/menu/select').then(({ data: res }) => {\r\n if (res.code !== 0) {\r\n return this.$message.error(res.msg)\r\n }\r\n this.menuList = res.data\r\n }).catch(() => {})\r\n },\r\n // 获取部门列表\r\n getDeptList () {\r\n return this.$http.get('/sys/dept/list').then(({ data: res }) => {\r\n if (res.code !== 0) {\r\n return this.$message.error(res.msg)\r\n }\r\n this.deptList = res.data\r\n }).catch(() => {})\r\n },\r\n // 获取信息\r\n getInfo () {\r\n this.$http.get(`/sys/role/${this.dataForm.id}`).then(({ data: res }) => {\r\n if (res.code !== 0) {\r\n return this.$message.error(res.msg)\r\n }\r\n this.dataForm = {\r\n ...this.dataForm,\r\n ...res.data\r\n }\r\n this.dataForm.menuIdList.forEach(item => this.$refs.menuListTree.setChecked(item, true))\r\n this.$refs.deptListTree.setCheckedKeys(this.dataForm.deptIdList)\r\n }).catch(() => {})\r\n },\r\n // 表单提交\r\n dataFormSubmitHandle: debounce(function () {\r\n this.$refs['dataForm'].validate((valid) => {\r\n if (!valid) {\r\n return false\r\n }\r\n this.dataForm.menuIdList = [\r\n ...this.$refs.menuListTree.getHalfCheckedKeys(),\r\n ...this.$refs.menuListTree.getCheckedKeys()\r\n ]\r\n this.dataForm.deptIdList = this.$refs.deptListTree.getCheckedKeys()\r\n this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/role', this.dataForm).then(({ data: res }) => {\r\n if (res.code !== 0) {\r\n return this.$message.error(res.msg)\r\n }\r\n this.$message({\r\n message: this.$t('prompt.success'),\r\n type: 'success',\r\n duration: 500,\r\n onClose: () => {\r\n this.visible = false\r\n this.$emit('refreshDataList')\r\n }\r\n })\r\n }).catch(() => {})\r\n })\r\n }, 1000, { 'leading': true, 'trailing': false })\r\n }\r\n}\r\n",{"version":3,"sources":["role-add-or-update.vue"],"names":[],"mappings":";AA4CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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":"role-add-or-update.vue","sourceRoot":"src/views/modules/sys","sourcesContent":["\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {{ $t('cancel') }}\r\n {{ $t('confirm') }}\r\n \r\n \r\n\r\n\r\n\r\n"]}]}