CzRger 3 miesięcy temu
rodzic
commit
110e50238e

+ 4 - 1
.env.development

@@ -5,4 +5,7 @@ NODE_ENV = development
 VITE_TITLE = 窗口表单
 
 # 基础路径
-VITE_BASE = window-form
+VITE_BASE = window-form
+
+# 接口环境
+VITE_API_NAME = dev

+ 4 - 1
.env.production

@@ -5,4 +5,7 @@ NODE_ENV = production
 VITE_TITLE = 窗口表单
 
 # 基础路径
-VITE_BASE = window-form
+VITE_BASE = window-form
+
+# 接口环境
+VITE_API_NAME = prod

BIN
src/out/file/许可范围导入模板.xlsx


+ 6 - 2
src/views/form/business-model/excel-import.vue

@@ -35,6 +35,7 @@
               :on-success="handleFileSuccess"
               :before-upload="handleBeforeUpload"
               :auto-upload="false"
+              :data="upload.data"
               drag
             >
               <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
@@ -82,7 +83,10 @@ const upload = reactive({
   isUploading: false,
   // 设置上传的请求头部
   headers: {
-    'Blade-Auth': inject('token'),
+    // 'Blade-Auth': inject('token'),
+  },
+  data: {
+    apiname: import.meta.env.VITE_API_NAME,
   },
   // 上传的地址
   url: '/business-model-api/api/blade-dcms/hazardouschemicalscatalog/parseBusinessScope',
@@ -102,7 +106,7 @@ watch(
 )
 const onDownload = () => {
   window.open(
-    'http://120.226.134.7:8100/cdn/xlsx/businessScopeImport.xlsx',
+    `/${import.meta.env.VITE_BASE}/file/许可范围导入模板.xlsx`,
     '_blank',
   )
 }

Plik diff jest za duży
+ 9 - 29
src/views/form/business-model/index.vue


+ 6 - 13
src/views/form/business-model/list.vue

@@ -80,14 +80,13 @@
 import {
   computed,
   getCurrentInstance,
-  inject,
   nextTick,
   onMounted,
   reactive,
   ref,
   watch,
 } from 'vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
+import { ElMessage } from 'element-plus'
 import { useDictionaryStore } from '@/stores'
 import axios from 'axios'
 
@@ -99,7 +98,6 @@ const props = defineProps({
   transfer: <any>{},
 })
 const state: any = reactive({
-  token: inject('token'),
   query: {
     loading: false,
     head: [
@@ -155,30 +153,25 @@ const onPage = (pageNum, pageSize) => {
     pageSize: pageSize,
   }
   const params = {
+    apiname: import.meta.env.VITE_API_NAME,
     current: state.query.page.pageNum,
     size: state.query.page.pageSize,
   }
-  const postParams = {}
   //  添加表单参数
   for (const [k, v] of Object.entries(state.query.formReal)) {
     if (proxy.$czrUtil.isValue(v)) {
-      postParams[k] = v
+      params[k] = v
     }
   }
   state.query.loading = true
   axios
     .post(
       '/business-model-api/api/blade-dcms/hazardouschemicalscatalog/page',
-      postParams,
-      {
-        params: params,
-        headers: {
-          'Blade-Auth': state.token,
-        },
-      },
+      params,
+      {},
     )
     .then((res: any) => {
-      if (res.data.code === 200) {
+      if (res.data.code == 0) {
         state.query.result.total = res.data.data.total
         state.query.result.data = res.data.data.records
         initTableSelected()

+ 17 - 31
src/views/form/business-model/text-import.vue

@@ -49,7 +49,6 @@ const props = defineProps({
 const state: any = reactive({
   loading: false,
   text: '',
-  token: inject('token'),
 })
 const ref_form = ref()
 watch(
@@ -70,42 +69,29 @@ const onSubmit = () => {
       axios
         .post(
           '/business-model-api/api/blade-dcms/hazardouschemicalscatalog/parseBusinessScopeStr',
-          state.text,
           {
-            headers: {
-              'Blade-Auth': state.token,
-              'Content-Type': 'text/plain', // 关键:告诉服务器这是纯文本
-            },
+            businessScope: state.text,
+            apiname: import.meta.env.VITE_API_NAME,
           },
+          {},
         )
         .then((res: any) => {
-          if (res.data.code === 200) {
-            if (res.data.data.success) {
-              ElMessageBox.confirm(
-                `成功导入 <span style="color: var(--czr-success-color)">${res.data.data.data.length}</span> 条数据!`,
-                '导入结果',
-                {
-                  dangerouslyUseHTMLString: true,
-                  showClose: false,
-                  showCancelButton: false,
-                },
-              ).then(() => {
-                if (res.data.code === 200) {
-                  if (res.data.data.success) {
-                    emit('update:show', false)
-                    emit('refresh', res.data.data.data)
-                  } else {
-                    ElMessage.error(res.data.data.errorMsg)
-                  }
-                } else {
-                  ElMessage.error(res.data.msg)
-                }
-              })
-            } else {
-              ElMessage.error(res.data.data.errorMsg)
-            }
+          if (res.data.code == 0) {
+            ElMessageBox.confirm(
+              `成功导入 <span style="color: var(--czr-success-color)">${res.data.data.length}</span> 条数据!`,
+              '导入结果',
+              {
+                dangerouslyUseHTMLString: true,
+                showClose: false,
+                showCancelButton: false,
+              },
+            ).then(() => {
+              emit('update:show', false)
+              emit('refresh', res.data.data)
+            })
           } else {
             ElMessage.error(res.data.msg)
+            state.loading = false
           }
         })
         .catch((e) => {

+ 1 - 1
vite.config.ts

@@ -57,7 +57,7 @@ export default defineConfig(({ mode, command }) => {
       strictPort: false,
       proxy: {
         '/business-model-api': {
-          target: 'http://120.226.134.7:8100/',
+          target: 'https://wssp.hainan.gov.cn/wForm/',
           changeOrigin: true,
           rewrite: (path) => {
             return path.replace(/^\/business-model-api/, '')