Browse Source

feat:买入回票统计

snow 2 years ago
parent
commit
51dab12ab4

+ 4 - 1
src/components/PageContainer/src/page-container.tsx

@@ -72,11 +72,14 @@ const PageContainer = defineComponent({
           onPreviewBtnClick={contentEvents.preview || modal.handlePreviewData}
           onUpdateBtnClick={contentEvents.update || modal.handleUpdateData}
           onCreateBtnClick={contentEvents.create || modal.handleCreateData}
+          onGetListResult={contentEvents.result}
           onSelectionChange={value => emit("content-select-change", value)}
           v-slots={{
             header: () => slots.content_header && slots.content_header(),
             custom: row => slots.content_action && slots.content_action(row),
-            expand: row => slots.expand && slots.expand(row)
+            expand: row => slots.expand && slots.expand(row),
+            tableBottom: () =>
+              slots.content_table_bottom && slots.content_table_bottom()
           }}
         />
       );

+ 1 - 0
src/components/PageContainer/src/types.ts

@@ -11,6 +11,7 @@ export type Events = {
     preview?: (row: any) => any;
     update?: (row: any) => any;
     create?: () => any;
+    result?: (row1: any, row2: any) => any;
   };
 };
 

+ 0 - 1
src/components/PageContent/src/hooks/use-params.ts

@@ -3,7 +3,6 @@ import { useAppStoreHook } from "/@/store/modules/app";
 
 export function useParams() {
   const { searchParams } = useAppStoreHook();
-  
 
   //查询参数
   const basicParams = ref<Record<string, any>>(

+ 5 - 3
src/components/PageContent/src/hooks/use-request.ts

@@ -1,4 +1,4 @@
-import { onMounted, ref, watch } from "vue";
+import { getCurrentInstance, onMounted, ref, watch } from "vue";
 import { ActionType, PageContentProps } from "../types";
 import { mapActionToApi } from "../utils/create-operation";
 import { mergeParams } from "../utils/merge-params";
@@ -12,6 +12,7 @@ import { useUserInfo } from "/@/hooks/core/useUser";
 
 export function useRequeset(props: PageContentProps) {
   const { contentConfig } = props;
+  const { emit } = getCurrentInstance();
   const { mockData, notNeedCompanyFilter } = contentConfig;
 
   const { logout } = useNav();
@@ -19,7 +20,7 @@ export function useRequeset(props: PageContentProps) {
   const dataList = ref(mockData ? mockData : []);
   const initRequest = ref(!props.contentConfig.notReuqiredInit);
 
-  const { currentCompany, isSwitchingCompany } = useCompany();
+  const { currentCompany } = useCompany();
   const { isSuperUser } = useUserInfo();
 
   const { getBasicParams, changeBasicParams } = useParams();
@@ -59,6 +60,7 @@ export function useRequeset(props: PageContentProps) {
       handler: () => {
         const list = Array.isArray(data) ? data : data.list;
         dataList.value = isTree ? handleTree(list ?? []) : list;
+        emit("getListResult", data, getBasicParams());
         changePagination("total", data.count);
       }
     });
@@ -110,7 +112,7 @@ export function useRequeset(props: PageContentProps) {
     () => currentCompany.value,
     () => {
       if (!notNeedCompanyFilter && isSuperUser.value) {
-        onSearch()
+        onSearch();
       }
     }
   );

+ 13 - 7
src/components/PageContent/src/page-content.tsx

@@ -1,5 +1,5 @@
 /* eslint-disable prettier/prettier */
-import { defineComponent, ref } from "vue";
+import { defineComponent, onMounted, ref, nextTick } from "vue";
 import PureTable from "@pureadmin/table";
 import { pageContentProps } from "./types";
 import { TableProBar } from "../../ReTable";
@@ -32,7 +32,8 @@ const PageConent = defineComponent({
     "updateBtnClick",
     "previewBtnClick",
     "statusBtnClick",
-    "selectionChange"
+    "selectionChange",
+    "getListResult"
   ],
   setup(props, { expose, emit, slots }) {
     //根据传入的api决定表格需要的操作
@@ -192,9 +193,7 @@ const PageConent = defineComponent({
       return (
         <div style={{ display: "flex", gap: "5px" }}>
           {/* excel导出 */}
-
           {slots.header && slots.header()}
-
           {renderCreateButton()}
         </div>
       );
@@ -293,8 +292,8 @@ const PageConent = defineComponent({
           onSelectionChange={handleSelection}
           {...paginationConfig}
           v-slots={{
-            operation: ({ row }) => renderOperation(row),
-            expand: ({ row }) => renderExpand(row)
+            expand: ({ row }) => renderExpand(row),
+            operation: ({ row }) => renderOperation(row)
           }}
         />
       );
@@ -313,6 +312,7 @@ const PageConent = defineComponent({
 
       return (
         <TableProBar
+
           tableRef={tableRef.value?.getTableRef()}
           title={title}
           dataList={dataList.value}
@@ -321,7 +321,13 @@ const PageConent = defineComponent({
           v-slots={{
             buttons: () => renderButtons(),
             toolbar: () => renderFilterColumnns(),
-            default: ({ size, checkList }) => renderPureTable(size, checkList)
+            default: ({ size, checkList }) => (
+              <div class="table-content">
+                {renderPureTable(size, checkList)}
+                <div class="table-inner">{slots.tableBottom && slots.tableBottom()}</div>
+                <div style={{ clear: 'both' }}></div>
+              </div>
+            )
           }}
         />
       );

+ 15 - 0
src/components/PageContent/src/styles/index.scss

@@ -24,3 +24,18 @@
     align-items: center;
   }
 }
+
+.table-content{
+  position: relative;
+
+  .el-pagination {
+    float: right;
+    width: auto !important;
+  }
+
+  .table-inner{
+    float: right;
+    margin-top: 22px;
+    margin-right: 10px;
+  }
+}

+ 3 - 2
src/components/PageContent/src/types.ts

@@ -36,8 +36,9 @@ export interface ContentConfig {
   companyProp?: string;
   superUserNoAction?: boolean;
   superUserNoPerview?: boolean;
-  showCreate: (isSuperUser: boolean) => boolean;
-  showStatus: (isSuperUser) => boolean;
+  handleListResult?: (list: any[], params: any) => any;
+  showCreate?: (isSuperUser: boolean) => boolean;
+  showStatus?: (isSuperUser) => boolean;
   statusRowProp?: (row: any) => any;
   showPreview?: (row: Record<string, string>) => boolean;
   showDelete?: (row: Record<string, string>) => boolean;

+ 0 - 3
src/store/modules/user.ts

@@ -116,7 +116,6 @@ export const useUserStore = defineStore({
       this.info = data;
       if (Number(code) === 0) {
         const { role_level } = data;
-
         this.isSuperUser = role_level === "1";
         const code = getRelaComNo();
         const companyName = getRelaComName();
@@ -124,12 +123,10 @@ export const useUserStore = defineStore({
           const { code: __code, data: __data } = await httpCompany({
             companyName
           });
-
           if (Number(__code) === 0) {
             this.companyList = __data.list;
           }
         }
-
         const index = this.companyList.findIndex(
           ({ companyNo }) => companyNo === code
         );

+ 2 - 2
src/views/InvoiceSaleSettings/basic-settings.vue

@@ -166,11 +166,11 @@ watch(
               @inital="code => (formData.cat_code = code)"
             />
           </el-form-item>
-          <el-form-item label="商品名称" prop="inv_good_name" flex-1>
+          <el-form-item label="开票商品名称" prop="inv_good_name" flex-1>
             <el-input
               w-full
               v-model="formData.inv_good_name"
-              placeholder="请输入商品名称"
+              placeholder="请输入开票商品名称"
               maxlength="70"
             />
           </el-form-item>

+ 0 - 4
src/views/InvoiceSaleSettings/commodityCost/config/configs.ts

@@ -110,10 +110,6 @@ export const good_detail_columns = [
     field: "inv_good_name",
     label: "开票商品名称"
   },
-  {
-    field: "inv_good_name",
-    label: "开票商品名称"
-  },
   {
     field: "addtime",
     label: "申请时间"

+ 2 - 1
src/views/purchase/ticketReturn/config/_details.ts

@@ -2,11 +2,12 @@
  * 采购回票详情
  */
 
-import { ElImage, ElTag } from "element-plus";
 import { h } from "vue";
+import { ElImage, ElTag } from "element-plus";
 import { createTooltip } from "/@/utils/tootip";
 import { DescriptionColumns } from "/@/components/BasicDescriptions";
 import { invTypeOptions, statusOptions } from "./_opitons";
+
 import {
   invoiceTypeList,
   seller_check_type,

+ 22 - 6
src/views/purchase/ticketReturn/index.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { ref } from "vue";
+import { ref, reactive } from "vue";
 import contentConfig from "./config/content.config";
 import searchConfig from "./config/search.config";
 import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
@@ -23,16 +23,21 @@ const invStatus = ["4", "10"];
 // { code: "017", name: "导出回票数据" },
 // { code: "018", name: "批量导入认证结果" },
 // { code: "019", name: "下载回票批量申请模板" },
-const { hasPermissionWithCode } = usePermission(PageName);
+
 const { isSuperUser } = useUserInfo();
+const { hasPermissionWithCode } = usePermission(PageName);
 const pageContentRef = ref<InstanceType<typeof PageContent> | null>(null);
-
+const loading = ref(false);
 const { push } = useRouter();
 const { currentCompany } = useCompany();
-const loading = ref(false);
 const invoiceModalRef = ref<InstanceType<typeof InvoiceModal>>(null);
 const execelUploadRef = ref<InstanceType<typeof ExeclUpoad>>(null);
 
+const statistics = reactive({
+  inv_subtotal_amount: "",
+  total: ""
+});
+
 async function handleDownload() {
   await httpRequsetExport({
     url: "ile",
@@ -54,7 +59,12 @@ const hooks: PageHooks = {
 const events: PageEvents = {
   content: {
     preview: ({ hpNo }) => push(`${baseUrl}?id=${hpNo}`),
-    create: () => push(baseUrl)
+    create: () => push(baseUrl),
+    result: data => {
+      const { inv_subtotal_amount, total } = data;
+      statistics.inv_subtotal_amount = inv_subtotal_amount;
+      statistics.total = total;
+    }
   }
 };
 
@@ -64,7 +74,6 @@ function onDownloadTemplate() {
   const workBook = utils.book_new();
   const workSheet = utils.json_to_sheet([template]);
   utils.book_append_sheet(workBook, workSheet, "sheet");
-
   //导出模板
   writeFile(workBook, "回票批量导入模板.xlsx", {
     bookType: "xlsx"
@@ -117,6 +126,13 @@ function onDownloadTemplate() {
           @click="() => invoiceModalRef.onDisplay(row)"
         />
       </template>
+
+      <template #content_table_bottom>
+        <p v-if="statistics.inv_subtotal_amount" style="font-weight: 500">
+          合计: 发票税前金额:{{ statistics.inv_subtotal_amount }}, 价税合计:
+          {{ statistics.total }}
+        </p>
+      </template>
     </PageContainer>
 
     <InvoiceModal ref="invoiceModalRef" />