update 文档拆分

This commit is contained in:
赵霄
2023-09-21 17:28:13 +08:00
parent d4c30733c4
commit a609348cbf
10 changed files with 922 additions and 859 deletions
@@ -0,0 +1,783 @@
<template>
<a-drawer
:title="formTitle"
placement="right"
:visible="visible"
@close="splitCancel"
width="900"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<a-spin :spinning="loading">
<a-form>
<a-form-model
class="split-content"
:model="formInline"
:rules="rules"
ref="splitEditForm"
>
<a-row :gutter="24">
<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 === '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">
<standard-selection :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" @change="uploadFileChange" :return-url="false"></upload-file>
<span class="con-divider">{{ $t('docTool.split.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>
</a-spin>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button type="primary" class="footer-btn-save" @click="splitSave">{{ $t('preservation') }}</a-button>
<a-button @click="splitCancel">{{ $t('cancel') }}</a-button>
</div>
<!-- 类型选择弹框 -->
<split-detail-add-type-check
ref="splitDetailAddTypeCheck"
@addTextOk="addTextOk"
@addTableOk="addTableOk"
@addImageOk="addImageOk"
>
</split-detail-add-type-check>
<!-- 编辑表格弹框 -->
<split-detail-add-table ref="splitDetailAddTable" @editOk="editTableOk"></split-detail-add-table>
</a-drawer>
</template>
<script>
import UploadFile from '../../../../components/UploadFile.vue'
import StandardSelection from '../../../../components/selection/StandardSelection.vue'
// 类型选择弹框
import SplitDetailAddTypeCheck from './SplitDetailAddTypeCheck.vue'
import SplitDetailAddTable from './SplitDetailAddTable.vue'
import { getDocSplitEditForm, getDocSplitEditFormData, addClause, editClause, getEditClauseContent } from '../../../../api/documentToolApi.js'
export default {
name: 'SplitAddForm',
components: {
SplitDetailAddTable,
UploadFile,
StandardSelection,
SplitDetailAddTypeCheck
},
data () {
return {
formTitle: this.$t('newlyAdded'),
contentList: [],
visible: false,
addIndex: '',
disabled: false,
formInline: {},
isFormInline: false,
dataList: [],
ruleList: [],
rules: {},
uploadName: '',
type: 'add',
loading: false,
submitFlag: false,
deleteIds: [],
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: ''
}
},
methods: {
loadData () {
this.loading = true
getEditClauseContent({ 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 () {
getDocSplitEditFormData({ id: this.itemId }).then(res => {
if (res.success) {
this.formInline = [...res.result]
}
})
},
// 增加按钮
splitAdd (val) {
if (val === '-1') {
this.addIndex = this.contentList.length - 1
} else {
this.addIndex = val
}
this.$refs.splitDetailAddTypeCheck.open()
},
// 编辑按钮
splitEdit (index, item) {
// console.log('item',item)
this.addIndex = index
console.log('&&&&&&&&&&&&&&&&&&&&&&&', item.itemContent)
this.$refs.splitDetailAddTable.open(item.itemContent)
this.$refs.splitDetailAddTable.isTableEdit = true
},
// 删除按钮
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 submitFunc
if (this.formInline.id) {
submitFunc = editClause
} else {
submitFunc = addClause
}
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(',')
submitFunc(params).then((res) => {
if (res.data.success) {
this.loading = false
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
// this.$emit('closeVisible',false)
this.$emit('sumber')
} 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)
},
// 增加文本类型成功
addTextOk (number) {
for (let i = this.contentList.length; i > this.addIndex; i--) {
this.contentList[i + number - 1] = this.contentList[i - 1]
}
for (let j = 0; j < number; j++) {
this.contentList[++this.addIndex] = {
id: '',
type: 'TEXT',
itemContent: ''
}
}
this.contentList = JSON.parse(JSON.stringify(this.contentList))
},
// 增加表格类型成功
addTableOk (ueContent) {
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.contentList = JSON.parse(JSON.stringify(this.contentList))
},
// 编辑表格类型成功
editTableOk (ueContent) {
console.log(ueContent)
this.contentList[this.addIndex] = {
id: '',
type: 'TABLE',
itemContent: ueContent[0]
}
this.contentList = JSON.parse(JSON.stringify(this.contentList))
},
// 增加图片类型成功
addImageOk (file, data, imgs) {
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]
}
this.contentList = JSON.parse(JSON.stringify(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 }
},
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.loading = false
// console.log('this.column',this.column)
},
getForm (callBack) {
this.loading = true
const params = {
flag: this.flag,
type: this.type
}
getDocSplitEditForm(params).then((res) => {
if (res.success) {
this.dataList = res.result
this.ruleList = res.result
this.integrateData()
callBack && callBack()
}
}).finally(() => {
this.loading = false
})
},
edit (item) {
this.visible = true
this.type = 'edit'
this.itemVal = item
this.getForm(() => {
getDocSplitEditFormData({ id: item.id }).then((res) => {
if (res.success) {
this.formInline = res.result
}
})
})
},
add () {
this.getForm()
this.loadData()
this.loadFormInfo()
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-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;
}
}
.item-model {
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 {
/deep/ 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>
@@ -0,0 +1,37 @@
<template>
<a-modal
:title="$t('docTool.split.clauseContent')"
:visible="contentVisible"
:confirm-loading="confirmLoading"
:footer="false"
@cancel="handleCancel"
>
<p v-html="contentValue"></p>
</a-modal>
</template>
<script>
export default {
name: 'SplitClauseDetail',
data () {
return {
contentVisible: false,
confirmLoading: false,
contentValue: ''
}
},
methods: {
open (val) {
this.contentVisible = true
this.contentValue = val
},
handleCancel () {
this.contentVisible = false
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,173 @@
<template>
<a-modal
:title="title"
class="split-table-title"
:visible="visible"
:confirm-loading="confirmLoading"
@ok="handleOkTable"
@cancel="handleCancelTable"
:width="700"
>
<u-editor :content="ueContent" :config="config" ref="ueditor" @editor-onChange="uEditorChange"></u-editor>
</a-modal>
</template>
<script>
import UEditor from '../../../../components/uEditor/UEditor.vue'
export default {
name: 'SplitDetailAddTable',
components: { UEditor },
data () {
return {
title: this.$t('docTool.split.table'),
visible: false,
confirmLoading: false,
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
},
isTableEdit: false
}
},
methods: {
open (tableStr) {
console.log('$$$$$$$$$$$$', tableStr)
this.visible = true
this.ueContent = tableStr
this.$nextTick(() => {
this.$refs.ueditor.setContent(this.ueContent)
})
},
// 表格确认按钮
handleOkTable () {
let ueContent = []
ueContent = this.ueContent.match(/<table.{0,}?.+?>{0,}?<\/table>/g) || []
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) {
console.log(ueContent)
console.log(this.isTableEdit)
if (this.isTableEdit) {
this.$emit('editOk', ueContent)
} else {
this.$emit('addOk', ueContent)
}
this.close()
}
},
// 表格取消按钮
handleCancelTable () {
this.close()
},
close () {
this.visible = false
this.isTableEdit = false
this.ueContent = ''
this.$nextTick(() => {
this.$refs.ueditor.execCommand()
})
},
// 获取表格内容
uEditorChange (val) {
console.log('--------------uEditorChange------------', val)
this.ueContent = val
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,287 @@
<template>
<a-modal
:title="$t('add')"
class="split-title"
:visible="visible"
:confirmLoading="confirmLoading"
@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('docTool.split.text') }}</span>
<span class="title-flex title-pic"
:class="{'title-flex-active':selected==='IMG'}"
@click="selectTitle('IMG')">{{ $t('docTool.split.picture') }}</span>
<span class="title-flex title-table"
:class="{'title-flex-active':selected==='TABLE'}"
@click="selectTitle('TABLE')">{{ $t('docTool.split.table') }}</span>
</div>
<!-- 选择文本类型时需要填写个数 -->
<div class="title-num" v-if="selected==='TEXT'">
<a-form>
<a-form-model
class="number-content"
:model="numberForm"
:rules="validatorRules"
ref="numberForm"
>
<a-form-model-item :label="$t('docTool.split.addQuantity')" prop="textNumber">
<a-input-number
style="width: 100%"
:min="0"
:max="100"
v-model="numberForm.textNumber"
:placeholder="$t('docTool.split.enterQuantity')"
:formatter="limitNumber"
:parser="limitNumber"
></a-input-number>
</a-form-model-item>
</a-form-model>
</a-form>
</div>
<!-- 选择表格时需要填写行列数 -->
<div class="title-num" v-if="selected==='TABLE'">
<a-form>
<a-form-model
class="number-content"
:model="rowColForm"
:rules="validatorRowColRules"
ref="numberRowColForm"
>
<a-form-model-item :label="$t('docTool.split.numberRows')" prop="rowCount">
<a-input-number
style="width: 100%"
v-model="rowColForm.rowCount"
:min="1"
:max="100"
:placeholder="$t('pleaseEnter')+$t('docTool.split.numberRows')"
:formatter="limitNumber"
:parser="limitNumber"
/>
</a-form-model-item>
<a-form-model-item :label="$t('docTool.split.numberColumns')" prop="colCount">
<a-input-number
style="width: 100%"
v-model="rowColForm.colCount"
:min="1"
:max="100"
:placeholder="$t('pleaseEnter')+$t('docTool.split.numberColumns')"
:formatter="limitNumber"
:parser="limitNumber"
/>
</a-form-model-item>
</a-form-model>
</a-form>
</div>
</div>
<!-- 上传图片弹框 -->
<split-add-clause-upload-image
ref="uploadFile"
:disabled="disabled"
:title="titleImg"
:listType="listType"
:accept="accept"
@uploadSuccess="uploadSuccess">
</split-add-clause-upload-image>
<!-- 表格弹框 -->
<split-detail-add-table ref="splitDetailAddTable" @addOk="tableAddOk"></split-detail-add-table>
</a-modal>
</template>
<script>
// 上传图片弹框
import SplitAddClauseUploadImage from '../../../../components/splitUpload/SplitAddClauseUploadImage.vue'
// 编辑表格的弹框
import SplitDetailAddTable from './SplitDetailAddTable.vue'
export default {
name: 'SplitDetailAddTypeCheck',
components: { SplitAddClauseUploadImage, SplitDetailAddTable },
watch: {
selected (val) {
if (this.selected === 'TEXT') {
this.selectedNum = true
} else {
this.selectedNum = false
}
}
},
data () {
return {
visible: false,
confirmLoading: false,
selected: 'TEXT',
selectedNum: true,
numberForm: {},
validatorRules: {
textNumber: [
{ required: true, message: this.$t('docTool.split.enterQuantity'), trigger: 'blur' }
]
},
// 文件上传弹框相关
splitVisible: false,
disabled: false,
titleImg: this.$t('uploadPictures'),
listType: 'picture',
accept: 'image/*',
// 表格行列相关数据
rowColForm: {},
validatorRowColRules: {
colCount: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('docTool.split.numberRows'), trigger: 'blur' }
],
rowCount: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('docTool.split.numberColumns'), trigger: 'blur' }
]
}
}
},
methods: {
open () {
this.visible = true
},
selectTitle (val) {
this.selected = val
if (val === 'TEXT') {
this.$nextTick(() => {
this.$refs.numberForm.clearValidate()
})
} else if (val === 'TABLE') {
this.$nextTick(() => {
this.$refs.numberRowColForm.clearValidate()
})
}
},
// 上传文件
uploadSuccess (file, data, imgs) {
this.$emit('addImageOk', file, data, imgs)
},
// 确定增加的类型
handleOk () {
if (this.confirmLoading) {
return
}
if (this.selected === 'TEXT') { // 文本类型
this.$refs.numberForm.validate(valid => {
if (valid) {
this.confirmLoading = true
this.$emit('addTextOk', this.numberForm.textNumber)
this.visible = false
this.confirmLoading = false
this.numberForm.textNumber = null
}
})
} else if (this.selected === 'IMG') { // 图片类型
this.$refs.uploadFile.open()
this.visible = false
} else if (this.selected === 'TABLE') { // 表格类型
this.$refs.numberRowColForm.validate(valid => {
if (valid) {
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.$nextTick(() => {
this.$refs.splitDetailAddTable.isTableEdit = false
this.$refs.splitDetailAddTable.open(tableStr)
})
this.visible = false
this.rowColForm = {}
}
}
})
}
},
handleCancel () {
this.visible = false
},
// 添加表格的回调
tableAddOk (ueContent) {
this.$emit('addTableOk', ueContent)
},
// 正则替换小数点
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-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;
}
}
}
}
.number-content {
.ant-form-item {
display: flex;
.ant-form-item-control-wrapper {
flex: 1;
.title-num-edit {
width: 100%;
}
}
}
}
</style>
@@ -0,0 +1,96 @@
<template>
<a-modal
class="show-setting"
:title="$t('docTool.split.batchSetting')"
:visible="visible"
:confirm-loading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
style="width: 1000px;height: auto"
>
<add-form
ref="fileForm"
:get-form-func="getFormFunc"
:get-document-info-func="getFormDataFunc"
@submitFormData="submitFormData"
:flag="'4'">
</add-form>
</a-modal>
</template>
<script>
import AddForm from '../../../../components/customField/AddForm.vue'
import { addBatchEditClause, editBatchEditClause, getFormForBatchEditClause, getFormDataForBatchEditClause } from '../../../../api/documentToolApi.js'
export default {
name: 'SplitDetailBatchSetting',
components: { AddForm },
data () {
return {
visible: false, // 批量设置弹框显示
confirmLoading: false,
getFormFunc: getFormForBatchEditClause,
getFormDataFunc: getFormDataForBatchEditClause
}
},
methods: {
open (ids) {
this.ids = ids
this.visible = true
},
// 批量设置确定
handleOk () {
this.$refs.fileForm.submit()
},
// 表单提交
submitFormData (formInline) {
if (this.confirmLoading) {
return
}
this.confirmLoading = true
let submitFunc
if (this.formInline.id) {
submitFunc = editBatchEditClause
} else {
submitFunc = addBatchEditClause
}
formInline.ids = this.ids
submitFunc(formInline).then((res) => {
if (res.data.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
},
// 批量设置取消
handleCancel () {
this.visible = false
}
}
}
</script>
<style scoped lang="less">
.show-setting {
.ant-modal {
min-width: 700px;
}
.ant-select-dropdown--multiple {
max-height: 39vh !important;
}
.ant-modal-body {
overflow-y: visible !important;
}
.ant-modal-footer {
text-align: center;
}
}
</style>
@@ -0,0 +1,165 @@
<template>
<a-modal
class="add-menus"
:title="title"
:visible="visible"
:confirm-loading="confirmLoading"
@cancel="handleCancel"
@ok="handleOk"
>
<a-form-model
class="split-click-right-form"
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-model-item :label="$t('docTool.split.clauseNo')" prop="name">
<a-input class="box-input" v-model="form.name" :placeholder="$t('pleaseEnter')+$t('docTool.split.clauseNo')" :maxLength="200" />
</a-form-model-item>
<a-form-model-item :label="$t('docTool.split.clauseName')" prop="itemName">
<a-input class="box-input" v-model="form.itemName" :placeholder="$t('pleaseEnter')+$t('docTool.split.clauseName')" :maxLength="200" />
</a-form-model-item>
<a-form-model-item :label="$t('serialNumber')" prop="displaySeq">
<a-input-number v-model="form.displaySeq" :min="1" :max="99999"
class="box-input"
:placeholder="$t('pleaseEnter')+$t('serialNumber')"
:formatter="limitNumber"
:parser="limitNumber" style="width: 100%" />
</a-form-model-item>
</a-form-model>
</a-modal>
</template>
<script>
import { postAction, putAction } from '../../../../api/manage.js'
export default {
name: 'SplitDetailNodeAdd',
data () {
return {
title: this.$t('add'),
visible: false,
confirmLoading: false,
labelCol: { span: 6 },
wrapperCol: { span: 16 },
form: {},
rules: {
name: [
// { required: true, message: this.$t('PleaseEnter') + this.$t('clauseNo'), trigger: 'blur' },
],
itemName: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('docTool.split.clauseName'), trigger: 'blur' }
],
displaySeq: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('serialNumber'), trigger: 'blur' }
// { min: 1, max: 99999, message: this.$t('cantExeed') + '99999' + this.$t('characters'), trigger: 'blur' },
]
},
isEdit: false,
nodeItem: {},
infoId: ''
}
},
methods: {
add (nodeItem, infoId) {
this.title = this.$t('add')
this.isEdit = false
this.form = {}
this.visible = true
this.nodeItem = nodeItem
this.infoId = infoId
},
edit (nodeItem, infoId) {
this.title = this.$t('edit')
this.isEdit = true
this.nodeItem = nodeItem
this.form.id = nodeItem.id
this.form.pid = nodeItem.pid
this.form.name = nodeItem.name
this.form.itemName = nodeItem.itemName
this.form.displaySeq = nodeItem.displaySeq
this.infoId = infoId
this.visible = true
},
handleCancel () {
this.visible = false
},
// 增加节点确定
handleOk () {
if (this.confirmLoading) {
return
}
const expandId = []
expandId.push(this.form.pid)
if (!this.isEdit) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.confirmLoading = true
const params = {
infoId: this.infoId,
pid: this.nodeItem.id,
...this.form
}
postAction(`split/sarFileSplitMenu/addMenu`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
// this.onExpand(expandId)
this.form = {}
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
})
} else {
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.confirmLoading = true
const params = {
info_id: this.infoId,
...this.form
}
putAction(`split/sarFileSplitMenu/updateMenu`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.form = {}
this.visible = false
this.$emit('update', expandId)
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
})
}
},
// 正则替换小数点
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">
.add-menus {
.ant-modal-wrap {
.ant-modal-footer {
text-align: center;
}
}
}
</style>