diff --git a/src/api/accounting/invoices.js b/src/api/accounting/invoices.js new file mode 100644 index 00000000..835fabe4 --- /dev/null +++ b/src/api/accounting/invoices.js @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// 创建发票 +export function createInvoices(data) { + return request({ + url: '/accounting/invoices/create', + method: 'post', + data: data + }) +} + +// 更新发票 +export function updateInvoices(data) { + return request({ + url: '/accounting/invoices/update', + method: 'put', + data: data + }) +} + +// 删除发票 +export function deleteInvoices(id) { + return request({ + url: '/accounting/invoices/delete?id=' + id, + method: 'delete' + }) +} + +// 获得发票 +export function getInvoices(id) { + return request({ + url: '/accounting/invoices/get?id=' + id, + method: 'get' + }) +} + +// 获得发票分页 +export function getInvoicesPage(query) { + return request({ + url: '/accounting/invoices/page', + method: 'get', + params: query + }) +} + +// 导出发票 Excel +export function exportInvoicesExcel(query) { + return request({ + url: '/accounting/invoices/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} diff --git a/src/main.js b/src/main.js index ffefed1c..34602e78 100644 --- a/src/main.js +++ b/src/main.js @@ -96,3 +96,35 @@ new Vue({ store, render: h => h(App) }) + +// 定义全局方法 +Vue.prototype.base64Encode = function(str) { + const base64EncodeChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + let out = '', i = 0, len = str.length; + let c1, c2, c3; + + while (i < len) { + c1 = str.charCodeAt(i++) & 0xff; + if (i == len) { + out += base64EncodeChars.charAt(c1 >> 2); + out += base64EncodeChars.charAt((c1 & 0x3) << 4); + out += '=='; + break; + } + c2 = str.charCodeAt(i++); + if (i == len) { + out += base64EncodeChars.charAt(c1 >> 2); + out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); + out += base64EncodeChars.charAt((c2 & 0xF) << 2); + out += '='; + break; + } + c3 = str.charCodeAt(i++); + out += base64EncodeChars.charAt(c1 >> 2); + out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); + out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)); + out += base64EncodeChars.charAt(c3 & 0x3F); + } + return out; +} + diff --git a/src/views/accounting/invoices/index.vue b/src/views/accounting/invoices/index.vue new file mode 100644 index 00000000..f56758c7 --- /dev/null +++ b/src/views/accounting/invoices/index.vue @@ -0,0 +1,752 @@ + + +