| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { ProTableV2, LoadingLayout, AppContainer, useTable } from '@bole-core/components'; |
| | | import * as enterpriseServices from '@/services/api/enterprise'; |
| | | import * as enterpriseInsuranceProductServices from '@/services/api/enterpriseInsuranceProduct'; |
| | | import { |
| | | EnumEnterpriseCooperationStatusText, |
| | | EnumEnterpriseCooperationSignStatusText, |
| | | } from '@/constants'; |
| | | import { Message } from '@bole-core/core'; |
| | | |
| | | defineOptions({ |
| | | name: 'InsureProductConfigure', |
| | |
| | | const operationBtnMap: Record<string, OperationBtnType> = { |
| | | enableBtn: { |
| | | emits: { |
| | | onClick: (role) => setStatus(role), |
| | | onClick: (role) => setDisabledEnterpriseInsuranceProducts(role), |
| | | }, |
| | | extraProps: { |
| | | hide: (role) => false, |
| | | hide: (role: API.GetEnterpriseInsuranceProductsQueryResultItem) => !role.isDisabled, |
| | | }, |
| | | }, |
| | | disableBtn: { |
| | | emits: { |
| | | onClick: (role) => setStatus(role), |
| | | onClick: (role) => setDisabledEnterpriseInsuranceProducts(role), |
| | | }, |
| | | extraProps: { |
| | | hide: (role) => false, |
| | | hide: (role: API.GetEnterpriseInsuranceProductsQueryResultItem) => role.isDisabled, |
| | | }, |
| | | }, |
| | | }; |
| | |
| | | const { checkSubModuleItemShow, column, operationBtns } = useAccess({ |
| | | operationBtnMap, |
| | | }); |
| | | |
| | | const route = useRoute(); |
| | | const enterpriseCooperationId = (route.params.id as string) ?? ''; |
| | | |
| | | const BaseState = { |
| | | loading: true, |
| | |
| | | } = useTable( |
| | | async ({ pageIndex, pageSize }, extraParamState) => { |
| | | try { |
| | | let params: API.GetPartyAEnterprisesQuery = { |
| | | let params: API.GetEnterpriseInsuranceProductsQuery = { |
| | | pageModel: { |
| | | rows: pageSize, |
| | | page: pageIndex, |
| | | orderInput: extraParamState.orderInput, |
| | | }, |
| | | enterpriseCooperationId: enterpriseCooperationId, |
| | | }; |
| | | |
| | | let res = await enterpriseServices.getPartyAEnterprises(params, { |
| | | let res = await enterpriseInsuranceProductServices.getEnterpriseInsuranceProducts(params, { |
| | | showLoading: !state.loading, |
| | | }); |
| | | return res; |
| | |
| | | }, |
| | | queryKey: ['enterpriseServices/getPartyAEnterprises'], |
| | | columnsRenderProps: { |
| | | cooperationStatus: { type: 'enum', valueEnum: EnumEnterpriseCooperationStatusText }, |
| | | signStatus: { type: 'enum', valueEnum: EnumEnterpriseCooperationSignStatusText }, |
| | | isDisabled: { |
| | | formatter: (row: API.GetEnterpriseInsuranceProductsQueryResultItem) => |
| | | row.isDisabled ? '禁用' : '启用', |
| | | }, |
| | | }, |
| | | } |
| | | ); |
| | | |
| | | async function setStatus(row) {} |
| | | async function setDisabledEnterpriseInsuranceProducts( |
| | | row: API.GetEnterpriseInsuranceProductsQueryResultItem |
| | | ) { |
| | | try { |
| | | await Message.tipMessage(`确认要${row.isDisabled ? '启用' : '禁用'}该保险产品吗?`); |
| | | let params: API.SetDisabledEnterpriseInsuranceProductsCommand = { |
| | | enterpriseCooperationId: enterpriseCooperationId, |
| | | ids: [row.id], |
| | | isDisabled: !row.isDisabled, |
| | | }; |
| | | let res = await enterpriseInsuranceProductServices.setDisabledEnterpriseInsuranceProducts( |
| | | params |
| | | ); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(paginationState.pageIndex); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | </script> |