xlsx 打印 揽货人接口

szh-new
张同海 6 months ago
parent 9a77ee4c08
commit 45e9558f7b

@ -54,7 +54,6 @@
"echarts": "^5.3.2",
"element-plus": "^2.3.12",
"exceljs": "^4.3.0",
"file-saver": "^2.0.5",
"handsontable": "^14.3.0",
"intro.js": "^5.1.0",
"lodash-es": "^4.17.21",
@ -66,6 +65,7 @@
"pinia": "2.0.12",
"qs": "^6.10.3",
"resize-observer-polyfill": "^1.5.1",
"sheetjs": "^2.0.0",
"showdown": "^2.1.0",
"sortablejs": "^1.15.0",
"tinymce": "^5.10.3",
@ -91,7 +91,6 @@
"@purge-icons/generated": "^0.8.1",
"@types/codemirror": "^5.60.5",
"@types/crypto-js": "^4.1.1",
"@types/file-saver": "^2.0.5",
"@types/fs-extra": "^9.0.13",
"@types/inquirer": "^8.2.1",
"@types/intro.js": "^3.0.2",

@ -396,6 +396,14 @@ export function CancelServiceStatus(parameter) {
data: parameter,
})
}
// 获取揽货人信息 (Auth)
export function GetSaleList(parameter) {
return request({
url: '/mainApi/ClientCommon/GetSaleList',
method: 'get',
params: parameter,
})
}
/**
* 分页查询订舱主表
* @params PageSize

@ -13,6 +13,7 @@ import {
GetClientLanesSelectList,
GetOperatorUserList,
GetSaleUserList,
GetSaleList,
GetVouchingClerkList,
GetCustomerServiceList,
// ---------------mailingInfo----------------
@ -144,13 +145,22 @@ if (FnshipAgencyId.succeeded) {
ListData.shipAgencyId.push({ label: e.codeName, value: e.id })
})
}
const FnsaleId: any = await GetSaleUserList()
// const FnsaleId: any = await GetSaleUserList()
// if (FnsaleId.succeeded) {
// ListData.saleId = []
// FnsaleId.data.forEach((e) => {
// ListData.saleId.push({ ...e, label: `${e.userName}/${e.userCode}`, value: e.id })
// })
// }
const FnsaleId: any = await GetSaleList()
if (FnsaleId.succeeded) {
ListData.saleId = []
FnsaleId.data.forEach((e) => {
ListData.saleId.push({ ...e, label: `${e.userName}/${e.userCode}`, value: e.id })
})
}
const FncustomerService: any = await GetCustomerServiceList()
if (FncustomerService.succeeded) {
ListData.customerService = []
@ -384,7 +394,7 @@ export const columns: BasicColumn[] = [
},
},
{
title: '所属分部',
title: '分公司',
dataIndex: 'saleOrgId',
width: 150,
customRender: ({ record }) => {
@ -1715,7 +1725,7 @@ export const basicInfoFormSchema: FormSchema[] = [
},
},
{
label: '所属分部',
label: '分公司',
field: 'saleOrgId',
component: 'Select',
required: false,
@ -1729,6 +1739,9 @@ export const basicInfoFormSchema: FormSchema[] = [
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
console.log(e, obj)
},
},
},
{
@ -2115,10 +2128,13 @@ export const basicInfoFormSchema: FormSchema[] = [
},
onChange: (e, obj) => {
if (e) {
console.log(obj)
ListData.saleId.forEach((item) => {
if (item.value == e) {
formModel.sale = item.cnName
console.log(e, obj)
formModel.sale = obj.label
obj.saleOrgList.forEach((item) => {
if (item.orgId == obj.defaultOrgId) {
formModel.saleOrgId = item.orgId
// formModel.sale = item.orgId
}
})
} else {
@ -5365,7 +5381,7 @@ export const BatchModificationFormSchema: FormSchema[] = [
show: false,
},
{
label: '所属分部',
label: '分公司',
field: 'saleOrgId',
component: 'Select',
required: false,

@ -283,7 +283,7 @@
}
.bottom {
display: flex;
margin-bottom: 32px;
margin-bottom: 14px;
.input-box {
margin-top: 10px;
flex: 1;

@ -35,6 +35,14 @@
>
<a-icon type="appstore" />EXCEL导出
</a-button>
<a-button
class="btn btn-more-name"
type="primary"
@click="PrintExcel"
:disabled="list.length === 0"
>
<a-icon type="appstore" />打印
</a-button>
<a-button
class="btn btn-import-station"
type="primary"
@ -104,9 +112,37 @@
:settings="settings"
v-if="list.length !== 0"
></hot-table>
<div class="table-no-data" v-if="list.length === 0"></div>
</div>
<div class="loading" v-else> ...</div>
<div v-show="false">
<table id="printableTable" class="printTable">
<thead>
<tr>
<th
v-for="(key, index) in columns"
:key="key.data"
v-show="index !== 0 && index !== 1 && index !== 2 && index !== 3"
class="printTh"
>{{ key.title }}</th
>
</tr>
</thead>
<tbody>
<tr v-for="item in list" :key="item.id">
<td
v-for="(key, index) in columns"
:key="key.data"
v-show="index !== 0 && index !== 1 && index !== 2 && index !== 3"
class="printTd"
>{{ item[key.data] }}</td
>
</tr>
</tbody>
</table>
</div>
</a-card>
</a-spin>
<a-modal
@ -217,6 +253,7 @@
import { GetPackageSelectList } from '/@/views/operation/seaexport/api/BookingLedger'
registerAllModules()
import * as XLSX from 'xlsx'
import printJS from 'print-js'
const route = useRoute()
const props = defineProps({
details: { type: Object, default: {} },
@ -1061,6 +1098,8 @@
async function UpExcel(file) {
const reader = new FileReader()
reader.onload = (e: any) => {
console.log(e.target.result)
const data = new Uint8Array(e.target.result)
const workbook = XLSX.read(data, { type: 'array' })
const worksheet = workbook.Sheets[workbook.SheetNames[0]]
@ -1114,9 +1153,6 @@
}
// EXCEL
function ExportExcel() {
// title: '',
// width: 80,
// data: 'bsno',
let Data: any = []
let DelData = ['id', 'bsno', 'ctnCode']
list.value.forEach((item, index) => {
@ -1136,17 +1172,22 @@
// 簿
const workbook = XLSX.utils.book_new()
console.log(workbook, 'workbook')
//
const worksheet = XLSX.utils.json_to_sheet(Data)
console.log(workbook, 'worksheet')
// 簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
console.log(workbook, 'workbook')
// Excel
const wbout = XLSX.write(workbook, { bookType: 'xlsx', type: 'binary' })
console.log(wbout, 'wbout')
// url
const blob = new Blob([s2ab(wbout)], { type: 'application/octet-stream' })
console.log(blob, 'blob')
const url = URL.createObjectURL(blob)
console.log(url, 'url')
// a
const a = document.createElement('a')
a.href = url
@ -1167,6 +1208,16 @@
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xff
return buf
}
//
async function PrintExcel() {
printJS({
printable: 'printableTable',
type: 'html',
header: null,
targetStyles: ['*'],
})
}
// -------------------------------
const loadingTable = ref(false)
const tableData: any = ref([{}])
@ -2086,6 +2137,28 @@
})
</script>
<style lang="less" scoped>
.printTable {
font-family: verdana, arial, sans-serif;
font-size: 11px;
color: #333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
.printTh {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede !important;
}
.printTd {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff !important;
}
.ds-goods-tb-check {
left: 34px;
}

Loading…
Cancel
Save