szh-new
张同海 5 months ago
commit df6e2e89ba

@ -54,8 +54,8 @@
default: '', default: '',
}, },
id: { id: {
type: Number, type: String,
default: 0 default: '0'
} }
}, },
emits: ['columns-change'], emits: ['columns-change'],

@ -19,7 +19,6 @@
> >
{{ t('component.table.settingColumnShow') }} {{ t('component.table.settingColumnShow') }}
</Checkbox> </Checkbox>
<Checkbox v-model:checked="checkIndex" @change="handleIndexCheckChange"> <Checkbox v-model:checked="checkIndex" @change="handleIndexCheckChange">
{{ t('component.table.settingIndexColumnShow') }} {{ t('component.table.settingIndexColumnShow') }}
</Checkbox> </Checkbox>
@ -163,8 +162,8 @@
emits: ['columns-change'], emits: ['columns-change'],
props: { props: {
id: { id: {
type: Number, type: String,
default: 0 default: '0'
} }
}, },
@ -246,6 +245,7 @@
const columns2 = [] const columns2 = []
let Apidata = { let Apidata = {
permissionId: '', permissionId: '',
tagNo: props.id
} }
usePermissionStore().getWrouteList.forEach((item: any) => { usePermissionStore().getWrouteList.forEach((item: any) => {
item.children[0].children?.forEach((item2) => { item.children[0].children?.forEach((item2) => {
@ -373,7 +373,7 @@
// //
const editTable = () => { const editTable = () => {
const Apidata = { const Apidata = {
id: 0, tagNo: props.id,
templateName: '列表设置', templateName: '列表设置',
content: JSON.stringify({ content: JSON.stringify({
columns: getColumns(), columns: getColumns(),
@ -511,7 +511,7 @@
}) })
if (!type) { if (!type) {
let Apidata = { let Apidata = {
id: props.id, tagNo: props.id,
permissionId: '', permissionId: '',
content: JSON.stringify({ content: JSON.stringify({
columns: data, columns: data,
@ -519,7 +519,6 @@
showIndexColumn: table.getBindValues.value.showIndexColumn, showIndexColumn: table.getBindValues.value.showIndexColumn,
}), }),
} }
console.log(usePermissionStore().getWrouteList)
usePermissionStore().getWrouteList.forEach((item) => { usePermissionStore().getWrouteList.forEach((item) => {
item.children[0].children?.forEach((item2) => { item.children[0].children?.forEach((item2) => {
if (fullPath.value.indexOf(item2.path) != -1) { if (fullPath.value.indexOf(item2.path) != -1) {

@ -36,8 +36,8 @@
default: () => ({}), default: () => ({}),
}, },
id: { id: {
type: Number, type: String,
default: 0 default: '0'
} }
}, },
emits: ['columns-change'], emits: ['columns-change'],

@ -154,7 +154,7 @@ export const basicProps = {
}, },
// 表格的id增加全选使用 // 表格的id增加全选使用
id: { id: {
type: Number, type: String,
default: 0 default: '0'
} }
} }

@ -215,7 +215,7 @@ export interface BasicTableProps<T = any> {
pagination?: PaginationProps | boolean pagination?: PaginationProps | boolean
// loading加载 // loading加载
loading?: boolean, loading?: boolean,
id?: Number, id?: string | number,
/** /**
* The column contains children to display * The column contains children to display

@ -1,5 +1,8 @@
import { router } from "/@/router" import { router } from "/@/router"
import { useMultipleTabStore } from '/@/store/modules/multipleTab' import { useMultipleTabStore } from '/@/store/modules/multipleTab'
import { useMessage } from '/@/hooks/web/useMessage'
import * as XLSX from 'xlsx'
const { createMessage } = useMessage()
// 格式表格时间 // 格式表格时间
export function formatTableData(v) { export function formatTableData(v) {
if (v) { if (v) {
@ -34,3 +37,59 @@ export function closePage(topath) {
} }
} }
} }
/* 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
}

@ -51,19 +51,20 @@
const loading = ref(false) const loading = ref(false)
const rowId = ref('') const rowId = ref('')
const { createMessage } = useMessage() const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 100, labelWidth: 100,
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,
}) })
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
resetFields() resetFields()
setModalProps({ confirmLoading: false, loading: true }) setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) { if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true }); // setModalProps({ confirmLoading: true });
rowId.value = data.record.id rowId.value = data.record.id
updateFormField(updateSchema)
const res: API.DataResult = await ApiInfo({ id: unref(rowId) }) const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
if (res.succeeded) { if (res.succeeded) {
setFieldsValue({ setFieldsValue({

@ -174,6 +174,7 @@
} }
}) })
Data.push(Obj) Data.push(Obj)
console.log(Data)
}) })
// 簿 // 簿
const workbook = XLSX.utils.book_new() const workbook = XLSX.utils.book_new()

@ -91,8 +91,8 @@ export const columns: BasicColumn[] = [
}, },
{ {
title: '申请支付日期', title: '申请支付日期',
dataIndex: 'financeSoftCode', dataIndex: 'paymentDate',
width: 200 width: 130
}, },
{ {
title: '最后审核日期', title: '最后审核日期',
@ -104,16 +104,16 @@ export const columns: BasicColumn[] = [
dataIndex: 'auditerName', dataIndex: 'auditerName',
width: 120 width: 120
}, },
{ // {
title: '结算对象银行', // title: '结算对象银行',
dataIndex: 'customerBank', // dataIndex: 'customerBank',
width: 150 // width: 150
}, // },
{ // {
title: '结算对象账户', // title: '结算对象账户',
dataIndex: 'customerBAN', // dataIndex: 'customerBAN',
width: 140 // width: 140
}, // },
{ {
title: '备注', title: '备注',
dataIndex: 'note', dataIndex: 'note',
@ -161,64 +161,64 @@ export const columns: BasicColumn[] = [
// }, // },
{ {
title: '委托单位', title: '委托单位',
dataIndex: 'client', dataIndex: 'clientName',
width: 120 width: 120
}, },
//////////////////// ////////////////////
{ // {
title: '申请方式', // title: '申请方式',
dataIndex: 'financeSoftCode', // dataIndex: 'financeSoftCode',
width: 200 // width: 200
}, // },
{ {
title: '已打印', title: '已打印',
dataIndex: 'financeSoftCode', dataIndex: 'isPrinted',
width: 200 width: 100
},
{
title: '入账申请编号',
dataIndex: 'financeSoftCode',
width: 200
}, },
// {
// title: '入账申请编号',
// dataIndex: 'financeSoftCode',
// width: 200
// },
{ {
title: '驳回原因', title: '驳回原因',
dataIndex: 'financeSoftCode', dataIndex: 'reason',
width: 200 width: 150
}, },
{ {
title: '结算方式', title: '结算方式',
dataIndex: 'financeSoftCode', dataIndex: 'settlementTypeName',
width: 200 width: 130
},
{
title: '申请部门',
dataIndex: 'financeSoftCode',
width: 200
}, },
// {
// title: '申请部门',
// dataIndex: 'financeSoftCode',
// width: 200
// },
{ {
title: '打印次数', title: '打印次数',
dataIndex: 'financeSoftCode', dataIndex: 'printTimes',
width: 200 width: 100
}, },
{ {
title: '所属分部', title: '所属分部',
dataIndex: 'financeSoftCode', dataIndex: 'saleDeptName',
width: 200 width: 150,
}, },
{ {
title: '发票日期', title: '发票日期',
dataIndex: 'financeSoftCode', dataIndex: 'invoiceDate',
width: 200 width: 120,
}, },
{ {
title: '发票金额', title: '发票金额',
dataIndex: 'financeSoftCode', dataIndex: 'invoiceAmount',
width: 200 width: 120
}, },
{ {
title: '收到发票', title: '收到发票',
dataIndex: 'financeSoftCode', dataIndex: 'isInvoiceReceived',
width: 200 width: 80
} }
] ]
@ -254,7 +254,7 @@ export const searchFormSchema: FormSchema[] = [
} }
}, },
{ {
field: 'billStatus', field: 'status',
label: '申请单状态', label: '申请单状态',
component: 'Select', component: 'Select',
colProps: { span: 4 }, colProps: { span: 4 },

@ -37,19 +37,23 @@
</a-popconfirm> </a-popconfirm>
<div class="nav"><i class="iconfont icon-xiaopiaodayin"></i>打印</div> <div class="nav"><i class="iconfont icon-xiaopiaodayin"></i>打印</div>
<div class="nav"> <div class="nav" @click="exportFile">
<i class="iconfont icon-shishijifei"></i>导出Excel <i class="iconfont icon-shishijifei"></i>导出Excel
</div> </div>
<!-- 打印组件 -->
<DsPrint
ref="dsPrint"
name="费用录入"
></DsPrint>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, defineProps, reactive } from 'vue' import { ref, defineProps, reactive, defineEmits } from 'vue'
import { useGo } from '/@/hooks/web/usePage' import { useGo } from '/@/hooks/web/usePage'
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
import { useRouter } from 'vue-router' //
import { useModal } from '/@/components/Modal' import DsPrint from '/@/components/Print/index.vue'
import { Delete, ApplyAudit, Withdraw } from '../api' import { Delete, ApplyAudit, Withdraw } from '../api'
const router = useRouter()
const { createMessage } = useMessage() const { createMessage } = useMessage()
const go = useGo() const go = useGo()
const props = defineProps({ const props = defineProps({
@ -60,6 +64,7 @@
type: Function type: Function
} }
}) })
const emit = defineEmits(['exportFile'])
// //
function create() { function create() {
go(`/paid-apply/create`) go(`/paid-apply/create`)
@ -76,6 +81,10 @@
} }
go(`/BookingDetail?id=${pkIdArr[0]}&isCopy=${true}`) go(`/BookingDetail?id=${pkIdArr[0]}&isCopy=${true}`)
} }
//
const exportFile = () => {
emit('exportFile')
}
const copyMoreFlag = ref(false) const copyMoreFlag = ref(false)
const copyMoreForm = reactive({ const copyMoreForm = reactive({
number: 1, number: 1,

@ -96,7 +96,7 @@
canResize: false, canResize: false,
rowSelection: { type: 'checkbox' }, rowSelection: { type: 'checkbox' },
immediate: false, immediate: false,
id: 1 id: '1'
}) })
// //
const add = () => { const add = () => {

@ -7,7 +7,7 @@
<div class="ds-pay-apply"> <div class="ds-pay-apply">
<BasicTable @register="registerTable" @row-dbClick="edit"> <BasicTable @register="registerTable" @row-dbClick="edit">
<template #toolbar> <template #toolbar>
<TableActionBar :selectRow="getSelectRows" :reload="reload"></TableActionBar> <TableActionBar :selectRow="getSelectRows" :reload="reload" @exportFile="exportFile"></TableActionBar>
</template> </template>
<template v-slot:bodyCell="{ column, record }"> <template v-slot:bodyCell="{ column, record }">
<!-- 复制单号 --> <!-- 复制单号 -->
@ -35,10 +35,13 @@
import { GetList } from './api' import { GetList } from './api'
import { columns, searchFormSchema, FeeStatus } from './columns' import { columns, searchFormSchema, FeeStatus } from './columns'
import { useGo } from '/@/hooks/web/usePage' import { useGo } from '/@/hooks/web/usePage'
import { exportExcel } from '/@/hooks/web/common'
const go = useGo() const go = useGo()
const [registerTable, { reload, getForm, getPaginationRef, getSelectRows }] = useTable({ const params = ref([])
const [registerTable, { reload, getForm, getPaginationRef, getSelectRows, getColumns }] = useTable({
title: '', title: '',
api: async (p) => { api: async (p) => {
params.value = p
const res = await GetList(p) const res = await GetList(p)
return new Promise((resolve) => { return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count }) resolve({ data: [...res.data], total: res.count })
@ -56,22 +59,36 @@
}, },
} }
let condition: API.ConditionItem[] = [] let condition: API.ConditionItem[] = []
if (!!data.UserName) { if (!!data.billNO) {
condition.push({ condition.push({
FieldName: 'UserName', FieldName: 'billNO',
FieldValue: data.UserName, FieldValue: data.billNO,
ConditionalType: 1, ConditionalType: 1,
}) })
} }
if (!!data.UserCode) { if (!!data.applicationNO) {
condition.push({ condition.push({
FieldName: 'UserCode', FieldName: 'applicationNO',
FieldValue: data.UserCode, FieldValue: data.applicationNO,
ConditionalType: 1, ConditionalType: 1,
}) })
} }
if (!!data.customerId) {
condition.push({
FieldName: 'customerId',
FieldValue: data.customerId,
ConditionalType: 1,
})
}
if (!!data.status) {
condition.push({
FieldName: 'status',
FieldValue: data.status,
ConditionalType: 1,
})
}
console.log(condition)
postParam.queryCondition = JSON.stringify(condition) postParam.queryCondition = JSON.stringify(condition)
// console.log(postParam);
return postParam return postParam
}, },
columns, columns,
@ -87,8 +104,13 @@
bordered: true, bordered: true,
showIndexColumn: true, showIndexColumn: true,
canResize: false, canResize: false,
immediate: false immediate: false,
id: '0'
}) })
// Excel
const exportFile = () => {
exportExcel(GetList, params.value, getColumns(), '费用申请')
}
const copyNo = (e, v) => { const copyNo = (e, v) => {
e.stopPropagation() e.stopPropagation()
navigator.clipboard.writeText(v) navigator.clipboard.writeText(v)

Loading…
Cancel
Save