lilei vor 7 Monaten
Ursprung
Commit
f39cb2001a

+ 26 - 10
src/views/allocationManagement/transferOut/chooseImportModal.vue

@@ -6,7 +6,8 @@
     :maskClosable="false"
     title="导入"
     v-model="isShow"
-    @cancel="isShow=false"
+    :closable="!spinning"
+    @cancel="isShow = false"
     :width="900">
     <div class="chooseImport-con">
       <!-- 可导入数据 -->
@@ -15,10 +16,10 @@
         class="sTable"
         ref="table"
         size="small"
-        :rowKey="(record) => record.allocateSn"
+        :rowKey="(record) => record.no"
         :columns="nowColumns"
         :dataSource="loadData"
-        :loading="loading"
+        :loading="spinning"
         :scroll="{ y: 200 }"
         :pagination="false"
         bordered>
@@ -30,10 +31,10 @@
         class="unTable"
         ref="unTable"
         size="small"
-        :rowKey="(record) => record.errorDesc"
+        :rowKey="(record) => record.no"
         :columns="nowUnColumns"
         :dataSource="unLoadData"
-        :loading="loading"
+        :loading="spinning"
         :scroll="{ y: 200 }"
         :pagination="false"
         bordered>
@@ -44,6 +45,7 @@
           type="primary"
           id="chooseImport-submit"
           size="large"
+          :loading="spinning"
           :class="loadData.length==0?'button-grey':'button-primary'"
           @click="handleSubmit"
           style="padding: 0 40px;">确认导入</a-button>
@@ -51,6 +53,7 @@
           id="chooseImport-cancel"
           size="large"
           class="button-cancel"
+          :disabled="spinning"
           @click="isShow=false"
           style="padding: 0 40px;margin-left: 15px;">取消</a-button>
         <a-button
@@ -58,6 +61,7 @@
           id="chooseImport-error"
           size="large"
           class="button-error"
+          :disabled="spinning"
           @click="handleError"
           style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
       </div>
@@ -69,7 +73,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { hdExportExcel } from '@/libs/exportExcel'
 // 接口
-import { allocateBillParseProducts, allocateBillFailExcel } from '@/api/allocateBill'
+import { allocateBillParseProducts, allocateBillFailExcel, allocateBillBatchInsert } from '@/api/allocateBill'
 export default {
   name: 'TransferOutChooseImportModal',
   mixins: [commonMixin],
@@ -88,6 +92,7 @@ export default {
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
+      spinning: false,
       nowColumns: [ //  正品
         { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
@@ -114,10 +119,10 @@ export default {
     // 获取表格数据
     getData () {
       const _this = this
-      this.loading = true
+      this.spinning = true
       // 获取列表数据  无分页
       allocateBillParseProducts(this.paramsData).then(res => {
-        this.loading = false
+        this.spinning = false
         if (res.status == 200) {
           if (res.data.okList && res.data.okList.length > 0) {
             res.data.okList.map((item, index) => {
@@ -139,10 +144,21 @@ export default {
       if (this.loadData.length == 0) {
         this.$message.warning('无可导入产品!')
       } else {
-        this.$emit('ok', this.loadData)
-        this.isShow = false
+        this.handleGuideOk(this.loadData)
       }
     },
+    // 导入产品
+    handleGuideOk (obj) {
+      this.spinning = true
+      allocateBillBatchInsert(obj).then(res => {
+        this.spinning = false
+        if (res.status == 200) {
+          this.isShow = false
+          this.$emit('ok')
+          this.$message.success('导入成功!')
+        }
+      })
+    },
     // 导出
     handleError () {
       const _this = this

+ 3 - 7
src/views/allocationManagement/transferOut/edit.vue

@@ -389,7 +389,7 @@ import { printBase64Fun, exportExcel } from '@/libs/JGPrint.js'
 import { queryStockProductForOtherPage } from '@/api/stock'
 import { productPriceInfo } from '@/api/product'
 import { departmentQueryList } from '@/api/expenseManagement'
-import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
+import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
 
 export default {
   name: 'TransferOutEdit',
@@ -621,12 +621,8 @@ export default {
     },
     // 导入产品
     handleGuideOk (obj) {
-      allocateBillBatchInsert(obj).then(res => {
-        if (res.status == 200) {
-          this.$refs.chooseTable.refresh(true)
-          this.getDetail(true)
-        }
-      })
+      this.$refs.chooseTable.refresh(true)
+      this.getDetail(true)
     },
     // 已选产品  重置
     chooseResetSearchForm (flag) {

+ 2 - 4
src/views/allocationManagement/transferOut/importGuideModal.vue

@@ -121,10 +121,8 @@ export default {
     },
     // 导入
     hanldeOk (obj) {
-      if (obj && obj.length > 0) {
-        this.$emit('ok', obj)
-        this.isShow = false
-      }
+      this.$emit('ok', obj)
+      this.isShow = false
     },
     // 关闭
     handleClose () {