diff --git a/.DS_Store b/.DS_Store index 01a7db2..9549846 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Dialog/Accessoriesprints.vue b/Dialog/Accessoriesprints.vue new file mode 100644 index 0000000..3f4a785 --- /dev/null +++ b/Dialog/Accessoriesprints.vue @@ -0,0 +1,429 @@ + + + + + diff --git a/Dialog/AddItemInformation.vue b/Dialog/AddItemInformation.vue new file mode 100644 index 0000000..98203b8 --- /dev/null +++ b/Dialog/AddItemInformation.vue @@ -0,0 +1,809 @@ + + + + + diff --git a/Dialog/EditBrand.vue b/Dialog/EditBrand.vue new file mode 100644 index 0000000..60eeb59 --- /dev/null +++ b/Dialog/EditBrand.vue @@ -0,0 +1,674 @@ + + + + + diff --git a/Dialog/EditIteminfo.vue b/Dialog/EditIteminfo.vue new file mode 100644 index 0000000..da26d25 --- /dev/null +++ b/Dialog/EditIteminfo.vue @@ -0,0 +1,476 @@ + + + + + diff --git a/Dialog/Editall.vue b/Dialog/Editall.vue new file mode 100644 index 0000000..6ce9aeb --- /dev/null +++ b/Dialog/Editall.vue @@ -0,0 +1,733 @@ + + + + + diff --git a/Dialog/Editinspectionreport.vue b/Dialog/Editinspectionreport.vue new file mode 100644 index 0000000..bfb5c47 --- /dev/null +++ b/Dialog/Editinspectionreport.vue @@ -0,0 +1,568 @@ + + + + + diff --git a/Dialog/Exceldown.vue b/Dialog/Exceldown.vue new file mode 100644 index 0000000..6f607e5 --- /dev/null +++ b/Dialog/Exceldown.vue @@ -0,0 +1,187 @@ + + + + \ No newline at end of file diff --git a/Dialog/InfoDialog.vue b/Dialog/InfoDialog.vue new file mode 100644 index 0000000..49c2695 --- /dev/null +++ b/Dialog/InfoDialog.vue @@ -0,0 +1,281 @@ + + + + + diff --git a/Dialog/InnerDialog.vue b/Dialog/InnerDialog.vue new file mode 100644 index 0000000..a69306d --- /dev/null +++ b/Dialog/InnerDialog.vue @@ -0,0 +1,213 @@ + + + + + diff --git a/Dialog/Integralmodal.vue b/Dialog/Integralmodal.vue new file mode 100644 index 0000000..ebedaf6 --- /dev/null +++ b/Dialog/Integralmodal.vue @@ -0,0 +1,694 @@ + + + + + diff --git a/Dialog/MachineDetailsDialog.vue b/Dialog/MachineDetailsDialog.vue new file mode 100644 index 0000000..a506de0 --- /dev/null +++ b/Dialog/MachineDetailsDialog.vue @@ -0,0 +1,854 @@ + + + + + + \ No newline at end of file diff --git a/Dialog/PopupMessage.vue b/Dialog/PopupMessage.vue new file mode 100644 index 0000000..19de422 --- /dev/null +++ b/Dialog/PopupMessage.vue @@ -0,0 +1,168 @@ + + + + \ No newline at end of file diff --git a/Dialog/Repeat.vue b/Dialog/Repeat.vue new file mode 100644 index 0000000..401797c --- /dev/null +++ b/Dialog/Repeat.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/Dialog/Warehousingprint.vue b/Dialog/Warehousingprint.vue new file mode 100644 index 0000000..cb22909 --- /dev/null +++ b/Dialog/Warehousingprint.vue @@ -0,0 +1,465 @@ + + + + + diff --git a/Dialog/addStaff.vue b/Dialog/addStaff.vue new file mode 100644 index 0000000..4740fb6 --- /dev/null +++ b/Dialog/addStaff.vue @@ -0,0 +1,272 @@ + + + + + +> diff --git a/Dialog/addbrand.vue b/Dialog/addbrand.vue new file mode 100644 index 0000000..b276326 --- /dev/null +++ b/Dialog/addbrand.vue @@ -0,0 +1,178 @@ + + + + + + \ No newline at end of file diff --git a/Dialog/batchinfo.vue b/Dialog/batchinfo.vue new file mode 100644 index 0000000..12e4272 --- /dev/null +++ b/Dialog/batchinfo.vue @@ -0,0 +1,1087 @@ + + + + + diff --git a/Dialog/break.vue b/Dialog/break.vue new file mode 100644 index 0000000..c4c0e86 --- /dev/null +++ b/Dialog/break.vue @@ -0,0 +1,756 @@ + + + + + \ No newline at end of file diff --git a/Dialog/break2.vue b/Dialog/break2.vue new file mode 100644 index 0000000..96cc60f --- /dev/null +++ b/Dialog/break2.vue @@ -0,0 +1,767 @@ + + + + + \ No newline at end of file diff --git a/Dialog/getoff.vue b/Dialog/getoff.vue new file mode 100644 index 0000000..1b6b45c --- /dev/null +++ b/Dialog/getoff.vue @@ -0,0 +1,244 @@ + + + + + \ No newline at end of file diff --git a/Dialog/idleProductlistTips.vue b/Dialog/idleProductlistTips.vue new file mode 100644 index 0000000..6924a70 --- /dev/null +++ b/Dialog/idleProductlistTips.vue @@ -0,0 +1,145 @@ + + + + + \ No newline at end of file diff --git a/Dialog/index.vue b/Dialog/index.vue new file mode 100644 index 0000000..f560029 --- /dev/null +++ b/Dialog/index.vue @@ -0,0 +1,638 @@ + + + + + diff --git a/Dialog/printingDialog.vue b/Dialog/printingDialog.vue new file mode 100644 index 0000000..67f1b7d --- /dev/null +++ b/Dialog/printingDialog.vue @@ -0,0 +1,491 @@ + + + + + diff --git a/Dialog/printingDialog2.vue b/Dialog/printingDialog2.vue new file mode 100644 index 0000000..ac5dc3b --- /dev/null +++ b/Dialog/printingDialog2.vue @@ -0,0 +1,532 @@ + + + + \ No newline at end of file diff --git a/Dialog/printingDialog3.vue b/Dialog/printingDialog3.vue new file mode 100644 index 0000000..7660d3b --- /dev/null +++ b/Dialog/printingDialog3.vue @@ -0,0 +1,444 @@ + + + + + \ No newline at end of file diff --git a/Dialog/replenishmentOrderDialog.vue b/Dialog/replenishmentOrderDialog.vue new file mode 100644 index 0000000..544886a --- /dev/null +++ b/Dialog/replenishmentOrderDialog.vue @@ -0,0 +1,75 @@ + + + + + \ No newline at end of file diff --git a/Dialog/saleDialog.vue b/Dialog/saleDialog.vue new file mode 100644 index 0000000..c40ac05 --- /dev/null +++ b/Dialog/saleDialog.vue @@ -0,0 +1,2190 @@ + + + + + diff --git a/Dialog/settlementok.vue b/Dialog/settlementok.vue new file mode 100644 index 0000000..0914981 --- /dev/null +++ b/Dialog/settlementok.vue @@ -0,0 +1,141 @@ + + + + + + \ No newline at end of file diff --git a/Dialog/updateinfo.vue b/Dialog/updateinfo.vue new file mode 100644 index 0000000..cd8aeb4 --- /dev/null +++ b/Dialog/updateinfo.vue @@ -0,0 +1,667 @@ + + + + + diff --git a/Dialog/xyqualitydialog.vue b/Dialog/xyqualitydialog.vue new file mode 100644 index 0000000..1a80497 --- /dev/null +++ b/Dialog/xyqualitydialog.vue @@ -0,0 +1,148 @@ + + + + + \ No newline at end of file diff --git a/api/InventoryManagement.js b/api/InventoryManagement.js new file mode 100644 index 0000000..3b9fb68 --- /dev/null +++ b/api/InventoryManagement.js @@ -0,0 +1,430 @@ +import request from './../utils/request' +// 审签图报表 +export function approval_drawing_report(data) { + return request({ + url: '/api/report/approval_drawing_report', + method: 'post', + data + }) +} +// 导出excel接口 +// export function approval_drawing_report(data) { +// return request({ +// url: '/api/report/approval_drawing_report', +// method: 'post', +// data +// }) +// } +// 查看借机记录 +export function phone_move_list(data) { + return request({ + url: '/api/phone_move/phone_move_list', + method: 'post', + data + }) +} +export function model_statistical(data) { + return request({ + url: '/api/console/model_statistical', + method: 'post', + data + }) +} +/* 查看详情*/ +export function model_statistical_detail(data) { + return request({ + url: '/api/console/model_statistical_detail', + method: 'post', + data + }) +} +/* 库存列表*/ +export function location_storage_statistical(data) { + return request({ + url: '/api/console/location_storage_statistical', + method: 'post', + data + }) +} + +/* 库存列表详情*/ +export function model_storage_statistical(data) { + return request({ + url: '/api/console/model_storage_statistical', + method: 'post', + data + }) +} + +/* 库存统计列表*/ +export function inventory_statistic_list(data) { + return request({ + url: '/api/statistic/inventory_statistic_list', + method: 'post', + data + }) +} +/* 库存统计option*/ +export function res_advanced_search(data) { + return request({ + url: '/api/res/res_advanced_search', + method: 'post', + data + }) +} +/* 品牌接口*/ +export function cate_brand_list_in_stock(data) { + return request({ + url: '/api/brand/cate_brand_list_in_stock', + method: 'post', + data + }) +} + +/* 盘库--质检员库存列*/ +export function warehouse_list(data) { + return request({ + url: '/api/make_inventory/warehouse_list', + method: 'post', + data + }) +} +/* 历史盘库*/ +export function history_make_inventory(data) { + return request({ + url: '/api/make_inventory/history_make_inventory', + method: 'post', + data + }) +} +/* 锁定库存*/ +export function lock_inventory(data) { + return request({ + url: '/api/make_inventory/lock_inventory', + method: 'post', + data + }) +} +/* 新增盘库*/ +export function add_inventory(data) { + return request({ + url: '/api/make_inventory/add_inventory', + method: 'post', + data + }) +} + +/* 盘库详情*/ +export function history_inventory_details(data) { + return request({ + url: '/api/make_inventory/history_inventory_details', + method: 'post', + data + }) +} +/* 开始录入机器*/ +export function enter_phone(data) { + return request({ + url: '/api/make_inventory/enter_phone', + method: 'post', + data + }) +} +/* 盘库---保存*/ +export function make_inventory_save(data) { + return request({ + url: '/api/make_inventory/make_inventory_save', + method: 'post', + data + }) +} +/* 盘库---缺少数量*/ +export function lack_phone(data) { + return request({ + url: '/api/make_inventory/lack_phone', + method: 'post', + data + }) +} +/* 机器销售退货(待收货)列表*/ +export function res_wait_receiving(data) { + return request({ + url: '/api/res/res_wait_receiving', + method: 'post', + data + }) +} +/* 销售退货(待收货)---批量收货*/ +export function batch_receiving(data) { + return request({ + url: '/api/res/batch_receiving', + method: 'post', + data + }) +} +/* 机器待回机列表*/ +export function res_wait_repair_back(data) { + return request({ + url: '/api/res/res_wait_repair_back', + method: 'post', + data + }) +} +/* 待出库列表/出库单*/ +export function wait_out_storage(data) { + return request({ + url: '/api/statistic/wait_out_storage', + method: 'post', + data + }) +} +/* 待出库列表/出库单 详情*/ +export function wait_out_storage_details(data) { + return request({ + url: '/api/statistic/wait_out_storage_details', + method: 'post', + data + }) +} +/* 出库单-详情*/ +export function out_storage_details(data) { + return request({ + url: '/api/statistic/out_storage_details', + method: 'post', + data + }) +} +//待出库列表-详情 +export function wait_storage_details(data) { + return request({ + url: '/api/statistic/wait_storage_details', + method: 'post', + data + }) +} + +/* 出库工作台---获取机器*/ +export function get_out_storage_imei(data) { + return request({ + url: '/api/statistic/get_out_storage_imei', + method: 'post', + data + }) +} +/* 确认出库*/ +export function confirm_out_storage(data) { + return request({ + url: '/api/statistic/confirm_out_storage', + method: 'post', + data + }) +} +/* 手动出库---imei获取机器*/ +export function out_batch_get_model(data) { + return request({ + url: '/api/statistic/out_batch_get_model', + method: 'post', + data + }) +} +/* 手动出库---批量出库*/ +export function out_storage_batch(data) { + return request({ + url: '/api/statistic/out_storage_batch', + method: 'post', + data + }) +} + +/* 调拨单*/ +export function transfers_order_list(data) { + return request({ + url: '/api/inspection/transfers_order_list', + method: 'post', + data + }) +} + +/* 分配调拨*/ +export function distribute_transfers(data) { + return request({ + url: '/api/inspection/distribute_transfers', + method: 'post', + data + }) +} + +/* 调拨记录*/ +export function transfers_record_list(data) { + return request({ + url: '/api/inspection/transfers_record_list', + method: 'post', + data + }) +} +/* 仓管确认、取消调拨*/ +export function transfers_order_confirm(data) { + return request({ + url: '/api/inspection/transfers_order_confirm', + method: 'post', + data + }) +} +/* 快递单号出库*/ +export function out_storage_express_single(data) { + return request({ + url: '/api/statistic/out_storage_express_single', + method: 'post', + data + }) +} +/* 维修单列表*/ +export function repair_order_list(data) { + return request({ + url: '/api/repair/repair_order_list', + method: 'post', + data + }) +} +/* 维修单详情*/ +export function repair_order_details(data) { + return request({ + url: '/api/repair/repair_order_details', + method: 'post', + data + }) +} +/* 维修工作台---搜索imei*/ +export function batch_get_model(data) { + return request({ + url: '/api/repair/batch_get_model', + method: 'post', + data + }) +} +/* 维修工作台---批量寄修*/ +export function batch_repair(data) { + return request({ + url: '/api/repair/batch_repair', + method: 'post', + data + }) +} +/* 维修工作台---批量回机*/ +export function batch_back(data) { + return request({ + url: '/api/repair/batch_back', + method: 'post', + data + }) +} +/* 维修工作台---批量返工*/ +export function batch_rework(data) { + return request({ + url: '/api/repair/batch_rework', + method: 'post', + data + }) +} +/* 回机获取维修故障金额*/ +export function repair_back_amount(data) { + return request({ + url: '/api/repair/repair_back_amount', + method: 'post', + data + }) +} +/* 批量回机获取维修故障金额*/ +export function batch_repair_back_amount(data) { + return request({ + url: '/api/repair/batch_repair_back_amount', + method: 'post', + data + }) +} + +/* 采购退货取消退货待收货列表*/ +export function res_wait_purchase_refunds(data) { + return request({ + url: '/api/res/res_wait_purchase_refunds', + method: 'post', + data + }) +} +/* 采购取消退货---确认收货*/ +export function purchase_confirm_goods(data) { + return request({ + url: '/api/refunds/purchase_confirm_goods', + method: 'post', + data + }) +} +/* 采购取消退货---确认收货*/ +export function batch_sales_add(data) { + return request({ + url: '/api/console/batch_get_model', + method: 'post', + data + }) +} +/* 采购取消退货---确认收货*/ +export function batch_operation_add(data) { + return request({ + url: '/api/console/batch_operation_add', + method: 'post', + data + }) +} +/* 采购申请退货批量操作---取消退货、确认退货---获取机器*/ +export function get_imei(data) { + return request({ + url: '/api/refunds/get_imei', + method: 'post', + data + }) +} +/* 采购申请退货---批量取消*/ +export function batch_cancel_refunds(data) { + return request({ + url: '/api/refunds/batch_cancel_refunds', + method: 'post', + data + }) +} +/* 采购申请退货---批量确认*/ +export function batch_confirm_refunds(data) { + return request({ + url: '/api/refunds/batch_confirm_refunds', + method: 'post', + data + }) +} + +/* 维修工作台---搜索imei---现场维修*/ +export function batch_get_model_field_repair(data) { + return request({ + url: '/api/repair/batch_get_model_field_repair', + method: 'post', + data + }) +} + +/* 批量正在维修*/ +export function batch_repair_ing(data) { + return request({ + url: '/api/repair/batch_repair_ing', + method: 'post', + data + }) +} + +/* 批量手动完成*/ +export function batch_repair_ack(data) { + return request({ + url: '/api/repair/batch_repair_ack', + method: 'post', + data + }) +} + + diff --git a/commontable/configuration/buttongrop.vue b/commontable/configuration/buttongrop.vue new file mode 100644 index 0000000..f5d2567 --- /dev/null +++ b/commontable/configuration/buttongrop.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/commontable/configuration/index.vue b/commontable/configuration/index.vue new file mode 100644 index 0000000..443456b --- /dev/null +++ b/commontable/configuration/index.vue @@ -0,0 +1,140 @@ + + + + + \ No newline at end of file diff --git a/commontable/configuration/qc.vue b/commontable/configuration/qc.vue new file mode 100644 index 0000000..d0d17b3 --- /dev/null +++ b/commontable/configuration/qc.vue @@ -0,0 +1,142 @@ + + + + + \ No newline at end of file diff --git a/commontable/configuration/refexp.vue b/commontable/configuration/refexp.vue new file mode 100644 index 0000000..edb419f --- /dev/null +++ b/commontable/configuration/refexp.vue @@ -0,0 +1,82 @@ + + + + + \ No newline at end of file diff --git a/commontable/configuration/setup.vue b/commontable/configuration/setup.vue new file mode 100644 index 0000000..e37b5e6 --- /dev/null +++ b/commontable/configuration/setup.vue @@ -0,0 +1,351 @@ + + + + + \ No newline at end of file diff --git a/commontable/eltablepagination.vue b/commontable/eltablepagination.vue new file mode 100644 index 0000000..6e9ae53 --- /dev/null +++ b/commontable/eltablepagination.vue @@ -0,0 +1,82 @@ + + + + + + diff --git a/commontable/erpTable.vue b/commontable/erpTable.vue new file mode 100644 index 0000000..6f5fb27 --- /dev/null +++ b/commontable/erpTable.vue @@ -0,0 +1,556 @@ + + + + + + \ No newline at end of file diff --git a/commontable/options.vue b/commontable/options.vue new file mode 100644 index 0000000..bde32e4 --- /dev/null +++ b/commontable/options.vue @@ -0,0 +1,1162 @@ + + + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/AgreeReturnDialog.vue b/commontable/tabledialog/AgreeReturnDialog.vue new file mode 100644 index 0000000..25ebcc4 --- /dev/null +++ b/commontable/tabledialog/AgreeReturnDialog.vue @@ -0,0 +1,336 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/BatchOffShelfDialog.vue b/commontable/tabledialog/BatchOffShelfDialog.vue new file mode 100644 index 0000000..ff1f461 --- /dev/null +++ b/commontable/tabledialog/BatchOffShelfDialog.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/DeliveryDialog.vue b/commontable/tabledialog/DeliveryDialog.vue new file mode 100644 index 0000000..271df38 --- /dev/null +++ b/commontable/tabledialog/DeliveryDialog.vue @@ -0,0 +1,1406 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/LightingDialog.vue b/commontable/tabledialog/LightingDialog.vue new file mode 100644 index 0000000..d1dd5a5 --- /dev/null +++ b/commontable/tabledialog/LightingDialog.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/LogsDialog.vue b/commontable/tabledialog/LogsDialog.vue new file mode 100644 index 0000000..e98b431 --- /dev/null +++ b/commontable/tabledialog/LogsDialog.vue @@ -0,0 +1,68 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/OffShelfDialog.vue b/commontable/tabledialog/OffShelfDialog.vue new file mode 100644 index 0000000..9d7a148 --- /dev/null +++ b/commontable/tabledialog/OffShelfDialog.vue @@ -0,0 +1,90 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/PriceAdjustment.vue b/commontable/tabledialog/PriceAdjustment.vue new file mode 100644 index 0000000..e767650 --- /dev/null +++ b/commontable/tabledialog/PriceAdjustment.vue @@ -0,0 +1,405 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/RejectDialog.vue b/commontable/tabledialog/RejectDialog.vue new file mode 100644 index 0000000..3a4a2e2 --- /dev/null +++ b/commontable/tabledialog/RejectDialog.vue @@ -0,0 +1,108 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabledialog/ResultDialog.vue b/commontable/tabledialog/ResultDialog.vue new file mode 100644 index 0000000..f338c75 --- /dev/null +++ b/commontable/tabledialog/ResultDialog.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/commontable/tablepagination.vue b/commontable/tablepagination.vue new file mode 100644 index 0000000..2968f75 --- /dev/null +++ b/commontable/tablepagination.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/commontable/tabletabs.vue b/commontable/tabletabs.vue new file mode 100644 index 0000000..a4cf68d --- /dev/null +++ b/commontable/tabletabs.vue @@ -0,0 +1,73 @@ + + + + + \ No newline at end of file diff --git a/commontable/xyTable.vue b/commontable/xyTable.vue new file mode 100644 index 0000000..ce83f92 --- /dev/null +++ b/commontable/xyTable.vue @@ -0,0 +1,686 @@ + + + + + diff --git a/commontable/ysTable.vue b/commontable/ysTable.vue new file mode 100644 index 0000000..b538ca6 --- /dev/null +++ b/commontable/ysTable.vue @@ -0,0 +1,833 @@ + + + + + diff --git a/index.js b/index.js index 2accde7..e10d8ca 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,12 @@ import MoreClass from "./CommonInput/MoreClass.vue"; import MoreScreen from "./CommonInput/MoreScreen.vue"; import selectbtn from "./CommonInput/selectbtn.vue"; import TimingModule from "./CommonInput/TimingModule.vue"; +import Options from "./commontable/options"; +import Table from "./commontable/erpTable.vue"; +import XyTable from "./commontable/xyTable.vue"; +import YsTable from "./commontable/ysTable.vue"; +import Tablepagination from "./commontable/tablepagination.vue"; +import Tabletabs from "./commontable/tabletabs.vue"; const componentarr = [ appTitle, @@ -16,6 +22,12 @@ const componentarr = [ MoreScreen, selectbtn, TimingModule, + Options, + Table, + XyTable, + YsTable, + Tablepagination, + Tabletabs ]; const install = function (Vue) { diff --git a/package.json b/package.json index cc68af0..bb28188 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "erp-element-ui", - "version": "1.0.8", + "version": "1.0.11", "description": "", "main": "index.js", "scripts": { @@ -10,7 +10,10 @@ "license": "ISC", "peerDependencies": { "element-ui": "^2.15.6", - "echarts":"^4.9.0" + "echarts":"^4.9.0", + "sortablejs":"^1.12.0", + "qrcodejs2":"^0.0.2", + "axios":"^0.18.1" }, "homepage": "https://git.aiguoai.com/liunan/erp-el-element.git", "repository": { diff --git a/utils/.DS_Store b/utils/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/utils/.DS_Store differ diff --git a/utils/Decimal.js b/utils/Decimal.js new file mode 100644 index 0000000..60518ce --- /dev/null +++ b/utils/Decimal.js @@ -0,0 +1,4 @@ + +export function add(){ + +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..ff7e439 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,185 @@ +/* + * @Author: your name + * @Date: 2020-09-08 18:06:28 + * @LastEditTime: 2023-03-06 14:54:24 + * @LastEditors: ckycjwds 1240973496@qq.com + * @Description: In User Settings Edit + * @FilePath: \aiguo_erp_vue\src\utils\request.js + */ +import axios from 'axios' +import { MessageBox, Message } from 'element-ui'; + + +const service = axios.create({ + baseURL: process?.env?.VUE_APP_BASE_API??"http://dev-erp-api.xtkj99.com:7890", + timeout: 1000 * 60 * 2 // 接口超时 +}) + +const pendingAjax = [] +const fastClickMsg = '数据请求中,请稍后' +const CancelToken = axios.CancelToken; + + +let lastcancel=null; + +const removePendingAjax = (config, type, c) => { + if (type.type == 1) { + if (config.data) { + config.data = JSON.stringify(config.data) + } + } + let url = config.url + if (!!config.data && config.data != '{}') { + url = config.url + '_' + config.data + } + // 数据请求中白名单 + const whitelist = ['get_class_account_list', 'cate_brand_list_all', 'ai_model_v2', 'res_advanced_search', 'qrcode', 'account_class_list', 'search_accessories', 'zz_new_status', 'get_unread_msg', 'third_party_no', 'get_ws_auth_code', 'get_drafts_box', 'manual_pull_datas', 'get_unopened_module', 'sales_performance_detail', 'goal_warehouse', 'chx_product_details', 'get_oss_sign_aliyun'] + const index = pendingAjax.findIndex(i => i === url) + const white = whitelist.some(res => { + if (url.indexOf(res) != -1) { + return true + } + }) + if (white) { // 白名单内的接口可以重复请求 + pendingAjax.splice(index, 1) + } else { + if (index > -1) { + c ? c(fastClickMsg + url) : pendingAjax.splice(index, 1) + } else { + c && pendingAjax.push(url) + } + } +} +// 请求拦截 +service.interceptors.request.use( + config => { + // if (navigator.onLine) { //检测网络是否正常 + let token=localStorage.getItem("token"); + if (token) { + config.headers['token'] = localStorage.getItem('token') + } + if(!lastcancel){ + lastcancel= new CancelToken(c => { + const copyconfig = JSON.parse(JSON.stringify(config)) + removePendingAjax(copyconfig, { type: 1 }, c) + }); + } + config.cancelToken=lastcancel; + // config.cancelToken = new CancelToken(c => { + // const copyconfig = JSON.parse(JSON.stringify(config)) + // removePendingAjax(copyconfig, { type: 1 }, c) + // }) + return config + // }else{ + // Message({ + // duration:4000, + // message: '请检查网络状态', + // type: 'warning', + // showClose:true, + // }) + // return + // } + }, + error => { + return Promise.reject(error) + } +) +// 响应拦截 +service.interceptors.response.use( + async response => { + const res = response.data + const copyconfig = JSON.parse(JSON.stringify(response.config)) + copyconfig.url = response.config.url.replace(copyconfig.baseURL, '') + if (typeof (copyconfig.data) === undefined || copyconfig.data == {} || copyconfig.data == '' || typeof (copyconfig.data) === 'object') { + copyconfig.data = '' + } + removePendingAjax(copyconfig, { type: 2 }) + lastcancel=null; + if (res.errcode == 1012) { + return res + } else if (res.errcode == 0 && res.msg != '' && res.msg != '成功' && res.msg != '获取成功') { + Message({ + duration: 4000, + message: res.msg, + type: 'success', + showClose: true + }) + return res + } else if (res.errcode == 105) { // 数据请求过快 + Message({ + duration: 1000, + message: res.msg, + type: 'warning', + showClose: true + }) + } else if (res.errcode == 1002) { + localStorage.clear(); + location.reload(); + /* 这里是判断识别sn的接口地址 如果为真 就把content返回*/ + } else if (res.errcode == 50086) { + return res + } else if (res.errcode != 0) { + Message({ + duration: 4000, + message: res.msg, + type: 'warning', + showClose: true + }) + return res + /* 这里是判断识别sn的接口地址 如果为真 就把content返回*/ + } else if (response.config.url.indexOf('https://apiv1.aiguovip.com/api/query/identify_sn_imei') > -1) { + return res.content + } else { + return res + } + }, + error => { + console.log(error) + if (error.message.indexOf('数据请求中') != -1) { + Message({ + duration: 1000, + showClose: true, + message: '数据请求中,请稍后...', + type: 'warning' + }) + } else if (error.message.indexOf('timeout') != -1) { + const copyconfig = JSON.parse(JSON.stringify(error.config)) + copyconfig.url = error.config.url.replace(copyconfig.baseURL, '') + if (typeof (copyconfig.data) === undefined || copyconfig.data == {} || copyconfig.data == '' || typeof (copyconfig.data) === 'object') { + copyconfig.data = '' + } + removePendingAjax(copyconfig, { type: 2 }) + Message({ + duration: 4000, + showClose: true, + message: '接口请求超时', + type: 'error' + }) + } else { + // console.log(Object.getOwnPropertyNames(error)); + // console.log(error); + // console.log(error.stack); + // console.log(error.message); + if(error?.response.config){ + const copyconfig = JSON.parse(JSON.stringify(error?.response.config)) + copyconfig.url = error?.response.config?.url?.replace(copyconfig.baseURL, '') + if (typeof (copyconfig.data) === undefined || copyconfig.data == {} || copyconfig.data == '' || typeof (copyconfig.data) === 'object') { + copyconfig.data = '' + } + removePendingAjax(copyconfig, { type: 2 }) + } + + Message({ + duration: 4000, + showClose: true, + message: '接口请求超时', + type: 'error' + }) + } + // return Promise.reject(error.response.data) + // return Promise.reject(error) + return error + } +) + +export default service \ No newline at end of file