copy from WMS/web/app/template/MyPluginName/Controllers/MyEntityName.ts
copy to HIAWms/web/app/template/HIAWms/Controllers/Sample.ts
Îļþ´Ó WMS/web/app/template/MyPluginName/Controllers/MyEntityName.ts ¸´ÖÆ |
| | |
| | | import { ref, onMounted, reactive, Ref, nextTick, computed } from 'vue' |
| | | import { injectModel } from '@/libs/Provider/Provider' |
| | | import { MyEntityName } from '../Models/MyEntityName' |
| | | import { Sample } from '../Models/Sample' |
| | | import { ElMessage } from 'element-plus' |
| | | import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' |
| | | import { useFile } from './File' |
| | |
| | | row: any |
| | | index: number |
| | | } |
| | | export const useMyEntityName = (props: any, ctx?: any) => { |
| | | const myEntityName = injectModel<MyEntityName>('myEntityName') |
| | | export const useSample = (props: any, ctx?: any) => { |
| | | const sample = injectModel<Sample>('sample') |
| | | const { exportFile } = useFile() |
| | | /** |
| | | * 头é¨é
ç½® |
| | |
| | | /** |
| | | * 卿åé
ç½® |
| | | */ |
| | | const myEntityNameColumns = ref<Record<string, any>>([]) |
| | | const sampleColumns = ref<Record<string, any>>([]) |
| | | /** |
| | | * æç´¢å¼ |
| | | */ |
| | |
| | | { |
| | | label: 'åå»ºå¯æ¬', |
| | | fn: async ({ row }: CurrentType) => { |
| | | await myEntityName.cloneData([row.id]) |
| | | await sample.cloneData([row.id]) |
| | | ElMessage.success('åå»ºå¯æ¬æå') |
| | | tableRef.value?.getList() |
| | | }, |
| | |
| | | `æ¯å¦å é¤${names.length ? names.join(',') : c.row.name}` |
| | | ).then(async () => { |
| | | const ids = selection.value.map((item: { id: string }) => item.id) |
| | | await myEntityName.deleteMyEntityNames(ids.length ? ids : [c.row.id]) |
| | | await sample.deleteSamples(ids.length ? ids : [c.row.id]) |
| | | ElMessage.success('å 餿å') |
| | | tableRef.value.getList() |
| | | }) |
| | |
| | | selection.value = records |
| | | } |
| | | |
| | | const onAddMyEntityName = () => { |
| | | const onAddSample = () => { |
| | | const params = tableRef.value?.getPaginationParams() |
| | | current.value = null |
| | | dialogConfig.visible = true |
| | |
| | | sort.value = params.totalCount + 1 |
| | | } |
| | | |
| | | const onConfirmMyEntityName = async () => { |
| | | const onConfirmSample = async () => { |
| | | dialogConfig.visible = false |
| | | if (dialogConfig.isAdd) { |
| | | tableRef.value?.scrollToRow({ |
| | |
| | | const onExport = () => { |
| | | const params = tableRef.value?.getParams() |
| | | exportFile( |
| | | '/api/v1/myPluginName/myEntityName/export', |
| | | '/api/v1/hiawms/sample/export', |
| | | params, |
| | | 'myPluginName' |
| | | 'hiawms' |
| | | ) |
| | | } |
| | | |
| | |
| | | current, |
| | | search, |
| | | sort, |
| | | myEntityNameColumns, |
| | | sampleColumns, |
| | | paginationParams, |
| | | headers, |
| | | onBeforeUpload, |
| | |
| | | onSearch, |
| | | onExport, |
| | | onRowClick, |
| | | onConfirmMyEntityName, |
| | | onConfirmSample, |
| | | onCheck, |
| | | onAddMyEntityName, |
| | | onAddSample, |
| | | } |
| | | } |