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 |   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