Commit ebd3825b7918f6d9d1029dbb301a77614d956f44
1 parent
d68f5b09
fix: 增加字典许&下拉支持搜索
Showing
12 changed files
with
34 additions
and
24 deletions
src/api/sys/config.ts
... | ... | @@ -11,8 +11,8 @@ enum Api { |
11 | 11 | DELETE = '/order/erp/system_setting/delete_by_id', |
12 | 12 | } |
13 | 13 | |
14 | -export function getList(params: LoginParams, mode: ErrorMessageMode = 'modal') { | |
15 | - return defHttp.post<LoginResultModel>( | |
14 | +export async function getList(params: LoginParams, mode: ErrorMessageMode = 'modal') { | |
15 | + const res = await defHttp.post<LoginResultModel>( | |
16 | 16 | { |
17 | 17 | url: Api.LIST, |
18 | 18 | params, |
... | ... | @@ -21,6 +21,12 @@ export function getList(params: LoginParams, mode: ErrorMessageMode = 'modal') { |
21 | 21 | errorMessageMode: mode, |
22 | 22 | }, |
23 | 23 | ); |
24 | + | |
25 | + return new Promise((resolve) => { | |
26 | + resolve({ | |
27 | + items: res?.sort((a, b) => a.settingValue.localeCompare(b.settingValue)) || [], | |
28 | + }); | |
29 | + }); | |
24 | 30 | } |
25 | 31 | export function saveConfig(params: LoginParams) { |
26 | 32 | return defHttp.post<LoginResultModel>( | ... | ... |
src/store/modules/order.ts
... | ... | @@ -89,11 +89,19 @@ export const useOrderStore = defineStore({ |
89 | 89 | /** |
90 | 90 | * @description: login |
91 | 91 | */ |
92 | - async getDict(): Promise<GetUserInfoModel | null> { | |
92 | + async getDict() { | |
93 | 93 | try { |
94 | 94 | const data = await getInitDictData(); |
95 | + const newData = groupBy(data, 'dictCode'); | |
96 | + // 遍历对象的每个键 | |
97 | + Object.keys(newData).forEach((key) => { | |
98 | + // 对每个数组按照字典序排序 | |
99 | + newData[key].sort((x, y) => { | |
100 | + return x.dictValue.localeCompare(y.dictValue); | |
101 | + }); | |
102 | + }); | |
95 | 103 | |
96 | - this.dicts = groupBy(data, 'dictCode'); | |
104 | + this.dicts = newData; | |
97 | 105 | } catch (error) { |
98 | 106 | return Promise.reject(error); |
99 | 107 | } | ... | ... |
src/views/project/account/index.vue
src/views/project/config/TablePanel.vue
... | ... | @@ -34,8 +34,8 @@ |
34 | 34 | |
35 | 35 | const [registerTable, { reload }] = useTable({ |
36 | 36 | api: getList, |
37 | - searchInfo: props.searchInfo, | |
38 | - | |
37 | + searchInfo: { ...props.searchInfo, pageSize: 1000 }, | |
38 | + pagination: false, | |
39 | 39 | columns: COLUMNS[props.column!], |
40 | 40 | rowKey: 'id', |
41 | 41 | actionColumn: { | ... | ... |
src/views/project/order/FieldDetail.vue
... | ... | @@ -116,7 +116,10 @@ |
116 | 116 | |
117 | 117 | setTimeout(async () => { |
118 | 118 | const res = await dictList({ dictCode: key.value }); |
119 | - dataSource.value = res.records; | |
119 | + dataSource.value = | |
120 | + res.records?.sort((x, y) => { | |
121 | + return x.dictValue.localeCompare(y.dictValue); | |
122 | + }) || []; | |
120 | 123 | reload(); |
121 | 124 | }, 300); |
122 | 125 | } | ... | ... |
src/views/project/order/FormDetail/BaseFormPanel.vue
... | ... | @@ -48,11 +48,6 @@ |
48 | 48 | |
49 | 49 | // businessPerson, |
50 | 50 | } = useOrderInfo(orderStore); |
51 | - console.log( | |
52 | - '%c [ productionDepartment ]-57', | |
53 | - 'font-size:13px; background:pink; color:#bf2c9f;', | |
54 | - productionDepartment, | |
55 | - ); | |
56 | 51 | |
57 | 52 | var schemas = computed(() => { |
58 | 53 | const options = { |
... | ... | @@ -95,17 +90,11 @@ |
95 | 90 | }; |
96 | 91 | } |
97 | 92 | |
98 | - console.log( | |
99 | - '%c [ ]-98', | |
100 | - 'font-size:13px; background:pink; color:#bf2c9f;', | |
101 | - item.field, | |
102 | - options[item.field], | |
103 | - ); | |
104 | - | |
105 | 93 | return { |
106 | 94 | ...item, |
107 | 95 | field: `${item.field}`, |
108 | 96 | componentProps: { |
97 | + ...(item.component === 'Select' && { showSearch: true }), | |
109 | 98 | ...(item.component === 'Select' && { options: options[item.field] }), |
110 | 99 | disabled: getBaseDisable(item.field, get(fields.value, `${item.field}`), props.id), |
111 | 100 | }, | ... | ... |
src/views/project/order/FormDetail/InspectionFormPanel.vue
src/views/project/order/FormDetail/ProfitFormPanel.vue
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | field: `${item.field}`, |
43 | 43 | componentProps: { |
44 | 44 | ...item.componentProps, |
45 | + ...(item.component === 'Select' && { showSearch: true }), | |
45 | 46 | ...(item.component === 'Select' && |
46 | 47 | !item.componentProps?.options?.length && { options: options[item.field] }), |
47 | 48 | disabled: getProfitDisable( | ... | ... |
src/views/project/order/FormDetail/ReportFormPanel.vue
... | ... | @@ -50,6 +50,7 @@ |
50 | 50 | ...item, |
51 | 51 | field: `${item.field}`, |
52 | 52 | componentProps: { |
53 | + ...(item.component === 'Select' && { showSearch: true }), | |
53 | 54 | ...(item.component === 'Select' && { options: options[optionsField] }), |
54 | 55 | disabled: getDisable( |
55 | 56 | get(fields.value, `${item.field}`), | ... | ... |
src/views/project/order/FormDetail/TrackFormPanel.vue
src/views/project/order/index.vue
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <!-- <template v-if="column.key === 'address1'"> |
6 | 6 | <span class="flex items-center justify-center"> 自定义字段列11 </span> |
7 | 7 | </template> --> |
8 | - <template v-if="SELECT_FIELD_COLUMNS.includes(column.key)"> | |
8 | + <template v-if="SELECT_FIELD_COLUMNS.includes(column.key) && role === ROLE.ADMIN"> | |
9 | 9 | <span class="flex items-center justify-center"> |
10 | 10 | {{ column.customTitle }} |
11 | 11 | <FormOutlined class="ml-2 cursor-pointer" @click="handleFieldVisible(column)" /> | ... | ... |
src/views/project/order/tableData.tsx
... | ... | @@ -1254,7 +1254,7 @@ export function getFormConfig(): Partial<FormProps> { |
1254 | 1254 | }, |
1255 | 1255 | { |
1256 | 1256 | field: `productionDepartmentConsignStartTime`, |
1257 | - label: `生成科拖货开始时间`, | |
1257 | + label: `生产科拖货开始时间`, | |
1258 | 1258 | component: 'DatePicker', |
1259 | 1259 | colProps: { |
1260 | 1260 | span: 6, |
... | ... | @@ -1263,7 +1263,7 @@ export function getFormConfig(): Partial<FormProps> { |
1263 | 1263 | }, |
1264 | 1264 | { |
1265 | 1265 | field: `productionDepartmentConsignEndTime`, |
1266 | - label: `生成科拖货结束时间`, | |
1266 | + label: `生产科拖货结束时间`, | |
1267 | 1267 | component: 'DatePicker', |
1268 | 1268 | colProps: { |
1269 | 1269 | span: 6, | ... | ... |