Blame view

src/components/system/EditSystemInfo.vue 7.16 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
1
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
110
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  <template>
    <el-dialog :title="$t('systemInfo.editTitle')" :visible="visible" width="70%" :close-on-click-modal="false">
      <el-form ref="form" :model="formData" label-width="150px" :rules="rules">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.systemTitle')" prop="systemTitle">
              <el-input v-model="formData.systemTitle"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.systemTitle') })" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.subSystemTitle')" prop="subSystemTitle">
              <el-input v-model="formData.subSystemTitle"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.subSystemTitle') })" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.systemSimpleTitle')" prop="systemSimpleTitle">
              <el-input v-model="formData.systemSimpleTitle"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.systemSimpleTitle') })" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.companyName')" prop="companyName">
              <el-input v-model="formData.companyName"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.companyName') })" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.logoUrl')" prop="logoUrl">
              <el-input v-model="formData.logoUrl"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.logoUrl') })" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.imgUrl')" prop="imgUrl">
              <el-input v-model="formData.imgUrl"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.imgUrl') })" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.defaultCommunityId')" prop="defaultCommunityId">
              <el-input v-model="formData.defaultCommunityId"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.defaultCommunityId') })" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.ownerTitle')" prop="ownerTitle">
              <el-input v-model="formData.ownerTitle"
                :placeholder="$t('systemInfo.required', { field: $t('systemInfo.ownerTitle') })" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.propertyTitle')" prop="propertyTitle">
              <el-input v-model="formData.propertyTitle"
                 />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.qqMapKey')" prop="qqMapKey">
              <el-input v-model="formData.qqMapKey"
                 />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="$t('systemInfo.mallUrl')" prop="mallUrl">
              <el-input v-model="formData.mallUrl"
                 />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
  
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="submitForm">{{$t('common.save')}}</el-button>
  
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { updateSystemInfo } from '@/api/system/systemInfoManageApi'
  
  export default {
    name: 'EditSystemInfo',
    props: {
      formData: {
        type: Object,
        default: () => ({})
      }
    },
    data() {
      return {
        visible: false,
        rules: {
          systemTitle: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.systemTitle') }), trigger: 'blur' },
            { max: 64, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.systemTitle'), length: 64 }), trigger: 'blur' }
          ],
          subSystemTitle: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.subSystemTitle') }), trigger: 'blur' },
            { max: 64, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.subSystemTitle'), length: 64 }), trigger: 'blur' }
          ],
          companyName: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.companyName') }), trigger: 'blur' },
            { max: 128, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.companyName'), length: 128 }), trigger: 'blur' }
          ],
          logoUrl: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.logoUrl') }), trigger: 'blur' },
            { max: 200, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.logoUrl'), length: 200 }), trigger: 'blur' }
          ],
          imgUrl: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.imgUrl') }), trigger: 'blur' },
            { max: 512, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.imgUrl'), length: 512 }), trigger: 'blur' }
          ],
          ownerTitle: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.ownerTitle') }), trigger: 'blur' },
            { max: 64, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.ownerTitle'), length: 64 }), trigger: 'blur' }
          ],
          propertyTitle: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.propertyTitle') }), trigger: 'blur' },
            { max: 64, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.propertyTitle'), length: 64 }), trigger: 'blur' }
          ],
          qqMapKey: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.qqMapKey') }), trigger: 'blur' },
            { max: 64, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.qqMapKey'), length: 64 }), trigger: 'blur' }
          ],
          mallUrl: [
            { required: true, message: this.$t('systemInfo.required', { field: this.$t('systemInfo.mallUrl') }), trigger: 'blur' },
            { max: 128, message: this.$t('systemInfo.maxLength', { field: this.$t('systemInfo.mallUrl'), length: 128 }), trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      open() {
        this.visible = true
      },
      submitForm() {
        this.$refs.form.validate(async valid => {
          if (valid) {
            try {
              await updateSystemInfo(this.formData)
              this.$emit('success')
              this.visible = false
            } catch (error) {
              this.$message.error(error.message || this.$t('common.updateFailed'))
            }
          }
        })
      }
    }
  }
  </script>