Files
laws_chery_client/src/views/documentTool/documentSplit/modules/SplitText.vue
T

256 lines
8.2 KiB
Vue

<template>
<a-drawer
:title="$t('docTool.split.splitText')"
placement="right"
:visible="visible"
@close="onClose"
width="1100"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row :gutter="24" type="flex">
<!--标准结构树-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('docTool.comparison.standardStructureTree')">
<a-tree-select
tree-node-filter-prop="title"
v-model="queryParam.standardSystem"
:maxTagCount="1"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
:tree-data="standardStructureTree"
tree-checkable
show-search
allowClear
tree-check-strictly
:filterTreeNode="filterTreeOption"
:placeholder="$t('pleaseSelect') + $t('docTool.comparison.standardStructureTree')"
/>
</a-form-item>
</a-col>
<!--标准号-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.standardNumber')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardNumber')"
v-model="queryParam.standardNumber"></a-input>
</a-form-item>
</a-col>
<!--标准名称-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('standardSelect.standardName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardSelect.standardName')"
v-model="queryParam.standardName"></a-input>
</a-form-item>
</a-col>
<!--文本状态-->
<a-col :md="8" :sm="12">
<a-form-item :label="$t('docTool.comparison.textStatus')">
<j-dict-select-tag
class="box-input"
v-model="queryParam.standardFileType"
:placeholder="$t('pleaseSelect') + $t('docTool.comparison.textStatus')"
:type="'select'"
:triggerChange="false"
:dictCode="'process_manuscript'" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<div class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">
{{ $t('query') }}
</a-button>
<a-button type="primary" @click="searchReset" icon="reload" ghost style="margin-left: 8px">{{ $t('reset') }}</a-button>
</div>
</div>
<j-table
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:loading="loading"
:scroll="{x: '100%'}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'checkbox' }"
:pagination="ipagination"
@change="handleTableChange">
</j-table>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="cancelSplit" style='margin-right: 15px'>{{ $t('cancel') }}</a-button>
<a-button type="primary" :loading="loading" @click="submitSplit">{{ $t('docTool.split.split') }}</a-button>
</div>
</a-drawer>
</template>
<script>
import JTable from '../../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../../mixins/JeroListMixin.js'
import { addDocSplit } from '../../../../api/documentToolApi.js'
import { getForeignStandardTree } from '@api/standardRegulationLibraryApi'
import { filterObj } from '@/utils/util'
export default {
name: 'SplitText',
components: { JTable },
mixins: [JeroListMixin],
data () {
return {
visible: false,
loading: false,
labelCol: {
span: 6
},
wrapperCol: {
span: 14
},
columns: [
// 资料类型
{
dataIndex: 'origin_dictText',
title: this.$t('docTool.split.dataType'),
width: 150
},
// 标准号
{
dataIndex: 'standardNumber',
title: this.$t('standardSelect.standardNumber'),
width: 150
},
// 标准名称
{
dataIndex: 'standardName',
title: this.$t('standardSelect.standardName'),
width: 150
},
// 文件状态
{
dataIndex: 'standardFileType_dictText',
title: this.$t('docTool.comparison.textStatus'),
width: 150
},
// 附件
{
dataIndex: 'fileName',
title: this.$t('businessSupport.questionAnswer.attach'),
width: 150
}
],
url: {
list: '/laws/DocumentTool/documentSplit/querySplitFileInfoByPage' // 表格数据
},
type: 'pdfdoc',
operationList: [],
showAction: false,
flag: 'header',
disableMixinCreated: true,
// 标准结构树
standardStructureTree: []
}
},
created () {
this.loadStandardStructureTree()
},
methods: {
// 获取树结构没有被禁用的value值
getValuesWhereNotDisabled (tree = []) {
const values = []
function traverse (node) {
if (!node.disabled) { // 只处理 disabled 不为 true 的节点
values.push(node.value)
}
if (node.children && node.children.length > 0) {
node.children.forEach(child => traverse(child))
}
}
tree.forEach(node => traverse(node))
return values
},
getQueryParams () {
// 获取查询条件
const sqp = {}
if (this.superQueryParams) {
sqp.superQueryParams = encodeURI(this.superQueryParams)
sqp.superQueryMatchType = this.superQueryMatchType
}
const param = Object.assign(sqp, this.queryParam, this.isorter, this.filters)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
if (Array.isArray(param.standardSystem) && param.standardSystem.length) {
param.standardSystem = param.standardSystem.map(item => item.value).join(',')
} else {
param.standardSystem = this.getValuesWhereNotDisabled(this.standardStructureTree).join(',')
}
return filterObj(param)
},
// 加载标准结构树
loadStandardStructureTree () {
// option 不传显示我的收藏,1不显示我的收藏, 2只能选二级中国及中国下三级,和欧盟EU
getForeignStandardTree({ option: 2 }).then(res => {
if (res.success) {
this.standardStructureTree = res.result || []
}
})
},
open () {
this.visible = true
this.queryParam = {}
this.loadData(1)
},
// 抽屉关闭
onClose () {
this.visible = false
this.onClearSelected()
},
// 取消
cancelSplit () {
this.onClose()
},
// 拆分
submitSplit () {
if (this.loading) {
return
}
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectOne'))
return
}
// 最多同时拆分十条
if (this.selectedRowKeys.length > 10) {
this.$message.warning(this.$t('docTool.split.maximumSelection') + '10' + this.$t('docTool.split.pieceOfData'))
return
}
this.loading = true
addDocSplit({ ids: this.selectedRowKeys.join(',') }).then(res => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.onClose()
} else {
this.messageLineFeedByBr(this.$t('operationFailed'), res.message)
}
this.$emit('ok')
}).finally(() => {
this.loading = false
})
}
}
}
</script>
<style scoped lang="less">
@import '~../../../../assets/less/common.less';
.table-page-search-wrapper {
display: flex;
/deep/ .ant-form-inline .ant-form-item .ant-form-item-control {
height: auto;
}
.ant-form {
flex: 1;
}
}
.table-page-search-submitButtons {
margin-left: 10px;
}
</style>