Blame view

src/views/system/registerProtocolList.vue 3.04 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
    <div class="register-protocol-container">
      <el-row>
        <el-col :span="24">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>{{ $t('registerProtocol.title') }}</span>
            </div>
            <div class="card-content">
              <el-form label-position="right" label-width="120px">
                <el-form-item :label="$t('registerProtocol.userProtocol')">
                  <div class="editor-container">
                    <rich-text-editor ref="userProtocolEditor" v-model="registerProtocolInfo.userProtocol" />
                  </div>
                </el-form-item>
                <el-form-item :label="$t('registerProtocol.merchantProtocol')">
                  <div class="editor-container">
                    <rich-text-editor ref="merchantProtocolEditor" v-model="registerProtocolInfo.merchantProtocol" />
                  </div>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="updateRegisterProtocol">
                    {{ $t('common.update') }}
                  </el-button>
                </el-form-item>
              </el-form>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </template>
  
  <script>
  import { listRegisterProtocols, updateRegisterProtocol } from '@/api/system/registerProtocolApi'
  import RichTextEditor from '@/components/editor/RichTextEditor.vue'
  
  export default {
    name: 'RegisterProtocolList',
    components: {
      RichTextEditor
    },
    data() {
      return {
        registerProtocolInfo: {
          userProtocol: '',
          merchantProtocol: '',
          protolcolId: ''
        }
      }
    },
    created() {
      this.listRegisterProtocols()
    },
    methods: {
      async listRegisterProtocols() {
        try {
          const params = {
            page: 1,
            row: 1
          }
          const res = await listRegisterProtocols(params)
          if (res.data && res.data.length > 0) {
  
            this.registerProtocolInfo = {
              ...res.data[0],
              protolcolId: res.data[0].protolcolId || ''
            }
            if (this.$refs.userProtocolEditor) {
              this.$refs.userProtocolEditor.setContent(this.registerProtocolInfo.userProtocol || '');
            }
            if (this.$refs.merchantProtocolEditor) {
              this.$refs.merchantProtocolEditor.setContent(this.registerProtocolInfo.merchantProtocol || '');
            }
          }
        } catch (error) {
          this.$message.error(this.$t('registerProtocol.fetchError'))
        }
      },
      async updateRegisterProtocol() {
        try {
          await updateRegisterProtocol(this.registerProtocolInfo)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
83
          this.$message.success(this.$t('common.operationSuccess'))
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
          this.listRegisterProtocols()
        } catch (error) {
          this.$message.error(error.message || this.$t('common.updateFailed'))
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .register-protocol-container {
    padding: 20px;
  
    .box-card {
      margin-bottom: 20px;
    }
  
    .card-content {
      padding: 20px;
    }
  
    .editor-container {
      margin-bottom: 20px;
    }
  }
  </style>