Blame view

src/components/oa/addNotepad.vue 4.24 KB
9cd53a9f   wuxw   完成办公功能
1
  <template>
f143e79f   wuxw   v1.9 产权登记看不到图片bug
2
    <el-dialog :title="$t('addNotepad.title')" :visible.sync="visible" width="70%" @close="handleClose">
9cd53a9f   wuxw   完成办公功能
3
4
5
6
7
8
9
10
11
12
13
      <el-form :model="addNotepadInfo" ref="form" :rules="rules" label-width="120px">
        <el-form-item :label="$t('addNotepad.room')" prop="roomName">
          <el-input v-model="addNotepadInfo.roomName" disabled></el-input>
        </el-form-item>
        <el-form-item :label="$t('addNotepad.contact')" prop="objName">
          <el-input v-model="addNotepadInfo.objName" disabled></el-input>
        </el-form-item>
        <el-form-item :label="$t('addNotepad.phone')" prop="link">
          <el-input v-model="addNotepadInfo.link" disabled></el-input>
        </el-form-item>
        <el-form-item :label="$t('addNotepad.type')" prop="noteType">
f143e79f   wuxw   v1.9 产权登记看不到图片bug
14
15
16
          <el-select v-model="addNotepadInfo.noteType" style="width:100%" :placeholder="$t('addNotepad.typePlaceholder')">
            <el-option v-for="item in addNotepadInfo.noteTypes" :key="item.statusCd" :label="item.name"
              :value="item.statusCd" />
9cd53a9f   wuxw   完成办公功能
17
18
19
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('addNotepad.content')" prop="title">
f143e79f   wuxw   v1.9 产权登记看不到图片bug
20
21
          <el-input type="textarea" :rows="5" v-model="addNotepadInfo.title"
            :placeholder="$t('addNotepad.contentPlaceholder')" />
9cd53a9f   wuxw   完成办公功能
22
23
24
25
26
27
28
29
30
31
32
33
34
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="saveNotepadInfo">{{ $t('common.save') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { getDict } from '@/api/community/communityApi'
  import { saveNotepad } from '@/api/oa/simplifyNotepadManageApi'
f143e79f   wuxw   v1.9 产权登记看不到图片bug
35
  import {queryRooms} from '@/api/room/roomApi'
9cd53a9f   wuxw   完成办公功能
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
  
  export default {
    name: 'AddNotepad',
    data() {
      return {
        visible: false,
        addNotepadInfo: {
          noteId: '',
          noteType: '',
          title: '',
          roomName: '',
          roomId: '',
          objId: '',
          objName: '',
          objType: '3309',
          link: '',
          noteTypes: [],
          communityId: ''
        },
        rules: {
          roomName: [
            { required: true, message: this.$t('addNotepad.roomRequired'), trigger: 'blur' }
          ],
          objName: [
            { required: true, message: this.$t('addNotepad.contactRequired'), trigger: 'blur' }
          ],
          link: [
            { required: true, message: this.$t('addNotepad.phoneRequired'), trigger: 'blur' },
            { pattern: /^1[3-9]\d{9}$/, message: this.$t('addNotepad.phoneFormat'), trigger: 'blur' }
          ],
          noteType: [
            { required: true, message: this.$t('addNotepad.typeRequired'), trigger: 'change' }
          ],
          title: [
            { required: true, message: this.$t('addNotepad.contentRequired'), trigger: 'blur' },
            { max: 256, message: this.$t('addNotepad.contentMaxLength'), trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      open(params) {
        this.visible = true
        this.addNotepadInfo = {
          ...this.addNotepadInfo,
          ...params,
          communityId: getCommunityId()
        }
        this.getNoteTypes()
f143e79f   wuxw   v1.9 产权登记看不到图片bug
85
        this.listNotepadRoom()
9cd53a9f   wuxw   完成办公功能
86
87
88
89
90
91
92
93
94
      },
      async getNoteTypes() {
        try {
          const data = await getDict('notepad', 'note_type')
          this.addNotepadInfo.noteTypes = data
        } catch (error) {
          console.error('Failed to get note types:', error)
        }
      },
f143e79f   wuxw   v1.9 产权登记看不到图片bug
95
96
97
98
99
100
101
102
103
104
105
      async listNotepadRoom() {
        const { rooms } = await queryRooms({
          communityId: this.addNotepadInfo.communityId,
          page:1,
          row:1,
          roomId:this.addNotepadInfo.roomId
        })
        Object.assign(this.addNotepadInfo,rooms[0])
        this.addNotepadInfo.objId = rooms[0].ownerId
        this.addNotepadInfo.objName = rooms[0].ownerName
      },
9cd53a9f   wuxw   完成办公功能
106
107
108
      async saveNotepadInfo() {
        this.$refs.form.validate(async valid => {
          if (!valid) return
f143e79f   wuxw   v1.9 产权登记看不到图片bug
109
  
9cd53a9f   wuxw   完成办公功能
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
          try {
            await saveNotepad(this.addNotepadInfo)
            this.$emit('success')
            this.visible = false
            this.$message.success(this.$t('common.saveSuccess'))
          } catch (error) {
            this.$message.error(error.message || this.$t('common.saveFailed'))
          }
        })
      },
      handleClose() {
        this.$refs.form.resetFields()
      }
    }
  }
  </script>