Commit eb855f20 by cwq0219

弹窗验证

1 parent 647dce37
...@@ -82,9 +82,6 @@ ...@@ -82,9 +82,6 @@
<gl-upload <gl-upload
class="upload-demo" class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
name="attachment"
v-validate="'required'"
data-vv-as="附件"
:limit="2" :limit="2"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:on-success="handleSuccess" :on-success="handleSuccess"
...@@ -101,25 +98,21 @@ ...@@ -101,25 +98,21 @@
class="el-upload__tip" class="el-upload__tip"
>请上传小于20MB的文件</div> >请上传小于20MB的文件</div>
</gl-upload> </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"
name="showType"
data-vv-as="展示方式"
v-validate="'required'">
<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> --> <!-- <p>说明:没有勾选则为默认形式,即在消息中心中展示</p> -->
...@@ -156,8 +149,7 @@ export default { ...@@ -156,8 +149,7 @@ export default {
data() { data() {
return { return {
isClear: false, isClear: false,
// 通过数据watch title: '创建通知',
title: '新增',
fileList: [], fileList: [],
sendObjList: [ sendObjList: [
{ {
...@@ -208,6 +200,8 @@ export default { ...@@ -208,6 +200,8 @@ export default {
}, },
isVisible(val) { isVisible(val) {
!val && (this.fileList = []) !val && (this.fileList = [])
console.log(this.noticeForm.recordId)
this.noticeForm.recordId && (this.title = '编辑通知')
this.$validator.errors.clear() this.$validator.errors.clear()
} }
}, },
...@@ -237,21 +231,15 @@ export default { ...@@ -237,21 +231,15 @@ export default {
this.$emit('hideDialog') this.$emit('hideDialog')
}, },
handleDraft() { handleDraft() {
// this.$emit('handleAddComfirm') this.$emit('handleAddComfirm')
// this.$validator.validateAll().then((result) => {
// if (result) {
// console.log(this.$validator)
// this.$emit('comfirmDialog', this.areaInfo)
// }
// })
}, },
handleComfrim() { handleComfrim() {
console.log(this.noticeForm) console.log(this.noticeForm)
this.$emit('handleAddComfirm') // this.$emit('handleAddComfirm')
this.$validator.validateAll().then((result) => { this.$validator.validateAll().then((result) => {
if (result) { if (result) {
console.log(this.$validator) console.log(this.$validator)
this.$emit('comfirmDialog', this.areaInfo) this.$emit('handleAddComfirm', this.areaInfo)
} }
}) })
// Promise.all([ // Promise.all([
......
...@@ -83,12 +83,9 @@ export default { ...@@ -83,12 +83,9 @@ export default {
}, },
data() { data() {
return { return {
// isClear: false,
readonly: true, readonly: true,
isEditable: false, isEditable: false,
// 通过数据watch
title: '通知详情', title: '通知详情',
// fileList: [],
sendObjList: [ sendObjList: [
{ {
label: '爱车保镖分组', label: '爱车保镖分组',
...@@ -141,26 +138,6 @@ export default { ...@@ -141,26 +138,6 @@ export default {
} }
}, },
methods: { methods: {
// 上传附件,限制用户上传的附件格式和大小
// beforeUpload(file) {
// const isLT20M = file.size / 1024 / 1024 < 20
// !isLT20M && this.$message.error('上传附件大小不能超过20M')
// return isLT20M
// },
// handleSuccess(file, fileList) {
// this.fileList = [{ name: fileList.name, url: fileList.url }]
// this.noticeForm.attachment = fileList.url
// // 移除验证
// // this.errorBags.remove('attachment')
// },
// handleError() {
// this.$message.error('上传失败,请重新上传!')
// },
// handleRemove(file, fileList) {
// 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')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!