Files
geg-gas-web/src/components/common/approListModal.vue

112 lines
3.4 KiB
Vue
Raw Normal View History

2025-12-25 17:51:53 +08:00
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="approListModal"></BasicTable>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { getLngApproPage} from '/@/api/approve/appro';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{ field: 'title', label: '标题/编号', component: 'Input'},
];
const columns: BasicColumn[] = [
2026-01-21 18:18:19 +08:00
{ dataIndex: 'title', title: '标题', align: 'left', },
{ dataIndex: 'code', title: '编号', align: 'left', },
{ dataIndex: 'typeName', title: '签报类型', align: 'left', },
{ dataIndex: 'empName', title: '拟稿人', align: 'left', },
{ dataIndex: 'bDeptName', title: '拟稿人所属部门', align: 'left', },
{ dataIndex: 'dateAppro', title: '拟稿日期', align: 'left', },
{ dataIndex: 'file', title: '附件', align: 'left', },
2025-12-25 17:51:53 +08:00
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('签报列表'),
api: getLngApproPage,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9, offSet:10},
schemas: codeFormSchema,
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
2026-01-28 18:21:33 +08:00
return { ...params, valid: 'Y',approCode: 'YSP',page:params.limit};
2025-12-25 17:51:53 +08:00
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleVisibleChange = (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('签报列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择签报')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.approListModal .basicCol{
position: inherit !important;
top: 0;
}
</style>