Browse Source

修改bug

chenrui 11 months ago
parent
commit
85f30ff607

+ 35 - 0
src/api/purchase.js

@@ -157,3 +157,38 @@ export const purchaseImportBatchInsert = (params) => {
     }
   })
 }
+
+// 采购入库 审核
+export const purchaseAudit = (params) => {
+  return axios({
+    url: '/purchase/audit',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('审核')
+    }
+  })
+}
+
+// 采购入库 上传凭证
+export const saveAttachment = (params) => {
+  return axios({
+    url: '/purchase/saveAttachment',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('上传凭证')
+    }
+  })
+}
+// 采购入库  轮胎唯一码
+export const traceCodeTraceCode = (params) => {
+  return axios({
+    url: '/purchase/traceCode/traceCode',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('查看唯一码')
+    }
+  })
+}

+ 6 - 4
src/components/UploadFile/index.vue

@@ -179,10 +179,12 @@ export default {
         }
         this.previewVisible = true
       } else {
-        const src = file.response.data
-        if (!Array.isArray(src)) {
-          this.previewImage = file.url || file.thumbUrl
-          this.previewVisible = true
+        if (file.response && file.response.status && file.response.status == 200) {
+          var src = file.response.data
+          if (Array.isArray(src)) {
+            src = file.response.data[0].filePath
+          }
+          window.location.href = src.replace('http:', 'https:')
         }
       }
     },

+ 2 - 2
src/views/purchasingManagement/purchaseReceipt/basicInfoModal.vue

@@ -74,7 +74,7 @@ import { VSelect } from '@/components'
 import supplier from '@/views/common/supplier.js'
 import warehouse from '@/views/common/chooseWarehouse.js'
 // 接口
-import { savePurchaseDetail } from '@/api/purchase'
+import { detailBaseSave } from '@/api/purchase'
 import { warehouseCascadeList } from '@/api/warehouse'
 export default {
   name: 'PurchaseReceiptBasicInfoModal',
@@ -149,7 +149,7 @@ export default {
           }
           form.sparePartsSn = _this.itemSn
           _this.spinning = true
-          savePurchaseDetail(form).then(res => {
+          detailBaseSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               setTimeout(() => {

+ 36 - 12
src/views/purchasingManagement/purchaseReceipt/detailModal.vue

@@ -18,16 +18,16 @@
           <a-descriptions :column="3">
             <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
             <a-descriptions-item label="入库仓库">{{ (basicInfoData&&basicInfoData.warehouseName) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="采购单号">{{ (basicInfoData&&basicInfoData.sparePartsTypeDictValue) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="客户名称">{{ (basicInfoData&&basicInfoData.sparePartsNo) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="采购单号">{{ (basicInfoData&&basicInfoData.lockBizNo) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="客户名称">{{ (basicInfoData&&basicInfoData.dealerName) || '--' }}</a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
       <!-- 总计 -->
       <a-alert type="info" style="margin:10px 0">
         <div slot="message">
-          采购数量 <strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ,
-          <span v-if="$hasPermissions('B_sparePartsDetail_costPrice')">采购金额 <strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? toThousands(productTotal.totalPrice) : '--' }}</strong></span>
+          采购数量 <strong>{{ (statisticsObj&&(statisticsObj.productTotalQty || statisticsObj.productTotalQty==0)) ? statisticsObj.productTotalQty : '--' }}</strong> ,
+          <span v-if="$hasPermissions('B_sparePartsDetail_costPrice')">采购金额 <strong>{{ (statisticsObj&&(statisticsObj.productTotalCost || statisticsObj.productTotalCost==0)) ? toThousands(statisticsObj.productTotalCost) : '--' }}</strong></span>
         </div>
       </a-alert>
       <!-- 列表 -->
@@ -38,8 +38,10 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
+
         :scroll="{ y: 300 }"
         bordered>
+        <!-- :defaultLoadData="false" -->
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <a-button
@@ -55,7 +57,8 @@
     <div class="btn-cont">
       <a-button id="detail-basicInfo-modal-back" @click="isShow = false">返回列表</a-button>
     </div>
-    <uniqueCodeModal v-drag :openModal="openUniqueCodeModal" :itemSn="itemSn" @close="closeUniqueCodeModal" />
+    <!-- 唯一码列表  不分页 -->
+    <uniqueCodeModal v-drag :openModal="openUniqueCodeModal" :uniqueData="uniqueList" @close="closeUniqueCodeModal" />
   </a-modal>
 </template>
 
@@ -66,7 +69,9 @@ import { STable, VSelect } from '@/components'
 import uniqueCodeModal from './uniqueCodeModal.vue'
 
 // 接口
-import { sparePartsReturnQueryPage, sparePartsPageCount } from '@/api/sparePartsReturn'
+import { sparePartsPageCount } from '@/api/spareParts'
+import { purchaseDetailPageList, queryDetailCount } from '@/api/purchase'
+
 export default {
   name: 'DetailModal',
   mixins: [commonMixin],
@@ -84,14 +89,20 @@ export default {
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      basicInfoData: null, //  基础信心数据
+      basicInfoData: null, //  基础信息数据
+      statisticsObj: null, //  统计数据
       openUniqueCodeModal: false, // 轮胎唯一码弹窗
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return sparePartsReturnQueryPage(Object.assign(parameter, { sparePartsReturnSn: this.itemSn })).then(res => {
+        const params = Object.assign(parameter, { sparePartsSn: this.itemSn })
+        return purchaseDetailPageList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
+            // 获取基础信息数据
+            this.getBasicsData()
+            // 获取统计数据
+            this.getDetailCount()
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
@@ -111,10 +122,13 @@ export default {
         { title: '产品名称', scopedSlots: { customRender: 'productName' }, width: '40%', align: 'left', ellipsis: true },
         { title: '单位', dataIndex: 'unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采购数量', dataIndex: 'productQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购单价', dataIndex: 'productCost', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
+        { title: '采购单价', dataIndex: 'productCost1', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '采购金额', dataIndex: 'productCost', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '操作', dataIndex: 'action', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } }
       ]
+      // if (this.basicInfoData && this.basicInfoData.state && this.basicInfoData.state === 'FINISH') {
+      //   arr.push({ title: '操作', dataIndex: 'action', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } })
+      // }
       // if (this.$hasPermissions('B_sparePartsDetail_costPrice')) { //  成本价权限
       //   arr.splice(5, 0, { title: '入库单价', dataIndex: 'productCost', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       //   arr.splice(6, 0, { title: '小计', dataIndex: 'subtotal', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
@@ -129,15 +143,25 @@ export default {
     closeUniqueCodeModal () {
       this.openUniqueCodeModal = false
     },
-    // 合计
-    getDetailCount (params) {
-      sparePartsPageCount(params).then(res => {
+    // 获取基础信息
+    getBasicsData () {
+      queryDetailCount({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
         } else {
           this.basicInfoData = null
         }
       })
+    },
+    // 统计
+    getDetailCount (params) {
+      sparePartsPageCount({ sparePartsSn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          this.statisticsObj = res.data
+        } else {
+          this.statisticsObj = null
+        }
+      })
     }
   },
   watch: {

+ 4 - 1
src/views/purchasingManagement/purchaseReceipt/edit.vue

@@ -18,7 +18,7 @@
       <a-card size="small" :bordered="false" class="purchaseReceiptEdit-cont" v-show="showDetail">
         <div slot="title">
           <span>基础信息</span>
-          <div style="cursor:pointer;color: #00aaff;float:right;" id="purchaseReceiptEdit-btn" @click.stop="handleEditBase" v-if="!detailsData&&detailsData.supplierName">
+          <div style="cursor:pointer;color: #00aaff;float:right;" id="purchaseReceiptEdit-btn" @click.stop="handleEditBase" v-if="!(detailsData&&detailsData.supplierName)">
             <a-icon type="edit" /> 编辑基础信息
           </div>
         </div>
@@ -293,6 +293,9 @@ export default {
     }
   },
   methods: {
+    ahandleAddOk () {
+      this.pageInit()
+    },
     // 第三方库存
     handleThirdQty () {
       const params = {

+ 73 - 23
src/views/purchasingManagement/purchaseReceipt/list.vue

@@ -37,8 +37,8 @@
                     v-model="queryParam.state"
                     ref="state"
                     id="purchaseReceiptList-serviceState"
-                    code="SPARE_PARTS_RETURN_STATE"
-                    placeholder="请选择审核状态"
+                    code="PURCHASE_STATE"
+                    placeholder="请选择业务状态"
                     allowClear
                   ></v-select>
                 </a-form-item>
@@ -49,7 +49,7 @@
                     v-model="queryParam.state"
                     ref="state"
                     id="purchaseReceiptList-state"
-                    code="SPARE_PARTS_RETURN_STATE"
+                    code="THIRD_PARTY_BIZ_STATE"
                     placeholder="请选择供应商状态"
                     allowClear
                   ></v-select>
@@ -99,38 +99,39 @@
             <span v-else>{{ record.sparePartsNo }}</span>
           </template>
           <!-- 操作 -->
-          <!-- state 待提交 WAIT_SUBMIT 待审核 WAIT_AUDIT 已完结 FINISH 审核不通过 AUDIT_REJECT -->
+          <!-- state  取消 CANCEL 待提交 WAIT_SUBMIT 待审核 WAIT_AUDIT 待入库 WAIT_PUT 已完结 FINISH 审核通过 PASS 审核不通过 REJECT -->
+          <!-- thirdpartyBizState 审核通过	AUDIT_PASS 审核不通过	AUDIT_REJECT  已取消	CANCEL 已出库	FINISH 待审核	WAIT_AUDIT 待发货	WAIT_RECEIVE -->
           <template slot="action" slot-scope="text, record">
             <a-button
               size="small"
               type="link"
               class="button-warning"
               @click="handleCheck(record)"
-              v-if="$hasPermissions('B_purchaseReturnRate') && record.state !='WAIT_SUBMIT'"
+              v-if="$hasPermissions('B_purchaseReturnRate') && record.state ==='WAIT_AUDIT'&&(!record.thirdpartyBizState)"
               id="purchaseReceiptList-examine-btn">审核</a-button>
             <a-button
               size="small"
               type="link"
-              v-if="$hasPermissions('B_purchaseReturnEdit')"
               @click="handleEdit(record)"
               class="button-info"
+              v-if="$hasPermissions('B_purchaseReturnEdit') && (record.state ==='WAIT_SUBMIT'||record.state ==='WAIT_AUDIT'||record.state ==='REJECT') && (!record.thirdpartyBizState)"
               id="purchaseReceiptList-edit-btn">编辑</a-button>
             <a-button
               size="small"
               type="link"
-              v-if="$hasPermissions('B_purchaseReturnDel')"
+              v-if="$hasPermissions('B_purchaseReturnDel')&&isShowCancelBtn(record)"
               @click="handleDel(record)"
               class="button-error"
               id="purchaseReceiptList-del-btn">取消</a-button>
             <a-tooltip placement="left">
               <template slot="title">
-                <span>物流单号:123456789</span>
+                <span>物流单号:{{ record.transportNo }}</span>
               </template>
               <a-button
                 size="small"
                 type="link"
                 class="button-warning"
-                v-if="$hasPermissions('B_purchaseReturnRate') && record.state !='WAIT_SUBMIT'"
+                v-if="$hasPermissions('B_purchaseReturnRate') && (record.state === 'WAIT_PUT'&&record.thirdpartyBizState==='FINISH')||(record.state === 'FINISH'&&record.thirdpartyBizState==='FINISH')"
                 id="purchaseReceiptList-logistics-btn">
                 物流
               </a-button>
@@ -140,24 +141,25 @@
               type="link"
               class="button-warning"
               @click="addVoucher(record)"
-              v-if="$hasPermissions('B_purchaseReturnRate') && record.state !='WAIT_SUBMIT'"
+              v-if="$hasPermissions('B_purchaseReturnRate') && isShowUploadBtn(record)"
               id="purchaseReceiptList-addVoucher-btn">上传凭证</a-button>
             <a-button
               size="small"
               type="link"
               class="button-warning"
               @click="seeVoucher(record)"
-              v-if="$hasPermissions('B_purchaseReturnRate') && record.state !='WAIT_SUBMIT'"
+              v-if="$hasPermissions('B_purchaseReturnRate') && isShowCheckBtn(record)"
               id="purchaseReceiptList-seeVoucher-btn">查看凭证</a-button>
+            <span v-if="isShowNoBtn(record)">--</span>
           </template>
         </s-table>
       </a-spin>
       <!-- 详情弹窗 -->
       <detailModal v-drag :openModal="openDetailModal" :itemSn="itemSn" @close="closeDetailModal" />
       <!-- 审核弹窗 -->
-      <reviewModal v-drag :openModal="openReviewModal" @close="openReviewModal=false"></reviewModal>
+      <reviewModal v-drag :openModal="openReviewModal" :itemSn="itemSn" @ok="okReviewModal" @close="closeReviewModal"></reviewModal>
       <!-- 上传凭证 -->
-      <uploadVoucherModal v-drag :openModal="openVoucherModal" @close="openVoucherModal=false"></uploadVoucherModal>
+      <uploadVoucherModal v-drag :openModal="openVoucherModal" :itemSn="itemSn" @close="openVoucherModal=false"></uploadVoucherModal>
     </a-card>
   </div>
 </template>
@@ -174,7 +176,7 @@ import reviewModal from './reviewModal.vue'
 import detailModal from './detailModal.vue'
 import uploadVoucherModal from './uploadVoucherModal.vue'
 // 接口
-import { purchaseList, purchasePageCount, purchaseCancel } from '@/api/purchase'
+import { purchaseList, purchasePageCount, purchaseCancel, purchaseAudit } from '@/api/purchase'
 export default {
   name: 'PurchaseReceiptList',
   mixins: [commonMixin],
@@ -234,14 +236,14 @@ export default {
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采购单号', scopedSlots: { customRender: 'purchaseReceiptNo' }, width: '9%', align: 'center' },
         { title: '提交时间', dataIndex: 'updateDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '供应商名称', dataIndex: 'shippingAddr', align: 'left', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '采购数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购金额', dataIndex: 'totalCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '入库仓库', dataIndex: 'returnReasonDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '关联单号', dataIndex: 'relationNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'supplierName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '供应商名称', dataIndex: 'supplierName', align: 'left', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '采购数量', dataIndex: 'productTotalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购金额', dataIndex: 'productTotalCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+        { title: '入库仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '关联单号', dataIndex: 'lockBizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'shippingAddr', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '供应商状态', dataIndex: 'returnReasonDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '供应商状态', dataIndex: 'thirdpartyBizStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '备注', dataIndex: 'remark', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
@@ -252,6 +254,28 @@ export default {
     }
   },
   methods: {
+    // <!-- state  取消 CANCEL 待提交 WAIT_SUBMIT 待审核 WAIT_AUDIT 待入库 WAIT_PUT 已完结 FINISH 审核通过 PASS 审核不通过 REJECT -->
+    // <!-- thirdpartyBizState 审核通过	AUDIT_PASS 审核不通过	AUDIT_REJECT  已取消	CANCEL 已出库	FINISH 待审核	WAIT_AUDIT 待发货	WAIT_RECEIVE -->
+    // 是否显示取消按钮
+    isShowCancelBtn (row) {
+      const res = ((row.state === 'WAIT_SUBMIT' || row.state === 'WAIT_AUDIT' || row.state === 'REJECT') && !row.thirdpartyBizState) || (row.state === 'PASS' && row.thirdpartyBizState === 'WAIT_AUDIT') || (row.state === 'PASS' && row.thirdpartyBizState === 'AUDIT_PASS')
+      return res
+    },
+    // 是否显示上传凭证按钮
+    isShowUploadBtn (con) {
+      const res = ((con.state === 'PASS' && con.thirdpartyBizState === 'AUDIT_PASS') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'WAIT_RECEIVE') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'FINISH') || (con.state === 'FINISH' && con.thirdpartyBizState === 'FINISH')) && !con.attachmentList
+      return res
+    },
+    // 是否显示查看凭证按钮
+    isShowCheckBtn (con) {
+      const res = ((con.state === 'PASS' && con.thirdpartyBizState === 'AUDIT_PASS') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'WAIT_RECEIVE') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'FINISH') || (con.state === 'FINISH' && con.thirdpartyBizState === 'FINISH')) && con.attachmentList
+      return res
+    },
+    // 是否显示 --
+    isShowNoBtn (rowVal) {
+      const res = (rowVal.state === 'CANCEL' && !rowVal.thirdpartyBizState) || (rowVal.state === 'CANCEL' && rowVal.thirdpartyBizState === 'WAIT_AUDIT') || (rowVal.state === 'CANCEL' && rowVal.thirdpartyBizState === 'AUDIT_PASS') || (rowVal.state === 'PASS' && rowVal.thirdpartyBizState === 'AUDIT_REJECT') || (rowVal.state === 'PASS' && rowVal.thirdpartyBizState === 'CANCEL')
+      return res
+    },
     // 创建时间
     dateChange (date) {
       this.queryParam.beginDate = date[0]
@@ -274,11 +298,36 @@ export default {
     // 审核
     handleCheck (row) {
       const _this = this
+      _this.itemSn = row.sparePartsSn
       _this.openReviewModal = true
     },
+    // 审核结果
+    okReviewModal (val) {
+      const _this = this
+      const ajaxData = {
+        sparePartsSn: _this.itemSn,
+        auditState: val
+      }
+      _this.spinning = true
+      purchaseAudit(ajaxData).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh(true)
+          _this.spinning = false
+          _this.closeReviewModal()
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    // 审核完成,清理sn数据
+    closeReviewModal () {
+      this.itemSn = null
+      this.openReviewModal = false
+    },
     //  采购单号 打开详情弹窗
     handleDetail (row) {
-      this.itemSn = row.sparePartsReturnSn
+      this.itemSn = row.sparePartsSn
       this.openDetailModal = true
     },
     // 关闭采购退货详情弹框
@@ -286,7 +335,8 @@ export default {
       this.openDetailModal = false
     },
     // 上传凭证
-    addVoucher () {
+    addVoucher (row) {
+      this.itemSn = row.sparePartsSn
       this.openVoucherModal = true
     },
     //  取消

+ 3 - 29
src/views/purchasingManagement/purchaseReceipt/reviewModal.vue

@@ -20,13 +20,13 @@
         <a-button
           id="auditModal-cancel"
           type="primary"
-          @click="handleAuditModal('AUDIT_REJECT')"
+          @click="handleAuditModal('REJECT')"
           style="margin-right: 15px;">审核不通过</a-button>
         <a-button
           type="primary"
           id="auditModal-save"
           class="button-info"
-          @click="handleAuditModal('PRICED')"
+          @click="handleAuditModal('PASS')"
         >审核通过</a-button>
       </div>
     </a-spin>
@@ -35,8 +35,6 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-// 接口
-import { sparePartsSaveDetail } from '@/api/spareParts'
 export default {
   name: 'ReviewModal',
   mixins: [commonMixin],
@@ -44,10 +42,6 @@ export default {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
-    },
-    itemSn: {
-      type: [Number, String],
-      default: ''
     }
   },
   data () {
@@ -59,27 +53,7 @@ export default {
   methods: {
     // 审核通过 审核不通过
     handleAuditModal (val) {
-      const _this = this
-      const productSnList = []
-      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
-        productSnList.push(item.productSn)
-      })
-      const ajaxData = {
-        productSnList: productSnList,
-        auditState: type
-      }
-      _this.spinning = true
-      sparePartsSaveDetail(ajaxData).then(res => {
-        if (res.status == 200) {
-          _this.$refs.table.clearSelected() // 清空表格选中项
-          _this.$message.success(res.message)
-          _this.$refs.table.refresh()
-          _this.spinning = false
-          _this.openAuditModal = false
-        } else {
-          _this.spinning = false
-        }
-      })
+      this.$emit('ok', val)
     }
   },
   watch: {

+ 50 - 87
src/views/purchasingManagement/purchaseReceipt/uploadVoucherModal.vue

@@ -9,20 +9,27 @@
     @cancel="isShow=false"
     :width="420">
     <div class="uploadVoucher-con">
-      <div class="explain-con">
-        <div style="overflow: hidden;padding-left: 23px;">
+      <a-form-model
+        ref="ruleForm"
+        :model="form"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="附件">
           <Upload
             id="uploadVoucher-attachList"
             ref="importUpload"
-            :maxNums="1"
-            fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
-            uploadType="import"
+            v-model="attachmentList"
+            :maxNums="10"
+            :fileSize="10"
+            uploadType="attach"
             :action="attachAction"
-            :uploadParams="uploadParams"
             upText="添加文件"
+            fileType="*"
             @change="changeImport"></Upload>
-        </div>
-      </div>
+          <div style="color:#999999;">(支持图片、word、excel、PDF等格式,最多10个附件)</div>
+        </a-form-model-item>
+      </a-form-model>
       <!-- 按钮 -->
       <div class="btn-con">
         <a-button
@@ -36,72 +43,60 @@
           id="uploadVoucher-nextStep"
           size="large"
           class="button-primary"
-          @click="handlerNextStep">保存</a-button>
+          @click="handleSaveVoucher">保存</a-button>
       </div>
     </div>
-    <!-- 导入 -->
-    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
   </a-modal>
 </template>
 
 <script>
-import ChooseImportModal from './chooseImportModal.vue'
 import { Upload } from '@/components'
+import { saveAttachment } from '@/api/purchase'
 export default {
   name: 'UploadVoucherModal',
-  components: { ChooseImportModal, Upload },
+  components: { Upload },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
     },
-    params: {
-      type: Object,
-      default: null
+    itemSn: {
+      type: String,
+      default: ''
     }
   },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      openImportModal: false, //  导入
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
-      paramsData: null,
-      uploadParams: {
-        savePathType: 'local'
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
       },
-      exportLoading: false,
-      filePath: location.protocol + '//' + location.host + '/templ/采购产品导入模板.xlsx'
+      attachList: null,
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
     }
   },
   methods: {
-    // 下一步
-    handlerNextStep () {
-      if (this.paramsData) {
-        this.openImportModal = true
-      } else {
-        this.$message.warning('添加文件后再进行下一步操作!')
-      }
+    // 上传凭证
+    handleSaveVoucher () {
+      saveAttachment({
+        sparePartsSn: this.itemSn,
+        attachmentList: this.attachList
+      }).then(res => {
+        if (res.code == 200) {
+          this.$message.success('上传成功')
+          this.isShow = false
+        }
+      })
     },
     // 上传文件  change
     changeImport (file) {
       if (file) {
-        this.paramsData = {
-          sparePartsSn: this.params.sparePartsSn || '',
-          path: file
-        }
+        this.attachList = JSON.parse(file)
+        this.attachList.map(item => {
+          item.fileType = item.extName
+        })
       }
-    },
-    // 导入
-    hanldeOk (obj) {
-      if (obj && obj.length > 0) {
-        this.$emit('ok', obj)
-        this.isShow = false
-      }
-    },
-    // 关闭
-    handleClose () {
-      this.openImportModal = false
-      this.isShow = false
     }
   },
   watch: {
@@ -114,6 +109,7 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.paramsData = null
+        this.itemSn = ''
         this.$refs.importUpload.setFileList('')
       }
     }
@@ -124,47 +120,14 @@ export default {
 <style lang="less" scoped>
   .uploadVoucher-modal{
     .uploadVoucher-con{
-      .explain-con{
-        .explain-item{
-          margin-bottom: 10px;
-          .explain-tit{
-            font-weight: bold;
-            span{
-              display: inline-block;
-              width: 18px;
-              height: 18px;
-              line-height: 16px;
-              text-align: center;
-              margin-right: 5px;
-              border-radius: 50%;
-              border: 1px solid rgba(0, 0, 0, 0.3);
-            }
-          }
-          p{
-            margin: 8px 0;
-            padding-left: 23px;
-          }
-          ul{
-            list-style: none;
-            padding: 0;
-            padding-left: 23px;
-            margin: 0;
-            li{
-              line-height: 26px;
-            }
-          }
-        }
-        #uploadVoucher-attachList{
-          width: 100%;
-        }
-      }
-      .btn-con{
-        margin: 10px 0 20px;
-        text-align: center;
-        .button-cancel{
-          font-size: 12px;
-        }
-      }
+     .btn-con{
+       margin: 10px 0 20px;
+       text-align: center;
+       .button-cancel{
+         font-size: 12px;
+       }
+     }
+
     }
   }
 </style>