From 0e9500211e1a10a94dbca72e754cc5cf7eb16e3d Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期六, 08 二月 2025 13:53:12 +0800 Subject: [PATCH] 产品结构树: 1、调整权限配置分配部门树组件逻辑 --- src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue | 95 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 81 insertions(+), 14 deletions(-) diff --git a/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue b/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue index b909b4c..aeb3240 100644 --- a/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue +++ b/src/views/dnc/base/modules/ProductStructure/Document/DocumentVersionTableList.vue @@ -1,31 +1,38 @@ <template> - <a-table :columns="columns" :data-source="dataSource" bordered :pagination="false" :size="size" 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"> + <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> + </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 @@ -38,6 +45,7 @@ return { disableMixinCreated: true, queryParams: {}, + currentDocumentVersion: '', columns: [ { title: '搴忓彿', dataIndex: 'rowIndex', width: 65, align: 'center', scopedSlots: { customRender: 'rowIndex' } }, { title: '鏂囦欢鍚嶇О', dataIndex: 'fileName', align: 'center', scopedSlots: { customRender: 'fileName' } }, @@ -48,6 +56,9 @@ list: '/nc/file/find/list' } } + }, + created() { + this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod) }, methods: { loadData() { @@ -65,6 +76,8 @@ 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) } @@ -74,6 +87,60 @@ }, /** + * 鎸囧畾褰撳墠鏂囨。涓哄綋鍓嶇増鏈� + * @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} 棰滆壊鏍囪瘑 -- Gitblit v1.9.3