فهرست منبع

Merge branch 'deploy_0804' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into deploy_0804

lilei 3 سال پیش
والد
کامیت
2693e171bb
4فایلهای تغییر یافته به همراه48 افزوده شده و 13 حذف شده
  1. 9 0
      src/api/sales.js
  2. 1 2
      src/components/UploadFile/index.vue
  3. 7 1
      src/components/custom.less
  4. 31 10
      src/views/salesManagement/salesQuery/queryPart.vue

+ 9 - 0
src/api/sales.js

@@ -156,3 +156,12 @@ export const salesExport = params => {
     responseType: 'blob'
   })
 }
+// 车架号  识别图片内容
+export const vinCodeParse = params => {
+  return axios.request({
+    url: `/vinCode/parse`,
+    method: 'post',
+    data: params,
+    responseType: 'blob'
+  })
+}

+ 1 - 2
src/components/UploadFile/index.vue

@@ -16,8 +16,7 @@
         <div class="ant-upload-text"> {{ upText }}</div>
       </div>
       <div v-if="fileList.length < maxNums && listType!='picture-card'">
-        <a-icon type="camera" :style="{ fontSize: '18px', verticalAlign: 'bottom' }" />
-        <!-- <a-button> <a-icon type="upload" /> {{ upText }} </a-button> -->
+        <a-button> <a-icon type="upload" /> {{ upText }} </a-button>
       </div>
     </a-upload>
     <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">

+ 7 - 1
src/components/custom.less

@@ -29,7 +29,13 @@ body{
       }
     }
   }
-  .form-model-con{  // a-form-model  有必选条件(因校验提示信息原因,因此边距需高于无必选条件边距)
+  .form-model-con.ant-form.ant-form-inline{  // a-form-model  有必选条件(因校验提示信息原因,因此边距需高于无必选条件边距)
+    // .ant-form-item {
+    //   margin-bottom: 16px!important;
+    //   .ant-form-explain{
+    //     font-size: 12px;
+    //   }
+    // }
     .ant-form-item {
       margin-bottom: 16px!important;
       .ant-form-explain{

+ 31 - 10
src/views/salesManagement/salesQuery/queryPart.vue

@@ -13,8 +13,9 @@
           <a-col :md="7" :sm="24">
             <a-form-model-item label="车架号(VIN)" prop="vinNo">
               <a-input id="productInfoList-vinNo" v-model.trim="queryParam.vinNo" @change="vinNoChange" allowClear placeholder="请输入车架号(VIN)">
-                <Upload slot="addonAfter" class="upload" v-model="queryParam.vinNoMsg" ref="vinNoMsg" @change="handleCamera"></Upload>
+                <a-icon @click="uploadFun" type="camera" slot="addonAfter" :style="{ fontSize: '18px', verticalAlign: 'bottom' }" />
               </a-input>
+              <input type="file" id="filed" hidden="" @change="filePreview">
             </a-form-model-item>
           </a-col>
           <a-col :md="6" :sm="24">
@@ -61,11 +62,6 @@
                 </a-select>
               </a-form-model-item>
             </a-col>
-            <!-- <a-col :md="6" :sm="24">
-              <a-form-item label="车型">
-                <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择车型"></v-select>
-              </a-form-item>
-            </a-col> -->
             <a-col :md="5" :sm="24">
               <a-form-model-item label="仓库">
                 <a-select
@@ -182,7 +178,7 @@ import { querySumByProductLocation } from '@/api/stock'
 import { warehouseAllList } from '@/api/warehouse'
 import productSalesRecordModal from './productSalesRecordModal.vue'
 import { STable, VSelect, Upload } from '@/components'
-import { supperCodeByVin } from '@/api/sales'
+import { supperCodeByVin, vinCodeParse } from '@/api/sales'
 export default {
   name: 'QueryPart',
   components: { STable, VSelect, Upload, productSalesRecordModal },
@@ -392,9 +388,34 @@ export default {
     closeModal () {
       this.openModal = false
     },
-    // VIN码上传图片
-    handleCamera (file) {
-      console.log(file)
+    uploadFun () {
+      document.getElementById('filed').click()
+    },
+    filePreview (e) {
+      const _this = this
+      var files = e.target.files[0]
+      const formData = new FormData()
+      formData.append('savePathType', 'local')
+      formData.append('file', files)
+      vinCodeParse(formData).then(res => {
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            if (obj.status == 200) {
+              _this.queryParam.vinNo = obj.data || ''
+              // 移除表单项的校验结果
+              _this.$refs.ruleForm.clearValidate('vinNo')
+            } else {
+              _this.$notification.error({
+                message: '提示',
+                description: obj.message
+              })
+            }
+          })
+          reader.readAsText(res)
+        }
+      })
     },
     // 仓库
     getWarehouse () {