MrShi
2025-01-17 db96301a4715b1c4f1180095441963ed6f430797
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>
    <div class="box">
        <div class="content">
            <div class="content_form">
                <el-form ref="form" :model="form" label-width="120px">
                    <el-form-item label="短信模板">
                        <div style="display: flex; align-items: self-start;">
                            <el-input type="textarea" rows="5" v-model="form.smsTemp"></el-input>
<!--                            <el-button type="primary" style="margin-left: 10px;">保存</el-button>-->
                        </div>
                    </el-form-item>
                    <el-form-item label="邮箱模板">
                        <div style="display: flex; align-items: self-start;">
                            <el-input type="textarea" rows="5" v-model="form.emailTemp"></el-input>
<!--                            <el-button type="primary" style="margin-left: 10px;">保存</el-button>-->
                        </div>
                    </el-form-item>
                    <el-form-item label="租赁通知单模板">
                        <div style="display: flex; align-items: self-start;">
                            <el-tooltip style="margin-right: 10px; margin-top: 10px; flex-shrink: 0;" effect="dark" content="包含租赁费、物业费、租赁押金、物业押金" placement="bottom-start">
                                <i class="el-icon-question"></i>
                            </el-tooltip>
                            <el-upload
                                style="flex: 1;"
                                class="upload-demo"
                                :action="uploadImgUrl"
                                :data="uploadData"
                                :on-success="uploadAvatarSuccess"
                                :on-remove="handleRemove"
                                :file-list="form.leaseTemp">
                                <el-button size="small" type="primary">点击上传</el-button>
                            </el-upload>
                        </div>
                    </el-form-item>
                    <el-form-item label="其他通知单模板">
                        <el-upload
                            class="upload-demo"
                            :action="uploadImgUrl"
                            :data="uploadData"
                            :on-success="uploadAvatarSuccess1"
                            :on-remove="handleRemove1"
                            :file-list="form.otherTemp">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="submit">保存</el-button>
                    </el-form-item>
                </el-form>
            </div>
            <el-button @click="$refs.templateKeywords.open('模板关键字')">模板关键字</el-button>
        </div>
        <templateKeywords ref="templateKeywords" />
    </div>
</template>
 
<script>
    import templateKeywords from './components/templateKeywords'
    import { getCallTemp } from '@/api/ywTempConfig'
  export default {
    name: 'collectionSettings',
    data() {
      return {
        uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch',
        uploadData: {
          folder: 'TEMP_CONFIG'
        },
        form: {
          emailTemp: '',
          smsTemp: '',
          leaseTemp: [],
          otherTemp: []
        }
      }
    },
    components: { templateKeywords },
    created () {
      this.getCallTempVal()
    },
    methods: {
      submit() {
      
      },
      handleRemove(e) {
        this.form.leaseTemp = []
      },
      uploadAvatarSuccess(file) {
        const item = file.data[0]
        this.form.leaseTemp = [{ ...item, name: item.originname }]
      },
      handleRemove1(e) {
        this.form.otherTemp = []
      },
      uploadAvatarSuccess1(file) {
        const item = file.data[0]
        this.form.otherTemp = [{ ...item, name: item.originname }]
      },
      getCallTempVal() {
        getCallTemp({})
            .then(res => {
              this.form.smsTemp = res.smsTemp.title
              this.form.emailTemp = res.emailTemp.title
              this.form.leaseTemp = [{ url: res.leaseTemp.url, name: res.leaseTemp.title }]
              this.form.otherTemp = [{ url: res.otherTemp.url, name: res.otherTemp.title }]
            })
      }
    }
  }
</script>
 
<style lang="scss" scoped>
    .box {
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        .content {
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            background: #ffffff;
            display: flex;
            align-items: self-start;
            justify-content: space-between;
            .content_form {
                width: 70%;
            }
        }
    }
</style>