Showing
13 changed files
with
951 additions
and
25 deletions
| @@ -6,6 +6,7 @@ import { | @@ -6,6 +6,7 @@ import { | ||
| 6 | TenantPageRequestParams, | 6 | TenantPageRequestParams, |
| 7 | TenantRequestDTO, | 7 | TenantRequestDTO, |
| 8 | UserDTO, | 8 | UserDTO, |
| 9 | + tenantProfileDTO, | ||
| 9 | } from './tenantInfo'; | 10 | } from './tenantInfo'; |
| 10 | import { defHttp } from '/@/utils/http/axios'; | 11 | import { defHttp } from '/@/utils/http/axios'; |
| 11 | 12 | ||
| @@ -19,6 +20,14 @@ enum Api { | @@ -19,6 +20,14 @@ enum Api { | ||
| 19 | sendMessageOrEmail = '/tenant/sendRestPasswordMsg', | 20 | sendMessageOrEmail = '/tenant/sendRestPasswordMsg', |
| 20 | deleteTenantAdmin = '/admin/user/deleteTenantAdmin', | 21 | deleteTenantAdmin = '/admin/user/deleteTenantAdmin', |
| 21 | getTenantRoles = '/admin/tenant/roles/', | 22 | getTenantRoles = '/admin/tenant/roles/', |
| 23 | + postAddTenantProfile = '/tenantProfile', | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +export async function saveTenantProfileApi(params: tenantProfileDTO) { | ||
| 27 | + await defHttp.post({ | ||
| 28 | + params: params, | ||
| 29 | + url: Api.postAddTenantProfile, | ||
| 30 | + }); | ||
| 22 | } | 31 | } |
| 23 | 32 | ||
| 24 | export function getTenantPage(params: TenantPageRequestParams) { | 33 | export function getTenantPage(params: TenantPageRequestParams) { |
| @@ -43,6 +43,43 @@ export interface TenantAdminPageRequestParams extends BaseQueryParams { | @@ -43,6 +43,43 @@ export interface TenantAdminPageRequestParams extends BaseQueryParams { | ||
| 43 | tenantCode: string; | 43 | tenantCode: string; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | +export interface tenantProfileDTO { | ||
| 47 | + name?: string; | ||
| 48 | + isolatedTbCore?: boolean; | ||
| 49 | + isolatedTbRuleEngine?: boolean; | ||
| 50 | + profileData: { | ||
| 51 | + configuration: { | ||
| 52 | + maxDevices?: 1; | ||
| 53 | + maxAssets?: string; | ||
| 54 | + maxCustomers?: string; | ||
| 55 | + maxUsers?: string; | ||
| 56 | + maxDashboards?: string; | ||
| 57 | + maxRuleChains?: string; | ||
| 58 | + maxResourcesInBytes?: string; | ||
| 59 | + maxOtaPackagesInBytes?: string; | ||
| 60 | + transportTenantMsgRateLimit?: string; | ||
| 61 | + transportTenantTelemetryMsgRateLimit?: string; | ||
| 62 | + transportTenantTelemetryDataPointsRateLimit?: string; | ||
| 63 | + transportDeviceMsgRateLimit?: string; | ||
| 64 | + transportDeviceTelemetryMsgRateLimit?: string; | ||
| 65 | + transportDeviceTelemetryDataPointsRateLimit?: string; | ||
| 66 | + maxTransportMessages?: string; | ||
| 67 | + maxTransportDataPoints?: string; | ||
| 68 | + maxREExecutions?: string; | ||
| 69 | + maxJSExecutions?: string; | ||
| 70 | + maxDPStorageDays?: string; | ||
| 71 | + maxRuleNodeExecutionsPerMessage?: string; | ||
| 72 | + maxEmails?: string; | ||
| 73 | + maxSms?: string; | ||
| 74 | + maxCreatedAlarms?: string; | ||
| 75 | + defaultStorageTtlDays?: string; | ||
| 76 | + alarmsTtlDays?: string; | ||
| 77 | + rpcTtlDays?: string; | ||
| 78 | + type: 'DEFAULT'; | ||
| 79 | + }; | ||
| 80 | + }; | ||
| 81 | + description: null; | ||
| 82 | +} | ||
| 46 | export interface UserDTO { | 83 | export interface UserDTO { |
| 47 | id: string; | 84 | id: string; |
| 48 | username: string; | 85 | username: string; |
src/views/device/profile/cpns/config.ts
0 → 100644
| 1 | +import { FormSchema } from '/@/components/Form'; | ||
| 2 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
| 3 | + | ||
| 4 | +export const alertContactsSchemas: FormSchema[] = [ | ||
| 5 | + { | ||
| 6 | + field: 'alertType', | ||
| 7 | + label: '告警通知方式', | ||
| 8 | + required: true, | ||
| 9 | + component: 'ApiSelect', | ||
| 10 | + componentProps: { | ||
| 11 | + api: findDictItemByCode, | ||
| 12 | + params: { | ||
| 13 | + dictCode: 'message_type', | ||
| 14 | + }, | ||
| 15 | + labelField: 'itemText', | ||
| 16 | + valueField: 'itemValue', | ||
| 17 | + }, | ||
| 18 | + }, | ||
| 19 | +]; |
src/views/device/profile/cpns/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" /> | ||
| 3 | +</template> | ||
| 4 | +<script lang="ts"> | ||
| 5 | + import { defineComponent, ref } from 'vue'; | ||
| 6 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
| 7 | + import { alertContactsSchemas } from './config'; | ||
| 8 | + | ||
| 9 | + export default defineComponent({ | ||
| 10 | + components: { BasicForm }, | ||
| 11 | + setup() { | ||
| 12 | + const getValueData: any = ref({}); | ||
| 13 | + const [register, { setProps, getFieldsValue }] = useForm({ | ||
| 14 | + schemas: alertContactsSchemas, | ||
| 15 | + actionColOptions: { | ||
| 16 | + span: 24, | ||
| 17 | + }, | ||
| 18 | + }); | ||
| 19 | + function getAllFields(getV) { | ||
| 20 | + const values = getFieldsValue(); | ||
| 21 | + getValueData.value = values; | ||
| 22 | + getV = getValueData.value; | ||
| 23 | + return getV; | ||
| 24 | + } | ||
| 25 | + return { | ||
| 26 | + getAllFields, | ||
| 27 | + register, | ||
| 28 | + setProps, | ||
| 29 | + }; | ||
| 30 | + }, | ||
| 31 | + }); | ||
| 32 | +</script> |
| 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> |
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | </BasicForm> | 17 | </BasicForm> |
| 18 | </CollapseContainer> | 18 | </CollapseContainer> |
| 19 | <p>创建报警规则</p> | 19 | <p>创建报警规则</p> |
| 20 | - <template v-for="(createItem, createIndex) in item.createRule" :key="createItem.id"> | 20 | + <template v-for="(childItem, createIndex) in item.createRule" :key="childItem.id"> |
| 21 | <div class="aic mb-4" style="border: 1px solid #bfbfbf"> | 21 | <div class="aic mb-4" style="border: 1px solid #bfbfbf"> |
| 22 | <div class="w-3/4"> | 22 | <div class="w-3/4"> |
| 23 | <BasicForm @register="registerFormCreateAlarm" /> | 23 | <BasicForm @register="registerFormCreateAlarm" /> |
| @@ -59,7 +59,29 @@ | @@ -59,7 +59,29 @@ | ||
| 59 | <div class="flex justify-start"> | 59 | <div class="flex justify-start"> |
| 60 | <a-button class="mr-5" @click="prevStep">上一步</a-button> | 60 | <a-button class="mr-5" @click="prevStep">上一步</a-button> |
| 61 | <a-button type="primary" @click="addAlarmRule">添加报警规则</a-button> | 61 | <a-button type="primary" @click="addAlarmRule">添加报警规则</a-button> |
| 62 | + <a-button style="margin-left: 14px" @click="handleClickAddAlertContacts">下一步</a-button> | ||
| 62 | </div> | 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> | ||
| 63 | </div> | 85 | </div> |
| 64 | </template> | 86 | </template> |
| 65 | 87 | ||
| @@ -75,9 +97,11 @@ | @@ -75,9 +97,11 @@ | ||
| 75 | PlusCircleOutlined, | 97 | PlusCircleOutlined, |
| 76 | PlusOutlined, | 98 | PlusOutlined, |
| 77 | EditOutlined, | 99 | EditOutlined, |
| 78 | - CloseOutlined, | ||
| 79 | } from '@ant-design/icons-vue'; | 100 | } from '@ant-design/icons-vue'; |
| 80 | - import { Tooltip, Checkbox } from 'ant-design-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 | + | ||
| 81 | export default defineComponent({ | 105 | export default defineComponent({ |
| 82 | components: { | 106 | components: { |
| 83 | BasicForm, | 107 | BasicForm, |
| @@ -87,14 +111,19 @@ | @@ -87,14 +111,19 @@ | ||
| 87 | PlusCircleOutlined, | 111 | PlusCircleOutlined, |
| 88 | PlusOutlined, | 112 | PlusOutlined, |
| 89 | EditOutlined, | 113 | EditOutlined, |
| 90 | - CloseOutlined, | ||
| 91 | Checkbox, | 114 | Checkbox, |
| 92 | Tooltip, | 115 | Tooltip, |
| 116 | + BasicModal, | ||
| 117 | + AlertContacts, | ||
| 118 | + Tag, | ||
| 93 | }, | 119 | }, |
| 94 | emits: ['prev'], | 120 | emits: ['prev'], |
| 95 | setup(_, { emit }) { | 121 | setup(_, { emit }) { |
| 96 | //告警列表 | 122 | //告警列表 |
| 97 | let alarmList = ref<alarmListItem[]>([]); | 123 | let alarmList = ref<alarmListItem[]>([]); |
| 124 | + const log = (e) => { | ||
| 125 | + console.log(e); | ||
| 126 | + }; | ||
| 98 | // 添加和删除告警配置 | 127 | // 添加和删除告警配置 |
| 99 | const deleteAlarmRule = (index: number) => { | 128 | const deleteAlarmRule = (index: number) => { |
| 100 | unref(alarmList).splice(index, 1); | 129 | unref(alarmList).splice(index, 1); |
| @@ -178,20 +207,32 @@ | @@ -178,20 +207,32 @@ | ||
| 178 | const deleteCondition = (index: number, createIndex: number) => { | 207 | const deleteCondition = (index: number, createIndex: number) => { |
| 179 | alarmList.value[index].createRule.splice(createIndex, 1); | 208 | alarmList.value[index].createRule.splice(createIndex, 1); |
| 180 | }; | 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 | + | ||
| 181 | return { | 221 | return { |
| 222 | + handleModal, | ||
| 223 | + log, | ||
| 224 | + statusModel, | ||
| 225 | + registerAlert, | ||
| 226 | + handleClickAddAlertContacts, | ||
| 182 | alarmList, | 227 | alarmList, |
| 183 | deleteAlarmRule, | 228 | deleteAlarmRule, |
| 184 | prevStep, | 229 | prevStep, |
| 185 | addAlarmRule, | 230 | addAlarmRule, |
| 186 | - | ||
| 187 | registerForm, | 231 | registerForm, |
| 188 | - | ||
| 189 | registerFormHighSetting, | 232 | registerFormHighSetting, |
| 190 | - | ||
| 191 | registerFormCreateAlarm, | 233 | registerFormCreateAlarm, |
| 192 | addCreateRole, | 234 | addCreateRole, |
| 193 | deleteCondition, | 235 | deleteCondition, |
| 194 | - | ||
| 195 | registerFormClearAlarm, | 236 | registerFormClearAlarm, |
| 196 | }; | 237 | }; |
| 197 | }, | 238 | }, |
| 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | +import { Tag } from 'ant-design-vue'; | ||
| 3 | +import { h } from 'vue'; | ||
| 2 | 4 | ||
| 3 | export const columns: BasicColumn[] = [ | 5 | export const columns: BasicColumn[] = [ |
| 4 | { | 6 | { |
| @@ -40,15 +42,22 @@ export const columns: BasicColumn[] = [ | @@ -40,15 +42,22 @@ export const columns: BasicColumn[] = [ | ||
| 40 | title: '阅读状态', | 42 | title: '阅读状态', |
| 41 | dataIndex: 'readStatus', | 43 | dataIndex: 'readStatus', |
| 42 | width: 200, | 44 | width: 200, |
| 43 | - format: (text: string, record: Recordable) => { | ||
| 44 | - return record.readStatus == 0 | ||
| 45 | - ? '未读' | ||
| 46 | - : record.type == 1 | ||
| 47 | - ? '已读' | ||
| 48 | - : record.type == 2 | ||
| 49 | - ? '其他' | ||
| 50 | - : '其他'; | 45 | + customRender: ({ record }) => { |
| 46 | + const status = record.readStatus; | ||
| 47 | + const enable = status == 0 ? '未读' : ~~status == 1 ? '已读' : '其他'; | ||
| 48 | + const color = enable == '未读' ? 'green' : enable == '已读' ? 'yellow' : 'red'; | ||
| 49 | + const text = enable == '未读' ? '未读' : enable == '已读' ? '已读' : '其他'; | ||
| 50 | + return h(Tag, { color: color }, () => text); | ||
| 51 | }, | 51 | }, |
| 52 | + // format: (text: string, record: Recordable) => { | ||
| 53 | + // return record.readStatus == 0 | ||
| 54 | + // ? '未读' | ||
| 55 | + // : record.type == 1 | ||
| 56 | + // ? '已读' | ||
| 57 | + // : record.type == 2 | ||
| 58 | + // ? '其他' | ||
| 59 | + // : '其他'; | ||
| 60 | + // }, | ||
| 52 | }, | 61 | }, |
| 53 | ]; | 62 | ]; |
| 54 | 63 |
| @@ -4,6 +4,7 @@ import { h, ref } from 'vue'; | @@ -4,6 +4,7 @@ import { h, ref } from 'vue'; | ||
| 4 | import { findDictItemByCode } from '/@/api/system/dict'; | 4 | import { findDictItemByCode } from '/@/api/system/dict'; |
| 5 | import { getOrganizationList } from '/@/api/system/system'; | 5 | import { getOrganizationList } from '/@/api/system/system'; |
| 6 | import { copyTransFun } from '/@/utils/fnUtils'; | 6 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 7 | +import { Tag } from 'ant-design-vue'; | ||
| 7 | 8 | ||
| 8 | export const selectAll = ref(null); | 9 | export const selectAll = ref(null); |
| 9 | export const selectOrg = ref(null); | 10 | export const selectOrg = ref(null); |
| @@ -51,9 +52,16 @@ export const columns: BasicColumn[] = [ | @@ -51,9 +52,16 @@ export const columns: BasicColumn[] = [ | ||
| 51 | title: '状态', | 52 | title: '状态', |
| 52 | dataIndex: 'status', | 53 | dataIndex: 'status', |
| 53 | width: 200, | 54 | width: 200, |
| 54 | - format: (_text: string, record: Recordable) => { | ||
| 55 | - return record.status; | 55 | + customRender: ({ record }) => { |
| 56 | + const status = record.status; | ||
| 57 | + const enable = status === '已发布' ? '已发布' : ~~status === '草稿' ? '草稿' : '其他'; | ||
| 58 | + const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; | ||
| 59 | + const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; | ||
| 60 | + return h(Tag, { color: color }, () => text); | ||
| 56 | }, | 61 | }, |
| 62 | + // format: (_text: string, record: Recordable) => { | ||
| 63 | + // return record.status; | ||
| 64 | + // }, | ||
| 57 | }, | 65 | }, |
| 58 | ]; | 66 | ]; |
| 59 | 67 |
src/views/tenant/setting/config.ts
0 → 100644
| 1 | +import { BasicColumn, FormSchema } from '/@/components/Table'; | ||
| 2 | + | ||
| 3 | +export const columns: BasicColumn[] = [ | ||
| 4 | + { | ||
| 5 | + title: '创建时间', | ||
| 6 | + dataIndex: 'createdTime', | ||
| 7 | + width: 200, | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + title: '名称', | ||
| 11 | + dataIndex: 'name', | ||
| 12 | + width: 200, | ||
| 13 | + }, | ||
| 14 | + { | ||
| 15 | + title: '说明', | ||
| 16 | + dataIndex: 'description', | ||
| 17 | + width: 120, | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + title: '默认', | ||
| 21 | + dataIndex: 'default', | ||
| 22 | + width: 200, | ||
| 23 | + }, | ||
| 24 | +]; | ||
| 25 | + | ||
| 26 | +export const formSchema: FormSchema[] = [ | ||
| 27 | + { | ||
| 28 | + field: 'name', | ||
| 29 | + label: '名称', | ||
| 30 | + colProps: { span: 24 }, | ||
| 31 | + required: true, | ||
| 32 | + component: 'Input', | ||
| 33 | + componentProps: { | ||
| 34 | + placeholder: '名称', | ||
| 35 | + }, | ||
| 36 | + }, | ||
| 37 | + { | ||
| 38 | + field: 'isolatedTbRuleEngine', | ||
| 39 | + label: '隔离板芯容器的加工', | ||
| 40 | + component: 'Checkbox', | ||
| 41 | + }, | ||
| 42 | + { | ||
| 43 | + field: 'isolatedTbCore', | ||
| 44 | + label: '在独立的ThinngsBoard规则引擎中处理', | ||
| 45 | + component: 'Checkbox', | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + field: 'description', | ||
| 49 | + label: '说明', | ||
| 50 | + colProps: { span: 24 }, | ||
| 51 | + component: 'InputTextArea', | ||
| 52 | + componentProps: { | ||
| 53 | + placeholder: '请输入说明', | ||
| 54 | + }, | ||
| 55 | + }, | ||
| 56 | +]; |
src/views/tenant/setting/cpns/config.ts
0 → 100644
| 1 | +import { FormSchema } from '/@/components/Table'; | ||
| 2 | + | ||
| 3 | +export const formSchema: FormSchema[] = [ | ||
| 4 | + { | ||
| 5 | + field: 'maxDevices', | ||
| 6 | + label: '最大设备数(0-无限制)', | ||
| 7 | + colProps: { span: 24 }, | ||
| 8 | + component: 'InputNumber', | ||
| 9 | + componentProps: { | ||
| 10 | + placeholder: '请输入最大设备数', | ||
| 11 | + }, | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + field: 'maxAssets', | ||
| 15 | + label: '最大资产数(0-无限制)', | ||
| 16 | + colProps: { span: 24 }, | ||
| 17 | + component: 'InputNumber', | ||
| 18 | + componentProps: { | ||
| 19 | + placeholder: '请输入最大资产', | ||
| 20 | + }, | ||
| 21 | + }, | ||
| 22 | + { | ||
| 23 | + field: 'maxCustomers', | ||
| 24 | + label: '最大客户数(0-无限制)', | ||
| 25 | + colProps: { span: 24 }, | ||
| 26 | + component: 'InputNumber', | ||
| 27 | + componentProps: { | ||
| 28 | + placeholder: '请输入最大客户数', | ||
| 29 | + }, | ||
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + field: 'maxUsers', | ||
| 33 | + label: '最大用户数(0-无限制)', | ||
| 34 | + colProps: { span: 24 }, | ||
| 35 | + component: 'InputNumber', | ||
| 36 | + componentProps: { | ||
| 37 | + placeholder: '请输入最大用户数', | ||
| 38 | + }, | ||
| 39 | + }, | ||
| 40 | + { | ||
| 41 | + field: 'maxDashboards', | ||
| 42 | + label: '仪表板的最大数量(0-无限制)', | ||
| 43 | + colProps: { span: 24 }, | ||
| 44 | + component: 'InputNumber', | ||
| 45 | + componentProps: { | ||
| 46 | + placeholder: '请输入仪表板的最大数量', | ||
| 47 | + }, | ||
| 48 | + }, | ||
| 49 | + { | ||
| 50 | + field: 'maxRuleChains', | ||
| 51 | + label: '最大规则链数(0-无限制)', | ||
| 52 | + colProps: { span: 24 }, | ||
| 53 | + component: 'InputNumber', | ||
| 54 | + componentProps: { | ||
| 55 | + placeholder: '请输入最大规则链数', | ||
| 56 | + }, | ||
| 57 | + }, | ||
| 58 | + { | ||
| 59 | + field: 'maxResourcesInBytes', | ||
| 60 | + label: 'Maximun sum of resource files in bytes(0-unlimited)', | ||
| 61 | + colProps: { span: 24 }, | ||
| 62 | + component: 'InputNumber', | ||
| 63 | + componentProps: { | ||
| 64 | + placeholder: '请输入', | ||
| 65 | + }, | ||
| 66 | + }, | ||
| 67 | + { | ||
| 68 | + field: 'maxOtaPackagesInBytes', | ||
| 69 | + label: 'Maximun sum of ota packages files size in bytes(0-unlimited)', | ||
| 70 | + colProps: { span: 24 }, | ||
| 71 | + component: 'InputNumber', | ||
| 72 | + componentProps: { | ||
| 73 | + placeholder: '请输入', | ||
| 74 | + }, | ||
| 75 | + }, | ||
| 76 | + { | ||
| 77 | + field: 'maxTransportMessages', | ||
| 78 | + label: '最大传输消息数(0-无限制)', | ||
| 79 | + colProps: { span: 24 }, | ||
| 80 | + component: 'InputNumber', | ||
| 81 | + componentProps: { | ||
| 82 | + placeholder: '请输入最大传输消息数', | ||
| 83 | + }, | ||
| 84 | + }, | ||
| 85 | + { | ||
| 86 | + field: 'maxTransportDataPoints', | ||
| 87 | + label: '传输数据点的最大数量(0-无限制)', | ||
| 88 | + colProps: { span: 24 }, | ||
| 89 | + component: 'InputNumber', | ||
| 90 | + componentProps: { | ||
| 91 | + placeholder: '请输入传输数据点的最大数量', | ||
| 92 | + }, | ||
| 93 | + }, | ||
| 94 | + { | ||
| 95 | + field: 'maxREExecutions', | ||
| 96 | + label: '最大规则引擎数(0-无限制)', | ||
| 97 | + colProps: { span: 24 }, | ||
| 98 | + component: 'InputNumber', | ||
| 99 | + componentProps: { | ||
| 100 | + placeholder: '请输入最大规则引擎数', | ||
| 101 | + }, | ||
| 102 | + }, | ||
| 103 | + | ||
| 104 | + { | ||
| 105 | + field: 'maxJSExecutions', | ||
| 106 | + label: '最大JavaScript执行数(0-不受限制)', | ||
| 107 | + colProps: { span: 24 }, | ||
| 108 | + component: 'InputNumber', | ||
| 109 | + componentProps: { | ||
| 110 | + placeholder: '请输入最大JavaScript执行数', | ||
| 111 | + }, | ||
| 112 | + }, | ||
| 113 | + { | ||
| 114 | + field: 'maxDPStorageDays', | ||
| 115 | + label: '最大日存储数据点数(0-无限制)', | ||
| 116 | + colProps: { span: 24 }, | ||
| 117 | + component: 'InputNumber', | ||
| 118 | + componentProps: { | ||
| 119 | + placeholder: '请输入最大日存储数据点数', | ||
| 120 | + }, | ||
| 121 | + }, | ||
| 122 | + { | ||
| 123 | + field: 'defaultStorageTtlDays', | ||
| 124 | + label: '默认存储 TTL 天数(0-无限制)', | ||
| 125 | + colProps: { span: 24 }, | ||
| 126 | + component: 'InputNumber', | ||
| 127 | + componentProps: { | ||
| 128 | + placeholder: '请输入默认存储 TTL 天数', | ||
| 129 | + }, | ||
| 130 | + }, | ||
| 131 | + { | ||
| 132 | + field: 'alarmsTtlDays', | ||
| 133 | + label: 'Alams TTL days(0-unlimaited)', | ||
| 134 | + colProps: { span: 24 }, | ||
| 135 | + component: 'InputNumber', | ||
| 136 | + componentProps: { | ||
| 137 | + placeholder: '请输入Alams TTL days', | ||
| 138 | + }, | ||
| 139 | + }, | ||
| 140 | + { | ||
| 141 | + field: 'rpcTtlDays', | ||
| 142 | + label: 'RPC TTL days(0-unlimaited)', | ||
| 143 | + colProps: { span: 24 }, | ||
| 144 | + component: 'InputNumber', | ||
| 145 | + componentProps: { | ||
| 146 | + placeholder: '请输入RPC TTL days', | ||
| 147 | + }, | ||
| 148 | + }, | ||
| 149 | + { | ||
| 150 | + field: 'maxRuleNodeExecutionsPerMessage', | ||
| 151 | + label: '每条消息的最大规则节点执行数(0-无限制)', | ||
| 152 | + colProps: { span: 24 }, | ||
| 153 | + component: 'InputNumber', | ||
| 154 | + componentProps: { | ||
| 155 | + placeholder: '请输入每条消息的最大规则节点执行数', | ||
| 156 | + }, | ||
| 157 | + }, | ||
| 158 | + { | ||
| 159 | + field: 'maxEmails', | ||
| 160 | + label: '发送的最大电子邮件数(0-无限制)', | ||
| 161 | + colProps: { span: 24 }, | ||
| 162 | + component: 'InputNumber', | ||
| 163 | + componentProps: { | ||
| 164 | + placeholder: '请输入发送的最大电子邮件数', | ||
| 165 | + }, | ||
| 166 | + }, | ||
| 167 | + { | ||
| 168 | + field: 'maxSms', | ||
| 169 | + label: '发送的最大短信数(0-无限制)', | ||
| 170 | + colProps: { span: 24 }, | ||
| 171 | + component: 'InputNumber', | ||
| 172 | + componentProps: { | ||
| 173 | + placeholder: '请输入发送的最大短信数', | ||
| 174 | + }, | ||
| 175 | + }, | ||
| 176 | + { | ||
| 177 | + field: 'maxCreatedAlarms', | ||
| 178 | + label: 'Maximum number of alarms created (0 - unlimited)', | ||
| 179 | + colProps: { span: 24 }, | ||
| 180 | + component: 'InputNumber', | ||
| 181 | + componentProps: { | ||
| 182 | + placeholder: '请输入maxCreatedAlarms', | ||
| 183 | + }, | ||
| 184 | + }, | ||
| 185 | + { | ||
| 186 | + field: 'transportTenantMsgRateLimit', | ||
| 187 | + label: '传输租户消息速率限制', | ||
| 188 | + colProps: { span: 24 }, | ||
| 189 | + component: 'Input', | ||
| 190 | + componentProps: { | ||
| 191 | + placeholder: '请输入传输租户消息速率限制', | ||
| 192 | + }, | ||
| 193 | + }, | ||
| 194 | + { | ||
| 195 | + field: 'transportTenantTelemetryMsgRateLimit', | ||
| 196 | + label: '租户遥测消息速率限制', | ||
| 197 | + colProps: { span: 24 }, | ||
| 198 | + component: 'Input', | ||
| 199 | + componentProps: { | ||
| 200 | + placeholder: '请输入租户遥测消息速率限制', | ||
| 201 | + }, | ||
| 202 | + }, | ||
| 203 | + { | ||
| 204 | + field: 'transportTenantTelemetryDataPointsRateLimit', | ||
| 205 | + label: '租户遥测数据点速率限制', | ||
| 206 | + colProps: { span: 24 }, | ||
| 207 | + component: 'Input', | ||
| 208 | + componentProps: { | ||
| 209 | + placeholder: '请输入租户遥测数据点速率限制', | ||
| 210 | + }, | ||
| 211 | + }, | ||
| 212 | + { | ||
| 213 | + field: 'transportDeviceMsgRateLimit', | ||
| 214 | + label: '传输设备消息速率限制', | ||
| 215 | + colProps: { span: 24 }, | ||
| 216 | + component: 'Input', | ||
| 217 | + componentProps: { | ||
| 218 | + placeholder: '请输入传输设备消息速率限制', | ||
| 219 | + }, | ||
| 220 | + }, | ||
| 221 | + { | ||
| 222 | + field: 'transportDeviceTelemetryMsgRateLimit', | ||
| 223 | + label: '设备遥测消息速率限制', | ||
| 224 | + colProps: { span: 24 }, | ||
| 225 | + component: 'Input', | ||
| 226 | + componentProps: { | ||
| 227 | + placeholder: '请输入设备遥测消息速率限制', | ||
| 228 | + }, | ||
| 229 | + }, | ||
| 230 | + { | ||
| 231 | + field: 'transportDeviceTelemetryDataPointsRateLimit', | ||
| 232 | + label: '设备遥测数据点速率限制', | ||
| 233 | + colProps: { span: 24 }, | ||
| 234 | + component: 'Input', | ||
| 235 | + componentProps: { | ||
| 236 | + placeholder: '请输入设备遥测数据点速率限制', | ||
| 237 | + }, | ||
| 238 | + }, | ||
| 239 | +]; |
src/views/tenant/setting/cpns/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <CollapseContainer title="配置设置"> | ||
| 3 | + <BasicForm @register="registerForm" /> | ||
| 4 | + </CollapseContainer> | ||
| 5 | +</template> | ||
| 6 | +<script lang="ts"> | ||
| 7 | + import { defineComponent, ref } from 'vue'; | ||
| 8 | + import { BasicForm, useForm } from '/@/components/Form'; | ||
| 9 | + import { formSchema } from './config'; | ||
| 10 | + import { CollapseContainer } from '/@/components/Container/index'; | ||
| 11 | + | ||
| 12 | + export default defineComponent({ | ||
| 13 | + name: 'index', | ||
| 14 | + components: { BasicForm, CollapseContainer }, | ||
| 15 | + emits: ['success', 'register'], | ||
| 16 | + setup() { | ||
| 17 | + const getValueData: any = ref({}); | ||
| 18 | + const [registerForm, { getFieldsValue }] = useForm({ | ||
| 19 | + schemas: formSchema, | ||
| 20 | + showActionButtonGroup: false, | ||
| 21 | + }); | ||
| 22 | + | ||
| 23 | + function getAllFields(getV) { | ||
| 24 | + const values = getFieldsValue(); | ||
| 25 | + getValueData.value = values; | ||
| 26 | + getV = getValueData.value; | ||
| 27 | + return getV; | ||
| 28 | + } | ||
| 29 | + return { | ||
| 30 | + getAllFields, | ||
| 31 | + registerForm, | ||
| 32 | + }; | ||
| 33 | + }, | ||
| 34 | + }); | ||
| 35 | +</script> |
| 1 | <template> | 1 | <template> |
| 2 | - <div class="p-4"> tenant setting works </div> | 2 | + <div> |
| 3 | + <BasicTable | ||
| 4 | + :rowSelection="{ type: 'checkbox' }" | ||
| 5 | + @selection-change="useSelectionChange" | ||
| 6 | + @register="registerTable" | ||
| 7 | + > | ||
| 8 | + <template #toolbar> | ||
| 9 | + <a-button type="primary" @click="handleAdd"> 新增租户配置 </a-button> | ||
| 10 | + <a-button type="error" @click="handleToolbarDel"> 删除 </a-button> | ||
| 11 | + </template> | ||
| 12 | + <template #action="{ record }"> | ||
| 13 | + <TableAction | ||
| 14 | + :actions="[ | ||
| 15 | + { | ||
| 16 | + label: '编辑', | ||
| 17 | + icon: 'clarity:note-edit-line', | ||
| 18 | + onClick: handleEdit.bind(null, record), | ||
| 19 | + }, | ||
| 20 | + { | ||
| 21 | + label: '删除', | ||
| 22 | + icon: 'ant-design:delete-outlined', | ||
| 23 | + color: 'error', | ||
| 24 | + popConfirm: { | ||
| 25 | + title: '是否确认删除', | ||
| 26 | + confirm: handleDelete.bind(null, record), | ||
| 27 | + }, | ||
| 28 | + }, | ||
| 29 | + ]" | ||
| 30 | + /> | ||
| 31 | + </template> | ||
| 32 | + </BasicTable> | ||
| 33 | + <SceneLinkAgeDrawer | ||
| 34 | + :getChildrenData="echoEditData" | ||
| 35 | + @register="registerDrawer" | ||
| 36 | + @success="handleSuccess" | ||
| 37 | + /> | ||
| 38 | + </div> | ||
| 3 | </template> | 39 | </template> |
| 4 | -<script lang="ts" setup> | ||
| 5 | - import { ref } from 'vue'; | ||
| 6 | - const loading = ref(true); | 40 | +<script lang="ts"> |
| 41 | + import { defineComponent, reactive } from 'vue'; | ||
| 42 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | ||
| 43 | + import { useDrawer } from '/@/components/Drawer'; | ||
| 44 | + import SceneLinkAgeDrawer from './useDrawer.vue'; | ||
| 45 | + import { columns } from './config'; | ||
| 46 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 47 | + import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; | ||
| 7 | 48 | ||
| 8 | - setTimeout(() => { | ||
| 9 | - loading.value = false; | ||
| 10 | - }, 1500); | 49 | + export default defineComponent({ |
| 50 | + name: 'index', | ||
| 51 | + components: { BasicTable, SceneLinkAgeDrawer, TableAction }, | ||
| 52 | + setup() { | ||
| 53 | + let selectedRowKeys: Array<string> = []; | ||
| 54 | + let echoEditData = reactive({}); | ||
| 55 | + const [registerDrawer, { openDrawer }] = useDrawer(); | ||
| 56 | + const { createMessage } = useMessage(); | ||
| 57 | + const [registerTable, { reload, getSelectRowKeys }] = useTable({ | ||
| 58 | + title: '', | ||
| 59 | + clickToRowSelect: false, | ||
| 60 | + api: screenLinkPageGetApi, | ||
| 61 | + columns, | ||
| 62 | + rowKey: 'id', | ||
| 63 | + useSearchForm: true, | ||
| 64 | + showTableSetting: true, | ||
| 65 | + bordered: true, | ||
| 66 | + showIndexColumn: false, | ||
| 67 | + actionColumn: { | ||
| 68 | + width: 180, | ||
| 69 | + title: '操作', | ||
| 70 | + dataIndex: 'action', | ||
| 71 | + slots: { customRender: 'action' }, | ||
| 72 | + fixed: undefined, | ||
| 73 | + }, | ||
| 74 | + }); | ||
| 75 | + | ||
| 76 | + function handleAdd() { | ||
| 77 | + openDrawer(true, { | ||
| 78 | + isUpdate: false, | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + const useSelectionChange = () => { | ||
| 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) { | ||
| 93 | + openDrawer(true, { | ||
| 94 | + record, | ||
| 95 | + isUpdate: true, | ||
| 96 | + }); | ||
| 97 | + echoEditData = record; | ||
| 98 | + } | ||
| 99 | + async function handleDelete(record: Recordable) { | ||
| 100 | + let ids = [record.id]; | ||
| 101 | + await screenLinkPageDeleteApi(ids); | ||
| 102 | + createMessage.success('删除成功'); | ||
| 103 | + reload(); | ||
| 104 | + } | ||
| 105 | + function handleSuccess() { | ||
| 106 | + reload(); | ||
| 107 | + } | ||
| 108 | + return { | ||
| 109 | + useSelectionChange, | ||
| 110 | + echoEditData, | ||
| 111 | + registerTable, | ||
| 112 | + registerDrawer, | ||
| 113 | + handleAdd, | ||
| 114 | + handleToolbarDel, | ||
| 115 | + handleEdit, | ||
| 116 | + handleDelete, | ||
| 117 | + handleSuccess, | ||
| 118 | + }; | ||
| 119 | + }, | ||
| 120 | + }); | ||
| 11 | </script> | 121 | </script> |
src/views/tenant/setting/useDrawer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div> | ||
| 3 | + <BasicDrawer | ||
| 4 | + v-bind="$attrs" | ||
| 5 | + @register="registerDrawer" | ||
| 6 | + showFooter | ||
| 7 | + :title="getTitle" | ||
| 8 | + width="500px" | ||
| 9 | + @ok="handleSubmit" | ||
| 10 | + > | ||
| 11 | + <BasicForm @register="registerForm" /> | ||
| 12 | + <CpnsTenantSet ref="getChildData" /> | ||
| 13 | + </BasicDrawer> | ||
| 14 | + </div> | ||
| 15 | +</template> | ||
| 16 | +<script lang="ts"> | ||
| 17 | + import { defineComponent, ref, computed, unref, getCurrentInstance, reactive } from 'vue'; | ||
| 18 | + import { BasicForm, useForm } from '/@/components/Form'; | ||
| 19 | + import { formSchema } from './config'; | ||
| 20 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
| 21 | + import CpnsTenantSet from './cpns/index.vue'; | ||
| 22 | + import { saveTenantProfileApi } from '/@/api/tenant/tenantApi'; | ||
| 23 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 24 | + | ||
| 25 | + export default defineComponent({ | ||
| 26 | + name: 'ConfigDrawer', | ||
| 27 | + components: { BasicDrawer, BasicForm, CpnsTenantSet }, | ||
| 28 | + emits: ['success', 'register'], | ||
| 29 | + setup() { | ||
| 30 | + const { createMessage } = useMessage(); | ||
| 31 | + const isUpdate = ref(true); | ||
| 32 | + let postAllData: any = reactive({}); | ||
| 33 | + let getValuesFormData: any = reactive({}); | ||
| 34 | + const { proxy } = getCurrentInstance(); | ||
| 35 | + const [registerForm, { validateFields, getFieldsValue, resetFields }] = useForm({ | ||
| 36 | + schemas: formSchema, | ||
| 37 | + showActionButtonGroup: false, | ||
| 38 | + }); | ||
| 39 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
| 40 | + await resetFields(); | ||
| 41 | + setDrawerProps({ confirmLoading: false }); | ||
| 42 | + isUpdate.value = !!data?.isUpdate; | ||
| 43 | + }); | ||
| 44 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增租户配置' : '编辑租户配置')); | ||
| 45 | + | ||
| 46 | + async function handleSubmit() { | ||
| 47 | + let res = validateFields(); | ||
| 48 | + if (!res) return; | ||
| 49 | + getValuesFormData = getFieldsValue(); | ||
| 50 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | ||
| 51 | + let profileData1 = { | ||
| 52 | + configuration: getChildValues, | ||
| 53 | + }; | ||
| 54 | + Object.assign( | ||
| 55 | + postAllData, | ||
| 56 | + { | ||
| 57 | + profileData: profileData1, | ||
| 58 | + }, | ||
| 59 | + getValuesFormData | ||
| 60 | + ); | ||
| 61 | + await saveTenantProfileApi(postAllData); | ||
| 62 | + createMessage.success('租户配置新增成功'); | ||
| 63 | + closeDrawer(); | ||
| 64 | + } | ||
| 65 | + return { | ||
| 66 | + registerDrawer, | ||
| 67 | + registerForm, | ||
| 68 | + getTitle, | ||
| 69 | + handleSubmit, | ||
| 70 | + }; | ||
| 71 | + }, | ||
| 72 | + }); | ||
| 73 | +</script> |