Blame view

src/pages/Invoice/constant.tsx 4.75 KB
zhongnanhuang authored
1
2
3
import { enumToProTableEnumValue } from '@/utils';
import { PAYEE_OPTIONS } from '../Order/constant';
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export type InvoiceItem = {
  id: number; //id
  invoiceStatus: string; //发票类型:专票/普票
  invoiceNumber: string; //发票号码
  status: string; //状态
  purchaser: string; //购买方
  payee: string; //收款单位
  contacts: string; //联系人
  sale: string; //销售
  money: number; //金额
  invoicingTime: string; //开票日期
  collectionTime: string; //收款时间
  notes: string; //备注
};
zhongnanhuang authored
19
20
21
22
export const INVOICE_STATUS = {
  UNVERIFIED: '未核销',
  VERIFIED: '已核销',
  ABNORMAL: '异常',
zhongnanhuang authored
23
  PARTIAL_VERIFICATION: '部分核销',
zhongnanhuang authored
24
25
};
26
27
28
29
30
export const BANKSTATEMENT_STATUS = {
  VERIFIED: '已核销',
  ABNORMAL: '异常',
};
31
32
export const INVOICE_COLUMNS = [
  {
zhongnanhuang authored
33
34
35
36
37
38
39
40
    dataIndex: 'invoiceId',
    title: 'id',
    valueType: 'text',
    hideInTable: true,
    hideInSearch: true,
    width: 100,
  },
  {
41
42
43
    dataIndex: 'invoiceNumber',
    title: '发票号码',
    valueType: 'text',
zhongnanhuang authored
44
    width: 100,
45
46
47
48
49
  },
  {
    dataIndex: 'invoiceStatus',
    title: '发票类型',
    valueType: 'select',
zhongnanhuang authored
50
    width: 100,
zhongnanhuang authored
51
52
53
54
    valueEnum: enumToProTableEnumValue({
      SPECIALLY_INVOICED: '专票',
      COMMON_INVOICED: '普票',
    }),
55
56
57
58
59
  },
  {
    title: '状态',
    dataIndex: 'status',
    valueType: 'text',
zhongnanhuang authored
60
    width: 100,
zhongnanhuang authored
61
62
63
    valueEnum: enumToProTableEnumValue({
      UNVERIFIED: '未核销',
      VERIFIED: '已核销',
zhongnanhuang authored
64
      PARTIAL_VERIFICATION: '部分核销',
zhongnanhuang authored
65
    }),
66
67
68
69
70
  },
  {
    title: '购买方',
    dataIndex: 'purchaser',
    valueType: 'text',
zhongnanhuang authored
71
    width: 180,
72
73
74
75
76
  },
  {
    title: '收款单位',
    dataIndex: 'payee',
    valueType: 'text',
zhongnanhuang authored
77
    width: 180,
zhongnanhuang authored
78
    valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
79
80
81
82
83
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
    valueType: 'text',
zhongnanhuang authored
84
    width: 100,
85
86
87
88
89
  },
  {
    title: '销售',
    dataIndex: 'sale',
    valueType: 'text',
zhongnanhuang authored
90
    width: 100,
91
92
93
94
95
  },
  {
    title: '金额',
    dataIndex: 'money',
    valueType: 'money',
zhongnanhuang authored
96
    width: 100,
97
98
99
100
  },
  {
    title: '开票日期',
    dataIndex: 'invoicingTime',
zhongnanhuang authored
101
    valueType: 'dateRange',
zhongnanhuang authored
102
    width: 150,
zhongnanhuang authored
103
104
105
106
107
108
109
110
111
112
    search: {
      transform: (value) => {
        if (value) {
          return {
            invoicingBeginTime: value[0],
            invoicingEndTime: value[1],
          };
        }
      },
    },
113
114
115
116
  },
  {
    title: '收款时间',
    dataIndex: 'collectionTime',
zhongnanhuang authored
117
    valueType: 'dateRange',
zhongnanhuang authored
118
    width: 200,
zhongnanhuang authored
119
120
121
122
123
124
125
126
127
128
    search: {
      transform: (value) => {
        if (value) {
          return {
            collectionBeginTime: value[0],
            collectionEndTime: value[1],
          };
        }
      },
    },
129
130
131
132
133
  },
  {
    title: '备注',
    dataIndex: 'notes',
    valueType: 'text',
zhongnanhuang authored
134
    width: 250,
135
136
  },
];
137
138
139
140
141
142
143
144
const convertToObjectWithTextAndStatus = (obj) => {
  const newObj = {};
  for (const [key, value] of Object.entries(obj)) {
    newObj[key] = { text: value, status: key };
  }
  return newObj;
};
zhongnanhuang authored
145
146
147
export const BANK_STATEMENT_COLUMNS = [
  {
    dataIndex: 'id',
zhongnanhuang authored
148
    title: '编号',
zhongnanhuang authored
149
    valueType: 'text',
zhongnanhuang authored
150
151
152
153
    width: 160,
    copyable: true,
    // hideInTable: true,
    // hideInSearch: true,
zhongnanhuang authored
154
    editable: false,
zhongnanhuang authored
155
156
  },
  {
曾国涛 authored
157
    dataIndex: 'statusText',
zhongnanhuang authored
158
    title: '状态',
zhongnanhuang authored
159
    valueType: 'select',
zhongnanhuang authored
160
    width: 100,
zhongnanhuang authored
161
    editable: false,
162
163
164
165
166
167
    hideInSearch: true,
  },
  {
    title: '状态',
    width: 80,
    dataIndex: 'status',
168
    hideInTable: true,
169
    valueEnum: convertToObjectWithTextAndStatus(BANKSTATEMENT_STATUS),
zhongnanhuang authored
170
171
172
173
174
175
176
177
  },
  {
    dataIndex: 'serialNumber',
    title: '流水号',
    valueType: 'text',
    width: 100,
  },
  {
178
    dataIndex: 'collectionDatetime',
曾国涛 authored
179
180
    title: '收款时间',
    valueType: 'date',
zhongnanhuang authored
181
    width: 100,
zhongnanhuang authored
182
    hideInSearch: true,
zhongnanhuang authored
183
184
  },
  {
185
    dataIndex: 'collectionDatetimeSearch',
曾国涛 authored
186
    title: '收款时间',
zhongnanhuang authored
187
    valueType: 'dateRange',
zhongnanhuang authored
188
    width: 100,
曾国涛 authored
189
    hideInTable: true,
zhongnanhuang authored
190
191
192
193
    search: {
      transform: (value) => {
        if (value) {
          return {
194
195
            collectionDatetimeBegin: value[0],
            collectionDatetimeEnd: value[1],
zhongnanhuang authored
196
197
198
199
          };
        }
      },
    },
zhongnanhuang authored
200
201
  },
  {
曾国涛 authored
202
203
    dataIndex: 'payeeText',
    title: '收款方',
zhongnanhuang authored
204
205
    valueType: 'text',
    width: 100,
206
207
208
209
210
211
    hideInSearch: true,
  },
  {
    title: '收款方',
    width: 80,
    dataIndex: 'payee',
212
    hideInTable: true,
213
    valueEnum: convertToObjectWithTextAndStatus(PAYEE_OPTIONS),
zhongnanhuang authored
214
215
  },
  {
曾国涛 authored
216
217
    dataIndex: 'payer',
    title: '付款方',
zhongnanhuang authored
218
219
220
221
    valueType: 'text',
    width: 100,
  },
  {
曾国涛 authored
222
223
    dataIndex: 'amount',
    title: '金额',
zhongnanhuang authored
224
225
    valueType: 'text',
    width: 100,
226
    hideInSearch: true,
zhongnanhuang authored
227
228
  },
  {
曾国涛 authored
229
230
    dataIndex: 'remark',
    title: '备注',
zhongnanhuang authored
231
232
    valueType: 'text',
    width: 100,
233
    hideInSearch: true,
zhongnanhuang authored
234
235
236
237
238
239
  },
  {
    dataIndex: 'remarkNote',
    title: '附言',
    valueType: 'text',
    width: 100,
240
    hideInSearch: true,
zhongnanhuang authored
241
242
  },
];