Pārlūkot izejas kodu

加导入按钮

hbchen 2 gadi atpakaļ
vecāks
revīzija
7c573f458f

+ 16 - 0
src/api/financialMana.js

@@ -186,3 +186,19 @@ export function exportIandPList(data) {
      params:data
  })
 }
+
+// 合规登记-导入
+ /**
+  * 
+  * @param {
+ * File - 文件formData - 必填
+ * } data 
+ * @returns 
+ */
+export function importDataApi(data) {
+ return request({
+     url:'/contract/register/import',
+     method:'post',
+     data
+ })
+}

+ 0 - 39
src/views/financialManagement/contractProgress.vue

@@ -1,6 +1,5 @@
 
 <script setup>
-  // import serviceVarietyDia from './components/serviceVarietyDia.vue'
   import permissionDia from './components/permissionDia.vue'
   import {useRouter,useRoute} from 'vue-router'
   import {useStore} from 'vuex'
@@ -678,42 +677,6 @@
           })
         }
       }
-      // let samllService=contractInfo.form.services.find(item => item.service_template_id==2)
-
-      // if(contractInfo.operationtype=='compliance' && samllService){
-        // 合规编辑
-        /**
-         * 有可能服务模板的接口数据还没返回
-         * 这时更改contractInfo.currentSmallService会触发子组件的监听函数,导致空指针错误
-         * 创建一个 setInterval 询问contractInfo.serviceArray数据是否返回,已返回就更新contractInfo.currentSmallService
-         */
-        //  let temarr = samllService.detail.map((rowItem) => {
-        //   let rowArr = [];
-        //   for (let key in rowItem) {
-        //       if (key.substr(0, 3) === "col" && rowItem[key] !== "") {
-        //         rowArr.push(JSON.parse(rowItem[key]));
-        //       }
-        //     }
-        //     return rowArr;
-        //   });
-        //   let paramsTemp={
-        //     tableHeadData:temarr[0],
-        //     tableData:temarr.slice(1),
-        //     service_template_id:samllService.service_template_id,
-        //     Value:samllService.value,
-        //     chart_permission_ids:samllService.chart_permission_ids
-        //   }
-        // if(contractInfo.serviceArray.length==0){
-        //   let timer=setInterval(()=>{
-        //     if(contractInfo.serviceArray.length>0){
-        //       contractInfo.currentSmallService=paramsTemp
-        //       clearInterval(timer)
-        //     }
-        //   },10)
-        // }else{
-        //   contractInfo.currentSmallService=paramsTemp
-        // }
-      // }
     })
   }
 </script>
@@ -1014,8 +977,6 @@
       <!-- 小套餐选择品种弹窗 -->
       <permission-dia v-model:visible="contractInfo.varietyDiaShow" :type="contractInfo.varietyDiaType"
       @selectFinish="getPermissionChecked" :hasCheckedPermission="contractInfo.checkedPermission"></permission-dia>
-      <!-- <service-variety-dia v-model:visible="contractInfo.varietyDiaShow" @selectFinish="getVarieties" 
-      :service="contractInfo.serviceArray.find(item=>item.service_template_id==2)" :currentService="contractInfo.currentSmallService" ></service-variety-dia> -->
       <!-- 查看套餐弹窗 -->
       <el-dialog v-model="contractInfo.serviceShow" style="min-width: 800px;" title="" width="70vw" top="5vh">
         <template #header>

+ 39 - 3
src/views/financialManagement/financialList.vue

@@ -2,7 +2,7 @@
 import { Search } from '@element-plus/icons-vue'
 import {useRouter,useRoute} from 'vue-router'
 import {getServiceList,getRegisterList,updateRegisterStatus,
-  registerDelete,registerListExport} from '@/api/financialMana'
+  registerDelete,registerListExport,importDataApi} from '@/api/financialMana'
 import {downloadByFlow} from '@/utils/common-methods'
 
 const router = useRouter()
@@ -48,7 +48,8 @@ const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
       contract_register_id:'',
       contract_status:''
     },
-    currentStatusRow:{}
+    currentStatusRow:{},
+    importLoading:false
   })
 
   // 监听
@@ -113,6 +114,30 @@ const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
       downloadByFlow(res,'xlsx','财务列表')
     })
   }
+
+  // 导入数据
+  const importData=(e)=>{
+    if(financial.importLoading){
+      ElMessage.warning('正在导入中,请勿重复导入')
+      return
+    }
+    let {file}=e
+    if(!file.name.endsWith('xlsx')){
+      ElMessage.warning('上传你的文件不为.xlxs结尾')
+      return
+    }
+    financial.importLoading=true
+    let formData = new FormData()
+    formData.append('File',file)
+    importDataApi(formData).then(res=>{
+      ElMessage.success('导入成功')
+      searchFinancial()
+    }).finally(()=>{
+      financial.importLoading=false
+    })
+  }
+
+
   // 显示开票详情
   const invoiceDetail=(row)=>{
     // console.log(row);
@@ -201,7 +226,18 @@ const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
           <div class="financial-top-option-zone">
               <el-button type="primary" size="large" style="width: 130px;margin-right: 30px;" v-permission="'financial:list:complianceAdd'"
               @click="registration('compliance')">合规登记</el-button>
-              <el-button @click="exportData" size="large" style="width: 130px;margin-left: 0;" >导出</el-button>
+              <el-button @click="exportData" size="large" style="width: 130px;margin: 0 30px 0 0;" >导出</el-button>
+              <el-upload
+                class="upload-demo"
+                accept=".xlsx"
+                :show-file-list="false"
+                :http-request="importData"
+                v-permission="'financial:list:complianceImport'"
+              >
+                <el-button size="large" :loading="financial.importLoading"
+                style="width: 130px;margin-left: 0;"  >导入</el-button>
+              </el-upload>
+              
           </div>
           <div class="financial-table-zone">
             <!-- 表格 -->