|  |  |  | 
|---|
|  |  |  | <el-form-item label="数据标签" prop="label" required> | 
|---|
|  |  |  | <el-input v-model="form.label" placeholder="请输入数据标签" v-trim maxlength="50"/> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="是否富文本" prop="istext" > | 
|---|
|  |  |  | <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 /> | 
|---|
|  |  |  | <el-input v-if="!form.istext" v-model="form.code" placeholder="请输入数据值" v-trim maxlength="500"/> | 
|---|
|  |  |  | <RichEditor v-else  :richData="form.code" :styleEditor="styleEditor" @getWangedditor="getWangedditor" :readonly="false"/> | 
|---|
|  |  |  | </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"/> | 
|---|
|  |  |  | <span class="status-text">{{form.disabled | disabledText}}</span> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="说明" prop="remark"> | 
|---|
|  |  |  | <el-input v-model="form.remark" placeholder="请输入数据说明" v-trim /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | </el-form> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaDictDataWindow', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | components: { GlobalWindow }, | 
|---|
|  |  |  | components: { GlobalWindow,RichEditor }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | styleEditor:'border: 1px solid #ccc;display: inline-block;', | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | id: null, | 
|---|
|  |  |  | dictId: null, | 
|---|
|  |  |  | code: '', | 
|---|
|  |  |  | label: '', | 
|---|
|  |  |  | disabled: false | 
|---|
|  |  |  | disabled: false, | 
|---|
|  |  |  | remark: '', | 
|---|
|  |  |  | istext: false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 验证规则 | 
|---|
|  |  |  | rules: { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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: { | 
|---|
|  |  |  | getWangedditor(val){ | 
|---|
|  |  |  | this.form.code =val | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @title 窗口标题 | 
|---|
|  |  |  | * @dict 所属字典ID | 
|---|
|  |  |  | 
|---|
|  |  |  | open (title, dictId, target) { | 
|---|
|  |  |  | this.title = title | 
|---|
|  |  |  | this.visible = true | 
|---|
|  |  |  | this.form.remark='' | 
|---|
|  |  |  | // 新建 | 
|---|
|  |  |  | if (target == null) { | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.$refs.form.resetFields() | 
|---|
|  |  |  | this.form.id = null | 
|---|
|  |  |  | this.form.dictId = dictId | 
|---|
|  |  |  | this.form.istext=false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | for (const key in this.form) { | 
|---|
|  |  |  | this.form[key] = target[key] | 
|---|
|  |  |  | this.form.dictId = dictId | 
|---|
|  |  |  | this.form.istext=false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|