• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import type { BasicColumn, FormSchema } from '/@/components/Table';
16import { h } from 'vue';
17import { Avatar } from 'ant-design-vue';
18import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
19import { render } from '/@/utils/common/renderUtils';
20import type { Component } from 'vue';
21
22export const columns: BasicColumn[] = [
23  {
24    title: '名称',
25    dataIndex: 'name',
26  },
27  {
28    title: '封面',
29    dataIndex: 'cover',
30    width: 100,
31    customRender: ({ text }): Component => {
32      return h(Avatar, {
33        src: getFileAccessHttpUrl(text),
34        shape: 'square',
35        size: 'default',
36      });
37    },
38  },
39  {
40    title: '是否营业',
41    dataIndex: 'isOpen',
42    customRender: ({ text }): Component => {
43      return render.renderDict(text, 'yn');
44    },
45  },
46  {
47    title: '地址',
48    dataIndex: 'address',
49  },
50  {
51    title: '距离',
52    dataIndex: 'distance',
53    customRender: ({ text }): string => {
54      return text != null ? text + 'km' : '';
55    },
56  },
57  {
58    title: '营业开始时间',
59    dataIndex: 'startTime',
60    width: 120,
61  },
62  {
63    title: '营业结束时间',
64    dataIndex: 'endTime',
65    width: 120,
66  },
67];
68
69export const columnsGoods: BasicColumn[] = [
70  {
71    title: '商品名称',
72    dataIndex: 'name',
73    align: 'center',
74  },
75  {
76    title: '封面',
77    dataIndex: 'cover',
78    width: 100,
79    align: 'center',
80    slots: { customRender: 'imgSlot' },
81  },
82  {
83    title: '添加时间',
84    align: 'center',
85    dataIndex: 'createTime',
86  },
87  {
88    title: '操作',
89    align: 'center',
90    dataIndex: 'action',
91    slots: { customRender: 'action' },
92  },
93];
94
95export const columnsComment: BasicColumn[] = [
96  {
97    title: '用户',
98    dataIndex: 'userName',
99    align: 'center',
100  },
101  {
102    title: '评分',
103    dataIndex: 'star',
104    align: 'center',
105  },
106  {
107    title: '内容',
108    dataIndex: 'content',
109    align: 'center',
110    width: 200,
111    ellipsis: true,
112  },
113  {
114    title: '时间',
115    dataIndex: 'createTime',
116    align: 'center',
117  },
118  {
119    title: '操作',
120    align: 'center',
121    dataIndex: 'action',
122    slots: { customRender: 'action' },
123  },
124];
125
126export const searchFormSchema: FormSchema[] = [
127  {
128    field: 'name',
129    label: '商家名称',
130    component: 'Input',
131    colProps: { span: 8 },
132  },
133  {
134    field: 'longitude',
135    label: '经度',
136    component: 'Input',
137    colProps: { span: 4 },
138  },
139  {
140    field: 'latitude',
141    label: '纬度',
142    component: 'Input',
143    colProps: { span: 4 },
144  },
145];
146
147export const formSchema: FormSchema[] = [
148  {
149    field: 'id',
150    label: 'id',
151    component: 'Input',
152    show: false,
153  },
154  {
155    field: 'createBy',
156    label: 'createBy',
157    component: 'Input',
158    show: false,
159  },
160  {
161    field: 'createTime',
162    label: 'createTime',
163    component: 'Input',
164    show: false,
165  },
166  {
167    field: 'name',
168    label: '商家名称',
169    component: 'Input',
170    required: true,
171    componentProps: {
172      placeholder: '请输入商家名称',
173    },
174  },
175  {
176    field: 'isOpen',
177    label: '是否营业',
178    component: 'JDictSelectTag',
179    required: true,
180    componentProps: {
181      dictCode: 'yn',
182      placeholder: '请选择',
183      stringToNumber: true,
184    },
185    colProps: {
186      span: 11,
187    },
188  },
189  {
190    field: 'address',
191    label: '地址',
192    component: 'Input',
193    componentProps: {
194      placeholder: '请输入地址',
195    },
196    colProps: {
197      span: 11,
198    },
199  },
200  {
201    field: 'longitude',
202    label: '经度',
203    component: 'Input',
204    componentProps: {
205      placeholder: '请输入经度',
206    },
207    colProps: {
208      span: 11,
209    },
210  },
211  {
212    field: 'latitude',
213    label: '纬度',
214    component: 'Input',
215    componentProps: {
216      placeholder: '请输入纬度',
217    },
218    colProps: {
219      span: 11,
220    },
221  },
222  {
223    field: 'startTime',
224    label: '营业开始时间',
225    component: 'Input',
226    componentProps: {
227      placeholder: '请输入开始时间',
228    },
229    colProps: {
230      span: 11,
231    },
232  },
233  {
234    field: 'endTime',
235    label: '营业结束时间',
236    component: 'Input',
237    componentProps: {
238      placeholder: '请输入结束时间',
239    },
240    colProps: {
241      span: 11,
242    },
243  },
244  {
245    field: 'startPrice',
246    label: '起送费',
247    component: 'InputNumber',
248    componentProps: {
249      placeholder: '请输入起送费',
250    },
251    colProps: {
252      span: 11,
253    },
254  },
255  {
256    field: 'deliveryPrice',
257    label: '配送费',
258    component: 'InputNumber',
259    componentProps: {
260      placeholder: '请输入配送费',
261    },
262    colProps: {
263      span: 11,
264    },
265  },
266  {
267    field: 'cover',
268    label: '封面',
269    component: 'JImageUpload',
270    componentProps: {
271      fileMax: 1,
272    },
273  },
274  {
275    field: 'phoneNumber',
276    label: '商家号码',
277    component: 'Input',
278    componentProps: {
279      placeholder: '请输入商家号码',
280    },
281    colProps: {
282      span: 11,
283    },
284  },
285  {
286    field: 'notice',
287    label: '公告',
288    component: 'InputTextArea',
289    labelLength: 8,
290    componentProps: {
291      placeholder: '请输入公告',
292    },
293  },
294];
295