123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view class="uni-container uni-container-bg">
- <view class="event">
- <view class="event-title">事件时间</view>
- <uni-datetime-picker class="time-item-check" type="date" :clear-icon="false" v-model="eventTime"
- @maskClick="startMaskClick" placeholder="请选择事件时间" />
- <view class="content">
- <view class="event-title">事件内容</view>
- <u--textarea v-model="eventContent" placeholder="请输入内容" :maxlength="1000" count height="150">
- </u--textarea>
- </view>
- </view>
- <view class="bottons">
- <view class="buttons-item">
- <u-button shape="circle" type="primary" text="取消" :custom-style="{color:'#4CB2B6',backgroundColor: '#fff',border:'1px solid #fff',marginRight:'10px'}" @click="cancel">
- </u-button>
- <u-button shape="circle" type="primary" color="#4CB2B6" text="保存" @click="submit">
- </u-button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import riliicon from '@/static/images/riliicon.png'
- import {
- createStationEvent,
- getOneMicrostation,//编辑获取
- updateOrgReport
- } from '@/api/fire_station/index';
- export default {
- data() {
- return {
- eventContent: '',
- eventTime: '',
- riliicon: riliicon,
- isEditId:false
- }
- },
- onLoad: function(option) {
- if(option.id){
- this.isEditId=option.id
- getOneMicrostation({
- id:option.id
- }).then(reponse => {
- this.eventTime=reponse.data.eventTime
- this.eventContent=reponse.data.eventContent
- console.log(reponse,'opt');
- })
- }
- },
- methods: {
- submit() {
- const that=this
- if(!this.eventContent){return this.$modal.msgError('请填写事件内容')}
- if(!this.eventTime){return this.$modal.msgError('请选择事件时间')}
- if(!this.isEditId){
- createStationEvent({
- eventContent: this.eventContent,
- eventTime:this.eventTime+''
- }).then(reponse => {
- that.$modal.msg('保存成功')
- setTimeout(() => {
- uni.navigateBack()
- }, 400)
-
- }).catch(err=>{
- })
- }else{
- updateOrgReport({
- eventContent: this.eventContent,
- eventTime:this.eventTime+'',
- id:this.isEditId
- }).then(reponse => {
- that.$modal.msg('编辑成功')
- setTimeout(() => {
- uni.navigateBack()
- }, 400)
-
- }).catch(err=>{
- })
- }
-
- },
- cancel() {
- uni.navigateBack()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- body {
- background-color: #f5f7f9;
- }
- page {
- background-color: #f5f7f9 !important;
- }
- .uni-container {
- height: 100%
- }
- .event {
- margin-top: 40rpx;
- background-color: #F5F7F9;
-
- .content {
- margin-top: 40rpx
- }
- .event-title {
- color: #274647;
- font-size: 28rpx;
- margin-bottom: 28rpx
- }
- }
- /deep/ .uniui-calendar:before {
- display: inline-block;
- content: url('~@/static/images/riliicon.png');
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- left: 14rpx;
- top: 16rpx
- }
- /deep/ .uni-input-placeholder{
- left: 44rpx !important;
- }
- /deep/.uni-input-input{
- margin-left: 40rpx;
- }
- /deep/ .uni-date-x[data-v-6e13d7e2],/deep/ .uni-date-x {
- height: 72rpx
- }
- .bottons {
- .buttons-item {
- display: flex;
- justify-content: space-between;
- width: 90%;
- margin-left: 5%
- }
- .u-button {
- width: 45%
- }
- position: fixed;
- left: 0;
- bottom: 100rpx;
- right: 0;
- }
- </style>
|