From e5ab234be6750c85bf99aa03094c445c001e2e9e Mon Sep 17 00:00:00 2001 From: Austin <1344583166@qq.com> Date: Mon, 23 Sep 2024 19:35:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20mysql=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=AE=B1=E6=94=AF=E6=8C=81=E6=A0=BC=E5=AD=90=E5=86=85=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=9B=86=E7=BE=A4/=E5=AE=9E=E4=BE=8B/IP=20#6997=20#?= =?UTF-8?q?=20Reviewed,=20transaction=20id:=2019139?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/tendb-ha-host/Index.vue | 3 + .../components/tendb-ha-host/table/Index.vue | 31 +++++++- dbm-ui/frontend/src/locales/zh-cn.json | 6 ++ dbm-ui/frontend/src/types/auto-imports.d.ts | 1 - .../pages/page1/components/RenderData/Row.vue | 1 + .../edit-field/InstanceWithSelector.vue | 36 +++++++-- .../mysql/proxy-replace/pages/page1/Index.vue | 33 ++++---- .../ReplaceHost/components/RenderData/Row.vue | 76 +++++++++++++++--- .../components/RenderData/Row.vue | 78 ++++++++++++++++--- .../components/common/RenderTargetProxy.vue | 4 +- .../page1/components/render-row/Index.vue | 20 +---- 11 files changed, 217 insertions(+), 72 deletions(-) diff --git a/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/Index.vue b/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/Index.vue index 264eac830a..81a45cdf13 100644 --- a/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/Index.vue +++ b/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/Index.vue @@ -67,6 +67,7 @@ :get-table-list="getTableList" :is-remote-pagination="isRemotePagination" :last-values="lastValues" + :multiple="multiple" :role-filter-list="roleFilterList" :status-filter="statusFilter" :table-setting="tableSetting" @@ -104,6 +105,7 @@ interface Props { lastValues: InstanceSelectorValues; tableSetting: TableSetting; + multiple?: NonNullable; firsrColumn?: TableConfigType['firsrColumn']; roleFilterList?: TableConfigType['roleFilterList']; isRemotePagination?: TableConfigType['isRemotePagination']; @@ -128,6 +130,7 @@ topoAlertContent: undefined, roleFilterList: undefined, filterClusterId: undefined, + multiple: true, }); const emits = defineEmits(); diff --git a/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/table/Index.vue b/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/table/Index.vue index 0a94b9f838..df1532f0df 100644 --- a/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/table/Index.vue +++ b/dbm-ui/frontend/src/components/instance-selector/components/tendb-ha-host/table/Index.vue @@ -30,7 +30,8 @@ style="margin-top: 12px" @page-limit-change="handeChangeLimit" @page-value-change="handleChangePage" - @refresh="fetchResources" /> + @refresh="fetchResources" + @row-click.stop.prevent="handleRowClick" /> @@ -60,6 +61,7 @@ lastValues: InstanceSelectorValues, tableSetting: TableSetting, clusterId?: number, + multiple?: TableConfigType['multiple'], isRemotePagination?: TableConfigType['isRemotePagination'], firsrColumn?: TableConfigType['firsrColumn'], // eslint-disable-next-line vue/no-unused-properties @@ -128,7 +130,7 @@ { width: 60, fixed: 'left', - label: () => ( + label: () => props.multiple && ( ); } - return ( + return props.multiple ? ( handleTableSelectOne(value, data)} /> + ) : ( + handleTableSelectOne(value, data)} + /> ); }, }, @@ -276,8 +285,22 @@ } }; + const handleRowClick = (row: unknown, data: T) => { + if (props.disabledRowConfig && props.disabledRowConfig.handler(data)) { + return; + } + + const isChecked = !!checkedMap.value[data[firstColumnFieldId.value]]; + if (isChecked && !props.multiple) { + // 单选不允许取消 + return; + } + + handleTableSelectOne(!isChecked, data); + }; + const handleTableSelectOne = (checked: boolean, data: T) => { - const lastCheckMap = { ...checkedMap.value }; + const lastCheckMap = props.multiple ? { ...checkedMap.value } : {}; if (checked) { lastCheckMap[data[firstColumnFieldId.value]] = formatValue(data); } else { diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index 5fc550b117..f1b555ab3d 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3529,5 +3529,11 @@ "不允许输入系统库和特殊库,如mysql、sys 等": "不允许输入系统库和特殊库,如mysql、sys 等", "支持 %(指代任意长度字符串), ?(指代单个字符串), *(指代全部)三个通配符": "支持 %(指代任意长度字符串), ?(指代单个字符串), *(指代全部)三个通配符", "包含通配符时, 每一单元格只允许输入单个对象。% ? 不能独立使用, * 只能单独使用": "包含通配符时, 每一单元格只允许输入单个对象。% ? 不能独立使用, * 只能单独使用", + "选择实例": "选择实例", + "格式不正确": "格式不正确", + "ip不存在": "ip不存在", + "请输入或选择主机": "请输入或选择主机", + "实例/IP重复": "实例/IP重复", + "同主机关联的其他集群,勾选后一同克隆": "同主机关联的其他集群,勾选后一同克隆", "这行勿动!新增翻译请在上一行添加!": "" } \ No newline at end of file diff --git a/dbm-ui/frontend/src/types/auto-imports.d.ts b/dbm-ui/frontend/src/types/auto-imports.d.ts index 6bc2ae2a45..79be9ca2a4 100644 --- a/dbm-ui/frontend/src/types/auto-imports.d.ts +++ b/dbm-ui/frontend/src/types/auto-imports.d.ts @@ -3,7 +3,6 @@ // @ts-nocheck // noinspection JSUnusedGlobalSymbols // Generated by unplugin-auto-import -// biome-ignore lint: disable export {} declare global { const EffectScope: (typeof import('vue'))['EffectScope']; diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/checksum/pages/page1/components/RenderData/Row.vue b/dbm-ui/frontend/src/views/db-manage/mysql/checksum/pages/page1/components/RenderData/Row.vue index d087f3f32d..a86d482a5c 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/checksum/pages/page1/components/RenderData/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/checksum/pages/page1/components/RenderData/Row.vue @@ -124,6 +124,7 @@ id: 0, }, version: '', + is_stand_by: false, }); export type IDataRowBatchKey = keyof Pick; diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/common/edit-field/InstanceWithSelector.vue b/dbm-ui/frontend/src/views/db-manage/mysql/common/edit-field/InstanceWithSelector.vue index 4d5313afda..cfbd672f98 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/common/edit-field/InstanceWithSelector.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/common/edit-field/InstanceWithSelector.vue @@ -49,13 +49,14 @@ @change="handleInstancesChange" />