[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"> <template v-slot:clauseContent="text, record">
<a-tooltip overlay-class-name="tooltip-style"> <div class="table-text can-click-table-text" v-if="text || text === 0" @click="showContent('item_content', text,record)">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template> {{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
<a v-if="text" class="link-a" @click="handleClauseContent(record)">{{ text }}</a> </div>
<div v-else class="table-text">{{ global.emptyLine }}</div> <div class="table-text" v-else>{{ global.emptyLine }}</div>
</a-tooltip>
</template> </template>
</a-table> </a-table>
@@ -64,15 +63,20 @@
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button> <a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button> <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button>
</div> </div>
<!--条文内容-->
<split-clause-detail ref="splitClauseDetail" />
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { getClauseListByStandardInfoId } from '../../api/api' import { getClauseListByStandardInfoId } from '../../api/api'
import SplitClauseDetail from '../../views/documentTool/documentSplit/modules/SplitClauseDetail'
export default { export default {
name: 'ClauseSelectionModal', name: 'ClauseSelectionModal',
components: { SplitClauseDetail },
props: { props: {
value: { value: {
type: String, type: String,
@@ -169,7 +173,7 @@ export default {
if (res.success) { if (res.success) {
this.dataList = res.result.records this.dataList = res.result.records
this.ipagination.total = res.result.total 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 { } else {
this.dataList = [] this.dataList = []
} }
@@ -192,7 +196,7 @@ export default {
if (selectedRowKeys.length > this.selectedRowList.length) { if (selectedRowKeys.length > this.selectedRowList.length) {
// 说明是增加了数据 // 说明是增加了数据
for (const rowIndex in selectedRows) { 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]) this.selectedRowList.push(selectedRows[rowIndex])
} }
@@ -202,7 +206,7 @@ export default {
if (selectedRowKeys && selectedRowKeys.length > 0) { if (selectedRowKeys && selectedRowKeys.length > 0) {
// 没有选中数据,说明这一页没有选中数据了 // 没有选中数据,说明这一页没有选中数据了
for (let i = 0; i < this.selectedRowList.length; i++) { 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) this.selectedRowList.splice(i, 1)
i-- i--
@@ -226,15 +230,13 @@ export default {
this.close() this.close()
}, },
handleSubmit () { handleSubmit () {
const serialNumber = [] const itemNumArr = []
const serialNameArr = []
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.selectedRowList.forEach(res => { this.selectedRowList.forEach(res => {
serialNumber.push(res.standardNumber) itemNumArr.push(res.item_num)
serialNameArr.push(res.standardName)
}) })
this.$emit('change', this.selectedRowKeys.join(',')) this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('nameChange', serialNameArr.join(',')) this.$emit('nameChange', itemNumArr.join(','))
this.$emit('listChange', this.selectedRowList) this.$emit('listChange', this.selectedRowList)
this.close() this.close()
} else { } 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]" v-decorator="['clauseIds', validatorRules.clauseIds]"
:nameStr="model.clauseNos" :nameStr="model.clauseNos"
:info-id="sarFileSplitInfoId" :info-id="sarFileSplitInfoId"
@listChange="handleClauseChange" @nameChange="handleClauseNameChange"
/> />
</a-form-item> </a-form-item>
<!--绑定人员--> <!--绑定人员-->
@@ -157,8 +157,8 @@ export default {
}) })
}, },
// 条款号变化 // 条款号变化
handleClauseChange (value) { handleClauseNameChange (value) {
this.model.clauseNos = value.map(item => item.clauseNo).join(',') this.model.clauseNos = value
}, },
close () { close () {
this.visible = false this.visible = false
@@ -90,9 +90,9 @@
:loading="loading" :loading="loading"
@change="handleTableChange"> @change="handleTableChange">
<!--条文内容--> <!-- 条款内容 -->
<template slot="item_content" slot-scope="{text, record}"> <template slot="clauseContent" slot-scope="{text, record}">
<div class="table-text" v-if="text || text === 0" @click="showContent('item_content', 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, ' ') : '' }} {{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div> </div>
<div class="table-text" v-else>{{ global.emptyLine }}</div> <div class="table-text" v-else>{{ global.emptyLine }}</div>
@@ -155,7 +155,7 @@ export default {
align: 'center', align: 'center',
width: 180, width: 180,
dataIndex: 'item_content', dataIndex: 'item_content',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'clauseContent' }
} }
], ],
clauseIds: '' // 能查看的条款ids clauseIds: '' // 能查看的条款ids
@@ -199,7 +199,7 @@ export default {
return return
} }
this.dataSource = res.result.records || [] 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 this.ipagination.total = res.result.total
} else { } else {
this.$message.warn(res.message) this.$message.warn(res.message)