272 lines
9.2 KiB
Vue
272 lines
9.2 KiB
Vue
<template>
|
|
<j-modal
|
|
:title="'拆分上传文本'"
|
|
:width="width"
|
|
:visible="visible"
|
|
switchFullscreen
|
|
:maskClosable="false"
|
|
:confirmLoading="confirmLoading"
|
|
:ok-text="$t('docTool.split.split')"
|
|
:cancel-text="$t('cancel')"
|
|
@ok="handleOk"
|
|
@cancel="handleCancel">
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
<a-form :form="form">
|
|
<!--标准号-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardSelect.standardNumber')">
|
|
<!-- <a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardNumber')"-->
|
|
<!-- @change="event => event.target.value = event.target.value.trim()"-->
|
|
<!-- :maxLength="100"-->
|
|
<!-- v-decorator="['serialNumber', validatorRules.serialNumber]" />-->
|
|
<standard-selection :placeholder="$t('pleaseSelect') + $t('standardSelect.standardNumber')"
|
|
type="radio"
|
|
@nameChange="handleStandardNumberChange"
|
|
:select-only="false"
|
|
:can-selected-source="[StandardSource.DOMESTIC.value, StandardSource.ENTERPRISE.value]"
|
|
class="readonly-input"
|
|
v-decorator="['serialNumber', validatorRules.serialNumber]" />
|
|
</a-form-item>
|
|
<!--标准名称-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardSelect.standardName')">
|
|
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardName')"
|
|
@change="event => event.target.value = event.target.value.trim()"
|
|
:maxLength="200"
|
|
v-decorator="['title', validatorRules.title]" />
|
|
</a-form-item>
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="'拆分文档类型'">
|
|
企标文件
|
|
</a-form-item>
|
|
<!--文本状态-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.comparison.textStatus')">
|
|
<!-- <a-input :placeholder="$t('pleaseEnter') + $t('docTool.comparison.textStatus')"-->
|
|
<!-- @change="event => event.target.value = event.target.value.trim()"-->
|
|
<!-- :maxLength="50"-->
|
|
<!-- v-decorator="['fileType', validatorRules.fileType]" />-->
|
|
<a-select
|
|
:placeholder="$t('pleaseSelect') + $t('docTool.comparison.textStatus')"
|
|
v-decorator="['fileType', validatorRules.fileType]"
|
|
show-search
|
|
:filter-option="filterOption"
|
|
>
|
|
<a-select-option :value="undefined">请选择</a-select-option>
|
|
<a-select-option v-for="(item, key) in dictOptions" :key="key" :value="item.value">
|
|
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
|
|
{{ item.text || item.label }}
|
|
</span>
|
|
</a-select-option>
|
|
</a-select>
|
|
<!-- <j-dict-select-tag-->
|
|
<!-- class="box-input"-->
|
|
<!-- v-decorator="['fileType', validatorRules.fileType]"-->
|
|
<!-- :placeholder="$t('pleaseSelect') + $t('docTool.comparison.textStatus')"-->
|
|
<!-- :type="'select'"-->
|
|
<!-- :triggerChange="false"-->
|
|
<!-- :dictCode="'process_manuscript'" />-->
|
|
</a-form-item>
|
|
<!--拆分结果文件-->
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.split.splitFile')">
|
|
<div class="result-file-box">
|
|
<j-upload v-decorator="['fileId', validatorRules.fileId]"
|
|
return-id
|
|
:number="1"
|
|
class="line-btn"
|
|
file-type="doc,docx" />
|
|
</div>
|
|
</a-form-item>
|
|
</a-form>
|
|
|
|
<div class="tip">
|
|
<a-icon type="exclamation-circle" class="tip-icon" />
|
|
<span>{{ $t('docTool.split.splitImportResultWord') }}</span>
|
|
<span class="tip-click" @click="showTips">{{ $t('docTool.split.clickToView') }}</span>
|
|
</div>
|
|
</a-spin>
|
|
</j-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import { importSplitResult , addDocSplit} from '@api/documentToolApi'
|
|
import { getFileInfo } from '@api/api'
|
|
import StandardSelection from '../../../../components/selection/StandardSelection.vue'
|
|
import { downloadFile } from '@api/manage'
|
|
import { StandardSource } from '../../../../enums/commonEnums'
|
|
|
|
export default {
|
|
name: 'splitIsInStorage',
|
|
components: { StandardSelection },
|
|
data () {
|
|
return {
|
|
StandardSource,
|
|
width: 600,
|
|
visible: false,
|
|
confirmLoading: false,
|
|
form: this.$form.createForm(this),
|
|
dictOptions: [
|
|
{
|
|
text: '发布稿',
|
|
value: '1'
|
|
},
|
|
{
|
|
text: '正文',
|
|
value: '2'
|
|
}
|
|
],
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 6 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 16 }
|
|
},
|
|
validatorRules: {
|
|
// 标准号
|
|
serialNumber: {
|
|
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('standardSelect.standardNumber') }, { max: 200, message: '标准编号最大输入200字符' }],
|
|
validateTrigger: 'blur'
|
|
},
|
|
// 标准名称
|
|
title: {
|
|
rules: [{ required: false, message: this.$t('pleaseEnter') + this.$t('standardSelect.standardName') }, { max: 200, message: '标准名称最大输入200字符' }],
|
|
validateTrigger: 'blur'
|
|
},
|
|
// 文本状态
|
|
fileType: {
|
|
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('docTool.comparison.textStatus') }],
|
|
validateTrigger: 'blur'
|
|
},
|
|
// 拆分文件
|
|
fileId: {
|
|
rules: [{ required: true, message: this.$t('uploadFile.pleaseUpload') + this.$t('docTool.split.splitFile') }],
|
|
validateTrigger: 'change'
|
|
}
|
|
},
|
|
downTemplateUrl: '/laws/DocumentTool/documentSplit/downloadImportTemplate' // 模板下载
|
|
}
|
|
},
|
|
methods: {
|
|
filterOption (input, option) {
|
|
const text = option.componentOptions.children[0].text || option.componentOptions.children[0].data.attrs.title
|
|
return text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
},
|
|
handleStandardNumberChange (name) {
|
|
this.form.setFieldsValue({ title: name })
|
|
},
|
|
open () {
|
|
this.visible = true
|
|
},
|
|
handleOk () {
|
|
this.form.validateFields(async (errors, values) => {
|
|
if (!errors) {
|
|
this.confirmLoading = true
|
|
const formData = values
|
|
const fileInfo = await getFileInfo({ id: formData.fileId })
|
|
if (fileInfo.success) {
|
|
formData.fileName = fileInfo.result.fileName
|
|
}
|
|
addDocSplit(formData).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.$emit('ok')
|
|
this.close()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.confirmLoading = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
handleCancel () {
|
|
this.close()
|
|
},
|
|
close () {
|
|
this.visible = false
|
|
this.form.resetFields()
|
|
},
|
|
showTips () {
|
|
this.$info({
|
|
closeable: true, // 展示右上角关闭
|
|
cancelText: this.$t('docTool.split.gotIt'),
|
|
title: this.$t('docTool.split.formatRequirement'),
|
|
content: (h) => {
|
|
const contentArr = ['(标题要求如下,不可省略且必须为正文格式,内容无规定)', '1 范围', '2 规范性引用文件', '3 术语与定义',
|
|
'4、5、6...', '(注)', '1.Word版本必须是2007以上', '2.文档序号从4开始拆分,且序号必须为连续,例如4.1,4.2,4.3']
|
|
const contentDomArr = []
|
|
for (let i = 0; i < contentArr.length; i++) {
|
|
if (i === 1 || i === 2 || i === 3 || i === 4) {
|
|
contentDomArr.push(h('div', { class: 'textClass' }, contentArr[i]))
|
|
} else if (i === 5) {
|
|
contentDomArr.push(h('div', { class: 'textClassRed' }, contentArr[i]))
|
|
} else {
|
|
contentDomArr.push(h('div', { }, contentArr[i]))
|
|
}
|
|
}
|
|
// for (const content of contentArr) {
|
|
// console.log(content)
|
|
// contentDomArr.push(h('div', {}, content))
|
|
// }
|
|
return contentDomArr
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.line-btn {
|
|
display: inline-block;
|
|
}
|
|
|
|
.line-btn:last-child {
|
|
margin-left: 12px;
|
|
}
|
|
|
|
.tip {
|
|
margin: 0 42px;
|
|
|
|
&-icon {
|
|
color: @primary-color;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
&-click {
|
|
color: @primary-color;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
|
|
.result-file-box {
|
|
display: flex;
|
|
align-items: baseline;
|
|
}
|
|
|
|
.result-file-box > div {
|
|
flex: 1;
|
|
width: 0;
|
|
}
|
|
|
|
.readonly-input {
|
|
/deep/ .ant-input[disabled] {
|
|
background-color: white;
|
|
color: rgba(0, 0, 0, 0.65);
|
|
}
|
|
}
|
|
</style>
|
|
<style>
|
|
.textClass{
|
|
color: rgba(0, 0, 0, 0.65);
|
|
font-weight: 600;
|
|
font-size: 16px;
|
|
margin-top: 6px;
|
|
}
|
|
.textClassRed{
|
|
color: red;
|
|
font-size: 14px;
|
|
margin-top: 6px;
|
|
}
|
|
</style>
|