|
|
|
@ -1,15 +1,10 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="topTable">
|
|
|
|
|
<BasicTable
|
|
|
|
|
class="ds-table"
|
|
|
|
|
@register="registerTable"
|
|
|
|
|
@row-dbClick="
|
|
|
|
|
(e) => {
|
|
|
|
|
GoDetailed(true, e)
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<BasicTable class="ds-table" @register="registerTable" @row-dbClick="(e) => {
|
|
|
|
|
GoDetailed(true, e)
|
|
|
|
|
}
|
|
|
|
|
">
|
|
|
|
|
<template #tableTitle>
|
|
|
|
|
<div class="buttonGroup">
|
|
|
|
|
<a-button v-repeat type="link">
|
|
|
|
@ -20,11 +15,11 @@
|
|
|
|
|
<span class="iconfont icon-locksuo IconColor"></span>
|
|
|
|
|
导出EXCEL
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button v-repeat type="link">
|
|
|
|
|
<a-button @click="handleApply" v-repeat type="link">
|
|
|
|
|
<span class="iconfont icon-locksuo IconColor"></span>
|
|
|
|
|
提交审核
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button v-repeat type="link">
|
|
|
|
|
<a-button @click="handleWithdraw" v-repeat type="link">
|
|
|
|
|
<span class="iconfont icon-locksuo IconColor"></span>
|
|
|
|
|
撤销审核
|
|
|
|
|
</a-button>
|
|
|
|
@ -35,12 +30,7 @@
|
|
|
|
|
<span class="iconfont icon-new_document"></span>
|
|
|
|
|
添加
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-popconfirm
|
|
|
|
|
title="确定删除当前选中数据?"
|
|
|
|
|
ok-text="是"
|
|
|
|
|
cancel-text="否"
|
|
|
|
|
@confirm="FnDel"
|
|
|
|
|
>
|
|
|
|
|
<a-popconfirm title="确定删除当前选中数据?" ok-text="是" cancel-text="否" @confirm="FnDel">
|
|
|
|
|
<a-button type="link">
|
|
|
|
|
<span class="iconfont icon-shanchu21"></span>
|
|
|
|
|
删除
|
|
|
|
@ -53,17 +43,15 @@
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:bodyCell="{ column, record }">
|
|
|
|
|
<template v-if="column.key === 'action'">
|
|
|
|
|
<TableAction
|
|
|
|
|
:actions="[
|
|
|
|
|
{
|
|
|
|
|
icon: 'clarity:note-edit-line',
|
|
|
|
|
tooltip: '编辑',
|
|
|
|
|
onClick: () => {
|
|
|
|
|
GoDetailed(true, record)
|
|
|
|
|
},
|
|
|
|
|
<TableAction :actions="[
|
|
|
|
|
{
|
|
|
|
|
icon: 'clarity:note-edit-line',
|
|
|
|
|
tooltip: '编辑',
|
|
|
|
|
onClick: () => {
|
|
|
|
|
GoDetailed(true, record)
|
|
|
|
|
},
|
|
|
|
|
]"
|
|
|
|
|
/>
|
|
|
|
|
},
|
|
|
|
|
]" />
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
@ -81,149 +69,186 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { GetList,InvoiceApplicationDelete} from './api.js'
|
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
|
|
|
|
import { columns, searchFormSchema, billTypeData } from './columns'
|
|
|
|
|
import { GetOpenPrintModuleList } from '/@/views/operation/seaexport/api/BookingLedger.js'
|
|
|
|
|
import * as XLSX from 'xlsx'
|
|
|
|
|
import DsPrint from '/@/components/Print/index.vue'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const { notification } = useMessage()
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
import { useGo } from '/@/hooks/web/usePage'
|
|
|
|
|
const go = useGo()
|
|
|
|
|
// 引入处理入参方法
|
|
|
|
|
import { formatParams } from '/@/hooks/web/common'
|
|
|
|
|
import { useAppStore } from '/@/store/modules/app'
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
// 表格
|
|
|
|
|
const [registerTable, { reload, getPaginationRef, getSelectRows, getRawDataSource }] = useTable({
|
|
|
|
|
title: '',
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await GetList(p)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
resolve({ data: [...res.data], total: res.count })
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 请求前的参数格式化
|
|
|
|
|
beforeFetch: (p) => {
|
|
|
|
|
return formatParams(p)
|
|
|
|
|
},
|
|
|
|
|
columns,
|
|
|
|
|
formConfig: {
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
schemas: searchFormSchema,
|
|
|
|
|
useAdvancedSearch: true,
|
|
|
|
|
},
|
|
|
|
|
isTreeTable: false,
|
|
|
|
|
pagination: true,
|
|
|
|
|
striped: true,
|
|
|
|
|
useSearchForm: true,
|
|
|
|
|
showTableSetting: true,
|
|
|
|
|
bordered: true,
|
|
|
|
|
showIndexColumn: true,
|
|
|
|
|
indexColumnProps: {
|
|
|
|
|
width: 60,
|
|
|
|
|
},
|
|
|
|
|
canResize: true,
|
|
|
|
|
immediate: true,
|
|
|
|
|
actionColumn: {
|
|
|
|
|
width: 80,
|
|
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'action',
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
},
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { GetList, InvoiceApplicationDelete, Withdraw, ApplyAudit } from './api.js'
|
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
|
|
|
|
import { columns, searchFormSchema, billTypeData } from './columns'
|
|
|
|
|
import { GetOpenPrintModuleList } from '/@/views/operation/seaexport/api/BookingLedger.js'
|
|
|
|
|
import * as XLSX from 'xlsx'
|
|
|
|
|
import DsPrint from '/@/components/Print/index.vue'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const { notification } = useMessage()
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
import { useGo } from '/@/hooks/web/usePage'
|
|
|
|
|
const go = useGo()
|
|
|
|
|
// 引入处理入参方法
|
|
|
|
|
import { formatParams } from '/@/hooks/web/common'
|
|
|
|
|
import { useAppStore } from '/@/store/modules/app'
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
// 表格
|
|
|
|
|
const [registerTable, { reload, getPaginationRef, getSelectRows, getRawDataSource }] = useTable({
|
|
|
|
|
title: '',
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await GetList(p)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
resolve({ data: [...res.data], total: res.count })
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 请求前的参数格式化
|
|
|
|
|
beforeFetch: (p) => {
|
|
|
|
|
return formatParams(p)
|
|
|
|
|
},
|
|
|
|
|
columns,
|
|
|
|
|
formConfig: {
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
schemas: searchFormSchema,
|
|
|
|
|
useAdvancedSearch: true,
|
|
|
|
|
},
|
|
|
|
|
isTreeTable: false,
|
|
|
|
|
pagination: true,
|
|
|
|
|
striped: true,
|
|
|
|
|
useSearchForm: true,
|
|
|
|
|
showTableSetting: true,
|
|
|
|
|
bordered: true,
|
|
|
|
|
showIndexColumn: true,
|
|
|
|
|
indexColumnProps: {
|
|
|
|
|
width: 60,
|
|
|
|
|
},
|
|
|
|
|
canResize: true,
|
|
|
|
|
immediate: true,
|
|
|
|
|
actionColumn: {
|
|
|
|
|
width: 80,
|
|
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'action',
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
// 新增 编辑
|
|
|
|
|
function GoDetailed(type, data) {
|
|
|
|
|
if (type) {
|
|
|
|
|
go(`/invoiceapplyDetail?id=${data.id}`)
|
|
|
|
|
} else {
|
|
|
|
|
go(`/invoiceapplyDetail`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 删除
|
|
|
|
|
function FnDel() {
|
|
|
|
|
let ids = []
|
|
|
|
|
ids = getSelectRows().map((item) => {
|
|
|
|
|
return item.id
|
|
|
|
|
})
|
|
|
|
|
// 新增 编辑
|
|
|
|
|
function GoDetailed(type, data) {
|
|
|
|
|
if (type) {
|
|
|
|
|
go(`/invoiceapplyDetail?id=${data.id}`)
|
|
|
|
|
} else {
|
|
|
|
|
go(`/invoiceapplyDetail`)
|
|
|
|
|
}
|
|
|
|
|
if (ids.length == 0) {
|
|
|
|
|
createMessage.error('请选择要删除的数据')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
// 删除
|
|
|
|
|
function FnDel() {
|
|
|
|
|
const ids = getSelectRows().map((item) => {
|
|
|
|
|
return item.id
|
|
|
|
|
})
|
|
|
|
|
InvoiceApplicationDelete({ids:ids}).then(res=>{
|
|
|
|
|
if(res.succeeded){
|
|
|
|
|
createMessage.success('删除成功')
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
InvoiceApplicationDelete({ ids: ids }).then(res => {
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
createMessage.success('删除成功')
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function handleApply() {
|
|
|
|
|
let ids = []
|
|
|
|
|
ids = getSelectRows().map((item) => {
|
|
|
|
|
return item.id
|
|
|
|
|
})
|
|
|
|
|
if (ids.length == 0) {
|
|
|
|
|
createMessage.error('请选择数据')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
ApplyAudit({ ids: ids }).then(res => {
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
createMessage.success('操作成功')
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleWithdraw() {
|
|
|
|
|
let ids = []
|
|
|
|
|
ids = getSelectRows().map((item) => {
|
|
|
|
|
return item.id
|
|
|
|
|
})
|
|
|
|
|
if (ids.length == 0) {
|
|
|
|
|
createMessage.error('请选择数据')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
Withdraw({ ids: ids }).then(res => {
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
createMessage.success('操作成功')
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 导出 EXCEL
|
|
|
|
|
function ExportExcel() {
|
|
|
|
|
let Data: any = []
|
|
|
|
|
let DelData = ['id', 'bsno', 'ctnCode']
|
|
|
|
|
getRawDataSource().forEach((item, index) => {
|
|
|
|
|
let Obj = {}
|
|
|
|
|
Object.keys(item).forEach((item2) => {
|
|
|
|
|
if (!DelData.includes(item2)) {
|
|
|
|
|
columns.forEach((e) => {
|
|
|
|
|
if (e.dataIndex == item2) {
|
|
|
|
|
if (e.title == '收付类型') {
|
|
|
|
|
let data = ''
|
|
|
|
|
billTypeData.forEach((d) => {
|
|
|
|
|
if (d.code == item[item2]) {
|
|
|
|
|
data = d.value
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Obj[e.title] = data
|
|
|
|
|
} else {
|
|
|
|
|
Obj[e.title] = item[item2]
|
|
|
|
|
}
|
|
|
|
|
// 导出 EXCEL
|
|
|
|
|
function ExportExcel() {
|
|
|
|
|
let Data: any = []
|
|
|
|
|
let DelData = ['id', 'bsno', 'ctnCode']
|
|
|
|
|
getRawDataSource().forEach((item, index) => {
|
|
|
|
|
let Obj = {}
|
|
|
|
|
Object.keys(item).forEach((item2) => {
|
|
|
|
|
if (!DelData.includes(item2)) {
|
|
|
|
|
columns.forEach((e) => {
|
|
|
|
|
if (e.dataIndex == item2) {
|
|
|
|
|
if (e.title == '收付类型') {
|
|
|
|
|
let data = ''
|
|
|
|
|
billTypeData.forEach((d) => {
|
|
|
|
|
if (d.code == item[item2]) {
|
|
|
|
|
data = d.value
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Obj[e.title] = data
|
|
|
|
|
} else {
|
|
|
|
|
Obj[e.title] = item[item2]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Data.push(Obj)
|
|
|
|
|
console.log(Data)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 创建工作簿
|
|
|
|
|
const workbook = XLSX.utils.book_new()
|
|
|
|
|
// 将数据转换为工作表
|
|
|
|
|
const worksheet = XLSX.utils.json_to_sheet(Data)
|
|
|
|
|
// 将工作表添加到工作簿
|
|
|
|
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
|
|
|
|
|
// 生成Excel的配置
|
|
|
|
|
const wbout = XLSX.write(workbook, { bookType: 'xlsx', type: 'binary' })
|
|
|
|
|
// 创建二进制对象并创建url
|
|
|
|
|
const blob = new Blob([s2ab(wbout)], { type: 'application/octet-stream' })
|
|
|
|
|
const url = URL.createObjectURL(blob)
|
|
|
|
|
// 创建a标签模拟点击进行下载
|
|
|
|
|
const a = document.createElement('a')
|
|
|
|
|
a.href = url
|
|
|
|
|
a.download = '客户对账.xlsx'
|
|
|
|
|
document.body.appendChild(a)
|
|
|
|
|
a.click()
|
|
|
|
|
Data.push(Obj)
|
|
|
|
|
console.log(Data)
|
|
|
|
|
})
|
|
|
|
|
// 创建工作簿
|
|
|
|
|
const workbook = XLSX.utils.book_new()
|
|
|
|
|
// 将数据转换为工作表
|
|
|
|
|
const worksheet = XLSX.utils.json_to_sheet(Data)
|
|
|
|
|
// 将工作表添加到工作簿
|
|
|
|
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
|
|
|
|
|
// 生成Excel的配置
|
|
|
|
|
const wbout = XLSX.write(workbook, { bookType: 'xlsx', type: 'binary' })
|
|
|
|
|
// 创建二进制对象并创建url
|
|
|
|
|
const blob = new Blob([s2ab(wbout)], { type: 'application/octet-stream' })
|
|
|
|
|
const url = URL.createObjectURL(blob)
|
|
|
|
|
// 创建a标签模拟点击进行下载
|
|
|
|
|
const a = document.createElement('a')
|
|
|
|
|
a.href = url
|
|
|
|
|
a.download = '客户对账.xlsx'
|
|
|
|
|
document.body.appendChild(a)
|
|
|
|
|
a.click()
|
|
|
|
|
|
|
|
|
|
// 清除对象URL
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
URL.revokeObjectURL(url)
|
|
|
|
|
document.body.removeChild(a)
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
// 将字符串转换为ArrayBuffer
|
|
|
|
|
function s2ab(s) {
|
|
|
|
|
const buf = new ArrayBuffer(s.length)
|
|
|
|
|
const view = new Uint8Array(buf)
|
|
|
|
|
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xff
|
|
|
|
|
return buf
|
|
|
|
|
}
|
|
|
|
|
const dsPrint = ref()
|
|
|
|
|
// 打印费用
|
|
|
|
|
async function printFee() {
|
|
|
|
|
dsPrint.value.init()
|
|
|
|
|
}
|
|
|
|
|
// 清除对象URL
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
URL.revokeObjectURL(url)
|
|
|
|
|
document.body.removeChild(a)
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
// 将字符串转换为ArrayBuffer
|
|
|
|
|
function s2ab(s) {
|
|
|
|
|
const buf = new ArrayBuffer(s.length)
|
|
|
|
|
const view = new Uint8Array(buf)
|
|
|
|
|
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xff
|
|
|
|
|
return buf
|
|
|
|
|
}
|
|
|
|
|
const dsPrint = ref()
|
|
|
|
|
// 打印费用
|
|
|
|
|
async function printFee() {
|
|
|
|
|
dsPrint.value.init()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.topTable {
|
|
|
|
|
height: calc(100vh - 145px);
|
|
|
|
|
}
|
|
|
|
|
.topTable {
|
|
|
|
|
height: calc(100vh - 145px);
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|