doctor-admin-components 1.0.13-beta.4 → 1.0.13-beta.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +18 -7
  2. package/package.json +1 -1
  3. package/packages/index.js +4 -0
  4. package/packages/src/api/biz/bizContract.js +963 -1
  5. package/packages/src/api/biz/bizContractCompany.js +1 -1
  6. package/packages/src/assets/images/click-show-table.png +0 -0
  7. package/packages/src/assets/images/more.png +0 -0
  8. package/packages/src/assets/images/pdf-new.png +0 -0
  9. package/packages/src/components/FileUpload/contract-drag-new.vue +89 -8
  10. package/packages/src/i18n/en/message.json +259 -0
  11. package/packages/src/i18n/index.js +38 -0
  12. package/packages/src/i18n/zh-CN/message.json +259 -0
  13. package/packages/src/utils/index.js +35 -0
  14. package/packages/src/utils/request.js +120 -146
  15. package/packages/src/views/biz/bizFileInfo/PAYMENT_VOUCHER(/"payment_voucher/", /"/344/273/230/346/254/276/345/207/255/350/257/201.ini" +222 -0
  16. package/packages/src/views/biz/bizFileInfo/contract copy.vue +1711 -0
  17. package/packages/src/views/biz/bizFileInfo/contract.vue +1602 -969
  18. package/packages/src/views/biz/bizFileInfo/contractFile/BillOfLadingNoTab.vue +114 -0
  19. package/packages/src/views/biz/bizFileInfo/contractFile/ContentTitle.vue +102 -0
  20. package/packages/src/views/biz/bizFileInfo/contractFile/IMGPreviewCheckBox.vue +280 -0
  21. package/packages/src/views/biz/bizFileInfo/contractFile/Progress.vue +84 -0
  22. package/packages/src/views/biz/bizFileInfo/contractFile/ProgressDetail.vue +122 -0
  23. package/packages/src/views/biz/bizFileInfo/contractFile/SectionSlot.vue +83 -0
  24. package/packages/src/views/biz/bizFileInfo/contractFile/ShowAndHide.vue +173 -0
  25. package/packages/src/views/biz/bizFileInfo/fileShow copy.vue +321 -0
  26. package/packages/src/views/biz/bizFileInfo/fileShow.vue +178 -130
  27. package/packages/src/views/biz/bizFileInfo/fileShowClaim.vue +1 -1
  28. package/packages/src/views/biz/bizShipment/add.vue +111 -66
  29. package/packages/src/views/biz/contractTracing/addSubCompany.vue +106 -169
  30. package/packages/src/views/biz/contractTracing/billInfo.vue +150 -315
  31. package/packages/src/views/biz/contractTracing/contractPdf.vue +31 -20
  32. package/packages/src/views/biz/contractTracing/contractSummary.vue +286 -629
  33. package/packages/src/views/biz/contractTracing/contractTracingDetail copy.vue +107 -0
  34. package/packages/src/views/biz/contractTracing/contractTracingDetail.vue +202 -8
  35. package/packages/src/views/biz/contractTracing/editBill.vue +219 -359
  36. package/packages/src/views/biz/contractTracing/purchaseInvoiceUpload.vue +91 -3
  37. package/packages/src/views/biz/contractTracing/shipmentPurchaseAmount.vue +8 -2
  38. package/packages/src/views/biz/contractTracing/subCompanyDialog.vue +196 -176
  39. package/packages/src/views/biz/contractTracing/association.vue +0 -189
  40. package/packages/src/views/biz/contractTracing/chargingDialog.vue +0 -84
  41. package/packages/src/views/biz/contractTracing/contract.vue +0 -1276
  42. package/packages/src/views/biz/contractTracing/disputeRecord.vue +0 -311
  43. package/packages/src/views/biz/contractTracing/edit.vue +0 -205
  44. package/packages/src/views/biz/contractTracing/sendDrafEmail.vue +0 -120
  45. package/packages/src/views/biz/contractTracing/shipment.vue +0 -601
@@ -0,0 +1,259 @@
1
+ {
2
+ "contract": {
3
+ "Claim_ID": "索赔 ID",
4
+ "Claim_Type": "索赔类型",
5
+ "Claim_records": "索赔记录",
6
+ "Claim_status": "索赔状态",
7
+ "Quality_Feedback": "质量反馈",
8
+ "Track_Shipment": "查看物流",
9
+ "View": "查看",
10
+ "address": "地址",
11
+ "billCargoName": "提单货物名称",
12
+ "billInfo": "提单信息",
13
+ "billTip": "请确认提单信息",
14
+ "bliRemark": "BLI备注(常用)",
15
+ "commitTime": "提交时间",
16
+ "company": "公司",
17
+ "companyAddress": "公司地址",
18
+ "companyName": "公司名称",
19
+ "companyTip": "系统根据您选择的公司自动带出",
20
+ "consignee": "收货人公司",
21
+ "consigneeAddress": "收货人地址",
22
+ "consigneeCompanyTitle": "管理收货人公司",
23
+ "consigneeInfo": "提单信息",
24
+ "consigneeTip": "请选择收货人公司",
25
+ "contact": "联系人",
26
+ "contactInfo": "联系人信息",
27
+ "contract": "合同公司",
28
+ "shipperInfo": "发货人信息",
29
+ "option": "选项",
30
+ "contractInfo": "合同信息",
31
+ "create_time": "创建时间",
32
+ "destination": "目的港",
33
+ "disputeTip": "如果你对合同有任何争议,你可以在这里填写并提交。提交后,我们的工作人员将在两个工作日内与您联系。",
34
+ "disputeTitle": "合同争议(可选)",
35
+ "email": "电子邮件",
36
+ "hsCode": "海关编码",
37
+ "landline": "座机",
38
+ "next": "其次",
39
+ "noDisputes": "无争议",
40
+ "notifier": "通知人公司",
41
+ "notifierAddress": "通知人地址",
42
+ "notifierCompanyTitle": "管理通知人公司",
43
+ "notifierInfo": "通知人信息",
44
+ "otherInfo": "其他信息",
45
+ "phoneNumber": "手机号码",
46
+ "picture": "图片",
47
+ "preferred": "首选",
48
+ "product": "商品品名",
49
+ "remark": "备注",
50
+ "selectCompany": "更换公司",
51
+ "shippingMarks": "唛头",
52
+ "stepOne": "步骤一",
53
+ "stepOneTip": "确认合同签订公司",
54
+ "stepTwo": "步骤二",
55
+ "stepTwoTip": "确认合同条款",
56
+ "successTip": "提交成功",
57
+ "successTip2": "非常感谢您的提交。我们的履约部门将尽快开始处理您的合同,并在必要时与您联系,请注意查收您的邮箱。再次感谢您的合作!",
58
+ "taxId": "税号",
59
+ "telePhone": "手机号码",
60
+ "terminal": "码头",
61
+ "tip1": "买家未填写提单信息",
62
+ "tip10": "税号不能为空",
63
+ "tip12": "数量不多于",
64
+ "tip13": "个",
65
+ "tip2": "买家提交了提单信息以后您可以在这里查看",
66
+ "tip3": "合同争议不能为空",
67
+ "tip4": "请上传",
68
+ "tip5": "文件大小小于",
69
+ "tip6": "文件类型为",
70
+ "tip7": "公司名称不能为空",
71
+ "tip8": "公司地址不能为空",
72
+ "tip9": "邮箱不能为空",
73
+ "withDispute": "有争议",
74
+ "firstNotifier": "第一通知人",
75
+ "attachments": "附件",
76
+ "tip14": "点击上传",
77
+ "tip15": "将文件拖到此处,或",
78
+ "secondNotifier": "第二通知人",
79
+ "shipper": "发货人公司",
80
+ "shipperAddress": "发货人地址",
81
+ "terminalTip": "如果您需要发货到指定的码头,请此处添加",
82
+ "shippingMarksTip": "请输入唛头",
83
+ "remarkTip": "请输入备注"
84
+ },
85
+ "contractDetail": {
86
+ "BLCopy": "正式提单",
87
+ "Claim_completion": "索赔完成",
88
+ "Claim_documents": "索赔文档",
89
+ "Contract_No": "合同编号",
90
+ "Contract_Status": "合同状态",
91
+ "BLConfirm": "BLI确认",
92
+ "BL_No": "提单号:",
93
+ "BL_Not_Confirm": "提单未确认",
94
+ "BL_Confirmed": "提单已确认",
95
+ "BL_info_confirmed": "提单信息已确认",
96
+ "bl_draft_confirm": "确认提单草稿",
97
+ "editBLInformation": "编辑提单信息",
98
+ "Credit_Note": "Credit note",
99
+ "Debit_Note": "Debit note",
100
+ "Deposit": "付定金",
101
+ "Deposit_Paid": "定金已付",
102
+ "Deposit_Unpaid": "定金未付",
103
+ "Final_payment": "尾款支付",
104
+ "reference_invince": "参考采购尾款",
105
+ "select_receive_buyer": "请先选择收货买家",
106
+ "select_receive_buyer_tips": "请在下方选择一个您需要发货的买家",
107
+ "Payment_receipt": "付款水单",
108
+ "Pending_Confirmation": "待确认",
109
+ "askId": "关联ASK ID",
110
+ "askName": "ASK 名称",
111
+ "askOverview": "ASK 概括",
112
+ "billOfLadingNo": "提单编号",
113
+ "billTo": "收票公司",
114
+ "blInfo": "提单指令",
115
+ "ship_create_tips": "是否确认直接生成装运?请注意,此合同的定金发票尚未生成或已生成但未收款,请先确认相关情况。",
116
+ "please_waiting": "请稍后",
117
+ "view_history": "查看历史版本",
118
+ "identification_summary": "识别汇总",
119
+ "edit_shipment": "编辑船运",
120
+ "blInfo_unconfirm": "提单指令待确认",
121
+ "bookingConfirmation": "订舱资料",
122
+ "categoryName": "大类",
123
+ "chargingStatus": "电放状态",
124
+ "closeInvoiceInfo": "收起发票信息",
125
+ "commodityInfo": "商品信息",
126
+ "commodityPicture": "商品图片",
127
+ "conrainerNo": "柜号",
128
+ "contractInfoConfirm": "合同信息",
129
+ "contractNo": "合同号",
130
+ "contractStatus": "合同状态",
131
+ "dealSummary": "成交概括",
132
+ "dealTime": "成交时间",
133
+ "delete": "删除",
134
+ "deleteAndUpload": "删除并重新上传",
135
+ "deposit": "定金",
136
+ "depositInvoice": "定金发票",
137
+ "deposit_unpaid": "定金待付",
138
+ "deposit_unreceipt": "支付凭证待提供",
139
+ "invoice_list": "发票列表",
140
+ "depositPaid": "定金未付",
141
+ "depositRemittanceReceipt": "定金 水单/汇款凭证",
142
+ "description": "描述",
143
+ "destination": "目的港",
144
+ "download": "下载",
145
+ "downloadZip": "批量下载",
146
+ "draftBillOfLading": "草稿提单",
147
+ "draftBillOfLading_confirm_success": "确认草稿提单成功",
148
+ "edit": "编辑",
149
+ "update_after_shipping": "将会在卖家装运后更新",
150
+ "fileManage": "文件管理",
151
+ "fileNmae": "文件名称",
152
+ "finalPaymentMemo": "尾款水单",
153
+ "finallyInvoice": "尾款发票",
154
+ "info": "合同详情",
155
+ "invoiceDate": "发票日期",
156
+ "invoiceInfo": "发票信息",
157
+ "invoiceNo": "发票号",
158
+ "invoiceSpecies": "发票种类",
159
+ "invoiceType": "发票类型",
160
+ "issuer": "开票公司",
161
+ "loadingCountry": "起运国",
162
+ "no": "No",
163
+ "operate": "操作",
164
+ "originCountry": "原产国",
165
+ "otherFile": "其他文件",
166
+ "upload_by": "上传时间 ",
167
+ "share": "分享",
168
+ "select_all":"全选照片",
169
+ "otherShipmentFile": "其他装运文件",
170
+ "packaging": "装箱",
171
+ "packingList": "装箱单",
172
+ "packingPhoto": "装箱照片",
173
+ "paymentTerms": "付款条款",
174
+ "paymentType": "付款类型",
175
+ "payment_voucher": "付款凭证",
176
+ "preferredQuoteMethod": "期望报价方式",
177
+ "preview": "预览",
178
+ "purchaseContract": "采购合同",
179
+ "quotePrice": "买家价格/MT",
180
+ "quoteType": "报价方式",
181
+ "relatedContract": "关联合同",
182
+ "remark": "备注",
183
+ "saleContract": "销售合同",
184
+ "saleFinallyInvoice": "最终尾款发票",
185
+ "normalFinallyInvoice": "正式尾款发票",
186
+ "sellerFinallyInvoice": "卖家采购尾款发票",
187
+ "uploadPurchaseInvoice": "上传采购尾款发票",
188
+ "saleTemporaryFinallyInvoice": "临时尾款发票",
189
+ "sellerPrice": "卖方价格/MT",
190
+ "shipmentDays": "装运时间",
191
+ "shipmentStatus": "物流状态",
192
+ "shipping": "装运",
193
+ "shipment": "装运",
194
+ "contract": "合同",
195
+ "receiving": "收货",
196
+ "progress": "进度",
197
+ "drag_and_upload": "将文件拖拽到此处上传",
198
+ "no_files": "暂无文件",
199
+ "add_success": "添加成功",
200
+ "has_copy": "已复制到剪切板",
201
+ "upload": "上传",
202
+ "signContract": "回签合同",
203
+ "signContract_success": "回签成功",
204
+ "release_success": "电放成功",
205
+ "withdraw_sign": "撤回回签",
206
+ "withdraw_sign_success": "撤回回签成功",
207
+ "signPuchaseContract": "回签采购合同",
208
+ "signSaleContract": "回签销售合同",
209
+
210
+ "containers_shipped":"柜待装运",
211
+ "packinglist_true": "装箱单已上传",
212
+ "packinglist_false": "装箱单待上传",
213
+ "balance_invoice_true": "发票、箱单已上传",
214
+ "balance_invoice_false": "尾款发票待上传",
215
+ "container_photos_true": "装箱照片已上传",
216
+ "container_photos_false": "装箱照片待上传",
217
+ "draftBl_true": "草稿提单已上传",
218
+ "draftBl_false": "草稿提单待上传",
219
+ "draftBl_buyer_confirm_true": "草稿提单已确认",
220
+ "draftBl_buyer_confirm_false": "草稿提单待买家确认",
221
+ "balancePartPaid_true": "尾款已部分支付",
222
+ "balancePartPaid_false": "尾款待买家支付",
223
+ "balancePaid_true": "尾款已支付",
224
+ "balancePaid_false": "尾款待买家支付",
225
+ "releasedTelex_true": "提货凭证已提供",
226
+ "releasedTelex_false": "提货凭证待提供",
227
+ "claiming": "索赔中",
228
+ "claiming_update": "文件已更新",
229
+ "claiming_closed": "索赔已关闭",
230
+ "draftContract_unsend": "草稿合同待发出",
231
+ "bl_confirm_true": "提单指令已确认",
232
+ "bl_confirm_false": "提单指令待买家确认",
233
+ "contract_send_true": "正式合同已发出",
234
+ "contract_send_false": "正式合同待发出",
235
+ "contract_signback_true": "回签合同已上传",
236
+ "contract_signback_false": "回签合同待上传",
237
+ "depositPaid_true": "定金已支付",
238
+ "depositPaid_false": "定金待支付",
239
+
240
+ "signed": "已签订",
241
+ "subCategory": "小类",
242
+ "summary": "订单概括",
243
+ "swift": "汇款凭证",
244
+ "tip1": "交付于 ",
245
+ "tip2": " 天后交易",
246
+ "tip3": "原产地证书",
247
+ "tip4": "是否包退运",
248
+ "tip5": "装运发货",
249
+ "tip6": "电放提单或其他凭证",
250
+ "tip7": "提货凭证",
251
+ "tip8": "合同履约完成",
252
+ "totalQuote": "总价/MT",
253
+ "viewPaymentInfo": "查看付款信息",
254
+ "voided": "已作废",
255
+ "voucherOrReceipt": "凭证/条款",
256
+ "weight": "重量(MT)",
257
+ "yes": "Yes"
258
+ }
259
+ }
@@ -404,3 +404,38 @@ export function encryptId(id) {
404
404
  const md5Hash = CryptoJS.MD5(id + data).toString();
405
405
  return md5Hash;
406
406
  }
407
+
408
+
409
+ /**
410
+ * @description: 判断链接是否好似图片
411
+ * @param {*} url
412
+ * @return {*}
413
+ */
414
+ export const isImage = (url) => {
415
+ return /^https?:\/\/.*\.(jpg|jpeg|png|gif|jfif|bmp|tiff|webp|heif|heic|svg|eps|ai|raw|dng|dwg|crd)$/i.test(url)
416
+ }
417
+
418
+ //判断链接是否是视频
419
+ export const isVideo = (url) => {
420
+ return /^https?:\/\/.*\.(mp4|avi|rmvb|rm|asf|divx|mpg|mpeg|mpe|wmv|mkv|vob|mov|3gp|ogg|flv|swf|f4v|webm|dat|ts|mts|dv|ogg)$/i.test(url)
421
+ }
422
+
423
+ export const isDoc = (url) => {
424
+ return url.toLowerCase().endsWith(".doc") || url.toLowerCase().endsWith(".docx")
425
+ }
426
+
427
+ export const isPdf = (url) => {
428
+ return url.toLowerCase().endsWith(".pdf")
429
+ }
430
+
431
+ export const isZip = (url) => {
432
+ return url.toLowerCase().endsWith(".zip") || url.toLowerCase().endsWith(".rar") || url.toLowerCase().endsWith(".7z") || url.toLowerCase().endsWith(".tar.gz")
433
+ }
434
+
435
+ export const isXls = (url) => {
436
+ return url.toLowerCase().endsWith(".xls") || url.toLowerCase().endsWith(".xlsx")
437
+ }
438
+
439
+ export const isPpt = (url) => {
440
+ return url.toLowerCase().endsWith(".ppt") || url.toLowerCase().endsWith(".pptx")
441
+ }
@@ -1,224 +1,198 @@
1
- import axios from "axios";
2
- import { Notification, MessageBox, Message, Loading } from "element-ui";
3
- import store from "../store";
4
- import { getToken } from "./auth";
5
- import errorCode from "./errorCode";
6
- import { tansParams, blobValidate } from "./ruoyi";
7
- import cache from "../plugins/cache";
8
- import { saveAs } from "file-saver";
9
- import Cookies from "js-cookie";
1
+ import axios from 'axios'
2
+ import { Notification, MessageBox, Message, Loading } from 'element-ui'
3
+ import store from '../store'
4
+ import { getToken } from './auth'
5
+ import errorCode from './errorCode'
6
+ import { tansParams, blobValidate } from './ruoyi'
7
+ import cache from '../plugins/cache'
8
+ import { saveAs } from 'file-saver'
9
+ import Cookies from 'js-cookie'
10
10
 
11
- let downloadLoadingInstance;
11
+ let downloadLoadingInstance
12
12
  // 是否显示重新登录
13
- export let isRelogin = { show: false };
13
+ export let isRelogin = { show: false }
14
14
 
15
- axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
15
+ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
16
16
  // 创建axios实例
17
17
  const service = axios.create({
18
18
  // axios中请求配置有baseURL选项,表示请求URL公共部分
19
- baseURL: "/prod-admin",
19
+ baseURL: '/prod-admin',
20
20
  // 超时
21
- timeout: 60000,
22
- });
21
+ timeout: 60000
22
+ })
23
23
 
24
24
  // request拦截器
25
25
  service.interceptors.request.use(
26
26
  (config) => {
27
27
  // 是否需要设置 token
28
- const isToken = (config.headers || {}).isToken === false;
28
+ const isToken = (config.headers || {}).isToken === false
29
29
  // 是否需要防止数据重复提交
30
- const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
31
- if (
32
- !config.url.includes("/api/transaction/list") &&
33
- getToken() &&
34
- !isToken
35
- ) {
36
- config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
30
+ const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
31
+ if (!config.url.includes('/api/transaction/list') && getToken() && !isToken) {
32
+ config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
37
33
  }
38
34
  // get请求映射params参数
39
- if (config.method === "get" && config.params) {
40
- let url = config.url + "?" + tansParams(config.params);
41
- url = url.slice(0, -1);
42
- config.params = {};
43
- config.url = url;
35
+ if (config.method === 'get' && config.params) {
36
+ let url = config.url + '?' + tansParams(config.params)
37
+ url = url.slice(0, -1)
38
+ config.params = {}
39
+ config.url = url
44
40
  }
45
- if (
46
- !isRepeatSubmit &&
47
- (config.method === "post" || config.method === "put")
48
- ) {
41
+ if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
49
42
  const requestObj = {
50
43
  url: config.url,
51
- data:
52
- typeof config.data === "object"
53
- ? JSON.stringify(config.data)
54
- : config.data,
55
- time: new Date().getTime(),
56
- };
57
- const sessionObj = cache.session.getJSON("sessionObj");
58
- if (
59
- sessionObj === undefined ||
60
- sessionObj === null ||
61
- sessionObj === ""
62
- ) {
63
- cache.session.setJSON("sessionObj", requestObj);
44
+ data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
45
+ time: new Date().getTime()
46
+ }
47
+ const sessionObj = cache.session.getJSON('sessionObj')
48
+ if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
49
+ cache.session.setJSON('sessionObj', requestObj)
64
50
  } else {
65
- const s_url = sessionObj.url; // 请求地址
66
- const s_data = sessionObj.data; // 请求数据
67
- const s_time = sessionObj.time; // 请求时间
68
- const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
69
- if (
70
- s_data === requestObj.data &&
71
- requestObj.time - s_time < interval &&
72
- s_url === requestObj.url
73
- ) {
74
- const message = "数据正在处理,请勿重复提交";
75
- console.warn(`[${s_url}]: ` + message);
76
- return Promise.reject(new Error(message));
51
+ const s_url = sessionObj.url // 请求地址
52
+ const s_data = sessionObj.data // 请求数据
53
+ const s_time = sessionObj.time // 请求时间
54
+ const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交
55
+ if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
56
+ const message = '数据正在处理,请勿重复提交'
57
+ console.warn(`[${s_url}]: ` + message)
58
+ return Promise.reject(new Error(message))
77
59
  } else {
78
- cache.session.setJSON("sessionObj", requestObj);
60
+ cache.session.setJSON('sessionObj', requestObj)
79
61
  }
80
62
  }
81
63
  }
82
64
 
83
- if (config.url.includes("/order/tracing?askId")) {
84
- config.baseURL = "";
85
- const token = Cookies.get("token");
86
- config.headers.token = token;
65
+ if (config.url.includes('/order/tracing?askId')) {
66
+ config.baseURL = ''
67
+ const token = Cookies.get('token')
68
+ config.headers.token = token
87
69
  }
88
- return config;
70
+ return config
89
71
  },
90
72
  (error) => {
91
- console.log(error);
92
- Promise.reject(error);
73
+ console.log(error)
74
+ Promise.reject(error)
93
75
  }
94
- );
76
+ )
95
77
 
96
78
  // 响应拦截器
97
79
  service.interceptors.response.use(
98
80
  (res) => {
99
81
  // 未设置状态码则默认成功状态
100
- const code = res.data.code || 200;
82
+ const code = res.data.code || 200
101
83
  // 获取错误信息
102
- const msg = errorCode[code] || res.data.msg || errorCode["default"];
84
+ const msg = errorCode[code] || res.data.msg || errorCode['default']
103
85
  // 二进制数据则直接返回
104
- if (
105
- res.request.responseType === "blob" ||
106
- res.request.responseType === "arraybuffer"
107
- ) {
108
- return res.data;
86
+ if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
87
+ return res.data
109
88
  }
110
89
  if (code === 401) {
111
90
  if (!isRelogin.show) {
112
- isRelogin.show = true;
113
- MessageBox.confirm(
114
- "登录状态已过期,您可以继续留在该页面,或者重新登录",
115
- "系统提示",
116
- {
117
- confirmButtonText: "重新登录",
118
- cancelButtonText: "取消",
119
- type: "warning",
120
- }
121
- )
91
+ isRelogin.show = true
92
+ MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
93
+ confirmButtonText: '重新登录',
94
+ cancelButtonText: '取消',
95
+ type: 'warning'
96
+ })
122
97
  .then(() => {
123
- isRelogin.show = false;
124
- store.dispatch("LogOut").then(() => {
125
- location.href = "/index";
126
- });
98
+ isRelogin.show = false
99
+ store.dispatch('LogOut').then(() => {
100
+ location.href = '/index'
101
+ })
127
102
  })
128
103
  .catch(() => {
129
- isRelogin.show = false;
130
- });
104
+ isRelogin.show = false
105
+ })
131
106
  }
132
- return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
107
+ return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
133
108
  } else if (code === 500) {
134
109
  Message({
135
110
  message: msg,
136
- type: "error",
137
- });
138
-
139
- return Promise.reject(new Error(msg));
111
+ type: 'error'
112
+ })
113
+ return res.data
140
114
  } else if (code !== 200) {
141
- Notification.error({
142
- title: msg,
143
- });
144
- return Promise.reject("error");
115
+ Message({
116
+ message: msg,
117
+ type: 'error'
118
+ })
119
+ return res.data
145
120
  } else {
146
- return res.data;
121
+ return res.data
147
122
  }
148
123
  },
149
124
  (error) => {
150
- console.log("err" + error);
151
- let { message } = error;
152
- if (message == "Network Error") {
153
- message = "后端接口连接异常";
154
- } else if (message.includes("timeout")) {
155
- message = "系统接口请求超时";
156
- } else if (message.includes("Request failed with status code")) {
157
- message = "系统接口" + message.substr(message.length - 3) + "异常";
125
+ console.log('err' + error)
126
+ let { message } = error
127
+ if (message == 'Network Error') {
128
+ message = '后端接口连接异常'
129
+ } else if (message.includes('timeout')) {
130
+ message = '系统接口请求超时'
131
+ } else if (message.includes('Request failed with status code')) {
132
+ message = '系统接口' + message.substr(message.length - 3) + '异常'
158
133
  }
159
134
  Message({
160
135
  message: message,
161
- type: "error",
162
- duration: 5 * 1000,
163
- });
164
- return Promise.reject(error);
136
+ type: 'error',
137
+ duration: 5 * 1000
138
+ })
139
+ return Promise.reject(error)
165
140
  }
166
- );
141
+ )
167
142
 
168
143
  // 通用下载方法
169
144
  export function download(url, params, filename) {
170
145
  downloadLoadingInstance = Loading.service({
171
- text: "正在下载数据,请稍候",
172
- spinner: "el-icon-loading",
173
- background: "rgba(0, 0, 0, 0.7)",
174
- });
146
+ text: '正在下载数据,请稍候',
147
+ spinner: 'el-icon-loading',
148
+ background: 'rgba(0, 0, 0, 0.7)'
149
+ })
175
150
  return service
176
151
  .post(url, params, {
177
152
  transformRequest: [
178
153
  (params) => {
179
- return tansParams(params);
180
- },
154
+ return tansParams(params)
155
+ }
181
156
  ],
182
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
183
- responseType: "blob",
157
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
158
+ responseType: 'blob'
184
159
  })
185
160
  .then(async (data) => {
186
- const isLogin = await blobValidate(data);
161
+ const isLogin = await blobValidate(data)
187
162
  if (isLogin) {
188
- const blob = new Blob([data]);
189
- saveAs(blob, filename);
163
+ const blob = new Blob([data])
164
+ saveAs(blob, filename)
190
165
  } else {
191
- const resText = await data.text();
192
- const rspObj = JSON.parse(resText);
193
- const errMsg =
194
- errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
195
- Message.error(errMsg);
166
+ const resText = await data.text()
167
+ const rspObj = JSON.parse(resText)
168
+ const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
169
+ Message.error(errMsg)
196
170
  }
197
- downloadLoadingInstance.close();
171
+ downloadLoadingInstance.close()
198
172
  })
199
173
  .catch((r) => {
200
- console.error(r);
201
- Message.error("下载文件出现错误,请联系管理员!");
202
- downloadLoadingInstance.close();
203
- });
174
+ console.error(r)
175
+ Message.error('下载文件出现错误,请联系管理员!')
176
+ downloadLoadingInstance.close()
177
+ })
204
178
  }
205
179
 
206
180
  export function downloadFile(url, filename) {
207
- let xmlhttp = new XMLHttpRequest();
208
- xmlhttp.open("GET", url, true);
209
- xmlhttp.responseType = "blob";
181
+ let xmlhttp = new XMLHttpRequest()
182
+ xmlhttp.open('GET', url, true)
183
+ xmlhttp.responseType = 'blob'
210
184
  xmlhttp.onload = function () {
211
185
  if (this.status == 200) {
212
- const blob = this.response;
213
- const link = document.createElement("a");
214
- link.href = window.URL.createObjectURL(blob);
215
- link.download = filename;
216
- document.body.appendChild(link);
217
- link.click();
218
- document.body.removeChild(link);
186
+ const blob = this.response
187
+ const link = document.createElement('a')
188
+ link.href = window.URL.createObjectURL(blob)
189
+ link.download = filename
190
+ document.body.appendChild(link)
191
+ link.click()
192
+ document.body.removeChild(link)
219
193
  }
220
- };
221
- xmlhttp.send();
194
+ }
195
+ xmlhttp.send()
222
196
  }
223
197
 
224
- export default service;
198
+ export default service