|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<a-modal
|
|
<a-modal
|
|
centered
|
|
centered
|
|
- class="announcementEdit-modal"
|
|
|
|
|
|
+ class="noticeEdit-modal"
|
|
:footer="null"
|
|
:footer="null"
|
|
:maskClosable="false"
|
|
:maskClosable="false"
|
|
:title="modalTit"
|
|
:title="modalTit"
|
|
@@ -11,64 +11,63 @@
|
|
<!-- 表单 -->
|
|
<!-- 表单 -->
|
|
<div>
|
|
<div>
|
|
<a-form-model
|
|
<a-form-model
|
|
- id="announcementEdit-form"
|
|
|
|
|
|
+ id="noticeEdit-form"
|
|
ref="ruleForm"
|
|
ref="ruleForm"
|
|
:model="form"
|
|
:model="form"
|
|
:rules="rules"
|
|
:rules="rules"
|
|
:label-col="formItemLayout.labelCol"
|
|
:label-col="formItemLayout.labelCol"
|
|
:wrapper-col="formItemLayout.wrapperCol"
|
|
:wrapper-col="formItemLayout.wrapperCol"
|
|
>
|
|
>
|
|
- <a-form-model-item label="类型" prop="productBrandName">
|
|
|
|
- <a-select placeholder="请选择类型" id="announcementEdit-level" allowClear v-model="form.level">
|
|
|
|
- <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
|
|
|
|
- </a-select>
|
|
|
|
|
|
+ <a-form-model-item label="类别" prop="type">
|
|
|
|
+ <v-select code="NOTITY_BIZ_TYPE" id="noticeEdit-type" v-model="form.type" allowClear placeholder="请选择类别"></v-select>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="可见性" prop="productBrandName">
|
|
|
|
- <a-select placeholder="请选择可见性" id="announcementEdit-level" allowClear v-model="form.level">
|
|
|
|
- <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
|
|
|
|
- </a-select>
|
|
|
|
|
|
+ <a-form-model-item label="可见性" prop="toAppName">
|
|
|
|
+ <v-select code="NOTITY_APP_TYPE" id="noticeEdit-toAppName" v-model="form.toAppName" allowClear placeholder="请选择可见性"></v-select>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="公告标题" prop="productBrandName">
|
|
|
|
|
|
+ <a-form-model-item label="公告标题" prop="title">
|
|
<a-input
|
|
<a-input
|
|
- id="announcementEdit-productBrandName"
|
|
|
|
|
|
+ id="noticeEdit-title"
|
|
:maxLength="30"
|
|
:maxLength="30"
|
|
- v-model="form.productBrandName"
|
|
|
|
|
|
+ v-model="form.title"
|
|
placeholder="请输入公告标题(最多30个字符)"
|
|
placeholder="请输入公告标题(最多30个字符)"
|
|
allowClear />
|
|
allowClear />
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="发布时间" prop="productBrandName">
|
|
|
|
|
|
+ <a-form-model-item label="发布时间" prop="releaseDate">
|
|
<a-date-picker
|
|
<a-date-picker
|
|
- :show-time="{ format: 'HH:mm' }"
|
|
|
|
- id="announcementEdit-productBrandName"
|
|
|
|
- format="YYYY-MM-DD HH:mm"
|
|
|
|
- placeholder="年/月/日 时/分"
|
|
|
|
- :disabled-date="disabledDate" />
|
|
|
|
|
|
+ show-time
|
|
|
|
+ id="noticeEdit-releaseDate"
|
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
+ placeholder="年/月/日 时/分/秒"
|
|
|
|
+ :disabled-date="disabledDate"
|
|
|
|
+ v-model="form.releaseDate"/>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="图片上传" prop="productBrandName">
|
|
|
|
|
|
+ <a-form-model-item label="图片上传" prop="imgPaths">
|
|
<Upload
|
|
<Upload
|
|
class="upload"
|
|
class="upload"
|
|
- id="announcementEdit-image"
|
|
|
|
- v-model="form.image"
|
|
|
|
- ref="image"
|
|
|
|
|
|
+ id="noticeEdit-imgPaths"
|
|
|
|
+ v-model="form.imgPaths"
|
|
|
|
+ ref="imgPaths"
|
|
:fileSize="10"
|
|
:fileSize="10"
|
|
:maxNums="5"
|
|
:maxNums="5"
|
|
- @change="changeHomeImage"
|
|
|
|
- listType="picture-card" ></Upload>
|
|
|
|
|
|
+ @change="changeImage"
|
|
|
|
+ listType="picture-card"
|
|
|
|
+ :uploadParams="uploadParams"></Upload>
|
|
<span class="upload-desc">说明:单张大小小于10Mb,最多5张。</span>
|
|
<span class="upload-desc">说明:单张大小小于10Mb,最多5张。</span>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="附件上传" prop="productBrandName">
|
|
|
|
|
|
+ <a-form-model-item label="附件上传" prop="attachPaths">
|
|
<Upload
|
|
<Upload
|
|
- id="announcementEdit-image"
|
|
|
|
- v-model="form.image"
|
|
|
|
|
|
+ id="noticeEdit-attachPaths"
|
|
|
|
+ v-model="form.attachPaths"
|
|
ref="enclosure"
|
|
ref="enclosure"
|
|
:fileSize="10"
|
|
:fileSize="10"
|
|
:maxNums="3"
|
|
:maxNums="3"
|
|
fileType="*"
|
|
fileType="*"
|
|
- @change="changeHomeImage" ></Upload>
|
|
|
|
|
|
+ @change="changeAttach"
|
|
|
|
+ :uploadParams="uploadParams"></Upload>
|
|
<span class="upload-desc">说明:单个文件小于10Mb,最多3个附件。</span>
|
|
<span class="upload-desc">说明:单个文件小于10Mb,最多3个附件。</span>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="公告内容" prop="desc">
|
|
|
|
- <editor id="announcementEdit-editor" ref="editor" class="announcementEdit-editor" @on-change="editorChange" :cache="false"></editor>
|
|
|
|
|
|
+ <a-form-model-item label="公告内容" prop="content">
|
|
|
|
+ <editor id="noticeEdit-editor" ref="editor" class="noticeEdit-editor" @on-change="editorChange" :cache="false"></editor>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
</a-form-model>
|
|
<div class="btn-cont">
|
|
<div class="btn-cont">
|
|
@@ -81,12 +80,12 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
-import { STable, Upload } from '@/components'
|
|
|
|
|
|
+import { VSelect, Upload } from '@/components'
|
|
import Editor from '@/components/WEeditor'
|
|
import Editor from '@/components/WEeditor'
|
|
-// import { dealerProductBrandSave } from '@/api/dealerProductBrand'
|
|
|
|
|
|
+import { noticeSave, noticeDetail } from '@/api/notice'
|
|
export default {
|
|
export default {
|
|
name: 'ProductBrandEditModal',
|
|
name: 'ProductBrandEditModal',
|
|
- components: { STable, Upload, Editor },
|
|
|
|
|
|
+ components: { VSelect, Upload, Editor },
|
|
props: {
|
|
props: {
|
|
openModal: { // 弹框显示状态
|
|
openModal: { // 弹框显示状态
|
|
type: Boolean,
|
|
type: Boolean,
|
|
@@ -114,16 +113,31 @@ export default {
|
|
wrapperCol: { span: 20 }
|
|
wrapperCol: { span: 20 }
|
|
},
|
|
},
|
|
form: {
|
|
form: {
|
|
- productBrandName: '', // 产品品牌名称
|
|
|
|
- image: '',
|
|
|
|
- desc: ''
|
|
|
|
|
|
+ type: undefined,
|
|
|
|
+ toAppName: undefined,
|
|
|
|
+ title: '',
|
|
|
|
+ releaseDate: null,
|
|
|
|
+ imgPaths: '',
|
|
|
|
+ attachPaths: '',
|
|
|
|
+ content: ''
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
- productBrandName: [
|
|
|
|
- { required: true, message: '请输入产品品牌名称', trigger: 'blur' }
|
|
|
|
|
|
+ type: [
|
|
|
|
+ { required: true, message: '请选择类别', trigger: 'change' }
|
|
|
|
+ ],
|
|
|
|
+ toAppName: [
|
|
|
|
+ { required: true, message: '请选择可见性', trigger: 'change' }
|
|
|
|
+ ],
|
|
|
|
+ title: [
|
|
|
|
+ { required: true, message: '请输入公告标题', trigger: 'blur' }
|
|
|
|
+ ],
|
|
|
|
+ releaseDate: [
|
|
|
|
+ { required: true, message: '请选择发布时间', trigger: 'change' }
|
|
]
|
|
]
|
|
},
|
|
},
|
|
- productBrandList: []
|
|
|
|
|
|
+ uploadParams: {
|
|
|
|
+ savePathType: 'web'
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -131,14 +145,26 @@ export default {
|
|
// Can not select days before today and today
|
|
// Can not select days before today and today
|
|
return current && current < moment().subtract(1, 'days')
|
|
return current && current < moment().subtract(1, 'days')
|
|
},
|
|
},
|
|
|
|
+ // 详情
|
|
|
|
+ getDetail () {
|
|
|
|
+ noticeDetail({ id: this.itemId }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.form = Object.assign(this.form, res.data)
|
|
|
|
+ this.$refs.imgPaths.setFileList(res.data.imgPaths)
|
|
|
|
+ this.$refs.attachPaths.setFileList(res.data.attachPaths)
|
|
|
|
+ this.$refs.editor.setHtml(this.formData.content)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 保存
|
|
// 保存
|
|
handleSave () {
|
|
handleSave () {
|
|
const _this = this
|
|
const _this = this
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
const formData = JSON.parse(JSON.stringify(_this.form))
|
|
const formData = JSON.parse(JSON.stringify(_this.form))
|
|
|
|
+ formData.releaseDate = moment(formData.releaseDate).format('YYYY-MM-DD HH:mm:ss')
|
|
formData.id = _this.itemId ? _this.itemId : undefined
|
|
formData.id = _this.itemId ? _this.itemId : undefined
|
|
- dealerProductBrandSave(formData).then(res => {
|
|
|
|
|
|
+ noticeSave(formData).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
_this.$emit('ok')
|
|
_this.$emit('ok')
|
|
@@ -151,12 +177,16 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 图片上传
|
|
// 图片上传
|
|
- changeHomeImage (file) {
|
|
|
|
- this.form.image = file
|
|
|
|
|
|
+ changeImage (file) {
|
|
|
|
+ this.form.imgPaths = file
|
|
|
|
+ },
|
|
|
|
+ // 附件上传
|
|
|
|
+ changeAttach (file) {
|
|
|
|
+ this.form.attachPaths = file
|
|
},
|
|
},
|
|
// 文本编辑器
|
|
// 文本编辑器
|
|
editorChange (html, text) {
|
|
editorChange (html, text) {
|
|
- this.form.desc = html
|
|
|
|
|
|
+ this.form.content = html
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -168,8 +198,11 @@ export default {
|
|
isShow (newValue, oldValue) {
|
|
isShow (newValue, oldValue) {
|
|
if (!newValue) {
|
|
if (!newValue) {
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
- } else {
|
|
|
|
- this.form.productBrandName = this.nowData && this.nowData.productBrandName ? this.nowData.productBrandName : ''
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ itemId (newValue, oldValue) {
|
|
|
|
+ if (this.isShow && newValue) {
|
|
|
|
+ this.getDetail()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -177,7 +210,7 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|
|
- .announcementEdit-modal{
|
|
|
|
|
|
+ .noticeEdit-modal{
|
|
.ant-modal-body {
|
|
.ant-modal-body {
|
|
padding: 40px 40px 24px;
|
|
padding: 40px 40px 24px;
|
|
}
|
|
}
|
|
@@ -190,7 +223,7 @@ export default {
|
|
color: #808695;
|
|
color: #808695;
|
|
}
|
|
}
|
|
// 文本编辑器 工具栏样式换行
|
|
// 文本编辑器 工具栏样式换行
|
|
- .announcementEdit-editor{
|
|
|
|
|
|
+ .noticeEdit-editor{
|
|
.w-e-toolbar{
|
|
.w-e-toolbar{
|
|
flex-wrap: wrap;
|
|
flex-wrap: wrap;
|
|
}
|
|
}
|