123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <script setup lang="ts">
- import { useColumns } from "./columns";
- import { httpList } from "/@/api/InvoiceSales/invoiceApply";
- import { reactive, ref, onMounted } from "vue";
- 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 { statusList, inv_type_list } from "./status";
- import { useRouter } from "vue-router";
- import { responseHandle } from "/@/utils/responseHandle";
- import IntervalTime from "/@/components/IntervalTime";
- import { useUserStoreHook } from "/@/store/modules/user";
- const { logout } = useNav();
- defineOptions({
- name: "invoiceApply"
- });
- console.log(useUserStoreHook().getMenuActions("invoiceApply"));
- // const aa=ref([].push(useUserStoreHook().))
- const initform = {
- inv_in: "", //客户公司
- inv_out: "", //业务企业公司
- apply_name: "", //申请人
- // apply_id:'',//申请人ID
- status: "",
- inv_type: "",
- start: "",
- end: "",
- page: 1,
- size: 15
- };
- const form = reactive({ ...initform });
- const { push } = useRouter();
- const dataList = ref([]);
- const loading = ref(false);
- const { columns } = useColumns();
- 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);
- }
- function timeChange(start, end) {
- console.log(start);
- console.log(end);
- }
- async function onSearch() {
- if (loading.value) return;
- 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 editItem(id) {
- push({
- path: "/InvoiceSales/invoiceApplyDeatil",
- query: {
- id
- }
- });
- }
- async function resetForm() {
- Object.keys(form.value).forEach(key => {
- form.value[key] = initform[key];
- });
- await onSearch();
- }
- onMounted(() => {
- onSearch();
- });
- </script>
- <template>
- <div class="main">
- <div class="bg-white p-4">
- <el-row :gutter="10" class="pb-4">
- <el-col :span="5">
- <el-select
- v-model="form.status"
- style="width: 100%"
- placeholder="发票申请状态"
- clearable
- >
- <el-option
- v-for="(si, sii) in statusList"
- :key="'status' + si.value + sii"
- :label="si.label"
- :value="si.value"
- />
- </el-select>
- </el-col>
- <el-col :span="5">
- <el-select
- v-model="form.inv_type"
- style="width: 100%"
- placeholder="发票类型"
- clearable
- >
- <el-option
- v-for="(si, sii) in inv_type_list"
- :key="'status' + si.value + sii"
- :label="si.label"
- :value="si.value"
- />
- </el-select>
- </el-col>
- <el-col :span="10">
- <IntervalTime
- v-model:startValue="form.start"
- v-model:endValue="form.end"
- @timeChange="timeChange"
- /></el-col>
- <el-col :span="4">
- <el-input
- v-model="form.apply_name"
- placeholder="申请人"
- style="width: 100%"
- clearable
- />
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="10">
- <el-input
- v-model="form.inv_in"
- placeholder="企业客户名称"
- style="width: 100%"
- clearable
- />
- </el-col>
- <el-col :span="10">
- <el-input
- v-model="form.inv_out"
- placeholder="业务企业公司"
- style="width: 100%"
- clearable
- />
- </el-col>
- <el-col :span="4">
- <el-button
- type="primary"
- :icon="useRenderIcon('search')"
- :loading="loading"
- class="fl"
- @click="resetSearch"
- >
- 搜索
- </el-button>
- <el-button
- :icon="useRenderIcon('refresh')"
- class="fl"
- @click="resetForm()"
- >
- 重置
- </el-button>
- </el-col>
- </el-row>
- </div>
- <TableProBar
- title="发票申请管理"
- :loading="loading"
- :dataList="dataList"
- @refresh="onSearch"
- >
- <template #buttons>
- <el-button
- type="primary"
- :icon="useRenderIcon('add')"
- @click="editItem('')"
- >
- 新增发票申请
- </el-button>
- </template>
- <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-button
- class="reset-margin"
- link
- type="primary"
- :size="size"
- @click="editItem(row.id)"
- :icon="useRenderIcon('eye-view')"
- />
- </template>
- </PureTable>
- </template>
- </TableProBar>
- </div>
- </template>
- <style scoped lang="scss">
- :deep(.el-dropdown-menu__item i) {
- margin: 0;
- }
- </style>
|