Browse Source

接口接入

scorpio 2 years ago
parent
commit
553cf1d98d
3 changed files with 56 additions and 23 deletions
  1. 11 0
      src/api/store/index.js
  2. 7 2
      src/layout/top.vue
  3. 38 21
      src/views/store/component/info3.vue

+ 11 - 0
src/api/store/index.js

@@ -32,5 +32,16 @@ export default {
       '/blade-project-manage-v2/project-dispatch/v2/delete-file',
       params
     )
+  },
+  /**
+   * 导出项目入库文件
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
+  exportFile(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/export-storage-word',
+      params
+    )
   }
 }

+ 7 - 2
src/layout/top.vue

@@ -168,8 +168,13 @@ export default {
   },
   methods: {
     initWebSocket() {
-      console.log(333)
-      const wsuri = 'ws://192.168.31.83:8200/websocket/' + this.user.info.userId
+      console.log(window.location.href)
+
+      const url =
+        window.location.href.indexOf('https') > -1
+          ? window.location.href.replace('https', 'wss')
+          : window.location.href.replace('http', 'ws')
+      const wsuri = url + '/websocket/' + this.user.info.userId
       this.websock = new WebSocket(wsuri)
       this.websock.onmessage = this.websocketonmessage
       // 连接建立时触发

+ 38 - 21
src/views/store/component/info3.vue

@@ -19,24 +19,29 @@
           <div>
             <el-dropdown @command="openFile">
               <el-button type="primary">
-                上传附件<el-icon class="el-icon--right"><arrow-down /></el-icon>
+                上传附件
+                <el-icon class="el-icon--right">
+                  <arrow-down />
+                </el-icon>
               </el-button>
               <template #dropdown>
                 <el-dropdown-menu>
                   <el-dropdown-item command="1"
-                    >备案证/可研批复</el-dropdown-item
-                  >
+                    >备案证/可研批复
+                  </el-dropdown-item>
                   <el-dropdown-item command="2">合同</el-dropdown-item>
                   <el-dropdown-item command="3">工程量清单</el-dropdown-item>
                   <el-dropdown-item command="4">现场照片</el-dropdown-item>
                   <el-dropdown-item command="5"
-                    >项目核实认定表</el-dropdown-item
-                  >
+                    >项目核实认定表
+                  </el-dropdown-item>
                   <el-dropdown-item command="6">其他资料</el-dropdown-item>
                 </el-dropdown-menu>
               </template>
             </el-dropdown>
-            <el-button type="primary" plain>导出</el-button>
+            <el-button type="primary" plain @click="exportFile"
+              >导 出</el-button
+            >
           </div>
         </template>
 
@@ -51,32 +56,32 @@
               size="mini"
               text
               @click="previewFile(row)"
-              >查 看</el-button
-            >
+              >查 看
+            </el-button>
             <el-button
               icon="Download"
               type="primary"
               size="mini"
               text
               @click="downLoad(row)"
-              >下 载</el-button
-            >
+              >下 载
+            </el-button>
             <el-button
               icon="Download"
               type="primary"
               size="mini"
               text
               @click="openFolder(row)"
-              >打开文件夹</el-button
-            >
+              >打开文件夹
+            </el-button>
             <el-button
               icon="Delete"
               type="primary"
               size="mini"
               text
               @click="rowDel(row)"
-              >删 除</el-button
-            >
+              >删 除
+            </el-button>
           </div>
         </template>
       </avue-crud>
@@ -90,19 +95,18 @@
     <el-dialog v-model="show" width="800px" title="附件要素">
       <el-descriptions title="合同">
         <el-descriptions-item label="Username"
-          >kooriookami</el-descriptions-item
-        >
+          >kooriookami
+        </el-descriptions-item>
         <el-descriptions-item label="Telephone"
-          >18100000000</el-descriptions-item
-        >
+          >18100000000
+        </el-descriptions-item>
         <el-descriptions-item label="Place">Suzhou</el-descriptions-item>
         <el-descriptions-item label="Remarks">
           <el-tag size="small">School</el-tag>
         </el-descriptions-item>
         <el-descriptions-item label="Address"
-          >No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu
-          Province</el-descriptions-item
-        >
+          >No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province
+        </el-descriptions-item>
       </el-descriptions>
     </el-dialog>
   </div>
@@ -283,6 +287,19 @@ export default {
       })
       window.open(routeUrl.href, '_blank')
     },
+    exportFile() {
+      console.log('export')
+      this.$api.store
+        .exportFile({ projectId: this.info.projectId })
+        .then(res => {
+          if (res.code === 200) {
+            ElMessageBox.alert(
+              '智能生成文档中,生成完成后系统将会发送通知消息给您!',
+              ''
+            )
+          }
+        })
+    },
     rowDel(row) {
       ElMessageBox.confirm('确定要执行删除操作?', '提示', {
         confirmButtonText: '确定',