zs před 8 měsíci
rodič
revize
2c4e2253dd

binární
public/产学研用供给模板.xlsx


binární
public/产学研用成果模板.xlsx


binární
public/产学研用需求模板.xlsx


binární
public/产学研用项目模板.xlsx


binární
public/导入模板.xlsx


+ 15 - 17
src/views/center/achievement.vue

@@ -6,7 +6,7 @@
           <div class="one_left">
             <div class="button" @click="toAdd">发布成果</div>
             <div class="button" @click="toTemplate">下载导出模板</div>
-            <el-upload class="button" :action="url" :show-file-list="false" :on-error="onError" :http-request="httpRequse" accept=".xlsx"> 选择excel模板文件 </el-upload>
+            <el-upload class="button" action="/files/web/cxyy_import/upload" :show-file-list="false" :on-success="onSuccess" accept=".xlsx"> 选择excel模板文件 </el-upload>
             <div class="button" @click="toDownload">下载Excel</div>
           </div>
           <div class="one_right">
@@ -96,6 +96,7 @@
 </template>
 
 <script setup>
+import axios from 'axios'
 import { Search } from '@element-plus/icons-vue'
 import { cloneDeep, get } from 'lodash-es'
 const $checkRes = inject('$checkRes')
@@ -311,26 +312,23 @@ const checkedExportChange = (value) => {
 }
 // 下载导出模板
 const toTemplate = () => {
-  window.open('/cxyyWeb/导入模板.xlsx')
+  window.open('/cxyyWeb/产学研用成果模板.xlsx')
 }
 // 上传Excel
-const httpRequse = async (param) => {
+const onSuccess = async (response, file) => {
   const msgbox = ElMessage({ message: '正在导入中,请稍后...', center: true, duration: 0 })
   try {
-    let fileObj = param.file
-    let fd = new FormData()
-    fd.append('file', fileObj, fileObj.name)
-    const res = await utilStore.toImport(fd)
-    // let list
-    console.log(res)
-    // if (res.status !== 200) {
-    //   list = [{ key: '请求发生错误' }]
-    // } else if (res.data.errcode !== 0) {
-    //   list = [{ key: '请求发生错误', num: res.data.errmsg }]
-    // } else {
-    //   list = res.data.data
-    // }
-    // console.log(list)
+    const res = await utilStore.toImport({ url: response.uri })
+    if (res.errcode == '0') {
+      if (res.data[0].errorList) {
+        ElMessageBox.alert(res.data[0].errorList, '错误提示', {
+          confirmButtonText: 'OK'
+        })
+      } else {
+        ElMessage({ message: '导入成功', type: 'success' })
+      }
+      search({ skip, limit })
+    }
   } catch (error) {
     console.error(error)
   } finally {

+ 14 - 17
src/views/center/demand.vue

@@ -6,7 +6,7 @@
           <div class="one_left">
             <div class="button" @click="toAdd">发布需求</div>
             <div class="button" @click="toTemplate">下载导出模板</div>
-            <el-upload class="button" :action="url" :show-file-list="false" :on-error="onError" :http-request="httpRequse" accept=".xlsx"> 选择excel模板文件 </el-upload>
+            <el-upload class="button" action="/files/web/cxyy_import/upload" :show-file-list="false" :on-success="onSuccess" accept=".xlsx"> 选择excel模板文件 </el-upload>
             <div class="button" @click="toDownload">下载Excel</div>
           </div>
           <div class="one_right">
@@ -368,26 +368,23 @@ const checkedExportChange = (value) => {
 }
 // 下载导出模板
 const toTemplate = () => {
-  window.open('/cxyyWeb/导入模板.xlsx')
+  window.open('/cxyyWeb/产学研用需求模板.xlsx')
 }
 // 上传Excel
-const httpRequse = async (param) => {
+const onSuccess = async (response, file) => {
   const msgbox = ElMessage({ message: '正在导入中,请稍后...', center: true, duration: 0 })
   try {
-    let fileObj = param.file
-    let fd = new FormData()
-    fd.append('file', fileObj, fileObj.name)
-    const res = await utilStore.toImport(fd)
-    // let list
-    console.log(res)
-    // if (res.status !== 200) {
-    //   list = [{ key: '请求发生错误' }]
-    // } else if (res.data.errcode !== 0) {
-    //   list = [{ key: '请求发生错误', num: res.data.errmsg }]
-    // } else {
-    //   list = res.data.data
-    // }
-    // console.log(list)
+    const res = await utilStore.toImport({ url: response.uri })
+    if (res.errcode == '0') {
+      if (res.data[0].errorList) {
+        ElMessageBox.alert(res.data[0].errorList, '错误提示', {
+          confirmButtonText: 'OK'
+        })
+      } else {
+        ElMessage({ message: '导入成功', type: 'success' })
+      }
+      search({ skip, limit })
+    }
   } catch (error) {
     console.error(error)
   } finally {

+ 14 - 17
src/views/center/project.vue

@@ -6,7 +6,7 @@
           <div class="one_left">
             <div class="button" @click="toAdd">发布项目</div>
             <div class="button" @click="toTemplate">下载导出模板</div>
-            <el-upload class="button" :action="url" :show-file-list="false" :on-error="onError" :http-request="httpRequse" accept=".xlsx"> 选择excel模板文件 </el-upload>
+            <el-upload class="button" action="/files/web/cxyy_import/upload" :show-file-list="false" :on-success="onSuccess" accept=".xlsx"> 选择excel模板文件 </el-upload>
             <div class="button" @click="toDownload">下载Excel</div>
           </div>
           <div class="one_right">
@@ -376,26 +376,23 @@ const checkedExportChange = (value) => {
 }
 // 下载导出模板
 const toTemplate = () => {
-  window.open('/cxyyWeb/导入模板.xlsx')
+  window.open('/cxyyWeb/产学研用项目模板.xlsx')
 }
 // 上传Excel
-const httpRequse = async (param) => {
+const onSuccess = async (response, file) => {
   const msgbox = ElMessage({ message: '正在导入中,请稍后...', center: true, duration: 0 })
   try {
-    let fileObj = param.file
-    let fd = new FormData()
-    fd.append('file', fileObj, fileObj.name)
-    const res = await utilStore.toImport(fd)
-    // let list
-    console.log(res)
-    // if (res.status !== 200) {
-    //   list = [{ key: '请求发生错误' }]
-    // } else if (res.data.errcode !== 0) {
-    //   list = [{ key: '请求发生错误', num: res.data.errmsg }]
-    // } else {
-    //   list = res.data.data
-    // }
-    // console.log(list)
+    const res = await utilStore.toImport({ url: response.uri })
+    if (res.errcode == '0') {
+      if (res.data[0].errorList) {
+        ElMessageBox.alert(res.data[0].errorList, '错误提示', {
+          confirmButtonText: 'OK'
+        })
+      } else {
+        ElMessage({ message: '导入成功', type: 'success' })
+      }
+      search({ skip, limit })
+    }
   } catch (error) {
     console.error(error)
   } finally {

+ 14 - 17
src/views/center/supply.vue

@@ -6,7 +6,7 @@
           <div class="one_left">
             <div class="button" @click="toAdd">发布供给</div>
             <div class="button" @click="toTemplate">下载导出模板</div>
-            <el-upload class="button" :action="url" :show-file-list="false" :on-error="onError" :http-request="httpRequse" accept=".xlsx"> 选择excel模板文件 </el-upload>
+            <el-upload class="button" action="/files/web/cxyy_import/upload" :show-file-list="false" :on-success="onSuccess" accept=".xlsx"> 选择excel模板文件 </el-upload>
             <div class="button" @click="toDownload">下载Excel</div>
           </div>
           <div class="one_right">
@@ -366,26 +366,23 @@ const checkedExportChange = (value) => {
 }
 // 下载导出模板
 const toTemplate = () => {
-  window.open('/cxyyWeb/导入模板.xlsx')
+  window.open('/cxyyWeb/产学研用供给模板.xlsx')
 }
 // 上传Excel
-const httpRequse = async (param) => {
+const onSuccess = async (response, file) => {
   const msgbox = ElMessage({ message: '正在导入中,请稍后...', center: true, duration: 0 })
   try {
-    let fileObj = param.file
-    let fd = new FormData()
-    fd.append('file', fileObj, fileObj.name)
-    const res = await utilStore.toImport(fd)
-    // let list
-    console.log(res)
-    // if (res.status !== 200) {
-    //   list = [{ key: '请求发生错误' }]
-    // } else if (res.data.errcode !== 0) {
-    //   list = [{ key: '请求发生错误', num: res.data.errmsg }]
-    // } else {
-    //   list = res.data.data
-    // }
-    // console.log(list)
+    const res = await utilStore.toImport({ url: response.uri })
+    if (res.errcode == '0') {
+      if (res.data[0].errorList) {
+        ElMessageBox.alert(res.data[0].errorList, '错误提示', {
+          confirmButtonText: 'OK'
+        })
+      } else {
+        ElMessage({ message: '导入成功', type: 'success' })
+      }
+      search({ skip, limit })
+    }
   } catch (error) {
     console.error(error)
   } finally {