|  |  |  | 
|---|
|  |  |  | </ProDialogTableWrapper> | 
|---|
|  |  |  | <template #footer> | 
|---|
|  |  |  | <span class="dialog-footer"> | 
|---|
|  |  |  | <el-button v-if="form.type === 'detail'" @click="emit('onCancel')" type="primary" | 
|---|
|  |  |  | >确定</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <template v-if="form.type === 'check'"> | 
|---|
|  |  |  | <el-button @click="emit('check', false)">验收未通过</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="emit('check', true)">验收通过</el-button> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | <el-button @click="emit('onCancel')" type="primary">确定</el-button> | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </ProDialog> | 
|---|
|  |  |  | 
|---|
|  |  |  | defineOperationBtns, | 
|---|
|  |  |  | useTable, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import * as taskCheckReceiveServices from '@/services/api/taskCheckReceive'; | 
|---|
|  |  |  | import { setOSSLink } from '@/utils'; | 
|---|
|  |  |  | import { downloadWithZip, Message } from '@bole-core/core'; | 
|---|
|  |  |  | import { useGlobalEventContext } from '@/hooks'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | name: 'EnterpriseConsumptionDetailDialog', | 
|---|
|  |  |  | name: 'CheckManageDialog', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | type Form = { | 
|---|
|  |  |  | id: string; | 
|---|
|  |  |  | type: string; | 
|---|
|  |  |  | isDetail: boolean; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const visible = defineModel({ type: Boolean }); | 
|---|
|  |  |  | const form = defineModel<Form>('form'); | 
|---|
|  |  |  | const title = computed(() => (form.value.type === 'check' ? '验收' : '详情')); | 
|---|
|  |  |  | const title = computed(() => (form.value.isDetail ? '详情' : '验收')); | 
|---|
|  |  |  | const emit = defineEmits<{ | 
|---|
|  |  |  | (e: 'onCancel'): void; | 
|---|
|  |  |  | (e: 'check', value: boolean): void; | 
|---|
|  |  |  | }>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const eventContext = useGlobalEventContext(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const columns = defineColumns([ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id: '1', | 
|---|
|  |  |  | enCode: 'creationTime', | 
|---|
|  |  |  | name: '提交时间', | 
|---|
|  |  |  | enCode: 'date', | 
|---|
|  |  |  | name: '任务日期', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id: '2', | 
|---|
|  |  |  | enCode: 'type', | 
|---|
|  |  |  | enCode: 'createdTime', | 
|---|
|  |  |  | name: '提交时间', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id: '3', | 
|---|
|  |  |  | enCode: 'files', | 
|---|
|  |  |  | name: '验收照片', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id: '4', | 
|---|
|  |  |  | enCode: 'checkReceiveStatus', | 
|---|
|  |  |  | name: '验收状态', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id: '5', | 
|---|
|  |  |  | enCode: 'checkReceiveTime', | 
|---|
|  |  |  | name: '验收时间', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const operationBtns = defineOperationBtns([ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | enCode: 'checkReceiveBtn', | 
|---|
|  |  |  | name: '验收通过', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | emits: { | 
|---|
|  |  |  | onClick: (role) => checkReceiveTask(role, EnumTaskUserSubmitCheckReceiveStatus.Success), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row: API.GetCheckReceiveTaskUserSubmitsQueryResultItem) => | 
|---|
|  |  |  | !( | 
|---|
|  |  |  | row.checkReceiveStatus === EnumTaskUserSubmitCheckReceiveStatus.WaitSubmit || | 
|---|
|  |  |  | row.checkReceiveStatus === EnumTaskUserSubmitCheckReceiveStatus.WaitCheckReceive | 
|---|
|  |  |  | ) || form.value.isDetail, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | enCode: 'checkReceiveBtn', | 
|---|
|  |  |  | name: '验收未通过', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | emits: { | 
|---|
|  |  |  | onClick: (role) => checkReceiveTask(role, EnumTaskUserSubmitCheckReceiveStatus.Fail), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row: API.GetCheckReceiveTaskUserSubmitsQueryResultItem) => | 
|---|
|  |  |  | !( | 
|---|
|  |  |  | row.checkReceiveStatus === EnumTaskUserSubmitCheckReceiveStatus.WaitSubmit || | 
|---|
|  |  |  | row.checkReceiveStatus === EnumTaskUserSubmitCheckReceiveStatus.WaitCheckReceive | 
|---|
|  |  |  | ) || form.value.isDetail, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | enCode: 'downloadBtn', | 
|---|
|  |  |  | 
|---|
|  |  |  | emits: { | 
|---|
|  |  |  | onClick: (role) => handleDownload(role), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row: API.GetCheckReceiveTaskUserSubmitsQueryResultItem) => row.files?.length === 0, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | watch( | 
|---|
|  |  |  | () => visible.value, | 
|---|
|  |  |  | visible, | 
|---|
|  |  |  | (val) => { | 
|---|
|  |  |  | if (val) { | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | if (form.value.id) { | 
|---|
|  |  |  | getList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } = useTable( | 
|---|
|  |  |  | async ({ pageIndex, pageSize }, extraParamState) => { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let params: API.GetFlexEnterpriseInput = { | 
|---|
|  |  |  | let params: API.GetCheckReceiveTaskUserSubmitsQuery = { | 
|---|
|  |  |  | pageModel: { | 
|---|
|  |  |  | rows: pageSize, | 
|---|
|  |  |  | page: pageIndex, | 
|---|
|  |  |  | orderInput: extraParamState.orderInput, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | id: form.value.id, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await flexEnterpriseServices.getFlexEnterpriseList(params); | 
|---|
|  |  |  | let res = await taskCheckReceiveServices.getCheckReceiveTaskUserSubmits(params); | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | console.log('error: ', error); | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | defaultExtraParams: { | 
|---|
|  |  |  | orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }], | 
|---|
|  |  |  | orderInput: [{ property: 'date', order: EnumPagedListOrder.Desc }], | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | queryKey: ['flexEnterpriseServices/getFlexEnterpriseList'], | 
|---|
|  |  |  | columnsRenderProps: {}, | 
|---|
|  |  |  | queryKey: ['taskCheckReceiveServices/getCheckReceiveTaskUserSubmits'], | 
|---|
|  |  |  | columnsRenderProps: { | 
|---|
|  |  |  | createdTime: { type: 'date' }, | 
|---|
|  |  |  | checkReceiveTime: { type: 'date' }, | 
|---|
|  |  |  | date: { type: 'date', format: 'YYYY-MM-DD' }, | 
|---|
|  |  |  | checkReceiveStatus: { type: 'enum', valueEnum: EnumTaskUserSubmitCheckReceiveStatusText }, | 
|---|
|  |  |  | files: { | 
|---|
|  |  |  | type: 'url', | 
|---|
|  |  |  | //@ts-ignore | 
|---|
|  |  |  | formatter: (row: API.GetCheckReceiveTaskUserSubmitsQueryResultItem) => | 
|---|
|  |  |  | row.files?.length > 0 && (row.files ?? []).map((x) => setOSSLink(x)), | 
|---|
|  |  |  | showDownloadBtn: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleDownload(row) {} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | function handleDownload(row: API.GetCheckReceiveTaskUserSubmitsQueryResultItem) { | 
|---|
|  |  |  | if (row.files?.length > 0) { | 
|---|
|  |  |  | downloadWithZip( | 
|---|
|  |  |  | row.files.map((x) => ({ | 
|---|
|  |  |  | data: `${setOSSLink(x)}`, | 
|---|
|  |  |  | })), | 
|---|
|  |  |  | '验收照片' | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style lang="scss" scoped> | 
|---|
|  |  |  | @use '@/style/common.scss' as *; | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | async function checkReceiveTask( | 
|---|
|  |  |  | row: API.GetCheckReceiveTaskUserSubmitsQueryResultItem, | 
|---|
|  |  |  | checkReceiveStatus: EnumTaskUserSubmitCheckReceiveStatus | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let params: API.CheckReceiveTaskCommand = { | 
|---|
|  |  |  | id: row.id, | 
|---|
|  |  |  | checkReceiveStatus: checkReceiveStatus, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await taskCheckReceiveServices.checkReceiveTask(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('操作成功'); | 
|---|
|  |  |  | getList(paginationState.pageIndex); | 
|---|
|  |  |  | eventContext.emit('checkReceiveTask'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|