wucl пре 2 година
родитељ
комит
25b7c3faae
2 измењених фајлова са 16 додато и 6 уклоњено
  1. 2 2
      .env.test
  2. 14 4
      src/views/item/detail.vue

+ 2 - 2
.env.test

@@ -1,4 +1,4 @@
-NODE_ENV = production
+NODE_ENV = test
 
 # just a flag
 ENV = 'staging'
@@ -6,5 +6,5 @@ ENV = 'staging'
 # base api
 VUE_APP_BASE_API = '/api/'
 VUE_APP_BASE_API2 = '/api'
-VUE_APP_BASE_WEB = '/admin'
+VUE_APP_BASE_WEB = '/admin-test'
 

+ 14 - 4
src/views/item/detail.vue

@@ -365,8 +365,7 @@
         this.$api.customer.simpleAll().then(res => {
           this.customerOptions = res.data
         })
-      },
-      handleAttachmentPreview(file){
+      }, handleAttachmentPreview(file){
         window.open(file.url)
       },
       handleExceed(files, fileList) {
@@ -375,9 +374,7 @@
       // 上传
       changeres(res, file) {
         if (res.code === 200){
-          const date = new Date();
           this.postForm.contractUrl = res.data.url;
-          this.postForm.uploadDate = date.getFullYear() + "-" + (this.getZero(date.getMonth() + 1)) + "-" + this.getZero((date.getDate()));
           const arr = res.data.url.split("-");
           this.contractName = arr[1];
         }else {
@@ -405,6 +402,13 @@
         }
         this.postForm.oaNo = null;
       },
+      getZero(num) {
+        // 单数前面加0
+        if (parseInt(num) < 10) {
+          num = '0' + num;
+        }
+        return num;
+      },
       getAllUser() {
         const that = this;
         that.$api.user.simpleAll().then(data => {
@@ -454,6 +458,12 @@
           });
           return;
         }
+        if (this.postForm.contractUrl){
+          const date = new Date();
+          this.postForm.uploadDate = date.getFullYear() + "-" + (this.getZero(date.getMonth() + 1)) + "-" + this.getZero((date.getDate()));
+        }else {
+          this.postForm.uploadDate = null;
+        }
         this.$refs.postForm.validate(valid => {
           if (valid) {
             if (this.dataId) {