Commit ae934227488eacc8555ae8795412d413133c99fb

Authored by xp.Huang
2 parents 20bcdf7b 89c1a95a

Merge branch 'sqy_dev' into 'main'

fix:[DEFECT-342]:添加消息模板参数说明

See merge request huang/yun-teng-iot-front!197
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 emits: ['success', 'register'], 24 emits: ['success', 'register'],
25 setup(_, { emit }) { 25 setup(_, { emit }) {
26 const isUpdate = ref(true); 26 const isUpdate = ref(true);
27 - const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ 27 + const [registerForm, { validate, setFieldsValue, resetFields, updateSchema }] = useForm({
28 labelWidth: 120, 28 labelWidth: 120,
29 schemas: formSchema, 29 schemas: formSchema,
30 showActionButtonGroup: false, 30 showActionButtonGroup: false,
@@ -40,6 +40,48 @@ @@ -40,6 +40,48 @@
40 Reflect.set(data.record, key + '', config[key]); 40 Reflect.set(data.record, key + '', config[key]);
41 } 41 }
42 await setFieldsValue(data.record); 42 await setFieldsValue(data.record);
  43 + if (data.record.templatePurpose === 'FOR_LOGIN') {
  44 + updateSchema({
  45 + field: 'templatePurpose',
  46 + helpMessage: `登录模板平台提供如下参数:
  47 + {
  48 + "code":"验证码"
  49 + }`,
  50 + });
  51 + } else if (data.record.templatePurpose === 'FOR_FORGET_PASSWORD') {
  52 + updateSchema({
  53 + field: 'templatePurpose',
  54 + helpMessage: `忘记密码模板平台提供如下参数:
  55 + {
  56 + "code":"验证码"
  57 + }`,
  58 + });
  59 + } else if (data.record.templatePurpose === 'FOR_ALARM_NOTICE') {
  60 + updateSchema({
  61 + field: 'templatePurpose',
  62 + helpMessage: `告警通知模板平台提供如下参数:
  63 + {
  64 + "type":"告警类型",
  65 + "device_name":"设备名称",
  66 + "severity":"告警等级",
  67 + "organization":"设备所属组织",
  68 + "createTime":告警时间
  69 + }`,
  70 + });
  71 + } else if (data.record.templatePurpose === 'FOR_SET_PASSWORD') {
  72 + updateSchema({
  73 + field: 'templatePurpose',
  74 + helpMessage: `清除密码模板平台提供如下参数:
  75 + {
  76 + "code":"验证码"
  77 + }`,
  78 + });
  79 + }
  80 + } else {
  81 + updateSchema({
  82 + field: 'templatePurpose',
  83 + helpMessage: [],
  84 + });
43 } 85 }
44 }); 86 });
45 87
@@ -183,14 +183,56 @@ export const formSchema: FormSchema[] = [ @@ -183,14 +183,56 @@ export const formSchema: FormSchema[] = [
183 label: '模板用途', 183 label: '模板用途',
184 required: true, 184 required: true,
185 component: 'ApiSelect', 185 component: 'ApiSelect',
186 - helpMessage: ['用户登录、忘记密码模板平台只提供"code"参数'],  
187 - componentProps: {  
188 - api: findDictItemByCode,  
189 - params: {  
190 - dictCode: 'template_purpose',  
191 - },  
192 - labelField: 'itemText',  
193 - valueField: 'itemValue', 186 + helpMessage: [],
  187 + componentProps({ formActionType }) {
  188 + const { updateSchema } = formActionType;
  189 + return {
  190 + onChange(value) {
  191 + if (value === 'FOR_LOGIN') {
  192 + updateSchema({
  193 + field: 'templatePurpose',
  194 + helpMessage: `登录模板平台提供如下参数:
  195 + {
  196 + "code":"验证码"
  197 + }`,
  198 + });
  199 + } else if (value === 'FOR_FORGET_PASSWORD') {
  200 + updateSchema({
  201 + field: 'templatePurpose',
  202 + helpMessage: `忘记密码模板平台提供如下参数:
  203 + {
  204 + "code":"验证码"
  205 + }`,
  206 + });
  207 + } else if (value === 'FOR_ALARM_NOTICE') {
  208 + updateSchema({
  209 + field: 'templatePurpose',
  210 + helpMessage: `告警通知模板平台提供如下参数:
  211 + {
  212 + "type":"告警类型",
  213 + "device_name":"设备名称",
  214 + "severity":"告警等级",
  215 + "organization":"设备所属组织",
  216 + "createTime":告警时间
  217 + }`,
  218 + });
  219 + } else if (value === 'FOR_SET_PASSWORD') {
  220 + updateSchema({
  221 + field: 'templatePurpose',
  222 + helpMessage: `清除密码模板平台提供如下参数:
  223 + {
  224 + "code":"验证码"
  225 + }`,
  226 + });
  227 + }
  228 + },
  229 + api: findDictItemByCode,
  230 + params: {
  231 + dictCode: 'template_purpose',
  232 + },
  233 + labelField: 'itemText',
  234 + valueField: 'itemValue',
  235 + };
194 }, 236 },
195 }, 237 },
196 { 238 {