| | |
| | | <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' |
| | | |
| | |
| | | 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' } |
| | | ] |
| | | } |
| | | }, |
| | |
| | | } |
| | | }, |
| | | 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) { |
| | |
| | | }) |
| | | }, |
| | | |
| | | // 关闭窗口 |
| | | handleCloseModal() { |
| | | this.visible = false |
| | | this.selectedRowKeys = [] |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style scoped> |
| | | |
| | | </style> |
| | | </style> |