Commit 647dce37 by cwq0219

详情、编辑弹窗

1 parent 7e981a2d
...@@ -5,7 +5,8 @@ const methods = { ...@@ -5,7 +5,8 @@ const methods = {
Search: `${path}search`, Search: `${path}search`,
UserCountSearch: `${path_push}.push.search`, UserCountSearch: `${path_push}.push.search`,
CancelPublish: `${path_push}.publish.cancel`, CancelPublish: `${path_push}.publish.cancel`,
MerchantGroup: `${path_merchant}.group.dict` MerchantGroup: `${path_merchant}.group.dict`,
Detail: `${path_push}.detail`
} }
export { export {
methods methods
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
prop="title" prop="title"
> >
<gl-input <gl-input
v-model="noticeForm.title" v-model="noticeForm.titile"
placeholder="请输入标题" placeholder="请输入标题"
name="title" name="title"
data-vv-as="标题" data-vv-as="标题"
v-validate="'required|max:30'" v-validate="'required|max:100'"
clearable clearable
></gl-input> ></gl-input>
<span <span
......
...@@ -18,20 +18,9 @@ ...@@ -18,20 +18,9 @@
prop="title" prop="title"
> >
<gl-input <gl-input
readonly="true" readonly="readonly"
v-model="noticeForm.title" v-model="noticeForm.titile"
placeholder="请输入标题"
name="title"
data-vv-as="标题"
v-validate="'required|max:30'"
clearable
></gl-input> ></gl-input>
<span
v-show="errorBags.has('title')"
class="error"
>
{{ errorBags.first('title') }}
</span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="内容详情:" label="内容详情:"
...@@ -39,110 +28,48 @@ ...@@ -39,110 +28,48 @@
> >
<div> <div>
<editor <editor
:isClear="isClear" :isEditable="isEditable"
name="context"
data-vv-as="内容"
v-validate="'required'"
v-model="noticeForm.context" v-model="noticeForm.context"
></editor> ></editor>
</div> </div>
<span
v-show="errorBags.has('context')"
class="error"
>
{{ errorBags.first('context') }}
</span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="发送对象:" label="发送对象:"
prop="sendObj" prop="sendObj"
> >
<gl-checkbox-group <gl-checkbox-group v-model="noticeForm.sendObj">
v-model="noticeForm.sendObj"
name="sendObj"
data-vv-as="发送对象"
v-validate="'required'"
>
<gl-checkbox <gl-checkbox
v-for="item in sendObjList" v-for="item in sendObjList"
:label="item.value" :label="item.value"
:key="item.value" :key="item.value"
disabled
>{{item.label}}</gl-checkbox> >{{item.label}}</gl-checkbox>
</gl-checkbox-group> </gl-checkbox-group>
<span
v-show="errorBags.has('sendObj')"
class="error"
>
{{ errorBags.first('sendObj') }}
</span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="上传附件:" label="上传附件:"
prop="attachment" prop="attachment"
class="download"
> >
<gl-upload <!-- <a href="http://down8.5156edu.com/showzipdown4.php?f_type1=2&id=96098">下载附件</a> -->
class="upload-demo" <a href="https://cdn.shopify.com/s/files/1/1545/3617/files/SH01_User_Manaul.pdf" download="SH01_User_Manaul.pdf">下载附件</a>
action="https://jsonplaceholder.typicode.com/posts/"
name="attachment"
v-validate="'required'"
data-vv-as="附件"
:limit="2"
:before-upload="beforeUpload"
:on-success="handleSuccess"
:on-error="handleError"
:on-remove="handleRemove"
:file-list="fileList"
>
<gl-button
size="small"
type="primary"
>点击上传</gl-button>
<div
slot="tip"
class="el-upload__tip"
>请上传小于20MB的文件</div>
</gl-upload>
<span
v-show="errorBags.has('attachment')"
class="error"
>
{{ errorBags.first('attachment') }}
</span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="展示方式:" label="展示方式:"
prop="showType" prop="showType"
> >
<gl-radio-group v-model="noticeForm.showType"> <gl-radio-group
v-model="noticeForm.showType"
disabled
>
<gl-radio <gl-radio
v-for="item in showTypeList" v-for="item in showTypeList"
:label="item.value" :label="item.value"
:key="item.value" :key="item.value"
name="showType"
data-vv-as="展示方式"
v-validate="'required'"
>{{item.label}}</gl-radio> >{{item.label}}</gl-radio>
</gl-radio-group> </gl-radio-group>
<!-- <p>说明:没有勾选则为默认形式,即在消息中心中展示</p> -->
<span
v-show="errorBags.has('showType')"
class="error"
>
{{ errorBags.first('showType') }}
</span>
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
<!-- <span slot="footer">
<el-button
type="primary"
@click="handleDraft"
>保存草稿</el-button>
<el-button
type="primary"
@click="handleComfrim"
>审核并发布</el-button>
<el-button @click="handleClose">取消发布</el-button>
</span> -->
</gl-dialog> </gl-dialog>
</div> </div>
</template> </template>
...@@ -156,10 +83,12 @@ export default { ...@@ -156,10 +83,12 @@ export default {
}, },
data() { data() {
return { return {
isClear: false, // isClear: false,
readonly: true,
isEditable: false,
// 通过数据watch // 通过数据watch
title: '通知详情', title: '通知详情',
fileList: [], // fileList: [],
sendObjList: [ sendObjList: [
{ {
label: '爱车保镖分组', label: '爱车保镖分组',
...@@ -173,11 +102,11 @@ export default { ...@@ -173,11 +102,11 @@ export default {
} }
], ],
showTypeList: [{ showTypeList: [{
label: '置顶消息',
value: '2'
}, {
label: '弹出框', label: '弹出框',
value: '1' value: '1'
}, {
label: '置顶消息',
value: '2'
}], }],
rules: { rules: {
title: [{ required: true }], title: [{ required: true }],
...@@ -213,25 +142,25 @@ export default { ...@@ -213,25 +142,25 @@ export default {
}, },
methods: { methods: {
// 上传附件,限制用户上传的附件格式和大小 // 上传附件,限制用户上传的附件格式和大小
beforeUpload(file) { // beforeUpload(file) {
const isLT20M = file.size / 1024 / 1024 < 20 // const isLT20M = file.size / 1024 / 1024 < 20
!isLT20M && this.$message.error('上传附件大小不能超过20M') // !isLT20M && this.$message.error('上传附件大小不能超过20M')
return isLT20M // return isLT20M
}, // },
handleSuccess(file, fileList) { // handleSuccess(file, fileList) {
this.fileList = [{ name: fileList.name, url: fileList.url }] // this.fileList = [{ name: fileList.name, url: fileList.url }]
this.noticeForm.attachment = fileList.url // this.noticeForm.attachment = fileList.url
// 移除验证 // // 移除验证
// this.errorBags.remove('attachment') // // this.errorBags.remove('attachment')
}, // },
handleError() { // handleError() {
this.$message.error('上传失败,请重新上传!') // this.$message.error('上传失败,请重新上传!')
}, // },
handleRemove(file, fileList) { // handleRemove(file, fileList) {
this.noticeForm.attachment = '' // this.noticeForm.attachment = ''
// 添加验证 // // 添加验证
// this.$validator.validate('attachment', this.noticeForm.attachment) // // this.$validator.validate('attachment', this.noticeForm.attachment)
}, // },
handleClose() { handleClose() {
console.log(this.noticeForm) console.log(this.noticeForm)
this.$emit('hideDialog') this.$emit('hideDialog')
...@@ -247,4 +176,26 @@ export default { ...@@ -247,4 +176,26 @@ export default {
.detail .el-select { .detail .el-select {
width: 100%; width: 100%;
} }
.detail .download a {
color: #409eff;
text-decoration: underline;
}
.detail .el-checkbox__input.is-disabled + span.el-checkbox__label,
.detail .el-radio__input.is-disabled + span.el-radio__label {
color: #606266;
}
.detail .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner,
.detail .el-radio__input.is-disabled.is-checked .el-radio__inner {
border-color: #409eff;
background: #409eff;
}
.detail .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after {
border-color: #fff;
}
.detail .el-radio__input.is-disabled.is-checked .el-radio__inner::after {
background-color: #fff;
}
.detail .el-radio:focus:not(.is-focus):not(:active) .el-radio__inner {
box-shadow: 0 0;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -32,6 +32,10 @@ export default { ...@@ -32,6 +32,10 @@ export default {
isClear: { isClear: {
type: Boolean, type: Boolean,
default: false default: false
},
isEditable: {
type: Boolean,
default: true
} }
}, },
watch: { watch: {
...@@ -121,6 +125,8 @@ export default { ...@@ -121,6 +125,8 @@ export default {
} }
// 创建富文本编辑器 // 创建富文本编辑器
this.editor.create() this.editor.create()
// 禁用编辑功能
!this.isEditable && this.editor.$textElem.attr('contenteditable', false)
} }
} }
} }
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<gl-button <gl-button
class="newButton" class="newButton"
type="primary" type="primary"
@click="handleAdd" @click="handleAdd(true)"
>创建通知</gl-button> >创建通知</gl-button>
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
...@@ -229,7 +229,8 @@ export default { ...@@ -229,7 +229,8 @@ export default {
// 编辑弹窗参数-start // 编辑弹窗参数-start
addVisible: false, addVisible: false,
noticeForm: { noticeForm: {
title: '', recordId: '',
titile: '',
context: '', context: '',
// 发送对象 // 发送对象
sendObj: [], sendObj: [],
...@@ -340,7 +341,8 @@ export default { ...@@ -340,7 +341,8 @@ export default {
label: '详情', label: '详情',
type: 'text', type: 'text',
callback: (index, row) => { callback: (index, row) => {
// console.log(row[index])
this.noticeDetail(row[index].recordId)
} }
}, },
{ {
...@@ -367,7 +369,7 @@ export default { ...@@ -367,7 +369,7 @@ export default {
return row.publishStatus === 1 ? null : '编辑' return row.publishStatus === 1 ? null : '编辑'
}, },
callback: (index, row) => { callback: (index, row) => {
this.noticeDetail(row[index].recordId, 1)
} }
} }
] ]
...@@ -538,10 +540,25 @@ export default { ...@@ -538,10 +540,25 @@ export default {
}) })
.catch(err => console.log(err)) .catch(err => console.log(err))
}, },
// 公告详情
noticeDetail(recordId, isEdit = 0) {
const params = { 'recordId': recordId }
params.method = nmMethods.Detail
request.req(params).then(res => {
console.log(res)
for (var item in this.noticeForm) {
this.noticeForm[item] = res[item]
}
// console.log(this.noticeForm)
isEdit ? this.handleAdd() : this.handleDetail()
}).catch(err => {
notice.errorTips(err)
})
},
// 新增公告 // 新增公告
handleAdd() { handleAdd(isCreate) {
this.noticeForm.showType = '1' isCreate && (this.noticeForm.showType = '1')
// this.noticeForm.context = '<p>fdasfdasf</p><p><img src="https://timgsa.baidu.com/timg?image&amp;quality=80&amp;size=b9999_10000&amp;sec=1555392730451&amp;di=6f2af72a691e8f7a19a436d63a40124b&amp;imgtype=0&amp;src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F20182%2F21%2F2018221142159_MZ33z.jpeg" style="max-width:100%;"><br></p><p><br></p>' // this.noticeForm.context = '<p>fdasfdasf</p><p><img src="https://timgsa.baidu.com/timg?image&amp;quality=80&amp;size=b9999_10000&amp;sec=1555392730451&amp;di=6f2af72a691e8f7a19a436d63a40124b&amp;imgtype=0&amp;src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F20182%2F21%2F2018221142159_MZ33z.jpeg" style="max-width:100%;"></p><p></p><p>gfdgdg</p><p>gfdgdg</p>'
this.addVisible = !this.addVisible this.addVisible = !this.addVisible
}, },
handleAddHide() { handleAddHide() {
...@@ -553,11 +570,12 @@ export default { ...@@ -553,11 +570,12 @@ export default {
resetSearch(this.noticeForm) resetSearch(this.noticeForm)
}, },
// 通知详情 // 通知详情
handleDetail() { handleDetail(recordId) {
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
}, },
handleDetailHide() { handleDetailHide() {
this.handleDetail() this.detailVisible = !this.detailVisible
resetSearch(this.noticeForm)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!