Browse Source

feat:LDTable组件对于返回序号增加states字段的判断

Lk 2 years ago
parent
commit
89164a52bc

+ 2 - 2
src/components/table/index.tsx

@@ -55,8 +55,8 @@ export default defineComponent({
           key: 'no',
           width: TABLE_CELL_WIDTH.no,
           align: 'center',
-          render(_, rowIndex) {
-            return rowIndex + 1;
+          render(items, rowIndex) {
+            return items.states ? '' : rowIndex + 1;
           },
         });
       }

+ 2 - 2
src/models/request/inventory.ts

@@ -51,6 +51,6 @@ export type AddInventoryParams = {
 };
 //新增物料管理
 export type EditInventoryParams = {
-
-   SupDays: string;
+   SupDays?: string;
+   id: string;
   };

+ 1 - 0
src/models/response/inventory.ts

@@ -19,6 +19,7 @@ export type GetInventoryData = {
   cInvDefine1: string;
   //型号编码
   cInvDefine2: string;
+  children: GetInventoryDatas[];
 };
 export type GetInventoryDatas = {
   ErpCode: string;

+ 1 - 1
src/models/response/myVendor.ts

@@ -7,5 +7,5 @@ cVenCode: string;
 * 供应商名称
 */
 cVenName: string;
-
+states?: string;
 };

+ 41 - 0
src/pages/inventory/table/children.vue

@@ -0,0 +1,41 @@
+<script setup lang="ts">
+import {ZodStringCheck} from 'zod';
+
+type Obj = {
+  SupDays: string;
+  cVenName: string;
+  price: string
+};
+type Props = {
+  data: Obj[];
+};
+
+const props = defineProps<Props>();
+console.log(props.data);
+</script>
+<template>
+  <div class="box">
+    <div
+      style="padding-right: 300px;"
+      class="child-item"
+      v-for="(item,index) in props.data"
+      :key="index"
+    >
+      <span style="width: 260px;">{{item.SupDays!}}</span>
+      <span style="width: 260px;">{{item.price!}}</span>
+      <span style="width: 150px;">{{item.cVenName!}}</span>
+    </div>
+  </div>
+</template>
+<style scoped lang="css">
+.box .child-item{
+  box-sizing: border-box;
+display: flex;
+flex-direction: row-reverse;
+height: 60px;
+line-height: 60px;
+}
+.box .child-item span{
+text-align: center;
+}
+</style>

+ 4 - 8
src/pages/inventory/table/hooks.ts

@@ -1,6 +1,6 @@
 import {searchSymbol, pageSymbol, filterSymbol} from '../state';
 import {GetInventoryList, DeleteInventory, resetPassword} from '@apis';
-import {type DataTableColumn, NSpace, useMessage, useDialog} from 'naive-ui';
+import {type DataTableColumn, NSpace, NDataTable, NTable} from 'naive-ui';
 import {GetCheckListParams, GetInventoryParams} from '@models';
 import {
   useFetchTableList,
@@ -9,8 +9,9 @@ import {
 } from '@hooks';
 import {TABLE_CELL_WIDTH, lightVariable} from '@utils';
 import {computed, h, ref} from 'vue';
-import {LDTableButton} from '@components';
+import {LDTableButton, LDTable} from '@components';
 import {useI18n} from 'vue-i18n';
+import Children from './children.vue';
 
 export function useTableData() {
   return useFetchTableList({
@@ -36,11 +37,6 @@ export function useColumns(refetch: () => void) {
   const columns
   = computed<DataTableColumn<GetCheckListParams>[]>(function() {
     return [
-      {
-        type: 'expand',
-        expandable: data => data.supplierList.length,
-        renderExpand: data => data.supplierList[0].length,
-      },
       {
         title: t('inventory.table[0]'),
         key: 'cCusName',
@@ -79,7 +75,7 @@ export function useColumns(refetch: () => void) {
       {
         title: t('inventory.table[7]'),
         width: TABLE_CELL_WIDTH.date,
-        key: 'supDays',
+        key: 'SupDays',
       },
       {
         title: t('common.tableHeader.operation'),

+ 0 - 18
src/pages/inventory/table/index.vue

@@ -17,24 +17,6 @@ const [isExporting, onExport] = useTableExportEvent(
   pageSymbol,
   {fn: exportInventory},
 );
-// const datas = [
-//   {
-//     ErpCode: 'ERD111',
-//     Pcode: '111',
-//     cCusModelName: '型号3',
-//     cCusName: '山西传媒有限公司',
-//     cInvName: '液压轴',
-//     id: 4,
-//   },
-//   {
-//     ErpCode: 'ERD111',
-//     Pcode: '111',
-//     cCusModelName: '型号3',
-//     cCusName: '山西传媒有限公司',
-//     cInvName: '液压轴',
-//     id: 4,
-//   },
-// ];
 </script>
 <template>
   <NCard class="table-wrapper">

+ 1 - 2
src/pages/myVendor/filter/index.vue

@@ -25,18 +25,17 @@ const [
 const searchContext = inject<TableSearchContext>(searchSymbol)!;
 
 const {tools, extendsTools} = useExtendsTools();
+//暂时取消可筛选项
 </script>
 
 <template>
   <LDFilterGroup
     @submit="onSubmit"
     @reset="onReset"
-    @filterConfirm="onFilterConfirm"
     :providerKey="filterDataSymbol"
     :fixedTools="tools"
     :sourceTools="filterSource"
     :isSearching="searchContext.isSearching"
-    :extendsTools="extendsTools"
   />
 </template>
 

+ 7 - 4
src/pages/myVendor/table/hooks.ts

@@ -46,6 +46,9 @@ export function useColumns(refetch: () => void) {
         title: t('myVendor.table[0]'),
         key: 'cVenCode',
         width: TABLE_CELL_WIDTH.normal,
+        render(item) {
+          return item.states ? '' : item.cVenCode;
+        },
       },
       {
         title: t('myVendor.table[1]'),
@@ -54,23 +57,23 @@ export function useColumns(refetch: () => void) {
       },
       {
         title: t('myVendor.table[2]'),
-        key: 'role',
+        key: 'ErpCode',
         width: TABLE_CELL_WIDTH.normal,
       },
 
       {
         title: t('myVendor.table[3]'),
-        key: 'email',
+        key: 'Pcode',
         width: TABLE_CELL_WIDTH.normal,
       },
       {
         title: t('myVendor.table[4]'),
-        key: 'phone',
+        key: 'cInvName',
         width: TABLE_CELL_WIDTH.normal,
       },
       {
         title: t('myVendor.table[5]'),
-        key: 'phone',
+        key: 'price',
         width: TABLE_CELL_WIDTH.normal,
       },
       {

+ 1 - 0
src/pages/myVendor/table/index.vue

@@ -42,6 +42,7 @@ const [isExporting, onExport] = useTableExportEvent(
       :columns="columns"
       :pageSymbol="pageSymbol"
       :searchSymbol="searchSymbol"
+       pkey="cVenCode"
     />
   </NCard>