9cd53a9f
wuxw
完成办公功能
|
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
|
<template>
<el-dialog
:title="$t('addNotepad.title')"
:visible.sync="visible"
width="70%"
@close="handleClose"
>
<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">
<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"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('addNotepad.content')" prop="title">
<el-input
type="textarea"
:rows="5"
v-model="addNotepadInfo.title"
:placeholder="$t('addNotepad.contentPlaceholder')"
/>
</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'
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()
},
async getNoteTypes() {
try {
const data = await getDict('notepad', 'note_type')
this.addNotepadInfo.noteTypes = data
} catch (error) {
console.error('Failed to get note types:', error)
}
},
async saveNotepadInfo() {
this.$refs.form.validate(async valid => {
if (!valid) return
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>
|