Procházet zdrojové kódy

1、完善上传附件

zhoux před 2 roky
rodič
revize
033f0fc18f

+ 4 - 3
.env.dev

@@ -2,12 +2,13 @@ NODE_ENV = 'development'
 VUE_APP_BUILD_TYPE='dev'
 VUE_APP_SERVER_URL='http://192.168.0.57:7001'
 # VUE_APP_SERVER_URL='https://s.dev01.dkiboss.com:6010/api'
-VUE_APP_UPLOAD_URL='https://s.dev01.dkiboss.com:6010/api/mdm-server/file/upload'
+# VUE_APP_UPLOAD_URL='https://s.dev01.dkiboss.com:6010/api/mdm-server/file/upload'
+VUE_APP_UPLOAD_URL='https://s.dev01.dkiboss.com:7000/api/mdm-server/file/upload'
+# VUE_APP_IMG_URL='https://s.dev01.dkiboss.com:6010/file'
+VUE_APP_IMG_URL='https://s.dev01.dkiboss.com:7000/file'
 VUE_APP_EXPORT_URL='http://localhost:5000/'
 VUE_APP_EXPORT_SQL_URL='http://s.dev01.dkiboss.com:6010/custom-report-sql.sql'
 VUE_APP_LOGS_URL='https://ibossmp.dongkesoft.com:7050/logs'
-VUE_APP_IMG_URL='https://s.dev01.dkiboss.com:6010/file'
-VUE_APP_HG_IMG_URL='https://haip-dev.oss-cn-shenzhen.aliyuncs.com/'
 VUE_APP_WEBSOCKET_URL='ws://localhost:1015/websocket/'
 VUE_APP_LOGIN_PAGE_NAME=["login"]
 VUE_APP_LOGIN_TYPE=0

+ 1 - 1
.env.test

@@ -1,6 +1,6 @@
 NODE_ENV='production'
 VUE_APP_BUILD_TYPE='test'
-VUE_APP_SERVER_URL='https://s.dev01.dkiboss.com:6010/api'
+VUE_APP_SERVER_URL='https://s.dev01.dkiboss.com:7000/api'
 VUE_APP_EXPORT_URL='https://s.dev01.dkiboss.com:6010/excel/'
 VUE_APP_EXPORT_SQL_URL='https://s.dev01.dkiboss.com:6010/custom-report-sql.sql'
 VUE_APP_UPLOAD_URL='https://s.dev01.dkiboss.com:6010/api/mdm-server/file/upload'

+ 60 - 40
src/components/base/dk-pic-wall/dk-pic-wall.vue

@@ -17,8 +17,8 @@
         type="drag"
         :max-size="$config.uploadFileConfig.maxSize"
         :multiple="multiple"
-        :action="$config.uploadUrl"
-        :data="{'folder':folder}"
+        :action="uploadUrl"
+        :data="{'folder':folderData}"
         :before-upload="beforeUpload">
         <div style="width: 120px;height:120px;line-height: 120px;">
           <Icon type="ios-camera" size="32"/>
@@ -45,11 +45,11 @@
                   style="cursor: pointer;line-height: 120px;font-size: 40px;opacity: 0;color: #fff;" type="md-eye"/>
             <div v-if="item.type!='img' && item.type!='video'" class="other">
               <Icon type="md-document" size="30"/>
-              <a @click="openOther(item)">{{item.name}}</a>
+              <a @click="openOther(item)">{{ item.name }}</a>
             </div>
           </div>
           <div v-if="!onlyShow"
-            style="width: 240px;height:50px;background-color: #00000096;transform: rotate(45deg);margin-top: -20px;"></div>
+               style="width: 240px;height:50px;background-color: #00000096;transform: rotate(45deg);margin-top: -20px;"></div>
           <Icon type="md-close" @click="delItem(index,1)" v-if="!onlyShow"
                 style="font-size:20px;color: white;position: absolute;right: 0;top:0;cursor: pointer;"/>
         </div>
@@ -61,17 +61,21 @@
       okText="下载"
       cancelText="关闭"
       :title="currentItem.name">
-      <video :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path" autoplay controls v-if="currentItem.type=='video'"
+      <video :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path" autoplay controls
+             v-if="currentItem.type=='video'"
              style="width: 480px;height:320px;"></video>
-      <img :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path" v-if="currentItem.type=='img'" style="width: 480px;"/>
+      <img :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path"
+           v-if="currentItem.type=='img'" style="width: 480px;"/>
     </Modal>
   </div>
 </template>
 
 <script>
+import store from "@/store";
+
 export default {
   name: 'DkPicWall',
-  model:{
+  model: {
     prop: "uploadListOuter", // 这个字段,是指父组件设置 v-model 时,将变量值传给子组件的 msg
     event: "update" // 这个字段,是指父组件监听 parent-event 事件
   },
@@ -81,9 +85,9 @@ export default {
       default: () => [],
     },
     // 是否禁用
-    disabled:{
-      type:Boolean,
-      default:false
+    disabled: {
+      type: Boolean,
+      default: false
     },
     // 是否上传多个
     multiple: {
@@ -107,28 +111,43 @@ export default {
     format: {
       type: Array
     },
+    // 表名
+    table: {
+      type: String
+    }
   },
   data() {
+    let self = this
     return {
+      uploadUrl: self.$config.uploadUrl,
       videoSrc: '',
       currentItem: {},
       modalFlag: false,
       goodsCode: null,
       dragIndex: null,
-      uploadListInner:this.uploadListOuter,
+      uploadListInner: this.uploadListOuter,
+      // 配置存放的文件夹 公司code - 表名 - 年月 -- 日
+      folderData: self.$store.state.user.cpCode + '/' + self.table + '/' + new Date().toYearMonth2() + '/' + new Date().toDay(),
     }
   },
   created() {
     // this.uploadListInner=this.uploadListOuter;
+    if (store.state.user.svcCode) {
+      this.uploadUrl = this.uploadUrl.replace('mdm-server', 'mdm-server' + '-' + store.state.user.svcCode.replace('_', '-'))
+    }
   },
+  // computed:{
+  //   folderData()
+  // },
   watch: {
     // 监听uploadList变化
     uploadListInner(n, o) {
+      console.log('tt',this.uploadListInner)
       this.$emit("update", this.uploadListInner);
 
     },
-    uploadListOuter(n, o){
-      this.uploadListInner=this.uploadListOuter;
+    uploadListOuter(n, o) {
+      this.uploadListInner = this.uploadListOuter;
     }
   },
   methods: {
@@ -138,7 +157,7 @@ export default {
      * @date   : 2022-5-25 19:20
      */
     beforeUpload(file) {
-      if (!this.accept && !(this.$config.uploadFileConfig.acceptPicType+','+this.$config.uploadFileConfig.acceptVideoType).split(',').includes(file.type)) {
+      if (!this.accept && !(this.$config.uploadFileConfig.acceptPicType + ',' + this.$config.uploadFileConfig.acceptVideoType).split(',').includes(file.type)) {
         this.$Message.warning('图片格式不在允许的范围内')
         return false
       }
@@ -155,26 +174,28 @@ export default {
     uploadSuccess(res, file) {
       if (res.code == 200 && res.data) {
         if (!this.multiple) {
-          this.uploadListInner = [
-            {
-              'type': this.getFileType(res.data),
-              'path': res.data,
-              'name': file.name,
-              'createTime': new Date().format()
-            }
-          ]
+          // this.uploadListInner = [
+          //   {
+          //     'type': this.getFileType(res.data),
+          //     'path': res.data,
+          //     'name': file.name,
+          //     'createTime': new Date().format()
+          //   }
+          // ]
+          this.uploadListInner = [...res.data]
         } else {
-          if (!this.uploadListInner){
+          if (!this.uploadListInner) {
             this.uploadListInner = []
           }
-          this.uploadListInner.push(
-            {
-              'type': this.getFileType(res.data),
-              'path': res.data,
-              'name': file.name,
-              'createTime': new Date().format()
-            }
-          )
+          this.uploadListInner.push(res.data)
+          // this.uploadListInner.push(
+          //   {
+          //     'type': this.getFileType(res.data),
+          //     'path': res.data,
+          //     'name': file.name,
+          //     'createTime': new Date().format()
+          //   }
+          // )
         }
       } else {
         this.$Message.warning(res.message)
@@ -206,7 +227,7 @@ export default {
     },
     fullScreenShow() {
       // window.location.href = this.currentItem.path
-      window.open(this.currentItem.fullPath ? this.currentItem.fullPath : this.$config.imgUrl+this.currentItem.path)
+      window.open(this.currentItem.fullPath ? this.currentItem.fullPath : this.$config.imgUrl + this.currentItem.path)
     },
     openModal(item) {
 
@@ -218,7 +239,7 @@ export default {
      * @author : 洪旭东
      * @date   : 2022-07-21 19:59
      */
-    openOther(item){
+    openOther(item) {
       window.open(this.$config.imgUrl + item.path)
     },
     getVideoBase64(list, returnList) {
@@ -240,7 +261,7 @@ export default {
 // 创建一个video节点
             const video = document.createElement('video')
 //               const video = document.getElementById('video-haha')
-            video.setAttribute('src', this.$config.imgUrl+tlist[0].path)
+            video.setAttribute('src', this.$config.imgUrl + tlist[0].path)
             video.setAttribute('crossOrigin', 'anonymous')
             // video.preload = 'preload'
             video.crossOrigin = 'anonymous'
@@ -274,10 +295,10 @@ export default {
     allowDropIn(e, i) {
       // console.log('this.dragIndex',i)
     },
-    drop(index){
-      let arr =this.uploadListInner;
-      [arr[this.dragIndex],arr[index]]=[arr[index],arr[this.dragIndex]];//es6解构赋值,交换元素位置
-      this.uploadListInner=[...arr];
+    drop(index) {
+      let arr = this.uploadListInner;
+      [arr[this.dragIndex], arr[index]] = [arr[index], arr[this.dragIndex]];//es6解构赋值,交换元素位置
+      this.uploadListInner = [...arr];
     },
     handleDragStart(e) {
       this.dragIndex = e
@@ -323,8 +344,7 @@ export default {
         return value2 - value1
       }
     },
-
-  }
+  },
 }
 </script>
 

+ 28 - 1
src/config/index.js

@@ -292,6 +292,33 @@ export default {
     tab: 'tab'
   },
   /**
+   * @desc   : 表名
+   * @author : 周兴
+   * @date   : 2024/3/27 10:07
+   */
+  tables:{
+    // 销售订单
+    order:'t_psi_order',
+    // 采购订单
+    purchase:'t_psi_purchase',
+    // 出库单
+    outbound:'t_psi_outbound',
+    // 入库单
+    inbound:'t_psi_inbound',
+    // 库存盘点
+    check:'t_psi_check',
+    // 库存调整
+    transfer:'t_psi_transfer',
+    // 资金转账
+    macTransfer:'t_mac_transfer',
+    // 收付款单
+    recPay:'t_mac_rec_pay',
+    // 其他收入单
+    income:'t_mac_income',
+    // 其他支出单
+    outlay:'t_mac_outlay',
+  },
+  /**
    *   @desc   : 在产盘点盘点状态
    *   @date   : 2023/3/24 13:12
    *   @author : 寇珊珊
@@ -832,7 +859,7 @@ export default {
   },
 
   uploadFileConfig: {
-    maxSize: 2048,//图片大小的最大值 2MB 2048kb
+    maxSize: 10240,//图片大小的最大值 10MB 10240kb
     acceptPicType: 'image/png,image/jpeg,image/jpg',// 接受上传的图片类型
     acceptVideoType: 'video/mp4,video/avi,video/mov',// 接受上传的视频类型
     acceptExcel: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel ',

+ 2 - 1
src/libs/base/api.request.js

@@ -1,5 +1,6 @@
 import HttpRequest from '@/libs/base/axios'
 import config from '@/config'
+import store from "@/store";
 
 
 let baseUrl = '';
@@ -7,7 +8,7 @@ let baseUrl = '';
 // console.log('==============当前环境:'+process.env.VUE_APP_BUILD_TYPE+'===============')
   baseUrl = process.env.VUE_APP_SERVER_URL;
   config.serviceUrl = process.env.VUE_APP_SERVER_URL
-  // config.imgUrl =process.env.VUE_APP_IMG_URL;
+  config.imgUrl =process.env.VUE_APP_IMG_URL;
   // config.hgImgUrl = process.env.VUE_APP_HG_IMG_URL;
   config.uploadUrl = process.env.VUE_APP_UPLOAD_URL;
   config.exportUrl = process.env.VUE_APP_EXPORT_URL;

+ 9 - 0
src/libs/tools/date-tools.js

@@ -79,6 +79,15 @@ Date.prototype.toYearMonth2 = function () {
 }
 
 /**
+ * @desc   : 获取当前日期
+ * @author : 周兴
+ * @date   : 2024/3/27 10:59
+ */
+Date.prototype.toDay = function () {
+  return this.format('dd')
+}
+
+/**
  * @desc   : 获得星期
  * @author : 周兴
  * @date   : 2022/11/16 17:16

+ 1 - 1
src/view/ivt/entry-handle/form.vue

@@ -114,7 +114,7 @@
         <div id="search-cond-div-files-info" ref="search-cond-div-files-info"
              slot="content">
           <DkPicWall v-model="formData.annexPaths" :disabled="this.allCanNoEdit?true:false"
-                     folder="t_order_entry/annex_paths" :accept="$config.uploadFileConfig.acceptPicType"
+                     :table="$config.tables.inbound" :accept="$config.uploadFileConfig.acceptPicType"
                      :format="['jpg','jpeg','png']"></DkPicWall>
         </div>
       </DkPanel>

+ 1 - 1
src/view/sale/order/form.vue

@@ -183,7 +183,7 @@
       <DkPanel prop="files">
         <div id="search-cond-div-files-info" ref="search-cond-div-files-info" slot="content">
           <DkPicWall v-model="formData.annexPaths"
-                     folder="t_order/annex_paths" :accept="$config.uploadFileConfig.acceptPicType"
+                     :table="$config.tables.order" :accept="$config.uploadFileConfig.acceptPicType"
                      :format="['jpg','jpeg','png']"></DkPicWall>
         </div>
       </DkPanel>