Commit aaf672c44a7a4ee9232d9a7883d7d0de281769e6
Merge branch 'fix/teambition/10-18/2024' into 'main_dev'
fix: 产品物模型创建到下一页时,点击新物模型下移,提示服务器错误 See merge request yunteng/thingskit-front!1513
Showing
2 changed files
with
16 additions
and
3 deletions
| @@ -107,7 +107,9 @@ | @@ -107,7 +107,9 @@ | ||
| 107 | const handleSwitch = async (e: any, record: any) => { | 107 | const handleSwitch = async (e: any, record: any) => { |
| 108 | switchLoading.value = true; | 108 | switchLoading.value = true; |
| 109 | await deviceProfileCategory({ ...record, status: e }); | 109 | await deviceProfileCategory({ ...record, status: e }); |
| 110 | - switchLoading.value = false; | 110 | + setTimeout(() => { |
| 111 | + switchLoading.value = false; | ||
| 112 | + }, 1500); | ||
| 111 | createMessage.success( | 113 | createMessage.success( |
| 112 | `${!e ? t('common.disableText') : t('common.enableText')}${t('common.successText')}` | 114 | `${!e ? t('common.disableText') : t('common.enableText')}${t('common.successText')}` |
| 113 | ); | 115 | ); |
| @@ -142,13 +142,21 @@ | @@ -142,13 +142,21 @@ | ||
| 142 | { | 142 | { |
| 143 | label: t('common.sortOperation.moveDown'), | 143 | label: t('common.sortOperation.moveDown'), |
| 144 | icon: 'ant-design:down-outlined', | 144 | icon: 'ant-design:down-outlined', |
| 145 | - ifShow: thingsModelListTotal - record.sort <= 1 ? false : true, | 145 | + ifShow: |
| 146 | + index === tableList.length - 1 && | ||
| 147 | + includeSortIsTop.includes(thingsModelListTotal - record.sort) | ||
| 148 | + ? false | ||
| 149 | + : true, | ||
| 146 | onClick: handleTableSort.bind(null, 'down', record), | 150 | onClick: handleTableSort.bind(null, 'down', record), |
| 147 | }, | 151 | }, |
| 148 | { | 152 | { |
| 149 | label: t('common.sortOperation.isBottom'), | 153 | label: t('common.sortOperation.isBottom'), |
| 150 | icon: 'ant-design:vertical-align-bottom-outlined', | 154 | icon: 'ant-design:vertical-align-bottom-outlined', |
| 151 | - ifShow: thingsModelListTotal - record.sort <= 1 ? false : true, | 155 | + ifShow: |
| 156 | + index === tableList.length - 1 && | ||
| 157 | + includeSortIsTop.includes(thingsModelListTotal - record.sort) | ||
| 158 | + ? false | ||
| 159 | + : true, | ||
| 152 | onClick: handleTableSort.bind(null, 'bottomUp', record), | 160 | onClick: handleTableSort.bind(null, 'bottomUp', record), |
| 153 | }, | 161 | }, |
| 154 | ]" | 162 | ]" |
| @@ -217,6 +225,8 @@ | @@ -217,6 +225,8 @@ | ||
| 217 | 225 | ||
| 218 | const includeSortIsTop = [0, 1]; | 226 | const includeSortIsTop = [0, 1]; |
| 219 | 227 | ||
| 228 | + const tableList = ref<Recordable[]>([]); | ||
| 229 | + | ||
| 220 | const { createMessage } = useMessage(); | 230 | const { createMessage } = useMessage(); |
| 221 | const isShowBtn = ref(false); | 231 | const isShowBtn = ref(false); |
| 222 | const [registerModal, { openModal }] = useModal(); | 232 | const [registerModal, { openModal }] = useModal(); |
| @@ -234,6 +244,7 @@ | @@ -234,6 +244,7 @@ | ||
| 234 | selectType: props.record.ifShowClass ? 'category' : undefined, | 244 | selectType: props.record.ifShowClass ? 'category' : undefined, |
| 235 | }); | 245 | }); |
| 236 | thingsModelListTotal.value = (res as Recordable)?.total || 0; | 246 | thingsModelListTotal.value = (res as Recordable)?.total || 0; |
| 247 | + tableList.value = (res as Recordable)?.items || []; | ||
| 237 | return res; | 248 | return res; |
| 238 | }, | 249 | }, |
| 239 | columns: props.record.ifShowClass | 250 | columns: props.record.ifShowClass |