[update] 绑定零部件

This commit is contained in:
lideqin
2024-04-19 14:19:40 +08:00
parent 552bc8397d
commit 41a8f9bd91
3 changed files with 29 additions and 23 deletions
@@ -50,11 +50,10 @@
<!-- 条款内容 -->
<template v-slot:clauseContent="text, record">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleClauseContent(record)">{{ text }}</a>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
<div class="table-text can-click-table-text" 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>
</a-table>
@@ -64,15 +63,20 @@
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button>
</div>
<!--条文内容-->
<split-clause-detail ref="splitClauseDetail" />
</a-drawer>
</template>
<script>
import { getClauseListByStandardInfoId } from '../../api/api'
import SplitClauseDetail from '../../views/documentTool/documentSplit/modules/SplitClauseDetail'
export default {
name: 'ClauseSelectionModal',
components: { SplitClauseDetail },
props: {
value: {
type: String,
@@ -169,7 +173,7 @@ export default {
if (res.success) {
this.dataList = res.result.records
this.ipagination.total = res.result.total
this.selectedRowKeys = this.value ? this.value.split(',') : (this.selectedRowKeys || [])
this.selectedRowKeys = this.value ? this.value.split(',').map(item => item.trim()) : (this.selectedRowKeys || [])
} else {
this.dataList = []
}
@@ -192,7 +196,7 @@ export default {
if (selectedRowKeys.length > this.selectedRowList.length) {
// 说明是增加了数据
for (const rowIndex in selectedRows) {
if (!this.selectedRowList.find(item => item.standardNumber === selectedRows[rowIndex].standardNumber)) {
if (!this.selectedRowList.find(item => item.id === selectedRows[rowIndex].id)) {
// 不存在,追加
this.selectedRowList.push(selectedRows[rowIndex])
}
@@ -202,7 +206,7 @@ export default {
if (selectedRowKeys && selectedRowKeys.length > 0) {
// 没有选中数据,说明这一页没有选中数据了
for (let i = 0; i < this.selectedRowList.length; i++) {
if (!selectedRowKeys.find(item => item === this.selectedRowList[i].standardNumber)) {
if (!selectedRowKeys.find(item => item === this.selectedRowList[i].id)) {
// 表格选中中没有找到这一条数据,说明已经被删了
this.selectedRowList.splice(i, 1)
i--
@@ -226,15 +230,13 @@ export default {
this.close()
},
handleSubmit () {
const serialNumber = []
const serialNameArr = []
const itemNumArr = []
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.selectedRowList.forEach(res => {
serialNumber.push(res.standardNumber)
serialNameArr.push(res.standardName)
itemNumArr.push(res.item_num)
})
this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('nameChange', serialNameArr.join(','))
this.$emit('nameChange', itemNumArr.join(','))
this.$emit('listChange', this.selectedRowList)
this.close()
} else {
@@ -257,8 +259,12 @@ export default {
}
},
// 点击条款内容
handleClauseContent (record) {
showContent (fieldName, val) {
const title = (this.columns.find(tt => tt.dbFieldName === fieldName) || {}).dbFieldTxt
if (title) {
this.$refs.splitClauseDetail.title = title
}
this.$refs.splitClauseDetail.open(val)
}
}
}
@@ -45,7 +45,7 @@
v-decorator="['clauseIds', validatorRules.clauseIds]"
:nameStr="model.clauseNos"
:info-id="sarFileSplitInfoId"
@listChange="handleClauseChange"
@nameChange="handleClauseNameChange"
/>
</a-form-item>
<!--绑定人员-->
@@ -157,8 +157,8 @@ export default {
})
},
// 条款号变化
handleClauseChange (value) {
this.model.clauseNos = value.map(item => item.clauseNo).join(',')
handleClauseNameChange (value) {
this.model.clauseNos = value
},
close () {
this.visible = false
@@ -90,9 +90,9 @@
:loading="loading"
@change="handleTableChange">
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" v-if="text || text === 0" @click="showContent('item_content', text,record)">
<!-- 条款内容 -->
<template slot="clauseContent" slot-scope="{text, record}">
<div class="table-text can-click-table-text" 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>
@@ -155,7 +155,7 @@ export default {
align: 'center',
width: 180,
dataIndex: 'item_content',
scopedSlots: { customRender: 'text' }
scopedSlots: { customRender: 'clauseContent' }
}
],
clauseIds: '' // 能查看的条款ids
@@ -199,7 +199,7 @@ export default {
return
}
this.dataSource = res.result.records || []
this.selectedRowKeys = this.clauseIds ? this.clauseIds.split(',') : []
this.selectedRowKeys = this.clauseIds ? this.clauseIds.split(',').map(item => item.trim()) : []
this.ipagination.total = res.result.total
} else {
this.$message.warn(res.message)