| | |
| | | const hide = message.loading('正在添加'); |
| | | try { |
| | | const resp = await Http.doPost('api/role/save', val); |
| | | hide(); |
| | | if (resp.code === 200) { |
| | | message.success('添加成功'); |
| | | return true; |
| | |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | hide(); |
| | | message.error('添加失败请重试!'); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |
| | |
| | | const hide = message.loading('正在更新'); |
| | | try { |
| | | const resp = await Http.doPost('api/role/update', val); |
| | | hide(); |
| | | if (resp.code === 200) { |
| | | message.success('更新成功'); |
| | | return true; |
| | |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | hide(); |
| | | message.error('配置失败请重试!'); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |
| | |
| | | const hide = message.loading('正在删除'); |
| | | try { |
| | | const resp = await Http.doPost('api/role/remove/' + rows.map((row) => row.id).join(',')); |
| | | hide(); |
| | | if (resp.code === 200) { |
| | | message.success('删除成功'); |
| | | return true; |
| | |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | hide(); |
| | | message.error('删除失败,请重试'); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |
| | |
| | | const hide = message.loading('正在导出'); |
| | | try { |
| | | const resp = await Http.doPostBlob('api/role/export'); |
| | | const blob = new Blob([resp], {type: 'application/vnd.ms-excel'}); |
| | | const blob = new Blob([resp], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | hide(); |
| | | message.success('导出成功'); |
| | | return true; |
| | | } catch (error) { |
| | | hide(); |
| | | message.error('导出失败,请重试'); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |