1177 lines
45 KiB
Java
1177 lines
45 KiB
Java
<template>
|
|
<div class="split-add-form">
|
|
<div class="split-add-form-wrapper">
|
|
<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"
|
|
:label-col="labelCol"
|
|
:wrapper-col="wrapperCol"
|
|
>
|
|
<a-row :gutter="24">
|
|
<div v-for="(item,index) in dataList" :key="index">
|
|
|
|
<a-col :span="12" v-if="item.field_show_type === '1' || item.field_show_type === '11'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :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>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === '2'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<a-input-number class="box-input"
|
|
:placeholder="$t('PleaseEnter')+item.db_field_txt"
|
|
:disabled="disabled"
|
|
v-model="formInline[item.db_field_name]" :min="1" :max="99999999"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === '3'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :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>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === '4'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :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>
|
|
</a-col>
|
|
<a-col :span="12" v-else-if="item.field_show_type === '5'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<a-date-picker class="box-input"
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
@change="dateChange(item)"
|
|
format="YYYY-MM-DD"
|
|
v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
style="width: 100%"/>
|
|
<!-- :disabledDate="disabledDate"-->
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
<a-col :span="12" v-else-if="item.field_show_type === '6'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<a-range-picker class="box-input" v-model="formInline[item.db_field_name]"
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
:disabled="disabled"
|
|
@change="onChange(item.db_field_name)"></a-range-picker>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === '7'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :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>
|
|
<!-- <span class="button-text-text" v-if="formInline[item.db_field_name]">-->
|
|
<!-- {{formInline[item.db_field_name].split(',').length}}-->
|
|
<!-- </span>-->
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="24" v-else-if="item.field_show_type === '8'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :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>
|
|
</a-col>
|
|
|
|
<a-col :span="24" v-else-if="item.field_show_type === '9' || item.field_show_type == 'sel_user'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<PersonnelSelection :query="item"
|
|
:personneQuery="formInline"
|
|
@change="PersonnelSelectionChange"
|
|
:disabled="disabled"
|
|
v-model="formInline[item.db_field_name]"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="24" v-else-if="item.field_show_type === '10'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<Standardselection :query="item"
|
|
@change="StandardselectionChange"
|
|
:disabled="disabled"
|
|
:standard="formInline"
|
|
v-model="formInline[item.db_field_name]"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === 'RADIO'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<j-dict-select-tag v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
@input="handleInput(item.db_field_name)"
|
|
:placeholder="$t('selectStatus')"
|
|
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === '0'">
|
|
<div class="box-title-text" :title="item.db_field_txt">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<a-tree-select
|
|
v-model="formInline[item.db_field_name]"
|
|
:maxTagCount="1"
|
|
style="width: 100%"
|
|
:tree-data="item.tree"
|
|
tree-checkable
|
|
:placeholder="$t('PleaseSelect')+item.db_field_txt"
|
|
/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
|
|
<a-col :span="12" v-else-if="item.field_show_type === 'CHECKBOX'">
|
|
<div class="box-title-text">
|
|
<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="itemModel" :prop="item.db_field_name">
|
|
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
|
|
:disabled="disabled"
|
|
:placeholder="$t('selectStatus')" :type="'checkbox'"
|
|
:triggerChange="false" :dictCode="item.dict_field"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</div>
|
|
</a-row>
|
|
|
|
|
|
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
|
|
|
|
|
|
<!-- 条款号-->
|
|
<!-- <a-row :gutter="24">-->
|
|
<!-- <a-col :span="12">-->
|
|
<!-- <a-form-model-item :label="$t('clauseNo')" prop="number">-->
|
|
<!-- <a-input v-model="form.number" :placeholder="$t('pleaseEnter')+$t('clauseNo')" />-->
|
|
<!-- </a-form-model-item>-->
|
|
<!-- </a-col>-->
|
|
<!--<!– 条款名称–>-->
|
|
<!-- <a-col :span="12">-->
|
|
<!-- <a-form-model-item :label="$t('clauseName')" prop="name">-->
|
|
<!-- <a-input v-model="form.name" :placeholder="$t('pleaseEnter')+$t('clauseName')" />-->
|
|
<!-- </a-form-model-item>-->
|
|
<!-- </a-col>-->
|
|
<!-- </a-row>-->
|
|
<!--<!– 功能领域–>-->
|
|
<!-- <a-row :gutter="24">-->
|
|
<!-- <a-col :span="12">-->
|
|
<!-- <a-form-model-item :label="$t('functionalAreas')" prop="funArea">-->
|
|
<!-- <j-dict-select-tag type="list" v-model="form.funArea" dictCode="function_territory" :placeholder="$t('pleaseSelect')+$t('functionalAreas')" />-->
|
|
<!-- </a-form-model-item>-->
|
|
<!-- </a-col>-->
|
|
<!--<!– 技术领域–>-->
|
|
<!-- <a-col :span="12">-->
|
|
<!-- <a-form-model-item :label="$t('technicalField')" prop="tecArea">-->
|
|
<!-- <j-dict-select-tag type="list" v-model="form.tecArea" dictCode="technology_territory" :placeholder="$t('pleaseSelect')+$t('technicalField')" />-->
|
|
<!-- </a-form-model-item>-->
|
|
<!-- </a-col>-->
|
|
<!-- </a-row>-->
|
|
<!--<!– 信息类别–>-->
|
|
<!-- <a-row :gutter="24">-->
|
|
<!-- <a-col :span="12">-->
|
|
<!-- <a-form-model-item :label="$t('informationCategory')" prop="infoType">-->
|
|
<!-- <j-dict-select-tag type="list" v-model="form.infoType" dictCode="xxx" :placeholder="$t('pleaseSelect')+$t('informationCategory')" />-->
|
|
<!-- </a-form-model-item>-->
|
|
<!-- </a-col>-->
|
|
<!-- </a-row>-->
|
|
<!-- 内容简介-->
|
|
<span class="con-divider">{{$t('contentValidity')}}</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" 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" :placeholder="$t('pleaseEnter')+$t('content')" auto-size />
|
|
<img v-if="item.type==='IMG'" :src="item.itemContent" alt="" @click="preImg(item)">
|
|
<div v-if="item.type==='TABLE'" v-html="item.content" class="item-table"></div>
|
|
</div>
|
|
<div class="row-right">
|
|
<a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button>
|
|
<a-button @click="splitDelete">{{$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 type="primary" @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="Title"
|
|
class="split-title"
|
|
:visible="addConVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="handleOk"
|
|
@cancel="handleCancel"
|
|
>
|
|
<div class="title-wraper">
|
|
<div class="title-top">
|
|
<span class="title-flex title-text" :class="{'title-flex-active':selected==1}" @click="selectTitle(1)">{{$t('text')}}</span>
|
|
<span class="title-flex title-pic" :class="{'title-flex-active':selected==2}" @click="selectTitle(2)">{{$t('picture')}}</span>
|
|
<span class="title-flex title-table" :class="{'title-flex-active':selected==3}" @click="selectTitle(3)">{{$t('table')}}</span>
|
|
</div>
|
|
<div class="title-num" v-if="selectedNum">
|
|
<span class="title-num-add">{{$t('addQuantity')}}</span>
|
|
<a-input-number class="title-num-edit" :min="1" v-model="textNumber" :placeholder="$t('enterQuantity')" :formatter="limitNumber" :parser="limitNumber"></a-input-number>
|
|
</div>
|
|
</div>
|
|
</a-modal>
|
|
<!-- 上传图片弹框-->
|
|
<split-upload v-if="splitVisible" ref="uploadFile2" :disabled="disabled" :accept="accept" :title="titleImg" :listType='listType' :splitVisible="splitVisible" @uploadSuccess="uploadSuccess"></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-item :label="$t('numberRows')">
|
|
<a-input-number v-model="rowCount" :min="1" :max="99999" :placeholder="$t('pleaseEnter')+$t('numberRows')" :formatter="limitNumber" :parser="limitNumber" />
|
|
</a-form-item>
|
|
<a-form-item :label="$t('numberColumns')">
|
|
<a-input-number v-model="colCount" :min="1" :max="99999" :placeholder="$t('pleaseEnter')+$t('numberColumns')" :formatter="limitNumber" :parser="limitNumber" />
|
|
</a-form-item>
|
|
</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>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Vue from 'vue'
|
|
import uploadFile from '@/components/uploadFile/file'
|
|
import Standardselection from '@/components/Standardselection/index'
|
|
import PersonnelSelection from '@/components/PersonnelSelection/index'
|
|
import SplitUpload from '@/components/SplitUpload/index'
|
|
import UEditor from '@/components/ueditor/index'
|
|
import moment from 'moment'
|
|
import axios from 'axios'
|
|
import { getAction, postAction } from '@/api/manage'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
import eventBUs from '../../../../common/event'
|
|
// import eventBUs from '../../common/event'
|
|
export default {
|
|
name: 'splitAddForm',
|
|
components:{
|
|
uploadFile,
|
|
Standardselection,
|
|
PersonnelSelection,
|
|
SplitUpload,
|
|
UEditor
|
|
},
|
|
data(){
|
|
return{
|
|
titleTable:this.$t('table'),
|
|
titleColRow:this.$t('tableRowsColumns'),
|
|
title:this.$t('newClause'),
|
|
TitlePreImg:'',
|
|
contentList:[],
|
|
content:{},
|
|
selected:1,
|
|
selectedNum:true,
|
|
textNumber:1,
|
|
Title:this.$t('add'),
|
|
confirmLoading: false,
|
|
visible:false,
|
|
addConVisible:false,
|
|
form:{},
|
|
// validatorRules:{
|
|
// number:[
|
|
// { required:true,message: this.$t('pleaseEnter')+this.$t('clauseNo'),trigger: 'blur' },
|
|
// { min:1, max: 200, message: this.$t('cantExeed')+'200'+this.$t('characters'), trigger: 'blur' }
|
|
// ],
|
|
// name:[
|
|
// { required:true,message: this.$t('pleaseEnter')+this.$t('clauseName'),trigger: 'blur' },
|
|
// { min:1, max: 200, message: this.$t('cantExeed')+'200'+this.$t('characters'), trigger: 'blur' }
|
|
// ]
|
|
// },
|
|
addIndex:'',
|
|
addImgVisible:false, //上传图片弹框
|
|
titleImg:this.$t('uploadPictures'),
|
|
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,
|
|
colCount:'', //列数
|
|
rowCount:'', //行数
|
|
formInline: {},
|
|
isFormInline: false,
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 6 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 17 }
|
|
},
|
|
dataList: [],
|
|
ruleList: [],
|
|
rules: {},
|
|
confirmLoading: false,
|
|
uploadName: '',
|
|
type: 'add',
|
|
loading:false,
|
|
token:Vue.ls.get(ACCESS_TOKEN),
|
|
submitFlag:false,
|
|
}
|
|
},
|
|
props:{
|
|
addVisible: {
|
|
type:Boolean,
|
|
default:false
|
|
},
|
|
formTitle:{
|
|
type:String,
|
|
default:''
|
|
},
|
|
url: {
|
|
type: Object,
|
|
default: {}
|
|
},
|
|
flag: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
infoId:{
|
|
type:String,
|
|
default:''
|
|
},
|
|
menuId:{
|
|
type:String,
|
|
default:''
|
|
},
|
|
itemId:{
|
|
type:String,
|
|
default:''
|
|
},
|
|
item:{
|
|
type:Object,
|
|
default:{}
|
|
}
|
|
},
|
|
watch:{
|
|
selected(val){
|
|
if(this.selected==1){
|
|
this.selectedNum=true
|
|
}else{
|
|
this.selectedNum=false
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
this.visible=this.addVisible
|
|
this.formInline=this.item
|
|
console.log('form',this.formInline,this.item)
|
|
this.loadData()
|
|
},
|
|
methods:{
|
|
loadData(){
|
|
this.loading=true
|
|
getAction(`split/sarFileSplitItemsVal/getItemsValList`,{itemId:this.itemId}).then(res=>{
|
|
if(res.success){
|
|
this.contentList=[...res.result]
|
|
|
|
console.log('res',res.result)
|
|
}
|
|
}).finally(()=>{
|
|
this.loading=false
|
|
})
|
|
},
|
|
afterVisibleChange(){
|
|
|
|
},
|
|
onClose(){
|
|
this.$emit('closeVisible',false)
|
|
},
|
|
|
|
//增加按钮
|
|
splitAdd(val){
|
|
this.addConVisible=true
|
|
if(val=='-1'){
|
|
this.addIndex=this.contentList.length-1
|
|
}else{
|
|
this.addIndex=val
|
|
}
|
|
},
|
|
//删除按钮
|
|
splitDelete(){
|
|
|
|
},
|
|
//保存
|
|
splitSave(){
|
|
// console.log('formInline',this.formInline)
|
|
this.$refs.splitEditForm.validate(valid=>{
|
|
if(valid){
|
|
this.submitFlag=true
|
|
this.confirmLoading = true
|
|
if(this.submitFlag){
|
|
let url = ''
|
|
if (this.formInline.id) {
|
|
url = this.url.updateInfo
|
|
} else {
|
|
url = this.url.addInfo
|
|
}
|
|
let params = JSON.parse(JSON.stringify(this.formInline))
|
|
|
|
Object.keys(params).forEach(res => {
|
|
if (params[res] instanceof Array) {
|
|
params[res] = params[res].join(',')
|
|
}
|
|
})
|
|
// console.log('item',this.item,JSON.stringify(this.item)=="{}")
|
|
if(JSON.stringify(this.item)=="{}"){
|
|
params.info_id=this.infoId
|
|
params.menu_id=this.menuId
|
|
}
|
|
// params.menuId=this.menuId
|
|
params.itemValEOList=this.contentList
|
|
// console.log('paramsformInline',params)
|
|
|
|
axios({
|
|
url: url,
|
|
method: 'post',
|
|
data: params,
|
|
headers: {
|
|
'X-Access-Token':this.token
|
|
}
|
|
})
|
|
.then( (res) =>{
|
|
if (res.data.success) {
|
|
this.confirmLoading = false
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
this.visible=false
|
|
// this.$emit('closeVisible',false)
|
|
eventBUs.$emit('searchReset')
|
|
}else{
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
})
|
|
.catch( (error) =>{
|
|
console.log(error);
|
|
}).finally(()=>{
|
|
this.confirmLoading=false
|
|
this.submitFlag=false
|
|
})
|
|
}
|
|
|
|
// postAction(url, params).then((res) => {
|
|
// if (res.success) {
|
|
// this.confirmLoading = false
|
|
// this.$message.success(this.$t('OperationSuccessful'))
|
|
// eventBUs.$emit('searchReset')
|
|
// this.$emit('addFormClick')
|
|
// } else {
|
|
// this.confirmLoading = false
|
|
// if (res.message.indexOf('发布日期不能大于') >= 0) {
|
|
// this.$message.warning(res.message)
|
|
// } else {
|
|
// this.$message.warning(this.$t('operationFailed'))
|
|
// }
|
|
// }
|
|
// })
|
|
}
|
|
})
|
|
},
|
|
//取消
|
|
splitCancel(){
|
|
this.visible=false
|
|
this.$emit('closeVisible',false)
|
|
},
|
|
//确定增加的类型
|
|
handleOk(){
|
|
this.addConVisible=false
|
|
let contentLength=this.contentList.length
|
|
if(this.selected==1){ //文本类型
|
|
for(let i=this.contentList.length;i>this.addIndex;i--){
|
|
this.contentList[i+contentLength-1]=this.contentList[i-1]
|
|
}
|
|
for(let j=0;j<this.textNumber;j++){
|
|
this.contentList[++this.addIndex]={
|
|
id:'',
|
|
type:'TEXT',
|
|
itemContent:''
|
|
}
|
|
}
|
|
|
|
}else if(this.selected==2){ //图片类型
|
|
|
|
this.splitVisible=true
|
|
|
|
}else if(this.selected==3){ //表格类型
|
|
this.tableColVisible=true
|
|
|
|
}
|
|
console.log('conteend',this.contentList)
|
|
},
|
|
handleCancel(){
|
|
this.addConVisible=false
|
|
},
|
|
selectTitle(val){
|
|
this.selected=val
|
|
|
|
},
|
|
//上传文件
|
|
uploadSuccess(data,imgs) {
|
|
let lengthImg=imgs.length
|
|
for(let i = this.contentList.length;i>this.addIndex;i--){
|
|
this.contentList[i+lengthImg-1]=this.contentList[i-1]
|
|
}
|
|
if(imgs && imgs.length > 0){
|
|
imgs.forEach(item => {
|
|
this.contentList[++this.addIndex]={
|
|
id:'',
|
|
type:'IMG',
|
|
itemContent:item.thumbUrl
|
|
}
|
|
})
|
|
}
|
|
this.splitVisible=false
|
|
},
|
|
//点击图片预览
|
|
preImg(item){
|
|
this.itemSrc=item.itemContent
|
|
this.preImgVisible=true
|
|
},
|
|
//关闭预览图片
|
|
handlePreImgCancel(){
|
|
this.preImgVisible=false
|
|
},
|
|
//表格确认按钮
|
|
handleOkTable(){
|
|
this.tableVisible=false
|
|
},
|
|
//表格取消按钮
|
|
handleCancelTable(){
|
|
this.tableVisible=false
|
|
},
|
|
//获取表格内容
|
|
uEditorChange (val) {
|
|
// this.itemContent = this.$refs.ueditor.getUEContent()
|
|
this.contentList[this.addIndex+1]= {
|
|
id:'',
|
|
type:'TABLE',
|
|
content:val
|
|
}
|
|
},
|
|
//取消行数列数按钮
|
|
handleColCancel(){
|
|
this.tableColVisible=false
|
|
},
|
|
//确定行数列数按钮
|
|
handleColOk(){
|
|
this.tableColVisible=false
|
|
this.tableVisible=true
|
|
if(this.rowCount>0&&this.colCount>0){
|
|
let tableList=[]
|
|
let tableStr=''
|
|
tableStr='<table class=\'word-table\' border="1" cellpadding="0" cellspacing="0">'
|
|
for(let r=0;r<this.rowCount;r++){
|
|
let rowTableList=[]
|
|
tableStr+='<tr>'
|
|
for(let c=0;c<this.colCount;c++){
|
|
tableStr+=`<td></td>`
|
|
let 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.contentList[this.addIndex+1]= {
|
|
id:'',
|
|
type:'TABLE',
|
|
content:tableStr
|
|
}
|
|
this.$nextTick(() => {
|
|
this.$refs.ueditor.setContent(this.ueContent)
|
|
})
|
|
}
|
|
// console.log('cont1111',this.addIndex,this.contentList)
|
|
},
|
|
dateChange(item) {
|
|
this.formInline[item.db_field_name] = this.formInline[item.db_field_name] ? moment(this.formInline[item.db_field_name]).format('YYYY-MM-DD') : ''
|
|
},
|
|
onChange(item) {
|
|
let dateOne = moment(this.formInline[item][0]).format('YYYY-MM-DD')
|
|
let dateTwo = moment(this.formInline[item][1]).format('YYYY-MM-DD')
|
|
this.formInline[item] = dateOne ? [dateOne, dateTwo] : []
|
|
},
|
|
|
|
clickButtonToUpload(item) {
|
|
this.$refs.uploadFile.perentHandleFunc()
|
|
this.$refs.uploadFile.state = item.flag
|
|
this.$refs.uploadFile.visible = true
|
|
this.uploadName = item.db_field_name
|
|
getAction('sys/common/getFileInfos', { id: this.formInline[item.db_field_name] }).then((res) => {
|
|
if (res.success) {
|
|
this.$refs.uploadFile.perentHandleFunc(res.result)
|
|
} else {
|
|
this.$refs.uploadFile.perentHandleFunc()
|
|
}
|
|
})
|
|
},
|
|
/** 上传文件的回调 */
|
|
uploadSuccess(data) {
|
|
let 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 }
|
|
},
|
|
handleInput(value) {
|
|
this.$nextTick(() => {
|
|
this.formInline = { ...this.formInline }
|
|
this.$refs.splitEditForm.validateField([value])
|
|
})
|
|
},
|
|
IntegrateData() {
|
|
this.isFormInline = false
|
|
let ruleList = []
|
|
// this.ruleList.forEach(res => {
|
|
// Object.keys(res).forEach(val => {
|
|
// res[val].forEach(ol => {
|
|
// ruleList.push(ol)
|
|
// })
|
|
// })
|
|
// })
|
|
let 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 === '2' ||
|
|
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 + '不能超出' + res.db_length + '个字符',
|
|
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
|
|
},
|
|
getForm(callBack) {
|
|
this.confirmLoading = true
|
|
let 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
|
|
// console.log('res',this.dataList)
|
|
this.IntegrateData()
|
|
callBack && callBack()
|
|
}
|
|
})
|
|
},
|
|
edit(item) {
|
|
this.type = 'edit'
|
|
this.getForm(() => {
|
|
getAction(this.url.getDocumentInfo, { id: item.id }).then((res) => {
|
|
if (res.success) {
|
|
this.formInline = res.result[0]
|
|
}
|
|
})
|
|
})
|
|
},
|
|
add() {
|
|
this.formInline = {}
|
|
this.type = 'add'
|
|
this.getForm()
|
|
},
|
|
StandardselectionChange(value, id) {
|
|
this.formInline[value + '_id'] = id
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
PersonnelSelectionChange(value, id) {
|
|
this.formInline[value + '_id'] = id
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
//正则替换小数点
|
|
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 lang="less" scoped>
|
|
@import '~@assets/less/common.less';
|
|
.split-add-form{
|
|
.split-add-form-wrapper{
|
|
}
|
|
}
|
|
.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-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{
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.split-form-footer{
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
.footer-btn-save{
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
|
|
}
|
|
.split-title{
|
|
.title-wraper {
|
|
.title-top {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
|
|
.title-flex {
|
|
border: 1px solid #d9d9d9;
|
|
padding: 10px 40px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.title-flex-active {
|
|
background: #00B3BE;
|
|
border-color: #00B3BE;
|
|
color:#FFFFFF;
|
|
}
|
|
}
|
|
|
|
.title-num {
|
|
margin: 20px 20px 0;
|
|
line-height: 32px;
|
|
display: flex;
|
|
justify-content: start;
|
|
|
|
.title-num-add {
|
|
min-width: 70px;
|
|
}
|
|
|
|
.title-num-edit {
|
|
flex: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.split-img{
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
img{
|
|
}
|
|
|
|
}
|
|
</style>
|
|
|
|
<style lang="less">
|
|
.split-title{
|
|
.ant-modal-footer{
|
|
text-align: center;
|
|
}
|
|
|
|
}
|
|
.split-table-drawer{
|
|
.ant-drawer-content-wrapper{
|
|
.row-left{
|
|
.item-table{
|
|
height: 100%;
|
|
table.word-table {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.ant-col-sm-5{
|
|
min-width: 170px;
|
|
}
|
|
.ant-col-sm-16{
|
|
width: 58%;
|
|
}
|
|
}
|
|
.split-table-title{
|
|
.ant-modal{
|
|
width: 700px;
|
|
.ant-modal-content{
|
|
width: 700px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.split-col-title{
|
|
.ant-col-5{
|
|
.ant-input-number{
|
|
min-width: 260px;
|
|
|
|
}
|
|
}
|
|
|
|
.ant-modal-footer{
|
|
text-align: center;
|
|
}
|
|
}
|
|
</style> |