diff --git a/src/components/Table/src/components/TableHeader.vue b/src/components/Table/src/components/TableHeader.vue index de634e09..36b81b5f 100644 --- a/src/components/Table/src/components/TableHeader.vue +++ b/src/components/Table/src/components/TableHeader.vue @@ -54,8 +54,8 @@ default: '', }, id: { - type: Number, - default: 0 + type: String, + default: '0' } }, emits: ['columns-change'], diff --git a/src/components/Table/src/components/settings/ColumnSetting.vue b/src/components/Table/src/components/settings/ColumnSetting.vue index 9eb3bd89..1e513c4f 100644 --- a/src/components/Table/src/components/settings/ColumnSetting.vue +++ b/src/components/Table/src/components/settings/ColumnSetting.vue @@ -19,7 +19,6 @@ > {{ t('component.table.settingColumnShow') }} - {{ t('component.table.settingIndexColumnShow') }} @@ -163,8 +162,8 @@ emits: ['columns-change'], props: { id: { - type: Number, - default: 0 + type: String, + default: '0' } }, @@ -246,6 +245,7 @@ const columns2 = [] let Apidata = { permissionId: '', + tagNo: props.id } usePermissionStore().getWrouteList.forEach((item: any) => { item.children[0].children?.forEach((item2) => { @@ -373,7 +373,7 @@ // 将列表添加到列表设置菜单页面中 const editTable = () => { const Apidata = { - id: 0, + tagNo: props.id, templateName: '列表设置', content: JSON.stringify({ columns: getColumns(), @@ -511,7 +511,7 @@ }) if (!type) { let Apidata = { - id: props.id, + tagNo: props.id, permissionId: '', content: JSON.stringify({ columns: data, @@ -519,7 +519,6 @@ showIndexColumn: table.getBindValues.value.showIndexColumn, }), } - console.log(usePermissionStore().getWrouteList) usePermissionStore().getWrouteList.forEach((item) => { item.children[0].children?.forEach((item2) => { if (fullPath.value.indexOf(item2.path) != -1) { diff --git a/src/components/Table/src/components/settings/index.vue b/src/components/Table/src/components/settings/index.vue index 8e93e5cd..4af3026b 100644 --- a/src/components/Table/src/components/settings/index.vue +++ b/src/components/Table/src/components/settings/index.vue @@ -36,8 +36,8 @@ default: () => ({}), }, id: { - type: Number, - default: 0 + type: String, + default: '0' } }, emits: ['columns-change'], diff --git a/src/components/Table/src/props.ts b/src/components/Table/src/props.ts index e007ff86..30490b96 100644 --- a/src/components/Table/src/props.ts +++ b/src/components/Table/src/props.ts @@ -154,7 +154,7 @@ export const basicProps = { }, // 表格的id增加全选使用 id: { - type: Number, - default: 0 + type: String, + default: '0' } } diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index d945b311..81efb30b 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -215,7 +215,7 @@ export interface BasicTableProps { pagination?: PaginationProps | boolean // loading加载 loading?: boolean, - id?: Number, + id?: string | number, /** * The column contains children to display diff --git a/src/hooks/web/common.ts b/src/hooks/web/common.ts index 5435a377..15c8398b 100644 --- a/src/hooks/web/common.ts +++ b/src/hooks/web/common.ts @@ -1,5 +1,8 @@ import { router } from "/@/router" import { useMultipleTabStore } from '/@/store/modules/multipleTab' +import { useMessage } from '/@/hooks/web/useMessage' +import * as XLSX from 'xlsx' +const { createMessage } = useMessage() // 格式表格时间 export function formatTableData(v) { if (v) { @@ -33,4 +36,60 @@ export function closePage(topath) { router.back() } } -} \ No newline at end of file +} + +/* 根据接口和过滤条件导出excel(目前支持单表头表格导出) + * api: 接口,params: 过滤条件,columes: 表格列,name: excel名称 +*/ +export function exportExcel(api, params = {}, columns = [], name = '未命名') { + if (!api) return createMessage.warning('缺少api') + params['pageCondition']['isExport'] = true + // 过滤出需要显示的列 + const cols = columns.filter(item => { + return !item.defaultHidden || item.visible + }) + api(params).then(res => { + const { data } = res + const fileData = data.map(row => { + const obj = {} + cols.forEach(item => { + for (var key in row) { + if (item.dataIndex === key) { + obj[item.title] = row[key] + } + } + }) + return obj + }) + // 创建工作簿 + const workbook = XLSX.utils.book_new() + // 将数据转换为工作表 + const worksheet = XLSX.utils.json_to_sheet(fileData) + // 将工作表添加到工作簿 + 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 = name + '.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 +} \ No newline at end of file diff --git a/src/views/baseinfo/accountMaintenance/components/Modal.vue b/src/views/baseinfo/accountMaintenance/components/Modal.vue index 41367a1b..b5fc6e8b 100644 --- a/src/views/baseinfo/accountMaintenance/components/Modal.vue +++ b/src/views/baseinfo/accountMaintenance/components/Modal.vue @@ -51,19 +51,20 @@ const loading = ref(false) const rowId = ref('') const { createMessage } = useMessage() - const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ + const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({ labelWidth: 100, schemas: formSchema, showActionButtonGroup: false, }) - const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { + const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => { resetFields() setModalProps({ confirmLoading: false, loading: true }) isUpdate.value = !!data?.isUpdate if (unref(isUpdate)) { // setModalProps({ confirmLoading: true }); rowId.value = data.record.id + updateFormField(updateSchema) const res: API.DataResult = await ApiInfo({ id: unref(rowId) }) if (res.succeeded) { setFieldsValue({ diff --git a/src/views/operation/CustomerReconciliation/index.vue b/src/views/operation/CustomerReconciliation/index.vue index 4dc7908c..04eee450 100644 --- a/src/views/operation/CustomerReconciliation/index.vue +++ b/src/views/operation/CustomerReconciliation/index.vue @@ -174,6 +174,7 @@ } }) Data.push(Obj) + console.log(Data) }) // 创建工作簿 const workbook = XLSX.utils.book_new() diff --git a/src/views/operation/paidApply/columns.tsx b/src/views/operation/paidApply/columns.tsx index 5d627859..11074b6e 100644 --- a/src/views/operation/paidApply/columns.tsx +++ b/src/views/operation/paidApply/columns.tsx @@ -91,8 +91,8 @@ export const columns: BasicColumn[] = [ }, { title: '申请支付日期', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'paymentDate', + width: 130 }, { title: '最后审核日期', @@ -104,16 +104,16 @@ export const columns: BasicColumn[] = [ dataIndex: 'auditerName', width: 120 }, - { - title: '结算对象银行', - dataIndex: 'customerBank', - width: 150 - }, - { - title: '结算对象账户', - dataIndex: 'customerBAN', - width: 140 - }, + // { + // title: '结算对象银行', + // dataIndex: 'customerBank', + // width: 150 + // }, + // { + // title: '结算对象账户', + // dataIndex: 'customerBAN', + // width: 140 + // }, { title: '备注', dataIndex: 'note', @@ -161,64 +161,64 @@ export const columns: BasicColumn[] = [ // }, { title: '委托单位', - dataIndex: 'client', + dataIndex: 'clientName', width: 120 }, //////////////////// - { - title: '申请方式', - dataIndex: 'financeSoftCode', - width: 200 - }, + // { + // title: '申请方式', + // dataIndex: 'financeSoftCode', + // width: 200 + // }, { title: '已打印', - dataIndex: 'financeSoftCode', - width: 200 - }, - { - title: '入账申请编号', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'isPrinted', + width: 100 }, + // { + // title: '入账申请编号', + // dataIndex: 'financeSoftCode', + // width: 200 + // }, { title: '驳回原因', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'reason', + width: 150 }, { title: '结算方式', - dataIndex: 'financeSoftCode', - width: 200 - }, - { - title: '申请部门', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'settlementTypeName', + width: 130 }, + // { + // title: '申请部门', + // dataIndex: 'financeSoftCode', + // width: 200 + // }, { title: '打印次数', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'printTimes', + width: 100 }, { title: '所属分部', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'saleDeptName', + width: 150, }, { title: '发票日期', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'invoiceDate', + width: 120, }, { title: '发票金额', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'invoiceAmount', + width: 120 }, { title: '收到发票', - dataIndex: 'financeSoftCode', - width: 200 + dataIndex: 'isInvoiceReceived', + width: 80 } ] @@ -254,7 +254,7 @@ export const searchFormSchema: FormSchema[] = [ } }, { - field: 'billStatus', + field: 'status', label: '申请单状态', component: 'Select', colProps: { span: 4 }, diff --git a/src/views/operation/paidApply/components/tableActionBar.vue b/src/views/operation/paidApply/components/tableActionBar.vue index e530c2ee..0e1a4f10 100644 --- a/src/views/operation/paidApply/components/tableActionBar.vue +++ b/src/views/operation/paidApply/components/tableActionBar.vue @@ -37,19 +37,23 @@ -