Showing
15 changed files
with
184 additions
and
190 deletions
| ... | ... | @@ -75,7 +75,7 @@ |
| 75 | 75 | </template> |
| 76 | 76 | |
| 77 | 77 | <script lang="ts"> |
| 78 | - import { defineComponent, reactive, h } from 'vue'; | |
| 78 | + import { defineComponent, reactive, h, nextTick } from 'vue'; | |
| 79 | 79 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 80 | 80 | import { PageWrapper } from '/@/components/Page'; |
| 81 | 81 | import { useDrawer } from '/@/components/Drawer'; |
| ... | ... | @@ -108,16 +108,7 @@ |
| 108 | 108 | const handleSuccess = () => { |
| 109 | 109 | reload(); |
| 110 | 110 | }; |
| 111 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 112 | - useBatchDelete(deleteAlarmConfig, handleSuccess); | |
| 113 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 114 | - // Demo:status为1的选择框禁用 | |
| 115 | - if (record.status === 1) { | |
| 116 | - return { disabled: true }; | |
| 117 | - } else { | |
| 118 | - return { disabled: false }; | |
| 119 | - } | |
| 120 | - }; | |
| 111 | + | |
| 121 | 112 | // 表格hooks |
| 122 | 113 | const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ |
| 123 | 114 | title: '告警配置列表', |
| ... | ... | @@ -139,7 +130,19 @@ |
| 139 | 130 | slots: { customRender: 'action' }, |
| 140 | 131 | fixed: 'right', |
| 141 | 132 | }, |
| 142 | - ...selectionOptions, | |
| 133 | + }); | |
| 134 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 135 | + useBatchDelete(deleteAlarmConfig, handleSuccess, setProps); | |
| 136 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 137 | + // Demo:status为1的选择框禁用 | |
| 138 | + if (record.status === 1) { | |
| 139 | + return { disabled: true }; | |
| 140 | + } else { | |
| 141 | + return { disabled: false }; | |
| 142 | + } | |
| 143 | + }; | |
| 144 | + nextTick(() => { | |
| 145 | + setProps(selectionOptions); | |
| 143 | 146 | }); |
| 144 | 147 | // 弹框 |
| 145 | 148 | const [registerDrawer, { openDrawer }] = useDrawer(); | ... | ... |
| ... | ... | @@ -6,12 +6,7 @@ |
| 6 | 6 | @select="handleSelect" |
| 7 | 7 | ref="organizationIdTreeRef" |
| 8 | 8 | /> |
| 9 | - <BasicTable | |
| 10 | - :clickToRowSelect="false" | |
| 11 | - @register="registerTable" | |
| 12 | - :searchInfo="searchInfo" | |
| 13 | - class="w-3/4 xl:w-4/5" | |
| 14 | - > | |
| 9 | + <BasicTable @register="registerTable" :searchInfo="searchInfo" class="w-3/4 xl:w-4/5"> | |
| 15 | 10 | <template #toolbar> |
| 16 | 11 | <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增告警联系人 </a-button> |
| 17 | 12 | <a-button |
| ... | ... | @@ -50,13 +45,13 @@ |
| 50 | 45 | </template> |
| 51 | 46 | |
| 52 | 47 | <script lang="ts"> |
| 53 | - import { defineComponent, reactive, ref, computed } from 'vue'; | |
| 48 | + import { defineComponent, reactive, nextTick } from 'vue'; | |
| 54 | 49 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 55 | 50 | import { PageWrapper } from '/@/components/Page'; |
| 56 | - import { useMessage } from '/@/hooks/web/useMessage'; | |
| 57 | 51 | import { useDrawer } from '/@/components/Drawer'; |
| 58 | 52 | import ContactDrawer from './ContactDrawer.vue'; |
| 59 | 53 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; |
| 54 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | |
| 60 | 55 | |
| 61 | 56 | import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; |
| 62 | 57 | import { searchFormSchema, columns } from './config.data'; |
| ... | ... | @@ -69,18 +64,13 @@ |
| 69 | 64 | ContactDrawer, |
| 70 | 65 | }, |
| 71 | 66 | setup() { |
| 72 | - let selectedRowIds = ref<string[]>([]); | |
| 73 | - const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | |
| 74 | - // 复选框事件 | |
| 75 | - const onSelectRowChange = (selectedRowKeys: string[]) => { | |
| 76 | - selectedRowIds.value = selectedRowKeys; | |
| 77 | - }; | |
| 78 | 67 | const searchInfo = reactive<Recordable>({}); |
| 79 | 68 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
| 80 | 69 | // 表格hooks |
| 81 | - const [registerTable, { reload }] = useTable({ | |
| 70 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 82 | 71 | title: '告警联系人列表', |
| 83 | 72 | api: getAlarmContact, |
| 73 | + clickToRowSelect: false, | |
| 84 | 74 | columns, |
| 85 | 75 | clickToRowSelect: false, |
| 86 | 76 | formConfig: { |
| ... | ... | @@ -91,10 +81,6 @@ |
| 91 | 81 | useSearchForm: true, |
| 92 | 82 | showTableSetting: true, |
| 93 | 83 | bordered: true, |
| 94 | - rowSelection: { | |
| 95 | - onChange: onSelectRowChange, | |
| 96 | - type: 'checkbox', | |
| 97 | - }, | |
| 98 | 84 | rowKey: 'id', |
| 99 | 85 | actionColumn: { |
| 100 | 86 | width: 200, |
| ... | ... | @@ -104,14 +90,20 @@ |
| 104 | 90 | fixed: 'right', |
| 105 | 91 | }, |
| 106 | 92 | }); |
| 93 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 94 | + deleteAlarmContact, | |
| 95 | + handleSuccess, | |
| 96 | + setProps | |
| 97 | + ); | |
| 98 | + nextTick(() => { | |
| 99 | + setProps(selectionOptions); | |
| 100 | + }); | |
| 107 | 101 | // 弹框 |
| 108 | 102 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 109 | - const { createMessage } = useMessage(); | |
| 110 | - | |
| 111 | 103 | // 刷新 |
| 112 | - const handleSuccess = () => { | |
| 104 | + function handleSuccess() { | |
| 113 | 105 | reload(); |
| 114 | - }; | |
| 106 | + } | |
| 115 | 107 | // 新增或编辑 |
| 116 | 108 | const handleCreateOrEdit = (record: Recordable | null) => { |
| 117 | 109 | if (record) { |
| ... | ... | @@ -125,24 +117,6 @@ |
| 125 | 117 | }); |
| 126 | 118 | } |
| 127 | 119 | }; |
| 128 | - // 删除或批量删除 | |
| 129 | - const handleDeleteOrBatchDelete = async (record: Recordable | null) => { | |
| 130 | - if (record) { | |
| 131 | - try { | |
| 132 | - await deleteAlarmContact([record.id]); | |
| 133 | - createMessage.success('删除联系人成功'); | |
| 134 | - handleSuccess(); | |
| 135 | - } catch (e) {} | |
| 136 | - } else { | |
| 137 | - try { | |
| 138 | - await deleteAlarmContact(selectedRowIds.value); | |
| 139 | - createMessage.success('批量删除联系人成功'); | |
| 140 | - selectedRowIds.value = []; | |
| 141 | - handleSuccess(); | |
| 142 | - } catch (e) {} | |
| 143 | - } | |
| 144 | - }; | |
| 145 | - | |
| 146 | 120 | // 树形选择器 |
| 147 | 121 | const handleSelect = (organizationId: string) => { |
| 148 | 122 | searchInfo.organizationId = organizationId; | ... | ... |
| ... | ... | @@ -60,10 +60,9 @@ |
| 60 | 60 | </template> |
| 61 | 61 | |
| 62 | 62 | <script lang="ts"> |
| 63 | - import { defineComponent, reactive, ref, computed } from 'vue'; | |
| 63 | + import { defineComponent, reactive, ref, nextTick } from 'vue'; | |
| 64 | 64 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 65 | 65 | import { PageWrapper } from '/@/components/Page'; |
| 66 | - import { useMessage } from '/@/hooks/web/useMessage'; | |
| 67 | 66 | import { useDrawer } from '/@/components/Drawer'; |
| 68 | 67 | import ContactDrawer from './ConfigurationCenterDrawer.vue'; |
| 69 | 68 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; |
| ... | ... | @@ -72,6 +71,8 @@ |
| 72 | 71 | getPage, |
| 73 | 72 | deleteConfigurationCenter, |
| 74 | 73 | } from '/@/api/configuration/center/configurationCenter'; |
| 74 | + import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | |
| 75 | + | |
| 75 | 76 | import { getAppEnvConfig } from '/@/utils/env'; |
| 76 | 77 | export default defineComponent({ |
| 77 | 78 | components: { |
| ... | ... | @@ -84,7 +85,6 @@ |
| 84 | 85 | setup() { |
| 85 | 86 | const { VITE_GLOB_CONFIGURATION } = getAppEnvConfig(); |
| 86 | 87 | let selectedRowIds = ref<string[]>([]); |
| 87 | - const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | |
| 88 | 88 | // 复选框事件 |
| 89 | 89 | const onSelectRowChange = (selectedRowKeys: string[]) => { |
| 90 | 90 | selectedRowIds.value = selectedRowKeys; |
| ... | ... | @@ -92,7 +92,7 @@ |
| 92 | 92 | const searchInfo = reactive<Recordable>({}); |
| 93 | 93 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
| 94 | 94 | // 表格hooks |
| 95 | - const [registerTable, { reload }] = useTable({ | |
| 95 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 96 | 96 | title: '组态中心列表', |
| 97 | 97 | api: getPage, |
| 98 | 98 | columns, |
| ... | ... | @@ -106,10 +106,6 @@ |
| 106 | 106 | useSearchForm: true, |
| 107 | 107 | showTableSetting: true, |
| 108 | 108 | bordered: true, |
| 109 | - rowSelection: { | |
| 110 | - onChange: onSelectRowChange, | |
| 111 | - type: 'checkbox', | |
| 112 | - }, | |
| 113 | 109 | rowKey: 'id', |
| 114 | 110 | actionColumn: { |
| 115 | 111 | width: 200, |
| ... | ... | @@ -119,14 +115,22 @@ |
| 119 | 115 | fixed: 'right', |
| 120 | 116 | }, |
| 121 | 117 | }); |
| 118 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 119 | + deleteConfigurationCenter, | |
| 120 | + handleSuccess, | |
| 121 | + setProps | |
| 122 | + ); | |
| 123 | + nextTick(() => { | |
| 124 | + setProps(selectionOptions); | |
| 125 | + }); | |
| 126 | + | |
| 122 | 127 | // 弹框 |
| 123 | 128 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 124 | - const { createMessage } = useMessage(); | |
| 125 | 129 | |
| 126 | 130 | // 刷新 |
| 127 | - const handleSuccess = () => { | |
| 131 | + function handleSuccess() { | |
| 128 | 132 | reload(); |
| 129 | - }; | |
| 133 | + } | |
| 130 | 134 | // 新增或编辑 |
| 131 | 135 | const handleCreateOrEdit = (record: Recordable | null) => { |
| 132 | 136 | if (record) { |
| ... | ... | @@ -140,24 +144,6 @@ |
| 140 | 144 | }); |
| 141 | 145 | } |
| 142 | 146 | }; |
| 143 | - // 删除或批量删除 | |
| 144 | - const handleDeleteOrBatchDelete = async (record: Recordable | null) => { | |
| 145 | - if (record) { | |
| 146 | - try { | |
| 147 | - await deleteConfigurationCenter([record.id]); | |
| 148 | - createMessage.success('删除组态成功'); | |
| 149 | - handleSuccess(); | |
| 150 | - } catch (e) {} | |
| 151 | - } else { | |
| 152 | - try { | |
| 153 | - await deleteConfigurationCenter(selectedRowIds.value); | |
| 154 | - createMessage.success('批量删除组态成功'); | |
| 155 | - selectedRowIds.value = []; | |
| 156 | - handleSuccess(); | |
| 157 | - } catch (e) {} | |
| 158 | - } | |
| 159 | - }; | |
| 160 | - | |
| 161 | 147 | // 树形选择器 |
| 162 | 148 | const handleSelect = (organizationId: string) => { |
| 163 | 149 | searchInfo.organizationId = organizationId; | ... | ... |
| ... | ... | @@ -146,7 +146,7 @@ |
| 146 | 146 | </div> |
| 147 | 147 | </template> |
| 148 | 148 | <script lang="ts"> |
| 149 | - import { defineComponent, reactive, unref } from 'vue'; | |
| 149 | + import { defineComponent, reactive, unref, nextTick } from 'vue'; | |
| 150 | 150 | import { DeviceState, DeviceTypeEnum } from '/@/api/device/model/deviceModel'; |
| 151 | 151 | import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table'; |
| 152 | 152 | import { columns, searchFormSchema } from './config/device.data'; |
| ... | ... | @@ -190,17 +190,6 @@ |
| 190 | 190 | Popover, |
| 191 | 191 | }, |
| 192 | 192 | setup(_) { |
| 193 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 194 | - useBatchDelete(deleteDevice, handleSuccess); | |
| 195 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 196 | - // Demo:status为1的选择框禁用 | |
| 197 | - if (record.customerId) { | |
| 198 | - return { disabled: true }; | |
| 199 | - } else { | |
| 200 | - return { disabled: false }; | |
| 201 | - } | |
| 202 | - }; | |
| 203 | - | |
| 204 | 193 | const { createMessage } = useMessage(); |
| 205 | 194 | const go = useGo(); |
| 206 | 195 | const searchInfo = reactive<Recordable>({}); |
| ... | ... | @@ -208,7 +197,7 @@ |
| 208 | 197 | const [registerModal, { openModal }] = useModal(); |
| 209 | 198 | const [registerCustomerModal, { openModal: openCustomerModal }] = useModal(); |
| 210 | 199 | const [registerDetailDrawer, { openDrawer }] = useDrawer(); |
| 211 | - const [registerTable, { reload, setSelectedRowKeys }] = useTable({ | |
| 200 | + const [registerTable, { reload, setSelectedRowKeys, setProps }] = useTable({ | |
| 212 | 201 | title: '设备列表', |
| 213 | 202 | api: devicePage, |
| 214 | 203 | columns, |
| ... | ... | @@ -230,7 +219,19 @@ |
| 230 | 219 | slots: { customRender: 'action' }, |
| 231 | 220 | fixed: 'right', |
| 232 | 221 | }, |
| 233 | - ...selectionOptions, | |
| 222 | + }); | |
| 223 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 224 | + useBatchDelete(deleteDevice, handleSuccess, setProps); | |
| 225 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 226 | + // Demo:status为1的选择框禁用 | |
| 227 | + if (record.customerId) { | |
| 228 | + return { disabled: true }; | |
| 229 | + } else { | |
| 230 | + return { disabled: false }; | |
| 231 | + } | |
| 232 | + }; | |
| 233 | + nextTick(() => { | |
| 234 | + setProps(selectionOptions); | |
| 234 | 235 | }); |
| 235 | 236 | |
| 236 | 237 | const userInfo: any = getAuthCache(USER_INFO_KEY); | ... | ... |
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | </div> |
| 46 | 46 | </template> |
| 47 | 47 | <script lang="ts"> |
| 48 | - import { defineComponent, h } from 'vue'; | |
| 48 | + import { defineComponent, h, nextTick } from 'vue'; | |
| 49 | 49 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 50 | 50 | import { messageConfigPage, deleteMessageConfig } from '/@/api/message/config'; |
| 51 | 51 | import { useDrawer } from '/@/components/Drawer'; |
| ... | ... | @@ -66,16 +66,7 @@ |
| 66 | 66 | function handleSuccess() { |
| 67 | 67 | reload(); |
| 68 | 68 | } |
| 69 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 70 | - useBatchDelete(deleteMessageConfig, handleSuccess); | |
| 71 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 72 | - // Demo:status为1的选择框禁用 | |
| 73 | - if (record.status === 1) { | |
| 74 | - return { disabled: true }; | |
| 75 | - } else { | |
| 76 | - return { disabled: false }; | |
| 77 | - } | |
| 78 | - }; | |
| 69 | + | |
| 79 | 70 | const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ |
| 80 | 71 | title: '消息配置列表', |
| 81 | 72 | api: messageConfigPage, |
| ... | ... | @@ -95,7 +86,19 @@ |
| 95 | 86 | slots: { customRender: 'action' }, |
| 96 | 87 | fixed: 'right', |
| 97 | 88 | }, |
| 98 | - ...selectionOptions, | |
| 89 | + }); | |
| 90 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 91 | + useBatchDelete(deleteMessageConfig, handleSuccess, setProps); | |
| 92 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 93 | + // Demo:status为1的选择框禁用 | |
| 94 | + if (record.status === 1) { | |
| 95 | + return { disabled: true }; | |
| 96 | + } else { | |
| 97 | + return { disabled: false }; | |
| 98 | + } | |
| 99 | + }; | |
| 100 | + nextTick(() => { | |
| 101 | + setProps(selectionOptions); | |
| 99 | 102 | }); |
| 100 | 103 | |
| 101 | 104 | function handleCreate() { | ... | ... |
| ... | ... | @@ -37,9 +37,8 @@ |
| 37 | 37 | </div> |
| 38 | 38 | </template> |
| 39 | 39 | <script lang="ts"> |
| 40 | - import { defineComponent } from 'vue'; | |
| 40 | + import { defineComponent, nextTick } from 'vue'; | |
| 41 | 41 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 42 | - import { useDrawerInner } from '/@/components/Drawer'; | |
| 43 | 42 | import { columns, searchFormSchema } from './email.data'; |
| 44 | 43 | import { mailLogPage, deleteMailLog } from '/@/api/message/records'; |
| 45 | 44 | import { useModal } from '/@/components/Modal'; |
| ... | ... | @@ -50,12 +49,7 @@ |
| 50 | 49 | components: { EmailDetail, BasicTable, TableAction }, |
| 51 | 50 | setup() { |
| 52 | 51 | const [registerModal, { openModal }] = useModal(); |
| 53 | - const { hasBatchDelete, selectionOptions, handleDeleteOrBatchDelete } = useBatchDelete( | |
| 54 | - deleteMailLog, | |
| 55 | - handleSuccess | |
| 56 | - ); | |
| 57 | - const [register] = useDrawerInner(() => {}); | |
| 58 | - const [registerTable, { reload }] = useTable({ | |
| 52 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 59 | 53 | title: '邮件发送列表', |
| 60 | 54 | api: mailLogPage, |
| 61 | 55 | columns, |
| ... | ... | @@ -75,7 +69,14 @@ |
| 75 | 69 | slots: { customRender: 'action' }, |
| 76 | 70 | fixed: 'right', |
| 77 | 71 | }, |
| 78 | - ...selectionOptions, | |
| 72 | + }); | |
| 73 | + const { hasBatchDelete, selectionOptions, handleDeleteOrBatchDelete } = useBatchDelete( | |
| 74 | + deleteMailLog, | |
| 75 | + handleSuccess, | |
| 76 | + setProps | |
| 77 | + ); | |
| 78 | + nextTick(() => { | |
| 79 | + setProps(selectionOptions); | |
| 79 | 80 | }); |
| 80 | 81 | |
| 81 | 82 | function handleCreate() {} |
| ... | ... | @@ -91,7 +92,6 @@ |
| 91 | 92 | } |
| 92 | 93 | |
| 93 | 94 | return { |
| 94 | - register, | |
| 95 | 95 | registerTable, |
| 96 | 96 | registerModal, |
| 97 | 97 | handleCreate, | ... | ... |
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | </div> |
| 37 | 37 | </template> |
| 38 | 38 | <script lang="ts"> |
| 39 | - import { defineComponent, h } from 'vue'; | |
| 39 | + import { defineComponent, h, nextTick } from 'vue'; | |
| 40 | 40 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 41 | 41 | import { columns, searchFormSchema } from './sms.data'; |
| 42 | 42 | import { Modal } from 'ant-design-vue'; |
| ... | ... | @@ -48,12 +48,7 @@ |
| 48 | 48 | name: 'SmsLog', |
| 49 | 49 | components: { BasicTable, TableAction }, |
| 50 | 50 | setup() { |
| 51 | - // 批量删除的hooks | |
| 52 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 53 | - deleteSmsLog, | |
| 54 | - handleSuccess | |
| 55 | - ); | |
| 56 | - const [registerTable, { reload }] = useTable({ | |
| 51 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 57 | 52 | title: '短信发送列表', |
| 58 | 53 | api: smsLogPage, |
| 59 | 54 | columns, |
| ... | ... | @@ -73,7 +68,14 @@ |
| 73 | 68 | slots: { customRender: 'action' }, |
| 74 | 69 | fixed: 'right', |
| 75 | 70 | }, |
| 76 | - ...selectionOptions, | |
| 71 | + }); | |
| 72 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 73 | + deleteSmsLog, | |
| 74 | + handleSuccess, | |
| 75 | + setProps | |
| 76 | + ); | |
| 77 | + nextTick(() => { | |
| 78 | + setProps(selectionOptions); | |
| 77 | 79 | }); |
| 78 | 80 | function handleQuery(record: Recordable) { |
| 79 | 81 | Modal.info({ | ... | ... |
| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | title: '是否确认删除', |
| 43 | 43 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
| 44 | 44 | }, |
| 45 | + ifShow: record.status == 0, | |
| 45 | 46 | }, |
| 46 | 47 | ]" |
| 47 | 48 | /> |
| ... | ... | @@ -53,7 +54,7 @@ |
| 53 | 54 | </div> |
| 54 | 55 | </template> |
| 55 | 56 | <script lang="ts"> |
| 56 | - import { defineComponent } from 'vue'; | |
| 57 | + import { defineComponent, nextTick } from 'vue'; | |
| 57 | 58 | import { BasicTable, TableAction, useTable } from '/@/components/Table'; |
| 58 | 59 | import { useDrawer } from '/@/components/Drawer'; |
| 59 | 60 | import TemplateDrawer from './TemplateDrawer.vue'; |
| ... | ... | @@ -81,16 +82,7 @@ |
| 81 | 82 | reload(); |
| 82 | 83 | } |
| 83 | 84 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 84 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 85 | - useBatchDelete(deleteMessageTemplate, handleSuccess); | |
| 86 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 87 | - // Demo:status为1的选择框禁用 | |
| 88 | - if (record.status === 1) { | |
| 89 | - return { disabled: true }; | |
| 90 | - } else { | |
| 91 | - return { disabled: false }; | |
| 92 | - } | |
| 93 | - }; | |
| 85 | + | |
| 94 | 86 | const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ |
| 95 | 87 | title: '消息模板列表', |
| 96 | 88 | api: messageTemplatePage, |
| ... | ... | @@ -110,7 +102,19 @@ |
| 110 | 102 | slots: { customRender: 'action' }, |
| 111 | 103 | fixed: 'right', |
| 112 | 104 | }, |
| 113 | - ...selectionOptions, | |
| 105 | + }); | |
| 106 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 107 | + useBatchDelete(deleteMessageTemplate, handleSuccess, setProps); | |
| 108 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 109 | + // Demo:status为1的选择框禁用 | |
| 110 | + if (record.status === 1) { | |
| 111 | + return { disabled: true }; | |
| 112 | + } else { | |
| 113 | + return { disabled: false }; | |
| 114 | + } | |
| 115 | + }; | |
| 116 | + nextTick(() => { | |
| 117 | + setProps(selectionOptions); | |
| 114 | 118 | }); |
| 115 | 119 | |
| 116 | 120 | function handleCreate() { | ... | ... |
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | </div> |
| 52 | 52 | </template> |
| 53 | 53 | <script lang="ts"> |
| 54 | - import { defineComponent, ref } from 'vue'; | |
| 54 | + import { defineComponent, ref, nextTick } from 'vue'; | |
| 55 | 55 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 56 | 56 | import { useDrawer } from '/@/components/Drawer'; |
| 57 | 57 | import NotifyManagerDrawer from './useDrawer.vue'; |
| ... | ... | @@ -72,12 +72,9 @@ |
| 72 | 72 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 73 | 73 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); |
| 74 | 74 | // 批量删除 |
| 75 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 76 | - notifyDeleteApi, | |
| 77 | - handleSuccess | |
| 78 | - ); | |
| 75 | + | |
| 79 | 76 | const NotifyManagerDrawerRef = ref(); |
| 80 | - const [registerTable, { reload }] = useTable({ | |
| 77 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 81 | 78 | title: '通知列表', |
| 82 | 79 | api: notifyGetTableApi, |
| 83 | 80 | columns, |
| ... | ... | @@ -96,7 +93,14 @@ |
| 96 | 93 | slots: { customRender: 'action' }, |
| 97 | 94 | fixed: 'right', |
| 98 | 95 | }, |
| 99 | - ...selectionOptions, | |
| 96 | + }); | |
| 97 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 98 | + notifyDeleteApi, | |
| 99 | + handleSuccess, | |
| 100 | + setProps | |
| 101 | + ); | |
| 102 | + nextTick(() => { | |
| 103 | + setProps(selectionOptions); | |
| 100 | 104 | }); |
| 101 | 105 | |
| 102 | 106 | function handleAdd() { | ... | ... |
| ... | ... | @@ -49,6 +49,7 @@ |
| 49 | 49 | </div> |
| 50 | 50 | </template> |
| 51 | 51 | <script lang="ts" setup> |
| 52 | + import { nextTick } from 'vue'; | |
| 52 | 53 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 53 | 54 | import { useDrawer } from '/@/components/Drawer'; |
| 54 | 55 | import { |
| ... | ... | @@ -64,17 +65,6 @@ |
| 64 | 65 | import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; |
| 65 | 66 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 66 | 67 | |
| 67 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 68 | - useBatchDelete(screenLinkPageDeleteApi, handleSuccess); | |
| 69 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 70 | - // Demo:status为1的选择框禁用 | |
| 71 | - if (record.status === 1) { | |
| 72 | - return { disabled: true }; | |
| 73 | - } else { | |
| 74 | - return { disabled: false }; | |
| 75 | - } | |
| 76 | - }; | |
| 77 | - | |
| 78 | 68 | const userInfo: any = getAuthCache(USER_INFO_KEY); |
| 79 | 69 | const userId = userInfo.userId; |
| 80 | 70 | |
| ... | ... | @@ -98,7 +88,19 @@ |
| 98 | 88 | slots: { customRender: 'action' }, |
| 99 | 89 | fixed: 'right', |
| 100 | 90 | }, |
| 101 | - ...selectionOptions, | |
| 91 | + }); | |
| 92 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 93 | + useBatchDelete(screenLinkPageDeleteApi, handleSuccess, setProps); | |
| 94 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 95 | + // Demo:status为1的选择框禁用 | |
| 96 | + if (record.status === 1) { | |
| 97 | + return { disabled: true }; | |
| 98 | + } else { | |
| 99 | + return { disabled: false }; | |
| 100 | + } | |
| 101 | + }; | |
| 102 | + nextTick(() => { | |
| 103 | + setProps(selectionOptions); | |
| 102 | 104 | }); |
| 103 | 105 | |
| 104 | 106 | function handleAdd() { | ... | ... |
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | </template> |
| 51 | 51 | |
| 52 | 52 | <script lang="ts" setup> |
| 53 | - import { ref } from 'vue'; | |
| 53 | + import { ref,nextTick } from 'vue'; | |
| 54 | 54 | import { Switch } from 'ant-design-vue'; |
| 55 | 55 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 56 | 56 | import { columns, searchFormSchema } from './config/config.data'; |
| ... | ... | @@ -66,16 +66,6 @@ |
| 66 | 66 | reload(); |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 70 | - useBatchDelete(deleteTransformApi, handleSuccess); | |
| 71 | - selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 72 | - // Demo:status为1的选择框禁用 | |
| 73 | - if (record.status === 1) { | |
| 74 | - return { disabled: true }; | |
| 75 | - } else { | |
| 76 | - return { disabled: false }; | |
| 77 | - } | |
| 78 | - }; | |
| 79 | 69 | const [registerTable, { reload, setProps, setSelectedRowKeys }] = useTable({ |
| 80 | 70 | api: getConvertApi, |
| 81 | 71 | title: '转换脚本列表', |
| ... | ... | @@ -97,7 +87,20 @@ |
| 97 | 87 | slots: { customRender: 'action' }, |
| 98 | 88 | fixed: 'right', |
| 99 | 89 | }, |
| 100 | - ...selectionOptions, | |
| 90 | + }); | |
| 91 | + | |
| 92 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = | |
| 93 | + useBatchDelete(deleteTransformApi, handleSuccess, setProps); | |
| 94 | + selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => { | |
| 95 | + // Demo:status为1的选择框禁用 | |
| 96 | + if (record.status === 1) { | |
| 97 | + return { disabled: true }; | |
| 98 | + } else { | |
| 99 | + return { disabled: false }; | |
| 100 | + } | |
| 101 | + }; | |
| 102 | + nextTick(() => { | |
| 103 | + setProps(selectionOptions); | |
| 101 | 104 | }); |
| 102 | 105 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 103 | 106 | ... | ... |
| ... | ... | @@ -73,7 +73,7 @@ |
| 73 | 73 | </div> |
| 74 | 74 | </template> |
| 75 | 75 | <script lang="ts"> |
| 76 | - import { defineComponent, reactive } from 'vue'; | |
| 76 | + import { defineComponent, reactive, nextTick } from 'vue'; | |
| 77 | 77 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 78 | 78 | import { deleteUser, getAccountList } from '/@/api/system/system'; |
| 79 | 79 | import { PageWrapper } from '/@/components/Page'; |
| ... | ... | @@ -89,14 +89,10 @@ |
| 89 | 89 | components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, |
| 90 | 90 | setup() { |
| 91 | 91 | const go = useGo(); |
| 92 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 93 | - deleteUser, | |
| 94 | - handleSuccess | |
| 95 | - ); | |
| 96 | 92 | const [registerModal, { openModal }] = useModal(); |
| 97 | 93 | let searchInfo = reactive<Recordable>({}); |
| 98 | 94 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
| 99 | - const [registerTable, { reload }] = useTable({ | |
| 95 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 100 | 96 | title: '账号列表', |
| 101 | 97 | api: getAccountList, |
| 102 | 98 | rowKey: 'id', |
| ... | ... | @@ -117,7 +113,14 @@ |
| 117 | 113 | dataIndex: 'action', |
| 118 | 114 | slots: { customRender: 'action' }, |
| 119 | 115 | }, |
| 120 | - ...selectionOptions, | |
| 116 | + }); | |
| 117 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 118 | + deleteUser, | |
| 119 | + handleSuccess, | |
| 120 | + setProps | |
| 121 | + ); | |
| 122 | + nextTick(() => { | |
| 123 | + setProps(selectionOptions); | |
| 121 | 124 | }); |
| 122 | 125 | |
| 123 | 126 | function handleCreate() { | ... | ... |
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | </div> |
| 44 | 44 | </template> |
| 45 | 45 | <script lang="ts"> |
| 46 | - import { defineComponent } from 'vue'; | |
| 46 | + import { defineComponent, nextTick } from 'vue'; | |
| 47 | 47 | |
| 48 | 48 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 49 | 49 | import { sysDictPage, deleteDict } from '/@/api/system/dict'; |
| ... | ... | @@ -63,11 +63,8 @@ |
| 63 | 63 | setup() { |
| 64 | 64 | const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); |
| 65 | 65 | const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); |
| 66 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 67 | - deleteDict, | |
| 68 | - handleSuccess | |
| 69 | - ); | |
| 70 | - const [registerTable, { reload }] = useTable({ | |
| 66 | + | |
| 67 | + const [registerTable, { reload, setProps }] = useTable({ | |
| 71 | 68 | title: '字典配置列表', |
| 72 | 69 | api: sysDictPage, |
| 73 | 70 | columns, |
| ... | ... | @@ -86,7 +83,14 @@ |
| 86 | 83 | slots: { customRender: 'action' }, |
| 87 | 84 | fixed: 'right', |
| 88 | 85 | }, |
| 89 | - ...selectionOptions, | |
| 86 | + }); | |
| 87 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 88 | + deleteDict, | |
| 89 | + handleSuccess, | |
| 90 | + setProps | |
| 91 | + ); | |
| 92 | + nextTick(() => { | |
| 93 | + setProps(selectionOptions); | |
| 90 | 94 | }); |
| 91 | 95 | |
| 92 | 96 | function handleCreate() { | ... | ... |
| ... | ... | @@ -50,11 +50,8 @@ |
| 50 | 50 | const [registerModal, { openDrawer }] = useDrawer(); |
| 51 | 51 | const { t } = useI18n(); //加载国际化 |
| 52 | 52 | const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); |
| 53 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 54 | - delOrganization, | |
| 55 | - handleSuccess | |
| 56 | - ); | |
| 57 | - const [registerTable, { reload, expandAll }] = useTable({ | |
| 53 | + | |
| 54 | + const [registerTable, { reload, expandAll, setProps }] = useTable({ | |
| 58 | 55 | title: t('routes.common.organization.toolOrganizationList'), |
| 59 | 56 | api: getOrganizationList, |
| 60 | 57 | columns, |
| ... | ... | @@ -73,7 +70,15 @@ |
| 73 | 70 | slots: { customRender: 'action' }, |
| 74 | 71 | fixed: 'right', |
| 75 | 72 | }, |
| 76 | - ...selectionOptions, | |
| 73 | + }); | |
| 74 | + | |
| 75 | + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | |
| 76 | + delOrganization, | |
| 77 | + handleSuccess, | |
| 78 | + setProps | |
| 79 | + ); | |
| 80 | + nextTick(() => { | |
| 81 | + setProps(selectionOptions); | |
| 77 | 82 | }); |
| 78 | 83 | /** |
| 79 | 84 | * 获得删除提示框的文字 | ... | ... |