fix: bug#10863、10816、10739、10746、10749

This commit is contained in:
JiangQiming 2023-03-24 15:22:02 +08:00
parent f55bf06297
commit 8d35495808
4 changed files with 32 additions and 21 deletions

View File

@ -38,7 +38,7 @@
:params="queryParams" :params="queryParams"
:rowSelection="{ :rowSelection="{
selectedRowKeys: table._selectedRowKeys.value, selectedRowKeys: table._selectedRowKeys.value,
onChange: selectRow, onChange: selectChange,
}" }"
@cancelSelect="table.cancelSelect" @cancelSelect="table.cancelSelect"
:columns="columns" :columns="columns"
@ -55,7 +55,7 @@
:status="slotProps.state?.value" :status="slotProps.state?.value"
:statusText="slotProps.state?.text" :statusText="slotProps.state?.text"
:statusNames="{ :statusNames="{
online: 'success', online: 'processing',
offline: 'error', offline: 'error',
notActive: 'warning', notActive: 'warning',
}" }"
@ -121,7 +121,7 @@
:status="slotProps.state.value" :status="slotProps.state.value"
:text="slotProps.state.text" :text="slotProps.state.text"
:statusNames="{ :statusNames="{
online: 'success', online: 'processing',
offline: 'error', offline: 'error',
notActive: 'warning', notActive: 'warning',
}" }"
@ -173,10 +173,8 @@ const confirm = () => {
permission: item.selectPermissions, permission: item.selectPermissions,
})); }));
if (params.length === 1) { // , ,
// , , departmentStore.setProductId(params[0].assetIdList[0]);
departmentStore.setProductId(params[0].assetIdList[0]);
}
loading.value = true; loading.value = true;
bindDeviceOrProductList_api(props.assetType, params) bindDeviceOrProductList_api(props.assetType, params)
@ -475,15 +473,20 @@ const table: any = {
}, },
}; };
table.init(); table.init();
const selectRow = (keys: string[], rows: any[]) => { // const selectRow = (rows: any[], check: boolean) => {
const okRows = rows.filter( // const okRows = rows.filter(
(item) => // (item) =>
!!item.permissionList.find( // !!item.permissionList.find(
(permiss: any) => permiss.value === 'share', // (permiss: any) => permiss.value === 'share',
), // ),
); // );
table.selectedRows = okRows; // table.selectedRows = okRows;
table._selectedRowKeys.value = okRows.map((item) => item.id); // table._selectedRowKeys.value = okRows.map((item) => item.id);
// };
// fix: bug#10749
const selectChange = (keys: string[], rows: any[]) => {
table.selectedRows = rows;
table._selectedRowKeys.value = keys;
}; };
</script> </script>

View File

@ -68,8 +68,8 @@
:status="slotProps.state?.value" :status="slotProps.state?.value"
:statusText="slotProps.state?.text" :statusText="slotProps.state?.text"
:statusNames="{ :statusNames="{
1: 'processing', online: 'processing',
0: 'error', offline: 'error',
}" }"
> >
<template #img> <template #img>
@ -171,8 +171,8 @@
:status="slotProps.state.value" :status="slotProps.state.value"
:text="slotProps.state.text" :text="slotProps.state.text"
:statusNames="{ :statusNames="{
1: 'processing', online: 'processing',
0: 'error', offline: 'error',
}" }"
></BadgeStatus> ></BadgeStatus>
</template> </template>
@ -517,6 +517,7 @@ const table = {
}, },
]; ];
unBindDeviceOrProduct_api('product', params).then(() => { unBindDeviceOrProduct_api('product', params).then(() => {
tableData._selectedRowKeys = [];
message.success('操作成功'); message.success('操作成功');
table.refresh(); table.refresh();
}); });

View File

@ -213,4 +213,11 @@ const table = reactive({
}); });
const dialogVisible = ref(false); const dialogVisible = ref(false);
watch(
() => props.parentId,
() => {
table.refresh();
},
);
</script> </script>

View File

@ -71,7 +71,7 @@
v-model:value="form.data.targetType" v-model:value="form.data.targetType"
:disabled="!!form.data.id" :disabled="!!form.data.id"
@change="form.rules.checkUnique" @change="form.rules.checkUnique"
placeholder="请选择关联方" placeholder="请选择关联方"
> >
<j-select-option <j-select-option
v-for="item in targetList" v-for="item in targetList"