Blame view

src/pages/Invoice/constant.tsx 4.5 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
  },
  {
    title: '状态',
58
    dataIndex: 'statusText',
59
    valueType: 'text',
60
    width: 180,
61
62
63
64
65
  },
  {
    title: '购买方',
    dataIndex: 'purchaser',
    valueType: 'text',
zhongnanhuang authored
66
    width: 180,
67
68
69
70
71
  },
  {
    title: '收款单位',
    dataIndex: 'payee',
    valueType: 'text',
zhongnanhuang authored
72
    width: 180,
zhongnanhuang authored
73
    valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
74
75
76
77
78
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
    valueType: 'text',
zhongnanhuang authored
79
    width: 100,
80
81
82
83
84
  },
  {
    title: '销售',
    dataIndex: 'sale',
    valueType: 'text',
zhongnanhuang authored
85
    width: 100,
86
87
88
89
90
  },
  {
    title: '金额',
    dataIndex: 'money',
    valueType: 'money',
91
92
93
94
95
96
97
98
    hideInSearch: true,
    width: 100,
  },
  {
    title: '开具类型',
    dataIndex: 'invoicingTypeText',
    valueType: 'invoicingTypeText',
    hideInSearch: true,
zhongnanhuang authored
99
    width: 100,
100
101
102
103
  },
  {
    title: '开票日期',
    dataIndex: 'invoicingTime',
zhongnanhuang authored
104
    valueType: 'dateRange',
zhongnanhuang authored
105
    width: 150,
zhongnanhuang authored
106
107
108
109
110
111
112
113
114
115
    search: {
      transform: (value) => {
        if (value) {
          return {
            invoicingBeginTime: value[0],
            invoicingEndTime: value[1],
          };
        }
      },
    },
116
117
118
119
  },
  {
    title: '收款时间',
    dataIndex: 'collectionTime',
zhongnanhuang authored
120
    valueType: 'dateRange',
zhongnanhuang authored
121
    width: 200,
zhongnanhuang authored
122
123
124
125
126
127
128
129
130
131
    search: {
      transform: (value) => {
        if (value) {
          return {
            collectionBeginTime: value[0],
            collectionEndTime: value[1],
          };
        }
      },
    },
132
133
134
135
136
  },
  {
    title: '备注',
    dataIndex: 'notes',
    valueType: 'text',
137
    hideInSearch: true,
zhongnanhuang authored
138
    width: 250,
139
140
  },
];
141
142
143
144
145
146
147
148
const convertToObjectWithTextAndStatus = (obj) => {
  const newObj = {};
  for (const [key, value] of Object.entries(obj)) {
    newObj[key] = { text: value, status: key };
  }
  return newObj;
};
zhongnanhuang authored
149
150
151
export const BANK_STATEMENT_COLUMNS = [
  {
    dataIndex: 'id',
zhongnanhuang authored
152
    title: '编号',
zhongnanhuang authored
153
    valueType: 'text',
zhongnanhuang authored
154
155
156
157
    width: 160,
    copyable: true,
    // hideInTable: true,
    // hideInSearch: true,
zhongnanhuang authored
158
    editable: false,
zhongnanhuang authored
159
160
161
162
163
164
165
166
  },
  {
    dataIndex: 'serialNumber',
    title: '流水号',
    valueType: 'text',
    width: 100,
  },
  {
167
    dataIndex: 'collectionDatetime',
曾国涛 authored
168
169
    title: '收款时间',
    valueType: 'date',
zhongnanhuang authored
170
    width: 100,
zhongnanhuang authored
171
    hideInSearch: true,
zhongnanhuang authored
172
173
  },
  {
174
    dataIndex: 'collectionDatetimeSearch',
曾国涛 authored
175
    title: '收款时间',
zhongnanhuang authored
176
    valueType: 'dateRange',
zhongnanhuang authored
177
    width: 100,
曾国涛 authored
178
    hideInTable: true,
zhongnanhuang authored
179
180
181
182
    search: {
      transform: (value) => {
        if (value) {
          return {
183
184
            collectionDatetimeBegin: value[0],
            collectionDatetimeEnd: value[1],
zhongnanhuang authored
185
186
187
188
          };
        }
      },
    },
zhongnanhuang authored
189
190
  },
  {
曾国涛 authored
191
192
    dataIndex: 'payeeText',
    title: '收款方',
zhongnanhuang authored
193
194
    valueType: 'text',
    width: 100,
195
196
197
198
199
200
    hideInSearch: true,
  },
  {
    title: '收款方',
    width: 80,
    dataIndex: 'payee',
201
    hideInTable: true,
202
    valueEnum: convertToObjectWithTextAndStatus(PAYEE_OPTIONS),
zhongnanhuang authored
203
204
  },
  {
曾国涛 authored
205
206
    dataIndex: 'payer',
    title: '付款方',
zhongnanhuang authored
207
208
209
210
    valueType: 'text',
    width: 100,
  },
  {
曾国涛 authored
211
212
    dataIndex: 'amount',
    title: '金额',
zhongnanhuang authored
213
214
    valueType: 'text',
    width: 100,
215
    hideInSearch: true,
zhongnanhuang authored
216
217
  },
  {
曾国涛 authored
218
219
    dataIndex: 'remark',
    title: '备注',
zhongnanhuang authored
220
221
    valueType: 'text',
    width: 100,
222
    hideInSearch: true,
zhongnanhuang authored
223
224
225
226
227
228
  },
  {
    dataIndex: 'remarkNote',
    title: '附言',
    valueType: 'text',
    width: 100,
229
    hideInSearch: true,
zhongnanhuang authored
230
231
  },
];