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 { useAtom, useAtomValue } from 'jotai'
import { import {
deleteAppPackageAtom, deleteAppPackageAtom,
saveOrUpdateAppPackageAtom, appPackageAtom, appPackagesAtom, appPackageSearchAtom,
saveOrUpdateAppPackageAtom, appPackageAtom, appPackagesAtom, appPackageSearchAtom, packageAppAtom,
} from '@/store/app/package' } from '@/store/app/package'
import { useEffect, useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
import Action from '@/components/action/Action.tsx' import Action from '@/components/action/Action.tsx'
@ -32,6 +32,7 @@ const AppPackage = () => {
const [ currentAppPackage, setAppPackage ] = useAtom(appPackageAtom) const [ currentAppPackage, setAppPackage ] = useAtom(appPackageAtom)
const { data, isFetching, isLoading, refetch } = useAtomValue(appPackagesAtom) const { data, isFetching, isLoading, refetch } = useAtomValue(appPackagesAtom)
const { mutate: deleteAppPackage, isPending: isDeleting } = useAtomValue(deleteAppPackageAtom) const { mutate: deleteAppPackage, isPending: isDeleting } = useAtomValue(deleteAppPackageAtom)
const { mutate: packageApp, isPending: packageing } = useAtomValue(packageAppAtom)
const [ open, setOpen ] = useState(false) const [ open, setOpen ] = useState(false)
const [ openFilter, setFilterOpen ] = useState(false) const [ openFilter, setFilterOpen ] = useState(false)
@ -226,12 +227,22 @@ const AppPackage = () => {
valueType: 'option', valueType: 'option',
fixed: 'right', fixed: 'right',
render: (_, record) => [ 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" <Action key="edit"
as={'a'} as={'a'}
onClick={() => { onClick={() => {
form.setFieldsValue(record) form.setFieldsValue(record)
setOpen(true) setOpen(true)
}}>{t('actions.edit')}</Action>, }}>{t('actions.edit')}</Action>,
<Divider type={'vertical'}/>,
<Popconfirm <Popconfirm
key={'del_confirm'} key={'del_confirm'}
disabled={isDeleting} disabled={isDeleting}
@ -312,7 +323,7 @@ const AppPackage = () => {
onRow={(record) => { onRow={(record) => {
return { return {
className: cx({ className: cx({
'ant-table-row-selected': currentAppPackage?.id === record.id
// 'ant-table-row-selected': currentAppPackage?.id === record.id
}), }),
onClick: () => { onClick: () => {
setAppPackage(record) 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