Commit db8072d74d325357fefd9fccc9c4dada513f7f66
Merge branch 'fix/DEFECT-1560' into 'main_dev'
fix: 修改看板控制组件和teambition上DEFECT-1560 See merge request yunteng/thingskit-front!856
Showing
10 changed files
with
117 additions
and
76 deletions
| @@ -12,11 +12,11 @@ export const getDeviceProfile = (deviceType?: string) => { | @@ -12,11 +12,11 @@ export const getDeviceProfile = (deviceType?: string) => { | ||
| 12 | }; | 12 | }; | 
| 13 | 13 | ||
| 14 | // 获取历史数据 | 14 | // 获取历史数据 | 
| 15 | -export const getDeviceHistoryInfo = (params: Recordable, orderBy) => { | 15 | +export const getDeviceHistoryInfo = (params: Recordable, orderBy?: string) => { | 
| 16 | return defHttp.get<HistoryData>( | 16 | return defHttp.get<HistoryData>( | 
| 17 | { | 17 | { | 
| 18 | url: `/plugins/telemetry/DEVICE/${params.entityId}/values/timeseries`, | 18 | url: `/plugins/telemetry/DEVICE/${params.entityId}/values/timeseries`, | 
| 19 | - params: { ...params, entityId: null, orderBy }, | 19 | + params: { ...params, entityId: null, orderBy: orderBy || 'DESC' }, | 
| 20 | }, | 20 | }, | 
| 21 | { | 21 | { | 
| 22 | joinPrefix: false, | 22 | joinPrefix: false, | 
| @@ -52,6 +52,7 @@ export function useBatchDelete( | @@ -52,6 +52,7 @@ export function useBatchDelete( | ||
| 52 | if (record) { | 52 | if (record) { | 
| 53 | await deleteFn([record.id]); | 53 | await deleteFn([record.id]); | 
| 54 | createMessage.success('删除成功'); | 54 | createMessage.success('删除成功'); | 
| 55 | + selectedRowIds.value = []; | ||
| 55 | } else { | 56 | } else { | 
| 56 | await deleteFn(selectedRowIds.value); | 57 | await deleteFn(selectedRowIds.value); | 
| 57 | createMessage.success('批量删除成功'); | 58 | createMessage.success('批量删除成功'); | 
| @@ -116,7 +116,7 @@ | @@ -116,7 +116,7 @@ | ||
| 116 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 116 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 
| 117 | const [registerModal, { openModal }] = useModal(); | 117 | const [registerModal, { openModal }] = useModal(); | 
| 118 | // 表格hooks | 118 | // 表格hooks | 
| 119 | - const [registerTable, { reload, setProps }] = useTable({ | 119 | + const [registerTable, { reload, setProps, clearSelectedRowKeys }] = useTable({ | 
| 120 | title: '视频列表', | 120 | title: '视频列表', | 
| 121 | api: cameraPage, | 121 | api: cameraPage, | 
| 122 | columns, | 122 | columns, | 
| @@ -145,6 +145,7 @@ | @@ -145,6 +145,7 @@ | ||
| 145 | // 刷新 | 145 | // 刷新 | 
| 146 | const handleSuccess = () => { | 146 | const handleSuccess = () => { | 
| 147 | reload(); | 147 | reload(); | 
| 148 | + clearSelectedRowKeys(); | ||
| 148 | }; | 149 | }; | 
| 149 | const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | 150 | const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | 
| 150 | deleteCameraManage, | 151 | deleteCameraManage, | 
| @@ -7,7 +7,7 @@ import { JSONEditor } from '/@/components/CodeEditor'; | @@ -7,7 +7,7 @@ import { JSONEditor } from '/@/components/CodeEditor'; | ||
| 7 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | 7 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | 
| 8 | import { getModelServices } from '/@/api/device/modelOfMatter'; | 8 | import { getModelServices } from '/@/api/device/modelOfMatter'; | 
| 9 | import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel'; | 9 | import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel'; | 
| 10 | -import { toRaw, unref } from 'vue'; | 10 | +import { nextTick, toRaw, unref } from 'vue'; | 
| 11 | import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue'; | 11 | import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue'; | 
| 12 | import { CommandDeliveryWayEnum, ServiceCallTypeEnum } from '/@/enums/toolEnum'; | 12 | import { CommandDeliveryWayEnum, ServiceCallTypeEnum } from '/@/enums/toolEnum'; | 
| 13 | import { TaskTypeEnum } from '/@/views/task/center/config'; | 13 | import { TaskTypeEnum } from '/@/views/task/center/config'; | 
| @@ -246,8 +246,9 @@ export const step1Schemas: FormSchema[] = [ | @@ -246,8 +246,9 @@ export const step1Schemas: FormSchema[] = [ | ||
| 246 | required: true, | 246 | required: true, | 
| 247 | component: 'ApiSelect', | 247 | component: 'ApiSelect', | 
| 248 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, | 248 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, | 
| 249 | - componentProps: ({ formModel }) => { | 249 | + componentProps: ({ formModel, formActionType }) => { | 
| 250 | const { organizationId, transportType } = formModel; | 250 | const { organizationId, transportType } = formModel; | 
| 251 | + const { validateFields } = formActionType; | ||
| 251 | if (![organizationId, transportType].every(Boolean)) return {}; | 252 | if (![organizationId, transportType].every(Boolean)) return {}; | 
| 252 | return { | 253 | return { | 
| 253 | api: async (params: Recordable) => { | 254 | api: async (params: Recordable) => { | 
| @@ -266,6 +267,10 @@ export const step1Schemas: FormSchema[] = [ | @@ -266,6 +267,10 @@ export const step1Schemas: FormSchema[] = [ | ||
| 266 | }, | 267 | }, | 
| 267 | valueField: 'tbDeviceId', | 268 | valueField: 'tbDeviceId', | 
| 268 | labelField: 'alias', | 269 | labelField: 'alias', | 
| 270 | + onChange: async () => { | ||
| 271 | + await nextTick(); | ||
| 272 | + validateFields(['gatewayId']); | ||
| 273 | + }, | ||
| 269 | }; | 274 | }; | 
| 270 | }, | 275 | }, | 
| 271 | }, | 276 | }, | 
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | import { ColEx } from '/@/components/Form/src/types'; | 11 | import { ColEx } from '/@/components/Form/src/types'; | 
| 12 | import { useHistoryData } from '../../hook/useHistoryData'; | 12 | import { useHistoryData } from '../../hook/useHistoryData'; | 
| 13 | import { formatToDateTime } from '/@/utils/dateUtil'; | 13 | import { formatToDateTime } from '/@/utils/dateUtil'; | 
| 14 | - import { useTable, BasicTable } from '/@/components/Table'; | 14 | + import { useTable, BasicTable, BasicColumn } from '/@/components/Table'; | 
| 15 | import { DataTypeEnum } from '/@/components/Form/src/externalCompns/components/StructForm/config'; | 15 | import { DataTypeEnum } from '/@/components/Form/src/externalCompns/components/StructForm/config'; | 
| 16 | import { | 16 | import { | 
| 17 | ModeSwitchButton, | 17 | ModeSwitchButton, | 
| @@ -60,13 +60,9 @@ | @@ -60,13 +60,9 @@ | ||
| 60 | } | 60 | } | 
| 61 | } | 61 | } | 
| 62 | 62 | ||
| 63 | - const [registerTable] = useTable({ | ||
| 64 | - showIndexColumn: false, | ||
| 65 | - showTableSetting: false, | ||
| 66 | - dataSource: historyData, | ||
| 67 | - maxHeight: 300, | ||
| 68 | - size: 'small', | ||
| 69 | - columns: [ | 63 | + const sortOrder = ref<any>('descend'); | 
| 64 | + const columns: BasicColumn[] | any = computed(() => { | ||
| 65 | + return [ | ||
| 70 | { | 66 | { | 
| 71 | title: '属性', | 67 | title: '属性', | 
| 72 | dataIndex: 'name', | 68 | dataIndex: 'name', | 
| @@ -84,18 +80,50 @@ | @@ -84,18 +80,50 @@ | ||
| 84 | format: (val) => { | 80 | format: (val) => { | 
| 85 | return formatToDateTime(val, 'YYYY-MM-DD HH:mm:ss'); | 81 | return formatToDateTime(val, 'YYYY-MM-DD HH:mm:ss'); | 
| 86 | }, | 82 | }, | 
| 87 | - sorter: 'descend', | 83 | + sorter: true, | 
| 84 | + sortOrder: unref(sortOrder), | ||
| 85 | + sortDirections: ['descend', 'ascend', 'descend'], | ||
| 88 | }, | 86 | }, | 
| 89 | - ], | 87 | + ]; | 
| 88 | + }); | ||
| 89 | + | ||
| 90 | + const [registerTable, { setColumns }] = useTable({ | ||
| 91 | + showIndexColumn: false, | ||
| 92 | + showTableSetting: false, | ||
| 93 | + dataSource: historyData, | ||
| 94 | + maxHeight: 300, | ||
| 95 | + columns: unref(columns), | ||
| 96 | + size: 'small', | ||
| 90 | }); | 97 | }); | 
| 91 | 98 | ||
| 92 | - const handleTableChange = async (pag, filters, sorter: any) => { | ||
| 93 | - console.log(pag, filters, sorter, 'pag, filters, sorter'); | 99 | + const getTableList = async (orderBy?: string) => { | 
| 100 | + // 表单验证 | ||
| 101 | + await method.validate(); | ||
| 102 | + const value = method.getFieldsValue(); | ||
| 103 | + const searchParams = getSearchParams(value); | ||
| 104 | + | ||
| 105 | + if (!hasDeviceAttr()) return; | ||
| 106 | + // 发送请求 | ||
| 107 | + loading.value = true; | ||
| 108 | + const res = await getDeviceHistoryInfo( | ||
| 109 | + { | ||
| 110 | + ...searchParams, | ||
| 111 | + entityId: props.deviceDetail.tbDeviceId, | ||
| 112 | + }, | ||
| 113 | + orderBy | ||
| 114 | + ); | ||
| 115 | + historyData.value = getTableHistoryData(res); | ||
| 116 | + loading.value = false; | ||
| 117 | + }; | ||
| 118 | + | ||
| 119 | + const handleTableChange = async (_pag, _filters, sorter: any) => { | ||
| 120 | + sortOrder.value = sorter.order; | ||
| 121 | + await setColumns(unref(columns)); | ||
| 94 | if (sorter.field == 'ts') { | 122 | if (sorter.field == 'ts') { | 
| 95 | if (sorter.order == 'descend') { | 123 | if (sorter.order == 'descend') { | 
| 96 | - openHistoryPanel('ASC'); | 124 | + getTableList('DESC'); | 
| 97 | } else { | 125 | } else { | 
| 98 | - openHistoryPanel('DESC'); | 126 | + getTableList('ASC'); | 
| 99 | } | 127 | } | 
| 100 | } | 128 | } | 
| 101 | }; | 129 | }; | 
| @@ -214,7 +242,7 @@ | @@ -214,7 +242,7 @@ | ||
| 214 | setOptions(setChartOptions(res, selectedKeys)); | 242 | setOptions(setChartOptions(res, selectedKeys)); | 
| 215 | }; | 243 | }; | 
| 216 | 244 | ||
| 217 | - const switchMode = (flag: EnumTableChartMode) => { | 245 | + const switchMode = async (flag: EnumTableChartMode) => { | 
| 218 | mode.value = flag; | 246 | mode.value = flag; | 
| 219 | }; | 247 | }; | 
| 220 | 248 | 
| 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 
| 2 | import { transformTime } from '/@/hooks/web/useDateToLocaleString'; | 2 | import { transformTime } from '/@/hooks/web/useDateToLocaleString'; | 
| 3 | +import { isObject, isString } from '/@/utils/is'; | ||
| 3 | 4 | ||
| 4 | export const columns: BasicColumn[] = [ | 5 | export const columns: BasicColumn[] = [ | 
| 5 | { | 6 | { | 
| @@ -55,6 +56,18 @@ export const exportJSONFile = (value: Recordable, name: string) => { | @@ -55,6 +56,18 @@ export const exportJSONFile = (value: Recordable, name: string) => { | ||
| 55 | URL.revokeObjectURL(objectURL); | 56 | URL.revokeObjectURL(objectURL); | 
| 56 | }; | 57 | }; | 
| 57 | 58 | ||
| 59 | +export const paseJSON = (string: string) => { | ||
| 60 | + let data = null; | ||
| 61 | + let flag = false; | ||
| 62 | + try { | ||
| 63 | + if (!isString(string)) return { flag: false, data }; | ||
| 64 | + data = JSON.parse(string); | ||
| 65 | + flag = true; | ||
| 66 | + if (!isObject(data)) flag = false; | ||
| 67 | + } catch (error) {} | ||
| 68 | + return { flag, data }; | ||
| 69 | +}; | ||
| 70 | + | ||
| 58 | export enum RuleChainPermisssion { | 71 | export enum RuleChainPermisssion { | 
| 59 | DETAIL = 'rule:chain:detail', | 72 | DETAIL = 'rule:chain:detail', | 
| 60 | } | 73 | } | 
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | <Upload :show-upload-list="false" :customRequest="handleImport"> | 8 | <Upload :show-upload-list="false" :customRequest="handleImport"> | 
| 9 | <Button type="primary" :loading="importLoading"> 导入规则链 </Button> | 9 | <Button type="primary" :loading="importLoading"> 导入规则链 </Button> | 
| 10 | </Upload> | 10 | </Upload> | 
| 11 | - <!-- <Authority> | 11 | + <Authority> | 
| 12 | <Popconfirm | 12 | <Popconfirm | 
| 13 | title="您确定要批量删除数据" | 13 | title="您确定要批量删除数据" | 
| 14 | ok-text="确定" | 14 | ok-text="确定" | 
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | > | 17 | > | 
| 18 | <a-button color="error" :disabled="hasBatchDelete"> 批量删除 </a-button> | 18 | <a-button color="error" :disabled="hasBatchDelete"> 批量删除 </a-button> | 
| 19 | </Popconfirm> | 19 | </Popconfirm> | 
| 20 | - </Authority> --> | 20 | + </Authority> | 
| 21 | </template> | 21 | </template> | 
| 22 | <template #root="{ record }"> | 22 | <template #root="{ record }"> | 
| 23 | <Tag :color="record.root ? 'green' : 'red'"> {{ record.root ? '是' : '否' }}</Tag> | 23 | <Tag :color="record.root ? 'green' : 'red'"> {{ record.root ? '是' : '否' }}</Tag> | 
| @@ -84,6 +84,7 @@ | @@ -84,6 +84,7 @@ | ||
| 84 | encode, | 84 | encode, | 
| 85 | exportJSONFile, | 85 | exportJSONFile, | 
| 86 | searchFormSchema, | 86 | searchFormSchema, | 
| 87 | + paseJSON, | ||
| 87 | } from './config/config.data'; | 88 | } from './config/config.data'; | 
| 88 | import { | 89 | import { | 
| 89 | deleteRuleChine, | 90 | deleteRuleChine, | 
| @@ -95,17 +96,45 @@ | @@ -95,17 +96,45 @@ | ||
| 95 | } from '/@/api/ruleengine/ruleengineApi'; | 96 | } from '/@/api/ruleengine/ruleengineApi'; | 
| 96 | import { useModal } from '/@/components/Modal'; | 97 | import { useModal } from '/@/components/Modal'; | 
| 97 | import { Authority } from '/@/components/Authority'; | 98 | import { Authority } from '/@/components/Authority'; | 
| 98 | - import { Tag, Button, Upload } from 'ant-design-vue'; | 99 | + import { Tag, Button, Upload, Popconfirm } from 'ant-design-vue'; | 
| 99 | import { RuleChainModal } from './component/index'; | 100 | import { RuleChainModal } from './component/index'; | 
| 100 | import { useMessage } from '/@/hooks/web/useMessage'; | 101 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| 101 | import { usePermission } from '/@/hooks/web/usePermission'; | 102 | import { usePermission } from '/@/hooks/web/usePermission'; | 
| 102 | import { useRouter } from 'vue-router'; | 103 | import { useRouter } from 'vue-router'; | 
| 103 | import { ref } from 'vue'; | 104 | import { ref } from 'vue'; | 
| 104 | - import { isObject, isString } from '/@/utils/is'; | 105 | + import { isObject } from '/@/utils/is'; | 
| 105 | // import { ChainDetailDrawer } from './chainDetail/index'; | 106 | // import { ChainDetailDrawer } from './chainDetail/index'; | 
| 106 | // import { useDrawer } from '/@/components/Drawer'; | 107 | // import { useDrawer } from '/@/components/Drawer'; | 
| 107 | 108 | ||
| 108 | - const [registerTable, { reload, setProps }] = useTable({ | 109 | + const [registerModal, { openModal }] = useModal(); | 
| 110 | + const { createMessage } = useMessage(); | ||
| 111 | + const { hasPermission } = usePermission(); | ||
| 112 | + const router = useRouter(); | ||
| 113 | + | ||
| 114 | + const isEmptyObject = (value: any) => isObject(value) && !Object.keys(value).length; | ||
| 115 | + const importLoading = ref<boolean>(false); | ||
| 116 | + const hasBatchDelete = ref<boolean>(false); | ||
| 117 | + | ||
| 118 | + const beforeFetch = (params) => { | ||
| 119 | + Reflect.set(params, 'page', params.page - 1); | ||
| 120 | + Reflect.set(params, 'sortProperty', 'createdTime'); | ||
| 121 | + Reflect.set(params, 'sortOrder', 'DESC'); | ||
| 122 | + return params; | ||
| 123 | + }; | ||
| 124 | + | ||
| 125 | + const rowSelection = () => { | ||
| 126 | + return { | ||
| 127 | + type: 'checkbox', | ||
| 128 | + getCheckboxProps: (record: Recordable) => { | ||
| 129 | + return { disabled: record.root }; | ||
| 130 | + }, | ||
| 131 | + onChange(rowKeys: string[]) { | ||
| 132 | + hasBatchDelete.value = rowKeys.length <= 0; | ||
| 133 | + }, | ||
| 134 | + }; | ||
| 135 | + }; | ||
| 136 | + | ||
| 137 | + const [registerTable, { reload, setProps, getSelectRowKeys, clearSelectedRowKeys }] = useTable({ | ||
| 109 | title: '规则链库', | 138 | title: '规则链库', | 
| 110 | api: getRuleChinsList, | 139 | api: getRuleChinsList, | 
| 111 | rowKey: (record) => record.id.id, | 140 | rowKey: (record) => record.id.id, | 
| @@ -123,19 +152,8 @@ | @@ -123,19 +152,8 @@ | ||
| 123 | pageField: 'page', | 152 | pageField: 'page', | 
| 124 | listField: 'data', | 153 | listField: 'data', | 
| 125 | }, | 154 | }, | 
| 126 | - beforeFetch(params) { | ||
| 127 | - Reflect.set(params, 'page', params.page - 1); | ||
| 128 | - Reflect.set(params, 'sortProperty', 'createdTime'); | ||
| 129 | - Reflect.set(params, 'sortOrder', 'DESC'); | ||
| 130 | - return params; | ||
| 131 | - }, | ||
| 132 | - rowSelection: { | ||
| 133 | - type: 'checkbox', | ||
| 134 | - getCheckboxProps: (record: Recordable) => { | ||
| 135 | - console.log(record, 'record'); | ||
| 136 | - return { disabled: record.root }; | ||
| 137 | - }, | ||
| 138 | - }, | 155 | + beforeFetch: (params) => beforeFetch(params), | 
| 156 | + rowSelection: rowSelection() as any, | ||
| 139 | actionColumn: { | 157 | actionColumn: { | 
| 140 | width: 220, | 158 | width: 220, | 
| 141 | title: '操作', | 159 | title: '操作', | 
| @@ -145,10 +163,6 @@ | @@ -145,10 +163,6 @@ | ||
| 145 | }, | 163 | }, | 
| 146 | }); | 164 | }); | 
| 147 | 165 | ||
| 148 | - const [registerModal, { openModal }] = useModal(); | ||
| 149 | - | ||
| 150 | - // const [registerDrawer, { openDrawer }] = useDrawer(); | ||
| 151 | - | ||
| 152 | const handleSuccess = () => { | 166 | const handleSuccess = () => { | 
| 153 | reload(); | 167 | reload(); | 
| 154 | }; | 168 | }; | 
| @@ -166,10 +180,6 @@ | @@ -166,10 +180,6 @@ | ||
| 166 | }); | 180 | }); | 
| 167 | }; | 181 | }; | 
| 168 | 182 | ||
| 169 | - const { createMessage } = useMessage(); | ||
| 170 | - const { hasPermission } = usePermission(); | ||
| 171 | - const router = useRouter(); | ||
| 172 | - | ||
| 173 | const handleView = (record: Recordable) => { | 183 | const handleView = (record: Recordable) => { | 
| 174 | const hasDetailPermission = hasPermission(RuleChainPermisssion.DETAIL); | 184 | const hasDetailPermission = hasPermission(RuleChainPermisssion.DETAIL); | 
| 175 | if (hasDetailPermission) { | 185 | if (hasDetailPermission) { | 
| @@ -178,30 +188,6 @@ | @@ -178,30 +188,6 @@ | ||
| 178 | } else createMessage.warning('没有权限'); | 188 | } else createMessage.warning('没有权限'); | 
| 179 | }; | 189 | }; | 
| 180 | 190 | ||
| 181 | - // const handleRowClick = (record) => { | ||
| 182 | - // openDrawer(true, { record }); | ||
| 183 | - // console.log('点击行', record); | ||
| 184 | - // }; | ||
| 185 | - | ||
| 186 | - // const handleDetail = (record) => { | ||
| 187 | - // console.log(record, '详情'); | ||
| 188 | - // }; | ||
| 189 | - | ||
| 190 | - const paseJSON = (string: string) => { | ||
| 191 | - let data = null; | ||
| 192 | - let flag = false; | ||
| 193 | - try { | ||
| 194 | - if (!isString(string)) return { flag: false, data }; | ||
| 195 | - data = JSON.parse(string); | ||
| 196 | - flag = true; | ||
| 197 | - if (!isObject(data)) flag = false; | ||
| 198 | - } catch (error) {} | ||
| 199 | - return { flag, data }; | ||
| 200 | - }; | ||
| 201 | - | ||
| 202 | - const isEmptyObject = (value: any) => isObject(value) && !Object.keys(value).length; | ||
| 203 | - | ||
| 204 | - const importLoading = ref<boolean>(false); | ||
| 205 | const handleImport = (data: { file: File }) => { | 191 | const handleImport = (data: { file: File }) => { | 
| 206 | const fileReader = new FileReader(); | 192 | const fileReader = new FileReader(); | 
| 207 | 193 | ||
| @@ -275,18 +261,25 @@ | @@ -275,18 +261,25 @@ | ||
| 275 | reload(); | 261 | reload(); | 
| 276 | }; | 262 | }; | 
| 277 | 263 | ||
| 278 | - const handleDeleteOrBatchDelete = async (record: Recordable) => { | 264 | + const handleDeleteOrBatchDelete = async (record: Recordable | null) => { | 
| 279 | setProps({ | 265 | setProps({ | 
| 280 | loading: true, | 266 | loading: true, | 
| 281 | }); | 267 | }); | 
| 282 | try { | 268 | try { | 
| 269 | + if (!record) { | ||
| 270 | + const ids = getSelectRowKeys(); | ||
| 271 | + await Promise.all(ids.map((item) => deleteRuleChine(item))); | ||
| 272 | + return; | ||
| 273 | + } | ||
| 283 | await deleteRuleChine(record.id.id); | 274 | await deleteRuleChine(record.id.id); | 
| 284 | - createMessage.success('删除成功'); | ||
| 285 | } finally { | 275 | } finally { | 
| 286 | setProps({ | 276 | setProps({ | 
| 287 | loading: false, | 277 | loading: false, | 
| 288 | }); | 278 | }); | 
| 279 | + | ||
| 280 | + createMessage.success('删除成功'); | ||
| 281 | + clearSelectedRowKeys(); | ||
| 282 | + reload(); | ||
| 289 | } | 283 | } | 
| 290 | - reload(); | ||
| 291 | }; | 284 | }; | 
| 292 | </script> | 285 | </script> | 
| @@ -173,10 +173,12 @@ | @@ -173,10 +173,12 @@ | ||
| 173 | const { codeType, customCommand } = unref(getDesign) || {}; | 173 | const { codeType, customCommand } = unref(getDesign) || {}; | 
| 174 | const { transportType } = customCommand || {}; | 174 | const { transportType } = customCommand || {}; | 
| 175 | const sendValue = ref<any>(unref(sliderValue)); | 175 | const sendValue = ref<any>(unref(sliderValue)); | 
| 176 | + const isModbusCommand = ref<boolean>(false); | ||
| 176 | if (transportType == 'TCP' && codeType == TaskTypeEnum.MODBUS_RTU) { | 177 | if (transportType == 'TCP' && codeType == TaskTypeEnum.MODBUS_RTU) { | 
| 177 | sendValue.value = await getSendValue(unref(sliderValue)); | 178 | sendValue.value = await getSendValue(unref(sliderValue)); | 
| 179 | + isModbusCommand.value = true; | ||
| 178 | } | 180 | } | 
| 179 | - const flag = await sendCommand(props.config.option, unref(sendValue), true); | 181 | + const flag = await sendCommand(props.config.option, unref(sendValue), unref(isModbusCommand)); | 
| 180 | flag | 182 | flag | 
| 181 | ? ((sliderValue.value = unref(sliderValue)), | 183 | ? ((sliderValue.value = unref(sliderValue)), | 
| 182 | (oldSliderValue.value = sliderValue.value), | 184 | (oldSliderValue.value = sliderValue.value), |