Jelajahi Sumber

去除导入功能地址中的prod-api前缀

liling 1 tahun lalu
induk
melakukan
4c1f623472

+ 8 - 2
src/utils/request.js

@@ -100,9 +100,15 @@ service.interceptors.response.use(
   error => {
   error => {
     console.log(error) // for debug
     console.log(error) // for debug
     console.log('request.js err.response=', error.response) // for debug
     console.log('request.js err.response=', error.response) // for debug
-    // error.response.data.message = error.response.data.message || '未知错误'
+    let errmsg = error.response.data.message || '未知错误'
+    if (error.toString().indexOf('Network') > -1) {
+      errmsg = '网络请求失败'
+    } else if (error.toString().indexOf('timeout') > -1) {
+      errmsg = '网络请求超时'
+    }
+    error.response.data.message = errmsg
     Message({
     Message({
-      message: error.toString().indexOf('Network') > -1 ? '网络请求失败' : '' + error.response.data.message,
+      message: errmsg,
       type: 'error',
       type: 'error',
       duration: 3 * 1000,
       duration: 3 * 1000,
       offset: window.screen.height / 3
       offset: window.screen.height / 3

+ 7 - 5
src/views/device/components/ModelFormCommandOpt104.vue

@@ -82,6 +82,7 @@
             placeholder="请输入"
             placeholder="请输入"
             type="number"
             type="number"
             maxlength="5"
             maxlength="5"
+            oninput="if(value.length>5)value=value.slice(0,5)"
             :disabled="inputvalueFlag"
             :disabled="inputvalueFlag"
             style="width:180px;margin-right: 2rem;"
             style="width:180px;margin-right: 2rem;"
           />
           />
@@ -100,13 +101,13 @@
         <div style="border: 1px solid #ccc;padding: 3rem 5rem;">
         <div style="border: 1px solid #ccc;padding: 3rem 5rem;">
           <div style="margin: 2rem 0;">
           <div style="margin: 2rem 0;">
             <el-button
             <el-button
-              style="padding: 1rem 5rem;"
+              style="padding: 1rem 4rem;"
               type="primary"
               type="primary"
-              :class="yaoTiaoCommnad.result===1 ? dark-button:''"
+              class="dark-button"
               size="big"
               size="big"
-              :disabled="yaoTiaoCommnad.result!==1"
+              :disabled="yaoTiaoCommnad.result!==-1"
               @click="commitYaoTiaoExecute"
               @click="commitYaoTiaoExecute"
-            >执行</el-button>
+            >遥调执行</el-button>
           </div>
           </div>
           <div style="margin: 2rem 0;">
           <div style="margin: 2rem 0;">
             <el-button
             <el-button
@@ -419,7 +420,7 @@ export default {
       }
       }
       this.yaoTiaoCommnad.result2 = 0
       this.yaoTiaoCommnad.result2 = 0
       this.yaoTiaoCommnad.result2Text = '执行中'
       this.yaoTiaoCommnad.result2Text = '执行中'
-      this.yaoTiaoCommnad.result = -1
+      this.yaoTiaoCommnad.result = 0
       // this.inputvalueFlag = true
       // this.inputvalueFlag = true
       var urlencoded = new URLSearchParams()
       var urlencoded = new URLSearchParams()
       urlencoded.append('stage', 'execute')
       urlencoded.append('stage', 'execute')
@@ -427,6 +428,7 @@ export default {
       urlencoded.append('value', v)
       urlencoded.append('value', v)
       postData(`/iec104/master/${this.modelParames.curPlanId}/normalized`, urlencoded).then((res) => {
       postData(`/iec104/master/${this.modelParames.curPlanId}/normalized`, urlencoded).then((res) => {
         // 操作成功
         // 操作成功
+        this.yaoTiaoCommnad.result = -1
         this.inputvalueFlag = false
         this.inputvalueFlag = false
         this.yaoTiaoCommnad.result2 = 1
         this.yaoTiaoCommnad.result2 = 1
         this.yaoTiaoCommnad.result2Text = '执行成功!'
         this.yaoTiaoCommnad.result2Text = '执行成功!'

+ 3 - 0
src/views/device/components/ModelFormFileTransferOpt104.vue

@@ -57,6 +57,7 @@
                           :show-file-list="false"
                           :show-file-list="false"
                           :auto-upload="true"
                           :auto-upload="true"
                           accept="*"
                           accept="*"
+                          :data="{filename:uploadFileName}"
                           :disabled="isUploadFileIng"
                           :disabled="isUploadFileIng"
                           :headers="uplaodHeader"
                           :headers="uplaodHeader"
                           :before-upload="(file) => updateActionUrl2(file,scope.row.id)"
                           :before-upload="(file) => updateActionUrl2(file,scope.row.id)"
@@ -174,6 +175,7 @@ export default {
       getFileDir: '/', // 拉取文件的目录名称
       getFileDir: '/', // 拉取文件的目录名称
       uploadFileUrl: '', // 文件上传地址
       uploadFileUrl: '', // 文件上传地址
       fid: '',
       fid: '',
+      uploadFileName: '', // 上传的文件名称
       uploadSize: 0, // 上传文件的大小
       uploadSize: 0, // 上传文件的大小
       isUploadFileIng: false, // 文件是否在上传中
       isUploadFileIng: false, // 文件是否在上传中
       isSendFileId: 0, // 文件是不是正在下发中
       isSendFileId: 0, // 文件是不是正在下发中
@@ -330,6 +332,7 @@ export default {
     updateActionUrl2(obj, id) {
     updateActionUrl2(obj, id) {
       return new Promise((r) => {
       return new Promise((r) => {
         this.$nextTick(() => {
         this.$nextTick(() => {
+          this.uploadFileName = obj.name
           this.uploadFileUrl = '/test/file/' + id + '/bytes' // 文件上传地址
           this.uploadFileUrl = '/test/file/' + id + '/bytes' // 文件上传地址
           r()
           r()
         })
         })

+ 1 - 2
src/views/device/tables/Sample.vue

@@ -221,10 +221,9 @@ export default {
   //   }
   //   }
   // },
   // },
   created() {
   created() {
-    const envUrl = process.env.VUE_APP_BASE_API
     // 网页加载完成后执行
     // 网页加载完成后执行
     // 接口 导入测点 /test/plan/:plan/points.csv
     // 接口 导入测点 /test/plan/:plan/points.csv
-    this.importCsvActionStr = envUrl + `/test/plan/${this.componentParames.curPlanId}/points.csv`
+    this.importCsvActionStr = `/test/plan/${this.componentParames.curPlanId}/points.csv`
     // console.log('this.importCsvActionStr=', this.importCsvActionStr)
     // console.log('this.importCsvActionStr=', this.importCsvActionStr)
     // 在bus上挂载刷新事件
     // 在bus上挂载刷新事件
     EventBus.$on('refreshManualSample', this.refreshManual)
     EventBus.$on('refreshManualSample', this.refreshManual)

+ 0 - 1
src/views/plan/components/PlanCheckPoint.vue

@@ -427,7 +427,6 @@ export default {
   },
   },
   mounted() {
   mounted() {
     this.$nextTick(() => {
     this.$nextTick(() => {
-      // const envUrl = process.env.VUE_APP_BASE_API
       // 网页加载完成后执行
       // 网页加载完成后执行
       this.importCsvActionStr = `/product/model/0/models.csv`
       this.importCsvActionStr = `/product/model/0/models.csv`
       if (this.currentPlanData.id > 0) {
       if (this.currentPlanData.id > 0) {

+ 2 - 3
src/views/plan/components/PlanCheckPoint_master104.vue

@@ -361,13 +361,12 @@ export default {
   },
   },
   mounted() {
   mounted() {
     this.$nextTick(() => {
     this.$nextTick(() => {
-      const envUrl = process.env.VUE_APP_BASE_API
       // 网页加载完成后执行
       // 网页加载完成后执行
-      this.importCsvActionStr = envUrl + `/product/model/0/models.csv`
+      this.importCsvActionStr = `/product/model/0/models.csv`
       if (this.currentPlanData.id > 0) {
       if (this.currentPlanData.id > 0) {
         // 如果获取到了PlanId再加载详细信息
         // 如果获取到了PlanId再加载详细信息
         this.getPlanCheckPoint()
         this.getPlanCheckPoint()
-        this.importCsvActionStr = envUrl + `/product/model/${this.currentPlanData.product}/models.csv`
+        this.importCsvActionStr = `/product/model/${this.currentPlanData.product}/models.csv`
       }
       }
       this.initFunctions()
       this.initFunctions()
     })
     })

+ 1 - 2
src/views/system/components/TempList.vue

@@ -124,9 +124,8 @@ export default {
     // 点击上传文件按钮事件
     // 点击上传文件按钮事件
     updataUsers(row) {
     updataUsers(row) {
       // console.log('upDatarow =', row)
       // console.log('upDatarow =', row)
-      const envUrl = process.env.VUE_APP_BASE_API
       const thisProductType = this.protocolOptions.find(par => par.name === row.name)
       const thisProductType = this.protocolOptions.find(par => par.name === row.name)
-      this.importCsvActionStr = envUrl + `/product/type/${thisProductType.id}/report.docx`
+      this.importCsvActionStr = `/product/type/${thisProductType.id}/report.docx`
     },
     },
     // 导入
     // 导入
     submitUpload() {
     submitUpload() {