| | |
| | | name: 'PackerDataList' |
| | | }); |
| | | |
| | | |
| | | const appStore = useAppStore(); |
| | | const { download } = useDownload(); |
| | | const { hasAuth } = useAuth(); |
| | |
| | | params: { |
| | | beginTime: `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-${String(new Date().getDate()).padStart(2, '0')} 00:00:00`, |
| | | endTime: `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-${String(new Date().getDate()).padStart(2, '0')} 23:59:59` |
| | | }, |
| | | } |
| | | }); |
| | | |
| | | const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } = |
| | | useNaivePaginatedTable({ |
| | | api: () => fetchGetPackerDataList(searchParams.value), |
| | | transform: response => defaultTransform(response), |
| | | onPaginationParamsChange: params => { |
| | | searchParams.value.pageNum = params.page; |
| | | searchParams.value.pageSize = params.pageSize; |
| | | }, |
| | | columns: () => [ |
| | | { |
| | | type: 'selection', |
| | | align: 'center', |
| | | width: 48 |
| | | api: () => fetchGetPackerDataList(searchParams.value), |
| | | transform: response => defaultTransform(response), |
| | | onPaginationParamsChange: params => { |
| | | searchParams.value.pageNum = params.page; |
| | | searchParams.value.pageSize = params.pageSize; |
| | | }, |
| | | { |
| | | key: 'index', |
| | | title: $t('common.index'), |
| | | align: 'center', |
| | | width: 64, |
| | | render: (_, index) => index + 1 |
| | | }, |
| | | { |
| | | key: 'time', |
| | | title: '时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'key', |
| | | title: 'key', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'online', |
| | | title: '网络状态(0异常,1正常)', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'qty', |
| | | title: '产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'badQty', |
| | | title: '剔除产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'xiaohemoVal', |
| | | title: '小盒膜消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tiaohemoVal', |
| | | title: '条盒膜消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'xiaohezhiVal', |
| | | title: '小盒纸消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tiaohezhiVal', |
| | | title: '条盒纸消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'neichenzhiVal', |
| | | title: '内衬纸消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'runTime', |
| | | title: '运行时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'stopTime', |
| | | title: '停机时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'stopTimes', |
| | | title: '停机次数', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'speed', |
| | | title: '车速', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'runStatus', |
| | | title: '运行状态(-1 断网 0停止 1低速运行 2正常运行)', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tsQty', |
| | | title: '提升机产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'mainQty', |
| | | title: '主机产量(小包机)', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'mainBadQty', |
| | | title: '主机剔除量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tbjQty', |
| | | title: '透包机产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tbjGdQty', |
| | | title: '透包机剔除好包', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tbjBadQty', |
| | | title: '透包机剔除坏包', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'pbjQty', |
| | | title: '排包机产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'shift', |
| | | title: '班次', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'equNo', |
| | | title: '设备', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'operate', |
| | | title: $t('common.operate'), |
| | | align: 'center', |
| | | width: 130, |
| | | render: row => { |
| | | const divider = () => { |
| | | if (!hasAuth('qa:packerData:edit') || !hasAuth('qa:packerData:remove')) { |
| | | return null; |
| | | } |
| | | return <NDivider vertical />; |
| | | }; |
| | | columns: () => [ |
| | | { |
| | | type: 'selection', |
| | | align: 'center', |
| | | width: 48 |
| | | }, |
| | | { |
| | | key: 'index', |
| | | title: $t('common.index'), |
| | | align: 'center', |
| | | width: 64, |
| | | render: (_, index) => index + 1 |
| | | }, |
| | | { |
| | | key: 'time', |
| | | title: '时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'key', |
| | | title: 'key', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'online', |
| | | title: '网络状态(0异常,1正常)', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'qty', |
| | | title: '产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'badQty', |
| | | title: '剔除产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'xiaohemoVal', |
| | | title: '小盒膜消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tiaohemoVal', |
| | | title: '条盒膜消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'xiaohezhiVal', |
| | | title: '小盒纸消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tiaohezhiVal', |
| | | title: '条盒纸消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'neichenzhiVal', |
| | | title: '内衬纸消耗', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'runTime', |
| | | title: '运行时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'stopTime', |
| | | title: '停机时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'stopTimes', |
| | | title: '停机次数', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'speed', |
| | | title: '车速', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'runStatus', |
| | | title: '运行状态(-1 断网 0停止 1低速运行 2正常运行)', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tsQty', |
| | | title: '提升机产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'mainQty', |
| | | title: '主机产量(小包机)', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'mainBadQty', |
| | | title: '主机剔除量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tbjQty', |
| | | title: '透包机产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tbjGdQty', |
| | | title: '透包机剔除好包', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tbjBadQty', |
| | | title: '透包机剔除坏包', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'pbjQty', |
| | | title: '排包机产量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'shift', |
| | | title: '班次', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'equNo', |
| | | title: '设备', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'operate', |
| | | title: $t('common.operate'), |
| | | align: 'center', |
| | | width: 130, |
| | | render: row => { |
| | | const divider = () => { |
| | | if (!hasAuth('qa:packerData:edit') || !hasAuth('qa:packerData:remove')) { |
| | | return null; |
| | | } |
| | | return <NDivider vertical />; |
| | | }; |
| | | |
| | | const editBtn = () => { |
| | | if (!hasAuth('qa:packerData:edit')) { |
| | | return null; |
| | | } |
| | | const editBtn = () => { |
| | | if (!hasAuth('qa:packerData:edit')) { |
| | | return null; |
| | | } |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="primary" |
| | | icon="material-symbols:drive-file-rename-outline-outline" |
| | | tooltipContent={$t('common.edit')} |
| | | onClick={() => edit(row.time)} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | const deleteBtn = () => { |
| | | if (!hasAuth('qa:packerData:remove')) { |
| | | return null; |
| | | } |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="error" |
| | | icon="material-symbols:delete-outline" |
| | | tooltipContent={$t('common.delete')} |
| | | popconfirmContent={$t('common.confirmDelete')} |
| | | onPositiveClick={() => handleDelete(row.time)} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="primary" |
| | | icon="material-symbols:drive-file-rename-outline-outline" |
| | | tooltipContent={$t('common.edit')} |
| | | onClick={() => edit(row.time)} |
| | | /> |
| | | <div class="flex-center gap-8px"> |
| | | {editBtn()} |
| | | {divider()} |
| | | {deleteBtn()} |
| | | </div> |
| | | ); |
| | | }; |
| | | |
| | | const deleteBtn = () => { |
| | | if (!hasAuth('qa:packerData:remove')) { |
| | | return null; |
| | | } |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="error" |
| | | icon="material-symbols:delete-outline" |
| | | tooltipContent={$t('common.delete')} |
| | | popconfirmContent={$t('common.confirmDelete')} |
| | | onPositiveClick={() => handleDelete(row.time)} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | return ( |
| | | <div class="flex-center gap-8px"> |
| | | {editBtn()} |
| | | {divider()} |
| | | {deleteBtn()} |
| | | </div> |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }); |
| | | ] |
| | | }); |
| | | |
| | | const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } = |
| | | useTableOperate(data, 'time', getData); |