ct
This commit is contained in:
		@@ -2,18 +2,30 @@
 | 
			
		||||
  <div class="add">
 | 
			
		||||
    <div class="header-description">
 | 
			
		||||
      <u-form :model="form" ref="uForm" label-width="auto">
 | 
			
		||||
        <u-form-item label="主题" prop="content" required label-position="top">
 | 
			
		||||
        <u-form-item label="主题" prop="content" required label-position="top" class="contents">
 | 
			
		||||
          <u-input v-model="form.content" placeholder="请输入标题(1000字以内)" type="textarea" auto-height height="280" maxlength="1000" />
 | 
			
		||||
        </u-form-item>
 | 
			
		||||
 | 
			
		||||
        <u-form-item label="图片(最多9张)" prop="images" class="avatars" label-position="top">
 | 
			
		||||
          <AiUploader :def.sync="form.images" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
 | 
			
		||||
        </u-form-item>
 | 
			
		||||
        <u-form-item label="议事截止时间" prop="discussDeadline" required>
 | 
			
		||||
          <AiDateTime v-model="form.discussDeadline" />
 | 
			
		||||
 | 
			
		||||
        <u-form-item label="发布地区" prop="areaId" required :border-bottom="false" right-icon="arrow-right" class="addresss">
 | 
			
		||||
          <AiAreaPicker v-model="form.areaId" :areaId="user.areaId" @select="areaSelect" style="color: #666"></AiAreaPicker>
 | 
			
		||||
        </u-form-item>
 | 
			
		||||
        <u-form-item label="公示截止时间" prop="publicityDeadline">
 | 
			
		||||
          <AiDateTime v-model="form.publicityDeadline" />
 | 
			
		||||
 | 
			
		||||
        <u-form-item label="议事截止时间" prop="discussDeadline" required :border-bottom="false" right-icon="arrow-right">
 | 
			
		||||
          <u-input v-model="form.discussDeadline" placeholder="请选择议事截止时间" @click="showStartTime = true" />
 | 
			
		||||
 | 
			
		||||
          <u-picker mode="time" :params="params" v-model="showStartTime" @confirm="confirmTime"></u-picker>
 | 
			
		||||
        </u-form-item>
 | 
			
		||||
 | 
			
		||||
        <u-form-item label="公示截止时间" prop="publicityDeadline" :border-bottom="false" right-icon="arrow-right">
 | 
			
		||||
          <u-input v-model="form.publicityDeadline" placeholder="请选择公示截止时间" @click="showEndTime = true" />
 | 
			
		||||
 | 
			
		||||
          <u-picker mode="time" :params="params" v-model="showEndTime" @confirm="confirmTime"></u-picker>
 | 
			
		||||
        </u-form-item>
 | 
			
		||||
 | 
			
		||||
        <u-form-item label="议事类型" prop="type" required label-position="top">
 | 
			
		||||
          <div v-for="op in $dict.getDict('discussType')" :key="op.dictValue" class="discussType" @click="form.type = op.dictValue" :class="{ current: form.type == op.dictValue }">
 | 
			
		||||
            {{ op.dictName }}
 | 
			
		||||
@@ -37,6 +49,17 @@ export default {
 | 
			
		||||
      id: '',
 | 
			
		||||
      form: { type: 0 },
 | 
			
		||||
      flag: false,
 | 
			
		||||
      showStartTime: false,
 | 
			
		||||
      showEndTime: false,
 | 
			
		||||
      params: {
 | 
			
		||||
        year: true,
 | 
			
		||||
        month: true,
 | 
			
		||||
        day: true,
 | 
			
		||||
        hour: true,
 | 
			
		||||
        minute: true,
 | 
			
		||||
        second: false,
 | 
			
		||||
        timestamp: true,
 | 
			
		||||
      },
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: { ...mapState(['user']) },
 | 
			
		||||
@@ -45,7 +68,10 @@ export default {
 | 
			
		||||
      this.id = o.id
 | 
			
		||||
      this.getDetail()
 | 
			
		||||
    }
 | 
			
		||||
    this.$dict.load('discussType')
 | 
			
		||||
 | 
			
		||||
    this.$dict.load('discussType').then(() => {
 | 
			
		||||
      // this.areaId = this.user.areaId
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  onShow() {
 | 
			
		||||
    document.title = '新增议事'
 | 
			
		||||
@@ -61,6 +87,7 @@ export default {
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    submit() {
 | 
			
		||||
      if (this.flag) return
 | 
			
		||||
      if (!this.form.content) {
 | 
			
		||||
@@ -86,6 +113,43 @@ export default {
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    areaSelect(e) {
 | 
			
		||||
      console.log(e)
 | 
			
		||||
      this.form.areaId = e
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    confirmTime(e) {
 | 
			
		||||
      console.log(e)
 | 
			
		||||
 | 
			
		||||
      if (this.showStartTime == true) {
 | 
			
		||||
        var nowTime = new Date().getTime() * 1
 | 
			
		||||
 | 
			
		||||
        var discussDeadlineTimes = new Date(e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00').getTime() * 1
 | 
			
		||||
 | 
			
		||||
        if (nowTime > discussDeadlineTimes) {
 | 
			
		||||
          this.form.discussDeadline = ''
 | 
			
		||||
          return this.$u.toast('议事截止时间应大于当前时间')
 | 
			
		||||
        } else {
 | 
			
		||||
          this.form.discussDeadline = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00'
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (this.showEndTime == true) {
 | 
			
		||||
        if (!this.form.discussDeadline) {
 | 
			
		||||
          return this.$u.toast('请先选择议事截止时间')
 | 
			
		||||
        }
 | 
			
		||||
        var beginTimes = new Date(this.form.discussDeadline).getTime() * 1
 | 
			
		||||
 | 
			
		||||
        var publicityDeadlineTimes = new Date(e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00').getTime() * 1
 | 
			
		||||
 | 
			
		||||
        if (publicityDeadlineTimes > beginTimes && publicityDeadlineTimes != beginTimes) {
 | 
			
		||||
          this.form.publicityDeadline = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00'
 | 
			
		||||
        } else {
 | 
			
		||||
          this.form.publicityDeadline = ''
 | 
			
		||||
          return this.$u.toast('公示截止时间应大于议事截止时间')
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
@@ -100,6 +164,9 @@ export default {
 | 
			
		||||
        .u-form-item__body {
 | 
			
		||||
          .u-form-item--right__content__slot {
 | 
			
		||||
            padding-bottom: 0;
 | 
			
		||||
            .u-input {
 | 
			
		||||
              text-align: right !important;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
@@ -109,6 +176,27 @@ export default {
 | 
			
		||||
        padding-bottom: 20px !important;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .addresss {
 | 
			
		||||
        .u-form-item__body {
 | 
			
		||||
          .u-form-item--right {
 | 
			
		||||
            .u-form-item--right__content {
 | 
			
		||||
              .u-form-item--right__content__slot {
 | 
			
		||||
                .AiAreaPicker {
 | 
			
		||||
                  width: 100%;
 | 
			
		||||
                  display: flex;
 | 
			
		||||
                  justify-content: flex-end;
 | 
			
		||||
                  .areaSelector {
 | 
			
		||||
                    .location {
 | 
			
		||||
                      opacity: 0;
 | 
			
		||||
                    }
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .avatars {
 | 
			
		||||
        margin: 16px 0;
 | 
			
		||||
 | 
			
		||||
@@ -119,6 +207,16 @@ export default {
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .contents {
 | 
			
		||||
        .u-form-item__body {
 | 
			
		||||
          .u-form-item--right__content__slot {
 | 
			
		||||
            .u-input {
 | 
			
		||||
              text-align: left !important;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user