lind 4 лет назад
Родитель
Сommit
8c3e5f039d

+ 0 - 8
src/components/BaseCrud/save/index.tsx

@@ -107,15 +107,7 @@ const Save = <T extends Record<string, any>>(props: Props<T>) => {
 
   const save = async () => {
     const values: T = await (customForm || form).submit();
-    // 特殊处理通知模版
-
-    if (service?.getUri().includes('/notifier/template')) {
-      (values as T & { template: Record<string, any> | string }).template = JSON.stringify(
-        values.template,
-      );
-    }
     const response = await service.update(values);
-
     if (response.status === 200) {
       Store.set(SystemConst.BASE_UPDATE_DATA, response.result);
     }

+ 49 - 101
src/pages/link/Type/Detail/index.tsx

@@ -227,6 +227,9 @@ const Save = observer(() => {
           labelAlign: 'left',
           layout: 'vertical',
         },
+        'x-component-props': {
+          placeholder: '请输入节点名称',
+        },
         'x-reactions': [
           {
             dependencies: ['shareCluster'],
@@ -243,6 +246,9 @@ const Save = observer(() => {
         title: '本地地址',
         'x-decorator': 'FormItem',
         'x-component': 'Select',
+        'x-component-props': {
+          placeholder: '请选择本地地址',
+        },
         'x-decorator-props': {
           gridSpan: 1,
           labelAlign: 'left',
@@ -274,6 +280,9 @@ const Save = observer(() => {
         type: 'number',
         'x-decorator': 'FormItem',
         'x-component': 'Select',
+        'x-component-props': {
+          placeholder: '请输入本地端口',
+        },
         'x-reactions': {
           dependencies: ['type'],
           fulfill: {
@@ -307,6 +316,9 @@ const Save = observer(() => {
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-validator': ['ipv4'],
+        'x-component-props': {
+          placeholder: '请输入公网地址',
+        },
         'x-reactions': {
           dependencies: ['type'],
           fulfill: {
@@ -326,6 +338,9 @@ const Save = observer(() => {
           layout: 'vertical',
           labelAlign: 'left',
         },
+        'x-component-props': {
+          placeholder: '请输入公网端口',
+        },
         required: true,
         'x-decorator': 'FormItem',
         'x-component': 'NumberPicker',
@@ -369,6 +384,9 @@ const Save = observer(() => {
               layout: 'vertical',
               labelAlign: 'left',
             },
+            'x-component-props': {
+              placeholder: '请输入远程地址',
+            },
             required: true,
             'x-validator': ['ipv4'],
             'x-decorator': 'FormItem',
@@ -381,6 +399,9 @@ const Save = observer(() => {
               layout: 'vertical',
               labelAlign: 'left',
             },
+            'x-component-props': {
+              placeholder: '请输入远程端口',
+            },
             required: true,
             'x-decorator': 'FormItem',
             'x-component': 'NumberPicker',
@@ -392,6 +413,9 @@ const Save = observer(() => {
               layout: 'vertical',
               labelAlign: 'left',
             },
+            'x-component-props': {
+              placeholder: '请输入ClientId',
+            },
             required: true,
             'x-decorator': 'FormItem',
             'x-component': 'Input',
@@ -403,12 +427,18 @@ const Save = observer(() => {
               layout: 'vertical',
               labelAlign: 'left',
             },
+            'x-component-props': {
+              placeholder: '请输入用户名',
+            },
             required: true,
             'x-decorator': 'FormItem',
             'x-component': 'Input',
           },
           password: {
             title: '密码',
+            'x-component-props': {
+              placeholder: '请输入密码',
+            },
             'x-decorator-props': {
               gridSpan: 1,
               layout: 'vertical',
@@ -426,12 +456,18 @@ const Save = observer(() => {
               layout: 'vertical',
               labelAlign: 'left',
             },
+            'x-component-props': {
+              placeholder: '请输入最大消息长度',
+            },
             required: true,
             'x-decorator': 'FormItem',
             'x-component': 'Input',
           },
           topicPrefix: {
             title: '订阅前缀',
+            'x-component-props': {
+              placeholder: '请输入订阅前缀',
+            },
             'x-decorator-props': {
               gridSpan: 1,
               tooltip: '当连接的服务为EMQ时,可能需要使用共享的订阅前缀,如:$queue或$share',
@@ -453,6 +489,9 @@ const Save = observer(() => {
           tooltip: '对外提供访问的地址,内网环境是填写服务器的内网IP地址',
           layout: 'vertical',
         },
+        'x-component-props': {
+          placeholder: '请输入最大消息长度',
+        },
         'x-reactions': {
           dependencies: ['type'],
           fulfill: {
@@ -463,25 +502,6 @@ const Save = observer(() => {
           },
         },
       },
-      // topicPrefix: {
-      //   title: '订阅前缀',
-      //   'x-decorator': 'FormItem',
-      //   'x-component': 'Input',
-      //   'x-decorator-props': {
-      //     gridSpan: 1,
-      //     labelAlign: 'left',
-      //     layout: 'vertical',
-      //   },
-      //   'x-reactions': {
-      //     dependencies: ['type'],
-      //     fulfill: {
-      //       state: {
-      //         // visible: '{{$deps[0]==="UDP"}}',
-      //         visible: '{{["MQTT_CLIENT"].includes($deps[0])}}',
-      //       },
-      //     },
-      //   },
-      // },
       parserType: {
         // TCP
         required: true,
@@ -495,6 +515,9 @@ const Save = observer(() => {
         'x-visible': false,
         'x-decorator': 'FormItem',
         'x-component': 'Select',
+        'x-component-props': {
+          placeholder: '请选择粘拆包规则',
+        },
         enum: [
           { value: 'DIRECT', label: '不处理' },
           { value: 'delimited', label: '分隔符' },
@@ -533,6 +556,9 @@ const Save = observer(() => {
             'x-decorator-props': {
               gridSpan: 1,
             },
+            'x-component-props': {
+              placeholder: '请输入名称',
+            },
             'x-validator': [
               {
                 max: 64,
@@ -551,6 +577,9 @@ const Save = observer(() => {
             'x-decorator-props': {
               gridSpan: 1,
             },
+            'x-component-props': {
+              placeholder: '请选择类型',
+            },
             'x-validator': [
               {
                 required: true,
@@ -655,88 +684,6 @@ const Save = observer(() => {
               },
             },
           },
-
-          // parserType: {
-          //   // TCP
-          //   title: '粘拆包规则',
-          //   'x-decorator-props': {
-          //     gridSpan: 3,
-          //     tooltip: '',
-          //   },
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Select',
-          //   enum: [
-          //     { label: 'DIRECT', value: '不处理' },
-          //     { label: 'delimited', value: '分隔符' },
-          //     { label: 'script', value: '自定义脚本' },
-          //     { label: 'fixed_length', value: '固定长度' },
-          //   ],
-          // },
-          // // MQTT_C
-          // remoteAddress: {
-          //   title: '远程地址',
-          //   'x-validator': ['ipv4'],
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Input',
-          // },
-          // remotePort: {
-          //   title: '远程端口',
-          //   type: 'number',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'NumberPicker',
-          //   'x-validator': [
-          //     {
-          //       max: 65535,
-          //       message: '请输入1-65535之间的整整数',
-          //     },
-          //     {
-          //       min: 1,
-          //       message: '请输入1-65535之间的整整数',
-          //     },
-          //
-          //   ],
-          // },
-          // client: {
-          //   title: 'client',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Input',
-          // },
-          // username: {
-          //   title: '用户名',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Input',
-          // },
-          // password: {
-          //   title: '密码',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Password',
-          // },
-          // // MQTT-S
-          // maxMessageSize: {
-          //   title: '最大消息长度',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'NumberPicker',
-          //   'x-decorator-props': {
-          //     tooltip: '单次收发消息的最大长度,单位:字节。设置过大可能会影响性能',
-          //   },
-          // },
-          // topicPrefix: {
-          //   title: '订阅前缀',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Input',
-          // },
-          // // MQTT_C end
-          // enableDtls: {
-          //   title: '开启DTLS',
-          //   'x-decorator': 'FormItem',
-          //   'x-component': 'Radio.Group',
-          //   required: true,
-          //   default: false,
-          //   enum: [
-          //     { label: '是', value: true },
-          //     { label: '否', value: false },
-          //   ],
-          // },
           description: {
             title: '说明',
             'x-component': 'Input.TextArea',
@@ -745,6 +692,7 @@ const Save = observer(() => {
               gridSpan: 3,
             },
             'x-component-props': {
+              placeholder: '请输入说明',
               showCount: true,
               maxLength: 200,
               rows: 5,

+ 3 - 0
src/pages/notice/Config/Detail/index.tsx

@@ -124,6 +124,9 @@ const Detail = observer(() => {
         required: true,
         'x-component': 'Input',
         'x-decorator': 'FormItem',
+        'x-component-props': {
+          placeholder: '请输入名称',
+        },
       },
       type: {
         title: '分类',

+ 23 - 18
src/pages/notice/Template/Detail/index.tsx

@@ -377,6 +377,7 @@ const Detail = observer(() => {
         'x-component': 'Radio.Group',
         'x-component-props': {
           optionType: 'button',
+          placeholder: '请选择类型',
         },
         required: true,
         'x-visible': typeList[id]?.length > 0,
@@ -388,12 +389,9 @@ const Detail = observer(() => {
         type: 'string',
         'x-decorator': 'FormItem',
         'x-component': 'Select',
-        // enum: [
-        //   {label: '测试配置1', value: 'test1'},
-        //   {label: '测试配置2', value: 'test2'},
-        //   {label: '测试配置3', value: 'test3'},
-        // ],
-        // 'x-reactions': '{{useAsyncDataSource(getConfig)}}',
+        'x-component-props': {
+          placeholder: '请选择绑定配置',
+        },
         'x-visible': id !== 'email',
       },
       template: {
@@ -597,12 +595,6 @@ const Detail = observer(() => {
                       placeholder: '这里是回显内容',
                     },
                   },
-                  // content: {
-                  //   title: '模版内容',
-                  //   type: 'string',
-                  //   'x-decorator': 'FormItem',
-                  //   'x-component': 'Input.TextArea',
-                  // },
                 },
                 'x-reactions': {
                   dependencies: ['provider'],
@@ -698,6 +690,9 @@ const Detail = observer(() => {
                     'x-component': 'Select',
                     'x-decorator': 'FormItem',
                     required: true,
+                    'x-component-props': {
+                      placeholder: '请选择消息类型',
+                    },
                     enum: [
                       { label: 'markdown', value: 'markdown' },
                       { label: 'text', value: 'text' },
@@ -712,6 +707,9 @@ const Detail = observer(() => {
                         title: '标题',
                         'x-component': 'Input',
                         'x-decorator': 'FormItem',
+                        'x-component-props': {
+                          placeholder: '请输入标题',
+                        },
                       },
                     },
                     'x-reactions': {
@@ -731,6 +729,9 @@ const Detail = observer(() => {
                         title: '标题',
                         'x-component': 'Input',
                         'x-decorator': 'FormItem',
+                        'x-component-props': {
+                          placeholder: '请输入标题',
+                        },
                       },
                       '{url:picUrl}': {
                         title: '图片链接',
@@ -738,12 +739,16 @@ const Detail = observer(() => {
                         'x-decorator': 'FormItem',
                         'x-component-props': {
                           type: 'file',
+                          placeholder: '请输入图片链接',
                         },
                       },
                       messageUrl: {
                         title: '内容链接',
                         'x-component': 'Input',
                         'x-decorator': 'FormItem',
+                        'x-component-props': {
+                          placeholder: '请输入内容链接',
+                        },
                       },
                     },
                     'x-reactions': {
@@ -803,11 +808,11 @@ const Detail = observer(() => {
                         'x-component': 'Input',
                         'x-decorator': 'FormItem',
                         'x-decorator-props': {
-                          tooltip: '请输入calledShowNumbers',
+                          tooltip: '请输入被叫号码',
                           gridSpan: 1,
                         },
                         'x-component-props': {
-                          placeholder: '请输入calledShowNumbers',
+                          placeholder: '请输入被叫号码',
                         },
                       },
                     },
@@ -817,10 +822,10 @@ const Detail = observer(() => {
                     'x-component': 'Input',
                     'x-decorator': 'FormItem',
                     'x-decorator-props': {
-                      tooltip: '请输入CalledNumber',
+                      tooltip: '请输入被叫显号',
                     },
                     'x-component-props': {
-                      placeholder: '请输入CalledNumber',
+                      placeholder: '请输入被叫显号',
                     },
                   },
                   PlayTimes: {
@@ -828,10 +833,10 @@ const Detail = observer(() => {
                     'x-component': 'Input',
                     'x-decorator': 'FormItem',
                     'x-decorator-props': {
-                      tooltip: '请输入PlayTimes',
+                      tooltip: '请输入播放次数',
                     },
                     'x-component-props': {
-                      placeholder: '请输入PlayTimes',
+                      placeholder: '请输入播放次数',
                     },
                   },
                 },

+ 10 - 6
src/pages/system/User/Save/index.tsx

@@ -300,11 +300,15 @@ const Save = (props: Props) => {
                   onClick={() => {
                     const tab: any = window.open(`${origin}/#/system/role?save=true`);
                     tab!.onTabSaveSuccess = (value: any) => {
-                      form.setFieldState('roleIdList', (state) => {
-                        state.dataSource = state.dataSource?.concat([
-                          { label: value.name, value: value.id },
-                        ]);
-                        state.value = [...state.value, value.id];
+                      form.setFieldState('roleIdList', async (state) => {
+                        state.dataSource = await getRole().then((resp) =>
+                          resp.result?.map((item: Record<string, unknown>) => ({
+                            ...item,
+                            label: item.name,
+                            value: item.id,
+                          })),
+                        );
+                        state.value = [...(state.value || []), value.id];
                       });
                     };
                   }}
@@ -349,7 +353,7 @@ const Save = (props: Props) => {
                             value: item.id,
                           })),
                         );
-                        state.value = [...state.value, value.id];
+                        state.value = [...(state.value || []), value.id];
                       });
                     };
                   }}