Browse Source

增加打包执行

main
dark 3 months ago
parent
commit
035e8eeba0
  1. 17
      src/pages/app/package/index.tsx
  2. 18
      src/store/app/package.ts

17
src/pages/app/package/index.tsx

@ -3,7 +3,7 @@ import { Button, Form, Popconfirm, Divider, Space, Tooltip, Badge } from 'antd'
import { useAtom, useAtomValue } from 'jotai'
import {
deleteAppPackageAtom,
saveOrUpdateAppPackageAtom, appPackageAtom, appPackagesAtom, appPackageSearchAtom,
saveOrUpdateAppPackageAtom, appPackageAtom, appPackagesAtom, appPackageSearchAtom, packageAppAtom,
} from '@/store/app/package'
import { useEffect, useMemo, useState } from 'react'
import Action from '@/components/action/Action.tsx'
@ -32,6 +32,7 @@ const AppPackage = () => {
const [ currentAppPackage, setAppPackage ] = useAtom(appPackageAtom)
const { data, isFetching, isLoading, refetch } = useAtomValue(appPackagesAtom)
const { mutate: deleteAppPackage, isPending: isDeleting } = useAtomValue(deleteAppPackageAtom)
const { mutate: packageApp, isPending: packageing } = useAtomValue(packageAppAtom)
const [ open, setOpen ] = useState(false)
const [ openFilter, setFilterOpen ] = useState(false)
@ -226,17 +227,27 @@ const AppPackage = () => {
valueType: 'option',
fixed: 'right',
render: (_, record) => [
<Action key="package"
as={'a'}
loading={packageing}
disabled={![ 0, 4 ].includes(record.status) || packageing}
onClick={() => {
packageApp(record)
}}
>{t('actions.package', '应用打包')}</Action>,
<Divider type={'vertical'}/>,
<Action key="edit"
as={'a'}
onClick={() => {
form.setFieldsValue(record)
setOpen(true)
}}>{t('actions.edit')}</Action>,
<Divider type={'vertical'}/>,
<Popconfirm
key={'del_confirm'}
disabled={isDeleting}
onConfirm={() => {
deleteAppPackage(record.id )
deleteAppPackage(record.id)
}}
title={t('message.deleteConfirm')}>
<a key="del">
@ -312,7 +323,7 @@ const AppPackage = () => {
onRow={(record) => {
return {
className: cx({
'ant-table-row-selected': currentAppPackage?.id === record.id
// 'ant-table-row-selected': currentAppPackage?.id === record.id
}),
onClick: () => {
setAppPackage(record)

18
src/store/app/package.ts

@ -16,7 +16,7 @@ export const appPackageIdAtom = atom(0)
export const appPackageIdsAtom = atom<number[]>([])
export const appPackageAtom = atom<APP.IAppPackage>(undefined as unknown as APP.IAppPackage )
export const appPackageAtom = atom<APP.IAppPackage>(undefined as unknown as APP.IAppPackage)
export const appPackageSearchAtom = atom<SearchParams>({
key: '',
@ -88,3 +88,19 @@ export const deleteAppPackageAtom = atomWithMutation((get) => {
}
}
})
//package 打包
export const packageAppAtom = atomWithMutation((get) => {
return {
mutationKey: [ 'packageAppPackage' ],
mutationFn: async (data: APP.IAppPackage) => {
return await aPPServ.package({ id: data.id })
},
onSuccess: (res) => {
message.success('message.packageSuccess')
//更新列表
get(queryClientAtom).invalidateQueries({ queryKey: [ 'appPackages', get(appPackageSearchAtom) ] })
return res
}
}
})
Loading…
Cancel
Save