|
@@ -1,167 +1,40 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { useColumns } from "./columns";
|
|
|
-import { httpList } from "/@/api/parameter/clients";
|
|
|
-import { reactive, ref, onMounted } from "vue";
|
|
|
-import { type FormInstance } from "element-plus";
|
|
|
-import { TableProBar } from "/@/components/ReTable";
|
|
|
-import { type PaginationProps } from "@pureadmin/table";
|
|
|
-import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
|
-import { useNav } from "/@/layout/hooks/nav";
|
|
|
-import DetailDialog from "./components/detail-dialog.vue";
|
|
|
-import { responseHandle } from "/@/utils/responseHandle";
|
|
|
-const { logout } = useNav();
|
|
|
-defineOptions({
|
|
|
- name: "clients"
|
|
|
-});
|
|
|
+import { PageSearch, usePageSearch } from "/@/components/PageSearch";
|
|
|
+import { PageModal, usePageModal } from "/@/components/PageModal";
|
|
|
+import { PageContent } from "/@/components/PageContent";
|
|
|
+import searchFormConfig from "./config/search.config";
|
|
|
+import contentConfig from "./config/content.config";
|
|
|
+import modalConfig from "./config/modal.config";
|
|
|
|
|
|
-const form = reactive({
|
|
|
- page: 1,
|
|
|
- size: 15,
|
|
|
- company: "",
|
|
|
- contactor: ""
|
|
|
+defineOptions({
|
|
|
+ name: "invoiceheader"
|
|
|
});
|
|
|
|
|
|
-const dataList = ref([]);
|
|
|
-const loading = ref(true);
|
|
|
-const { columns } = useColumns();
|
|
|
-const formRef = ref<FormInstance>();
|
|
|
-const dialogRef = ref<InstanceType<typeof DetailDialog>>(null);
|
|
|
+const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch();
|
|
|
|
|
|
-const pagination = reactive<PaginationProps>({
|
|
|
- total: 0,
|
|
|
- pageSize: 15,
|
|
|
- currentPage: 1,
|
|
|
- background: true
|
|
|
-});
|
|
|
-
|
|
|
-async function handleCurrentChange(val: number) {
|
|
|
- form.page = val;
|
|
|
- await onSearch();
|
|
|
-}
|
|
|
-
|
|
|
-async function handleSizeChange(val: number) {
|
|
|
- form.size = val;
|
|
|
- form.page = 1;
|
|
|
- await onSearch();
|
|
|
-}
|
|
|
-
|
|
|
-function handleSelectionChange(val) {
|
|
|
- console.log("handleSelectionChange", val);
|
|
|
-}
|
|
|
-
|
|
|
-async function onSearch() {
|
|
|
- loading.value = true;
|
|
|
- const { code, data, message } = await httpList(form);
|
|
|
-
|
|
|
- responseHandle({
|
|
|
- code,
|
|
|
- message,
|
|
|
- logout,
|
|
|
- handler: () => {
|
|
|
- const { list, count } = data;
|
|
|
- dataList.value = list ?? [];
|
|
|
- pagination.total = count ?? 0;
|
|
|
- pagination.pageSize = form.size;
|
|
|
- pagination.currentPage = form.page;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- loading.value = false;
|
|
|
-}
|
|
|
-
|
|
|
-async function resetSearch() {
|
|
|
- form.page = 1;
|
|
|
- await onSearch();
|
|
|
-}
|
|
|
-//详情弹窗
|
|
|
-function showDetail(row) {
|
|
|
- dialogRef.value.show(row);
|
|
|
-}
|
|
|
-
|
|
|
-const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
- if (!formEl) return;
|
|
|
- formEl.resetFields();
|
|
|
- form.page = 1;
|
|
|
- onSearch();
|
|
|
-};
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- onSearch();
|
|
|
+const { pageModalRef, handlePreviewData, defaultInfo } = usePageModal({
|
|
|
+ pageContentRef
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="main role">
|
|
|
- <el-form
|
|
|
- ref="formRef"
|
|
|
- :inline="true"
|
|
|
- :model="form"
|
|
|
- :label-width="0"
|
|
|
- class="bg-white w-99/100 pl-8 pt-4"
|
|
|
- >
|
|
|
- <el-form-item prop="company">
|
|
|
- <el-input placeholder="客户公司名称" v-model="form.company" clearable />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="contactor">
|
|
|
- <el-input placeholder="联系人" v-model="form.contactor" clearable />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- :icon="useRenderIcon('search')"
|
|
|
- :loading="loading"
|
|
|
- @click="resetSearch"
|
|
|
- >
|
|
|
- 搜索
|
|
|
- </el-button>
|
|
|
- <el-button :icon="useRenderIcon('refresh')" @click="resetForm(formRef)">
|
|
|
- 重置
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <TableProBar
|
|
|
- title="企业客户"
|
|
|
- :loading="loading"
|
|
|
- :dataList="dataList"
|
|
|
- @refresh="onSearch"
|
|
|
- >
|
|
|
- <template #buttons />
|
|
|
- <template v-slot="{ size, checkList }">
|
|
|
- <PureTable
|
|
|
- border
|
|
|
- align="left"
|
|
|
- showOverflowTooltip
|
|
|
- table-layout="auto"
|
|
|
- :size="size"
|
|
|
- :data="dataList"
|
|
|
- :columns="columns"
|
|
|
- :checkList="checkList"
|
|
|
- :pagination="pagination"
|
|
|
- :paginationSmall="size === 'small' ? true : false"
|
|
|
- :header-cell-style="{ background: '#fafafa', color: '#606266' }"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- >
|
|
|
- <template #operation="{ row }">
|
|
|
- <el-tooltip content="查看详情" placement="top">
|
|
|
- <el-button
|
|
|
- class="reset-margin"
|
|
|
- link
|
|
|
- type="primary"
|
|
|
- :size="size"
|
|
|
- @click="showDetail(row)"
|
|
|
- :icon="useRenderIcon('eye-view')"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </PureTable>
|
|
|
- </template>
|
|
|
- </TableProBar>
|
|
|
-
|
|
|
- <!-- 详情框 -->
|
|
|
- <DetailDialog ref="dialogRef" />
|
|
|
+ <PageSearch
|
|
|
+ :form-config="searchFormConfig"
|
|
|
+ @search-btn-click="handleSearchClick"
|
|
|
+ @reset-btn-click="handleResetClick"
|
|
|
+ />
|
|
|
+ <PageContent
|
|
|
+ ref="pageContentRef"
|
|
|
+ :content-config="contentConfig"
|
|
|
+ @preview-btn-click="handlePreviewData"
|
|
|
+ />
|
|
|
+ <PageModal
|
|
|
+ ref="pageModalRef"
|
|
|
+ prview-description
|
|
|
+ :modal-config="modalConfig"
|
|
|
+ :default-info="defaultInfo"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|