Commit f9a9f15782f704a2def42c6f95db143c5980a1b1
Merge branch 'ft-dev' into 'main'
style:设备配置样式修改,feat:设备配置详情优化代码 See merge request huang/yun-teng-iot-front!44
Showing
23 changed files
with
873 additions
and
1104 deletions
@@ -11,9 +11,12 @@ import { | @@ -11,9 +11,12 @@ import { | ||
11 | import { defHttp } from '/@/utils/http/axios'; | 11 | import { defHttp } from '/@/utils/http/axios'; |
12 | import { BasicPageParams } from '/@/api/model/baseModel'; | 12 | import { BasicPageParams } from '/@/api/model/baseModel'; |
13 | export type QueryTenantProfilesParam = BasicPageParams & OtherParams; | 13 | export type QueryTenantProfilesParam = BasicPageParams & OtherParams; |
14 | +export type DeleteTenantProfilesParam = OtherParams; | ||
14 | export type OtherParams = { | 15 | export type OtherParams = { |
15 | sortProperty?: string; | 16 | sortProperty?: string; |
16 | sortOrder?: string; | 17 | sortOrder?: string; |
18 | + tenantProfield?: string; | ||
19 | + textSearch?: any; | ||
17 | }; | 20 | }; |
18 | 21 | ||
19 | enum Api { | 22 | enum Api { |
@@ -28,13 +31,14 @@ enum Api { | @@ -28,13 +31,14 @@ enum Api { | ||
28 | getTenantRoles = '/admin/tenant/roles/', | 31 | getTenantRoles = '/admin/tenant/roles/', |
29 | postAddTenantProfile = '/tenantProfile', | 32 | postAddTenantProfile = '/tenantProfile', |
30 | getTenantProfile = '/tenantProfiles', | 33 | getTenantProfile = '/tenantProfiles', |
31 | - deleteTenantProfile = '/tenantProfiles', | 34 | + deleteTenantProfile = '/tenantProfile/', |
32 | } | 35 | } |
33 | 36 | ||
34 | -export async function deleteTenantProfileApi(tenantIds) { | 37 | +export async function deleteTenantProfileApi(params?: DeleteTenantProfilesParam) { |
35 | await defHttp.delete( | 38 | await defHttp.delete( |
36 | { | 39 | { |
37 | - url: `${Api.deleteTenantProfile}/${tenantIds}`, | 40 | + params: params, |
41 | + url: Api.deleteTenantProfile, | ||
38 | }, | 42 | }, |
39 | { | 43 | { |
40 | joinPrefix: false, | 44 | joinPrefix: false, |
@@ -43,15 +47,10 @@ export async function deleteTenantProfileApi(tenantIds) { | @@ -43,15 +47,10 @@ export async function deleteTenantProfileApi(tenantIds) { | ||
43 | } | 47 | } |
44 | 48 | ||
45 | export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { | 49 | export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { |
46 | - return defHttp.get( | ||
47 | - { | ||
48 | - params: params, | ||
49 | - url: Api.getTenantProfile, | ||
50 | - }, | ||
51 | - { | ||
52 | - joinPrefix: false, | ||
53 | - } | ||
54 | - ); | 50 | + return defHttp.get({ |
51 | + params: params, | ||
52 | + url: Api.getTenantProfile, | ||
53 | + }); | ||
55 | }; | 54 | }; |
56 | 55 | ||
57 | export async function saveTenantProfileApi(params: tenantProfileDTO) { | 56 | export async function saveTenantProfileApi(params: tenantProfileDTO) { |
src/hooks/web/useDateToLocaleString.ts
0 → 100644
1 | +// 时间戳转时间 | ||
2 | +export const transformTime = (timestamp = +new Date()) => { | ||
3 | + if (timestamp) { | ||
4 | + const time = new Date(timestamp); | ||
5 | + const y = time.getFullYear(); //getFullYear方法以四位数字返回年份 | ||
6 | + const M = time.getMonth() + 1; // getMonth方法从 Date 对象返回月份 (0 ~ 11),返回结果需要手动加一 | ||
7 | + const d = time.getDate(); // getDate方法从 Date 对象返回一个月中的某一天 (1 ~ 31) | ||
8 | + // const h = time.getHours(); // getHours方法返回 Date 对象的小时 (0 ~ 23) | ||
9 | + // const m = time.getMinutes(); // getMinutes方法返回 Date 对象的分钟 (0 ~ 59) | ||
10 | + // const s = time.getSeconds(); // getSeconds方法返回 Date 对象的秒数 (0 ~ 59) | ||
11 | + // h + ':' + m + ':' + s | ||
12 | + return y + '-' + M + '-' + d; | ||
13 | + } else { | ||
14 | + return ''; | ||
15 | + } | ||
16 | +}; |
@@ -18,29 +18,23 @@ | @@ -18,29 +18,23 @@ | ||
18 | <div class="mt-5"> | 18 | <div class="mt-5"> |
19 | <DeviceProfileStep1 | 19 | <DeviceProfileStep1 |
20 | ref="DeviceProfileStep1Ref" | 20 | ref="DeviceProfileStep1Ref" |
21 | - :echoStep1="editEchoData" | ||
22 | @next="handleStepNext1" | 21 | @next="handleStepNext1" |
23 | v-if="current === 0" | 22 | v-if="current === 0" |
24 | /> | 23 | /> |
25 | <DeviceProfileStep2 | 24 | <DeviceProfileStep2 |
26 | - :echoStep2="editEchoData" | 25 | + ref="DeviceProfileStep2Ref" |
27 | @prev="handleStepPrev" | 26 | @prev="handleStepPrev" |
28 | @next="handleStep2Next" | 27 | @next="handleStep2Next" |
29 | v-if="current === 1" | 28 | v-if="current === 1" |
30 | /> | 29 | /> |
31 | <DeviceProfileStep3 | 30 | <DeviceProfileStep3 |
32 | - :echoStep3="editEchoData" | 31 | + ref="DeviceProfileStep3Ref" |
33 | @prev="handleStepPrev" | 32 | @prev="handleStepPrev" |
34 | @next="handleStep3Next" | 33 | @next="handleStep3Next" |
35 | @redo="handleRedo" | 34 | @redo="handleRedo" |
36 | v-if="current === 2" | 35 | v-if="current === 2" |
37 | /> | 36 | /> |
38 | - <DeviceProfileStep4 | ||
39 | - :echoStep4="editEchoData" | ||
40 | - ref="getStepData" | ||
41 | - @prev="handleStepPrev" | ||
42 | - v-if="current === 3" | ||
43 | - /> | 37 | + <DeviceProfileStep4 ref="DeviceProfileStep4Ref" @prev="handleStepPrev" v-if="current === 3" /> |
44 | </div> | 38 | </div> |
45 | </BasicModal> | 39 | </BasicModal> |
46 | </template> | 40 | </template> |
@@ -72,16 +66,18 @@ | @@ -72,16 +66,18 @@ | ||
72 | emits: ['success', 'register'], | 66 | emits: ['success', 'register'], |
73 | setup(_, { emit }) { | 67 | setup(_, { emit }) { |
74 | const DeviceProfileStep1Ref = ref(null); | 68 | const DeviceProfileStep1Ref = ref(null); |
69 | + const DeviceProfileStep2Ref = ref(null); | ||
70 | + const DeviceProfileStep3Ref = ref(null); | ||
71 | + const DeviceProfileStep4Ref = ref(null); | ||
75 | const { createMessage } = useMessage(); | 72 | const { createMessage } = useMessage(); |
76 | - const getStepData = ref(null); | 73 | + // const getStepData = ref(null); |
77 | const { proxy } = getCurrentInstance(); | 74 | const { proxy } = getCurrentInstance(); |
78 | const postDeviceConfogData: any = ref({}); | 75 | const postDeviceConfogData: any = ref({}); |
79 | const getStepOneData: any = ref({}); | 76 | const getStepOneData: any = ref({}); |
80 | const getStepTwoData: any = ref({}); | 77 | const getStepTwoData: any = ref({}); |
81 | const getStepThreeData: any = ref({}); | 78 | const getStepThreeData: any = ref({}); |
82 | - const editEchoData: any = ref({}); | 79 | + const editEchoData: any = ref(null); |
83 | const alarmProfileData: any = ref({}); | 80 | const alarmProfileData: any = ref({}); |
84 | - // const isGetStepThreeData: any = ref({}); | ||
85 | const isGetStepThreeData: any = ref({}); | 81 | const isGetStepThreeData: any = ref({}); |
86 | const postEditId = ref(''); | 82 | const postEditId = ref(''); |
87 | const current = ref(0); | 83 | const current = ref(0); |
@@ -90,16 +86,40 @@ | @@ -90,16 +86,40 @@ | ||
90 | const [register, { closeModal }] = useModalInner((data) => { | 86 | const [register, { closeModal }] = useModalInner((data) => { |
91 | isUpdate.value = !!data?.isUpdate; | 87 | isUpdate.value = !!data?.isUpdate; |
92 | if (!unref(isUpdate)) { | 88 | if (!unref(isUpdate)) { |
93 | - console.log('新增'); | ||
94 | current.value = 0; | 89 | current.value = 0; |
95 | - postDeviceConfogData.value = {}; | ||
96 | - proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); | 90 | + switch (current.value) { |
91 | + case 0: | ||
92 | + proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); | ||
93 | + break; | ||
94 | + case 1: | ||
95 | + proxy.$refs.DeviceProfileStep2Ref.customResetAndFunc(); | ||
96 | + break; | ||
97 | + case 2: | ||
98 | + // proxy.$refs.DeviceProfileStep3Ref.customResetFunc(); | ||
99 | + // break; | ||
100 | + case 3: | ||
101 | + proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc(); | ||
102 | + break; | ||
103 | + } | ||
97 | } | 104 | } |
98 | if (unref(isUpdate)) { | 105 | if (unref(isUpdate)) { |
99 | - console.log('编辑'); | ||
100 | current.value = 0; | 106 | current.value = 0; |
101 | postEditId.value = data.record.id; | 107 | postEditId.value = data.record.id; |
102 | editEchoData.value = data.record; | 108 | editEchoData.value = data.record; |
109 | + switch (current.value) { | ||
110 | + case 0: | ||
111 | + proxy.$refs.DeviceProfileStep1Ref.resetFieldsFunc(editEchoData.value); | ||
112 | + break; | ||
113 | + case 1: | ||
114 | + proxy.$refs.DeviceProfileStep2Ref.resetFieldsFunc(editEchoData.value); | ||
115 | + break; | ||
116 | + case 2: | ||
117 | + // proxy.$refs.DeviceProfileStep3Ref.resetFieldsFunc(editEchoData.value); | ||
118 | + // break; | ||
119 | + case 3: | ||
120 | + proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc(editEchoData.value); | ||
121 | + break; | ||
122 | + } | ||
103 | } | 123 | } |
104 | }); | 124 | }); |
105 | function handleStepPrev() { | 125 | function handleStepPrev() { |
@@ -123,7 +143,8 @@ | @@ -123,7 +143,8 @@ | ||
123 | const handleSubmit = async () => { | 143 | const handleSubmit = async () => { |
124 | if (!unref(isUpdate)) { | 144 | if (!unref(isUpdate)) { |
125 | isGetStepThreeData.value.profileData = getStepThreeData.value; | 145 | isGetStepThreeData.value.profileData = getStepThreeData.value; |
126 | - alarmProfileData.value.alarmProfile = await proxy.$refs.getStepData.getAllFields(); | 146 | + alarmProfileData.value.alarmProfile = |
147 | + await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); | ||
127 | Object.assign( | 148 | Object.assign( |
128 | postDeviceConfogData.value, | 149 | postDeviceConfogData.value, |
129 | getStepOneData.value, | 150 | getStepOneData.value, |
@@ -139,7 +160,8 @@ | @@ -139,7 +160,8 @@ | ||
139 | if (unref(isUpdate)) { | 160 | if (unref(isUpdate)) { |
140 | postDeviceConfogData.value.id = postEditId.value; | 161 | postDeviceConfogData.value.id = postEditId.value; |
141 | isGetStepThreeData.value.alarmProfile = getStepThreeData.value; | 162 | isGetStepThreeData.value.alarmProfile = getStepThreeData.value; |
142 | - alarmProfileData.value.alarmProfile = await proxy.$refs.getStepData.getAllFields(); | 163 | + alarmProfileData.value.alarmProfile = |
164 | + await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); | ||
143 | Object.assign( | 165 | Object.assign( |
144 | postDeviceConfogData.value, | 166 | postDeviceConfogData.value, |
145 | getStepOneData.value, | 167 | getStepOneData.value, |
@@ -157,9 +179,12 @@ | @@ -157,9 +179,12 @@ | ||
157 | return; | 179 | return; |
158 | }; | 180 | }; |
159 | return { | 181 | return { |
182 | + DeviceProfileStep2Ref, | ||
183 | + DeviceProfileStep3Ref, | ||
184 | + DeviceProfileStep4Ref, | ||
160 | DeviceProfileStep1Ref, | 185 | DeviceProfileStep1Ref, |
161 | editEchoData, | 186 | editEchoData, |
162 | - getStepData, | 187 | + // getStepData, |
163 | handleStep3Next, | 188 | handleStep3Next, |
164 | handleSubmit, | 189 | handleSubmit, |
165 | handleCancel, | 190 | handleCancel, |
1 | <template> | 1 | <template> |
2 | - <BasicModal v-bind="$attrs" width="55rem" @register="register" :title="getTitle"> | ||
3 | - <PageWrapper title="设备配置详情"> | ||
4 | - <Description @register="register1" class="mt-4" /> | ||
5 | - </PageWrapper> | ||
6 | - </BasicModal> | 2 | + <div> |
3 | + <BasicModal | ||
4 | + :showCancelBtn="true" | ||
5 | + :showOkBtn="false" | ||
6 | + v-bind="$attrs" | ||
7 | + width="55rem" | ||
8 | + @register="register" | ||
9 | + :title="getTitle" | ||
10 | + > | ||
11 | + <Tabs v-model:activeKey="activeKey"> | ||
12 | + <TabPane key="1" tab="详情"> | ||
13 | + <BasicForm | ||
14 | + :showSubmitButton="false" | ||
15 | + :showResetButton="false" | ||
16 | + @register="registerDetail" | ||
17 | + /> | ||
18 | + </TabPane> | ||
19 | + <TabPane key="2" tab="传输配置" force-render> | ||
20 | + <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerTrans" | ||
21 | + /></TabPane> | ||
22 | + <TabPane key="3" tab="报警规则"> | ||
23 | + <BasicForm | ||
24 | + :showSubmitButton="false" | ||
25 | + :showResetButton="false" | ||
26 | + @register="registerStep3Schemas" | ||
27 | + /> | ||
28 | + <BasicForm | ||
29 | + :showSubmitButton="false" | ||
30 | + :showResetButton="false" | ||
31 | + @register="registerStep3HighSetting" | ||
32 | + /> | ||
33 | + <BasicForm | ||
34 | + :showSubmitButton="false" | ||
35 | + :showResetButton="false" | ||
36 | + @register="registerStep3CreateAlarm" | ||
37 | + /> | ||
38 | + <BasicForm | ||
39 | + :showSubmitButton="false" | ||
40 | + :showResetButton="false" | ||
41 | + @register="registerStep3RuleAlarm" | ||
42 | + /> | ||
43 | + </TabPane> | ||
44 | + <TabPane key="4" tab="告警管理"> | ||
45 | + <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerContact" | ||
46 | + /></TabPane> | ||
47 | + </Tabs> | ||
48 | + </BasicModal> | ||
49 | + </div> | ||
7 | </template> | 50 | </template> |
8 | <script lang="ts"> | 51 | <script lang="ts"> |
9 | - import { defineComponent, ref, computed, unref } from 'vue'; | 52 | + import { defineComponent, ref, computed, watch } from 'vue'; |
10 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 53 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
11 | - import { Description, DescItem, useDescription } from '/@/components/Description/index'; | ||
12 | - import { PageWrapper } from '/@/components/Page'; | 54 | + import { Tabs, TabPane } from 'ant-design-vue'; |
13 | import { deviceConfigGetDetail } from '/@/api/device/deviceConfigApi'; | 55 | import { deviceConfigGetDetail } from '/@/api/device/deviceConfigApi'; |
56 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
57 | + import { | ||
58 | + step1Schemas, | ||
59 | + step2Schemas, | ||
60 | + step3Schemas, | ||
61 | + step3HighSetting, | ||
62 | + step3CreateAlarm, | ||
63 | + alertContactsSchemas, | ||
64 | + } from './step/data'; | ||
14 | 65 | ||
15 | - const schema: DescItem[] = [ | ||
16 | - { | ||
17 | - field: 'description', | ||
18 | - label: '描述', | ||
19 | - }, | ||
20 | - { | ||
21 | - field: 'enabled', | ||
22 | - label: '禁用', | ||
23 | - }, | ||
24 | - { | ||
25 | - field: 'name', | ||
26 | - label: '设备配置名称', | ||
27 | - }, | ||
28 | - { | ||
29 | - field: 'transportType', | ||
30 | - label: '传输类型', | ||
31 | - }, | ||
32 | - ]; | ||
33 | export default defineComponent({ | 66 | export default defineComponent({ |
34 | name: 'ConfigDrawer', | 67 | name: 'ConfigDrawer', |
35 | - components: { BasicModal, Description, PageWrapper }, | 68 | + components: { Tabs, TabPane, BasicModal, BasicForm }, |
36 | emits: ['success', 'register'], | 69 | emits: ['success', 'register'], |
37 | setup() { | 70 | setup() { |
38 | - let descInfo = ref(null); | 71 | + const activeKey = ref('1'); |
39 | const isUpdate = ref(true); | 72 | const isUpdate = ref(true); |
73 | + const descInfo: any = ref(null); | ||
74 | + const dataInfo: any = ref(''); | ||
75 | + watch( | ||
76 | + () => activeKey.value, | ||
77 | + (v) => { | ||
78 | + dataInfo.value = v; | ||
79 | + } | ||
80 | + ); | ||
81 | + const [registerDetail, { setFieldsValue }] = useForm({ | ||
82 | + schemas: step1Schemas, | ||
83 | + actionColOptions: { | ||
84 | + span: 24, | ||
85 | + }, | ||
86 | + }); | ||
87 | + const [registerTrans, { setFieldsValue }] = useForm({ | ||
88 | + schemas: step2Schemas, | ||
89 | + actionColOptions: { | ||
90 | + span: 24, | ||
91 | + }, | ||
92 | + }); | ||
93 | + const [registerStep3Schemas, { setFieldsValue }] = useForm({ | ||
94 | + schemas: step3Schemas, | ||
95 | + actionColOptions: { | ||
96 | + span: 24, | ||
97 | + }, | ||
98 | + }); | ||
99 | + const [registerStep3HighSetting, { setFieldsValue }] = useForm({ | ||
100 | + schemas: step3HighSetting, | ||
101 | + actionColOptions: { | ||
102 | + span: 24, | ||
103 | + }, | ||
104 | + }); | ||
105 | + const [registerStep3CreateAlarm, { setFieldsValue }] = useForm({ | ||
106 | + schemas: step3CreateAlarm, | ||
107 | + actionColOptions: { | ||
108 | + span: 24, | ||
109 | + }, | ||
110 | + }); | ||
111 | + const [registerContact, { setFieldsValue }] = useForm({ | ||
112 | + schemas: alertContactsSchemas, | ||
113 | + actionColOptions: { | ||
114 | + span: 24, | ||
115 | + }, | ||
116 | + }); | ||
117 | + const [registerStep3RuleAlarm, { setFieldsValue }] = useForm({ | ||
118 | + schemas: alertContactsSchemas, | ||
119 | + actionColOptions: { | ||
120 | + span: 24, | ||
121 | + }, | ||
122 | + }); | ||
40 | const [register] = useModalInner(async (data) => { | 123 | const [register] = useModalInner(async (data) => { |
124 | + activeKey.value = '1'; | ||
41 | isUpdate.value = !!data?.isUpdate; | 125 | isUpdate.value = !!data?.isUpdate; |
42 | - let getDescInfo = await deviceConfigGetDetail(data.record.id); | ||
43 | - descInfo.value = getDescInfo; | 126 | + descInfo.value = await deviceConfigGetDetail(data.record.id); |
127 | + console.log(descInfo.value); | ||
128 | + switch (dataInfo.value) { | ||
129 | + case '1': | ||
130 | + // await setRegisterDetail({ ...descInfo.value }); | ||
131 | + setFieldsFunc(descInfo.value); | ||
132 | + break; | ||
133 | + case '2': | ||
134 | + // await setRegisterTrans({ ...descInfo.value }); | ||
135 | + setFieldsFunc(descInfo.value); | ||
136 | + | ||
137 | + break; | ||
138 | + case '3': | ||
139 | + // await setRegisterStep3Schemas({ ...descInfo.value }); | ||
140 | + // await setRegisterStep3HighSetting({ ...descInfo.value }); | ||
141 | + // await setRegisterStep3CreateAlarm({ ...descInfo.value }); | ||
142 | + // await setRegisterStep3RuleAlarm({ ...descInfo.value }); | ||
143 | + setFieldsFunc(descInfo.value); | ||
144 | + | ||
145 | + break; | ||
146 | + case '4': | ||
147 | + // await setRegisterContact({ ...descInfo.value }); | ||
148 | + setFieldsFunc(descInfo.value); | ||
149 | + | ||
150 | + break; | ||
151 | + deault: break; | ||
152 | + } | ||
44 | }); | 153 | }); |
45 | - const getTitle = computed(() => (!unref(isUpdate) ? '查看设备配置' : '查看设备配置')); | ||
46 | - const [register1] = useDescription({ | ||
47 | - title: '详情', | ||
48 | - bordered: false, | ||
49 | - data: descInfo, | ||
50 | - schema: schema, | 154 | + const setFieldsFunc = (v) => { |
155 | + setFieldsValue(v); | ||
156 | + }; | ||
157 | + const getTitle = computed(() => { | ||
158 | + return '设备配置详情'; | ||
51 | }); | 159 | }); |
160 | + | ||
52 | return { | 161 | return { |
162 | + registerStep3RuleAlarm, | ||
163 | + registerContact, | ||
164 | + registerStep3HighSetting, | ||
165 | + registerStep3CreateAlarm, | ||
166 | + registerStep3Schemas, | ||
167 | + registerTrans, | ||
168 | + activeKey, | ||
169 | + registerDetail, | ||
53 | register, | 170 | register, |
54 | - register1, | ||
55 | getTitle, | 171 | getTitle, |
56 | }; | 172 | }; |
57 | }, | 173 | }, |
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | </template> | 44 | </template> |
45 | </BasicTable> | 45 | </BasicTable> |
46 | <DeviceProfileModal v-if="isJudgeStatus" @register="registerModal" @success="handleSuccess" /> | 46 | <DeviceProfileModal v-if="isJudgeStatus" @register="registerModal" @success="handleSuccess" /> |
47 | - <DeviceConfigDetail v-if="!isJudgeStatus" @register="registerModal" @success="handleSuccess" /> | 47 | + <DeviceConfigDetail @register="registerModalDetail" @success="handleSuccess" /> |
48 | <ExpExcelModal @register="register1" @success="defaultHeader" /> | 48 | <ExpExcelModal @register="register1" @success="defaultHeader" /> |
49 | </div> | 49 | </div> |
50 | </template> | 50 | </template> |
@@ -68,6 +68,7 @@ | @@ -68,6 +68,7 @@ | ||
68 | let isJudgeStatus = ref(true); | 68 | let isJudgeStatus = ref(true); |
69 | const { createMessage } = useMessage(); | 69 | const { createMessage } = useMessage(); |
70 | const [registerModal, { openModal }] = useModal(); | 70 | const [registerModal, { openModal }] = useModal(); |
71 | + const [registerModalDetail, { openModal: openModalDetail }] = useModal(); | ||
71 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ | 72 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
72 | title: '设备配置列表', | 73 | title: '设备配置列表', |
73 | clickToRowSelect: false, | 74 | clickToRowSelect: false, |
@@ -147,7 +148,7 @@ | @@ -147,7 +148,7 @@ | ||
147 | } | 148 | } |
148 | 149 | ||
149 | async function handleDetailView(record: Recordable) { | 150 | async function handleDetailView(record: Recordable) { |
150 | - openModal(true, { | 151 | + openModalDetail(true, { |
151 | record, | 152 | record, |
152 | isUpdate: false, | 153 | isUpdate: false, |
153 | }); | 154 | }); |
@@ -179,6 +180,7 @@ | @@ -179,6 +180,7 @@ | ||
179 | reload(); | 180 | reload(); |
180 | } | 181 | } |
181 | return { | 182 | return { |
183 | + registerModalDetail, | ||
182 | register1, | 184 | register1, |
183 | defaultHeader, | 185 | defaultHeader, |
184 | useSelectionChange, | 186 | useSelectionChange, |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | </div> | 6 | </div> |
7 | </template> | 7 | </template> |
8 | <script lang="ts"> | 8 | <script lang="ts"> |
9 | - import { defineComponent, watch, onMounted } from 'vue'; | 9 | + import { defineComponent } from 'vue'; |
10 | import { BasicForm, useForm } from '/@/components/Form'; | 10 | import { BasicForm, useForm } from '/@/components/Form'; |
11 | import { step1Schemas } from './data'; | 11 | import { step1Schemas } from './data'; |
12 | import { Select, Input, Divider } from 'ant-design-vue'; | 12 | import { Select, Input, Divider } from 'ant-design-vue'; |
@@ -20,10 +20,7 @@ | @@ -20,10 +20,7 @@ | ||
20 | [Divider.name]: Divider, | 20 | [Divider.name]: Divider, |
21 | }, | 21 | }, |
22 | emits: ['next', 'resetFunc'], | 22 | emits: ['next', 'resetFunc'], |
23 | - props: { | ||
24 | - echoStep1: Object, | ||
25 | - }, | ||
26 | - setup(props, { emit }) { | 23 | + setup(_, { emit }) { |
27 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ | 24 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ |
28 | labelWidth: 100, | 25 | labelWidth: 100, |
29 | schemas: step1Schemas, | 26 | schemas: step1Schemas, |
@@ -35,33 +32,20 @@ | @@ -35,33 +32,20 @@ | ||
35 | text: '下一步', | 32 | text: '下一步', |
36 | }, | 33 | }, |
37 | submitFunc: customSubmitFunc, | 34 | submitFunc: customSubmitFunc, |
38 | - // resetFunc: customResetFunc, | ||
39 | - }); | ||
40 | - onMounted(() => { | ||
41 | - setFieldsValue({ ...props.echoStep1 }); | ||
42 | }); | 35 | }); |
43 | - | ||
44 | - watch( | ||
45 | - () => props.echoStep1, | ||
46 | - (newV) => { | ||
47 | - setFieldsValue({ ...newV }); | ||
48 | - } | ||
49 | - ); | 36 | + const resetFieldsFunc = (v) => { |
37 | + setFieldsValue(v); | ||
38 | + }; | ||
50 | async function customSubmitFunc() { | 39 | async function customSubmitFunc() { |
51 | try { | 40 | try { |
52 | const values = await validate(); | 41 | const values = await validate(); |
53 | emit('next', values); | 42 | emit('next', values); |
54 | } catch (error) {} | 43 | } catch (error) {} |
55 | } | 44 | } |
56 | - | ||
57 | const customResetFunc = async () => { | 45 | const customResetFunc = async () => { |
58 | await resetFields(); | 46 | await resetFields(); |
59 | - // try { | ||
60 | - // emit('resetFunc', resetValue); | ||
61 | - // } catch (error) {} | ||
62 | }; | 47 | }; |
63 | - | ||
64 | - return { register, customResetFunc }; | 48 | + return { register, customResetFunc, resetFieldsFunc }; |
65 | }, | 49 | }, |
66 | }); | 50 | }); |
67 | </script> | 51 | </script> |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | </div> | 4 | </div> |
5 | </template> | 5 | </template> |
6 | <script lang="ts"> | 6 | <script lang="ts"> |
7 | - import { defineComponent, watch } from 'vue'; | 7 | + import { defineComponent } from 'vue'; |
8 | import { BasicForm, useForm } from '/@/components/Form'; | 8 | import { BasicForm, useForm } from '/@/components/Form'; |
9 | import { step2Schemas } from './data'; | 9 | import { step2Schemas } from './data'; |
10 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; | 10 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
@@ -18,10 +18,7 @@ | @@ -18,10 +18,7 @@ | ||
18 | [Descriptions.Item.name]: Descriptions.Item, | 18 | [Descriptions.Item.name]: Descriptions.Item, |
19 | }, | 19 | }, |
20 | emits: ['next', 'prev'], | 20 | emits: ['next', 'prev'], |
21 | - props: { | ||
22 | - echoStep2: Object, | ||
23 | - }, | ||
24 | - setup(props, { emit }) { | 21 | + setup(_, { emit }) { |
25 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ | 22 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ |
26 | labelWidth: 80, | 23 | labelWidth: 80, |
27 | schemas: step2Schemas, | 24 | schemas: step2Schemas, |
@@ -37,16 +34,12 @@ | @@ -37,16 +34,12 @@ | ||
37 | resetFunc: customResetFunc, | 34 | resetFunc: customResetFunc, |
38 | submitFunc: customSubmitFunc, | 35 | submitFunc: customSubmitFunc, |
39 | }); | 36 | }); |
40 | - watch( | ||
41 | - () => props.echoStep2, | ||
42 | - (newV) => { | ||
43 | - if (newV?.key == 'edit') { | ||
44 | - setFieldsValue({ ...newV }); | ||
45 | - } else { | ||
46 | - resetFields(); | ||
47 | - } | ||
48 | - } | ||
49 | - ); | 37 | + const resetFieldsFunc = (v) => { |
38 | + setFieldsValue(v); | ||
39 | + }; | ||
40 | + const customResetAndFunc = async () => { | ||
41 | + await resetFields(); | ||
42 | + }; | ||
50 | async function customResetFunc() { | 43 | async function customResetFunc() { |
51 | emit('prev'); | 44 | emit('prev'); |
52 | } | 45 | } |
@@ -56,7 +49,7 @@ | @@ -56,7 +49,7 @@ | ||
56 | emit('next', values); | 49 | emit('next', values); |
57 | } catch (error) {} | 50 | } catch (error) {} |
58 | } | 51 | } |
59 | - return { register }; | 52 | + return { register, resetFieldsFunc, customResetAndFunc }; |
60 | }, | 53 | }, |
61 | }); | 54 | }); |
62 | </script> | 55 | </script> |
src/views/device/profile/step/DeviceProfileStep3 copy.vue
deleted
100644 → 0
1 | -<template> | ||
2 | - <div class="step3"> | ||
3 | - <template v-for="(item, index) in alarmList" :key="item.id"> | ||
4 | - <CollapseContainer class="border mb-8"> | ||
5 | - <template #action> | ||
6 | - <div @click="deleteAlarmRule(index)" class="cursor-pointer"> | ||
7 | - <DeleteOutlined style="font-size: 20px" class="mr-2" /> | ||
8 | - </div> | ||
9 | - </template> | ||
10 | - <BasicForm @register="registerForm" /> | ||
11 | - <CollapseContainer> | ||
12 | - <template #action> 高级设置 </template> | ||
13 | - <BasicForm @register="registerFormHighSetting"> | ||
14 | - <template #checkBox="{ model, field }"> | ||
15 | - <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | ||
16 | - </template> | ||
17 | - </BasicForm> | ||
18 | - </CollapseContainer> | ||
19 | - <p>创建报警规则</p> | ||
20 | - <template v-for="(childItem, createIndex) in item.createRule" :key="childItem.id"> | ||
21 | - <div class="aic mb-4" style="border: 1px solid #bfbfbf"> | ||
22 | - <div class="w-3/4"> | ||
23 | - <BasicForm @register="registerFormCreateAlarm" /> | ||
24 | - <div> | ||
25 | - <p style="color: #f5594e" class="mt-4 ml-4" | ||
26 | - >请添加报警规则条件 | ||
27 | - <PlusOutlined class="cursor-pointer ml-4" style="font-size: 20px" | ||
28 | - /></p> | ||
29 | - <p class="mt-4 ml-4" | ||
30 | - >启用规则:始终启用 | ||
31 | - <EditOutlined class="cursor-pointer ml-4" style="font-size: 20px" | ||
32 | - /></p> | ||
33 | - <p class="mt-4 ml-4" | ||
34 | - >详情:<EditOutlined class="cursor-pointer ml-4" style="font-size: 20px" | ||
35 | - /></p> | ||
36 | - <p class="mt-4 ml-4">dashboard:</p> | ||
37 | - </div> | ||
38 | - </div> | ||
39 | - <div class="w-1/4 flex justify-center"> | ||
40 | - <Tooltip title="移除"> | ||
41 | - <MinusCircleOutlined | ||
42 | - style="font-size: 25px; color: #305680" | ||
43 | - class="cursor-pointer" | ||
44 | - @click="deleteCondition(index, createIndex)" | ||
45 | - /> | ||
46 | - </Tooltip> | ||
47 | - </div> | ||
48 | - </div> | ||
49 | - </template> | ||
50 | - <a-button class="mt-5" @click="addCreateRole(index)" | ||
51 | - ><PlusCircleOutlined />添加创建条件</a-button | ||
52 | - > | ||
53 | - <p>清除报警规则</p> | ||
54 | - <BasicForm @register="registerFormClearAlarm"> | ||
55 | - <template #formHeader> </template> | ||
56 | - </BasicForm> | ||
57 | - </CollapseContainer> | ||
58 | - </template> | ||
59 | - <div class="flex justify-start"> | ||
60 | - <a-button class="mr-5" @click="prevStep">上一步</a-button> | ||
61 | - <a-button type="primary" @click="addAlarmRule">添加报警规则</a-button> | ||
62 | - <a-button style="margin-left: 14px" @click="handleClickAddAlertContacts">下一步</a-button> | ||
63 | - </div> | ||
64 | - <BasicModal | ||
65 | - v-if="statusModel" | ||
66 | - @register="registerAlert" | ||
67 | - v-bind="$attrs" | ||
68 | - :showCancelBtn="true" | ||
69 | - :showOkBtn="true" | ||
70 | - :canFullscreen="false" | ||
71 | - :closable="false" | ||
72 | - :height="900" | ||
73 | - :width="500" | ||
74 | - :maskClosable="false" | ||
75 | - title="告警通知" | ||
76 | - :helpMessage="['告警通知']" | ||
77 | - @ok="handleModal" | ||
78 | - > | ||
79 | - <div> | ||
80 | - <span>请选择告警通知联系人:</span> | ||
81 | - <Tag v-for="(item, index) in 10" closable @close="log" :key="index"> 冯涛+{{ item }}</Tag> | ||
82 | - </div> | ||
83 | - <AlertContacts ref="getAlertContactRef" /> | ||
84 | - </BasicModal> | ||
85 | - </div> | ||
86 | -</template> | ||
87 | - | ||
88 | -<script lang="ts"> | ||
89 | - import { defineComponent, ref, unref } from 'vue'; | ||
90 | - import type { alarmListItem } from '../types/index'; | ||
91 | - import { CollapseContainer } from '/@/components/Container/index'; | ||
92 | - import { BasicForm, useForm } from '/@/components/Form'; | ||
93 | - import { step3Schemas, step3HighSetting, step3CreateAlarm, step3ClearAlarm } from './data'; | ||
94 | - import { | ||
95 | - DeleteOutlined, | ||
96 | - MinusCircleOutlined, | ||
97 | - PlusCircleOutlined, | ||
98 | - PlusOutlined, | ||
99 | - EditOutlined, | ||
100 | - } from '@ant-design/icons-vue'; | ||
101 | - import { Tooltip, Checkbox, Tag } from 'ant-design-vue'; | ||
102 | - import AlertContacts from '../cpns/index.vue'; | ||
103 | - import { BasicModal, useModal } from '/@/components/Modal'; | ||
104 | - | ||
105 | - export default defineComponent({ | ||
106 | - components: { | ||
107 | - BasicForm, | ||
108 | - CollapseContainer, | ||
109 | - DeleteOutlined, | ||
110 | - MinusCircleOutlined, | ||
111 | - PlusCircleOutlined, | ||
112 | - PlusOutlined, | ||
113 | - EditOutlined, | ||
114 | - Checkbox, | ||
115 | - Tooltip, | ||
116 | - BasicModal, | ||
117 | - AlertContacts, | ||
118 | - Tag, | ||
119 | - }, | ||
120 | - emits: ['prev'], | ||
121 | - setup(_, { emit }) { | ||
122 | - //告警列表 | ||
123 | - let alarmList = ref<alarmListItem[]>([]); | ||
124 | - const log = (e) => { | ||
125 | - console.log(e); | ||
126 | - }; | ||
127 | - // 添加和删除告警配置 | ||
128 | - const deleteAlarmRule = (index: number) => { | ||
129 | - unref(alarmList).splice(index, 1); | ||
130 | - }; | ||
131 | - // 上一步 | ||
132 | - const prevStep = () => { | ||
133 | - emit('prev'); | ||
134 | - }; | ||
135 | - const addAlarmRule = () => { | ||
136 | - unref(alarmList).push({ | ||
137 | - id: Date.now(), | ||
138 | - alarmType: '', | ||
139 | - isPass: false, | ||
140 | - createRule: [ | ||
141 | - { | ||
142 | - id: Date.now() + Math.random(), | ||
143 | - alarmVisible: false, | ||
144 | - addKeyFilterVisible: false, | ||
145 | - detailVisible: false, | ||
146 | - detail: '', | ||
147 | - filterList: [], | ||
148 | - }, | ||
149 | - ], | ||
150 | - clearRule: [], | ||
151 | - }); | ||
152 | - }; | ||
153 | - | ||
154 | - // 表单部分 报警类型 | ||
155 | - const [registerForm] = useForm({ | ||
156 | - labelWidth: 120, | ||
157 | - schemas: step3Schemas, | ||
158 | - showResetButton: false, | ||
159 | - showSubmitButton: false, | ||
160 | - }); | ||
161 | - | ||
162 | - // 高级设置 | ||
163 | - const [registerFormHighSetting] = useForm({ | ||
164 | - labelWidth: 120, | ||
165 | - schemas: step3HighSetting, | ||
166 | - showResetButton: false, | ||
167 | - showSubmitButton: false, | ||
168 | - actionColOptions: { | ||
169 | - span: 24, | ||
170 | - }, | ||
171 | - }); | ||
172 | - | ||
173 | - // 添加创建条件表单 | ||
174 | - const [registerFormCreateAlarm] = useForm({ | ||
175 | - labelWidth: 120, | ||
176 | - schemas: step3CreateAlarm, | ||
177 | - showResetButton: false, | ||
178 | - showSubmitButton: false, | ||
179 | - actionColOptions: { | ||
180 | - span: 24, | ||
181 | - }, | ||
182 | - }); | ||
183 | - | ||
184 | - // 清除条件表单 | ||
185 | - const [registerFormClearAlarm] = useForm({ | ||
186 | - labelWidth: 120, | ||
187 | - schemas: step3ClearAlarm, | ||
188 | - showResetButton: false, | ||
189 | - showSubmitButton: false, | ||
190 | - actionColOptions: { | ||
191 | - span: 24, | ||
192 | - }, | ||
193 | - }); | ||
194 | - | ||
195 | - // 添加‘创建条件’ | ||
196 | - const addCreateRole = (index: number) => { | ||
197 | - unref(alarmList)[index].createRule.push({ | ||
198 | - id: Date.now() + Math.random(), | ||
199 | - alarmVisible: false, | ||
200 | - addKeyFilterVisible: false, | ||
201 | - detailVisible: false, | ||
202 | - detail: '', | ||
203 | - filterList: [], | ||
204 | - }); | ||
205 | - }; | ||
206 | - // 删除‘创建条件’ | ||
207 | - const deleteCondition = (index: number, createIndex: number) => { | ||
208 | - alarmList.value[index].createRule.splice(createIndex, 1); | ||
209 | - }; | ||
210 | - | ||
211 | - const statusModel = ref(false); | ||
212 | - const [registerAlert, { openModal }] = useModal(); | ||
213 | - const handleClickAddAlertContacts = () => { | ||
214 | - statusModel.value = true; | ||
215 | - openModal(statusModel.value); | ||
216 | - }; | ||
217 | - const handleModal = () => { | ||
218 | - console.log(1); | ||
219 | - }; | ||
220 | - | ||
221 | - return { | ||
222 | - handleModal, | ||
223 | - log, | ||
224 | - statusModel, | ||
225 | - registerAlert, | ||
226 | - handleClickAddAlertContacts, | ||
227 | - alarmList, | ||
228 | - deleteAlarmRule, | ||
229 | - prevStep, | ||
230 | - addAlarmRule, | ||
231 | - registerForm, | ||
232 | - registerFormHighSetting, | ||
233 | - registerFormCreateAlarm, | ||
234 | - addCreateRole, | ||
235 | - deleteCondition, | ||
236 | - registerFormClearAlarm, | ||
237 | - }; | ||
238 | - }, | ||
239 | - }); | ||
240 | -</script> | ||
241 | - | ||
242 | -<style lang="less" scoped> | ||
243 | - .step3 { | ||
244 | - width: 100%; | ||
245 | - } | ||
246 | - .border { | ||
247 | - border: 1px solid #bfbfbf; | ||
248 | - } | ||
249 | - | ||
250 | - .aic { | ||
251 | - display: flex; | ||
252 | - align-items: center; | ||
253 | - } | ||
254 | - | ||
255 | - :deep(.vben-collapse-container__header) { | ||
256 | - border: none; | ||
257 | - } | ||
258 | -</style> |
@@ -7,42 +7,51 @@ | @@ -7,42 +7,51 @@ | ||
7 | <DeleteOutlined style="font-size: 20px" class="mr-2" /> | 7 | <DeleteOutlined style="font-size: 20px" class="mr-2" /> |
8 | </div> | 8 | </div> |
9 | </template> | 9 | </template> |
10 | - <BasicForm @register="registerForm" /> | 10 | + <div style="margin-left: -30px"> <BasicForm @register="registerForm" /></div> |
11 | <CollapseContainer> | 11 | <CollapseContainer> |
12 | <template #action> 高级设置 </template> | 12 | <template #action> 高级设置 </template> |
13 | - <BasicForm @register="registerFormHighSetting"> | ||
14 | - <template #checkBox="{ model, field }"> | ||
15 | - <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | ||
16 | - </template> | ||
17 | - </BasicForm> | 13 | + <div style="margin-left: 10px"> |
14 | + <BasicForm @register="registerFormHighSetting"> | ||
15 | + <template #checkBox="{ model, field }"> | ||
16 | + <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | ||
17 | + </template> | ||
18 | + </BasicForm> | ||
19 | + </div> | ||
18 | </CollapseContainer> | 20 | </CollapseContainer> |
19 | <p>创建报警规则</p> | 21 | <p>创建报警规则</p> |
20 | <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | 22 | <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> |
21 | <div class="aic mb-4" style="border: 1px solid #bfbfbf"> | 23 | <div class="aic mb-4" style="border: 1px solid #bfbfbf"> |
22 | <div class="w-3/4"> | 24 | <div class="w-3/4"> |
23 | - <BasicForm @register="registerFormCreateAlarm" /> | ||
24 | - <div> | 25 | + <div style="margin-left: -30px" |
26 | + ><BasicForm @register="registerFormCreateAlarm" | ||
27 | + /></div> | ||
28 | + <div style="margin-left: 5px"> | ||
25 | <p style="color: #f5594e" class="mt-4 ml-4" | 29 | <p style="color: #f5594e" class="mt-4 ml-4" |
26 | >请添加报警规则条件 | 30 | >请添加报警规则条件 |
27 | <PlusOutlined | 31 | <PlusOutlined |
28 | @click="handleOpenAlaramRuleConditions" | 32 | @click="handleOpenAlaramRuleConditions" |
29 | class="cursor-pointer ml-4" | 33 | class="cursor-pointer ml-4" |
30 | style="font-size: 20px" | 34 | style="font-size: 20px" |
31 | - /></p> | ||
32 | - <p class="mt-4 ml-4" | 35 | + />{{ ruleTemplateData }} |
36 | + </p> | ||
37 | + <p style="white-space: wrap" class="mt-4 ml-4" | ||
33 | >启用规则:始终启用 | 38 | >启用规则:始终启用 |
34 | <EditOutlined | 39 | <EditOutlined |
35 | @click="handleOpenEnableRule" | 40 | @click="handleOpenEnableRule" |
36 | class="cursor-pointer ml-4" | 41 | class="cursor-pointer ml-4" |
37 | style="font-size: 20px" | 42 | style="font-size: 20px" |
38 | - /></p> | 43 | + />{{ enableTemplateData }} |
44 | + </p> | ||
39 | <p class="mt-4 ml-4" | 45 | <p class="mt-4 ml-4" |
40 | >详情模板:<EditOutlined | 46 | >详情模板:<EditOutlined |
41 | @click="handleOpenDetailTemplate" | 47 | @click="handleOpenDetailTemplate" |
42 | class="cursor-pointer ml-4" | 48 | class="cursor-pointer ml-4" |
43 | style="font-size: 20px" | 49 | style="font-size: 20px" |
44 | - /></p> | ||
45 | - <BasicForm @register="dashboardForm" /> | 50 | + />{{ detailTemplateData }} |
51 | + </p> | ||
52 | + <div style="margin-left: 16px"> | ||
53 | + <BasicForm @register="dashboardForm" /> | ||
54 | + </div> | ||
46 | </div> | 55 | </div> |
47 | </div> | 56 | </div> |
48 | <div class="w-1/4 flex justify-center"> | 57 | <div class="w-1/4 flex justify-center"> |
@@ -59,11 +68,12 @@ | @@ -59,11 +68,12 @@ | ||
59 | <a-button class="mt-5" @click="addCreateRole(index)" | 68 | <a-button class="mt-5" @click="addCreateRole(index)" |
60 | ><PlusCircleOutlined />添加创建条件</a-button | 69 | ><PlusCircleOutlined />添加创建条件</a-button |
61 | > | 70 | > |
71 | + <div style="height: 20px"></div> | ||
62 | <p>清除报警规则</p> | 72 | <p>清除报警规则</p> |
63 | <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | 73 | <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> |
64 | <div class="aic mb-4" style="border: 1px solid #bfbfbf"> | 74 | <div class="aic mb-4" style="border: 1px solid #bfbfbf"> |
65 | <div class="w-3/4"> | 75 | <div class="w-3/4"> |
66 | - <div> | 76 | + <div style="margin-left: 5px"> |
67 | <p style="color: #f5594e" class="mt-4 ml-4" | 77 | <p style="color: #f5594e" class="mt-4 ml-4" |
68 | >请添加报警规则条件 | 78 | >请添加报警规则条件 |
69 | <PlusOutlined | 79 | <PlusOutlined |
@@ -84,7 +94,9 @@ | @@ -84,7 +94,9 @@ | ||
84 | class="cursor-pointer ml-4" | 94 | class="cursor-pointer ml-4" |
85 | style="font-size: 20px" | 95 | style="font-size: 20px" |
86 | /></p> | 96 | /></p> |
87 | - <BasicForm @register="dashboardForm" /> | 97 | + <div style="margin-left: 16px"> |
98 | + <BasicForm @register="dashboardForm" /> | ||
99 | + </div> | ||
88 | </div> | 100 | </div> |
89 | </div> | 101 | </div> |
90 | <div class="w-1/4 flex justify-center"> | 102 | <div class="w-1/4 flex justify-center"> |
@@ -183,9 +195,13 @@ | @@ -183,9 +195,13 @@ | ||
183 | const emptyObj: any = ref({}); | 195 | const emptyObj: any = ref({}); |
184 | const detailObj: any = ref({}); | 196 | const detailObj: any = ref({}); |
185 | const ruleObj: any = ref({}); | 197 | const ruleObj: any = ref({}); |
198 | + const ruleLastObj: any = ref({}); | ||
186 | const enableObj: any = ref({}); | 199 | const enableObj: any = ref({}); |
187 | const additionalObj: any = ref({}); | 200 | const additionalObj: any = ref({}); |
188 | const isWhereTypeValue = ref(null); | 201 | const isWhereTypeValue = ref(null); |
202 | + const ruleTemplateData: any = ref(null); | ||
203 | + const enableTemplateData: any = ref(null); | ||
204 | + const detailTemplateData: any = ref(null); | ||
189 | //告警列表 | 205 | //告警列表 |
190 | let profileData = ref<alarmListItem[]>([]); | 206 | let profileData = ref<alarmListItem[]>([]); |
191 | const log = (e) => { | 207 | const log = (e) => { |
@@ -273,29 +289,102 @@ | @@ -273,29 +289,102 @@ | ||
273 | watch(isWhereType, (nV) => { | 289 | watch(isWhereType, (nV) => { |
274 | isWhereTypeValue.value = nV; | 290 | isWhereTypeValue.value = nV; |
275 | }); | 291 | }); |
292 | + //详情模板 | ||
276 | const getAllFieldsFunc = (v) => { | 293 | const getAllFieldsFunc = (v) => { |
277 | detailObj.value = v; | 294 | detailObj.value = v; |
295 | + detailTemplateData.value = ` | ||
296 | + 报警详细信息:${v.alarmDetails} | ||
297 | + `; | ||
278 | }; | 298 | }; |
299 | + //启用规则 | ||
279 | const getAllFieldsEnabFunc = (v) => { | 300 | const getAllFieldsEnabFunc = (v) => { |
280 | enableObj.value = v; | 301 | enableObj.value = v; |
302 | + const findDay = [ | ||
303 | + { | ||
304 | + label: '星期一', | ||
305 | + value: '1', | ||
306 | + }, | ||
307 | + { | ||
308 | + label: '星期二', | ||
309 | + value: '2', | ||
310 | + }, | ||
311 | + { | ||
312 | + label: '星期三', | ||
313 | + value: '3', | ||
314 | + }, | ||
315 | + { | ||
316 | + label: '星期四', | ||
317 | + value: '4', | ||
318 | + }, | ||
319 | + { | ||
320 | + label: '星期五', | ||
321 | + value: '5', | ||
322 | + }, | ||
323 | + { | ||
324 | + label: '星期六', | ||
325 | + value: '6', | ||
326 | + }, | ||
327 | + { | ||
328 | + label: '星期七', | ||
329 | + value: '7', | ||
330 | + }, | ||
331 | + ]; | ||
332 | + const findDayByValue = findDay.map((f, i) => { | ||
333 | + console.log(i); | ||
334 | + if (f.value == v.daysOfWeek[i]) { | ||
335 | + return f.label; | ||
336 | + } | ||
337 | + }); | ||
338 | + | ||
339 | + enableTemplateData.value = ` | ||
340 | + 开始时间:${v.startsOn}结束时间:${v.endsOn}天数:${findDayByValue} | ||
341 | + `; | ||
281 | }; | 342 | }; |
282 | - const getAllFieldsRuleFunc = (v) => { | 343 | + //规则条件 |
344 | + const getAllFieldsRuleFunc = (v, v1) => { | ||
283 | ruleObj.value = v; | 345 | ruleObj.value = v; |
284 | - const value = { | ||
285 | - value: ruleObj.value?.value, | ||
286 | - }; | 346 | + const findDay = [ |
347 | + { label: '等于', value: 'EQUAL' }, | ||
348 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
349 | + { label: '开始于', value: 'STARTS_WITH' }, | ||
350 | + { label: '结束于', value: 'ENDS_WITH' }, | ||
351 | + { label: '包含', value: 'CONTAINS' }, | ||
352 | + { label: '不包含', value: 'NOT_CONTAINS' }, | ||
353 | + { label: '等于', value: 'EQUAL' }, | ||
354 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
355 | + { label: '大于', value: 'GREATER' }, | ||
356 | + { label: '小于', value: 'LESS' }, | ||
357 | + { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
358 | + { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
359 | + ]; | ||
360 | + const findRuleByValue = findDay.find((f) => { | ||
361 | + if (f.value == v.operation) { | ||
362 | + return f.label; | ||
363 | + } | ||
364 | + }); | ||
365 | + ruleTemplateData.value = ` | ||
366 | + 键名:${v.key}...操作:${findRuleByValue?.label}...值:${v.value1} | ||
367 | + `; | ||
368 | + ruleLastObj.value = v1; | ||
287 | const predicate = { | 369 | const predicate = { |
288 | - operation: 'GREATER_OR_EQUAL', | 370 | + operation: ruleObj.value.operation, |
289 | value: { | 371 | value: { |
290 | - defaultValue: 12, | 372 | + defaultValue: Number(ruleObj.value.value1), |
291 | }, | 373 | }, |
292 | - type: 'NUMERIC', | 374 | + type: ruleObj.value.type1, |
293 | }; | 375 | }; |
294 | - const spec = { | ||
295 | - // type: ruleObj.value?.spec, | ||
296 | - type: 'SIMPLE', | 376 | + const spec1 = { |
377 | + type: ruleLastObj.value.conditionType, | ||
378 | + // unit: ruleLastObj.value.unit, | ||
379 | + // predicate: { | ||
380 | + // defaultValue: Number(ruleLastObj.value.defaultValue), | ||
381 | + // dynamicValue: { | ||
382 | + // sourceType: ruleLastObj.value.sourceType, | ||
383 | + // sourceAttribute: ruleLastObj.value.sourceAttribute, | ||
384 | + // inherit: ruleLastObj.value.inherit, | ||
385 | + // }, | ||
386 | + // }, | ||
297 | }; | 387 | }; |
298 | - | ||
299 | const getCondition = { | 388 | const getCondition = { |
300 | condition: [ | 389 | condition: [ |
301 | { | 390 | { |
@@ -303,20 +392,13 @@ | @@ -303,20 +392,13 @@ | ||
303 | type: ruleObj.value?.type, | 392 | type: ruleObj.value?.type, |
304 | key: ruleObj.value?.key, | 393 | key: ruleObj.value?.key, |
305 | }, | 394 | }, |
306 | - valueType: ruleObj.value?.valueType, | ||
307 | - value, | 395 | + valueType: ruleObj.value.type1, |
308 | predicate, | 396 | predicate, |
309 | }, | 397 | }, |
310 | ], | 398 | ], |
311 | - spec, | 399 | + spec: spec1, |
312 | }; | 400 | }; |
313 | - | ||
314 | - // const spec = { | ||
315 | - // spec: ruleObj.value?.spec, | ||
316 | - // }; | ||
317 | - | ||
318 | const getValueConditon = { | 401 | const getValueConditon = { |
319 | - // spec, | ||
320 | condition: getCondition, | 402 | condition: getCondition, |
321 | }; | 403 | }; |
322 | Object.assign(additionalObj.value, getValueConditon); | 404 | Object.assign(additionalObj.value, getValueConditon); |
@@ -327,8 +409,8 @@ | @@ -327,8 +409,8 @@ | ||
327 | const scheduleValue = { | 409 | const scheduleValue = { |
328 | type: enableObj.value.schedule, | 410 | type: enableObj.value.schedule, |
329 | daysOfWeek: enableObj.value.daysOfWeek, | 411 | daysOfWeek: enableObj.value.daysOfWeek, |
330 | - endsOn: enableObj.value.endsOn, | ||
331 | - startsOn: enableObj.value.startOn, | 412 | + // endsOn: enableObj.value.endsOn, |
413 | + // startsOn: enableObj.value.startOn, | ||
332 | timezone: enableObj.value.timezone, | 414 | timezone: enableObj.value.timezone, |
333 | }; | 415 | }; |
334 | const getSchedule = { | 416 | const getSchedule = { |
@@ -353,7 +435,7 @@ | @@ -353,7 +435,7 @@ | ||
353 | }; | 435 | }; |
354 | 436 | ||
355 | const valueRegisterFormHighSetting = await validateRegisterFormHighSetting(); | 437 | const valueRegisterFormHighSetting = await validateRegisterFormHighSetting(); |
356 | - const valueRegisterFormCreateAlarm = await validateRegisterFormCreateAlarm(); | 438 | + // const valueRegisterFormCreateAlarm = await validateRegisterFormCreateAlarm(); |
357 | const getValueRegisterFormHighSetting = { | 439 | const getValueRegisterFormHighSetting = { |
358 | propagate: valueRegisterFormHighSetting?.propagate, | 440 | propagate: valueRegisterFormHighSetting?.propagate, |
359 | propagateRelationTypes: [valueRegisterFormHighSetting?.propagateRelationTypes], | 441 | propagateRelationTypes: [valueRegisterFormHighSetting?.propagateRelationTypes], |
@@ -398,6 +480,9 @@ | @@ -398,6 +480,9 @@ | ||
398 | }; | 480 | }; |
399 | 481 | ||
400 | return { | 482 | return { |
483 | + detailTemplateData, | ||
484 | + enableTemplateData, | ||
485 | + ruleTemplateData, | ||
401 | dashboardForm, | 486 | dashboardForm, |
402 | getAllFieldsRuleFunc, | 487 | getAllFieldsRuleFunc, |
403 | getAllFieldsEnabFunc, | 488 | getAllFieldsEnabFunc, |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | emits: ['prev'], | 18 | emits: ['prev'], |
19 | setup(_, { emit }) { | 19 | setup(_, { emit }) { |
20 | const getValueData: any = ref({}); | 20 | const getValueData: any = ref({}); |
21 | - const [register, { setProps, validate }] = useForm({ | 21 | + const [register, { setProps, validate, setFieldsValue, resetFields }] = useForm({ |
22 | schemas: alertContactsSchemas, | 22 | schemas: alertContactsSchemas, |
23 | actionColOptions: { | 23 | actionColOptions: { |
24 | span: 24, | 24 | span: 24, |
@@ -28,16 +28,24 @@ | @@ -28,16 +28,24 @@ | ||
28 | }, | 28 | }, |
29 | resetFunc: customResetFunc, | 29 | resetFunc: customResetFunc, |
30 | }); | 30 | }); |
31 | + const resetFieldsFunc = (v) => { | ||
32 | + setFieldsValue(v); | ||
33 | + }; | ||
34 | + const customResetAndFunc = async () => { | ||
35 | + await resetFields(); | ||
36 | + }; | ||
31 | async function customResetFunc() { | 37 | async function customResetFunc() { |
32 | emit('prev'); | 38 | emit('prev'); |
33 | } | 39 | } |
34 | - async function getAllFields(getV) { | 40 | + const getAllFields = async (getV) => { |
35 | const values = await validate(); | 41 | const values = await validate(); |
36 | getValueData.value = values; | 42 | getValueData.value = values; |
37 | getV = getValueData.value; | 43 | getV = getValueData.value; |
38 | return getV; | 44 | return getV; |
39 | - } | 45 | + }; |
40 | return { | 46 | return { |
47 | + customResetAndFunc, | ||
48 | + resetFieldsFunc, | ||
41 | customResetFunc, | 49 | customResetFunc, |
42 | getAllFields, | 50 | getAllFields, |
43 | register, | 51 | register, |
src/views/device/profile/step/DeviceProfileStep5.vue
deleted
100644 → 0
1 | -<template> | ||
2 | - <div class="step3"> | ||
3 | - <h1 v-if="alarmList.length === 0" style="font-size: 24px" class="text-center" | ||
4 | - >未配置报警规则</h1 | ||
5 | - > | ||
6 | - | ||
7 | - <template v-else v-for="(item, index) in alarmList" :key="item"> | ||
8 | - <CollapseContainer :title="item.alarmType" style="border: 1px solid #bfbfbf" class="mb-6"> | ||
9 | - <template #action> | ||
10 | - <div @click="handleDeleteAlarm(index)" class="cursor-pointer"> | ||
11 | - <DeleteOutlined style="font-size: 20px" class="mr-2" /> | ||
12 | - </div> | ||
13 | - </template> | ||
14 | - <a-form :wrapper-col="wrapperCol" labelAlign="left" :model="item" :rules="rules"> | ||
15 | - <a-form-item label="报警类型" :labelCol="{ style: { width: '80px' } }" name="alarmType"> | ||
16 | - <a-input v-model:value="item.alarmType" /> | ||
17 | - </a-form-item> | ||
18 | - </a-form> | ||
19 | - | ||
20 | - <CollapseContainer> | ||
21 | - <template #action> 高级设置 </template> | ||
22 | - <div class="flex" style="align-items: center"> | ||
23 | - <input type="checkbox" v-model="item.isPass" /> <div class="ml-2">传递警报</div> | ||
24 | - </div> | ||
25 | - | ||
26 | - <a-form :wrapper-col="wrapperCol" labelAlign="left" v-if="item.isPass"> | ||
27 | - <a-form-item label="传递的关联类型" :labelCol="{ style: { width: '120px' } }"> | ||
28 | - <a-input /> | ||
29 | - </a-form-item> | ||
30 | - </a-form> | ||
31 | - </CollapseContainer> | ||
32 | - <p style="color: #3c3c3c">创建报警规则</p> | ||
33 | - <template v-for="(item1, index1) in item.alarmRule" :key="item1"> | ||
34 | - <div class="alarm-rule mb-4"> | ||
35 | - <div style="width: 90%; border: 2px solid #8c8c8c; border-radius: 5px" class="flex"> | ||
36 | - <div style="width: 30%; height: 100%; border-right: 1px solid #e0e0e0"> | ||
37 | - <span style="color: #305680; margin-left: 10px">严重程度</span> | ||
38 | - <a-select :options="options" style="width: 100px; margin-left: 10px" /> | ||
39 | - </div> | ||
40 | - <div style="width: 70%; height: 100%"> | ||
41 | - <p style="color: #f5594e" class="mt-4 ml-4" | ||
42 | - >请添加报警规则条件 | ||
43 | - <PlusOutlined | ||
44 | - class="cursor-pointer ml-4" | ||
45 | - style="font-size: 20px" | ||
46 | - @click="editAlarmCondition(index, index1)" | ||
47 | - /></p> | ||
48 | - <p class="mt-4 ml-4" | ||
49 | - >启用规则:始终启用 | ||
50 | - <EditOutlined class="cursor-pointer ml-4" style="font-size: 20px" | ||
51 | - /></p> | ||
52 | - <p class="mt-4 ml-4" | ||
53 | - >详情:{{ item1.detail }} | ||
54 | - <EditOutlined | ||
55 | - @click="item1.detailVisible = true" | ||
56 | - class="cursor-pointer ml-4" | ||
57 | - style="font-size: 20px" | ||
58 | - /></p> | ||
59 | - <p class="mt-4 ml-4">dashboard: <a-select style="width: 180px" /></p> | ||
60 | - </div> | ||
61 | - </div> | ||
62 | - <div style="width: 10%" class="alarm-remove"> | ||
63 | - <a-tooltip title="移除"> | ||
64 | - <MinusCircleOutlined | ||
65 | - style="font-size: 25px color:#305680" | ||
66 | - class="cursor-pointer" | ||
67 | - @click="handleDeleteCondition(index, index1)" | ||
68 | - /> | ||
69 | - </a-tooltip> | ||
70 | - </div> | ||
71 | - </div> | ||
72 | - <!-- 编辑报警规则条件 --> | ||
73 | - <a-modal | ||
74 | - v-model:visible="item1.alarmVisible" | ||
75 | - title="编辑报警规则条件" | ||
76 | - centered | ||
77 | - width="800px" | ||
78 | - @cancel="handleAlarmCancel(index, index1)" | ||
79 | - @ok="item1.alarmVisible = false" | ||
80 | - > | ||
81 | - <CollapseContainer title="键名筛选器" style="border: 1px solid #bfbfbf" class="mb-6"> | ||
82 | - <a-modal | ||
83 | - v-model:visible="item1.addKeyFilterVisible" | ||
84 | - title="添加键名筛选器" | ||
85 | - centered | ||
86 | - width="600px" | ||
87 | - @ok="item1.addKeyFilterVisible = false" | ||
88 | - > | ||
89 | - <a-form | ||
90 | - :wrapper-col="wrapperCol" | ||
91 | - :labelCol="{ style: { width: '80px' } }" | ||
92 | - labelAlign="right" | ||
93 | - > | ||
94 | - <a-form-item label="键类型"> | ||
95 | - <a-select :options="keyTypeOptions" default-value="Timeseries" /> | ||
96 | - </a-form-item> | ||
97 | - <a-form-item label="键名"> | ||
98 | - <a-input /> | ||
99 | - </a-form-item> | ||
100 | - <a-form-item label="值类型"> | ||
101 | - <a-select :options="valueTypeOptions" /> | ||
102 | - </a-form-item> | ||
103 | - </a-form> | ||
104 | - <collapseContainer title="筛选器"> | ||
105 | - <template v-for="filterItem in item1.filterList" :key="filterItem"> | ||
106 | - <div class="flex justify-between mb-4" style="align-items: center"> | ||
107 | - <a-select | ||
108 | - style="width: 150px" | ||
109 | - :options="operatorOptions" | ||
110 | - default-value="=" | ||
111 | - /><a-input style="width: 350px" /> | ||
112 | - <a-tooltip title="删除筛选器"> | ||
113 | - <CloseOutlined @click="deleteFilter(index, index1)" /> | ||
114 | - </a-tooltip> | ||
115 | - </div> | ||
116 | - </template> | ||
117 | - <div class="flex"> | ||
118 | - <a-button type="primary" class="mr-4" @click="addFilter(index, index1)" | ||
119 | - >添加</a-button | ||
120 | - > | ||
121 | - <a-button type="primary">添加复合</a-button> | ||
122 | - </div> | ||
123 | - </collapseContainer> | ||
124 | - </a-modal> | ||
125 | - <div class="flex justify-start"> | ||
126 | - <a-button type="primary" @click="item1.addKeyFilterVisible = true" | ||
127 | - >添加键名筛选器</a-button | ||
128 | - > | ||
129 | - </div> | ||
130 | - </CollapseContainer> | ||
131 | - <CollapseContainer title="筛选器预览" style="border: 1px solid #bfbfbf" class="mb-6" /> | ||
132 | - </a-modal> | ||
133 | - <!-- 启用规则--> | ||
134 | - <!-- <a-modal | ||
135 | - v-model:visible="visible" | ||
136 | - title="编辑报警规则条件" | ||
137 | - centered | ||
138 | - @cancel="handleCancel(index, index1)" | ||
139 | - @ok="visible = false" | ||
140 | - > | ||
141 | - 编辑报警规则条件123 | ||
142 | - </a-modal> --> | ||
143 | - | ||
144 | - <!-- 创建报警规则详情的弹框 --> | ||
145 | - <a-modal | ||
146 | - v-model:visible="item1.detailVisible" | ||
147 | - title="详情" | ||
148 | - centered | ||
149 | - @cancel="handleCancel(index, index1)" | ||
150 | - @ok="item1.detailVisible = false" | ||
151 | - > | ||
152 | - <a-textarea v-model:value="item1.detail" placeholder="报警详细信息" :rows="4" /> | ||
153 | - </a-modal> | ||
154 | - </template> | ||
155 | - <a-button class="mt-5" @click="addCreateRole(index)" | ||
156 | - ><PlusCircleOutlined />添加创建条件</a-button | ||
157 | - > | ||
158 | - <p style="color: #3c3c3c">清除报警规则</p> | ||
159 | - <template v-for="(item2, index2) in item.removeRule" :key="item2"> | ||
160 | - <div class="alarm-rule mb-4"> | ||
161 | - <div style="width: 90%; border: 2px solid #8c8c8c; border-radius: 5px" class="flex"> | ||
162 | - <div style="width: 70%; height: 100%"> | ||
163 | - <p style="color: #f5594e" class="mt-4 ml-4" | ||
164 | - >请添加报警规则条件 | ||
165 | - <PlusOutlined class="cursor-pointer ml-4" style="font-size: 20px" | ||
166 | - /></p> | ||
167 | - <p class="mt-4 ml-4" | ||
168 | - >启用规则:始终启用 | ||
169 | - <EditOutlined class="cursor-pointer ml-4" style="font-size: 20px" | ||
170 | - /></p> | ||
171 | - <p class="mt-4 ml-4" | ||
172 | - >详情:{{ item2.detail }} | ||
173 | - <EditOutlined | ||
174 | - class="cursor-pointer ml-4" | ||
175 | - style="font-size: 20px" | ||
176 | - @click="editRemoveVisible = true" | ||
177 | - /> | ||
178 | - </p> | ||
179 | - | ||
180 | - <p class="mt-4 ml-4">Mobile dashboard: <a-select style="width: 150px" /></p> | ||
181 | - </div> | ||
182 | - </div> | ||
183 | - <div style="width: 10%" class="alarm-remove"> | ||
184 | - <a-tooltip title="移除"> | ||
185 | - <MinusCircleOutlined | ||
186 | - style="font-size: 25px color:#305680" | ||
187 | - class="cursor-pointer" | ||
188 | - @click="handleDeleteRemoveCondition(index, index2)" | ||
189 | - /> | ||
190 | - </a-tooltip> | ||
191 | - </div> | ||
192 | - </div> | ||
193 | - <a-modal | ||
194 | - v-model:visible="editRemoveVisible" | ||
195 | - title="详情" | ||
196 | - centered | ||
197 | - @cancel="handleCancel1(index, index2)" | ||
198 | - @ok="editRemoveVisible = false" | ||
199 | - > | ||
200 | - <a-textarea v-model:value="item2.detail" placeholder="报警详细信息" :rows="4" /> | ||
201 | - </a-modal> | ||
202 | - </template> | ||
203 | - <a-button class="mt-5" @click="addRemoveRule(index)" | ||
204 | - ><PlusCircleOutlined />添加清除条件</a-button | ||
205 | - > | ||
206 | - </CollapseContainer> | ||
207 | - </template> | ||
208 | - <div class="flex justify-start"> | ||
209 | - <a-button class="mr-5" @click="prevStep">上一步</a-button> | ||
210 | - <a-button type="primary" @click="addAlarmRule">添加报警规则</a-button> | ||
211 | - </div> | ||
212 | - </div> | ||
213 | -</template> | ||
214 | -<script lang="ts"> | ||
215 | - import { defineComponent, ref } from 'vue'; | ||
216 | - import { | ||
217 | - Alert, | ||
218 | - Divider, | ||
219 | - Descriptions, | ||
220 | - Input, | ||
221 | - Form, | ||
222 | - FormItem, | ||
223 | - Button, | ||
224 | - Select, | ||
225 | - Tooltip, | ||
226 | - Textarea, | ||
227 | - Modal, | ||
228 | - } from 'ant-design-vue'; | ||
229 | - import { | ||
230 | - DeleteOutlined, | ||
231 | - MinusCircleOutlined, | ||
232 | - PlusCircleOutlined, | ||
233 | - PlusOutlined, | ||
234 | - EditOutlined, | ||
235 | - CloseOutlined, | ||
236 | - } from '@ant-design/icons-vue'; | ||
237 | - import { CollapseContainer } from '/@/components/Container/index'; | ||
238 | - import { alarmListItem } from '../types/index'; | ||
239 | - export default defineComponent({ | ||
240 | - components: { | ||
241 | - DeleteOutlined, | ||
242 | - MinusCircleOutlined, | ||
243 | - PlusCircleOutlined, | ||
244 | - CollapseContainer, | ||
245 | - EditOutlined, | ||
246 | - PlusOutlined, | ||
247 | - CloseOutlined, | ||
248 | - [Form.name]: Form, | ||
249 | - [FormItem.name]: FormItem, | ||
250 | - [Modal.name]: Modal, | ||
251 | - [Textarea.name]: Textarea, | ||
252 | - [Tooltip.name]: Tooltip, | ||
253 | - [Button.name]: Button, | ||
254 | - [Input.name]: Input, | ||
255 | - [Select.name]: Select, | ||
256 | - [Form.name]: Form, | ||
257 | - [Form.Item.name]: Form.Item, | ||
258 | - [Alert.name]: Alert, | ||
259 | - [Divider.name]: Divider, | ||
260 | - [Descriptions.name]: Descriptions, | ||
261 | - [Descriptions.Item.name]: Descriptions.Item, | ||
262 | - }, | ||
263 | - emits: ['prev'], | ||
264 | - setup(_, { emit }) { | ||
265 | - const alarmList = ref<alarmListItem[]>([]); | ||
266 | - | ||
267 | - const options = ref([ | ||
268 | - { | ||
269 | - value: '1', | ||
270 | - label: '危险', | ||
271 | - }, | ||
272 | - | ||
273 | - { | ||
274 | - value: '2', | ||
275 | - label: '重要', | ||
276 | - }, | ||
277 | - { | ||
278 | - value: '3', | ||
279 | - label: '次要', | ||
280 | - }, | ||
281 | - { | ||
282 | - value: '4', | ||
283 | - label: '警告', | ||
284 | - }, | ||
285 | - { | ||
286 | - value: '5', | ||
287 | - label: '不确定', | ||
288 | - }, | ||
289 | - ]); | ||
290 | - const keyTypeOptions = ref([ | ||
291 | - { | ||
292 | - value: 'properties', | ||
293 | - label: '属性', | ||
294 | - }, | ||
295 | - | ||
296 | - { | ||
297 | - value: 'Timeseries', | ||
298 | - label: 'Timeseries', | ||
299 | - }, | ||
300 | - { | ||
301 | - value: 'constant', | ||
302 | - label: '常量', | ||
303 | - }, | ||
304 | - ]); | ||
305 | - const valueTypeOptions = ref([ | ||
306 | - { | ||
307 | - value: 'string', | ||
308 | - label: '字符串', | ||
309 | - }, | ||
310 | - { | ||
311 | - value: 'number', | ||
312 | - label: '数字', | ||
313 | - }, | ||
314 | - { | ||
315 | - value: 'boolean', | ||
316 | - label: '布尔值', | ||
317 | - }, | ||
318 | - { | ||
319 | - value: 'dateTime', | ||
320 | - label: '日期时间', | ||
321 | - }, | ||
322 | - ]); | ||
323 | - const operatorOptions = ref([ | ||
324 | - { | ||
325 | - value: '=', | ||
326 | - label: '等于', | ||
327 | - }, | ||
328 | - { | ||
329 | - value: '!=', | ||
330 | - label: '不等于', | ||
331 | - }, | ||
332 | - { | ||
333 | - value: '>', | ||
334 | - label: '大于', | ||
335 | - }, | ||
336 | - { | ||
337 | - value: '<', | ||
338 | - label: '小于', | ||
339 | - }, | ||
340 | - { | ||
341 | - value: '>=', | ||
342 | - label: '大于或等于', | ||
343 | - }, | ||
344 | - { | ||
345 | - value: '<=', | ||
346 | - label: '小于或等于', | ||
347 | - }, | ||
348 | - ]); | ||
349 | - const rules = { | ||
350 | - alarmType: [ | ||
351 | - { | ||
352 | - required: true, | ||
353 | - message: '报警类型必填', | ||
354 | - trigger: 'blur', | ||
355 | - }, | ||
356 | - ], | ||
357 | - }; | ||
358 | - | ||
359 | - const prevStep = () => { | ||
360 | - emit('prev'); | ||
361 | - }; | ||
362 | - // 添加报警规则 | ||
363 | - const addAlarmRule = () => { | ||
364 | - alarmList.value.push({ | ||
365 | - alarmType: '', | ||
366 | - isPass: false, | ||
367 | - createRule: [], | ||
368 | - clearRule: [], | ||
369 | - }); | ||
370 | - }; | ||
371 | - const handleDeleteAlarm = (index: number) => { | ||
372 | - alarmList.value.splice(index, 1); | ||
373 | - }; | ||
374 | - // 添加‘创建条件’ | ||
375 | - const addCreateRole = (index: number) => { | ||
376 | - alarmList.value[index].createRule.push({ | ||
377 | - alarmVisible: false, | ||
378 | - addKeyFilterVisible: false, | ||
379 | - detailVisible: false, | ||
380 | - detail: '', | ||
381 | - filterList: [], | ||
382 | - }); | ||
383 | - }; | ||
384 | - const handleDeleteCondition = (index: number, index1: number) => { | ||
385 | - alarmList.value[index].createRule.splice(index1, 1); | ||
386 | - }; | ||
387 | - | ||
388 | - // 添加‘清除报警规则’ | ||
389 | - const addRemoveRule = (index: number) => { | ||
390 | - alarmList.value[index].clearRule.push({ | ||
391 | - detail: '', | ||
392 | - }); | ||
393 | - }; | ||
394 | - const handleDeleteRemoveCondition = (index: number, index1: number) => { | ||
395 | - alarmList.value[index].clearRule.splice(index1, 1); | ||
396 | - }; | ||
397 | - | ||
398 | - // 弹框取消事件 --2个 | ||
399 | - const visible = ref(false); | ||
400 | - const editRemoveVisible = ref(false); | ||
401 | - const handleCancel = (index: number, index1: number) => { | ||
402 | - alarmList.value[index].createRule[index1].detail = ''; | ||
403 | - alarmList.value[index].createRule[index1].detailVisible = false; | ||
404 | - }; | ||
405 | - | ||
406 | - const handleCancel1 = (index: number, index2: number) => { | ||
407 | - alarmList.value[index].clearRule[index2].detail = ''; | ||
408 | - editRemoveVisible.value = false; | ||
409 | - }; | ||
410 | - | ||
411 | - const handleAlarmCancel = (index, index1) => { | ||
412 | - alarmList.value[index].createRule[index1].alarmVisible = false; | ||
413 | - console.log('object---'); | ||
414 | - }; | ||
415 | - const editAlarmCondition = (index, index1) => { | ||
416 | - alarmList.value[index].createRule[index1].alarmVisible = true; | ||
417 | - console.log('object'); | ||
418 | - }; | ||
419 | - // 添加键名筛选器 | ||
420 | - const addFilter = (index, index1) => { | ||
421 | - console.log(index, index1); | ||
422 | - alarmList.value[index].createRule[index1].filterList?.push({ | ||
423 | - operator: '=', | ||
424 | - value: '', | ||
425 | - }); | ||
426 | - }; | ||
427 | - const deleteFilter = (index: number, index1: number) => { | ||
428 | - alarmList.value[index].createRule[index1].filterList?.splice(index1, 1); | ||
429 | - }; | ||
430 | - return { | ||
431 | - rules, | ||
432 | - alarmList, | ||
433 | - options, | ||
434 | - visible, | ||
435 | - editRemoveVisible, | ||
436 | - prevStep, | ||
437 | - addAlarmRule, | ||
438 | - addCreateRole, | ||
439 | - handleDeleteAlarm, | ||
440 | - handleDeleteCondition, | ||
441 | - addRemoveRule, | ||
442 | - handleDeleteRemoveCondition, | ||
443 | - handleCancel, | ||
444 | - handleCancel1, | ||
445 | - handleAlarmCancel, | ||
446 | - editAlarmCondition, | ||
447 | - keyTypeOptions, | ||
448 | - valueTypeOptions, | ||
449 | - operatorOptions, | ||
450 | - deleteFilter, | ||
451 | - addFilter, | ||
452 | - labelCol: { style: { width: '150px' } }, | ||
453 | - wrapperCol: { span: 18 }, | ||
454 | - }; | ||
455 | - }, | ||
456 | - }); | ||
457 | -</script> | ||
458 | -<style lang="less" scoped> | ||
459 | - .step3 { | ||
460 | - width: 500px; | ||
461 | - margin: 0 auto; | ||
462 | - } | ||
463 | - .alarm-rule { | ||
464 | - height: 200px; | ||
465 | - display: flex; | ||
466 | - .alarm-remove { | ||
467 | - display: flex; | ||
468 | - justify-content: center; | ||
469 | - align-items: center; | ||
470 | - } | ||
471 | - } | ||
472 | -</style> |
1 | { | 1 | { |
2 | + "name": "测试2", | ||
3 | + "description": "测试2", | ||
4 | + "transportType": "COAP", | ||
2 | "profileData": { | 5 | "profileData": { |
3 | - "configuration": { | ||
4 | - "maxDevices": "1", | ||
5 | - "maxAssets": "1", | ||
6 | - "maxCustomers": "1", | ||
7 | - "maxUsers": "1", | ||
8 | - "maxDashboards": "1", | ||
9 | - "maxRuleChains": "1", | ||
10 | - "maxResourcesInBytes": "1", | ||
11 | - "maxOtaPackagesInBytes": "1", | ||
12 | - "maxTransportMessages": "1", | ||
13 | - "maxTransportDataPoints": "1", | ||
14 | - "maxREExecutions": "1", | ||
15 | - "maxJSExecutions": "1", | ||
16 | - "maxDPStorageDays": "1", | ||
17 | - "defaultStorageTtlDays": "1", | ||
18 | - "alarmsTtlDays": "1", | ||
19 | - "rpcTtlDays": "1", | ||
20 | - "maxRuleNodeExecutionsPerMessage": "1", | ||
21 | - "maxEmails": "1", | ||
22 | - "maxSms": "1", | ||
23 | - "maxCreatedAlarms": "1", | ||
24 | - "transportTenantMsgRateLimit": "1", | ||
25 | - "transportTenantTelemetryMsgRateLimit": "1", | ||
26 | - "transportTenantTelemetryDataPointsRateLimit": "1", | ||
27 | - "transportDeviceMsgRateLimit": "1", | ||
28 | - "transportDeviceTelemetryMsgRateLimit": "1", | ||
29 | - "transportDeviceTelemetryDataPointsRateLimit": "1" | ||
30 | - } | 6 | + "alarms": [ |
7 | + { | ||
8 | + "alarmType": "测试2", | ||
9 | + "propagate": true, | ||
10 | + "propagateRelationTypes": [ | ||
11 | + "测试2" | ||
12 | + ], | ||
13 | + "createRules": { | ||
14 | + "MAJOR": { | ||
15 | + "alarmDetails": "测试2", | ||
16 | + "schedule": { | ||
17 | + "type": "SPECIFIC_TIME", | ||
18 | + "daysOfWeek": [ | ||
19 | + "1", | ||
20 | + "2", | ||
21 | + "3" | ||
22 | + ], | ||
23 | + "endsOn": "14:11:27", | ||
24 | + "timezone": "Africa/Abidjan (UTC+00:00)" | ||
25 | + }, | ||
26 | + "condition": { | ||
27 | + "condition": [ | ||
28 | + { | ||
29 | + "key": { | ||
30 | + "type": "TIME_SERIES", | ||
31 | + "key": "CO2" | ||
32 | + }, | ||
33 | + "valueType": "NUMERIC", | ||
34 | + "predicate": { | ||
35 | + "operation": "LESS", | ||
36 | + "value": { | ||
37 | + "defaultValue": 2 | ||
38 | + }, | ||
39 | + "type": "NUMERIC" | ||
40 | + } | ||
41 | + } | ||
42 | + ], | ||
43 | + "spec": { | ||
44 | + "type": "DURATION", | ||
45 | + "unit": "DAYS", | ||
46 | + "predicate": { | ||
47 | + "defaultValue": 3, | ||
48 | + "dynamicValue": { | ||
49 | + "sourceType": "CURRENT_TENANT", | ||
50 | + "sourceAttribute": "测试2" | ||
51 | + } | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + } | ||
56 | + } | ||
57 | + } | ||
58 | + ] | ||
31 | }, | 59 | }, |
32 | - "name": "1", | ||
33 | - "isolatedTbRuleEngine": true, | ||
34 | - "description": "1" | 60 | + "alarmProfile": { |
61 | + "messageMode": "PHONE_MESSAGE" | ||
62 | + } | ||
35 | } | 63 | } |
src/views/device/profile/step/cpns/2.json
deleted
100644 → 0
1 | -{ | ||
2 | - "name": "租户配置测试1", | ||
3 | - "isolatedTbCore": true, | ||
4 | - "isolatedTbRuleEngine": null, | ||
5 | - "profileData": { | ||
6 | - "configuration": { | ||
7 | - "maxDevices": 1, | ||
8 | - "maxAssets": 1, | ||
9 | - "maxCustomers": 1, | ||
10 | - "maxUsers": 1, | ||
11 | - "maxDashboards": 1, | ||
12 | - "maxRuleChains": 1, | ||
13 | - "maxResourcesInBytes": 1, | ||
14 | - "maxOtaPackagesInBytes": 1, | ||
15 | - "transportTenantMsgRateLimit": "1", | ||
16 | - "transportTenantTelemetryMsgRateLimit": "1", | ||
17 | - "transportTenantTelemetryDataPointsRateLimit": "1", | ||
18 | - "transportDeviceMsgRateLimit": "当前客户", | ||
19 | - "transportDeviceTelemetryMsgRateLimit": "1", | ||
20 | - "transportDeviceTelemetryDataPointsRateLimit": "d", | ||
21 | - "maxTransportMessages": 1, | ||
22 | - "maxTransportDataPoints": 1, | ||
23 | - "maxREExecutions": 1, | ||
24 | - "maxJSExecutions": 1, | ||
25 | - "maxDPStorageDays": 1, | ||
26 | - "maxRuleNodeExecutionsPerMessage": 1, | ||
27 | - "maxEmails": 1, | ||
28 | - "maxSms": 1, | ||
29 | - "maxCreatedAlarms": 1, | ||
30 | - "defaultStorageTtlDays": 1, | ||
31 | - "alarmsTtlDays": 1, | ||
32 | - "rpcTtlDays": 1, | ||
33 | - "type": "DEFAULT" | ||
34 | - } | ||
35 | - }, | ||
36 | - "description": "1" | ||
37 | -} |
@@ -6,9 +6,9 @@ import { DescItem } from '/@/components/Description/index'; | @@ -6,9 +6,9 @@ import { DescItem } from '/@/components/Description/index'; | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | export enum TriggerEnum { | 8 | export enum TriggerEnum { |
9 | - IS_DEVICE_ACT = '', | ||
10 | - IS_TIME_ACT = 'TIME_SERIES', | ||
11 | - IS_SCENE_ACT = 'CONSTANT', | 9 | + IS_DEVICE_ACT = 'SIMPLE', |
10 | + IS_TIME_ACT = 'DURATION', | ||
11 | + IS_SCENE_ACT = 'REPEATING', | ||
12 | IS_CURRENT_CUSTOMER = 'CURRENT_CUSTOMER', | 12 | IS_CURRENT_CUSTOMER = 'CURRENT_CUSTOMER', |
13 | IS_CURRENT_DEVICE = 'CURRENT_DEVICE', | 13 | IS_CURRENT_DEVICE = 'CURRENT_DEVICE', |
14 | } | 14 | } |
@@ -68,88 +68,88 @@ export const DescDetailSchema: DescItem[] = [ | @@ -68,88 +68,88 @@ export const DescDetailSchema: DescItem[] = [ | ||
68 | 68 | ||
69 | export const formSchema: FormSchema[] = [ | 69 | export const formSchema: FormSchema[] = [ |
70 | { | 70 | { |
71 | - field: 'type1', | 71 | + field: 'conditionType', |
72 | label: '条件类型', | 72 | label: '条件类型', |
73 | colProps: { span: 24 }, | 73 | colProps: { span: 24 }, |
74 | component: 'Select', | 74 | component: 'Select', |
75 | componentProps: { | 75 | componentProps: { |
76 | placeholder: '请选择报警日程表', | 76 | placeholder: '请选择报警日程表', |
77 | options: [ | 77 | options: [ |
78 | - { label: '简单', value: '' }, | ||
79 | - { label: '持续时间', value: 'TIME_SERIES' }, | ||
80 | - { label: '重复', value: 'CONSTANT' }, | 78 | + { label: '简单', value: 'SIMPLE' }, |
79 | + { label: '持续时间', value: 'DURATION' }, | ||
80 | + { label: '重复', value: 'REPEATING' }, | ||
81 | ], | 81 | ], |
82 | }, | 82 | }, |
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | - field: 'valueType1', | 85 | + field: 'sourceType', |
86 | label: '动态源类型', | 86 | label: '动态源类型', |
87 | colProps: { span: 24 }, | 87 | colProps: { span: 24 }, |
88 | component: 'Select', | 88 | component: 'Select', |
89 | componentProps: { | 89 | componentProps: { |
90 | placeholder: '请选择动态源类型', | 90 | placeholder: '请选择动态源类型', |
91 | options: [ | 91 | options: [ |
92 | - { label: '无动态值', value: 'STRING' }, | ||
93 | - { label: '当前租户', value: 'NUMERIC' }, | ||
94 | - { label: '当前客户', value: 'BOOLEAN' }, | ||
95 | - { label: '当前设备', value: 'NUMERIC' }, | 92 | + { label: '无动态值', value: '' }, |
93 | + { label: '当前租户', value: 'CURRENT_TENANT' }, | ||
94 | + { label: '当前客户', value: 'CURRENT_CUSTOMER' }, | ||
95 | + { label: '当前设备', value: 'CURRENT_DEVICE' }, | ||
96 | ], | 96 | ], |
97 | }, | 97 | }, |
98 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | 98 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'conditionType')), |
99 | }, | 99 | }, |
100 | { | 100 | { |
101 | - field: 'value1', | 101 | + field: 'sourceAttribute', |
102 | label: '源属性', | 102 | label: '源属性', |
103 | colProps: { span: 24 }, | 103 | colProps: { span: 24 }, |
104 | component: 'Input', | 104 | component: 'Input', |
105 | componentProps: { | 105 | componentProps: { |
106 | placeholder: '源属性', | 106 | placeholder: '源属性', |
107 | }, | 107 | }, |
108 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | 108 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'conditionType')), |
109 | }, | 109 | }, |
110 | { | 110 | { |
111 | - field: 'valueType1', | 111 | + field: 'sourceType', |
112 | label: '动态源类型', | 112 | label: '动态源类型', |
113 | colProps: { span: 24 }, | 113 | colProps: { span: 24 }, |
114 | component: 'Select', | 114 | component: 'Select', |
115 | componentProps: { | 115 | componentProps: { |
116 | placeholder: '请选择动态源类型', | 116 | placeholder: '请选择动态源类型', |
117 | options: [ | 117 | options: [ |
118 | - { label: '无动态值', value: 'BOOLEAN' }, | ||
119 | - { label: '当前租户', value: 'STRING' }, | ||
120 | - { label: '当前客户', value: 'NUMERIC' }, | ||
121 | - { label: '当前设备', value: 'COMPLEX' }, | 118 | + { label: '无动态值', value: '' }, |
119 | + { label: '当前租户', value: 'CURRENT_TENANT' }, | ||
120 | + { label: '当前客户', value: 'CURRENT_CUSTOMER' }, | ||
121 | + { label: '当前设备', value: 'CURRENT_DEVICE' }, | ||
122 | ], | 122 | ], |
123 | }, | 123 | }, |
124 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | 124 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'conditionType')), |
125 | }, | 125 | }, |
126 | { | 126 | { |
127 | - field: 'value1', | 127 | + field: 'sourceAttribute', |
128 | label: '源属性', | 128 | label: '源属性', |
129 | colProps: { span: 24 }, | 129 | colProps: { span: 24 }, |
130 | component: 'Input', | 130 | component: 'Input', |
131 | componentProps: { | 131 | componentProps: { |
132 | placeholder: '源属性', | 132 | placeholder: '源属性', |
133 | }, | 133 | }, |
134 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | 134 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'conditionType')), |
135 | }, | 135 | }, |
136 | { | 136 | { |
137 | - field: 'predicate1', | 137 | + field: 'defaultValue', |
138 | label: '持续时间值', | 138 | label: '持续时间值', |
139 | colProps: { span: 24 }, | 139 | colProps: { span: 24 }, |
140 | component: 'Input', | 140 | component: 'Input', |
141 | componentProps: { | 141 | componentProps: { |
142 | - placeholder: '请输入持续时间值', | 142 | + placeholder: '请输入持续时间值(请输入数字)', |
143 | }, | 143 | }, |
144 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | 144 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'conditionType')), |
145 | }, | 145 | }, |
146 | { | 146 | { |
147 | - field: 'spec1', | 147 | + field: 'unit', |
148 | label: '时间单位', | 148 | label: '时间单位', |
149 | colProps: { span: 24 }, | 149 | colProps: { span: 24 }, |
150 | component: 'Select', | 150 | component: 'Select', |
151 | componentProps: { | 151 | componentProps: { |
152 | - placeholder: '请选择报警日程表', | 152 | + placeholder: '请选择时间单位', |
153 | options: [ | 153 | options: [ |
154 | { label: '秒', value: 'SECONDS' }, | 154 | { label: '秒', value: 'SECONDS' }, |
155 | { label: '分钟', value: 'MINUTES' }, | 155 | { label: '分钟', value: 'MINUTES' }, |
@@ -157,26 +157,26 @@ export const formSchema: FormSchema[] = [ | @@ -157,26 +157,26 @@ export const formSchema: FormSchema[] = [ | ||
157 | { label: '天', value: 'DAYS' }, | 157 | { label: '天', value: 'DAYS' }, |
158 | ], | 158 | ], |
159 | }, | 159 | }, |
160 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | 160 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'conditionType')), |
161 | }, | 161 | }, |
162 | { | 162 | { |
163 | - field: '', | 163 | + field: 'defaultValue', |
164 | label: '事件计数值必填', | 164 | label: '事件计数值必填', |
165 | colProps: { span: 24 }, | 165 | colProps: { span: 24 }, |
166 | component: 'Input', | 166 | component: 'Input', |
167 | componentProps: { | 167 | componentProps: { |
168 | - placeholder: '请输入事件计数值必填', | 168 | + placeholder: '请输入事件计数值必填(请输入数字)', |
169 | }, | 169 | }, |
170 | rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }], | 170 | rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }], |
171 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | 171 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'conditionType')), |
172 | }, | 172 | }, |
173 | { | 173 | { |
174 | - field: '', | 174 | + field: 'inherit', |
175 | label: '', | 175 | label: '', |
176 | component: 'Checkbox', | 176 | component: 'Checkbox', |
177 | renderComponentContent: 'Inherit from owner', | 177 | renderComponentContent: 'Inherit from owner', |
178 | ifShow: ({ values }) => | 178 | ifShow: ({ values }) => |
179 | - isCurrentCus(Reflect.get(values, 'valueType')) || | ||
180 | - isCurrentDev(Reflect.get(values, 'valueType')), | 179 | + isCurrentCus(Reflect.get(values, 'sourceType')) || |
180 | + isCurrentDev(Reflect.get(values, 'sourceType')), | ||
181 | }, | 181 | }, |
182 | ]; | 182 | ]; |
@@ -8,6 +8,10 @@ export enum TriggerEnum { | @@ -8,6 +8,10 @@ export enum TriggerEnum { | ||
8 | IS_DEVICE_ACT = '属性', | 8 | IS_DEVICE_ACT = '属性', |
9 | IS_TIME_ACT = 'TIME_SERIES', | 9 | IS_TIME_ACT = 'TIME_SERIES', |
10 | IS_SCENE_ACT = '常量', | 10 | IS_SCENE_ACT = '常量', |
11 | + IS_STRING = 'STRING', | ||
12 | + IS_NUMERIC = 'NUMERIC', | ||
13 | + IS_BOOLEAN = 'BOOLEAN', | ||
14 | + IS_COMPLEX = 'COMPLEX', | ||
11 | } | 15 | } |
12 | 16 | ||
13 | export const isShiDu = (type: string) => { | 17 | export const isShiDu = (type: string) => { |
@@ -21,6 +25,22 @@ export const isTimeAll = (type: string) => { | @@ -21,6 +25,22 @@ export const isTimeAll = (type: string) => { | ||
21 | return type === TriggerEnum.IS_SCENE_ACT; | 25 | return type === TriggerEnum.IS_SCENE_ACT; |
22 | }; | 26 | }; |
23 | 27 | ||
28 | +export const isString = (type: string) => { | ||
29 | + return type === TriggerEnum.IS_STRING; | ||
30 | +}; | ||
31 | + | ||
32 | +export const isNumeric = (type: string) => { | ||
33 | + return type === TriggerEnum.IS_NUMERIC; | ||
34 | +}; | ||
35 | + | ||
36 | +export const isBoolean = (type: string) => { | ||
37 | + return type === TriggerEnum.IS_BOOLEAN; | ||
38 | +}; | ||
39 | + | ||
40 | +export const isComplex = (type: string) => { | ||
41 | + return type === TriggerEnum.IS_COMPLEX; | ||
42 | +}; | ||
43 | + | ||
24 | export const formSchema: FormSchema[] = [ | 44 | export const formSchema: FormSchema[] = [ |
25 | { | 45 | { |
26 | field: 'type', | 46 | field: 'type', |
@@ -79,7 +99,7 @@ export const formSchema: FormSchema[] = [ | @@ -79,7 +99,7 @@ export const formSchema: FormSchema[] = [ | ||
79 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | 99 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
80 | }, | 100 | }, |
81 | { | 101 | { |
82 | - field: 'valueType', | 102 | + field: 'type1', |
83 | label: '值类型', | 103 | label: '值类型', |
84 | colProps: { span: 24 }, | 104 | colProps: { span: 24 }, |
85 | component: 'Select', | 105 | component: 'Select', |
@@ -93,4 +113,81 @@ export const formSchema: FormSchema[] = [ | @@ -93,4 +113,81 @@ export const formSchema: FormSchema[] = [ | ||
93 | ], | 113 | ], |
94 | }, | 114 | }, |
95 | }, | 115 | }, |
116 | + { | ||
117 | + field: 'operation', | ||
118 | + label: '操作', | ||
119 | + colProps: { span: 24 }, | ||
120 | + component: 'Select', | ||
121 | + componentProps: { | ||
122 | + placeholder: '请选择操作', | ||
123 | + options: [ | ||
124 | + { label: '等于', value: 'EQUAL' }, | ||
125 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
126 | + { label: '开始于', value: 'STARTS_WITH' }, | ||
127 | + { label: '结束于', value: 'ENDS_WITH' }, | ||
128 | + { label: '包含', value: 'CONTAINS' }, | ||
129 | + { label: '不包含', value: 'NOT_CONTAINS' }, | ||
130 | + ], | ||
131 | + }, | ||
132 | + ifShow: ({ values }) => isString(Reflect.get(values, 'type1')), | ||
133 | + }, | ||
134 | + { | ||
135 | + field: 'operation', | ||
136 | + label: '操作', | ||
137 | + colProps: { span: 24 }, | ||
138 | + component: 'Select', | ||
139 | + componentProps: { | ||
140 | + placeholder: '请选择操作', | ||
141 | + options: [ | ||
142 | + { label: '等于', value: 'EQUAL' }, | ||
143 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
144 | + { label: '大于', value: 'GREATER' }, | ||
145 | + { label: '小于', value: 'LESS' }, | ||
146 | + { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
147 | + { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
148 | + ], | ||
149 | + }, | ||
150 | + ifShow: ({ values }) => isNumeric(Reflect.get(values, 'type1')), | ||
151 | + }, | ||
152 | + { | ||
153 | + field: 'operation', | ||
154 | + label: '操作', | ||
155 | + colProps: { span: 24 }, | ||
156 | + component: 'Select', | ||
157 | + componentProps: { | ||
158 | + placeholder: '请选择操作', | ||
159 | + options: [ | ||
160 | + { label: '等于', value: 'EQUAL' }, | ||
161 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
162 | + ], | ||
163 | + }, | ||
164 | + ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), | ||
165 | + }, | ||
166 | + { | ||
167 | + field: 'operation', | ||
168 | + label: '操作', | ||
169 | + colProps: { span: 24 }, | ||
170 | + component: 'Select', | ||
171 | + componentProps: { | ||
172 | + placeholder: '请选择操作', | ||
173 | + options: [ | ||
174 | + { label: '等于', value: 'EQUAL' }, | ||
175 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
176 | + { label: '大于', value: 'GREATER' }, | ||
177 | + { label: '小于', value: 'LESS' }, | ||
178 | + { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
179 | + { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
180 | + ], | ||
181 | + }, | ||
182 | + ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), | ||
183 | + }, | ||
184 | + { | ||
185 | + field: 'value1', | ||
186 | + label: '默认值', | ||
187 | + colProps: { span: 24 }, | ||
188 | + component: 'Input', | ||
189 | + componentProps: { | ||
190 | + placeholder: '请输入默认值(数字)', | ||
191 | + }, | ||
192 | + }, | ||
96 | ]; | 193 | ]; |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | <KeyValueModal @register="registerModal" @success="handleSuccess" /> | 41 | <KeyValueModal @register="registerModal" @success="handleSuccess" /> |
42 | </template> | 42 | </template> |
43 | <script lang="ts"> | 43 | <script lang="ts"> |
44 | - import { defineComponent, ref, computed, unref, onMounted } from 'vue'; | 44 | + import { defineComponent, ref, computed, unref } from 'vue'; |
45 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 45 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
46 | import { BasicForm, useForm } from '/@/components/Form'; | 46 | import { BasicForm, useForm } from '/@/components/Form'; |
47 | import { formSchema, columns, DescDetailSchema, columnsView } from './config'; | 47 | import { formSchema, columns, DescDetailSchema, columnsView } from './config'; |
@@ -60,11 +60,12 @@ | @@ -60,11 +60,12 @@ | ||
60 | BasicTable, | 60 | BasicTable, |
61 | TableAction, | 61 | TableAction, |
62 | }, | 62 | }, |
63 | - emits: ['success', 'register', 'getAllFieldsRule'], | 63 | + emits: ['success', 'register', 'getAllFieldsRule', 'getLastAllFieldsRule'], |
64 | setup(_, { emit }) { | 64 | setup(_, { emit }) { |
65 | const getTableApiData: any = ref([]); | 65 | const getTableApiData: any = ref([]); |
66 | const detailData: any = ref([]); | 66 | const detailData: any = ref([]); |
67 | const receiveData: any = ref(null); | 67 | const receiveData: any = ref(null); |
68 | + const lastValues: any = ref(null); | ||
68 | const isUpdate = ref(true); | 69 | const isUpdate = ref(true); |
69 | const [registerForm, { getFieldsValue }] = useForm({ | 70 | const [registerForm, { getFieldsValue }] = useForm({ |
70 | labelWidth: 120, | 71 | labelWidth: 120, |
@@ -90,13 +91,12 @@ | @@ -90,13 +91,12 @@ | ||
90 | 91 | ||
91 | const handleSubmit = () => { | 92 | const handleSubmit = () => { |
92 | if (unref(isUpdate.value)) { | 93 | if (unref(isUpdate.value)) { |
93 | - console.log(1); | ||
94 | const values = getFieldsValue(); | 94 | const values = getFieldsValue(); |
95 | getTableApiData.value.push(values); | 95 | getTableApiData.value.push(values); |
96 | detailData.value.push(values); | 96 | detailData.value.push(values); |
97 | } | 97 | } |
98 | - // const values = getFieldsValue(); | ||
99 | - emit('getAllFieldsRule', receiveData.value); | 98 | + lastValues.value = getFieldsValue(); |
99 | + emit('getAllFieldsRule', receiveData.value, lastValues.value); | ||
100 | closeModal(); | 100 | closeModal(); |
101 | }; | 101 | }; |
102 | const handleAddKey = () => { | 102 | const handleAddKey = () => { |
@@ -118,7 +118,6 @@ | @@ -118,7 +118,6 @@ | ||
118 | }; | 118 | }; |
119 | const handleSuccess = (v) => { | 119 | const handleSuccess = (v) => { |
120 | receiveData.value = v; | 120 | receiveData.value = v; |
121 | - console.log(receiveData.value); | ||
122 | setTimeout(() => { | 121 | setTimeout(() => { |
123 | doFunc(); | 122 | doFunc(); |
124 | }, 10); | 123 | }, 10); |
@@ -127,9 +126,6 @@ | @@ -127,9 +126,6 @@ | ||
127 | getTableApiData.value.push(receiveData.value); | 126 | getTableApiData.value.push(receiveData.value); |
128 | detailData.value.push(receiveData.value); | 127 | detailData.value.push(receiveData.value); |
129 | }; | 128 | }; |
130 | - onMounted(() => { | ||
131 | - console.log(1); | ||
132 | - }); | ||
133 | return { | 129 | return { |
134 | columnsView, | 130 | columnsView, |
135 | DescDetailSchema, | 131 | DescDetailSchema, |
@@ -308,6 +308,9 @@ export const formSchema: FormSchema[] = [ | @@ -308,6 +308,9 @@ export const formSchema: FormSchema[] = [ | ||
308 | colProps: { | 308 | colProps: { |
309 | span: 8, | 309 | span: 8, |
310 | }, | 310 | }, |
311 | + componentProps: { | ||
312 | + valueFormat: 'HH:mm:ss', | ||
313 | + }, | ||
311 | ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | 314 | ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), |
312 | }, | 315 | }, |
313 | { | 316 | { |
@@ -317,6 +320,9 @@ export const formSchema: FormSchema[] = [ | @@ -317,6 +320,9 @@ export const formSchema: FormSchema[] = [ | ||
317 | colProps: { | 320 | colProps: { |
318 | span: 8, | 321 | span: 8, |
319 | }, | 322 | }, |
323 | + componentProps: { | ||
324 | + valueFormat: 'HH:mm:ss', | ||
325 | + }, | ||
320 | ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | 326 | ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), |
321 | }, | 327 | }, |
322 | ]; | 328 | ]; |
1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
2 | -import { findDictItemByCode } from '/@/api/system/dict'; | ||
3 | // import { getOrganizationList } from '/@/api/system/system'; | 2 | // import { getOrganizationList } from '/@/api/system/system'; |
4 | // import { copyTransFun } from '/@/utils/fnUtils'; | 3 | // import { copyTransFun } from '/@/utils/fnUtils'; |
5 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | 4 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; |
6 | import { ref } from 'vue'; | 5 | import { ref } from 'vue'; |
6 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
7 | +import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; | ||
7 | 8 | ||
8 | export const step1Schemas: FormSchema[] = [ | 9 | export const step1Schemas: FormSchema[] = [ |
9 | { | 10 | { |
@@ -74,7 +75,6 @@ export const step2Schemas: FormSchema[] = [ | @@ -74,7 +75,6 @@ export const step2Schemas: FormSchema[] = [ | ||
74 | field: 'transportType', | 75 | field: 'transportType', |
75 | component: 'Select', | 76 | component: 'Select', |
76 | label: '传输方式', | 77 | label: '传输方式', |
77 | - defaultValue: 'COAP', | ||
78 | componentProps: { | 78 | componentProps: { |
79 | options: [ | 79 | options: [ |
80 | { label: 'MQTT', value: 'MQTT' }, | 80 | { label: 'MQTT', value: 'MQTT' }, |
@@ -184,3 +184,175 @@ export const dashboardFormScheme: FormSchema[] = [ | @@ -184,3 +184,175 @@ export const dashboardFormScheme: FormSchema[] = [ | ||
184 | }, | 184 | }, |
185 | }, | 185 | }, |
186 | ]; | 186 | ]; |
187 | + | ||
188 | +export const alertContactsSchemas: FormSchema[] = [ | ||
189 | + { | ||
190 | + field: 'alarmContactId', | ||
191 | + label: '告警通知联系人', | ||
192 | + component: 'ApiSelect', | ||
193 | + componentProps: { | ||
194 | + api: alarmContactGetPage, | ||
195 | + labelField: 'username', | ||
196 | + valueField: 'id', | ||
197 | + resultField: 'items', | ||
198 | + }, | ||
199 | + }, | ||
200 | + { | ||
201 | + field: 'messageMode', | ||
202 | + label: '告警通知方式', | ||
203 | + required: true, | ||
204 | + component: 'ApiSelect', | ||
205 | + componentProps: { | ||
206 | + api: findDictItemByCode, | ||
207 | + params: { | ||
208 | + dictCode: 'message_type', | ||
209 | + }, | ||
210 | + labelField: 'itemText', | ||
211 | + valueField: 'itemValue', | ||
212 | + }, | ||
213 | + }, | ||
214 | +]; | ||
215 | + | ||
216 | +export const echoFormSchema: FormSchema[] = [ | ||
217 | + { | ||
218 | + field: 'type', | ||
219 | + label: '键类型', | ||
220 | + colProps: { span: 24 }, | ||
221 | + component: 'Select', | ||
222 | + componentProps: { | ||
223 | + placeholder: '请选择键类型', | ||
224 | + options: [ | ||
225 | + { label: '属性', value: '属性' }, | ||
226 | + { label: 'Timeseries', value: 'TIME_SERIES' }, | ||
227 | + { label: '常量', value: '常量' }, | ||
228 | + ], | ||
229 | + }, | ||
230 | + }, | ||
231 | + { | ||
232 | + field: 'key', | ||
233 | + label: '键名', | ||
234 | + colProps: { span: 24 }, | ||
235 | + component: 'Select', | ||
236 | + componentProps: { | ||
237 | + placeholder: '请选择键名', | ||
238 | + options: [ | ||
239 | + { label: 'active', value: 'active' }, | ||
240 | + { label: 'inactivityAlarmTime', value: 'inactivityAlarmTime' }, | ||
241 | + { label: 'lastActivityTime', value: 'lastActivityTime' }, | ||
242 | + { label: 'lastConnectTime', value: 'lastConnectTime' }, | ||
243 | + { label: 'lastDisconnectTime', value: 'lastDisconnectTime' }, | ||
244 | + ], | ||
245 | + }, | ||
246 | + }, | ||
247 | + { | ||
248 | + field: 'key', | ||
249 | + label: '键名', | ||
250 | + colProps: { span: 24 }, | ||
251 | + component: 'Select', | ||
252 | + componentProps: { | ||
253 | + placeholder: '请选择键名', | ||
254 | + options: [ | ||
255 | + { label: 'CO2', value: 'CO2' }, | ||
256 | + { label: 'temp', value: 'temp' }, | ||
257 | + { label: 'wet', value: 'wet' }, | ||
258 | + ], | ||
259 | + }, | ||
260 | + }, | ||
261 | + { | ||
262 | + field: 'key', | ||
263 | + label: '键名', | ||
264 | + colProps: { span: 24 }, | ||
265 | + component: 'Input', | ||
266 | + componentProps: { | ||
267 | + placeholder: '请输入键名', | ||
268 | + }, | ||
269 | + }, | ||
270 | + { | ||
271 | + field: 'type1', | ||
272 | + label: '值类型', | ||
273 | + colProps: { span: 24 }, | ||
274 | + component: 'Select', | ||
275 | + componentProps: { | ||
276 | + placeholder: '请选择值类型', | ||
277 | + options: [ | ||
278 | + { label: '字符串', value: 'STRING' }, | ||
279 | + { label: '数字', value: 'NUMERIC' }, | ||
280 | + { label: '布尔值', value: 'BOOLEAN' }, | ||
281 | + { label: '日期时间', value: 'COMPLEX' }, | ||
282 | + ], | ||
283 | + }, | ||
284 | + }, | ||
285 | + { | ||
286 | + field: 'operation', | ||
287 | + label: '操作', | ||
288 | + colProps: { span: 24 }, | ||
289 | + component: 'Select', | ||
290 | + componentProps: { | ||
291 | + placeholder: '请选择操作', | ||
292 | + options: [ | ||
293 | + { label: '等于', value: 'EQUAL' }, | ||
294 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
295 | + { label: '开始于', value: 'STARTS_WITH' }, | ||
296 | + { label: '结束于', value: 'ENDS_WITH' }, | ||
297 | + { label: '包含', value: 'CONTAINS' }, | ||
298 | + { label: '不包含', value: 'NOT_CONTAINS' }, | ||
299 | + ], | ||
300 | + }, | ||
301 | + }, | ||
302 | + { | ||
303 | + field: 'operation', | ||
304 | + label: '操作', | ||
305 | + colProps: { span: 24 }, | ||
306 | + component: 'Select', | ||
307 | + componentProps: { | ||
308 | + placeholder: '请选择操作', | ||
309 | + options: [ | ||
310 | + { label: '等于', value: 'EQUAL' }, | ||
311 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
312 | + { label: '大于', value: 'GREATER' }, | ||
313 | + { label: '小于', value: 'LESS' }, | ||
314 | + { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
315 | + { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
316 | + ], | ||
317 | + }, | ||
318 | + }, | ||
319 | + { | ||
320 | + field: 'operation', | ||
321 | + label: '操作', | ||
322 | + colProps: { span: 24 }, | ||
323 | + component: 'Select', | ||
324 | + componentProps: { | ||
325 | + placeholder: '请选择操作', | ||
326 | + options: [ | ||
327 | + { label: '等于', value: 'EQUAL' }, | ||
328 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
329 | + ], | ||
330 | + }, | ||
331 | + }, | ||
332 | + { | ||
333 | + field: 'operation', | ||
334 | + label: '操作', | ||
335 | + colProps: { span: 24 }, | ||
336 | + component: 'Select', | ||
337 | + componentProps: { | ||
338 | + placeholder: '请选择操作', | ||
339 | + options: [ | ||
340 | + { label: '等于', value: 'EQUAL' }, | ||
341 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
342 | + { label: '大于', value: 'GREATER' }, | ||
343 | + { label: '小于', value: 'LESS' }, | ||
344 | + { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
345 | + { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
346 | + ], | ||
347 | + }, | ||
348 | + }, | ||
349 | + { | ||
350 | + field: 'value1', | ||
351 | + label: '默认值', | ||
352 | + colProps: { span: 24 }, | ||
353 | + component: 'Input', | ||
354 | + componentProps: { | ||
355 | + placeholder: '请输入默认值(数字)', | ||
356 | + }, | ||
357 | + }, | ||
358 | +]; |
1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | +import { transformTime } from '/@/hooks/web/useDateToLocaleString'; | ||
2 | 3 | ||
3 | export const columns: BasicColumn[] = [ | 4 | export const columns: BasicColumn[] = [ |
4 | { | 5 | { |
5 | title: '创建时间', | 6 | title: '创建时间', |
6 | dataIndex: 'createdTime', | 7 | dataIndex: 'createdTime', |
7 | width: 200, | 8 | width: 200, |
9 | + format: (_text: string, record: Recordable) => { | ||
10 | + return transformTime(record.createdTime); | ||
11 | + }, | ||
8 | }, | 12 | }, |
9 | { | 13 | { |
10 | title: '名称', | 14 | title: '名称', |
@@ -20,9 +24,23 @@ export const columns: BasicColumn[] = [ | @@ -20,9 +24,23 @@ export const columns: BasicColumn[] = [ | ||
20 | title: '默认', | 24 | title: '默认', |
21 | dataIndex: 'default', | 25 | dataIndex: 'default', |
22 | width: 200, | 26 | width: 200, |
27 | + format: (_text: string, record: Recordable) => { | ||
28 | + return record.default == false ? '否' : '是'; | ||
29 | + }, | ||
23 | }, | 30 | }, |
24 | ]; | 31 | ]; |
25 | 32 | ||
33 | +export const searchFormSchema: FormSchema[] = [ | ||
34 | + { | ||
35 | + field: 'textSearch', | ||
36 | + label: '租户配置名称', | ||
37 | + colProps: { span: 8 }, | ||
38 | + component: 'Input', | ||
39 | + componentProps: { | ||
40 | + placeholder: '请输入租户配置名称', | ||
41 | + }, | ||
42 | + }, | ||
43 | +]; | ||
26 | export const formSchema: FormSchema[] = [ | 44 | export const formSchema: FormSchema[] = [ |
27 | { | 45 | { |
28 | field: 'name', | 46 | field: 'name', |
1 | import { FormSchema } from '/@/components/Table'; | 1 | import { FormSchema } from '/@/components/Table'; |
2 | -import { numberRule } from '/@/utils/rules'; | 2 | +// import { numberRule } from '/@/utils/rules'; |
3 | 3 | ||
4 | export const formSchema: FormSchema[] = [ | 4 | export const formSchema: FormSchema[] = [ |
5 | { | 5 | { |
@@ -12,233 +12,233 @@ export const formSchema: FormSchema[] = [ | @@ -12,233 +12,233 @@ export const formSchema: FormSchema[] = [ | ||
12 | placeholder: '请选择类型', | 12 | placeholder: '请选择类型', |
13 | options: [{ label: '默认', value: 'DEFAULT' }], | 13 | options: [{ label: '默认', value: 'DEFAULT' }], |
14 | }, | 14 | }, |
15 | - rules: numberRule, | ||
16 | }, | 15 | }, |
17 | { | 16 | { |
18 | field: 'maxDevices', | 17 | field: 'maxDevices', |
18 | + required: true, | ||
19 | + | ||
19 | label: '最大设备数(0-无限制)', | 20 | label: '最大设备数(0-无限制)', |
20 | component: 'Input', | 21 | component: 'Input', |
21 | colProps: { span: 24 }, | 22 | colProps: { span: 24 }, |
22 | componentProps: { | 23 | componentProps: { |
23 | - placeholder: '请输入最大设备数', | 24 | + placeholder: '请输入最大设备数(请输入数字)', |
24 | }, | 25 | }, |
25 | - rules: numberRule, | ||
26 | }, | 26 | }, |
27 | { | 27 | { |
28 | field: 'maxAssets', | 28 | field: 'maxAssets', |
29 | + required: true, | ||
30 | + | ||
29 | label: '最大资产数(0-无限制)', | 31 | label: '最大资产数(0-无限制)', |
30 | colProps: { span: 24 }, | 32 | colProps: { span: 24 }, |
31 | component: 'Input', | 33 | component: 'Input', |
32 | - rules: numberRule, | ||
33 | - | ||
34 | componentProps: { | 34 | componentProps: { |
35 | - placeholder: '请输入最大资产', | 35 | + placeholder: '请输入最大资产(请输入数字)', |
36 | }, | 36 | }, |
37 | }, | 37 | }, |
38 | { | 38 | { |
39 | field: 'maxCustomers', | 39 | field: 'maxCustomers', |
40 | + required: true, | ||
41 | + | ||
40 | label: '最大客户数(0-无限制)', | 42 | label: '最大客户数(0-无限制)', |
41 | colProps: { span: 24 }, | 43 | colProps: { span: 24 }, |
42 | component: 'Input', | 44 | component: 'Input', |
43 | - rules: numberRule, | ||
44 | - | ||
45 | componentProps: { | 45 | componentProps: { |
46 | - placeholder: '请输入最大客户数', | 46 | + placeholder: '请输入最大客户数(请输入数字)', |
47 | }, | 47 | }, |
48 | }, | 48 | }, |
49 | { | 49 | { |
50 | field: 'maxUsers', | 50 | field: 'maxUsers', |
51 | + required: true, | ||
52 | + | ||
51 | label: '最大用户数(0-无限制)', | 53 | label: '最大用户数(0-无限制)', |
52 | colProps: { span: 24 }, | 54 | colProps: { span: 24 }, |
53 | component: 'Input', | 55 | component: 'Input', |
54 | - rules: numberRule, | ||
55 | - | ||
56 | componentProps: { | 56 | componentProps: { |
57 | - placeholder: '请输入最大用户数', | 57 | + placeholder: '请输入最大用户数(请输入数字)', |
58 | }, | 58 | }, |
59 | }, | 59 | }, |
60 | { | 60 | { |
61 | field: 'maxDashboards', | 61 | field: 'maxDashboards', |
62 | + required: true, | ||
63 | + | ||
62 | label: '仪表板的最大数量(0-无限制)', | 64 | label: '仪表板的最大数量(0-无限制)', |
63 | colProps: { span: 24 }, | 65 | colProps: { span: 24 }, |
64 | component: 'Input', | 66 | component: 'Input', |
65 | - rules: numberRule, | ||
66 | - | ||
67 | componentProps: { | 67 | componentProps: { |
68 | - placeholder: '请输入仪表板的最大数量', | 68 | + placeholder: '请输入仪表板的最大数量(请输入数字)', |
69 | }, | 69 | }, |
70 | }, | 70 | }, |
71 | { | 71 | { |
72 | field: 'maxRuleChains', | 72 | field: 'maxRuleChains', |
73 | + required: true, | ||
74 | + | ||
73 | label: '最大规则链数(0-无限制)', | 75 | label: '最大规则链数(0-无限制)', |
74 | colProps: { span: 24 }, | 76 | colProps: { span: 24 }, |
75 | component: 'Input', | 77 | component: 'Input', |
76 | - rules: numberRule, | ||
77 | - | ||
78 | componentProps: { | 78 | componentProps: { |
79 | - placeholder: '请输入最大规则链数', | 79 | + placeholder: '请输入最大规则链数(请输入数字)', |
80 | }, | 80 | }, |
81 | }, | 81 | }, |
82 | { | 82 | { |
83 | field: 'maxResourcesInBytes', | 83 | field: 'maxResourcesInBytes', |
84 | + required: true, | ||
85 | + | ||
84 | label: '以字节为单位的资源文件的最大总和(0-无限制)', | 86 | label: '以字节为单位的资源文件的最大总和(0-无限制)', |
85 | colProps: { span: 24 }, | 87 | colProps: { span: 24 }, |
86 | component: 'Input', | 88 | component: 'Input', |
87 | - rules: numberRule, | ||
88 | - | ||
89 | componentProps: { | 89 | componentProps: { |
90 | - placeholder: '请输入', | 90 | + placeholder: '请输入(请输入数字)', |
91 | }, | 91 | }, |
92 | }, | 92 | }, |
93 | { | 93 | { |
94 | field: 'maxOtaPackagesInBytes', | 94 | field: 'maxOtaPackagesInBytes', |
95 | + required: true, | ||
96 | + | ||
95 | label: 'Ota包文件大小的最大总和(字节)(0-无限制)', | 97 | label: 'Ota包文件大小的最大总和(字节)(0-无限制)', |
96 | colProps: { span: 24 }, | 98 | colProps: { span: 24 }, |
97 | component: 'Input', | 99 | component: 'Input', |
98 | - rules: numberRule, | ||
99 | - | ||
100 | componentProps: { | 100 | componentProps: { |
101 | - placeholder: '请输入', | 101 | + placeholder: '请输入(请输入数字)', |
102 | }, | 102 | }, |
103 | }, | 103 | }, |
104 | { | 104 | { |
105 | field: 'maxTransportMessages', | 105 | field: 'maxTransportMessages', |
106 | + required: true, | ||
107 | + | ||
106 | label: '最大传输消息数(0-无限制)', | 108 | label: '最大传输消息数(0-无限制)', |
107 | colProps: { span: 24 }, | 109 | colProps: { span: 24 }, |
108 | component: 'Input', | 110 | component: 'Input', |
109 | - rules: numberRule, | ||
110 | - | ||
111 | componentProps: { | 111 | componentProps: { |
112 | - placeholder: '请输入最大传输消息数', | 112 | + placeholder: '请输入最大传输消息数(请输入数字)', |
113 | }, | 113 | }, |
114 | }, | 114 | }, |
115 | { | 115 | { |
116 | field: 'maxTransportDataPoints', | 116 | field: 'maxTransportDataPoints', |
117 | + required: true, | ||
118 | + | ||
117 | label: '传输数据点的最大数量(0-无限制)', | 119 | label: '传输数据点的最大数量(0-无限制)', |
118 | colProps: { span: 24 }, | 120 | colProps: { span: 24 }, |
119 | component: 'Input', | 121 | component: 'Input', |
120 | - rules: numberRule, | ||
121 | - | ||
122 | componentProps: { | 122 | componentProps: { |
123 | - placeholder: '请输入传输数据点的最大数量', | 123 | + placeholder: '请输入传输数据点的最大数量(请输入数字)', |
124 | }, | 124 | }, |
125 | }, | 125 | }, |
126 | { | 126 | { |
127 | field: 'maxREExecutions', | 127 | field: 'maxREExecutions', |
128 | + required: true, | ||
129 | + | ||
128 | label: '最大规则引擎数(0-无限制)', | 130 | label: '最大规则引擎数(0-无限制)', |
129 | colProps: { span: 24 }, | 131 | colProps: { span: 24 }, |
130 | component: 'Input', | 132 | component: 'Input', |
131 | - rules: numberRule, | ||
132 | - | ||
133 | componentProps: { | 133 | componentProps: { |
134 | - placeholder: '请输入最大规则引擎数', | 134 | + placeholder: '请输入最大规则引擎数(请输入数字)', |
135 | }, | 135 | }, |
136 | }, | 136 | }, |
137 | 137 | ||
138 | { | 138 | { |
139 | field: 'maxJSExecutions', | 139 | field: 'maxJSExecutions', |
140 | + required: true, | ||
141 | + | ||
140 | label: '最大JavaScript执行数(0-不受限制)', | 142 | label: '最大JavaScript执行数(0-不受限制)', |
141 | colProps: { span: 24 }, | 143 | colProps: { span: 24 }, |
142 | component: 'Input', | 144 | component: 'Input', |
143 | - rules: numberRule, | ||
144 | - | ||
145 | componentProps: { | 145 | componentProps: { |
146 | - placeholder: '请输入最大JavaScript执行数', | 146 | + placeholder: '请输入最大JavaScript执行数(请输入数字)', |
147 | }, | 147 | }, |
148 | }, | 148 | }, |
149 | { | 149 | { |
150 | field: 'maxDPStorageDays', | 150 | field: 'maxDPStorageDays', |
151 | + required: true, | ||
152 | + | ||
151 | label: '最大日存储数据点数(0-无限制)', | 153 | label: '最大日存储数据点数(0-无限制)', |
152 | colProps: { span: 24 }, | 154 | colProps: { span: 24 }, |
153 | component: 'Input', | 155 | component: 'Input', |
154 | - rules: numberRule, | ||
155 | - | ||
156 | componentProps: { | 156 | componentProps: { |
157 | - placeholder: '请输入最大日存储数据点数', | 157 | + placeholder: '请输入最大日存储数据点数(请输入数字)', |
158 | }, | 158 | }, |
159 | }, | 159 | }, |
160 | { | 160 | { |
161 | field: 'defaultStorageTtlDays', | 161 | field: 'defaultStorageTtlDays', |
162 | + required: true, | ||
163 | + | ||
162 | label: '默认存储 TTL 天数(0-无限制)', | 164 | label: '默认存储 TTL 天数(0-无限制)', |
163 | colProps: { span: 24 }, | 165 | colProps: { span: 24 }, |
164 | component: 'Input', | 166 | component: 'Input', |
165 | - rules: numberRule, | ||
166 | - | ||
167 | componentProps: { | 167 | componentProps: { |
168 | - placeholder: '请输入默认存储 TTL 天数', | 168 | + placeholder: '请输入默认存储 TTL 天数(请输入数字)', |
169 | }, | 169 | }, |
170 | }, | 170 | }, |
171 | { | 171 | { |
172 | field: 'alarmsTtlDays', | 172 | field: 'alarmsTtlDays', |
173 | + required: true, | ||
174 | + | ||
173 | label: 'Alams TTL days(0-无限制)', | 175 | label: 'Alams TTL days(0-无限制)', |
174 | colProps: { span: 24 }, | 176 | colProps: { span: 24 }, |
175 | component: 'Input', | 177 | component: 'Input', |
176 | - rules: numberRule, | ||
177 | - | ||
178 | componentProps: { | 178 | componentProps: { |
179 | - placeholder: '请输入Alams TTL days', | 179 | + placeholder: '请输入Alams TTL days(请输入数字)', |
180 | }, | 180 | }, |
181 | }, | 181 | }, |
182 | { | 182 | { |
183 | field: 'rpcTtlDays', | 183 | field: 'rpcTtlDays', |
184 | + required: true, | ||
185 | + | ||
184 | label: 'RPC TTL days(0-无限制)', | 186 | label: 'RPC TTL days(0-无限制)', |
185 | colProps: { span: 24 }, | 187 | colProps: { span: 24 }, |
186 | component: 'Input', | 188 | component: 'Input', |
187 | - rules: numberRule, | ||
188 | - | ||
189 | componentProps: { | 189 | componentProps: { |
190 | - placeholder: '请输入RPC TTL days', | 190 | + placeholder: '请输入RPC TTL days(请输入数字)', |
191 | }, | 191 | }, |
192 | }, | 192 | }, |
193 | { | 193 | { |
194 | field: 'maxRuleNodeExecutionsPerMessage', | 194 | field: 'maxRuleNodeExecutionsPerMessage', |
195 | + required: true, | ||
196 | + | ||
195 | label: '每条消息的最大规则节点执行数(0-无限制)', | 197 | label: '每条消息的最大规则节点执行数(0-无限制)', |
196 | colProps: { span: 24 }, | 198 | colProps: { span: 24 }, |
197 | component: 'Input', | 199 | component: 'Input', |
198 | - rules: numberRule, | ||
199 | - | ||
200 | componentProps: { | 200 | componentProps: { |
201 | - placeholder: '请输入每条消息的最大规则节点执行数', | 201 | + placeholder: '请输入每条消息的最大规则节点执行数(请输入数字)', |
202 | }, | 202 | }, |
203 | }, | 203 | }, |
204 | { | 204 | { |
205 | field: 'maxEmails', | 205 | field: 'maxEmails', |
206 | + required: true, | ||
206 | label: '发送的最大电子邮件数(0-无限制)', | 207 | label: '发送的最大电子邮件数(0-无限制)', |
207 | colProps: { span: 24 }, | 208 | colProps: { span: 24 }, |
208 | component: 'Input', | 209 | component: 'Input', |
209 | - rules: numberRule, | ||
210 | - | ||
211 | componentProps: { | 210 | componentProps: { |
212 | - placeholder: '请输入发送的最大电子邮件数', | 211 | + placeholder: '请输入发送的最大电子邮件数(请输入数字)', |
213 | }, | 212 | }, |
214 | }, | 213 | }, |
215 | { | 214 | { |
216 | field: 'maxSms', | 215 | field: 'maxSms', |
216 | + required: true, | ||
217 | + | ||
217 | label: '发送的最大短信数(0-无限制)', | 218 | label: '发送的最大短信数(0-无限制)', |
218 | colProps: { span: 24 }, | 219 | colProps: { span: 24 }, |
219 | component: 'Input', | 220 | component: 'Input', |
220 | - rules: numberRule, | ||
221 | - | ||
222 | componentProps: { | 221 | componentProps: { |
223 | - placeholder: '请输入发送的最大短信数', | 222 | + placeholder: '请输入发送的最大短信数(请输入数字)', |
224 | }, | 223 | }, |
225 | }, | 224 | }, |
226 | { | 225 | { |
227 | field: 'maxCreatedAlarms', | 226 | field: 'maxCreatedAlarms', |
227 | + required: true, | ||
228 | + | ||
228 | label: '创建的最大报警数 (0 - 无限制)', | 229 | label: '创建的最大报警数 (0 - 无限制)', |
229 | colProps: { span: 24 }, | 230 | colProps: { span: 24 }, |
230 | component: 'Input', | 231 | component: 'Input', |
231 | - rules: numberRule, | ||
232 | componentProps: { | 232 | componentProps: { |
233 | - placeholder: '请输入maxCreatedAlarms', | 233 | + placeholder: '请输入maxCreatedAlarms(请输入数字)', |
234 | }, | 234 | }, |
235 | }, | 235 | }, |
236 | { | 236 | { |
237 | field: 'transportTenantMsgRateLimit', | 237 | field: 'transportTenantMsgRateLimit', |
238 | + | ||
238 | label: '传输租户消息速率限制', | 239 | label: '传输租户消息速率限制', |
239 | colProps: { span: 24 }, | 240 | colProps: { span: 24 }, |
240 | component: 'Input', | 241 | component: 'Input', |
241 | - | ||
242 | componentProps: { | 242 | componentProps: { |
243 | placeholder: '请输入传输租户消息速率限制', | 243 | placeholder: '请输入传输租户消息速率限制', |
244 | }, | 244 | }, |
@@ -248,7 +248,6 @@ export const formSchema: FormSchema[] = [ | @@ -248,7 +248,6 @@ export const formSchema: FormSchema[] = [ | ||
248 | label: '租户遥测消息速率限制', | 248 | label: '租户遥测消息速率限制', |
249 | colProps: { span: 24 }, | 249 | colProps: { span: 24 }, |
250 | component: 'Input', | 250 | component: 'Input', |
251 | - | ||
252 | componentProps: { | 251 | componentProps: { |
253 | placeholder: '请输入租户遥测消息速率限制', | 252 | placeholder: '请输入租户遥测消息速率限制', |
254 | }, | 253 | }, |
@@ -258,7 +257,6 @@ export const formSchema: FormSchema[] = [ | @@ -258,7 +257,6 @@ export const formSchema: FormSchema[] = [ | ||
258 | label: '租户遥测数据点速率限制', | 257 | label: '租户遥测数据点速率限制', |
259 | colProps: { span: 24 }, | 258 | colProps: { span: 24 }, |
260 | component: 'Input', | 259 | component: 'Input', |
261 | - | ||
262 | componentProps: { | 260 | componentProps: { |
263 | placeholder: '请输入租户遥测数据点速率限制', | 261 | placeholder: '请输入租户遥测数据点速率限制', |
264 | }, | 262 | }, |
@@ -268,7 +266,6 @@ export const formSchema: FormSchema[] = [ | @@ -268,7 +266,6 @@ export const formSchema: FormSchema[] = [ | ||
268 | label: '传输设备消息速率限制', | 266 | label: '传输设备消息速率限制', |
269 | colProps: { span: 24 }, | 267 | colProps: { span: 24 }, |
270 | component: 'Input', | 268 | component: 'Input', |
271 | - | ||
272 | componentProps: { | 269 | componentProps: { |
273 | placeholder: '请输入传输设备消息速率限制', | 270 | placeholder: '请输入传输设备消息速率限制', |
274 | }, | 271 | }, |
@@ -278,7 +275,6 @@ export const formSchema: FormSchema[] = [ | @@ -278,7 +275,6 @@ export const formSchema: FormSchema[] = [ | ||
278 | label: '设备遥测消息速率限制', | 275 | label: '设备遥测消息速率限制', |
279 | colProps: { span: 24 }, | 276 | colProps: { span: 24 }, |
280 | component: 'Input', | 277 | component: 'Input', |
281 | - | ||
282 | componentProps: { | 278 | componentProps: { |
283 | placeholder: '请输入设备遥测消息速率限制', | 279 | placeholder: '请输入设备遥测消息速率限制', |
284 | }, | 280 | }, |
1 | <template> | 1 | <template> |
2 | - <CollapseContainer title="配置设置"> | 2 | + <CollapseContainer title="租户配置设置"> |
3 | <BasicForm @register="registerForm" /> | 3 | <BasicForm @register="registerForm" /> |
4 | </CollapseContainer> | 4 | </CollapseContainer> |
5 | </template> | 5 | </template> |
@@ -15,11 +15,13 @@ | @@ -15,11 +15,13 @@ | ||
15 | emits: ['success', 'register', 'funcResetFields'], | 15 | emits: ['success', 'register', 'funcResetFields'], |
16 | setup() { | 16 | setup() { |
17 | const getValueData: any = ref({}); | 17 | const getValueData: any = ref({}); |
18 | - const [registerForm, { getFieldsValue, resetFields }] = useForm({ | 18 | + const [registerForm, { getFieldsValue, resetFields, setFieldsValue }] = useForm({ |
19 | schemas: formSchema, | 19 | schemas: formSchema, |
20 | showActionButtonGroup: false, | 20 | showActionButtonGroup: false, |
21 | }); | 21 | }); |
22 | - | 22 | + const setFieldsValueFunc = (v) => { |
23 | + setFieldsValue(v); | ||
24 | + }; | ||
23 | function getAllFields(getV) { | 25 | function getAllFields(getV) { |
24 | const values = getFieldsValue(); | 26 | const values = getFieldsValue(); |
25 | getValueData.value = values; | 27 | getValueData.value = values; |
@@ -30,6 +32,7 @@ | @@ -30,6 +32,7 @@ | ||
30 | resetFields(); | 32 | resetFields(); |
31 | } | 33 | } |
32 | return { | 34 | return { |
35 | + setFieldsValueFunc, | ||
33 | funcResetFields, | 36 | funcResetFields, |
34 | getAllFields, | 37 | getAllFields, |
35 | registerForm, | 38 | registerForm, |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <BasicTable | ||
4 | - :rowSelection="{ type: 'checkbox' }" | ||
5 | - @selection-change="useSelectionChange" | ||
6 | - @register="registerTable" | ||
7 | - > | 3 | + <BasicTable @register="registerTable"> |
8 | <template #toolbar> | 4 | <template #toolbar> |
9 | <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> | 5 | <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> |
10 | - <!-- <a-button type="error" @click="handleToolbarDel"> 删除 </a-button> --> | ||
11 | </template> | 6 | </template> |
12 | <template #action="{ record }"> | 7 | <template #action="{ record }"> |
13 | <TableAction | 8 | <TableAction |
@@ -42,7 +37,7 @@ | @@ -42,7 +37,7 @@ | ||
42 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 37 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
43 | import { useDrawer } from '/@/components/Drawer'; | 38 | import { useDrawer } from '/@/components/Drawer'; |
44 | import TenantSettingDrawer from './useDrawer.vue'; | 39 | import TenantSettingDrawer from './useDrawer.vue'; |
45 | - import { columns } from './config'; | 40 | + import { columns, searchFormSchema } from './config'; |
46 | import { useMessage } from '/@/hooks/web/useMessage'; | 41 | import { useMessage } from '/@/hooks/web/useMessage'; |
47 | import { getTableTenantProfileApi, deleteTenantProfileApi } from '/@/api/tenant/tenantApi'; | 42 | import { getTableTenantProfileApi, deleteTenantProfileApi } from '/@/api/tenant/tenantApi'; |
48 | 43 | ||
@@ -50,7 +45,6 @@ | @@ -50,7 +45,6 @@ | ||
50 | name: 'Index', | 45 | name: 'Index', |
51 | components: { BasicTable, TenantSettingDrawer, TableAction }, | 46 | components: { BasicTable, TenantSettingDrawer, TableAction }, |
52 | setup() { | 47 | setup() { |
53 | - // let selectedRowKeys: Array<string> = []; | ||
54 | let echoEditData = reactive({}); | 48 | let echoEditData = reactive({}); |
55 | const [registerDrawer, { openDrawer }] = useDrawer(); | 49 | const [registerDrawer, { openDrawer }] = useDrawer(); |
56 | const { createMessage } = useMessage(); | 50 | const { createMessage } = useMessage(); |
@@ -59,6 +53,10 @@ | @@ -59,6 +53,10 @@ | ||
59 | clickToRowSelect: false, | 53 | clickToRowSelect: false, |
60 | api: getTableTenantProfileApi, | 54 | api: getTableTenantProfileApi, |
61 | columns, | 55 | columns, |
56 | + formConfig: { | ||
57 | + labelWidth: 120, | ||
58 | + schemas: searchFormSchema, | ||
59 | + }, | ||
62 | useSearchForm: true, | 60 | useSearchForm: true, |
63 | showTableSetting: true, | 61 | showTableSetting: true, |
64 | bordered: true, | 62 | bordered: true, |
@@ -78,17 +76,6 @@ | @@ -78,17 +76,6 @@ | ||
78 | }); | 76 | }); |
79 | } | 77 | } |
80 | 78 | ||
81 | - const useSelectionChange = () => { | ||
82 | - console.log(1); | ||
83 | - // selectedRowKeys = getSelectRowKeys(); | ||
84 | - }; | ||
85 | - | ||
86 | - async function handleToolbarDel() { | ||
87 | - // await screenLinkPageDeleteApi(selectedRowKeys); | ||
88 | - // createMessage.success('删除成功'); | ||
89 | - reload(); | ||
90 | - } | ||
91 | - | ||
92 | function handleEdit(record: Recordable) { | 79 | function handleEdit(record: Recordable) { |
93 | openDrawer(true, { | 80 | openDrawer(true, { |
94 | record, | 81 | record, |
@@ -97,7 +84,8 @@ | @@ -97,7 +84,8 @@ | ||
97 | echoEditData = record; | 84 | echoEditData = record; |
98 | } | 85 | } |
99 | async function handleDelete(record: Recordable) { | 86 | async function handleDelete(record: Recordable) { |
100 | - let ids = record.id; | 87 | + let ids = record.id.id; |
88 | + console.log(record); | ||
101 | await deleteTenantProfileApi(ids); | 89 | await deleteTenantProfileApi(ids); |
102 | createMessage.success('删除成功'); | 90 | createMessage.success('删除成功'); |
103 | reload(); | 91 | reload(); |
@@ -106,12 +94,10 @@ | @@ -106,12 +94,10 @@ | ||
106 | reload(); | 94 | reload(); |
107 | } | 95 | } |
108 | return { | 96 | return { |
109 | - useSelectionChange, | ||
110 | echoEditData, | 97 | echoEditData, |
111 | registerTable, | 98 | registerTable, |
112 | registerDrawer, | 99 | registerDrawer, |
113 | handleAdd, | 100 | handleAdd, |
114 | - handleToolbarDel, | ||
115 | handleEdit, | 101 | handleEdit, |
116 | handleDelete, | 102 | handleDelete, |
117 | handleSuccess, | 103 | handleSuccess, |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | @ok="handleSubmit" | 9 | @ok="handleSubmit" |
10 | > | 10 | > |
11 | <BasicForm @register="registerForm" /> | 11 | <BasicForm @register="registerForm" /> |
12 | - <CpnsTenantSet ref="getChildData" /> | 12 | + <CpnsTenantSet ref="getChildData" :parentData="parentSetData" /> |
13 | </BasicDrawer> | 13 | </BasicDrawer> |
14 | </div> | 14 | </div> |
15 | </template> | 15 | </template> |
@@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
30 | const { createMessage } = useMessage(); | 30 | const { createMessage } = useMessage(); |
31 | const isUpdate = ref(true); | 31 | const isUpdate = ref(true); |
32 | let postAllData: any = reactive({}); | 32 | let postAllData: any = reactive({}); |
33 | + const parentSetData: any = ref(null); | ||
33 | let getValuesFormData: any = reactive({}); | 34 | let getValuesFormData: any = reactive({}); |
34 | const { proxy } = getCurrentInstance(); | 35 | const { proxy } = getCurrentInstance(); |
35 | const getChildData = ref(null); | 36 | const getChildData = ref(null); |
@@ -47,6 +48,8 @@ | @@ -47,6 +48,8 @@ | ||
47 | isUpdate.value = !!data?.isUpdate; | 48 | isUpdate.value = !!data?.isUpdate; |
48 | //编辑 | 49 | //编辑 |
49 | if (unref(isUpdate)) { | 50 | if (unref(isUpdate)) { |
51 | + parentSetData.value = { ...data.record.profileData.configuration }; | ||
52 | + proxy.$refs.getChildData.setFieldsValueFunc(parentSetData.value); | ||
50 | editGetId.value = data.record.id; | 53 | editGetId.value = data.record.id; |
51 | await setFieldsValue({ | 54 | await setFieldsValue({ |
52 | ...data.record, | 55 | ...data.record, |
@@ -56,25 +59,27 @@ | @@ -56,25 +59,27 @@ | ||
56 | const getTitle = computed(() => (!unref(isUpdate) ? '新增租户配置' : '编辑租户配置')); | 59 | const getTitle = computed(() => (!unref(isUpdate) ? '新增租户配置' : '编辑租户配置')); |
57 | 60 | ||
58 | async function handleSubmit() { | 61 | async function handleSubmit() { |
59 | - let res = validateFields(); | ||
60 | - if (!res) return; | ||
61 | - getValuesFormData = getFieldsValue(); | ||
62 | - let getChildValues = proxy.$refs.getChildData.getAllFields(); | ||
63 | - let profileData1 = { | ||
64 | - configuration: getChildValues, | ||
65 | - }; | ||
66 | - Object.assign( | ||
67 | - postAllData, | ||
68 | - { | ||
69 | - profileData: profileData1, | ||
70 | - }, | ||
71 | - getValuesFormData | ||
72 | - ); | ||
73 | - await saveTenantProfileApi(postAllData); | ||
74 | - createMessage.success('租户配置新增成功'); | ||
75 | - closeDrawer(); | ||
76 | - emit('success'); | ||
77 | - resetFields(); | 62 | + if (!unref(isUpdate)) { |
63 | + let res = validateFields(); | ||
64 | + if (!res) return; | ||
65 | + getValuesFormData = getFieldsValue(); | ||
66 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | ||
67 | + let profileData1 = { | ||
68 | + configuration: getChildValues, | ||
69 | + }; | ||
70 | + Object.assign( | ||
71 | + postAllData, | ||
72 | + { | ||
73 | + profileData: profileData1, | ||
74 | + }, | ||
75 | + getValuesFormData | ||
76 | + ); | ||
77 | + await saveTenantProfileApi(postAllData); | ||
78 | + createMessage.success('租户配置新增成功'); | ||
79 | + closeDrawer(); | ||
80 | + emit('success'); | ||
81 | + resetFields(); | ||
82 | + } | ||
78 | if (unref(isUpdate)) { | 83 | if (unref(isUpdate)) { |
79 | let res = validateFields(); | 84 | let res = validateFields(); |
80 | if (!res) return; | 85 | if (!res) return; |
@@ -98,6 +103,7 @@ | @@ -98,6 +103,7 @@ | ||
98 | } | 103 | } |
99 | } | 104 | } |
100 | return { | 105 | return { |
106 | + parentSetData, | ||
101 | getChildData, | 107 | getChildData, |
102 | registerDrawer, | 108 | registerDrawer, |
103 | registerForm, | 109 | registerForm, |