|  |  | 
 |  |  | <template> | 
 |  |  |   <GlobalWindow | 
 |  |  |     :title="title" | 
 |  |  |     :visible.sync="visible" | 
 |  |  |     :confirm-working="isWorking.create" | 
 |  |  |     @confirm="confirm" | 
 |  |  |       :title="title" | 
 |  |  |       :visible.sync="visible" | 
 |  |  |       :confirm-working="isWorking.create" | 
 |  |  |       @confirm="confirm" | 
 |  |  |   > | 
 |  |  |     <el-form :model="form" ref="form" :rules="rules"> | 
 |  |  |       <el-form-item label="数据说明" prop="label" required> | 
 |  |  |         <el-input v-model="form.remark" placeholder="请输入数据说明" v-trim/> | 
 |  |  |       </el-form-item> | 
 |  |  |       <el-form-item label="数据标签" prop="label" required> | 
 |  |  |         <el-input v-model="form.label" placeholder="请输入数据标签" v-trim maxlength="50"/> | 
 |  |  |         <el-input v-model="form.label" placeholder="请输入数据标签" v-trim/> | 
 |  |  |       </el-form-item> | 
 |  |  |       <el-form-item label="是否富文本" prop="istext" > | 
 |  |  |         <el-radio-group v-model="form.istext"> | 
 |  |  |           <el-radio :label="0" value="0">文本</el-radio> | 
 |  |  |           <el-radio :label="1" value="1">图片|文件</el-radio> | 
 |  |  |           <el-radio :label="2" value="2">富文本</el-radio> | 
 |  |  |         </el-radio-group> | 
 |  |  | <!--        <el-switch v-model="form.istext" :active-value="true" :inactive-value="false"/> | 
 |  |  |         <span class="status-text">{{form.istext | disabledText1}}</span>--> | 
 |  |  |       </el-form-item> | 
 |  |  |       <el-form-item label="数据值" prop="code" required> | 
 |  |  |         <el-tiptap | 
 |  |  |                 v-if="[175].includes(form.id)" | 
 |  |  |                 v-model="form.code" | 
 |  |  |                 :extensions="extensions" | 
 |  |  |         /> | 
 |  |  |         <el-input v-else v-model="form.code" placeholder="请输入数据值" v-trim /> | 
 |  |  |         <template  v-if="form.istext == 1" > | 
 |  |  |           <UploadFile :uploadData="{ folder: 'richeditor',fileType:'' }" :fileList="fileList" @uploadSuccess="fileUploaded" /> | 
 |  |  |           <el-input  readonly v-model="form.code" placeholder="完整数据值" v-trim/> | 
 |  |  |         </template> | 
 |  |  |         <RichEditor v-if="form.istext == 2"  :richData="form.code" :styleEditor="styleEditor" @getWangedditor="getWangedditor" :readonly="false"/> | 
 |  |  |         <el-input v-if="form.istext == 0"  v-model="form.code" placeholder="请输入数据值" v-trim/> | 
 |  |  |       </el-form-item> | 
 |  |  |       <el-form-item label="状态" prop="disabled" required class="form-item-status"> | 
 |  |  |         <el-switch v-model="form.disabled" :active-value="false" :inactive-value="true"/> | 
 |  |  | 
 |  |  | <script> | 
 |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
 |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
 |  |  | import { upload } 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 RichEditor from '@/components/common/RichEditor' | 
 |  |  | import UploadFile from "@/components/common/UploadFile" | 
 |  |  | export default { | 
 |  |  |   name: 'OperaDictDataWindow', | 
 |  |  |   extends: BaseOpera, | 
 |  |  |   components: { GlobalWindow }, | 
 |  |  |   components: {UploadFile, GlobalWindow,RichEditor }, | 
 |  |  |   data () { | 
 |  |  |     return { | 
 |  |  |       // 表单数据 | 
 |  |  |       styleEditor:'border: 1px solid #ccc;display: inline-block;', | 
 |  |  |       form: { | 
 |  |  |         id: null, | 
 |  |  |         dictId: null, | 
 |  |  |         code: '', | 
 |  |  |         label: '', | 
 |  |  |         disabled: false | 
 |  |  |         disabled: false, | 
 |  |  |         istext: 0, | 
 |  |  |         remark: '' | 
 |  |  |       }, | 
 |  |  |       fileList: [], | 
 |  |  |       // 验证规则 | 
 |  |  |       rules: { | 
 |  |  |         label: [ | 
 |  |  | 
 |  |  |         code: [ | 
 |  |  |           { required: true, message: '请输入数据值' } | 
 |  |  |         ] | 
 |  |  |       }, | 
 |  |  |       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() | 
 |  |  |       ] | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  |     fileUploaded(data){ | 
 |  |  |       this.form.code = data.fileurlFull | 
 |  |  |     }, | 
 |  |  |     getWangedditor(val){ | 
 |  |  |       this.form.code =val | 
 |  |  |     }, | 
 |  |  |     /** | 
 |  |  |      * @title 窗口标题 | 
 |  |  |      * @dict 所属字典ID | 
 |  |  | 
 |  |  |     open (title, dictId, target) { | 
 |  |  |       this.title = title | 
 |  |  |       this.visible = true | 
 |  |  |  | 
 |  |  |       this.form.istext = 0 | 
 |  |  |       // 新建 | 
 |  |  |       if (target == null) { | 
 |  |  |         this.$nextTick(() => { | 
 |  |  |           this.$refs.form.resetFields() | 
 |  |  |           this.form.id = null | 
 |  |  |           this.form.dictId = dictId | 
 |  |  |           this.form.istext=0 | 
 |  |  |         }) | 
 |  |  |         return | 
 |  |  |       } | 
 |  |  | 
 |  |  |       this.$nextTick(() => { | 
 |  |  |         for (const key in this.form) { | 
 |  |  |           this.form[key] = target[key] | 
 |  |  |           this.form.dictId = dictId | 
 |  |  |           this.form.istext = 0 | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     } |