|
|
@@ -1,16 +1,6 @@
|
|
|
<template>
|
|
|
- <el-dialog
|
|
|
- :title="title"
|
|
|
- :visible.sync="dialogVisible"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false"
|
|
|
- append-to-body
|
|
|
- width="65%"
|
|
|
- top="10vh"
|
|
|
- custom-class="dialog"
|
|
|
- @open="getform"
|
|
|
- @close="closeDialog"
|
|
|
- >
|
|
|
+ <el-dialog :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" :close-on-press-escape="false"
|
|
|
+ append-to-body width="65%" top="10vh" custom-class="dialog" @open="getform" @close="closeDialog">
|
|
|
<el-row class="notice-container">
|
|
|
<!-- <div style="padding-left:65px;">
|
|
|
<span class="photo-area" @click="dialogPictureVisible = !readonly">
|
|
|
@@ -35,13 +25,7 @@
|
|
|
@action-event="uploaderPictureAction"
|
|
|
@close="visible => dialogPictureVisible = visible"
|
|
|
/> -->
|
|
|
- <el-form
|
|
|
- ref="form"
|
|
|
- :rules="rules"
|
|
|
- :model="form"
|
|
|
- label-width="100px"
|
|
|
- @submit.native.prevent
|
|
|
- >
|
|
|
+ <el-form ref="form" :rules="rules" :model="form" label-width="100px" @submit.native.prevent>
|
|
|
<!-- <el-form-item label="发布选项:" prop="publicItem">
|
|
|
<el-radio-group v-model="form.publicItem">
|
|
|
<el-radio label="notices">发布公告</el-radio>
|
|
|
@@ -110,44 +94,27 @@
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="发布时间:" prop="publicDate">
|
|
|
- <el-date-picker
|
|
|
- v-model="form.publicDate"
|
|
|
- type="date"
|
|
|
- style="width: 100%"
|
|
|
- placeholder="选择日期"
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- />
|
|
|
+ <el-date-picker v-model="form.publicDate" type="date" style="width: 100%" placeholder="选择日期"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="失效时间:" prop="loseDate">
|
|
|
- <el-date-picker
|
|
|
- v-model="form.loseDate"
|
|
|
- type="date"
|
|
|
- style="width: 100%"
|
|
|
- placeholder="选择日期,不可早于发布时间"
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- />
|
|
|
+ <el-date-picker v-model="form.loseDate" type="date" style="width: 100%" placeholder="选择日期,不可早于发布时间"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-form-item label="附件:" prop="fileAttach">
|
|
|
- <ibps-attachment-selector
|
|
|
- v-model="form.fileAttach"
|
|
|
- accept="*"
|
|
|
- multiple
|
|
|
- />
|
|
|
+ <ibps-attachment-selector v-model="form.fileAttach" accept="*" multiple />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="内容:" prop="content">
|
|
|
<ibps-ueditor v-model="form.content" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
- <ibps-uploader
|
|
|
- :visible="dialogFormVisible"
|
|
|
- @action-event="uploaderAction"
|
|
|
- @close="(visible) => (dialogFormVisible = visible)"
|
|
|
- />
|
|
|
+ <ibps-uploader :visible="dialogFormVisible" @action-event="uploaderAction"
|
|
|
+ @close="(visible) => (dialogFormVisible = visible)" />
|
|
|
<div slot="footer" class="el-dialog--center">
|
|
|
<ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
|
|
|
</div>
|
|
|
@@ -155,347 +122,348 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { fileUrl } from '@/api/platform/file/attachment'
|
|
|
- import { save, get } from '@/api/platform/system/news'
|
|
|
- import { typeOptions } from './constants'
|
|
|
- import ActionUtils from '@/utils/action'
|
|
|
- import { getFile } from '@/utils/avatar'
|
|
|
- import IbpsTypeSelect from '@/business/platform/cat/type/select'
|
|
|
- import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
|
|
|
- import IbpsOrgSelector from '@/business/platform/org/org/selector'
|
|
|
+import { fileUrl } from '@/api/platform/file/attachment'
|
|
|
+import { get, save } from '@/api/platform/system/news'
|
|
|
+import IbpsTypeSelect from '@/business/platform/cat/type/select'
|
|
|
+import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
|
|
|
+import IbpsOrgSelector from '@/business/platform/org/org/selector'
|
|
|
+import ActionUtils from '@/utils/action'
|
|
|
+import { getFile } from '@/utils/avatar'
|
|
|
+import { typeOptions } from './constants'
|
|
|
|
|
|
- import IbpsUploader from '@/business/platform/file/uploader'
|
|
|
+import IbpsUploader from '@/business/platform/file/uploader'
|
|
|
|
|
|
- import IbpsUeditor from '@/components/ibps-ueditor'
|
|
|
- import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
|
|
|
+import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
|
|
|
+import IbpsUeditor from '@/components/ibps-ueditor'
|
|
|
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- IbpsUeditor,
|
|
|
- IbpsTypeSelect,
|
|
|
- IbpsEmployeeSelector,
|
|
|
- IbpsOrgSelector,
|
|
|
- IbpsUploader,
|
|
|
- IbpsAttachmentSelector,
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ IbpsUeditor,
|
|
|
+ IbpsTypeSelect,
|
|
|
+ IbpsEmployeeSelector,
|
|
|
+ IbpsOrgSelector,
|
|
|
+ IbpsUploader,
|
|
|
+ IbpsAttachmentSelector,
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ visible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
},
|
|
|
- props: {
|
|
|
- visible: {
|
|
|
- type: Boolean,
|
|
|
- default: false,
|
|
|
+ readonly: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ id: String,
|
|
|
+ title: String,
|
|
|
+ status: String,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ const { first = '', second = '' } = this.$store.getters.level || {}
|
|
|
+ const { positions = [] } = this.$store.getters.userInfo || {}
|
|
|
+ const position = positions.length ? positions[0] : {}
|
|
|
+ return {
|
|
|
+ limit: 1,
|
|
|
+ accept: '.jpeg,.gif,.png,.jpg', // 规定上传类型
|
|
|
+ formName: 'form',
|
|
|
+ dialogVisible: this.visible,
|
|
|
+ dialogLoading: false,
|
|
|
+ dialogFormVisible: false, // 弹窗
|
|
|
+ dialogPictureVisible: false, // 弹窗
|
|
|
+ typeOptions: typeOptions,
|
|
|
+ defaultForm: {},
|
|
|
+ show: '',
|
|
|
+ formsId: this.id,
|
|
|
+ form: {
|
|
|
+ author: '',
|
|
|
+ content: '',
|
|
|
+ createBy: '',
|
|
|
+ createOrgId: '',
|
|
|
+ createTime: '',
|
|
|
+ dataStatus: '',
|
|
|
+ dbtype: '',
|
|
|
+ depId: position.id,
|
|
|
+ depName: position.name,
|
|
|
+ fileAttach: '',
|
|
|
+ id: '',
|
|
|
+ ip: '',
|
|
|
+ public0: 'Y',
|
|
|
+ includeChild: 'N',
|
|
|
+ key: '',
|
|
|
+ loseDate: '',
|
|
|
+ name: '',
|
|
|
+ picture: '',
|
|
|
+ pk: '',
|
|
|
+ publicDate: this.$common.getDateNow(19),
|
|
|
+ publicItem: 'notices',
|
|
|
+ status: '',
|
|
|
+ tenantId: '',
|
|
|
+ title: '',
|
|
|
+ // 改字段暂时无用,改存当前层级第一级ID
|
|
|
+ type: second || first,
|
|
|
+ typeId: '',
|
|
|
+ updateBy: '',
|
|
|
+ updateTime: '',
|
|
|
+ userId: this.$store.getters.userId,
|
|
|
+ userName: this.$store.getters.name,
|
|
|
},
|
|
|
- readonly: {
|
|
|
- type: Boolean,
|
|
|
- default: false,
|
|
|
+ rules: {
|
|
|
+ typeId: [{ required: true, message: this.$t('validate.required') }],
|
|
|
+ title: [{ required: true, message: this.$t('validate.required') }],
|
|
|
+ userId: [{ required: true, message: this.$t('validate.required') }],
|
|
|
+ publicDate: [
|
|
|
+ { required: true, message: this.$t('validate.required') },
|
|
|
+ ],
|
|
|
+ content: [{ required: true, message: this.$t('validate.required') }],
|
|
|
},
|
|
|
- id: String,
|
|
|
- title: String,
|
|
|
- status: String,
|
|
|
- },
|
|
|
- data() {
|
|
|
- const { first = '', second = '' } = this.$store.getters.level || {}
|
|
|
- const { positions = [] } = this.$store.getters.userInfo || {}
|
|
|
- const position = positions.length ? positions[0] : {}
|
|
|
- return {
|
|
|
- limit: 1,
|
|
|
- accept: '.jpeg,.gif,.png,.jpg', // 规定上传类型
|
|
|
- formName: 'form',
|
|
|
- dialogVisible: this.visible,
|
|
|
- dialogLoading: false,
|
|
|
- dialogFormVisible: false, // 弹窗
|
|
|
- dialogPictureVisible: false, // 弹窗
|
|
|
- typeOptions: typeOptions,
|
|
|
- defaultForm: {},
|
|
|
- show: '',
|
|
|
- formsId: this.id,
|
|
|
- form: {
|
|
|
- author: '',
|
|
|
- content: '',
|
|
|
- createBy: '',
|
|
|
- createOrgId: '',
|
|
|
- createTime: '',
|
|
|
- dataStatus: '',
|
|
|
- dbtype: '',
|
|
|
- depId: position.id,
|
|
|
- depName: position.name,
|
|
|
- fileAttach: '',
|
|
|
- id: '',
|
|
|
- ip: '',
|
|
|
- public0: 'Y',
|
|
|
- includeChild: 'N',
|
|
|
- key: '',
|
|
|
- loseDate: '',
|
|
|
- name: '',
|
|
|
- picture: '',
|
|
|
- pk: '',
|
|
|
- publicDate: this.$common.getDateNow(19),
|
|
|
- publicItem: 'notices',
|
|
|
- status: '',
|
|
|
- tenantId: '',
|
|
|
- title: '',
|
|
|
- // 改字段暂时无用,改存当前层级第一级ID
|
|
|
- type: second || first,
|
|
|
- typeId: '',
|
|
|
- updateBy: '',
|
|
|
- updateTime: '',
|
|
|
- userId: this.$store.getters.userId,
|
|
|
- userName: this.$store.getters.name,
|
|
|
- },
|
|
|
- rules: {
|
|
|
- typeId: [{ required: true, message: this.$t('validate.required') }],
|
|
|
- title: [{ required: true, message: this.$t('validate.required') }],
|
|
|
- userId: [{ required: true, message: this.$t('validate.required') }],
|
|
|
- publicDate: [
|
|
|
- { required: true, message: this.$t('validate.required') },
|
|
|
- ],
|
|
|
- content: [{ required: true, message: this.$t('validate.required') }],
|
|
|
- },
|
|
|
- toolbars: [
|
|
|
- {
|
|
|
- key: 'save',
|
|
|
- icon: 'ibps-icon-send',
|
|
|
- label: '发布',
|
|
|
- type: 'success',
|
|
|
- hidden: () => {
|
|
|
- return this.readonly
|
|
|
- },
|
|
|
+ toolbars: [
|
|
|
+ {
|
|
|
+ key: 'save',
|
|
|
+ icon: 'ibps-icon-send',
|
|
|
+ label: '发布',
|
|
|
+ type: 'success',
|
|
|
+ hidden: () => {
|
|
|
+ return this.readonly
|
|
|
},
|
|
|
- {
|
|
|
- key: 'drafts',
|
|
|
- icon: 'ibps-icon-save',
|
|
|
- label: '存为草稿',
|
|
|
- hidden: () => {
|
|
|
- return this.readonly
|
|
|
- },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'drafts',
|
|
|
+ icon: 'ibps-icon-save',
|
|
|
+ label: '存为草稿',
|
|
|
+ hidden: () => {
|
|
|
+ return this.readonly
|
|
|
},
|
|
|
- { key: 'cancel' },
|
|
|
- ],
|
|
|
- }
|
|
|
+ },
|
|
|
+ { key: 'cancel' },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ formId() {
|
|
|
+ return this.id
|
|
|
},
|
|
|
- computed: {
|
|
|
- formId() {
|
|
|
- return this.id
|
|
|
- },
|
|
|
- image() {
|
|
|
- return getFile(this.form.picture)
|
|
|
- },
|
|
|
+ image() {
|
|
|
+ return getFile(this.form.picture)
|
|
|
},
|
|
|
- watch: {
|
|
|
- visible: {
|
|
|
- handler: function (val, oldVal) {
|
|
|
- this.dialogVisible = this.visible
|
|
|
- },
|
|
|
- immediate: true,
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ visible: {
|
|
|
+ handler: function (val, oldVal) {
|
|
|
+ this.dialogVisible = this.visible
|
|
|
},
|
|
|
+ immediate: true,
|
|
|
},
|
|
|
- created() {
|
|
|
- this.defaultForm = JSON.parse(JSON.stringify(this.form))
|
|
|
- this.form.userId = this.$store.getters.userId
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.defaultForm = JSON.parse(JSON.stringify(this.form))
|
|
|
+ this.form.userId = this.$store.getters.userId
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleActionEvent({ key }) {
|
|
|
+ switch (key) {
|
|
|
+ case 'save':
|
|
|
+ this.handleSave()
|
|
|
+ break
|
|
|
+ case 'drafts':
|
|
|
+ this.handleDrafts()
|
|
|
+ break
|
|
|
+ case 'cancel':
|
|
|
+ this.closeDialog()
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
},
|
|
|
- methods: {
|
|
|
- handleActionEvent({ key }) {
|
|
|
- switch (key) {
|
|
|
- case 'save':
|
|
|
- this.handleSave()
|
|
|
- break
|
|
|
- case 'drafts':
|
|
|
- this.handleDrafts()
|
|
|
- break
|
|
|
- case 'cancel':
|
|
|
- this.closeDialog()
|
|
|
- break
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
- },
|
|
|
- // 选择图片附件区
|
|
|
- /**
|
|
|
- * 上传
|
|
|
- */
|
|
|
- handleUpload() {
|
|
|
- this.dialogFormVisible = true
|
|
|
- },
|
|
|
- uploaderAction(buttonKey, data) {
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.form.fileAttach = data.id
|
|
|
- },
|
|
|
- uploaderPictureAction(buttonKey, data) {
|
|
|
- this.dialogPictureVisible = false
|
|
|
- this.form.picture = fileUrl(data.id || data[0].id)
|
|
|
- },
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- return true
|
|
|
- },
|
|
|
- handleAvatarSuccess(res, file) {
|
|
|
- this.form.imageUrl = URL.createObjectURL(file.raw)
|
|
|
- },
|
|
|
- // 填写编辑区
|
|
|
- handleInput(data) {
|
|
|
- this.form.userId = data.id
|
|
|
- this.form.userName = data.name
|
|
|
- },
|
|
|
- depNameInput(data) {
|
|
|
- this.form.depId = data
|
|
|
- },
|
|
|
- callbackDepName(data) {
|
|
|
- const arr = []
|
|
|
- data.forEach((i) => {
|
|
|
- arr.push(i.name)
|
|
|
- })
|
|
|
- this.form.depName = arr.join(' ')
|
|
|
- },
|
|
|
- change(data) {
|
|
|
- this.show = data
|
|
|
- },
|
|
|
- // 发布
|
|
|
- handleSave() {
|
|
|
- this.form.status = 'publish'
|
|
|
- this.$refs[this.formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- // 置顶公告必须选择图片
|
|
|
- if (this.image === '' && this.form.publicItem === 'top') {
|
|
|
- ActionUtils.warning('请选择封面图片')
|
|
|
- } else {
|
|
|
- this.saveData()
|
|
|
- }
|
|
|
+ // 选择图片附件区
|
|
|
+ /**
|
|
|
+ * 上传
|
|
|
+ */
|
|
|
+ handleUpload() {
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ },
|
|
|
+ uploaderAction(buttonKey, data) {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.form.fileAttach = data.id
|
|
|
+ },
|
|
|
+ uploaderPictureAction(buttonKey, data) {
|
|
|
+ this.dialogPictureVisible = false
|
|
|
+ this.form.picture = fileUrl(data.id || data[0].id)
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ handleAvatarSuccess(res, file) {
|
|
|
+ this.form.imageUrl = URL.createObjectURL(file.raw)
|
|
|
+ },
|
|
|
+ // 填写编辑区
|
|
|
+ handleInput(data) {
|
|
|
+ this.form.userId = data.id
|
|
|
+ this.form.userName = data.name
|
|
|
+ },
|
|
|
+ depNameInput(data) {
|
|
|
+ this.form.depId = data
|
|
|
+ },
|
|
|
+ callbackDepName(data) {
|
|
|
+ const arr = []
|
|
|
+ data.forEach((i) => {
|
|
|
+ arr.push(i.name)
|
|
|
+ })
|
|
|
+ this.form.depName = arr.join(' ')
|
|
|
+ },
|
|
|
+ change(data) {
|
|
|
+ this.show = data
|
|
|
+ },
|
|
|
+ // 发布
|
|
|
+ handleSave() {
|
|
|
+ this.form.status = 'publish'
|
|
|
+ this.$refs[this.formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ // 置顶公告必须选择图片
|
|
|
+ if (this.image === '' && this.form.publicItem === 'top') {
|
|
|
+ ActionUtils.warning('请选择封面图片')
|
|
|
} else {
|
|
|
- ActionUtils.saveErrorMessage()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 保存草稿
|
|
|
- handleDrafts() {
|
|
|
- this.form.status = 'drafts'
|
|
|
- this.$refs[this.formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
this.saveData()
|
|
|
- } else {
|
|
|
- ActionUtils.saveErrorMessage()
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- // 保存数据
|
|
|
- saveData() {
|
|
|
- const data = JSON.parse(JSON.stringify(this.form))
|
|
|
- data.publicDate = new Date(this.form.publicDate).getTime() || ''
|
|
|
- data.loseDate = new Date(this.form.loseDate).getTime() || ''
|
|
|
- // 检测失效日期是否发布日期在之前。
|
|
|
- if (data.publicDate > data.loseDate && data.loseDate !== '') {
|
|
|
- ActionUtils.error('发布时间与失效时间范围不合法!')
|
|
|
- return
|
|
|
+ } else {
|
|
|
+ ActionUtils.saveErrorMessage()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 保存草稿
|
|
|
+ handleDrafts() {
|
|
|
+ this.form.status = 'drafts'
|
|
|
+ this.$refs[this.formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.saveData()
|
|
|
+ } else {
|
|
|
+ ActionUtils.saveErrorMessage()
|
|
|
}
|
|
|
- save(this.form)
|
|
|
- .then((response) => {
|
|
|
- this.$emit('callback', this)
|
|
|
- ActionUtils.saveSuccessMessage(response.message, (rtn) => {
|
|
|
- if (rtn) {
|
|
|
- this.closeDialog()
|
|
|
- } else {
|
|
|
- if (this.form.status === 'drafts') {
|
|
|
- return
|
|
|
- }
|
|
|
- this.form.depId = ''
|
|
|
- this.form.picture = ''
|
|
|
- this.$refs[this.formName].resetFields()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 保存数据
|
|
|
+ saveData() {
|
|
|
+ const data = JSON.parse(JSON.stringify(this.form))
|
|
|
+ data.publicDate = new Date(this.form.publicDate).getTime() || ''
|
|
|
+ data.loseDate = new Date(this.form.loseDate).getTime() || ''
|
|
|
+ // 检测失效日期是否发布日期在之前。
|
|
|
+ if (data.publicDate > data.loseDate && data.loseDate !== '') {
|
|
|
+ ActionUtils.error('发布时间与失效时间范围不合法!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ save(this.form)
|
|
|
+ .then((response) => {
|
|
|
+ this.$emit('callback', this)
|
|
|
+ ActionUtils.saveSuccessMessage(response.message, (rtn) => {
|
|
|
+ if (rtn) {
|
|
|
+ this.closeDialog()
|
|
|
+ } else {
|
|
|
+ if (this.form.status === 'drafts') {
|
|
|
+ return
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error(err)
|
|
|
+ this.form.depId = ''
|
|
|
+ this.form.picture = ''
|
|
|
+ this.$refs[this.formName].resetFields()
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
- // 关闭当前窗口
|
|
|
- closeDialog() {
|
|
|
- this.$emit('close', false)
|
|
|
- this.show = ''
|
|
|
- this.$refs[this.formName].resetFields()
|
|
|
- },
|
|
|
- /**
|
|
|
- * 表单验证
|
|
|
- */
|
|
|
- formValidate() {
|
|
|
- if (this.readonly) return
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs[this.formName].validate(() => {})
|
|
|
})
|
|
|
- },
|
|
|
- /**
|
|
|
- * 获取表单数据
|
|
|
- */
|
|
|
- getform() {
|
|
|
- this.form.userName = this.$store.getters.name
|
|
|
- if (this.$utils.isEmpty(this.formId)) {
|
|
|
- // 重置表单
|
|
|
- const firstDate = new Date()
|
|
|
- this.form.publicDate = firstDate.setDate(1)
|
|
|
- this.form = JSON.parse(JSON.stringify(this.defaultForm))
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 关闭当前窗口
|
|
|
+ closeDialog() {
|
|
|
+ this.$emit('close', false)
|
|
|
+ this.show = ''
|
|
|
+ this.$refs[this.formName].resetFields()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 表单验证
|
|
|
+ */
|
|
|
+ formValidate() {
|
|
|
+ if (this.readonly) return
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs[this.formName].validate(() => { })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取表单数据
|
|
|
+ */
|
|
|
+ getform() {
|
|
|
+ this.form.userName = this.$store.getters.name
|
|
|
+ if (this.$utils.isEmpty(this.formId)) {
|
|
|
+ // 重置表单
|
|
|
+ const firstDate = new Date()
|
|
|
+ this.form.publicDate = firstDate.setDate(1)
|
|
|
+ this.form = JSON.parse(JSON.stringify(this.defaultForm))
|
|
|
+ this.formValidate()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.dialogLoading = true
|
|
|
+ get({
|
|
|
+ newsId: this.formId,
|
|
|
+ })
|
|
|
+ .then((response) => {
|
|
|
+ this.form = response.data
|
|
|
+ this.show = this.form.public0
|
|
|
this.formValidate()
|
|
|
- return
|
|
|
- }
|
|
|
- this.dialogLoading = true
|
|
|
- get({
|
|
|
- newsId: this.formId,
|
|
|
+ this.dialogLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.dialogLoading = false
|
|
|
})
|
|
|
- .then((response) => {
|
|
|
- this.form = response.data
|
|
|
- this.show = this.form.public0
|
|
|
- this.formValidate()
|
|
|
- this.dialogLoading = false
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.dialogLoading = false
|
|
|
- })
|
|
|
- },
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
- .notice-container {
|
|
|
- padding: 10px;
|
|
|
- max-height: calc(80vh - 120px);
|
|
|
- }
|
|
|
- .photo-area {
|
|
|
+.notice-container {
|
|
|
+ padding: 10px;
|
|
|
+ max-height: calc(80vh - 120px);
|
|
|
+}
|
|
|
+
|
|
|
+.photo-area {
|
|
|
+ display: block;
|
|
|
+ position: relative;
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ z-index: 9997;
|
|
|
+
|
|
|
+ .avatar {
|
|
|
display: block;
|
|
|
- position: relative;
|
|
|
width: 178px;
|
|
|
height: 178px;
|
|
|
- z-index: 9997;
|
|
|
-
|
|
|
- .avatar {
|
|
|
- display: block;
|
|
|
- width: 178px;
|
|
|
- height: 178px;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- .handle-photo-buttons {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- background: rgba(7, 0, 0, 0.6);
|
|
|
- // display: none;
|
|
|
- z-index: 9998;
|
|
|
+ .handle-photo-buttons {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ background: rgba(7, 0, 0, 0.6);
|
|
|
+ // display: none;
|
|
|
+ z-index: 9998;
|
|
|
|
|
|
- > div {
|
|
|
- margin: 44% 0 0 30%;
|
|
|
+ >div {
|
|
|
+ margin: 44% 0 0 30%;
|
|
|
|
|
|
- i {
|
|
|
- z-index: 9999;
|
|
|
- cursor: pointer;
|
|
|
- margin: 0 7px;
|
|
|
- color: white;
|
|
|
- font-size: 18px;
|
|
|
- }
|
|
|
+ i {
|
|
|
+ z-index: 9999;
|
|
|
+ cursor: pointer;
|
|
|
+ margin: 0 7px;
|
|
|
+ color: white;
|
|
|
+ font-size: 18px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- .photo-area:hover > .handle-photo-buttons {
|
|
|
- display: block;
|
|
|
- }
|
|
|
+.photo-area:hover>.handle-photo-buttons {
|
|
|
+ display: block;
|
|
|
+}
|
|
|
|
|
|
- .avatar {
|
|
|
- width: 178px;
|
|
|
- height: 178px;
|
|
|
- display: block;
|
|
|
- }
|
|
|
+.avatar {
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ display: block;
|
|
|
+}
|
|
|
</style>
|