doum
3 天以前 66b84de58e3efae14c1e258ee716e02ad9557497
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<template>
  <div class="box" style="height:100%;overflow-y: auto" >
    <el-form :model="form" ref="form" label-width="140px">
      <div>
        <span style="font-size: 15px; font-weight: bold">人员授权配置:</span>
      </div>
      <el-form-item label="" prop="frezzDays" label-width="50px">
        人员门禁授权冻结:连续
        <el-input
          style="width: 50px"
          type="text"
          v-model="form.frezzDays"
          placeholder=""
          v-trim
        />
        天,无门禁/车辆闸机事件
      </el-form-item>
      <div>
        <span style="font-size: 15px; font-weight: bold">访客配置:</span>
      </div>
      <el-form-item label="来访预约方式:" prop="reservationWay">
        <el-radio-group v-model="form.reservationWay">
          <el-radio :label="1">预约免登记</el-radio>
          <el-radio :label="0">预约后登记(需要配备访客机)</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="被访人校验方式:" prop="checkVisit">
        <el-radio-group v-model="form.checkVisit">
          <el-radio :label="0">仅手机号</el-radio>
          <el-radio :label="1">手机号&姓名</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="健康证是否必填:" prop="healthCard">
        <el-radio-group v-model="form.healthCard">
          <el-radio :label="0">否</el-radio>
          <el-radio :label="1">是</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="允许自选门禁组:" prop="doorsVisitRequired">
        <el-switch
          v-model="form.doorsVisitRequired"
          active-color="#13ce66"
          inactive-color="#ff4949"
          :active-value="1"
          :inactive-value="0"
        >
        </el-switch>
      </el-form-item>
      <el-form-item label="访客是否答题:" prop="isAnswer">
        <el-switch
          v-model="form.isAnswer"
          active-color="#13ce66"
          inactive-color="#ff4949"
          :active-value="1"
          :inactive-value="0"
        >
        </el-switch>
      </el-form-item>
      <el-form-item label="访客答题主题:" prop="theme">
        <el-input
          style="width: 50%"
          type="textarea"
          v-model="form.theme"
          placeholder="请输入答题标题"
          v-trim
        />
      </el-form-item>
      <el-form-item label="访客答题说明:" prop="description">
        <el-input
          style="width: 50%"
          type="textarea"
          v-model="form.description"
          placeholder="请输入"
          v-trim
        />
      </el-form-item>
      <el-form-item label="在园须知:" prop="visitNotice">
        <!-- <el-tiptap
          style="width: 50%"
          v-model="form.visitNotice"
          :extensions="extensions"
        /> -->
        <RichEditor style="width: 70%" :richData="form.visitNotice" :styleEditor="styleEditor" @getWangedditor="getWangedditor" :readonly="false"/>
      </el-form-item>
      <el-form-item label="访客预约指南:" prop="visitNotice">
        <!-- <el-tiptap
          style="width: 50%"
          v-model="form.visitTips"
          :extensions="extensions"
        /> -->
        <RichEditor style="width: 70%" :richData="form.visitTips" :styleEditor="styleEditor" @getWangedditor="getWangedditor1" :readonly="false"/>
      </el-form-item>
      <el-form-item label="访客入园导览图:" prop="visitNotice">
        <!-- <el-tiptap
          style="width: 50%"
          v-model="form.visitMap"
          :extensions="extensions"
        /> -->
        <RichEditor style="width: 70%" :richData="form.visitMap" :styleEditor="styleEditor" @getWangedditor="getWangedditor2" :readonly="false"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submit">保存配置项</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
 
<script>
import { getVisitConfigDTO, updateVisitConfig } from '@/api/system/common'
import RichEditor from '@/components/common/RichEditor'
import {
  // necessary extensions
  Doc,
  Text,
  Paragraph,
  Heading,
  Bold,
  Underline,
  Italic,
  Strike,
  ListItem,
  BulletList,
  OrderedList,
  Image,
  Blockquote,
  TextAlign,
  Indent,
  Table,
  TableHeader,
  TableCell,
  TableRow,
  TextColor,
  HorizontalRule
} from 'element-tiptap'
import { upload } from '@/api/system/common'
export default {
  name: 'visitorSources',
  components: {
    RichEditor
  },
  data() {
    return {
      form: {
        id: null,
        checkVisit: 0,
        reservationWay: 0,
        healthCard: 0,
        isAnswer: 0,
        doorsVisitRequired: '',
        theme: '',
        description: '',
        visitNotice: '',
        visitMap: '',
        visitTips: '',
        frezzDays: null
      },
      styleEditor:'border: 1px solid #ccc;display: inline-block;',
      extensions: [
        new Doc(),
        new Text(),
        new Paragraph(),
        new Heading({ level: 5 }),
        new Bold({ bubble: true }),
        new Underline({ bubble: true, menubar: false }),
        new Italic(),
        new Strike(),
        new ListItem(),
        new BulletList(),
        new OrderedList(),
        new Image({
          uploadRequest(file) {
            const fd = new FormData()
            fd.append('folder', 'visit/')
            fd.append('file', file)
            return upload(fd).then(res => {
              return res.url
            })
          }
        }),
        new Blockquote(),
        new TextAlign(),
        new Indent(),
        new Table(),
        new TableHeader(),
        new TableCell(),
        new TableRow(),
        new HorizontalRule(),
        new TextColor()
      ]
    }
  },
 
  created() {
    this.getData()
  },
 
  methods: {
    getWangedditor(val){
      this.form.visitNotice =val
    },
    getWangedditor1(val){
      this.form.visitTips =val
    },
    getWangedditor2(val){
      this.form.visitMap =val
    },
    getData() {
      getVisitConfigDTO({})
        .then(res => {
          this.form.checkVisit = res.checkVisit
          this.form.description = res.description
          this.form.healthCard = res.healthCard
          this.form.isAnswer = res.isAnswer
          this.form.reservationWay = res.reservationWay
          this.form.theme = res.theme
          this.form.doorsVisitRequired = res.doorsVisitRequired
          this.form.visitNotice = res.visitNotice
          this.form.visitTips = res.visitTips
          this.form.visitMap = res.visitMap
          this.form.frezzDays = res.frezzDays
        })
    },
    submit() {
      updateVisitConfig({
        isAnswer: this.form.isAnswer,
        healthCard: this.form.healthCard,
        checkVisit: this.form.checkVisit,
        reservationWay: this.form.reservationWay,
        description: this.form.description,
        theme: this.form.theme,
        visitNotice: this.form.visitNotice,
        visitTips: this.form.visitTips,
        frezzDays: this.form.frezzDays,
        visitMap: this.form.visitMap,
        doorsVisitRequired: this.form.doorsVisitRequired
      }).then(res => {
        this.$message.success('保存成功')
        this.getData()
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.el-container /deep/  .el-main{
  width: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
/deep/ .el-main{
  width: 100%;
  //height: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.box {
  width: 100%;
  padding: 30px;
  box-sizing: border-box;
  background: #ffffff;
}
</style>