jiangping
2024-05-09 b62578f8b43f15be89b3d14f463f11aed03e6fb9
admin/src/views/business/visitorSources.vue
@@ -19,6 +19,15 @@
                    <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"
@@ -34,6 +43,9 @@
            <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" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submit">保存配置项</el-button>
            </el-form-item>
@@ -43,6 +55,31 @@
<script>
import { getVisitConfigDTO, updateVisitConfig } from '@/api/system/common'
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',
@@ -54,9 +91,43 @@
        reservationWay: 0,
        healthCard: 0,
        isAnswer: 0,
        doorsVisitRequired: '',
        theme: '',
        description: ''
      }
        description: '',
        visitNotice: ''
      },
      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.prefixPath + res.folder + res.halfPath
            })
          }
        }),
        new Blockquote(),
        new TextAlign(),
        new Indent(),
        new Table(),
        new TableHeader(),
        new TableCell(),
        new TableRow(),
        new HorizontalRule(),
        new TextColor()
      ]
    }
  },
@@ -74,6 +145,8 @@
          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
        })
    },
    submit () {
@@ -83,7 +156,9 @@
        checkVisit: this.form.checkVisit,
        reservationWay: this.form.reservationWay,
        description: this.form.description,
        theme: this.form.theme
        theme: this.form.theme,
        visitNotice: this.form.visitNotice,
        doorsVisitRequired: this.form.doorsVisitRequired
      }).then(res => {
        this.$message.success('保存成功')
        this.getData()
@@ -96,7 +171,6 @@
<style lang="scss" scoped>
    .box {
        width: 100%;
        height: 100%;
        padding: 30px;
        box-sizing: border-box;
        background: #ffffff;