123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <uni-drawer ref="drawer" mode="left" :mask-click="false" width="85%" :maskClick='true'>
- <scroll-view class="scroll-view" scroll-y="true">
- <uni-section :title="type==='add'?'突发事件上报':'编辑突发事件' " type="line"></uni-section>
- <view class="form-wrap" >
- <uni-forms ref="form" label-position="top" :rules="rules" :model="form" :label-width="300">
- <uni-forms-item label ="消息标题">
- <uni-easyinput v-model="form.reportingSubject" placeholder="请输入消息标题" type="textarea" :maxlength="150" autoHeight />
- <view class="word-limit">{{form.reportingSubject.length||0}}/150</view>
- </uni-forms-item>
- <uni-forms-item label ="上报单位" >
- <uni-easyinput v-model="form.reportingGroupName" placeholder="请输入上报单位" />
- </uni-forms-item>
- <uni-forms-item label="请输入消息内容">
- <uni-easyinput type="textarea" :maxlength="300"
- v-model="form.reportingContent" autoHeight
- placeholder="请输入消息内容"></uni-easyinput>
- <view class="word-limit">{{form.reportingContent.length||0}}/300</view>
- </uni-forms-item>
- </uni-forms>
- <view class="handle-container">
- <button class="save" type="primary" @click="onSubmit">保存</button>
- <button class="cancel" type="default" @click="close">取消</button>
- </view>
- </view>
- </scroll-view>
- </uni-drawer>
- </template>
- <script>
- import reportingApi from '@/api/reporting.js'
- export default{
- name:"EditReporting",
- data(){
- return{
- type:undefined,
- form:{
- reportingId: 0,
- reportingTypeId: 0,
- reportingTypeTitle: '',
- reportingSubject: '',
- reportingContent: '',
- reportingGroupName: '',
- remark: ''
- }
- }
- },
- methods:{
- resetForm(){
- this.form={
- reportingId: 0,
- reportingTypeId: 0,
- reportingTypeTitle: '',
- reportingSubject: '',
- reportingContent: '',
- reportingGroupName: '',
- remark: ''
- }
- },
- onSubmit(){
- this.$refs.form.validate().then(res=>{
- reportingApi.update(this.form).then(()=>{
- uni.showToast({
- icon:"none",
- title:"成功!!"
- })
- this.$emit('success')
- this.close();
- })
- }).catch(err =>{
- uni.showToast({
- icon:"none",
- title:"请检查填写信息!"
- })
- })
- },
- show({type,item}){
- this.resetForm()
- this.type=type
- this.$refs.drawer.open()
- reportingApi.getById(item.reportingId).then((res)=>{
- this.form={...res.data}
- })
- },
- close(){
- this.$refs.drawer.close()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .scroll-view {
- height: 100%;
- padding: 20rpx;
- box-sizing: border-box;
- .form-wrap{
- padding:40rpx 20rpx;
- .handle-container{
- display: flex;
- justify-content: center;
- align-items: center;
- button{
- width: 160rpx;
- padding: 20rpx 16rpx;
- line-height: 1;
- font-size: 28rpx;
- &.save{
- background-color: #007aff;
- }
- }
- }
- .word-limit{
- text-align: right;
- padding: 10rpx 0;
- color: #999;
- font-size: 26rpx;
- }
- .attachbox{
- display: flex;
- flex-wrap: wrap;
- .attach{
- padding: 16rpx 18rpx;
- image,.handle{
- display: block;
- width: 100rpx;
- height: 100rpx;
- box-shadow: rgba(0,0,0,0.6);
- border: 1rpx solid #ccc;
- border-radius: 10px;
- overflow: hidden;
- box-sizing: border-box;
- }
- .handle{
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- }
- }
- </style>
|