old mode 100644
new mode 100755
| | |
| | | <script setup lang="tsx"> |
| | | import { ref } from 'vue'; |
| | | import { NDivider } from 'naive-ui'; |
| | | import { fetchBatchDeleteBatch, fetchGetBatchList } from '@/service/api/qm/batch'; |
| | | import { useAppStore } from '@/store/modules/app'; |
| | | import { useAuth } from '@/hooks/business/auth'; |
| | | import { useDownload } from '@/hooks/business/download'; |
| | | import { defaultTransform, useNaivePaginatedTable, useTableOperate } from '@/hooks/common/table'; |
| | | import { $t } from '@/locales'; |
| | | import {nextTick, ref} from 'vue'; |
| | | import {useRouter} from 'vue-router'; |
| | | import {NDivider, NDropdown} from 'naive-ui'; |
| | | import {fetchBatchDeleteBatch, fetchGetBatchList} from '@/service/api/qm/batch'; |
| | | import {useAppStore} from '@/store/modules/app'; |
| | | import {useAuth} from '@/hooks/business/auth'; |
| | | import {useDownload} from '@/hooks/business/download'; |
| | | import {useSvgIcon} from '@/hooks/common/icon'; |
| | | import {defaultTransform, useNaivePaginatedTable, useTableOperate} from '@/hooks/common/table'; |
| | | import {$t} from '@/locales'; |
| | | import ButtonIcon from '@/components/custom/button-icon.vue'; |
| | | import BatchOperateDrawer from './modules/batch-operate-drawer.vue'; |
| | | import BatchSearch from './modules/batch-search.vue'; |
| | |
| | | name: 'BatchList' |
| | | }); |
| | | |
| | | |
| | | const appStore = useAppStore(); |
| | | const { download } = useDownload(); |
| | | const { hasAuth } = useAuth(); |
| | | const router = useRouter(); |
| | | const {download} = useDownload(); |
| | | const {hasAuth} = useAuth(); |
| | | const {SvgIconVNode} = useSvgIcon(); |
| | | |
| | | // 右键菜单相关 |
| | | const showDropdown = ref(false); |
| | | const x = ref(0); |
| | | const y = ref(0); |
| | | const currentRow = ref<Api.Qm.Batch | null>(null); |
| | | |
| | | const dropdownOptions = [ |
| | | { |
| | | label: '原始数据维护', |
| | | key: 'raw-data-maintenance', |
| | | icon: SvgIconVNode({icon: 'mdi:database-edit-outline', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '综合测试台数据维护', |
| | | key: 'test-bench-maintenance', |
| | | icon: SvgIconVNode({icon: 'mdi:monitor-dashboard', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '新建复检批次', |
| | | key: 'new-recheck-batch', |
| | | icon: SvgIconVNode({icon: 'mdi:plus-circle-outline', fontSize: 18}) |
| | | }, |
| | | { |
| | | type: 'divider', |
| | | key: 'd1' |
| | | }, |
| | | { |
| | | label: '卷包卷制检验结果报告', |
| | | key: 'report-rolling', |
| | | icon: SvgIconVNode({icon: 'mdi:file-document-outline', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '包装标识检验原始记录', |
| | | key: 'record-packaging', |
| | | icon: SvgIconVNode({icon: 'mdi:barcode-scan', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '熄火、含水率、含末率原始记录', |
| | | key: 'record-quality', |
| | | icon: SvgIconVNode({icon: 'mdi:water-percent', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '端部落丝原始记录', |
| | | key: 'record-silk', |
| | | icon: SvgIconVNode({icon: 'mdi:format-list-bulleted-type', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '综合测试台原始记录', |
| | | key: 'record-bench', |
| | | icon: SvgIconVNode({icon: 'mdi:chart-line', fontSize: 18}) |
| | | }, |
| | | { |
| | | label: '外观检验原始记录', |
| | | key: 'record-appearance', |
| | | icon: SvgIconVNode({icon: 'mdi:eye-outline', fontSize: 18}) |
| | | }, |
| | | { |
| | | type: 'divider', |
| | | key: 'd2' |
| | | }, |
| | | { |
| | | label: $t('common.edit'), |
| | | key: 'edit', |
| | | icon: SvgIconVNode({icon: 'material-symbols:drive-file-rename-outline-outline', fontSize: 18}), |
| | | show: hasAuth('qm:batch:edit') |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | key: 'delete', |
| | | icon: SvgIconVNode({icon: 'material-symbols:delete-outline', fontSize: 18}), |
| | | show: hasAuth('qm:batch:remove') |
| | | } |
| | | ]; |
| | | |
| | | function handleSelect(key: string) { |
| | | showDropdown.value = false; |
| | | if (!currentRow.value) return; |
| | | |
| | | if (key === 'edit') { |
| | | edit(currentRow.value.id); |
| | | } else if (key === 'delete') { |
| | | window.$dialog?.error({ |
| | | title: $t('common.confirmDelete'), |
| | | content: $t('common.confirmDelete'), |
| | | positiveText: $t('common.confirm'), |
| | | negativeText: $t('common.cancel'), |
| | | onPositiveClick: () => { |
| | | handleDelete(currentRow.value!.id); |
| | | } |
| | | }); |
| | | } else if (key === 'raw-data-maintenance') { |
| | | // 跳转到 matcheck 页面 |
| | | if (!currentRow.value.judgeCode) { |
| | | window.$message?.warning('该批次没有判定依据'); |
| | | return; |
| | | } |
| | | router.push({ |
| | | path: '/qm/matcheck', |
| | | query: { |
| | | judgeCode: currentRow.value.judgeCode, |
| | | batchCode: currentRow.value.batchCode, |
| | | matCode: currentRow.value.matCode |
| | | } |
| | | }); |
| | | } else { |
| | | // 处理其他业务操作 |
| | | window.$message?.info(`点击了: ${key}`); |
| | | } |
| | | } |
| | | |
| | | function handleRowProps(row: Api.Qm.Batch) { |
| | | return { |
| | | onContextmenu: (e: MouseEvent) => { |
| | | e.preventDefault(); |
| | | showDropdown.value = false; |
| | | nextTick().then(() => { |
| | | currentRow.value = row; |
| | | x.value = e.clientX; |
| | | y.value = e.clientY; |
| | | showDropdown.value = true; |
| | | }); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | // 类型/反馈MES/类别的 value->label 映射(用于表格显示) |
| | | const TYP_MAP: Record<string, string> = { A: '制丝', B: '成型', C: '卷包', D: '封箱', E: '糖香料' }; |
| | | const FLAG_MAP: Record<string, string> = { '0': '未上传mes', '1': '已上传', '3': '从MES下载' }; |
| | | const CATEGORY_MAP: Record<string, string> = { '0': '成品', '1': '辅材' }; |
| | | const FLAG_MAP: Record<string, string> = {'0': '未上传mes', '1': '已上传', '3': '从MES下载'}; |
| | | const CATEGORY_MAP: Record<string, string> = {'0': '成品', '1': '辅材'}; |
| | | |
| | | const searchParams = ref<Api.Qm.BatchSearchParams>({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | batchCode: null, |
| | | isflag: '1', |
| | | typ: null, |
| | | eqpCode: null, |
| | | matCode: null, |
| | |
| | | flag: null, |
| | | toMesDate: null, |
| | | fromMesDate: null, |
| | | deleted: null, |
| | | category: null, |
| | | enabled: '1', |
| | | deleted: 0, |
| | | category: '0', |
| | | state: null, |
| | | params: {} |
| | | params: { |
| | | beginBatchDate: `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-${String(new Date().getDate()).padStart(2, '0')} 00:00:00`, |
| | | endBatchDate: `${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 } = |
| | | const {columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX} = |
| | | useNaivePaginatedTable({ |
| | | api: () => fetchGetBatchList(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: () => fetchGetBatchList(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: 'id', |
| | | title: '编码', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'batchCode', |
| | | title: '批次代码', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'batchName', |
| | | title: '批次名称', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'typ', |
| | | title: '类型', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => TYP_MAP[row.typ] ?? row.typ |
| | | }, |
| | | { |
| | | key: 'eqpCode', |
| | | title: '机台代码', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'matCode', |
| | | title: '牌号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'judgeCode', |
| | | title: '判定依据代码', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'batchDate', |
| | | title: '批次生成日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'isflag', |
| | | title: '使用标志', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'enabled', |
| | | title: '启用标志', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'totalNum', |
| | | title: '到货总量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'results', |
| | | title: '综合判定', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'approver', |
| | | title: '批准人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'auditor', |
| | | title: '审核人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'creater', |
| | | title: '创建人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tabDate', |
| | | title: '制表日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'verName', |
| | | title: '版本名称', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'verCode', |
| | | title: '版本编号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'archDate', |
| | | title: '保存期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'flag', |
| | | title: '反馈MES', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => FLAG_MAP[String(row.flag)] ?? row.flag |
| | | }, |
| | | { |
| | | key: 'toMesDate', |
| | | title: '上传MES时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'fromMesDate', |
| | | title: '从MES时间下载', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'deleted', |
| | | title: '删除标志', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'batchDes', |
| | | title: '批次描述', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'category', |
| | | title: '类别', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => CATEGORY_MAP[String(row.category)] ?? row.category |
| | | }, |
| | | { |
| | | key: 'makeno', |
| | | title: '卷制工号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'shifteqpno', |
| | | title: '班次机号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'boxno', |
| | | title: '装箱号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'pid', |
| | | title: '父批次号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'reviewer', |
| | | title: '复核人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'rvcount', |
| | | title: '复检次数', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'state', |
| | | title: '批次状态', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'reviewTime', |
| | | title: '复核日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'auditTime', |
| | | title: '审核日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'spec', |
| | | title: '规格', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'approveTime', |
| | | title: '批准时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'unit', |
| | | title: '到货单位', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'arrivalTime', |
| | | title: '到货日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'storagePlace', |
| | | title: '存放地点', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'checker', |
| | | title: '检验员', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'receiveTime', |
| | | title: '接单日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'inspTime', |
| | | title: '报检日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'storer', |
| | | title: '仓库保管员', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'isverify', |
| | | title: '是否验证', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'ischk', |
| | | title: '是否检验', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'bak1', |
| | | title: '备用1', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'bak2', |
| | | title: '备用2', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'operate', |
| | | title: $t('common.operate'), |
| | | align: 'center', |
| | | width: 130, |
| | | render: row => { |
| | | const divider = () => { |
| | | if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch: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: 'batchCode', |
| | | title: '批次号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'matName', |
| | | title: '牌号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'judgeName', |
| | | title: '判定依据', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'batchDate', |
| | | title: '批次生成日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'isflag', |
| | | title: '使用标志', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => (row.isflag == '1' ? '是' : '否') |
| | | }, |
| | | { |
| | | key: 'enabled', |
| | | title: '启用标志', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => (row.enabled == '1' ? '是' : '否') |
| | | }, |
| | | { |
| | | key: 'totalNum', |
| | | title: '到货总量', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'results', |
| | | title: '综合判定', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'approver', |
| | | title: '批准人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'auditor', |
| | | title: '审核人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'creater', |
| | | title: '创建人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'tabDate', |
| | | title: '制表日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'verName', |
| | | title: '版本名称', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'verCode', |
| | | title: '版本编号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'archDate', |
| | | title: '保存期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'flag', |
| | | title: '反馈MES', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => FLAG_MAP[String(row.flag)] ?? row.flag |
| | | }, |
| | | { |
| | | key: 'toMesDate', |
| | | title: '上传MES时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'fromMesDate', |
| | | title: '从MES时间下载', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'deleted', |
| | | title: '删除标志', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => (row.deleted == 1 ? '是' : '否') |
| | | }, |
| | | { |
| | | key: 'batchDes', |
| | | title: '批次描述', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'category', |
| | | title: '类别', |
| | | align: 'center', |
| | | minWidth: 120, |
| | | render: row => CATEGORY_MAP[String(row.category)] ?? row.category |
| | | }, |
| | | { |
| | | key: 'makeno', |
| | | title: '卷制工号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'shifteqpno', |
| | | title: '班次机号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'boxno', |
| | | title: '装箱号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'pid', |
| | | title: '父批次号', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'reviewer', |
| | | title: '复核人', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'rvcount', |
| | | title: '复检次数', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'state', |
| | | title: '批次状态', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'reviewTime', |
| | | title: '复核日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'auditTime', |
| | | title: '审核日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'spec', |
| | | title: '规格', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'approveTime', |
| | | title: '批准时间', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'unit', |
| | | title: '到货单位', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'arrivalTime', |
| | | title: '到货日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'storagePlace', |
| | | title: '存放地点', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'checker', |
| | | title: '检验员', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'receiveTime', |
| | | title: '接单日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'inspTime', |
| | | title: '报检日期', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'storer', |
| | | title: '仓库保管员', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'isverify', |
| | | title: '是否验证', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'ischk', |
| | | title: '是否检验', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'bak1', |
| | | title: '备用1', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'bak2', |
| | | title: '备用2', |
| | | align: 'center', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | key: 'operate', |
| | | title: $t('common.operate'), |
| | | fixed: 'right', |
| | | align: 'center', |
| | | width: 130, |
| | | render: row => { |
| | | const divider = () => { |
| | | if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch:remove')) { |
| | | return null; |
| | | } |
| | | return <NDivider vertical/>; |
| | | }; |
| | | |
| | | const editBtn = () => { |
| | | if (!hasAuth('qm:batch:edit')) { |
| | | return null; |
| | | } |
| | | const editBtn = () => { |
| | | if (!hasAuth('qm:batch:edit')) { |
| | | return null; |
| | | } |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="primary" |
| | | icon="material-symbols:drive-file-rename-outline-outline" |
| | | tooltipContent={$t('common.edit')} |
| | | onClick={() => edit(row.id)} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | const deleteBtn = () => { |
| | | if (!hasAuth('qm:batch:remove')) { |
| | | return null; |
| | | } |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="error" |
| | | icon="material-symbols:delete-outline" |
| | | tooltipContent={$t('common.delete')} |
| | | popconfirmContent={$t('common.confirmDelete')} |
| | | onPositiveClick={() => handleDelete(row.id)} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="primary" |
| | | icon="material-symbols:drive-file-rename-outline-outline" |
| | | tooltipContent={$t('common.edit')} |
| | | onClick={() => edit(row.id)} |
| | | /> |
| | | <div class="flex-center gap-8px"> |
| | | {editBtn()} |
| | | {divider()} |
| | | {deleteBtn()} |
| | | </div> |
| | | ); |
| | | }; |
| | | |
| | | const deleteBtn = () => { |
| | | if (!hasAuth('qm:batch:remove')) { |
| | | return null; |
| | | } |
| | | return ( |
| | | <ButtonIcon |
| | | text |
| | | type="error" |
| | | icon="material-symbols:delete-outline" |
| | | tooltipContent={$t('common.delete')} |
| | | popconfirmContent={$t('common.confirmDelete')} |
| | | onPositiveClick={() => handleDelete(row.id)} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | return ( |
| | | <div class="flex-center gap-8px"> |
| | | {editBtn()} |
| | | {divider()} |
| | | {deleteBtn()} |
| | | </div> |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }); |
| | | ] |
| | | }); |
| | | |
| | | const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } = |
| | | const {drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted} = |
| | | useTableOperate(data, 'id', getData); |
| | | |
| | | async function handleBatchDelete() { |
| | | // request |
| | | const { error } = await fetchBatchDeleteBatch(checkedRowKeys.value); |
| | | const {error} = await fetchBatchDeleteBatch(checkedRowKeys.value); |
| | | if (error) return; |
| | | onBatchDeleted(); |
| | | } |
| | | |
| | | async function handleDelete(id: CommonType.IdType) { |
| | | // request |
| | | const { error } = await fetchBatchDeleteBatch([id]); |
| | | const {error} = await fetchBatchDeleteBatch([id]); |
| | | if (error) return; |
| | | onDeleted(); |
| | | } |
| | |
| | | |
| | | <template> |
| | | <div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto"> |
| | | <BatchSearch v-model:model="searchParams" @search="getDataByPage" /> |
| | | <BatchSearch v-model:model="searchParams" @search="getDataByPage"/> |
| | | <NCard title="检验批次列表" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden"> |
| | | <template #header-extra> |
| | | <TableHeaderOperation |
| | |
| | | remote |
| | | :row-key="row => row.id" |
| | | :pagination="mobilePagination" |
| | | :row-props="handleRowProps" |
| | | class="sm:h-full" |
| | | /> |
| | | <NDropdown |
| | | placement="bottom-start" |
| | | trigger="manual" |
| | | :x="x" |
| | | :y="y" |
| | | :options="dropdownOptions" |
| | | :show="showDropdown" |
| | | :on-clickoutside="() => (showDropdown = false)" |
| | | @select="handleSelect" |
| | | /> |
| | | <BatchOperateDrawer |
| | | v-model:visible="drawerVisible" |
| | | :operate-type="operateType" |