From 63ac895629d2de0e7f4284b1617d9aa8cbd07d05 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期五, 21 三月 2025 14:16:04 +0800 Subject: [PATCH] 1、删除DNC冗余组件 2、优化DNC文档版本、文档指派及文档预览功能代码 --- src/views/dnc/common/SelectFileCompareModal.vue | 76 ++++++++++++++++++++++++------------- 1 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/views/dnc/common/SelectFileCompareModal.vue b/src/views/dnc/common/SelectFileCompareModal.vue index 9c6b7cd..f471912 100644 --- a/src/views/dnc/common/SelectFileCompareModal.vue +++ b/src/views/dnc/common/SelectFileCompareModal.vue @@ -1,27 +1,22 @@ -<template> - <a-modal :title="title" :visible="visible" :width="700" @cancel="handleCloseModal" @ok="handleOpenCompareModal" - :maskClosable="false"> - <a-table :dataSource="dataSource" :columns="columns" :pagination="false" bordered :scroll="{y:364}" - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" rowKey="fileId"> - <template slot="rowIndex" slot-scope="text,record,index"> - <span :style="{color:setCurrentVersionColor(record.publishFlag)}">{{parseInt(index) + 1}}</span> - </template> - <template slot="fileName" slot-scope="text,record,index"> - <span :style="{color:setCurrentVersionColor(record.publishFlag)}"> - {{text}}.{{record.fileSuffix}} - <span v-if="record.publishFlag">[褰撳墠鐗堟湰]</span> - </span> - </template> - <template slot="docVersion" slot-scope="text,record"> - <span :style="{color:setCurrentVersionColor(record.publishFlag)}">{{text}}</span> - </template> - </a-table> + <template> + <a-modal :title="title" :visible="visible" :width="700" @cancel="handleCloseModal" @ok="handleOpenCompareModal" + :maskClosable="false"> + <a-table :dataSource="dataSource" :columns="columns" :pagination="false" bordered :scroll="{y:364}" + :customRow="customRow" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" rowKey="fileId"> + <template slot="fileName" slot-scope="text,record,index"> + <span :style="{color:setCurrentVersionColor(record.publishFlag)}"> + {{ text }}.{{ record.fileSuffix }} + <span v-if="record.publishFlag">[褰撳墠鐗堟湰]</span> + </span> + </template> + </a-table> - <FileCompareModal ref="fileCompareModalRef" :fileDiffObject="fileDiffObject" :fileVersionArray="fileVersionArray"/> - </a-modal> -</template> + <FileCompareModal ref="fileCompareModalRef" :fileDiffObject="fileDiffObject" :fileVersionArray="fileVersionArray"/> + </a-modal> + </template> -<script> + <script> import dncApi from '@/api/dnc' import FileCompareModal from './FileCompareModal' @@ -45,9 +40,17 @@ fileVersionArray: [], selectedFileInfo: {}, columns: [ - { title: '搴忓彿', dataIndex: 'rowIndex', width: 65, align: 'center', scopedSlots: { customRender: 'rowIndex' } }, + { + title: '搴忓彿', + dataIndex: 'rowIndex', + width: 65, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + } + }, { title: '鏂囦欢鍚嶇О', dataIndex: 'fileName', align: 'center', scopedSlots: { customRender: 'fileName' } }, - { title: '鐗堟湰鍙�', dataIndex: 'docVersion', align: 'center', scopedSlots: { customRender: 'docVersion' } } + { title: '鐗堟湰鍙�', dataIndex: 'docVersion', align: 'center' } ] } }, @@ -65,11 +68,29 @@ } }, methods: { + /** + * 瀹氬埗琛ㄦ牸琛屾牱寮� + * @param record 琛ㄦ牸琛屼俊鎭� + * @returns {{style: {color: *}}} 鏍峰紡 + */ + customRow(record) { + return { + style: { + color: this.setCurrentVersionColor(record.publishFlag) + } + } + }, + + /** + * 褰撹〃鏍煎閫夋鏀瑰彉鏃惰Е鍙� + * @param selectedRowKeys 閫変腑鐨勬瘡涓�琛岀殑key闆嗗悎 + */ onSelectChange(selectedRowKeys) { if (selectedRowKeys.length < 3) this.selectedRowKeys = selectedRowKeys else this.selectedRowKeys = selectedRowKeys.slice(-2) }, + // 鎵撳紑瀵规瘮绐楀彛 handleOpenCompareModal() { const { $confirm, $notification, selectedRowKeys, title, dataSource } = this if (selectedRowKeys.length < 2) { @@ -121,14 +142,15 @@ }) }, + // 鍏抽棴绐楀彛 handleCloseModal() { this.visible = false this.selectedRowKeys = [] } } } -</script> + </script> -<style scoped> + <style scoped> -</style> \ No newline at end of file + </style> \ No newline at end of file -- Gitblit v1.9.3