[update 标准解读流程]

This commit is contained in:
danshihao
2024-07-09 09:50:02 +08:00
parent 982039700f
commit ba2f572d9f
9 changed files with 1165 additions and 377 deletions
@@ -0,0 +1,352 @@
<template>
<div>
<a-spin :spinning="loading">
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<div v-if="!disabled" class="table-operator">
<!-- 添加标准 -->
<a-button icon="plus" type="primary" @click="handleAddStandard">
{{$t('workCenter.standardInterpretationProcess.addStandard')}}
</a-button>
<!-- 选择条款 -->
<a-button icon="plus" type="primary" @click="handleSelectClause">
{{$t('workCenter.standardInterpretationProcess.selectStandard')}}
</a-button>
</div>
<div class="table-container mb-20">
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="false">
<!-- 分解单来源-->
<template v-slot:decompositionSource="{text, record}">
<a-select v-model="record.decompositionSource"
@change="handleChangeDecompositionSource"
:placeholder="$t('pleaseSelect') + $t('workCenter.standardInterpretationProcess.decompositionOrderSource')"
style="width: 100%;">
<a-select-option v-for="item in decompositionSourceList"
:disabled="item.isDisabled === '1'"
:key="item.value" :value="item.value">
{{ item.text || item.title }}
</a-select-option>
</a-select>
</template>
</j-table>
</div>
<template v-if="showClauseTable">
<div v-if="!disabled" class="table-operator">
<!-- 批量删除条款 -->
<a-button icon="delete" type="danger" ghost @click="handleClauseBatchDel">
{{ $t('batchDelete') }}
</a-button>
</div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="uuid"
:columns="clauseColumns"
:dataSource="clauseDataSource"
:pagination="clauseIpagination"
:row-selection="{ selectedRowKeys: selectedClauseRowKeys, onChange: onSelectClauseChange }"
@change="handleClauseTableChange">
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" style="cursor: pointer" v-if="text || text === 0" @click="showContent('item_content', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<template v-slot:action="{text, record}">
<a @click="handleClauseDelete(record.uuid)" class="table-ope-btn">{{ $t('delete') }}</a>
</template>
</j-table>
</template>
</a-spin>
<!-- 添加标准弹框-只选择已拆分的数据 -->
<standard-selection-modal ref="selectStandardRef"
type="radio"
@listChange="handleAddStandardCallback"
:canSelectedSource="[StandardSource.FOREIGN.value]"
disabledSourceSearch/>
<!--条文内容-->
<split-clause-detail ref="splitClauseDetail" />
</div>
</template>
<script>
import StandardSelectionModal from '@comp/selection/StandardSelectionModal'
import { interpretGetClauseList, interpretGetFileByStandardId } from '@api/workCenter'
import { randomUUID } from '@/utils/util'
import { StandardSource } from '@/enums/commonEnums'
import SplitClauseDetail from '@views/documentTool/documentSplit/modules/SplitClauseDetail'
export default {
name: 'InterpretationInitiate',
components: { SplitClauseDetail, StandardSelectionModal },
props: {
disabled: {
type: Boolean,
required: false,
default: false
}
},
data () {
return {
StandardSource,
loading: false,
columns: [
{ // 标准编号
title: this.$t('standardNumber'),
align: 'center',
width: 180,
dataIndex: 'standardNumber',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称
title: this.$t('standardName'),
align: 'center',
width: 180,
dataIndex: 'standardName',
scopedSlots: { customRender: 'text' }
},
{ // 标准状态
title: this.$t('standardState'),
align: 'center',
width: 180,
dataIndex: 'standardState_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 分解单来源
title: this.$t('workCenter.standardInterpretationProcess.decompositionOrderSource'),
align: 'center',
width: 180,
dataIndex: 'decompositionSource_dictText',
scopedSlots: { customRender: 'decompositionSource' }
},
{ // 实施日期
title: this.$t('implementationDate'),
align: 'center',
width: 180,
dataIndex: 'implementationDate',
scopedSlots: { customRender: 'text' }
},
{ // 新生产车实施日期
title: this.$t('newProductionVehicleImplementationDate'),
align: 'center',
width: 180,
dataIndex: 'newProductionImplementation',
scopedSlots: { customRender: 'text' }
},
{ // 新认证车实施日期
title: this.$t('newCertifiedVehicleImplementationDate'),
align: 'center',
width: 180,
dataIndex: 'newCerImplementDate',
scopedSlots: { customRender: 'text' }
}
],
dataSource: [],
decompositionSourceList: [], // 标准分解单下拉
showClauseTable: false,
clauseColumns: [
{ // 标准编号/条款号
title: this.$t('standardNumber') + '/' + this.$t('clauseNo'),
align: 'center',
width: 180,
dataIndex: 'itemNum',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称/条款标题
title: this.$t('standardName') + '/' + this.$t('clauseTitle'),
align: 'center',
width: 180,
dataIndex: 'itemTitle',
scopedSlots: { customRender: 'text' }
},
{ // 条款内容
title: this.$t('clauseContent'),
align: 'center',
width: 180,
dataIndex: 'itemContent',
scopedSlots: { customRender: 'item_content' }
},
{ // 操作
title: this.$t('operation'),
fixed: 'right',
width: 150,
scopedSlots: { customRender: 'action' }
}
],
clauseDataSource: [],
/* 分页参数 */
clauseIpagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedClauseRowKeys: []
}
},
methods: {
/**
* 获取组件内的数据
* @param isValidate - 是否需要校验
*/
getData (isValidate) {
const obj = {}
if (isValidate) {
// 如果没有选择标准
if (!this.dataSource.length) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
// 校验失败就返回true
obj._flag = true
}
}
// 选择的标准列表
obj.standardData = this.dataSource
// 选择的条款列表
obj.clauseData = this.clauseDataSource
// 是否显示了条款列表
obj.showClauseTable = this.showClauseTable
return obj
},
// 更新组件内的数据
setData (data) {
},
// 添加标准
handleAddStandard () {
this.$refs.selectStandardRef.open()
},
// 选择条款
handleSelectClause () {
// 请添加一条标准
if (!this.dataSource.length) {
this.$message.warning(this.$t('workCenter.standardInterpretationProcess.pleaseAddStandard'))
return
}
// 请选择分解单来源
if (!this.dataSource[0].decompositionSource) {
this.$message.warning(this.$t('pleaseSelect') + this.$t('workCenter.standardInterpretationProcess.decompositionOrderSource'))
return
}
this.showClauseTable = true
this.loading = true
interpretGetClauseList({
standardId: this.dataSource[0].id,
fileType: this.dataSource[0].decompositionSource
}).then(res => {
if (res.success) {
this.clauseDataSource = (res.result || []).map(item => {
item.uuid = randomUUID()
return item
})
}
}).finally(() => {
this.loading = false
})
},
// 选择完标准回调
handleAddStandardCallback (list) {
console.log(list)
this.dataSource = list || []
if (this.dataSource.length) {
interpretGetFileByStandardId({ standardId: this.dataSource[0].id }).then(res => {
if (res.success) {
this.decompositionSourceList = res.result || []
}
})
}
},
// 修改分解单来源
handleChangeDecompositionSource (val) {
this.decompositionSource = val
const find = this.decompositionSourceList.find(item => item.value === val)
if (find) {
this.dataSource.decompositionSource_dictText = find.text || find.title
}
},
// 条款批量删除
handleClauseBatchDel () {
if (this.selectedClauseRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
const that = this
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: () => {
this.clauseDataSource = this.clauseDataSource.filter(item => !this.selectedClauseRowKeys.includes(item.uuid))
this.selectedClauseRowKeys = []
// 重新计算分页问题
that.handleClauseReCalculatePage(that.selectedClauseRowKeys.length)
}
})
}
},
// 条款删除
handleClauseDelete (id) {
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
const index = this.clauseDataSource.findIndex(item => item.uuid === id)
if (index !== -1) {
this.clauseDataSource.splice(index, 1)
}
if (that.clauseIpagination.current > 1 && ((that.clauseIpagination.current - 1) * that.clauseIpagination.pageSize) + 1 === that.clauseIpagination.total) {
that.clauseIpagination.current -= 1
}
}
})
},
// 删除后计算分页
handleClauseReCalculatePage (count) {
// 总数量-count
const total = this.clauseIpagination.total - count
// 获取删除后的分页数
const currentIndex = Math.ceil(total / this.clauseIpagination.pageSize)
// 删除后的分页数<所在当前页
if (currentIndex < this.clauseIpagination.current) {
this.clauseIpagination.current = currentIndex
}
},
// 勾选条款
onSelectClauseChange (keys) {
this.selectedClauseRowKeys = keys
},
/**
* 显示条款内容、条文解读弹框
* @param fieldName
* @param val
*/
showContent (fieldName, val) {
const title = (this.clauseColumns.find(tt => tt.dbFieldName === fieldName) || {}).dbFieldTxt
if (title) {
this.$refs.splitClauseDetail.title = title
}
this.$refs.splitClauseDetail.open(val)
},
handleClauseTableChange (pagination, filters, sorter) {
this.clauseIpagination = pagination
}
}
}
</script>
<style lang="less" scoped>
.mb-20 {
margin-bottom: 20px;
}
</style>
@@ -0,0 +1,238 @@
<template>
<div>
<a-spin :spinning="loading">
<div class="process-part-title">{{ $t('dispatchInformation') }}</div>
<div v-if="!disabled" class="table-operator">
<!-- 批量删除条款 -->
<a-button icon="delete" type="danger" ghost @click="handleClauseBatchDel">
{{ $t('batchDelete') }}
</a-button>
</div>
<div class="mb-20">
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="id"
:columns="clauseColumns"
:dataSource="clauseDataSource"
:pagination="clauseIpagination"
:row-selection="{ selectedRowKeys: selectedClauseRowKeys, onChange: onSelectClauseChange }"
@change="handleClauseTableChange">
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" style="cursor: pointer" v-if="text || text === 0" @click="showContent('item_content', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<template v-slot:action="{text, record}">
<a @click="handleClauseDelete(record.id)" class="table-ope-btn">{{ $t('delete') }}</a>
</template>
</j-table>
</div>
<a-form :form="form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row>
<a-col :span="8">
<a-form-item :label="$t('workCenter.standardInterpretationProcess.mainInterpreter')" :colon="false">
<!--主解读人-->
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.standardInterpretationProcess.mainInterpreter')"
v-decorator="['masterInterpretId', validatorRules.masterInterpretId]"
:disabled="disabled"
filedName="masterInterpretId"
@nameChange="userSelectNameChange"
:nameStr="formInline.masterInterpretId_dictText" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
<!--条文内容-->
<split-clause-detail ref="splitClauseDetail" />
</div>
</template>
<script>
import SplitClauseDetail from '@views/documentTool/documentSplit/modules/SplitClauseDetail'
import UserSelection from '@comp/selection/UserSelection'
export default {
name: 'InterpretationLiaisonDistribute',
components: { UserSelection, SplitClauseDetail },
props: {
disabled: {
type: Boolean,
required: false,
default: false
}
},
data () {
return {
form: this.$form.createForm(this),
loading: false,
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
clauseColumns: [
{ // 标准编号/条款号
title: this.$t('standardNumber') + '/' + this.$t('clauseNo'),
align: 'center',
width: 180,
dataIndex: 'itemNum',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称/条款标题
title: this.$t('standardName') + '/' + this.$t('clauseTitle'),
align: 'center',
width: 180,
dataIndex: 'itemTitle',
scopedSlots: { customRender: 'text' }
},
{ // 条款内容
title: this.$t('clauseContent'),
align: 'center',
width: 180,
dataIndex: 'itemContent',
scopedSlots: { customRender: 'item_content' }
},
{ // 操作
title: this.$t('operation'),
fixed: 'right',
width: 150,
scopedSlots: { customRender: 'action' }
}
],
clauseDataSource: [],
/* 分页参数 */
clauseIpagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedClauseRowKeys: [],
validatorRules: {
// 主解读人
masterInterpretId: {
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('processName') }],
validateTrigger: 'blur'
}
},
// 表单的数据
formInline: {}
}
},
methods: {
/**
* 获取组件内的数据
* @param isValidate - 是否需要校验
*/
async getData (isValidate) {
const obj = {}
if (isValidate) {
obj.formData = await new Promise((resolve) => {
this.form.validateFields((err, values) => {
if (err) { obj._flag = true }
// 校验成功失败都返回表单数据
resolve(values)
})
})
}
// 条款列表
obj.clauseData = this.clauseDataSource
return obj
},
// 更新组件内的数据
setData (data) {
this.clauseDataSource = data.data.processStandardInterpretClauseList || []
this.formInline = data.data.processStandardInterpret
this.form.setFieldsValue(this.formInline)
},
// 条款批量删除
handleClauseBatchDel () {
if (this.selectedClauseRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
const that = this
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: () => {
this.clauseDataSource = this.clauseDataSource.filter(item => !this.selectedClauseRowKeys.includes(item.id))
this.selectedClauseRowKeys = []
// 重新计算分页问题
that.handleClauseReCalculatePage(that.selectedClauseRowKeys.length)
}
})
}
},
// 条款删除
handleClauseDelete (id) {
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
const index = this.clauseDataSource.findIndex(item => item.id === id)
if (index !== -1) {
this.clauseDataSource.splice(index, 1)
}
if (that.clauseIpagination.current > 1 && ((that.clauseIpagination.current - 1) * that.clauseIpagination.pageSize) + 1 === that.clauseIpagination.total) {
that.clauseIpagination.current -= 1
}
}
})
},
// 删除后计算分页
handleClauseReCalculatePage (count) {
// 总数量-count
const total = this.clauseIpagination.total - count
// 获取删除后的分页数
const currentIndex = Math.ceil(total / this.clauseIpagination.pageSize)
// 删除后的分页数<所在当前页
if (currentIndex < this.clauseIpagination.current) {
this.clauseIpagination.current = currentIndex
}
},
// 勾选条款
onSelectClauseChange (keys) {
this.selectedClauseRowKeys = keys
},
/**
* 显示条款内容、条文解读弹框
* @param fieldName
* @param val
*/
showContent (fieldName, val) {
const title = (this.clauseColumns.find(tt => tt.dbFieldName === fieldName) || {}).dbFieldTxt
if (title) {
this.$refs.splitClauseDetail.title = title
}
this.$refs.splitClauseDetail.open(val)
},
handleClauseTableChange (pagination, filters, sorter) {
this.clauseIpagination = pagination
},
// 选择用户回显用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
}
}
}
</script>
<style lang="less" scoped>
.mb-20 {
margin-bottom: 20px;
}
</style>
@@ -0,0 +1,352 @@
<template>
<div>
<a-spin :spinning="loading">
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<div class="table-container mb-20">
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="false">
</j-table>
</div>
<a-form :form="form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row>
<a-col :span="8">
<a-form-item :label="$t('workCenter.standardInterpretationProcess.interpretingTasksIsDistribute')" :colon="false">
<!--解读任务是否下发-->
<j-dict-select-tag :placeholder="$t('pleaseSelect') + $t('workCenter.standardInterpretationProcess.interpretingTasksIsDistribute')"
@change="hanldeChangeIsDistribute"
dict-code="is_distribute"
v-decorator="[ 'isDistribute', validatorRules.isDistribute ]" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<div class="mb-20">
<a-button icon="arrow-down">下一步</a-button>
</div>
<!-- 分发的部分 -->
<template v-if="isDistribute">
<div class="process-part-title">{{ $t('dispatchInformation') }}</div>
<div v-if="!disabled" class="table-operator">
<!-- 批量选择人员 -->
<a-button icon="plus" type="primary" @click="handleClauseBatchSelectUser">
{{$t('workCenter.standardInterpretationProcess.addStandard')}}
</a-button>
<!-- 导出 -->
<a-button icon="plus" type="primary" @click="handleExportClause">
{{$t('workCenter.standardInterpretationProcess.selectStandard')}}
</a-button>
<!-- 批量删除 -->
<a-button icon="plus" type="primary" @click="handleClauseBatchDel">
{{$t('workCenter.standardInterpretationProcess.selectStandard')}}
</a-button>
</div>
<div class="table-container mb-20">
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="id"
:columns="clauseColumns"
:dataSource="clauseDataSource"
:pagination="clauseIpagination"
:row-selection="{ selectedRowKeys: selectedClauseRowKeys, onChange: onSelectClauseChange }"
@change="handleClauseTableChange">
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" style="cursor: pointer" v-if="text || text === 0" @click="showContent('item_content', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--各涉及部门解读人-->
<template slot="interpretPersonIds" slot-scope="{text, record, index}">
<user-selection :placeholder="$t('pleaseSelect')+$t('workCenter.standardInterpretationProcess.departInterpretingPeople')"
v-model="record.interpretPersonIds"
:disabled="disabled"
filedName="interpretPersonIds"
@nameChange="(...arg) => userSelectNameChange(...arg, index)"
type="checkbox"
:nameStr="record.interpretPersonIds_dictText" />
</template>
<template v-slot:action="{text, record}">
<a @click="handleClauseDelete(record.id)" class="table-ope-btn">{{ $t('delete') }}</a>
</template>
</j-table>
</div>
</template>
<!-- 不分发的部分 -->
<template v-else-if="isDistribute === false">
</template>
</a-spin>
<!--条文内容-->
<split-clause-detail ref="splitClauseDetail" />
<!--批量选择人员-->
<user-select-modal ref="userSelectModal" check-required @change="handleClauseBatchSelectUserCallback" />
</div>
</template>
<script>
import UserSelection from '@comp/selection/UserSelection'
import SplitClauseDetail from '@views/documentTool/documentSplit/modules/SplitClauseDetail'
import UserSelectModal from '@comp/selection/UserSelectModal'
export default {
name: 'InterpretationMainInterpreterDistribute',
components: { UserSelectModal, SplitClauseDetail, UserSelection },
props: {
disabled: {
type: Boolean,
required: false,
default: false
}
},
data () {
return {
loading: false,
form: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
columns: [
{ // 标准编号
title: this.$t('standardNumber'),
align: 'center',
width: 180,
dataIndex: 'standardNumber',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称
title: this.$t('standardName'),
align: 'center',
width: 180,
dataIndex: 'standardName',
scopedSlots: { customRender: 'text' }
},
{ // 标准状态
title: this.$t('standardState'),
align: 'center',
width: 180,
dataIndex: 'standardState_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 分解单来源
title: this.$t('workCenter.standardInterpretationProcess.decompositionOrderSource'),
align: 'center',
width: 180,
dataIndex: 'decompositionSource_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 实施日期
title: this.$t('implementationDate'),
align: 'center',
width: 180,
dataIndex: 'implementationDate',
scopedSlots: { customRender: 'text' }
},
{ // 新生产车实施日期
title: this.$t('newProductionVehicleImplementationDate'),
align: 'center',
width: 180,
dataIndex: 'newProductionImplementation',
scopedSlots: { customRender: 'text' }
},
{ // 新认证车实施日期
title: this.$t('newCertifiedVehicleImplementationDate'),
align: 'center',
width: 180,
dataIndex: 'newCerImplementDate',
scopedSlots: { customRender: 'text' }
}
],
dataSource: [],
// 表单的数据
formInline: {},
validatorRules: {
// 解读任务是否下发
isDistribute: {
rules: [
{ required: false, message: this.$t('pleaseSelect') + this.$t('workCenter.standardInterpretationProcess.interpretingTasksIsDistribute') }
],
validateTrigger: 'change'
}
},
// 是否点击下一步
isNextStep: false,
// 是否下发 (true是, false否, null未选择)
isDistribute: null,
showClauseTable: false,
clauseColumns: [
{ // 标准编号/条款号
title: this.$t('standardNumber') + '/' + this.$t('clauseNo'),
align: 'center',
width: 180,
dataIndex: 'itemNum',
scopedSlots: { customRender: 'text' }
},
{ // 标准名称/条款标题
title: this.$t('standardName') + '/' + this.$t('clauseTitle'),
align: 'center',
width: 180,
dataIndex: 'itemTitle',
scopedSlots: { customRender: 'text' }
},
{ // 条款内容
title: this.$t('clauseContent'),
align: 'center',
width: 180,
dataIndex: 'itemContent',
scopedSlots: { customRender: 'item_content' }
},
{ // 各涉及部门解读人
title: this.$t('workCenter.standardInterpretationProcess.departInterpretingPeople'),
align: 'center',
width: 180,
dataIndex: 'interpretPersonIds',
scopedSlots: { customRender: 'interpretPersonIds' }
},
{ // 操作
title: this.$t('operation'),
fixed: 'right',
width: 150,
scopedSlots: { customRender: 'action' }
}
],
clauseDataSource: [],
/* 分页参数 */
clauseIpagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedClauseRowKeys: []
}
},
methods: {
getData (isValidate) {
},
setData (data) {
},
// 是否下发
hanldeChangeIsDistribute (val) {
if (val + '' === '1') {
this.isDistribute = true
} else if (val + '' === '2') {
this.isDistribute = false
} else {
this.isDistribute = null
}
},
// 条款导出
handleExportClause () {
},
// 条款批量删除
handleClauseBatchDel () {
if (this.selectedClauseRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
const that = this
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: () => {
this.clauseDataSource = this.clauseDataSource.filter(item => !this.selectedClauseRowKeys.includes(item.id))
this.selectedClauseRowKeys = []
// 重新计算分页问题
that.handleClauseReCalculatePage(that.selectedClauseRowKeys.length)
}
})
}
},
// 条款删除
handleClauseDelete (id) {
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
const index = this.clauseDataSource.findIndex(item => item.id === id)
if (index !== -1) {
this.clauseDataSource.splice(index, 1)
}
if (that.clauseIpagination.current > 1 && ((that.clauseIpagination.current - 1) * that.clauseIpagination.pageSize) + 1 === that.clauseIpagination.total) {
that.clauseIpagination.current -= 1
}
}
})
},
// 删除后计算分页
handleClauseReCalculatePage (count) {
// 总数量-count
const total = this.clauseIpagination.total - count
// 获取删除后的分页数
const currentIndex = Math.ceil(total / this.clauseIpagination.pageSize)
// 删除后的分页数<所在当前页
if (currentIndex < this.clauseIpagination.current) {
this.clauseIpagination.current = currentIndex
}
},
// 勾选条款
onSelectClauseChange (keys) {
this.selectedClauseRowKeys = keys
},
/**
* 显示条款内容、条文解读弹框
* @param fieldName
* @param val
*/
showContent (fieldName, val) {
const title = (this.clauseColumns.find(tt => tt.dbFieldName === fieldName) || {}).dbFieldTxt
if (title) {
this.$refs.splitClauseDetail.title = title
}
this.$refs.splitClauseDetail.open(val)
},
handleClauseTableChange (pagination, filters, sorter) {
this.clauseIpagination = pagination
},
// 选择用户回显用户名
userSelectNameChange (value, fieldName, index) {
this.clauseDataSource[index][fieldName + '_dictText'] = value
},
// 批量选择人员
handleClauseBatchSelectUser () {
this.$refs.userSelectModal.open()
},
// 批量选择人员回调
handleClauseBatchSelectUserCallback (user) {
// this.clauseDataSource.forEach(item => {
// if (this.selectedClauseRowKeys.includes(item.id)) {
// item.interpretPersonIds = user
// }
// })
console.log(user)
}
}
}
</script>
<style scoped>
</style>