|  |  |  | 
|---|
|  |  |  | <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.title"></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.title"></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> | 
|---|
|  |  |  | <div style="display: flex; align-items: center;"> | 
|---|
|  |  |  | <el-button type="text" v-for="(item, index) in form.leaseTemp" :key="index" style="margin-right: 10px;" @click="openFile(item.url)">{{item.name}}</el-button> | 
|---|
|  |  |  | <el-upload | 
|---|
|  |  |  | class="upload-demo" | 
|---|
|  |  |  | :action="uploadImgUrl" | 
|---|
|  |  |  | :data="uploadData" | 
|---|
|  |  |  | :on-success="uploadAvatarSuccess" | 
|---|
|  |  |  | :on-remove="handleRemove"> | 
|---|
|  |  |  | <el-button size="small" type="primary">点击上传</el-button> | 
|---|
|  |  |  | </el-upload> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--                            <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="其他通知单模板"> | 
|---|
|  |  |  | <div style="display: flex; align-items: center;"> | 
|---|
|  |  |  | <el-button type="text" v-for="(item, index) in form.otherTemp" :key="index" style="margin-right: 10px;" @click="openFile(item.url)">{{item.name}}</el-button> | 
|---|
|  |  |  | <el-upload | 
|---|
|  |  |  | class="upload-demo" | 
|---|
|  |  |  | :action="uploadImgUrl" | 
|---|
|  |  |  | :data="uploadData" | 
|---|
|  |  |  | :on-success="uploadAvatarSuccess1" | 
|---|
|  |  |  | :on-remove="handleRemove1"> | 
|---|
|  |  |  | <el-button size="small" type="primary">点击上传</el-button> | 
|---|
|  |  |  | </el-upload> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item> | 
|---|
|  |  |  | <el-button type="primary" @click="submit" :disabled="loading" :loading="loading">保存</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, updTempConfig } from '@/api/ywTempConfig' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'collectionSettings' | 
|---|
|  |  |  | name: 'collectionSettings', | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch', | 
|---|
|  |  |  | uploadData: { | 
|---|
|  |  |  | folder: 'TEMP_CONFIG' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | emailTemp: {}, | 
|---|
|  |  |  | smsTemp: {}, | 
|---|
|  |  |  | leaseTemp: [], | 
|---|
|  |  |  | otherTemp: [] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | loading: false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | components: { templateKeywords }, | 
|---|
|  |  |  | created () { | 
|---|
|  |  |  | this.getCallTempVal() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | submit() { | 
|---|
|  |  |  | this.loading = true | 
|---|
|  |  |  | updTempConfig({ | 
|---|
|  |  |  | emailTemp: this.form.emailTemp, | 
|---|
|  |  |  | smsTemp: this.form.smsTemp, | 
|---|
|  |  |  | leaseTemp: this.form.leaseTemp[0], | 
|---|
|  |  |  | otherTemp: this.form.otherTemp[0] | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | this.$message.success('更新成功!') | 
|---|
|  |  |  | this.getCallTempVal() | 
|---|
|  |  |  | }).finally(() => { | 
|---|
|  |  |  | this.loading = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | openFile(url) { | 
|---|
|  |  |  | window.open(url) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | this.form.emailTemp = res.emailTemp | 
|---|
|  |  |  | this.form.leaseTemp = [{ url: res.leaseTemp.url, ...res.leaseTemp, name: res.leaseTemp.title }] | 
|---|
|  |  |  | this.form.otherTemp = [{ url: res.otherTemp.url, ...res.otherTemp, 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> | 
|---|