1114 lines
40 KiB
Vue
1114 lines
40 KiB
Vue
<template>
|
|
<a-drawer
|
|
class="split-table-drawer"
|
|
:title="formTitle"
|
|
placement="right"
|
|
:visible="visible"
|
|
:after-visible-change="afterVisibleChange"
|
|
@close="onClose"
|
|
width="900"
|
|
>
|
|
<a-spin :spinning="loading">
|
|
<a-form>
|
|
<a-form-model
|
|
class="split-content"
|
|
:model="formInline"
|
|
:rules="rules"
|
|
ref="splitEditForm"
|
|
>
|
|
<a-row :gutter="24" class="split-form-row">
|
|
<a-col :span="12" v-for="(item,index) in dataList" :key="index">
|
|
<div class="box-title-text" v-if="item.field_show_type === '1' || item.field_show_type === '11'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-input class="box-input"
|
|
:disabled="disabled"
|
|
v-model="formInline[item.db_field_name]"
|
|
:placeholder="$t('PleaseEnter')+item.db_field_txt"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '2'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-input-number class="box-input"
|
|
:placeholder="$t('PleaseEnter')+item.db_field_txt"
|
|
:disabled="disabled"
|
|
:min="0"
|
|
v-model="formInline[item.db_field_name]" :max="99999999"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '3'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<j-dict-select-tag class="box-input" v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
@input="handleInput(item.db_field_name)"
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
:type="'select'"
|
|
:triggerChange="false" :dictCode="item.dict_field"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '4'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model-multi" :prop="item.db_field_name">
|
|
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
:type="'select'"
|
|
:triggerChange="false" :dictCode="item.dict_field"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '5'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-date-picker class="box-input"
|
|
format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
:getCalendarContainer="(trigger) => trigger.parentNode"
|
|
v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
style="width: 100%"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '6'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-range-picker class="box-input" v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
@change="onChange(item.db_field_name)"></a-range-picker>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '7'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-button type="primary" class="button-text"
|
|
@click="clickButtonToUpload(item)">
|
|
{{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
|
|
formInline[item.db_field_name] === null) ? $t('clickUpload') : $t('viewUploadedFiles')
|
|
}}
|
|
</a-button>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '8'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-textarea
|
|
:placeholder="$t('PleaseEnter')+item.db_field_txt"
|
|
:disabled="disabled"
|
|
v-model="formInline[item.db_field_name]" :rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '9' || item.field_show_type === 'sel_user'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<PersonnelSelection :query="item"
|
|
v-if="visible"
|
|
:personneQuery="formInline"
|
|
@change="PersonnelSelectionChange"
|
|
:disabled="disabled"
|
|
v-model="formInline[item.db_field_name]"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === '10'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<Standardselection :query="item"
|
|
:disabled="disabled"
|
|
:standard="formInline"
|
|
v-model="formInline[item.db_field_name]"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === 'RADIO'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<j-dict-select-tag v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
class="box-input"
|
|
@input="handleInput(item.db_field_name)"
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" :title="item.db_field_txt" v-else-if="item.field_show_type === '0'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" :prop="item.db_field_name">
|
|
<a-tree-select
|
|
tree-node-filter-prop="title"
|
|
v-model="formInline[item.db_field_name]"
|
|
class="box-input"
|
|
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
|
style="width: 100%"
|
|
:tree-data="item.tree"
|
|
tree-checkable
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
@change="changeTree"
|
|
/>
|
|
|
|
</a-form-model-item>
|
|
</div>
|
|
<div class="box-title-text" v-else-if="item.field_show_type === 'CHECKBOX'">
|
|
<div class="title-text">
|
|
<span class="required" v-if="item.field_must_input === 1">*</span>
|
|
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model-multi" :prop="item.db_field_name">
|
|
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
:type="'checkbox'"
|
|
:triggerChange="false" :dictCode="item.dict_field"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
<upload-file ref="uploadFile" :accept="accept" @change="uploadFileChange" :return-url="false"></upload-file>
|
|
|
|
<span class="con-divider">{{$t('clauseContent')}}</span>
|
|
<a-divider dashed />
|
|
<div class="table-operator">
|
|
<div class="operator-text" @click="splitAdd('-1')">
|
|
<a-icon type="plus" />
|
|
{{$t('Add')}}
|
|
</div>
|
|
</div>
|
|
<a-row :gutter="24" class="split-content-row" id="split-content" v-for="(item, index) in contentList" :key="index">
|
|
<div class="split-row">
|
|
<div class="row-left">
|
|
<a-textarea v-if="item.type==='TEXT'" v-model="item.itemContent" :show-count="true" :maxlength="1000" :placeholder="$t('pleaseEnter')+$t('content')" />
|
|
<viewer>
|
|
<img v-if="item.type==='IMG'" :src="item.thumbUrl?item.thumbUrl:item.itemContent" alt="">
|
|
</viewer>
|
|
<!-- <img v-if="item.type==='IMG'" :src="item.thumbUrl?item.thumbUrl:item.itemContent" alt="" @click="preImg(item)">-->
|
|
<div v-if="item.type==='TABLE'" v-html="item.itemContent" class="item-table"></div>
|
|
</div>
|
|
<div class="row-right">
|
|
<a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button>
|
|
<a-button class="row-btn-edit" @click="splitEdit(index,item)" v-if="item.type==='TABLE'">{{$t('edit')}}</a-button>
|
|
<a-button @click="splitDelete(item,index)">{{$t('delete')}}</a-button>
|
|
</div>
|
|
</div>
|
|
</a-row>
|
|
</a-form-model>
|
|
</a-form>
|
|
<div class="split-form-footer">
|
|
<a-button type="primary" class="footer-btn-save" @click="splitSave">{{$t('preservation')}}</a-button>
|
|
<a-button @click="splitCancel">{{$t('cancel')}}</a-button>
|
|
</div>
|
|
</a-spin>
|
|
<!-- 图片预览 -->
|
|
<a-modal
|
|
:title="titlePreImg"
|
|
class="split-img"
|
|
:visible="preImgVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="handleOk"
|
|
@cancel="handlePreImgCancel"
|
|
:footer="false"
|
|
>
|
|
<img :src="itemSrc" alt="">
|
|
</a-modal>
|
|
<!-- 类型选择弹框-->
|
|
<a-modal
|
|
:title="$t('Add')"
|
|
class="split-title"
|
|
:visible="addConVisible"
|
|
@ok="handleOk"
|
|
@cancel="handleCancel"
|
|
>
|
|
<div class="title-wraper">
|
|
<div class="title-top">
|
|
<span class="title-flex title-text-flex" :class="{'title-flex-active':selected==='TEXT'}" @click="selectTitle('TEXT')">{{$t('text')}}</span>
|
|
<span class="title-flex title-pic" :class="{'title-flex-active':selected==='IMG'}" @click="selectTitle('IMG')">{{$t('picture')}}</span>
|
|
<span class="title-flex title-table" :class="{'title-flex-active':selected==='TABLE'}" @click="selectTitle('TABLE')">{{$t('table')}}</span>
|
|
</div>
|
|
<div class="title-num" v-if="selectedNum">
|
|
<a-form>
|
|
<a-form-model
|
|
class="number-content"
|
|
:model="numberForm"
|
|
:rules="validatorRules"
|
|
ref="numberForm"
|
|
>
|
|
<a-form-model-item :label="$t('addQuantity')" prop="textNumber">
|
|
<a-row :gutter="24">
|
|
<a-col :span="24">
|
|
<a-input-number class="title-num-edit box-input" :min="0" :max="100" v-model="numberForm.textNumber" :placeholder="$t('enterQuantity')" :formatter="limitNumber" :parser="limitNumber" ></a-input-number>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
</a-form>
|
|
</div>
|
|
</div>
|
|
</a-modal>
|
|
<!-- 上传图片弹框 -->
|
|
<split-upload v-if="splitVisible" ref="uploadFile2" :disabled="disabled" :title="titleImg" :listType='listType' :splitVisible="splitVisible" :accept="accept" @coloseHandle="coloseHandle" @uploadSuccess="uploadSuccess1"></split-upload>
|
|
<!-- 输入表格行数列数 -->
|
|
<a-modal
|
|
:title="titleColRow"
|
|
class="split-col-title"
|
|
:visible="tableColVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="handleColOk"
|
|
@cancel="handleColCancel"
|
|
>
|
|
<a-form :form="form" :label-col="{ span: 8 }" :wrapper-col="{ span: 14 }">
|
|
<a-form-model
|
|
class="number-content"
|
|
:model="rowColForm"
|
|
:rules="validatorRowColRules"
|
|
ref="numberRowColForm"
|
|
>
|
|
<a-form-model-item :label="$t('numberRows')" prop="rowCount">
|
|
<!-- <a-form-item :label="$t('numberRows')">-->
|
|
<a-input-number class="box-input" v-model="rowColForm.rowCount" :min="1" :max="100" :placeholder="$t('pleaseEnter')+$t('numberRows')" :formatter="limitNumber" :parser="limitNumber" style="width: 100%" />
|
|
<!-- </a-form-item>-->
|
|
</a-form-model-item>
|
|
<a-form-model-item :label="$t('numberColumns')" prop="colCount">
|
|
<!-- <a-form-item :label="$t('numberColumns')">-->
|
|
<a-input-number class="box-input" v-model="rowColForm.colCount" :min="1" :max="100" :placeholder="$t('pleaseEnter')+$t('numberColumns')" :formatter="limitNumber" :parser="limitNumber" style="width: 100%" />
|
|
<!-- </a-form-item>-->
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
</a-form>
|
|
</a-modal>
|
|
<!-- 表格弹框 -->
|
|
<a-modal
|
|
:title="titleTable"
|
|
class="split-table-title"
|
|
:visible="tableVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="handleOkTable"
|
|
@cancel="handleCancelTable"
|
|
width="700"
|
|
>
|
|
<u-editor v-if="tableVisible" :content="ueContent" :config=config ref="ueditor" @editor-onChange="uEditorChange"></u-editor>
|
|
</a-modal>
|
|
</a-drawer>
|
|
</template>
|
|
|
|
<script>
|
|
import UploadFile from '@/components/UploadFile'
|
|
import StandardSelection from '@/components/selection/StandardSelection'
|
|
import SplitUpload from '@/components/splitUpload/SplitUpload'
|
|
import UEditor from '@/components/uEditor/UEditor'
|
|
import moment from 'moment'
|
|
import axios from 'axios'
|
|
import { getAction, postAction } from '@/api/manage'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
export default {
|
|
name: 'SplitAddForm',
|
|
components: {
|
|
uploadFile,
|
|
Standardselection,
|
|
SplitUpload,
|
|
UEditor
|
|
},
|
|
data () {
|
|
return {
|
|
formTitle: '',
|
|
titleTable: this.$t('table'),
|
|
titleColRow: this.$t('tableRowsColumns'),
|
|
title: this.$t('newClause'),
|
|
titlePreImg: '',
|
|
contentList: [],
|
|
selected: 'TEXT',
|
|
selectedNum: true,
|
|
confirmLoading: false,
|
|
visible: false,
|
|
addConVisible: false,
|
|
form: {},
|
|
addIndex: '',
|
|
accept: 'image/*',
|
|
listType: 'picture',
|
|
disabled: false,
|
|
splitVisible: false,
|
|
tableVisible: false,
|
|
preImgVisible: false, // 图片预览
|
|
itemSrc: '', // 预览图片
|
|
ueContent: '',
|
|
// UE编辑器配置
|
|
config: {
|
|
// 可以在此处定义工具栏的内容
|
|
toolbars: [
|
|
[
|
|
'undo', // 撤销
|
|
'redo', // 重做
|
|
'bold', // 加粗
|
|
'italic', // 斜体
|
|
'underline', // 下划线
|
|
'strikethrough', // 删除线
|
|
'subscript', // 下标
|
|
'superscript', // 上标
|
|
'fontborder', // 字符边框
|
|
'fontfamily', // 字体
|
|
'fontsize', // 字号
|
|
'forecolor', // 字体颜色
|
|
// 'backcolor', // 背景色
|
|
'paragraph', // 段落格式
|
|
'customstyle', // 自定义标题
|
|
'indent', // 首行缩进
|
|
'justifyleft', // 居左对齐
|
|
'fullscreen', // 全屏
|
|
'justifyright', // 居右对齐
|
|
'justifycenter', // 居中对齐
|
|
'justifyjustify', // 两端对齐
|
|
'lineheight', // 行间距,
|
|
'rowspacingtop', // 段前距
|
|
'rowspacingbottom', // 段后距
|
|
'directionalityltr', // 从左向右输入
|
|
'directionalityrtl', // 从右向左输入
|
|
'cleardoc', // 清空文档
|
|
'formatmatch', // 格式刷
|
|
'removeformat', // 清除格式
|
|
'source', // 源代码
|
|
'blockquote', // 引用
|
|
'pasteplain', // 纯文本粘贴模式
|
|
'selectall', // 全选
|
|
'horizontal', // 分隔线
|
|
'time', // 时间
|
|
'date', // 日期
|
|
'link', // 超链接
|
|
'unlink', // 取消链接
|
|
// 'background', // 背景
|
|
// 'simpleupload', // 单图上传
|
|
'imagenone', // 默认
|
|
'imageleft', // 左浮动
|
|
'imageright', // 右浮动
|
|
'imagecenter', // 居中
|
|
'touppercase', // 字母大写
|
|
'tolowercase', // 字母小写
|
|
'emotion', // 表情
|
|
'spechars', // 特殊字符
|
|
'searchreplace', // 查询替换
|
|
'insertunorderedlist', // 无序列表
|
|
'insertorderedlist', // 有序列表
|
|
'pagebreak', // 分页
|
|
'insertframe', // 插入Iframe
|
|
'charts', // 图表
|
|
'edittip ', // 编辑提示
|
|
'autotypeset', // 自动排版
|
|
'drafts', // 从草稿箱加载
|
|
'inserttable', // 插入表格
|
|
'deletetable', // 删除表格,
|
|
'insertparagraphbeforetable', // ”表格前插入行”
|
|
'insertrow', // 前插入行
|
|
'insertcol', // 前插入列
|
|
'mergeright', // 右合并单元格
|
|
'mergedown', // 下合并单元格
|
|
'deleterow', // 删除行
|
|
'deletecol', // 删除列
|
|
'splittorows', // 拆分成行
|
|
'splittocols', // 拆分成列
|
|
'splittocells', // 完全拆分单元格
|
|
'inserttitle', // 插入标题
|
|
'deletecaption', // 删除表格标题,
|
|
'mergecells', // 合并多个单元格
|
|
'edittable', // 表格属性
|
|
'edittd' // 单元格属性
|
|
]
|
|
],
|
|
autoHeightEnabled: false,
|
|
autoFloatEnabled: false,
|
|
initialContent: '', // 初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
|
|
autoClearinitialContent: true, // 是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
|
|
initialFrameWidth: 650,
|
|
elementPathEnabled: false,
|
|
initialFrameHeight: 300,
|
|
maximumWords: 4000,
|
|
BaseUrl: '',
|
|
UEDITOR_HOME_URL: '/ueditor/',
|
|
editTableIndex: 1
|
|
|
|
},
|
|
tableColVisible: false,
|
|
formInline: {},
|
|
isFormInline: false,
|
|
dataList: [],
|
|
ruleList: [],
|
|
rules: {},
|
|
uploadName: '',
|
|
type: 'add',
|
|
loading: false,
|
|
token: Vue.ls.get(ACCESS_TOKEN),
|
|
submitFlag: false,
|
|
deleteIds: [],
|
|
numberForm: {},
|
|
validatorRules: {
|
|
textNumber: [
|
|
{ required: true, message: this.$t('enterQuantity'), trigger: 'blur' }
|
|
]
|
|
},
|
|
numberFlag: false,
|
|
rowColForm: {},
|
|
validatorRowColRules: {
|
|
colCount: [
|
|
{ required: true, message: this.$t('pleaseEnter') + this.$t('numberRows'), trigger: 'blur' }
|
|
],
|
|
rowCount: [
|
|
{ required: true, message: this.$t('pleaseEnter') + this.$t('numberColumns'), trigger: 'blur' }
|
|
]
|
|
},
|
|
itemVal: {},
|
|
contentTrees: '',
|
|
isTableEdit: false
|
|
}
|
|
},
|
|
props: {
|
|
url: {
|
|
type: Object,
|
|
default: () => {
|
|
return {}
|
|
}
|
|
},
|
|
flag: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
infoId: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
menuId: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
itemId: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
watch: {
|
|
selected (val) {
|
|
if (this.selected === 'TEXT') {
|
|
this.selectedNum = true
|
|
} else {
|
|
this.selectedNum = false
|
|
}
|
|
}
|
|
},
|
|
mounted () {
|
|
this.loadData()
|
|
this.loadFormInfo()
|
|
},
|
|
methods: {
|
|
loadData () {
|
|
this.loading = true
|
|
getAction(`split/sarFileSplitItemsVal/getItemsValList`, { itemId: this.itemId }).then(res => {
|
|
if (res.success) {
|
|
this.contentList = [...res.result]
|
|
this.contentList.forEach(item => {
|
|
const imgData = item.itemContent.split('fileUrl=')[1]
|
|
item.thumbUrl = window._CONFIG.domianURL + '/sys/split/file/getImage?fileUrl=' + imgData
|
|
})
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 获取表单信息
|
|
loadFormInfo () {
|
|
getAction(`split/sarFileSplitItems/getSplitItemsById`, { id: this.itemId }).then(res => {
|
|
if (res.success) {
|
|
this.formInline = [...res.result]
|
|
}
|
|
})
|
|
},
|
|
onClose () {
|
|
this.$emit('closeVisible', false)
|
|
},
|
|
// 增加按钮
|
|
splitAdd (val) {
|
|
this.addConVisible = true
|
|
if (val === '-1') {
|
|
this.addIndex = this.contentList.length - 1
|
|
} else {
|
|
this.addIndex = val
|
|
}
|
|
},
|
|
// 编辑按钮
|
|
splitEdit (index, item) {
|
|
// console.log('item',item)
|
|
this.addIndex = index
|
|
this.tableVisible = true
|
|
this.isTableEdit = true
|
|
this.ueContent = item.itemContent
|
|
this.$nextTick(() => {
|
|
this.$refs.ueditor.setContent(item.itemContent)
|
|
})
|
|
},
|
|
// 删除按钮
|
|
splitDelete (item, index) {
|
|
if (item.id) {
|
|
this.deleteIds.push(item.id)
|
|
}
|
|
for (let i = index; i < this.contentList.length - 1; i++) {
|
|
this.contentList[index] = this.contentList[index + 1]
|
|
}
|
|
this.contentList.pop()
|
|
},
|
|
// 保存
|
|
splitSave () {
|
|
this.$refs.splitEditForm.validate(valid => {
|
|
if (valid) {
|
|
this.loading = true
|
|
if (!this.submitFlag) {
|
|
this.submitFlag = true
|
|
let url = ''
|
|
if (this.formInline.id) {
|
|
url = this.url.updateInfo
|
|
} else {
|
|
url = this.url.addInfo
|
|
}
|
|
const params = JSON.parse(JSON.stringify(this.formInline))
|
|
Object.keys(params).forEach(res => {
|
|
if (params[res] instanceof Array) {
|
|
params[res] = params[res].join(',')
|
|
}
|
|
})
|
|
params.info_id = this.infoId
|
|
params.menu_id = this.menuId
|
|
if (this.formInline.id) {
|
|
params.menu_id = this.itemVal.menu_id
|
|
}
|
|
const contentList = JSON.parse(JSON.stringify(this.contentList))
|
|
contentList.forEach((item, index) => {
|
|
if (item.type === 'IMG') {
|
|
this.$delete(item, 'thumbUrl')
|
|
}
|
|
})
|
|
params.itemValEOList = contentList
|
|
params.delItemIds = this.deleteIds.join(',')
|
|
axios({
|
|
url: url,
|
|
method: 'post',
|
|
data: params,
|
|
headers: {
|
|
'X-Access-Token': this.token
|
|
}
|
|
})
|
|
.then((res) => {
|
|
if (res.data.success) {
|
|
this.loading = false
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
this.visible = false
|
|
// this.$emit('closeVisible',false)
|
|
const queryParam = {
|
|
menu_id: this.menuId,
|
|
info_id: this.infoId
|
|
|
|
}
|
|
this.$emit('sumber', queryParam)
|
|
} else {
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.log(error)
|
|
}).finally(() => {
|
|
this.visible = false
|
|
this.$emit('closeVisible', false)
|
|
this.loading = false
|
|
this.submitFlag = false
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
// 取消
|
|
splitCancel () {
|
|
this.visible = false
|
|
this.$emit('closeVisible', false)
|
|
},
|
|
// 确定增加的类型
|
|
handleOk () {
|
|
if (this.selected === 'TEXT') { // 文本类型
|
|
// console.log('contentList111111',this.contentList)
|
|
this.$refs.numberForm.validate(valid => {
|
|
if (valid) {
|
|
if (!this.numberFlag) {
|
|
this.numberFlag = true
|
|
for (let i = this.contentList.length; i > this.addIndex; i--) {
|
|
this.contentList[i + this.numberForm.textNumber - 1] = this.contentList[i - 1]
|
|
}
|
|
for (let j = 0; j < this.numberForm.textNumber; j++) {
|
|
this.contentList[++this.addIndex] = {
|
|
id: '',
|
|
type: 'TEXT',
|
|
itemContent: ''
|
|
}
|
|
}
|
|
this.addConVisible = false
|
|
this.numberFlag = false
|
|
this.numberForm.textNumber = null
|
|
// console.log('contentList',this.contentList)
|
|
}
|
|
}
|
|
})
|
|
} else if (this.selected === 'IMG') { // 图片类型
|
|
// this.$refs.uploadFile2.visible=true
|
|
this.splitVisible = true
|
|
this.addConVisible = false
|
|
} else if (this.selected === 'TABLE') { // 表格类型
|
|
this.tableColVisible = true
|
|
this.addConVisible = false
|
|
}
|
|
},
|
|
handleCancel () {
|
|
this.addConVisible = false
|
|
},
|
|
selectTitle (val) {
|
|
this.selected = val
|
|
},
|
|
// 上传文件
|
|
uploadSuccess1 (file, data, imgs, uploadFileFlag) {
|
|
for (let i = this.contentList.length; i > this.addIndex; i--) {
|
|
this.contentList[i] = this.contentList[i - 1]
|
|
}
|
|
this.contentList[++this.addIndex] = {
|
|
id: '',
|
|
type: 'IMG',
|
|
itemContent: file.response.result.url,
|
|
thumbUrl: window._CONFIG.domianURL + '/sys/split/file/getImage?fileUrl=' + file.response.result.url.split('fileUrl=')[1]
|
|
}
|
|
if (uploadFileFlag === 0) {
|
|
this.splitVisible = false
|
|
}
|
|
},
|
|
// 关闭预览图片
|
|
handlePreImgCancel () {
|
|
this.preImgVisible = false
|
|
},
|
|
// 表格确认按钮
|
|
handleOkTable () {
|
|
let ueContent = []
|
|
ueContent = this.ueContent.match(/<table.{0,}?.+?>{0,}?<\/table>/g) || []
|
|
// console.log('uuuuuu',ueContent)
|
|
if (ueContent && ueContent.length > 1) {
|
|
this.$message.warning(this.$t('oneTableAdded'))
|
|
} else if (!ueContent || ueContent.length < 1) {
|
|
this.$message.warning(this.$t('addATable'))
|
|
} if (ueContent && ueContent.length == 1) {
|
|
this.tableVisible = false
|
|
if (this.isTableEdit) {
|
|
this.contentList[this.addIndex] = {
|
|
id: '',
|
|
type: 'TABLE',
|
|
itemContent: ueContent[0]
|
|
}
|
|
} else {
|
|
for (let i = this.contentList.length; i > this.addIndex; i--) {
|
|
this.contentList[i + ueContent.length - 1] = this.contentList[i - 1]
|
|
}
|
|
this.contentList[++this.addIndex] = {
|
|
id: '',
|
|
type: 'TABLE',
|
|
itemContent: ueContent[0]
|
|
}
|
|
}
|
|
this.isTableEdit = false
|
|
}
|
|
},
|
|
// 表格取消按钮
|
|
handleCancelTable () {
|
|
this.tableVisible = false
|
|
this.isTableEdit = false
|
|
},
|
|
// 获取表格内容
|
|
uEditorChange (val) {
|
|
this.ueContent = val
|
|
},
|
|
// 取消行数列数按钮
|
|
handleColCancel () {
|
|
this.tableColVisible = false
|
|
this.rowColForm.rowCount = ''
|
|
this.rowColForm.colCount = ''
|
|
},
|
|
// 确定行数列数按钮
|
|
handleColOk () {
|
|
this.$refs.numberRowColForm.validate(valid => {
|
|
if (valid) {
|
|
this.tableColVisible = false
|
|
this.tableVisible = true
|
|
if (this.rowColForm.rowCount > 0 && this.rowColForm.colCount > 0) {
|
|
const tableList = []
|
|
let tableStr = ''
|
|
tableStr = '<table class="word-table" border="1" cellpadding="0" cellspacing="0">'
|
|
for (let r = 0; r < this.rowColForm.rowCount; r++) {
|
|
const rowTableList = []
|
|
tableStr += '<tr>'
|
|
for (let c = 0; c < this.rowColForm.colCount; c++) {
|
|
tableStr += `<td></td>`
|
|
const tableItem = {}
|
|
tableItem.id = ''
|
|
tableItem.rowNum = r + 1
|
|
tableItem.colNum = c + 1
|
|
tableItem.content = ''
|
|
rowTableList.push(tableItem)
|
|
}
|
|
tableStr += `</tr>`
|
|
tableList.push(rowTableList)
|
|
}
|
|
tableStr += `</table>`
|
|
this.ueContent = tableStr
|
|
|
|
this.$nextTick(() => {
|
|
this.$refs.ueditor.setContent(this.ueContent)
|
|
})
|
|
this.rowColForm.rowCount = ''
|
|
this.rowColForm.colCount = ''
|
|
}
|
|
}
|
|
})
|
|
// console.log('cont1111',this.addIndex,this.contentList)
|
|
},
|
|
onChange (item) {
|
|
if (this.queryParam[item] && this.queryParam[item].length > 0) {
|
|
const startDate = item + '_start'
|
|
const endDate = item + '_end'
|
|
this.queryParam[startDate] = this.queryParam[item][0]
|
|
this.queryParam[endDate] = this.queryParam[item][1]
|
|
} else {
|
|
this.queryParam[item] = []
|
|
}
|
|
},
|
|
// 点击点击上传按钮
|
|
clickButtonToUpload (item) {
|
|
this.$refs.uploadFile.open(this.formInline[item.db_field_name])
|
|
this.uploadName = item.db_field_name
|
|
},
|
|
// 文件上传改变后的回调
|
|
uploadFileChange (data) {
|
|
const attIdList = []
|
|
if (data && data.length > 0) {
|
|
data.map(item => {
|
|
attIdList.push(item.id || data.name)
|
|
})
|
|
}
|
|
/** 赋值给当前对应的表单文件 */
|
|
this.formInline[this.uploadName] = attIdList.join(',')
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
// 关闭上传
|
|
closeHandle () {
|
|
this.splitVisible = false
|
|
},
|
|
handleInput (value) {
|
|
this.$nextTick(() => {
|
|
this.formInline = { ...this.formInline }
|
|
this.$refs.splitEditForm.validateField([value])
|
|
})
|
|
},
|
|
integrateData () {
|
|
this.isFormInline = false
|
|
const rules = {}
|
|
this.ruleList.forEach((res, index) => {
|
|
const rule = []
|
|
if (res.field_must_input === 1) {
|
|
if (res.field_show_type === '1') {
|
|
rule.push({
|
|
required: true,
|
|
message: res.db_field_txt + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
})
|
|
} else if (res.field_show_type === '4' || res.field_show_type === '6' ||
|
|
res.field_show_type === '5' || res.field_show_type === '7'
|
|
) {
|
|
rule.push({
|
|
required: true,
|
|
message: res.db_field_txt + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
})
|
|
} else if (res.field_show_type === '2') {
|
|
rule.push({
|
|
required: true,
|
|
message: res.db_field_txt + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
})
|
|
} else if (res.field_show_type === '8' || res.field_show_type === '9' || res.field_show_type === '10' || res.field_show_type === '11') {
|
|
rule.push({
|
|
required: true,
|
|
message: res.db_field_txt + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
})
|
|
} else if (res.field_show_type === '3') {
|
|
rule.push({
|
|
required: true,
|
|
message: res.db_field_txt + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
})
|
|
}
|
|
}
|
|
if (res.field_show_type === '1' ||
|
|
res.field_show_type === '8' || res.field_show_type === '9' || res.field_show_type === '10' ||
|
|
res.field_show_type === '11') {
|
|
rule.push({
|
|
max: res.db_length,
|
|
message: res.db_field_txt + this.$t('cantExeed') + res.db_length + this.$t('characters'),
|
|
trigger: 'blur'
|
|
})
|
|
}
|
|
if (rule.length > 0) {
|
|
rules[res.db_field_name] = rule
|
|
}
|
|
})
|
|
this.$set(this, 'rules', rules)
|
|
// console.log('rules',this.rules)
|
|
this.isFormInline = true
|
|
this.confirmLoading = false
|
|
// console.log('this.column',this.column)
|
|
},
|
|
getForm (callBack) {
|
|
this.confirmLoading = true
|
|
const params = {
|
|
flag: this.flag,
|
|
type: this.type
|
|
}
|
|
getAction(this.url.getAddForm, params).then((res) => {
|
|
if (res.success) {
|
|
this.dataList = res.result
|
|
this.ruleList = res.result
|
|
this.integrateData()
|
|
callBack && callBack()
|
|
}
|
|
})
|
|
},
|
|
edit (item) {
|
|
this.visible = true
|
|
this.type = 'edit'
|
|
this.itemVal = item
|
|
this.getForm(() => {
|
|
getAction(this.url.getDocumentInfo, { id: item.id }).then((res) => {
|
|
if (res.success) {
|
|
this.formInline = res.result
|
|
}
|
|
})
|
|
})
|
|
},
|
|
add () {
|
|
this.getForm()
|
|
this.visible = true
|
|
this.formInline = {}
|
|
this.contentList = []
|
|
this.type = 'add'
|
|
},
|
|
// 树结果选择
|
|
changeTree (value, label, extra) {
|
|
// console.log('changeValue',value, label, extra)
|
|
const labelValues = label
|
|
labelValues.shift()
|
|
this.contentTrees = labelValues.join(',')
|
|
},
|
|
// 正则替换小数点
|
|
limitNumber (value) {
|
|
if (typeof value === 'string') {
|
|
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
|
|
} else if (typeof value === 'number') {
|
|
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
|
|
} else {
|
|
return 0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.split-table-drawer{
|
|
.split-content{
|
|
.box-title-text {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
.title-text {
|
|
width: 114px;
|
|
text-align: right;
|
|
display: inline-block;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
margin-right: 16px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
height: 42px;
|
|
line-height: 42px;
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.title-text-text {
|
|
margin-top: 9px;
|
|
}
|
|
}
|
|
.itemModel {
|
|
width: calc(100% - 130px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
}
|
|
.con-divider{
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
color: rgba(0, 0, 0, 0.85)
|
|
}
|
|
.table-operator{
|
|
margin-bottom: 20px;
|
|
text-align: right;
|
|
}
|
|
|
|
}
|
|
.split-content-row{
|
|
.split-row{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin: 0 20px 20px;
|
|
.row-left{
|
|
flex: 1;
|
|
|
|
/*border:1px solid #9e9e9e;*/
|
|
img{
|
|
cursor: pointer;
|
|
width: 32px;
|
|
height: 32px;
|
|
}
|
|
.item-table{
|
|
table{
|
|
width: 100%!important;
|
|
}
|
|
}
|
|
|
|
}
|
|
.row-right{
|
|
min-width: 150px;
|
|
margin-left: 20px;
|
|
.row-btn-add, .row-btn-edit{
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.split-form-footer{
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
position: fixed;
|
|
bottom:0px;
|
|
right: 0;
|
|
width: 900px;
|
|
padding-bottom:10px;
|
|
background: #FFFFFF;
|
|
.footer-btn-save{
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
|
|
}
|
|
.split-title{
|
|
.title-wraper {
|
|
.title-top {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
|
|
.title-flex {
|
|
width: 75px;
|
|
height: 35px;
|
|
text-align: center;
|
|
border-radius: 5px;
|
|
border: 1px solid #d9d9d9;
|
|
padding: 7px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.title-flex-active {
|
|
background: #00B3BE;
|
|
border-color: #00B3BE;
|
|
color:#FFFFFF;
|
|
}
|
|
}
|
|
|
|
.title-num {
|
|
margin: 20px 20px 0;
|
|
line-height: 32px;
|
|
|
|
.title-num-add {
|
|
min-width: 70px;
|
|
}
|
|
|
|
.title-num-edit {
|
|
flex: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.split-img{
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
img{
|
|
}
|
|
}
|
|
.box-input {
|
|
/*min-width: 200px;*/
|
|
display: inline-block;
|
|
height: 38px;
|
|
margin-top: 2px;
|
|
}
|
|
.button-text {
|
|
height: 38px;
|
|
width: calc(100% - 100px);
|
|
line-height: 38px;
|
|
background: #fff;
|
|
border: 1px #00B3BE solid;
|
|
color: #00B3BE;
|
|
}
|
|
|
|
/deep/ .ant-select-tree {
|
|
width: auto;
|
|
height: 300px;
|
|
overflow: auto;
|
|
position: absolute;
|
|
/*background: #fff;*/
|
|
}
|
|
|
|
/deep/ .ant-select-tree-dropdown {
|
|
min-height: 320px;
|
|
}
|
|
</style>
|