Bladeren bron

Fix: 导出401的问题

liqianyi 2 jaren geleden
bovenliggende
commit
7ca12614bf
2 gewijzigde bestanden met toevoegingen van 109 en 107 verwijderingen
  1. 106 106
      src/components/work-flow/node-edit.vue
  2. 3 1
      src/views/modules/warehouse/in-record.vue

+ 106 - 106
src/components/work-flow/node-edit.vue

@@ -384,28 +384,28 @@
 </template>
 
 <script>
-import { getWorkType } from "@/api/crafts";
-import { workTypeMasterList } from "@/api/worktype";
-import UploadComponent from "@/views/modules/common/upload-component";
+import { getWorkType } from '@/api/crafts'
+import { workTypeMasterList } from '@/api/worktype'
+import UploadComponent from '@/views/modules/common/upload-component'
 export default {
-  name: "nodeEdit",
+  name: 'nodeEdit',
   components: { UploadComponent },
   props: {
     data: {
       type: Object,
-      default: () => {},
+      default: () => {}
     },
     disabled: {
       type: Boolean,
-      default: false,
+      default: false
     },
     // 是否选择操作人,当选择操作人时,其他字段不可编辑
     selectOperator: {
       type: Boolean,
-      default: false,
-    },
+      default: false
+    }
   },
-  data() {
+  data () {
     return {
       // 工种列表
       workTypeOptions: [],
@@ -413,191 +413,191 @@ export default {
       operatorIdOptions: [],
       node: {},
       form: {
-        nodeName: "",
-        workTypeId: "",
+        nodeName: '',
+        workTypeId: '',
         operatorId: [],
-        prodProductionRequireList: [{}],
+        prodProductionRequireList: [{}]
       },
       fileList: [],
       inspectionMethodOptions: [
-        { value: "1", name: "游标卡尺" },
-        { value: "2", name: "千分尺" },
-        { value: "3", name: "高度尺" },
-        { value: "4", name: "百分表" },
-        { value: "5", name: "R规" },
-        { value: "6", name: "环规、塞规" },
-        { value: "7", name: "游标角度尺" },
-        { value: "8", name: "三坐标" },
-        { value: "9", name: "模具" },
-        { value: "10", name: "样板" },
-        { value: "11", name: "夹具" },
-        { value: "12", name: "目测" },
-        { value: "13", name: "组合测量" },
-        { value: "14", name: "精密测量" },
-        { value: "15", name: "敲击" },
-        { value: "16", name: "测厚仪" },
-        { value: "17", name: "其他" },
+        { value: '1', name: '游标卡尺' },
+        { value: '2', name: '千分尺' },
+        { value: '3', name: '高度尺' },
+        { value: '4', name: '百分表' },
+        { value: '5', name: 'R规' },
+        { value: '6', name: '环规、塞规' },
+        { value: '7', name: '游标角度尺' },
+        { value: '8', name: '三坐标' },
+        { value: '9', name: '模具' },
+        { value: '10', name: '样板' },
+        { value: '11', name: '夹具' },
+        { value: '12', name: '目测' },
+        { value: '13', name: '组合测量' },
+        { value: '14', name: '精密测量' },
+        { value: '15', name: '敲击' },
+        { value: '16', name: '测厚仪' },
+        { value: '17', name: '其他' }
       ],
       rules: {
         nodeName: [
-          { required: true, message: "请输入节点名称", trigger: "blur" },
+          { required: true, message: '请输入节点名称', trigger: 'blur' }
         ],
         workTypeId: [
-          { required: true, message: "请选择工种", trigger: "blur" },
+          { required: true, message: '请选择工种', trigger: 'blur' }
         ],
         operatorId: [
-          { required: true, message: "请选择操作人", trigger: "blur" },
+          { required: true, message: '请选择操作人', trigger: 'blur' }
         ],
         preTaskTime: [
-          { required: true, message: "请输入所需工时", trigger: "blur" },
+          { required: true, message: '请输入所需工时', trigger: 'blur' }
         ],
-        pageNo: [{ required: true, message: "请输入", trigger: "blur" }],
+        pageNo: [{ required: true, message: '请输入', trigger: 'blur' }],
         inspectionParam: [
-          { required: true, message: "请输入", trigger: "blur" },
+          { required: true, message: '请输入', trigger: 'blur' }
         ],
         inspectionMethod: [
-          { required: true, message: "请选择", trigger: "blur" },
+          { required: true, message: '请选择', trigger: 'blur' }
         ],
-        allowValues: [{ required: true, message: "请输入", trigger: "blur" }],
-      },
-    };
+        allowValues: [{ required: true, message: '请输入', trigger: 'blur' }]
+      }
+    }
   },
   watch: {
-    data(val) {
-      this.node = val;
+    data (val) {
+      this.node = val
       this.form = {
         ...this.form,
-        ...this.node,
-      };
+        ...this.node
+      }
       if (this.node.operatorId) {
-        this.form.operatorId = this.node.operatorId.split(",");
+        this.form.operatorId = this.node.operatorId.split(',')
       }
 
       // 附件
       if (this.node.attachList) {
         this.$nextTick(() => {
-          this.fileList = [];
+          this.fileList = []
           this.node.attachList.forEach((item) => {
             this.fileList.push({
               name: item.fileName,
               url: item.url,
-              id: item.url,
-            });
-          });
-        });
+              id: item.url
+            })
+          })
+        })
       }
     },
-    disabled(val) {
-      this.disabled = val;
-    },
+    disabled (val) {
+      this.disabled = val
+    }
   },
-  activated() {},
-  created() {
-    this.getWorkTypeOptions();
+  activated () {},
+  created () {
+    this.getWorkTypeOptions()
   },
   computed: {},
-  mounted() {
-    this.node = this.data;
+  mounted () {
+    this.node = this.data
     this.form = {
       ...this.form,
-      ...this.node,
-    };
+      ...this.node
+    }
     if (this.node.operatorId) {
-      this.form.operatorId = this.node.operatorId.split(",");
+      this.form.operatorId = this.node.operatorId.split(',')
     }
 
     // 附件
     if (this.node.attachList) {
-      this.fileList = [];
+      this.fileList = []
       this.node.attachList.forEach((item) => {
         this.fileList.push({
           name: item.fileName,
           url: item.url,
-          id: item.url,
-        });
-      });
+          id: item.url
+        })
+      })
     }
-    this.getOperatorList();
+    this.getOperatorList()
   },
   methods: {
-    getWorkTypeOptions() {
-      this.workTypeOptions = [];
+    getWorkTypeOptions () {
+      this.workTypeOptions = []
       getWorkType().then(({ data }) => {
-        if (data && data.code === "200") {
-          this.workTypeOptions = data.data;
+        if (data && data.code === '200') {
+          this.workTypeOptions = data.data
         }
-      });
+      })
     },
-    onChage(val) {
+    onChage (val) {
       this.workTypeOptions.forEach((v) => {
         if (v.typeId === val) {
-          this.form.quotedPrice = Number(v.quotedPrice || 0).toFixed(2);
+          this.form.quotedPrice = Number(v.quotedPrice || 0).toFixed(2)
         }
-      });
+      })
     },
     // 按工种ID查询操作人列表
-    getOperatorList() {
+    getOperatorList () {
       if (this.node.workTypeId) {
         workTypeMasterList(this.node.workTypeId).then(({ data }) => {
-          if (data && data.code === "200") {
-            this.operatorIdOptions = [];
+          if (data && data.code === '200') {
+            this.operatorIdOptions = []
             data.data.forEach((item) => {
-              this.operatorIdOptions.push(item);
-            });
+              this.operatorIdOptions.push(item)
+            })
           }
-        });
+        })
       }
     },
-    uploadSuccess(fileList) {
-      this.fileList = fileList;
+    uploadSuccess (fileList) {
+      this.fileList = fileList
     },
     // 校验表单
-    validateFormData() {
+    validateFormData () {
       return new Promise((resolve, reject) => {
-        this.$refs["form"].validate((valid) => {
+        this.$refs['form'].validate((valid) => {
           if (!valid) {
             // eslint-disable-next-line prefer-promise-reject-errors
-            reject();
-            return;
+            reject()
+            return
           }
-          resolve();
-        });
-      });
+          resolve()
+        })
+      })
     },
     // 获取表单数据
-    formData() {
-      const form = { ...this.form, operatorName: "" };
+    formData () {
+      const form = { ...this.form, operatorName: '' }
       if (this.form.operatorId != null) {
-        form.operatorId = this.form.operatorId.toString();
+        form.operatorId = this.form.operatorId.toString()
         this.form.operatorId.forEach((id) => {
-          let op = this.operatorIdOptions.find((t) => t.userId === id);
+          let op = this.operatorIdOptions.find((t) => t.userId === id)
           if (op.name != null) {
-            form.operatorName += op.name + " ";
+            form.operatorName += op.name + ' '
           }
-        });
+        })
       }
 
       // 填充附件
-      let fList = this.fileList;
+      let fList = this.fileList
       if (fList.length > 0) {
-        form.attachList = [];
+        form.attachList = []
         for (let i = 0; i < fList.length; i++) {
           form.attachList.push({
             fileName: fList[i].name,
-            url: fList[i].url,
-          });
+            url: fList[i].url
+          })
         }
       }
-      return form;
+      return form
     },
 
-    addRow() {
-      this.form.prodProductionRequireList.push({});
+    addRow () {
+      this.form.prodProductionRequireList.push({})
     },
-    removeRow(index) {
-      this.form.prodProductionRequireList.splice(index, 1);
-    },
-  },
-};
+    removeRow (index) {
+      this.form.prodProductionRequireList.splice(index, 1)
+    }
+  }
+}
 </script>
 <style scoped></style>

+ 3 - 1
src/views/modules/warehouse/in-record.vue

@@ -161,6 +161,7 @@
   import UserComponent from '../common/user-component'
   import { getRecordList } from '@/api/warehouse'
   import { getFirstDayOfMonth, getCurrentDay } from '@/api/util'
+  import Vue from 'vue'
 export default {
     name: 'stock-order',
     components: {UserComponent},
@@ -251,7 +252,8 @@ export default {
         }
         let url = this.$http.adornUrl('/biz-service/inbound-record-ctl/exportExcel') +
           '?recordType=' + params.recordType +
-          '&beginTime=' + encodeURIComponent(params.beginTime) + '&endTime=' + encodeURIComponent(params.endTime)
+          '&beginTime=' + encodeURIComponent(params.beginTime) + '&endTime=' + encodeURIComponent(params.endTime) +
+          '&_token=' + Vue.cookie.get('token')
         window.open(url, '_blank')
       },
       // 申请单类型