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,8 +11,8 @@ enum Api { | ||
11 | DELETE = '/order/erp/system_setting/delete_by_id', | 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 | url: Api.LIST, | 17 | url: Api.LIST, |
18 | params, | 18 | params, |
@@ -21,6 +21,12 @@ export function getList(params: LoginParams, mode: ErrorMessageMode = 'modal') { | @@ -21,6 +21,12 @@ export function getList(params: LoginParams, mode: ErrorMessageMode = 'modal') { | ||
21 | errorMessageMode: mode, | 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 | export function saveConfig(params: LoginParams) { | 31 | export function saveConfig(params: LoginParams) { |
26 | return defHttp.post<LoginResultModel>( | 32 | return defHttp.post<LoginResultModel>( |
src/store/modules/order.ts
@@ -89,11 +89,19 @@ export const useOrderStore = defineStore({ | @@ -89,11 +89,19 @@ export const useOrderStore = defineStore({ | ||
89 | /** | 89 | /** |
90 | * @description: login | 90 | * @description: login |
91 | */ | 91 | */ |
92 | - async getDict(): Promise<GetUserInfoModel | null> { | 92 | + async getDict() { |
93 | try { | 93 | try { |
94 | const data = await getInitDictData(); | 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 | } catch (error) { | 105 | } catch (error) { |
98 | return Promise.reject(error); | 106 | return Promise.reject(error); |
99 | } | 107 | } |
src/views/project/account/index.vue
@@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
15 | // onClick: handleView.bind(null, record), | 15 | // onClick: handleView.bind(null, record), |
16 | // }, | 16 | // }, |
17 | { | 17 | { |
18 | - icon: 'clarity:note-edit-line', | ||
19 | - tooltip: '编辑用户资料', | 18 | + label: '编辑', |
19 | + // tooltip: '编辑用户资料', | ||
20 | onClick: handleEdit.bind(null, record), | 20 | onClick: handleEdit.bind(null, record), |
21 | }, | 21 | }, |
22 | // { | 22 | // { |
src/views/project/config/TablePanel.vue
@@ -34,8 +34,8 @@ | @@ -34,8 +34,8 @@ | ||
34 | 34 | ||
35 | const [registerTable, { reload }] = useTable({ | 35 | const [registerTable, { reload }] = useTable({ |
36 | api: getList, | 36 | api: getList, |
37 | - searchInfo: props.searchInfo, | ||
38 | - | 37 | + searchInfo: { ...props.searchInfo, pageSize: 1000 }, |
38 | + pagination: false, | ||
39 | columns: COLUMNS[props.column!], | 39 | columns: COLUMNS[props.column!], |
40 | rowKey: 'id', | 40 | rowKey: 'id', |
41 | actionColumn: { | 41 | actionColumn: { |
src/views/project/order/FieldDetail.vue
@@ -116,7 +116,10 @@ | @@ -116,7 +116,10 @@ | ||
116 | 116 | ||
117 | setTimeout(async () => { | 117 | setTimeout(async () => { |
118 | const res = await dictList({ dictCode: key.value }); | 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 | reload(); | 123 | reload(); |
121 | }, 300); | 124 | }, 300); |
122 | } | 125 | } |
src/views/project/order/FormDetail/BaseFormPanel.vue
@@ -48,11 +48,6 @@ | @@ -48,11 +48,6 @@ | ||
48 | 48 | ||
49 | // businessPerson, | 49 | // businessPerson, |
50 | } = useOrderInfo(orderStore); | 50 | } = useOrderInfo(orderStore); |
51 | - console.log( | ||
52 | - '%c [ productionDepartment ]-57', | ||
53 | - 'font-size:13px; background:pink; color:#bf2c9f;', | ||
54 | - productionDepartment, | ||
55 | - ); | ||
56 | 51 | ||
57 | var schemas = computed(() => { | 52 | var schemas = computed(() => { |
58 | const options = { | 53 | const options = { |
@@ -95,17 +90,11 @@ | @@ -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 | return { | 93 | return { |
106 | ...item, | 94 | ...item, |
107 | field: `${item.field}`, | 95 | field: `${item.field}`, |
108 | componentProps: { | 96 | componentProps: { |
97 | + ...(item.component === 'Select' && { showSearch: true }), | ||
109 | ...(item.component === 'Select' && { options: options[item.field] }), | 98 | ...(item.component === 'Select' && { options: options[item.field] }), |
110 | disabled: getBaseDisable(item.field, get(fields.value, `${item.field}`), props.id), | 99 | disabled: getBaseDisable(item.field, get(fields.value, `${item.field}`), props.id), |
111 | }, | 100 | }, |
src/views/project/order/FormDetail/InspectionFormPanel.vue
@@ -37,6 +37,7 @@ | @@ -37,6 +37,7 @@ | ||
37 | return { | 37 | return { |
38 | ...item, | 38 | ...item, |
39 | componentProps: { | 39 | componentProps: { |
40 | + ...(item.component === 'Select' && { showSearch: true }), | ||
40 | ...(item.component === 'Select' && { options: options[item.field] }), | 41 | ...(item.component === 'Select' && { options: options[item.field] }), |
41 | disabled: getDisable( | 42 | disabled: getDisable( |
42 | get(fields.value, item.field), | 43 | get(fields.value, item.field), |
src/views/project/order/FormDetail/ProfitFormPanel.vue
@@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
42 | field: `${item.field}`, | 42 | field: `${item.field}`, |
43 | componentProps: { | 43 | componentProps: { |
44 | ...item.componentProps, | 44 | ...item.componentProps, |
45 | + ...(item.component === 'Select' && { showSearch: true }), | ||
45 | ...(item.component === 'Select' && | 46 | ...(item.component === 'Select' && |
46 | !item.componentProps?.options?.length && { options: options[item.field] }), | 47 | !item.componentProps?.options?.length && { options: options[item.field] }), |
47 | disabled: getProfitDisable( | 48 | disabled: getProfitDisable( |
src/views/project/order/FormDetail/ReportFormPanel.vue
@@ -50,6 +50,7 @@ | @@ -50,6 +50,7 @@ | ||
50 | ...item, | 50 | ...item, |
51 | field: `${item.field}`, | 51 | field: `${item.field}`, |
52 | componentProps: { | 52 | componentProps: { |
53 | + ...(item.component === 'Select' && { showSearch: true }), | ||
53 | ...(item.component === 'Select' && { options: options[optionsField] }), | 54 | ...(item.component === 'Select' && { options: options[optionsField] }), |
54 | disabled: getDisable( | 55 | disabled: getDisable( |
55 | get(fields.value, `${item.field}`), | 56 | get(fields.value, `${item.field}`), |
src/views/project/order/FormDetail/TrackFormPanel.vue
@@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
30 | ...item, | 30 | ...item, |
31 | componentProps: { | 31 | componentProps: { |
32 | ...item.componentProps, | 32 | ...item.componentProps, |
33 | + ...(item.component === 'Select' && { showSearch: true }), | ||
33 | disabled: getDisable( | 34 | disabled: getDisable( |
34 | get(fields.value, `${item.field}`), | 35 | get(fields.value, `${item.field}`), |
35 | props.id, | 36 | props.id, |
src/views/project/order/index.vue
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <!-- <template v-if="column.key === 'address1'"> | 5 | <!-- <template v-if="column.key === 'address1'"> |
6 | <span class="flex items-center justify-center"> 自定义字段列11 </span> | 6 | <span class="flex items-center justify-center"> 自定义字段列11 </span> |
7 | </template> --> | 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 | <span class="flex items-center justify-center"> | 9 | <span class="flex items-center justify-center"> |
10 | {{ column.customTitle }} | 10 | {{ column.customTitle }} |
11 | <FormOutlined class="ml-2 cursor-pointer" @click="handleFieldVisible(column)" /> | 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,7 +1254,7 @@ export function getFormConfig(): Partial<FormProps> { | ||
1254 | }, | 1254 | }, |
1255 | { | 1255 | { |
1256 | field: `productionDepartmentConsignStartTime`, | 1256 | field: `productionDepartmentConsignStartTime`, |
1257 | - label: `生成科拖货开始时间`, | 1257 | + label: `生产科拖货开始时间`, |
1258 | component: 'DatePicker', | 1258 | component: 'DatePicker', |
1259 | colProps: { | 1259 | colProps: { |
1260 | span: 6, | 1260 | span: 6, |
@@ -1263,7 +1263,7 @@ export function getFormConfig(): Partial<FormProps> { | @@ -1263,7 +1263,7 @@ export function getFormConfig(): Partial<FormProps> { | ||
1263 | }, | 1263 | }, |
1264 | { | 1264 | { |
1265 | field: `productionDepartmentConsignEndTime`, | 1265 | field: `productionDepartmentConsignEndTime`, |
1266 | - label: `生成科拖货结束时间`, | 1266 | + label: `生产科拖货结束时间`, |
1267 | component: 'DatePicker', | 1267 | component: 'DatePicker', |
1268 | colProps: { | 1268 | colProps: { |
1269 | span: 6, | 1269 | span: 6, |