Explorar el Código

feat:辅材配件销售订单查询导入结果

Moss hace 1 año
padre
commit
db3d765dd0

+ 8 - 0
src/api/auxiliaryFittings/auxiliarySalesOrder.js

@@ -118,4 +118,12 @@ export function getProjectCollectionList(params) {
     method: 'post',
     params
   })
+}
+
+export function queryImportResult(params) {
+  return request({
+    url: `/websit/sales/query/import/result`,
+    method: 'post',
+    params
+  })
 }

+ 1 - 1
src/components/template/import_mixin.js

@@ -25,7 +25,7 @@ export default {
             }
             func({ formdata })
               .then(res => {
-                fun2 && fun2()
+                fun2 && fun2(res)
                 this.$refs.pageRef.refreshList()
                 loading.close()
                 this.$message({

+ 60 - 2
src/views/auxiliaryFittings/salesManagement/attachmentSalesOrder/index.vue

@@ -20,6 +20,18 @@
 				:title="'配件销售订单' + formDialogTitles[formDialogType]"></attachmentSalesOrderDetail>
 		</div>
 		<print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" />
+
+		<el-dialog
+			title="导入结果"
+			:visible.sync="showImportResult"
+			width="600px">
+			<div class="importResultList">
+				<div class="item" v-for="(item, index) in importResultList" :key="index">{{item}}</div>
+			</div>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="showImportResult = false">关 闭</el-button>
+			</span>
+		</el-dialog>
 	</div>
 </template>
 
@@ -30,7 +42,7 @@ import import_mixin from '@/components/template/import_mixin.js'
 import ImageUpload from '@/components/file-upload'
 import { downloadFiles } from '@/utils/util'
 import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
-import { listPageV2, pageExport, getDetail, add, edit, submit, listImportP } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
+import { listPageV2, pageExport, getDetail, add, edit, submit, listImportP, queryImportResult } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
 import { getWebsit } from "@/api/customerManagement";
 import printPreview from '../components/preview.vue'
 import { disAutoConnect, hiprint } from 'vue-plugin-hiprint'
@@ -63,6 +75,9 @@ export default {
 			isShowTab: true,
 			orderEnginBaseId: '',
 			payQrcode: JSON.parse(localStorage.getItem('greemall_user')).payQrcode,
+
+			showImportResult: false,
+			importResultList: [],
 		}
 	},
 	computed: {
@@ -80,7 +95,11 @@ export default {
 					[
 						this.optionsEvensAuth("imp", {
 							render: () => {
-							  return this.importButton(listImportP, '导入')
+							  return this.importButton(listImportP, '导入', null, null, (res) => {
+									this.$nextTick(() => {
+										this.checkImportResult(res.data);
+									})
+								})
 							}
 						})
 					],
@@ -407,6 +426,38 @@ export default {
 			    this.$message.error('下载失败')
 			})
 		},
+
+		// 查询导入结果
+		checkImportResult(importBatchId) {
+			const loading = this.$loading({
+				lock: true,
+				text: '正在查询导入结果',
+				spinner: 'el-icon-loading',
+				background: 'rgba(0, 0, 0, 0.7)'
+			})
+			queryImportResult({
+				importBatchId
+			}).then(result => {
+				if(result.data.waitCount == 0){
+					clearInterval(this.timer)
+					loading.close();
+					// result.data.errList = ['测试测试1', '测试测试1']
+					if(result.data?.errList?.length > 0) {
+						this.importResultList = result.data.errList;
+						this.showImportResult = true;
+					}else {
+						
+					}
+				}else {
+					this.timer = setTimeout(()=>{
+						this.checkImportResult(importBatchId);
+					}, 2000)
+				}
+			}).catch(err => {
+				loading.close();
+				clearInterval(this.timer)
+			})
+		},
 	}
 }
 </script>
@@ -419,4 +470,11 @@ export default {
 .tab {
 	padding: 20px 20px 0 20px;
 }
+
+.importResultList {
+	.item {
+		font-size: 16px;
+		margin-bottom: 10px;
+	}
+}
 </style>

+ 60 - 2
src/views/auxiliaryFittings/salesManagement/auxiliarySalesOrder/index.vue

@@ -20,6 +20,18 @@
 				:title="'辅材销售订单' + formDialogTitles[formDialogType]"></auxiliarySalesOrderDetail>
 		</div>
 		<print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" />
+
+		<el-dialog
+			title="导入结果"
+			:visible.sync="showImportResult"
+			width="600px">
+			<div class="importResultList">
+				<div class="item" v-for="(item, index) in importResultList" :key="index">{{item}}</div>
+			</div>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="showImportResult = false">关 闭</el-button>
+			</span>
+		</el-dialog>
 	</div>
 </template>
 
@@ -30,7 +42,7 @@ import import_mixin from '@/components/template/import_mixin.js'
 import ImageUpload from '@/components/file-upload'
 import { downloadFiles } from '@/utils/util'
 import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
-import { listPageV2, pageExport, getDetail, add, edit, submit, listImportM } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
+import { listPageV2, pageExport, getDetail, add, edit, submit, listImportM, queryImportResult } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
 import { getWebsit } from "@/api/customerManagement";
 import printPreview from '../components/preview.vue'
 import { disAutoConnect, hiprint } from 'vue-plugin-hiprint'
@@ -63,6 +75,9 @@ export default {
 			isShowTab: true,
 			orderEnginBaseId: '',
 			payQrcode: JSON.parse(localStorage.getItem('greemall_user')).payQrcode,
+
+			showImportResult: false,
+			importResultList: [],
 		}
 	},
 	computed: {
@@ -80,7 +95,11 @@ export default {
 					[
 						this.optionsEvensAuth("imp", {
 							render: () => {
-							  return this.importButton(listImportM, '导入')
+							  return this.importButton(listImportM, '导入', null, null, (res) => {
+									this.$nextTick(() => {
+										this.checkImportResult(res.data);
+									})
+								})
 							}
 						})
 					],
@@ -404,6 +423,38 @@ export default {
 			    this.$message.error('下载失败')
 			})
 		},
+
+		// 查询导入结果
+		checkImportResult(importBatchId) {
+			const loading = this.$loading({
+				lock: true,
+				text: '正在查询导入结果',
+				spinner: 'el-icon-loading',
+				background: 'rgba(0, 0, 0, 0.7)'
+			})
+			queryImportResult({
+				importBatchId
+			}).then(result => {
+				if(result.data.waitCount == 0){
+					clearInterval(this.timer)
+					loading.close();
+					// result.data.errList = ['测试测试1', '测试测试1']
+					if(result.data?.errList?.length > 0) {
+						this.importResultList = result.data.errList;
+						this.showImportResult = true;
+					}else {
+						
+					}
+				}else {
+					this.timer = setTimeout(()=>{
+						this.checkImportResult(importBatchId);
+					}, 2000)
+				}
+			}).catch(err => {
+				loading.close();
+				clearInterval(this.timer)
+			})
+		},
 	}
 }
 </script>
@@ -416,4 +467,11 @@ export default {
 .tab {
 	padding: 20px 20px 0 20px;
 }
+
+.importResultList {
+	.item {
+		font-size: 16px;
+		margin-bottom: 10px;
+	}
+}
 </style>