From ba9490368b8bf27e0d4a6471420044dadf5b720e Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期二, 21 一月 2025 15:33:42 +0800 Subject: [PATCH] 产品结构树: 1、新增指定文档为当前版本功能与文档版本内容差异比对功能(新增插件vue-code-diff) 2、调整产品及部件属性tab栏标题为属性信息 3、删除产品及部件属性信息中对应层级名称 全局: 调整设置后端接口地址方式由vue.config.js改为env环境文件配置 --- src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue | 153 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 134 insertions(+), 19 deletions(-) diff --git a/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue b/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue index 14f5344..aeb3240 100644 --- a/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue +++ b/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue @@ -1,39 +1,154 @@ <template> - <a-table :columns="columns" :data-source="dataSource" bordered :pagination="false"> - - </a-table> + <div> + <a-table :columns="columns" :data-source="dataSource" bordered :pagination="false" :size="size" rowKey="fileId" + :customRow="customRow"> + <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> + <template slot="fileSize" slot-scope="text,record"> + <span :style="{color:setCurrentVersionColor(record.publishFlag)}">{{(text/1024).toFixed(2)}}KB</span> + </template> + </a-table> + <SelectFileCompareModal :dataSource="dataSource" :setCurrentVersionColor="setCurrentVersionColor" + ref="selectFileCompareModalRef"/> + </div> </template> <script> import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import { getAction } from '@/api/manage' + import dncApi from '@/api/dnc' + import SelectFileCompareModal from './SelectFileCompareModal' export default { name: 'DocumentVersionTableList', mixins: [JeecgListMixin], - components: {}, + components: { SelectFileCompareModal }, + props: { + currentDocumentInfo: { + type: Object + }, + size: { + type: String + } + }, data() { return { + disableMixinCreated: true, + queryParams: {}, + currentDocumentVersion: '', columns: [ - { - title: '搴忓彿', - dataIndex: 'rowIndex', - key: 'rowIndex', - width: 65, - align: 'center', - customRender: function(t, r, index) { - return parseInt(index) + 1 - } - }, - { title: '鏂囦欢鍚嶇О', dataIndex: 'fileName', align: 'center' }, - { title: '鐗堟湰鍙�', dataIndex: 'docVersion', align: 'center' }, - { title: '鏂囦欢澶у皬', dataIndex: 'fileSize', align: 'center' } + { title: '搴忓彿', dataIndex: 'rowIndex', width: 65, align: 'center', scopedSlots: { customRender: 'rowIndex' } }, + { title: '鏂囦欢鍚嶇О', dataIndex: 'fileName', align: 'center', scopedSlots: { customRender: 'fileName' } }, + { title: '鐗堟湰鍙�', dataIndex: 'docVersion', align: 'center', scopedSlots: { customRender: 'docVersion' } }, + { title: '鏂囦欢澶у皬', dataIndex: 'fileSize', align: 'center', scopedSlots: { customRender: 'fileSize' } } ], url: { - list: '' + list: '/nc/file/find/list' } } }, - methods: {} + created() { + this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod) + }, + methods: { + loadData() { + this.dataSource = [] + if (!this.url.list) { + this.$message.error('璇疯缃畊rl.list灞炴��!') + return + } + var params = this.getQueryParams()//鏌ヨ鏉′欢 + params.docId = this.currentDocumentInfo.docId + if (!params) { + return false + } + this.loading = true + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource = res.list + this.currentDocumentVersion = res.list.find(item => item.publishFlag).docVersion + console.log('currentDocumentVersion', this.currentDocumentVersion) + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + }, + + /** + * 鎸囧畾褰撳墠鏂囨。涓哄綋鍓嶇増鏈� + * @param fileId 鏂囦欢Id + */ + handleFileAssign({ fileId }) { + const that = this + dncApi.appointCurrentDocumentVersionApi(fileId) + .then(res => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + const currentAssignDocumentVersion = that.dataSource.find(item => item.fileId === fileId).docVersion + // 濡傛灉褰撳墠鎸囧畾鐗堟湰鐨勭増鏈彿涓庡綋鍓嶇増鏈殑鐗堟湰鍙蜂竴鑷村垯涓嶉噸鏂板姞杞藉垪琛ㄥ苟涓斾笉閲嶆柊閲婃斁棰勮鎺ュ彛璋冨彇 + if (that.currentDocumentVersion === currentAssignDocumentVersion) return + that.loadData() + that.$emit('releaseFilePreviewApi') + } else { + that.$notification.error({ + message: '娑堟伅', + description: res.message + }) + } + }) + .catch(err => { + that.$notification.error({ + message: '娑堟伅', + description: err.message + }) + }) + }, + + handleFileAddRelative(_, modalTitle) { + if (!this.$refs.selectFileCompareModalRef) return + this.$refs.selectFileCompareModalRef.visible = true + this.$refs.selectFileCompareModalRef.title = modalTitle + }, + + customRow(record) { + return { + on: { + contextmenu: event => { + event.preventDefault() + this.$emit('handleTableContextMenuOpen', Object.assign({ param: 'file' }, record)) + } + } + } + }, + + triggerCorrespondingMethod({ methodName, level, modalTitle, tableRowInfo }) { + if (this[methodName]) this[methodName](tableRowInfo, modalTitle) + }, + + /** + * 璁剧疆琛ㄦ牸涓负褰撳墠鐗堟湰鐨勬枃浠惰〃鏍艰棰滆壊鏍囪瘑 + * @param publishFlag 鏄惁涓哄綋鍓嶇増鏈� + * @returns {string} 棰滆壊鏍囪瘑 + */ + setCurrentVersionColor(publishFlag) { + return publishFlag ? '#DB9538' : '' + } + } } </script> -- Gitblit v1.9.3