Commit 2a4161856af19446c7bf4592ec86e3299e89ac77

Authored by xp.Huang
2 parents bf0dc7c7 f16db0c7

Merge branch 'ww' into 'main'

fix: fix bug DEFECT-394

See merge request huang/yun-teng-iot-front!214
... ... @@ -15,8 +15,7 @@ enum MessageConfigApi {
15 15 * 获取当前租户下的所有配置
16 16 */
17 17 export const findMessageConfig = (params: MessageParams) => {
18   - console.log(params, 'params');
19   - return defHttp.post<MessageConfigResult>({
  18 + return defHttp.post<MessageConfigResult[]>({
20 19 url: MessageConfigApi.CONFIG_URL + '/find',
21 20 params,
22 21 });
... ...
... ... @@ -39,7 +39,7 @@
39 39 Select,
40 40 LoadingOutlined,
41 41 },
42   - inheritAttrs: false,
  42 + inheritAttrs: true,
43 43 props: {
44 44 value: propTypes.oneOfType([
45 45 propTypes.object,
... ...
... ... @@ -438,9 +438,12 @@
438 438 },
439 439 });
440 440 </script>
441   -<style scoped>
  441 +<style scoped lang="less">
442 442 .wrapper {
443 443 position: relative;
  444 + :deep(.BMap_shadow) {
  445 + display: none;
  446 + }
444 447 }
445 448 .right-wrap {
446 449 padding-top: 10px;
... ...
... ... @@ -18,6 +18,7 @@
18 18 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
19 19 import { saveOrEditMessageTemplate } from '/@/api/message/template';
20 20 import { useMessage } from '/@/hooks/web/useMessage';
  21 + import { findMessageConfig } from '/@/api/message/config';
21 22 export default defineComponent({
22 23 name: 'TemplateDrawer',
23 24 components: { BasicDrawer, BasicForm },
... ... @@ -40,6 +41,20 @@
40 41 Reflect.set(data.record, key + '', config[key]);
41 42 }
42 43 await setFieldsValue(data.record);
  44 + const res = await findMessageConfig({});
  45 + const options = res.map((item) => {
  46 + return {
  47 + disabled: item.messageType !== data.record.messageType,
  48 + label: item.configName,
  49 + value: item.id,
  50 + };
  51 + });
  52 + await updateSchema({
  53 + field: 'messageConfigId',
  54 + componentProps: {
  55 + options,
  56 + },
  57 + });
43 58 if (data.record.templatePurpose === 'FOR_LOGIN') {
44 59 updateSchema({
45 60 field: 'templatePurpose',
... ...
... ... @@ -120,13 +120,34 @@ export const formSchema: FormSchema[] = [
120 120 label: '消息类型',
121 121 required: true,
122 122 component: 'ApiSelect',
123   - componentProps: {
124   - api: findDictItemByCode,
125   - params: {
126   - dictCode: 'message_type',
127   - },
128   - labelField: 'itemText',
129   - valueField: 'itemValue',
  123 + componentProps({ formActionType }) {
  124 + return {
  125 + api: findDictItemByCode,
  126 + params: {
  127 + dictCode: 'message_type',
  128 + },
  129 + labelField: 'itemText',
  130 + valueField: 'itemValue',
  131 + onChange: async (value) => {
  132 + const res = await findMessageConfig({});
  133 + let typeId: Nullable<string> = null;
  134 + const options = res.map((item) => {
  135 + if (item.messageType === value) typeId = item.id;
  136 + return {
  137 + disabled: item.messageType !== value,
  138 + label: item.configName,
  139 + value: item.id,
  140 + };
  141 + });
  142 + await formActionType.setFieldsValue({ messageConfigId: typeId });
  143 + await formActionType.updateSchema({
  144 + field: 'messageConfigId',
  145 + componentProps: {
  146 + options,
  147 + },
  148 + });
  149 + },
  150 + };
130 151 },
131 152 },
132 153 {
... ...