szh-new
张同海 5 months ago
parent 74ab977de9
commit 2424dc9001

@ -1,25 +1,32 @@
import {
GetClientSourceSelectList,
GetClientStlModeSelectList,
GetVesselSelectList
GetVesselSelectList,
} from '/@/views/operation/seaexport/api/BookingLedger'
import { GetFeeCurrencySelectList } from '/@/api/common/index'
export default {
// 业务来源
GetClientSourceSelectList: () => {
return GetClientSourceSelectList().then(res => {
return GetClientSourceSelectList().then((res) => {
return res.data
})
},
// 结算方式
GetClientStlModeSelectList: () => {
return GetClientStlModeSelectList().then(res => {
return GetClientStlModeSelectList().then((res) => {
return res.data
})
},
// 船名
GetVesselSelectList: () => {
return GetVesselSelectList().then(res => {
return GetVesselSelectList().then((res) => {
return res.data
})
}
}
},
// 币别
GetFeeCurrencySelectList: () => {
return GetFeeCurrencySelectList().then((res) => {
return res.data
})
},
}

@ -16,6 +16,8 @@ export const useOptionsStore = defineStore({
GetClientStlModeSelectList: [],
// 船名
GetVesselSelectList: [],
// 币别
GetFeeCurrencySelectList: [],
}),
getters: {
// 通过code获取下拉字典code)就是接口尾部单词
@ -25,11 +27,11 @@ export const useOptionsStore = defineStore({
return store.$state[code]
} else {
// 没有值调用接口存数据
store.setOptionsByCode(code).then(res => {
store.setOptionsByCode(code).then((res) => {
return res
})
}
}
},
},
actions: {
/**
@ -38,12 +40,12 @@ export const useOptionsStore = defineStore({
*/
setOptionsByCode(code) {
const options = Config[code]()
return options.then(res => {
return options.then((res) => {
this[code] = res
return res
})
}
}
},
},
})
// Need to be used outside the setup

@ -1,6 +1,7 @@
import { BasicColumn, FormSchema } from '/@/components/Table'
export const searchFormSchema: FormSchema[] = [
{ field: 'billNo', label: '对账编号', component: 'Input', colProps: { span: 4 } },
{ field: 'customerName', label: '对账客户名称', component: 'Input', colProps: { span: 4 } },
// {
// field: 'mblno',
// label: '对账客户',
@ -74,7 +75,7 @@ export const searchFormSchema: FormSchema[] = [
// colProps: { span: 2 },
// },
]
const billTypeData = [
export const billTypeData = [
{ code: 0, value: '全部' },
{ code: 1, value: '应收' },
{ code: 2, value: '应付' },
@ -108,4 +109,7 @@ export const columns: BasicColumn[] = [
{ title: '未付RMB', dataIndex: 'balrmbcr', align: 'left' },
{ title: '应付USD', dataIndex: 'usdcr', align: 'left' },
{ title: '未付USD', dataIndex: 'balusdcr', align: 'left' },
{ title: '对账时间', dataIndex: 'createTime', align: 'left' },
{ title: '对账人', dataIndex: 'createByName', align: 'left' },
{ title: '备注', dataIndex: 'note', align: 'left' },
]

@ -9,6 +9,7 @@
@cancel="closeModal"
:defaultFullscreen="true"
:canFullscreen="false"
:showFooter="false"
>
<div class="CsMain">
<a-row class="p-4 CsHeader" :gutter="5">

@ -17,18 +17,38 @@
<div class="nav" @click="GoDetailed(false, null)">
<i class="iconfont icon-jiahao2fill"></i>新建
</div>
<div class="nav" @click="FnDel"> <i class="iconfont icon-shanchu"></i>删除 </div>
<div class="nav" @click="Lock">
<Icon icon="ant-design:lock-outlined" class="iconfont" />
锁定
</div>
<div class="nav" @click="UnLock">
<Icon icon="ant-design:unlock-outlined" class="iconfont" />
撤销锁定
</div>
<div class="nav" @click="ExportExcel">
<i class="iconfont icon-weibiaoti--"></i>EXCEL导出
</div>
<div class="nav" @click="printFee"> <i class="iconfont icon-xiaopiaodayin"></i>打印 </div>
</div>
</template>
</BasicTable>
<DsPrint ref="dsPrint" name="客户对账"></DsPrint>
</template>
<script lang="ts" setup>
import { GetCheckBillList } from './api.js'
import { ref } from 'vue'
import { GetCheckBillList, CheckBillLocking, CheckBillUnLocking } from './api.js'
import { BasicTable, useTable } from '/@/components/Table'
import { columns, searchFormSchema } from './columns'
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()
import { useGo } from '/@/hooks/web/usePage'
const go = useGo()
//
const [registerTable, { reload, getForm, getPaginationRef, getSelectRows }] = useTable({
const [registerTable, { getForm, getPaginationRef, getSelectRows, getRawDataSource }] = useTable({
title: '',
api: async (p) => {
const res: API.DataResult = await GetCheckBillList(p)
@ -47,6 +67,10 @@
sortConditions: [],
},
}
postParam.pageCondition.sortConditions.push({
sortField: 'createTime',
listSortDirection: 1,
})
let condition: API.ConditionItem[] = []
if (!!data.billNo) {
condition.push({
@ -55,6 +79,13 @@
ConditionalType: 1,
})
}
if (!!data.customerName) {
condition.push({
FieldName: 'customerName',
FieldValue: data.customerName,
ConditionalType: 1,
})
}
postParam.queryCondition = JSON.stringify(condition)
return postParam
},
@ -74,16 +105,110 @@
resizeHeightOffset: 35,
immediate: true,
})
//
function GoDetailed(type, data) {
console.log(type, data)
if (type) {
console.log(data)
go(`/CustomerReconciliationDetails?id=${data.id}`)
} else {
go(`/CustomerReconciliationDetails`)
}
}
//
function FnDel() {
notification.warning({ message: '待开发', duration: 3 })
}
//
function Lock() {
let ApiData: any = {
ids: [],
}
getSelectRows().forEach((e) => {
ApiData.ids.push(e.id)
})
CheckBillLocking(ApiData).then((res) => {
if (res.succeeded) {
notification.success({ message: '锁定成功', duration: 3 })
}
})
}
//
function UnLock() {
let ApiData: any = {
ids: [],
}
getSelectRows().forEach((e) => {
ApiData.ids.push(e.id)
})
CheckBillUnLocking(ApiData).then((res) => {
if (res.succeeded) {
notification.success({ message: '解除锁定成功', duration: 3 })
}
})
}
// 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)
})
// 簿
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()
}
</script>
<style lang="less">

@ -131,166 +131,171 @@
// size: 'small',
})
async function submit() {
let data = getFieldsValue2()
setTimeout(() => {
let data = getFieldsValue2()
console.log(data, 11111111111)
let SS = data.pkgs
if (SS) {
let GetStringNum = (str) => {
var num = 0
if (str == null || str == '') return num
if (str.length == 0) return num
var if_find = false
var str_num = ''
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1)
if (
member == '0' ||
member == '1' ||
member == '2' ||
member == '3' ||
member == '4' ||
member == '5' ||
member == '6' ||
member == '7' ||
member == '8' ||
member == '9' ||
member == '.' ||
member == '-'
) {
if (!if_find) {
str_num = str_num + member
let SS = data.pkgs
if (SS) {
let GetStringNum = (str) => {
var num = 0
if (str == null || str == '') return num
if (str.length == 0) return num
var if_find = false
var str_num = ''
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1)
if (
member == '0' ||
member == '1' ||
member == '2' ||
member == '3' ||
member == '4' ||
member == '5' ||
member == '6' ||
member == '7' ||
member == '8' ||
member == '9' ||
member == '.' ||
member == '-'
) {
if (!if_find) {
str_num = str_num + member
}
} else {
if_find = true
}
} else {
if_find = true
}
return str_num
}
return str_num
}
let ToEn = (a) => {
// eslint-disable-next-line no-array-constructor
const arr1 = new Array('', ' thousand', ' million', ' billion')
const b = a.length
let f: any = null
let h = 0
let g = ''
const e = Math.ceil(b / 3)
const k = b - e * 3
g = ''
for (f = k; f < b; f += 3) {
++h
// eslint-disable-next-line no-undef
const num3 = f >= 0 ? a.substring(f, f + 3) : a.substring(0, k + 3)
// eslint-disable-next-line no-undef
const strEng = English(num3)
// eslint-disable-next-line eqeqeq
if (strEng != '') {
let ToEn = (a) => {
// eslint-disable-next-line no-array-constructor
const arr1 = new Array('', ' thousand', ' million', ' billion')
const b = a.length
let f: any = null
let h = 0
let g = ''
const e = Math.ceil(b / 3)
const k = b - e * 3
g = ''
for (f = k; f < b; f += 3) {
++h
// eslint-disable-next-line no-undef
const num3 = f >= 0 ? a.substring(f, f + 3) : a.substring(0, k + 3)
// eslint-disable-next-line no-undef
const strEng = English(num3)
// eslint-disable-next-line eqeqeq
if (g != '') g += ' '
g += English(num3) + arr1[e - h]
if (strEng != '') {
// eslint-disable-next-line eqeqeq
if (g != '') g += ' '
g += English(num3) + arr1[e - h]
}
}
return g
}
return g
}
let English = (a) => {
// eslint-disable-next-line no-array-constructor
var arr2 = new Array(
'zero',
'ten',
'twenty',
'thirty',
'forty',
'fifty',
'sixty',
'seventy',
'eighty',
'ninety',
)
// eslint-disable-next-line no-array-constructor
var arr3 = new Array(
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
'nine',
)
// eslint-disable-next-line no-array-constructor
var arr4 = new Array(
'ten',
'eleven',
'twelve',
'thirteen',
'fourteen',
'fifteen',
'sixteen',
'seventeen',
'eighteen',
'nineteen',
)
let English = (a) => {
// eslint-disable-next-line no-array-constructor
var arr2 = new Array(
'zero',
'ten',
'twenty',
'thirty',
'forty',
'fifty',
'sixty',
'seventy',
'eighty',
'ninety',
)
// eslint-disable-next-line no-array-constructor
var arr3 = new Array(
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
'nine',
)
// eslint-disable-next-line no-array-constructor
var arr4 = new Array(
'ten',
'eleven',
'twelve',
'thirteen',
'fourteen',
'fifteen',
'sixteen',
'seventeen',
'eighteen',
'nineteen',
)
let strRet = ''
// eslint-disable-next-line eqeqeq
if (a.length == 3 && a.substr(0, 3) != '000') {
if (a.substr(0, 1) != '0') {
strRet += arr3[a.substr(0, 1)] + ' hundred'
if (a.substr(1, 2) != '00') strRet += ' and '
} else {
strRet += ' and '
}
a = a.substring(1)
}
if (a.length == 2) {
if (a.substr(0, 1) == '0') a = a.substring(1)
else if (a.substr(0, 1) == '1') strRet += arr4[a.substr(1, 2)]
else {
strRet += arr2[a.substr(0, 1)]
if (a.substr(1, 1) != '0') strRet += '-'
let strRet = ''
// eslint-disable-next-line eqeqeq
if (a.length == 3 && a.substr(0, 3) != '000') {
if (a.substr(0, 1) != '0') {
strRet += arr3[a.substr(0, 1)] + ' hundred'
if (a.substr(1, 2) != '00') strRet += ' and '
} else {
strRet += ' and '
}
a = a.substring(1)
}
}
if (a.length == 1 && a.substr(0, 1) != '0') strRet += arr3[a.substr(0, 1)]
return strRet
}
SS = SS.toString()
const i = SS.indexOf('\n')
let num = 0
let strKind: any = ''
let enCapital = ''
if (i > 0) {
const slist = SS.split('\n')
for (let i = 0; i < slist.length; i += 1) {
const member = slist[i]
const strNum: any = GetStringNum(member)
if (i == 0) {
strKind = member.substring(strNum.length)
if (a.length == 2) {
if (a.substr(0, 1) == '0') a = a.substring(1)
else if (a.substr(0, 1) == '1') strRet += arr4[a.substr(1, 2)]
else {
strRet += arr2[a.substr(0, 1)]
if (a.substr(1, 1) != '0') strRet += '-'
a = a.substring(1)
}
}
num = parseFloat(num).add(parseFloat(strNum))
if (a.length == 1 && a.substr(0, 1) != '0') strRet += arr3[a.substr(0, 1)]
return strRet
}
SS = SS.toString()
const i = SS.indexOf('\n')
let num = 0
let strKind: any = ''
let enCapital = ''
if (i > 0) {
const slist = SS.split('\n')
for (let i = 0; i < slist.length; i += 1) {
const member = slist[i]
const strNum: any = GetStringNum(member)
if (i == 0) {
strKind = member.substring(strNum.length)
}
num = parseFloat(num).add(parseFloat(strNum))
}
if (strKind !== '') {
enCapital = strKind
if (strKind !== '') {
enCapital = strKind
} else {
strKind = data.kindPkgsName ? data.kindPkgsName : ''
enCapital = ToEn(num).toUpperCase() + ' ' + strKind + ' ONLY.'
}
console.log(strKind, 1)
} else {
strKind = data.kindPkgsName ? data.kindPkgsName : ''
enCapital = ToEn(num).toUpperCase() + ' ' + strKind + ' ONLY.'
const strNum: any = GetStringNum(SS)
strKind = SS.substring(strNum.length) ? SS.substring(strNum.length) : ''
if (strKind !== '') {
enCapital = strKind
} else {
strKind = data.kindPkgsName ? data.kindPkgsName : ''
enCapital = 'SAY:' + ToEn(strNum).toUpperCase() + ' ' + strKind + ' ONLY.'
}
console.log(strKind, 2)
}
setFieldsValue4({ totalNo: enCapital })
} else {
const strNum: any = GetStringNum(SS)
strKind = SS.substring(strNum.length) ? SS.substring(strNum.length) : ''
if (strKind !== '') {
enCapital = strKind
} else {
strKind = data.kindPkgsName ? data.kindPkgsName : ''
enCapital = 'SAY:' + ToEn(strNum).toUpperCase() + ' ' + strKind + ' ONLY.'
}
setFieldsValue4({ totalNo: '' })
}
setFieldsValue4({ totalNo: enCapital })
} else {
setFieldsValue4({ totalNo: '' })
}
}, 0)
}
const [
registerForm4,

@ -733,7 +733,7 @@
<!-- 打印弹窗 start -->
<a-modal
:zIndex="1005"
width="35vw"
width="45vw"
:maskClosable="false"
v-model:visible="PrintModalVisible"
title="打印"
@ -991,7 +991,6 @@
const dataSource = ref<any>([])
//
const [registerTable, { reload, getForm, setTableData }] = useTable({
title: '打印列表',
//
handleSearchInfoFn: () => {
let Arr: any = []
@ -1048,6 +1047,7 @@
}
//
function FnCilckTemplateType({ templateId, printType }) {
spinning.value = true
notification.success({ message: '搜索文件中...', duration: 3 })
GetOpenJsonPrintInfo({
templateId,
@ -1059,47 +1059,14 @@
if (!res.succeeded) {
notification.error({ message: res.message, duration: 3 })
} else {
// // 1.pdf; 2.excel; 3.word
// let base64ToBlob = (code) => {
// code = code.replace(/[\n\r]/g, '') // base64base64
// // atob() 使 base-64
// const raw = window.atob(code)
// const rawLength = raw.length
// const uInt8Array = new Uint8Array(rawLength)
// for (let i = 0; i < rawLength; ++i) {
// // UnicodeUnit8Array
// uInt8Array[i] = raw.charCodeAt(i)
// }
// // BlobUint8Arraypdf
// let type = ''
// switch (res.data.printType) {
// case '2':
// type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
// break
// case '3':
// type = 'application/msword'
// break
// default:
// type = 'application/pdf'
// break
// }
// return new Blob([uInt8Array], { type })
// }
// const blob = base64ToBlob(res.data.printData)
// ''
// if (window.navigator && window.navigator.msSaveOrOpenBlob) {
// window.navigator.msSaveOrOpenBlob(blob)
// } else {
// const fileURL = URL.createObjectURL(blob)
// window.open(fileURL) //ppf
// }
let fileURL = `http://60.209.125.238:3009/PrintTempFile/${res.data}`
window.open(fileURL)
}
spinning.value = false
})
.catch((err) => {
console.log(err)
spinning.value = false
})
}
function openModel(type) {

@ -20,6 +20,6 @@ export const searchFormSchema: FormSchema[] = [
field: 'templateName',
label: '模板名称',
component: 'Input',
colProps: { span: 6 },
colProps: { span: 8 },
},
]

@ -1,5 +1,7 @@
import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue'
import { useOptionsStore } from '/@/store/modules/options'
const optionsStore = useOptionsStore()
export const columns: BasicColumn[] = [
{
title: '机构名称',
@ -336,13 +338,32 @@ export const formSchema: FormSchema[] = [
span: 6,
},
},
// {
// label: '本地货币',
// field: 'localCurrency',
// component: 'Input',
// defaultValue: '',
// colProps: {
// span: 6,
// },
// },
{
label: '本地货币',
field: 'localCurrency',
component: 'Input',
defaultValue: '',
colProps: {
span: 6,
label: '本地货币',
component: 'ApiSelect',
defaultValue: '',
colProps: { span: 6 },
componentProps: () => {
return {
allowClear: true,
showSearch: true,
option: optionsStore.getOptionsByCode('GetFeeCurrencySelectList'),
labelField: 'codeName',
valueField: 'codeName',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{
@ -534,12 +555,22 @@ export const BankformSchema: FormSchema[] = [
},
},
{
label: '币别',
field: 'currency',
component: 'Input',
defaultValue: '',
colProps: {
span: 12,
label: '币别',
component: 'ApiSelect',
defaultValue: '',
colProps: { span: 12 },
componentProps: () => {
return {
allowClear: true,
showSearch: true,
option: optionsStore.getOptionsByCode('GetFeeCurrencySelectList'),
labelField: 'codeName',
valueField: 'codeName',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{

Loading…
Cancel
Save