Browse Source

增加打包执行

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

15
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,12 +227,22 @@ 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}
@ -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)

16
src/store/app/package.ts

@ -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