Blame view

src/views/oa/editNoticeViewList.vue 3.6 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
ec9ec2ce   wuxw   开发完成物业公告问题
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
    <div class="edit-notice-container">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>{{ $t('editNoticeView.title') }}</span>
        </div>
  
        <el-form ref="form" :model="editNoticeViewInfo" label-width="120px">
          <el-row>
            <el-col :span="24">
              <el-form-item :label="$t('editNoticeView.titleLabel')" prop="title">
                <el-input v-model="editNoticeViewInfo.title" :placeholder="$t('editNoticeView.titlePlaceholder')"
                  clearable />
              </el-form-item>
            </el-col>
          </el-row>
  
          <el-row>
            <el-col :span="24">
              <el-form-item :label="$t('editNoticeView.contentLabel')" prop="context">
                <div class="editor-wrapper">
                  <rich-text-editor ref="richTextEditor" v-model="editNoticeViewInfo.context" />
                </div>
              </el-form-item>
            </el-col>
          </el-row>
  
          <el-row>
            <el-col :span="24" class="button-group">
              
              <el-button type="warning" @click="closeEditNoticeInfo" style="margin-left: 20px;">
                <i class="el-icon-close"></i>
                {{ $t('common.cancel') }}
              </el-button>
              <el-button type="primary" @click="editNotice">
                <i class="el-icon-check"></i>
                {{ $t('common.save') }}
              </el-button>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
    </div>
  </template>
  
  <script>
  import { updateNotice, getNoticeDetail } from '@/api/oa/editNoticeViewApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import RichTextEditor from "@/components/editor/RichTextEditor";
  
  
  export default {
    name: 'EditNoticeViewList',
    data() {
      return {
        editNoticeViewInfo: {
          noticeId: '',
          title: '',
          noticeTypeCd: '',
          context: '',
          startTime: '',
          endTime: '',
          communityId: ''
        }
      }
    },
    components: {
      RichTextEditor
    },
    created() {
      this.initData()
    },
    methods: {
      async initData() {
        this.editNoticeViewInfo.noticeId = this.$route.query.noticeId
        this.editNoticeViewInfo.communityId = getCommunityId()
        await this._initEditNoticeInfo()
      },
      async _initEditNoticeInfo() {
        try {
          const params = {
            page: 1,
            row: 1,
            communityId: this.editNoticeViewInfo.communityId,
            noticeId: this.editNoticeViewInfo.noticeId
          }
          const { notices } = await getNoticeDetail(params)
          this.editNoticeViewInfo = { ...notices[0] }
          this.$refs.richTextEditor.setContent(notices[0].context)
  
        } catch (error) {
          this.$message.error(this.$t('editNoticeView.fetchError'))
        }
      },
      editNoticeValidate() {
  
  
        return this.$refs.form.validate(valid => {
          if (!valid) {
            return false
          }
          return true
        })
      },
      async editNotice() {
  
        try {
          const { code, msg } = await updateNotice(this.editNoticeViewInfo)
          if (code === 0) {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
110
            this.$message.success(this.$t('common.operationSuccess'))
ec9ec2ce   wuxw   开发完成物业公告问题
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
            this.closeEditNoticeInfo()
          } else {
            this.$message.error(msg)
          }
        } catch (error) {
          this.$message.error(this.$t('editNoticeView.updateError'))
        }
      },
      closeEditNoticeInfo() {
        this.$router.go(-1)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .edit-notice-container {
    padding: 20px;
  
    .box-card {
      margin-bottom: 20px;
    }
  
    .editor-wrapper {
      width: 100%;
    }
  
    .button-group {
      text-align: right;
      margin-top: 20px;
    }
  }
  </style>