{"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\\sys\\notice-add-or-update.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\sys\\notice-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\nimport Cookies from 'js-cookie'\nimport debounce from 'lodash/debounce'\nimport 'quill/dist/quill.snow.css'\nimport Quill from 'quill'\nexport default {\n data () {\n return {\n visible: false,\n quillEditor: null,\n quillEditorToolbarOptions: [\n ['bold', 'italic', 'underline', 'strike'],\n ['image'],\n [{ 'list': 'ordered' }, { 'list': 'bullet' }],\n [{ 'size': ['small', false, 'large', 'huge'] }],\n [{ 'color': [] }, { 'background': [] }],\n ['clean']\n ],\n uploadUrl: '',\n deptList: [],\n dataForm: {\n id: '',\n type: 0,\n title: '',\n content: '',\n receiverType: 0,\n receiverTypeIds: '',\n receiverTypeList: [],\n status: '',\n senderName: '',\n senderDate: '',\n creator: '',\n createDate: ''\n }\n }\n },\n computed: {\n dataRule () {\n var validateContent = (rule, value, callback) => {\n if (this.quillEditor.getLength() <= 1) {\n return callback(new Error(this.$t('validate.required')))\n }\n callback()\n }\n return {\n type: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n title: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n content: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' },\n { validator: validateContent, trigger: 'blur' }\n ],\n receiverType: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n receiverTypeIds: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n status: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n senderName: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ]\n }\n }\n },\n methods: {\n init () {\n this.visible = true\n this.$nextTick(() => {\n if (this.quillEditor) {\n this.quillEditor.deleteText(0, this.quillEditor.getLength())\n } else {\n this.quillEditorHandle()\n }\n this.$refs['dataForm'].resetFields()\n Promise.all([\n this.getDeptList()\n ]).then(() => {\n if (this.dataForm.id) {\n this.getInfo()\n }\n })\n })\n },\n // 富文本编辑器\n quillEditorHandle () {\n this.quillEditor = new Quill('#J_quillEditor', {\n modules: {\n toolbar: this.quillEditorToolbarOptions\n },\n theme: 'snow'\n })\n // 自定义上传图片功能 (使用element upload组件)\n this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/sys/oss/upload?access_token=${Cookies.get('access_token')}`\n this.quillEditor.getModule('toolbar').addHandler('image', () => {\n this.$refs.uploadBtn.$el.click()\n })\n // 监听内容变化,动态赋值\n this.quillEditor.on('text-change', () => {\n this.dataForm.content = this.quillEditor.root.innerHTML\n })\n },\n // 上传图片之前\n uploadBeforeUploadHandle (file) {\n if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {\n this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' }))\n return false\n }\n },\n // 上传图片成功\n uploadSuccessHandle (res, file, fileList) {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.src)\n },\n // 获取部门列表\n getDeptList () {\n return this.$http.get('/sys/dept/list').then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.deptList = res.data\n }).catch(() => {})\n },\n // 获取信息\n getInfo () {\n this.$http.get(`/sys/notice/${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 }\n\n this.quillEditor.root.innerHTML = this.dataForm.content\n\n // 接受者为部门\n if (this.dataForm.receiverType === 1) {\n this.$refs.deptListTree.setCheckedKeys(res.data.receiverTypeIds.split(','))\n }\n }).catch(() => {})\n },\n // 表单提交\n dataFormSubmitHandle: debounce(function (status) {\n this.$refs['dataForm'].validate((valid) => {\n if (!valid) {\n return false\n }\n // 接受者为部门\n if (this.dataForm.receiverType === 1) {\n this.dataForm.receiverTypeIds = this.$refs.deptListTree.getCheckedKeys().join(',')\n this.dataForm.receiverTypeList = this.$refs.deptListTree.getCheckedKeys()\n } else {\n this.dataForm.receiverTypeIds = ''\n }\n this.dataForm.status = status\n this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/notice/', this.dataForm).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 }).catch(() => {})\n })\n }, 1000, { 'leading': true, 'trailing': false })\n }\n}\n",{"version":3,"sources":["notice-add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;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","file":"notice-add-or-update.vue","sourceRoot":"src/views/modules/sys","sourcesContent":["\n \n \n \n \n \n \n \n \n \n \n \n \n \n {{ $t('upload.button') }}\n \n \n \n \n {{ $t('notice.receiverType0') }}\n {{ $t('notice.receiverType1') }}\n \n \n \n \n \n \n \n \n {{ $t('cancel') }}\n {{ $t('notice.draft') }}\n {{ $t('notice.release') }}\n \n \n\n\n\n"]}]}