feat(mes): 新增 md workstation 的迁移
parent
2a868b809f
commit
59cc3bbd61
|
|
@ -5,12 +5,12 @@ import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictLabel } from '@vben/hooks';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, Card, message, Modal } from 'ant-design-vue';
|
||||
import { Button, Card, message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const showClear = computed(
|
|||
|
||||
/** 根据工作站编号回显选择器 */
|
||||
async function resolveItemById(id: number | undefined) {
|
||||
if (id === null) {
|
||||
if (id == null) {
|
||||
selectedItem.value = undefined;
|
||||
return;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ async function resolveItemById(id: number | undefined) {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
selectedItem.value = await getWorkstation(id as number);
|
||||
selectedItem.value = await getWorkstation(id);
|
||||
} catch (error) {
|
||||
console.error('[MdWorkstationSelect] resolveItemById failed:', error);
|
||||
}
|
||||
|
|
@ -90,8 +90,8 @@ function handleClick(event: MouseEvent) {
|
|||
clearSelected();
|
||||
return;
|
||||
}
|
||||
const selectedIds = props.modelValue === null ? [] : [props.modelValue];
|
||||
dialogRef.value?.open(selectedIds as number[], { multiple: false });
|
||||
const selectedIds = props.modelValue == null ? [] : [props.modelValue];
|
||||
dialogRef.value?.open(selectedIds, { multiple: false });
|
||||
}
|
||||
|
||||
/** 回填选中的工作站 */
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|||
import type { MesProRouteApi } from '#/api/mes/pro/route';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
||||
import { getDictLabel } from '@vben/hooks';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message, Modal, Tooltip } from 'ant-design-vue';
|
||||
import { Button, message, Tooltip } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -55,19 +55,12 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MesProRouteApi.Route,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
Modal.confirm({
|
||||
content: `确认要将"${row.name}"工艺路线切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
async onOk() {
|
||||
await updateRouteStatus(row.id!, newStatus);
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
},
|
||||
onCancel() {
|
||||
reject(new Error('取消操作'));
|
||||
},
|
||||
});
|
||||
});
|
||||
await confirm(
|
||||
`确认要将"${row.name}"工艺路线切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
);
|
||||
await updateRouteStatus(row.id!, newStatus);
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 删除(仅停用状态可删除) */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
<script lang="ts" setup>
|
||||
import type { MesProWorkRecordApi } from '#/api/mes/pro/workrecord';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { confirm } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { Button, message, Modal, Tag } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
clockInWorkRecord,
|
||||
clockOutWorkRecord,
|
||||
getMyWorkRecord,
|
||||
} from '#/api/mes/pro/workrecord';
|
||||
import MdWorkstationSelect from '#/views/mes/md/workstation/components/md-workstation-select.vue';
|
||||
import { MesProWorkRecordTypeEnum } from '#/views/mes/utils/constants';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'change'): void;
|
||||
}>();
|
||||
|
||||
const myWorkstation = ref<MesProWorkRecordApi.MyWorkRecord | null>(null); // 当前用户绑定的工作站状态
|
||||
const clockInModalVisible = ref(false); // 上工弹窗是否可见
|
||||
const selectedWorkstationId = ref<number>(); // 当前选中的工作站编号
|
||||
|
||||
const isClockIn = computed(() => // 是否处于上工状态
|
||||
myWorkstation.value?.type === MesProWorkRecordTypeEnum.CLOCK_IN,
|
||||
);
|
||||
|
||||
/** 加载当前用户工作站 */
|
||||
async function loadMyWorkstation() {
|
||||
myWorkstation.value = await getMyWorkRecord();
|
||||
}
|
||||
|
||||
/** 打开上工弹窗 */
|
||||
function handleOpenClockIn() {
|
||||
selectedWorkstationId.value = undefined;
|
||||
clockInModalVisible.value = true;
|
||||
}
|
||||
|
||||
/** 上工 */
|
||||
async function handleClockIn() {
|
||||
if (!selectedWorkstationId.value) {
|
||||
return;
|
||||
}
|
||||
await clockInWorkRecord(selectedWorkstationId.value);
|
||||
message.success('上工成功');
|
||||
clockInModalVisible.value = false;
|
||||
selectedWorkstationId.value = undefined;
|
||||
await loadMyWorkstation();
|
||||
emit('change');
|
||||
}
|
||||
|
||||
/** 下工 */
|
||||
async function handleClockOut() {
|
||||
await confirm('确认下工当前工作站?');
|
||||
await clockOutWorkRecord();
|
||||
message.success('下工成功');
|
||||
await loadMyWorkstation();
|
||||
emit('change');
|
||||
}
|
||||
|
||||
onMounted(loadMyWorkstation);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="bg-card mb-3 flex items-center justify-between rounded border p-3"
|
||||
>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<span class="text-sm font-semibold">我的工作站</span>
|
||||
<template v-if="isClockIn">
|
||||
<Tag color="success">
|
||||
<IconifyIcon class="mr-1 inline-block size-4" icon="lucide:check" />
|
||||
{{ myWorkstation!.workstationCode }} -
|
||||
{{ myWorkstation!.workstationName }}
|
||||
</Tag>
|
||||
<span class="text-muted-foreground text-xs">
|
||||
上工时间:{{ formatDateTime(myWorkstation!.clockInTime as Date) }}
|
||||
</span>
|
||||
</template>
|
||||
<Tag v-else>当前未上工</Tag>
|
||||
</div>
|
||||
<div>
|
||||
<Button v-if="!isClockIn" type="primary" @click="handleOpenClockIn">
|
||||
<IconifyIcon class="mr-1 inline-block size-4" icon="lucide:play" />
|
||||
上工
|
||||
</Button>
|
||||
<Button v-else danger @click="handleClockOut">
|
||||
<IconifyIcon class="mr-1 inline-block size-4" icon="lucide:pause" />
|
||||
下工
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Modal
|
||||
v-model:open="clockInModalVisible"
|
||||
:ok-button-props="{ disabled: !selectedWorkstationId }"
|
||||
title="选择工作站"
|
||||
width="420px"
|
||||
@ok="handleClockIn"
|
||||
>
|
||||
<MdWorkstationSelect
|
||||
v-model="selectedWorkstationId"
|
||||
class="w-full"
|
||||
placeholder="请选择工作站"
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesProWorkRecordApi } from '#/api/mes/pro/workrecord';
|
||||
import type { SystemUserApi } from '#/api/system/user';
|
||||
|
||||
import { markRaw } from 'vue';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
import MdWorkstationSelect from '#/views/mes/md/workstation/components/md-workstation-select.vue';
|
||||
|
||||
/** 关联数据 */
|
||||
let userList: SystemUserApi.User[] = [];
|
||||
getSimpleUserList().then((data) => (userList = data));
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'userId',
|
||||
label: '用户',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
placeholder: '请选择用户',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'workstationId',
|
||||
label: '工作站',
|
||||
component: markRaw(MdWorkstationSelect),
|
||||
componentProps: {
|
||||
placeholder: '请选择工作站',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'type',
|
||||
label: '操作类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.MES_PRO_WORK_RECORD_TYPE, 'number'),
|
||||
placeholder: '请选择操作类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '操作时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions<MesProWorkRecordApi.WorkRecordLog>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
field: 'userId',
|
||||
title: '用户',
|
||||
width: 140,
|
||||
formatter: ({ row }) =>
|
||||
row.userNickname ||
|
||||
userList.find((user) => user.id === row.userId)?.nickname ||
|
||||
'',
|
||||
},
|
||||
{
|
||||
field: 'workstationCode',
|
||||
title: '工作站编码',
|
||||
width: 140,
|
||||
},
|
||||
{
|
||||
field: 'workstationName',
|
||||
title: '工作站名称',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '操作类型',
|
||||
width: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.MES_PRO_WORK_RECORD_TYPE },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
width: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesProWorkRecordApi } from '#/api/mes/pro/workrecord';
|
||||
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
exportWorkRecordLog,
|
||||
getWorkRecordLogPage,
|
||||
} from '#/api/mes/pro/workrecord';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import WorkRecordStatusBar from './components/work-record-status-bar.vue';
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportWorkRecordLog(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '工作记录.xls', source: data });
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getWorkRecordLogPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<MesProWorkRecordApi.WorkRecordLog>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【生产】工作记录"
|
||||
url="https://doc.iocoder.cn/mes/pro/work-record/"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<WorkRecordStatusBar @change="handleRefresh" />
|
||||
|
||||
<Grid table-title="工作记录列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['mes:pro-workrecord:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProWorkRecordApi {
|
||||
/** MES 工作记录流水 */
|
||||
export interface WorkRecordLog {
|
||||
id?: number; // 编号
|
||||
userId?: number; // 用户编号
|
||||
userNickname?: string; // 用户昵称
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
type?: number; // 1=上工 2=下工
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
|
||||
/** MES 当前用户工作站绑定状态 */
|
||||
export interface MyWorkRecord {
|
||||
userId?: number; // 用户编号
|
||||
userNickname?: string; // 用户昵称
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
type?: number; // 1=上工 2=下工
|
||||
clockInTime?: Date; // 上工时间
|
||||
clockOutTime?: Date; // 下工时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询工作记录分页 */
|
||||
export function getWorkRecordLogPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesProWorkRecordApi.WorkRecordLog>>(
|
||||
'/mes/pro/workrecord/log/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工作记录详情 */
|
||||
export function getWorkRecordLog(id: number) {
|
||||
return requestClient.get<MesProWorkRecordApi.WorkRecordLog>(
|
||||
`/mes/pro/workrecord/log/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出工作记录 */
|
||||
export function exportWorkRecordLog(params: any) {
|
||||
return requestClient.download('/mes/pro/workrecord/log/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 上工(绑定工作站) */
|
||||
export function clockInWorkRecord(workstationId: number) {
|
||||
return requestClient.put('/mes/pro/workrecord/clock-in', null, {
|
||||
params: { workstationId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 下工(解绑工作站) */
|
||||
export function clockOutWorkRecord() {
|
||||
return requestClient.put('/mes/pro/workrecord/clock-out');
|
||||
}
|
||||
|
||||
/** 查询当前用户绑定的工作站 */
|
||||
export function getMyWorkRecord() {
|
||||
return requestClient.get<MesProWorkRecordApi.MyWorkRecord>(
|
||||
'/mes/pro/workrecord/get-my',
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcDefectApi {
|
||||
/** MES 缺陷类型 */
|
||||
export interface Defect {
|
||||
id?: number; // 编号
|
||||
code?: string; // 缺陷编码
|
||||
name?: string; // 缺陷描述
|
||||
type?: number; // 检测项类型
|
||||
level?: number; // 缺陷等级
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询缺陷类型分页 */
|
||||
export function getDefectPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesQcDefectApi.Defect>>(
|
||||
'/mes/qc/defect/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询缺陷类型精简列表 */
|
||||
export function getDefectSimpleList() {
|
||||
return requestClient.get<MesQcDefectApi.Defect[]>('/mes/qc/defect/simple-list');
|
||||
}
|
||||
|
||||
/** 查询缺陷类型详情 */
|
||||
export function getDefect(id: number) {
|
||||
return requestClient.get<MesQcDefectApi.Defect>(`/mes/qc/defect/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增缺陷类型 */
|
||||
export function createDefect(data: MesQcDefectApi.Defect) {
|
||||
return requestClient.post('/mes/qc/defect/create', data);
|
||||
}
|
||||
|
||||
/** 修改缺陷类型 */
|
||||
export function updateDefect(data: MesQcDefectApi.Defect) {
|
||||
return requestClient.put('/mes/qc/defect/update', data);
|
||||
}
|
||||
|
||||
/** 删除缺陷类型 */
|
||||
export function deleteDefect(id: number) {
|
||||
return requestClient.delete(`/mes/qc/defect/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出缺陷类型 */
|
||||
export function exportDefect(params: any) {
|
||||
return requestClient.download('/mes/qc/defect/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcIndicatorApi {
|
||||
/** MES 质检指标 */
|
||||
export interface Indicator {
|
||||
id?: number; // 编号
|
||||
code?: string; // 检测项编码
|
||||
name?: string; // 检测项名称
|
||||
type?: number; // 检测项类型
|
||||
tool?: string; // 检测工具
|
||||
resultType?: number; // 结果值类型
|
||||
resultSpecification?: string; // 结果值属性
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询质检指标分页 */
|
||||
export function getIndicatorPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesQcIndicatorApi.Indicator>>(
|
||||
'/mes/qc/indicator/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询质检指标详情 */
|
||||
export function getIndicator(id: number) {
|
||||
return requestClient.get<MesQcIndicatorApi.Indicator>(
|
||||
`/mes/qc/indicator/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增质检指标 */
|
||||
export function createIndicator(data: MesQcIndicatorApi.Indicator) {
|
||||
return requestClient.post('/mes/qc/indicator/create', data);
|
||||
}
|
||||
|
||||
/** 修改质检指标 */
|
||||
export function updateIndicator(data: MesQcIndicatorApi.Indicator) {
|
||||
return requestClient.put('/mes/qc/indicator/update', data);
|
||||
}
|
||||
|
||||
/** 删除质检指标 */
|
||||
export function deleteIndicator(id: number) {
|
||||
return requestClient.delete(`/mes/qc/indicator/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出质检指标 */
|
||||
export function exportIndicator(params: any) {
|
||||
return requestClient.download('/mes/qc/indicator/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcTemplateApi {
|
||||
/** MES 质检方案 */
|
||||
export interface Template {
|
||||
id?: number; // 编号
|
||||
code?: string; // 方案编号
|
||||
name?: string; // 方案名称
|
||||
types?: number[]; // 检测种类
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询质检方案分页 */
|
||||
export function getTemplatePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesQcTemplateApi.Template>>(
|
||||
'/mes/qc/template/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询质检方案详情 */
|
||||
export function getTemplate(id: number) {
|
||||
return requestClient.get<MesQcTemplateApi.Template>(
|
||||
`/mes/qc/template/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增质检方案 */
|
||||
export function createTemplate(data: MesQcTemplateApi.Template) {
|
||||
return requestClient.post('/mes/qc/template/create', data);
|
||||
}
|
||||
|
||||
/** 修改质检方案 */
|
||||
export function updateTemplate(data: MesQcTemplateApi.Template) {
|
||||
return requestClient.put('/mes/qc/template/update', data);
|
||||
}
|
||||
|
||||
/** 删除质检方案 */
|
||||
export function deleteTemplate(id: number) {
|
||||
return requestClient.delete(`/mes/qc/template/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出质检方案 */
|
||||
export function exportTemplate(params: any) {
|
||||
return requestClient.download('/mes/qc/template/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcTemplateIndicatorApi {
|
||||
/** MES 质检方案-检测指标项 */
|
||||
export interface TemplateIndicator {
|
||||
id?: number; // 编号
|
||||
templateId?: number; // 质检方案ID
|
||||
indicatorId?: number; // 质检指标ID
|
||||
checkMethod?: string; // 检测方法
|
||||
standardValue?: number; // 标准值
|
||||
unitMeasureId?: number; // 计量单位ID
|
||||
thresholdMax?: number; // 误差上限
|
||||
thresholdMin?: number; // 误差下限
|
||||
docUrl?: string; // 说明图URL
|
||||
remark?: string; // 备注
|
||||
indicatorCode?: string; // 检测项编码(JOIN)
|
||||
indicatorName?: string; // 检测项名称(JOIN)
|
||||
indicatorType?: number; // 检测项类型(JOIN)
|
||||
indicatorTool?: string; // 检测工具(JOIN)
|
||||
unitMeasureName?: string; // 计量单位名称(JOIN)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询检测指标项分页 */
|
||||
export function getTemplateIndicatorPage(params: PageParam & { templateId?: number }) {
|
||||
return requestClient.get<
|
||||
PageResult<MesQcTemplateIndicatorApi.TemplateIndicator>
|
||||
>('/mes/qc/template/indicator/page', { params });
|
||||
}
|
||||
|
||||
/** 查询检测指标项详情 */
|
||||
export function getTemplateIndicator(id: number) {
|
||||
return requestClient.get<MesQcTemplateIndicatorApi.TemplateIndicator>(
|
||||
`/mes/qc/template/indicator/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增检测指标项 */
|
||||
export function createTemplateIndicator(
|
||||
data: MesQcTemplateIndicatorApi.TemplateIndicator,
|
||||
) {
|
||||
return requestClient.post('/mes/qc/template/indicator/create', data);
|
||||
}
|
||||
|
||||
/** 修改检测指标项 */
|
||||
export function updateTemplateIndicator(
|
||||
data: MesQcTemplateIndicatorApi.TemplateIndicator,
|
||||
) {
|
||||
return requestClient.put('/mes/qc/template/indicator/update', data);
|
||||
}
|
||||
|
||||
/** 删除检测指标项 */
|
||||
export function deleteTemplateIndicator(id: number) {
|
||||
return requestClient.delete(`/mes/qc/template/indicator/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcTemplateItemApi {
|
||||
/** MES 质检方案-产品关联 */
|
||||
export interface TemplateItem {
|
||||
id?: number; // 编号
|
||||
templateId?: number; // 质检方案ID
|
||||
itemId?: number; // 产品物料ID
|
||||
quantityCheck?: number; // 最低检测数
|
||||
quantityUnqualified?: number; // 最大不合格数
|
||||
criticalRate?: number; // 最大致命缺陷率(%)
|
||||
majorRate?: number; // 最大严重缺陷率(%)
|
||||
minorRate?: number; // 最大轻微缺陷率(%)
|
||||
remark?: string; // 备注
|
||||
itemCode?: string; // 物料编码(JOIN)
|
||||
itemName?: string; // 物料名称(JOIN)
|
||||
specification?: string; // 规格型号(JOIN)
|
||||
unitMeasureName?: string; // 计量单位名称(JOIN)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品关联分页 */
|
||||
export function getTemplateItemPage(params: PageParam & { templateId?: number }) {
|
||||
return requestClient.get<PageResult<MesQcTemplateItemApi.TemplateItem>>(
|
||||
'/mes/qc/template/item/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品关联详情 */
|
||||
export function getTemplateItem(id: number) {
|
||||
return requestClient.get<MesQcTemplateItemApi.TemplateItem>(
|
||||
`/mes/qc/template/item/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增产品关联 */
|
||||
export function createTemplateItem(data: MesQcTemplateItemApi.TemplateItem) {
|
||||
return requestClient.post('/mes/qc/template/item/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品关联 */
|
||||
export function updateTemplateItem(data: MesQcTemplateItemApi.TemplateItem) {
|
||||
return requestClient.put('/mes/qc/template/item/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品关联 */
|
||||
export function deleteTemplateItem(id: number) {
|
||||
return requestClient.delete(`/mes/qc/template/item/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesWmBarcodeConfigApi {
|
||||
/** MES 条码配置 */
|
||||
export interface BarcodeConfig {
|
||||
id?: number; // 编号
|
||||
format?: number; // 条码格式
|
||||
bizType?: number; // 业务类型
|
||||
contentFormat?: string; // 内容格式模板
|
||||
contentExample?: string; // 内容样例
|
||||
autoGenerateFlag?: boolean; // 是否自动生成
|
||||
defaultTemplate?: string; // 默认打印模板
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询条码配置分页 */
|
||||
export function getBarcodeConfigPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesWmBarcodeConfigApi.BarcodeConfig>>(
|
||||
'/mes/wm/barcode-config/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询条码配置详情 */
|
||||
export function getBarcodeConfig(id: number) {
|
||||
return requestClient.get<MesWmBarcodeConfigApi.BarcodeConfig>(
|
||||
`/mes/wm/barcode-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增条码配置 */
|
||||
export function createBarcodeConfig(data: MesWmBarcodeConfigApi.BarcodeConfig) {
|
||||
return requestClient.post('/mes/wm/barcode-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改条码配置 */
|
||||
export function updateBarcodeConfig(data: MesWmBarcodeConfigApi.BarcodeConfig) {
|
||||
return requestClient.put('/mes/wm/barcode-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除条码配置 */
|
||||
export function deleteBarcodeConfig(id: number) {
|
||||
return requestClient.delete(`/mes/wm/barcode-config/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ export function getBarcode(id: number) {
|
|||
export function getBarcodeByBusiness(bizType: number, bizId: number) {
|
||||
return requestClient.get<MesWmBarcodeApi.Barcode>(
|
||||
'/mes/wm/barcode/get-by-business',
|
||||
{ params: { bizType, bizId } },
|
||||
{ params: { bizId, bizType } },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -57,9 +57,14 @@ export function deleteBarcode(id: number) {
|
|||
return requestClient.delete(`/mes/wm/barcode/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出条码 */
|
||||
export function exportBarcode(params: any) {
|
||||
return requestClient.download('/mes/wm/barcode/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 生成条码内容 */
|
||||
export function generateBarcodeContent(bizType: number, bizCode: string) {
|
||||
return requestClient.get<string>('/mes/wm/barcode/generate-content', {
|
||||
params: { bizType, bizCode },
|
||||
params: { bizCode, bizType },
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesWmMaterialStockApi {
|
||||
/** MES 库存台账 */
|
||||
export interface MaterialStock {
|
||||
id?: number; // 编号
|
||||
itemTypeId?: number; // 物料分类编号
|
||||
itemId?: number; // 物料编号
|
||||
itemCode?: string; // 物料编码
|
||||
itemName?: string; // 物料名称
|
||||
specification?: string; // 规格型号
|
||||
unitMeasureName?: string; // 计量单位名称
|
||||
batchId?: number; // 批次编号
|
||||
batchCode?: string; // 批次号
|
||||
warehouseId?: number; // 仓库编号
|
||||
warehouseCode?: string; // 仓库编码
|
||||
warehouseName?: string; // 仓库名称
|
||||
locationId?: number; // 库区编号
|
||||
locationName?: string; // 库区名称
|
||||
areaId?: number; // 库位编号
|
||||
areaName?: string; // 库位名称
|
||||
vendorId?: number; // 供应商编号
|
||||
vendorName?: string; // 供应商名称
|
||||
quantity?: number; // 在库数量
|
||||
receiptTime?: string; // 入库日期
|
||||
frozen?: boolean; // 是否冻结
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询库存台账分页 */
|
||||
export function getMaterialStockPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesWmMaterialStockApi.MaterialStock>>(
|
||||
'/mes/wm/material-stock/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询库存台账详情 */
|
||||
export function getMaterialStock(id: number) {
|
||||
return requestClient.get<MesWmMaterialStockApi.MaterialStock>(
|
||||
`/mes/wm/material-stock/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新库存冻结状态 */
|
||||
export function updateMaterialStockFrozen(data: {
|
||||
frozen: boolean;
|
||||
id: number;
|
||||
}) {
|
||||
return requestClient.put('/mes/wm/material-stock/update-frozen', data);
|
||||
}
|
||||
|
||||
/** 导出库存台账 */
|
||||
export function exportMaterialStock(params: any) {
|
||||
return requestClient.download('/mes/wm/material-stock/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
@ -48,3 +48,18 @@ export function getWarehouseArea(id: number) {
|
|||
`/mes/wm/warehouse-area/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增库位 */
|
||||
export function createWarehouseArea(data: MesWmWarehouseAreaApi.WarehouseArea) {
|
||||
return requestClient.post('/mes/wm/warehouse-area/create', data);
|
||||
}
|
||||
|
||||
/** 修改库位 */
|
||||
export function updateWarehouseArea(data: MesWmWarehouseAreaApi.WarehouseArea) {
|
||||
return requestClient.put('/mes/wm/warehouse-area/update', data);
|
||||
}
|
||||
|
||||
/** 删除库位 */
|
||||
export function deleteWarehouseArea(id: number) {
|
||||
return requestClient.delete(`/mes/wm/warehouse-area/delete?id=${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,18 @@ export function getWarehouse(id: number) {
|
|||
`/mes/wm/warehouse/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增仓库 */
|
||||
export function createWarehouse(data: MesWmWarehouseApi.Warehouse) {
|
||||
return requestClient.post('/mes/wm/warehouse/create', data);
|
||||
}
|
||||
|
||||
/** 修改仓库 */
|
||||
export function updateWarehouse(data: MesWmWarehouseApi.Warehouse) {
|
||||
return requestClient.put('/mes/wm/warehouse/update', data);
|
||||
}
|
||||
|
||||
/** 删除仓库 */
|
||||
export function deleteWarehouse(id: number) {
|
||||
return requestClient.delete(`/mes/wm/warehouse/delete?id=${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,35 @@ export function getWarehouseLocation(id: number) {
|
|||
`/mes/wm/warehouse-location/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增库区 */
|
||||
export function createWarehouseLocation(
|
||||
data: MesWmWarehouseLocationApi.WarehouseLocation,
|
||||
) {
|
||||
return requestClient.post('/mes/wm/warehouse-location/create', data);
|
||||
}
|
||||
|
||||
/** 修改库区 */
|
||||
export function updateWarehouseLocation(
|
||||
data: MesWmWarehouseLocationApi.WarehouseLocation,
|
||||
) {
|
||||
return requestClient.put('/mes/wm/warehouse-location/update', data);
|
||||
}
|
||||
|
||||
/** 删除库区 */
|
||||
export function deleteWarehouseLocation(id: number) {
|
||||
return requestClient.delete(`/mes/wm/warehouse-location/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量设置库区下所有库位的混放规则 */
|
||||
export function updateAreaByLocationId(
|
||||
locationId: number,
|
||||
allowItemMixing?: boolean,
|
||||
allowBatchMixing?: boolean,
|
||||
) {
|
||||
return requestClient.put(
|
||||
'/mes/wm/warehouse-location/update-by-location-id',
|
||||
null,
|
||||
{ params: { allowBatchMixing, allowItemMixing, locationId } },
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const showClear = computed(
|
|||
|
||||
/** 根据工作站编号回显选择器 */
|
||||
async function resolveItemById(id: number | undefined) {
|
||||
if (id === null) {
|
||||
if (id == null) {
|
||||
selectedItem.value = undefined;
|
||||
return;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ async function resolveItemById(id: number | undefined) {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
selectedItem.value = await getWorkstation(id as number);
|
||||
selectedItem.value = await getWorkstation(id);
|
||||
} catch (error) {
|
||||
console.error('[MdWorkstationSelect] resolveItemById failed:', error);
|
||||
}
|
||||
|
|
@ -90,8 +90,8 @@ function handleClick(event: MouseEvent) {
|
|||
clearSelected();
|
||||
return;
|
||||
}
|
||||
const selectedIds = props.modelValue === null ? [] : [props.modelValue];
|
||||
dialogRef.value?.open(selectedIds as number[], { multiple: false });
|
||||
const selectedIds = props.modelValue == null ? [] : [props.modelValue];
|
||||
dialogRef.value?.open(selectedIds, { multiple: false });
|
||||
}
|
||||
|
||||
/** 回填选中的工作站 */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
<script lang="ts" setup>
|
||||
import type { MesProWorkRecordApi } from '#/api/mes/pro/workrecord';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { confirm } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElDialog, ElMessage, ElTag } from 'element-plus';
|
||||
|
||||
import {
|
||||
clockInWorkRecord,
|
||||
clockOutWorkRecord,
|
||||
getMyWorkRecord,
|
||||
} from '#/api/mes/pro/workrecord';
|
||||
import MdWorkstationSelect from '#/views/mes/md/workstation/components/md-workstation-select.vue';
|
||||
import { MesProWorkRecordTypeEnum } from '#/views/mes/utils/constants';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'change'): void;
|
||||
}>();
|
||||
|
||||
const myWorkstation = ref<MesProWorkRecordApi.MyWorkRecord | null>(null); // 当前用户绑定的工作站状态
|
||||
const clockInDialogVisible = ref(false); // 上工弹窗是否可见
|
||||
const selectedWorkstationId = ref<number>(); // 当前选中的工作站编号
|
||||
|
||||
const isClockIn = computed(() => // 是否处于上工状态
|
||||
myWorkstation.value?.type === MesProWorkRecordTypeEnum.CLOCK_IN,
|
||||
);
|
||||
|
||||
/** 加载当前用户工作站 */
|
||||
async function loadMyWorkstation() {
|
||||
myWorkstation.value = await getMyWorkRecord();
|
||||
}
|
||||
|
||||
/** 打开上工弹窗 */
|
||||
function handleOpenClockIn() {
|
||||
selectedWorkstationId.value = undefined;
|
||||
clockInDialogVisible.value = true;
|
||||
}
|
||||
|
||||
/** 上工 */
|
||||
async function handleClockIn() {
|
||||
if (!selectedWorkstationId.value) {
|
||||
return;
|
||||
}
|
||||
await clockInWorkRecord(selectedWorkstationId.value);
|
||||
ElMessage.success('上工成功');
|
||||
clockInDialogVisible.value = false;
|
||||
selectedWorkstationId.value = undefined;
|
||||
await loadMyWorkstation();
|
||||
emit('change');
|
||||
}
|
||||
|
||||
/** 下工 */
|
||||
async function handleClockOut() {
|
||||
await confirm('确认下工当前工作站?');
|
||||
await clockOutWorkRecord();
|
||||
ElMessage.success('下工成功');
|
||||
await loadMyWorkstation();
|
||||
emit('change');
|
||||
}
|
||||
|
||||
onMounted(loadMyWorkstation);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="bg-card mb-3 flex items-center justify-between rounded border p-3"
|
||||
>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<span class="text-sm font-semibold">我的工作站</span>
|
||||
<template v-if="isClockIn">
|
||||
<ElTag type="success">
|
||||
<IconifyIcon class="mr-1 inline-block size-4" icon="lucide:check" />
|
||||
{{ myWorkstation!.workstationCode }} -
|
||||
{{ myWorkstation!.workstationName }}
|
||||
</ElTag>
|
||||
<span class="text-muted-foreground text-xs">
|
||||
上工时间:{{ formatDateTime(myWorkstation!.clockInTime as Date) }}
|
||||
</span>
|
||||
</template>
|
||||
<ElTag v-else type="info">当前未上工</ElTag>
|
||||
</div>
|
||||
<div>
|
||||
<ElButton v-if="!isClockIn" type="primary" @click="handleOpenClockIn">
|
||||
<IconifyIcon class="mr-1 inline-block size-4" icon="lucide:play" />
|
||||
上工
|
||||
</ElButton>
|
||||
<ElButton v-else type="danger" @click="handleClockOut">
|
||||
<IconifyIcon class="mr-1 inline-block size-4" icon="lucide:pause" />
|
||||
下工
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<ElDialog
|
||||
v-model="clockInDialogVisible"
|
||||
title="选择工作站"
|
||||
width="420px"
|
||||
>
|
||||
<MdWorkstationSelect
|
||||
v-model="selectedWorkstationId"
|
||||
class="w-full"
|
||||
placeholder="请选择工作站"
|
||||
/>
|
||||
<template #footer>
|
||||
<ElButton @click="clockInDialogVisible = false">取消</ElButton>
|
||||
<ElButton
|
||||
:disabled="!selectedWorkstationId"
|
||||
type="primary"
|
||||
@click="handleClockIn"
|
||||
>
|
||||
确认上工
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesProWorkRecordApi } from '#/api/mes/pro/workrecord';
|
||||
import type { SystemUserApi } from '#/api/system/user';
|
||||
|
||||
import { markRaw } from 'vue';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
import MdWorkstationSelect from '#/views/mes/md/workstation/components/md-workstation-select.vue';
|
||||
|
||||
/** 关联数据 */
|
||||
let userList: SystemUserApi.User[] = [];
|
||||
getSimpleUserList().then((data) => (userList = data));
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'userId',
|
||||
label: '用户',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
clearable: true,
|
||||
labelField: 'nickname',
|
||||
placeholder: '请选择用户',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'workstationId',
|
||||
label: '工作站',
|
||||
component: markRaw(MdWorkstationSelect),
|
||||
componentProps: {
|
||||
placeholder: '请选择工作站',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'type',
|
||||
label: '操作类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
options: getDictOptions(DICT_TYPE.MES_PRO_WORK_RECORD_TYPE, 'number'),
|
||||
placeholder: '请选择操作类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '操作时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions<MesProWorkRecordApi.WorkRecordLog>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
field: 'userId',
|
||||
title: '用户',
|
||||
width: 140,
|
||||
formatter: ({ row }) =>
|
||||
row.userNickname ||
|
||||
userList.find((user) => user.id === row.userId)?.nickname ||
|
||||
'',
|
||||
},
|
||||
{
|
||||
field: 'workstationCode',
|
||||
title: '工作站编码',
|
||||
width: 140,
|
||||
},
|
||||
{
|
||||
field: 'workstationName',
|
||||
title: '工作站名称',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '操作类型',
|
||||
width: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.MES_PRO_WORK_RECORD_TYPE },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
width: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesProWorkRecordApi } from '#/api/mes/pro/workrecord';
|
||||
|
||||
import { DocAlert, Page } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
exportWorkRecordLog,
|
||||
getWorkRecordLogPage,
|
||||
} from '#/api/mes/pro/workrecord';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import WorkRecordStatusBar from './components/work-record-status-bar.vue';
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportWorkRecordLog(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '工作记录.xls', source: data });
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getWorkRecordLogPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<MesProWorkRecordApi.WorkRecordLog>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【生产】工作记录"
|
||||
url="https://doc.iocoder.cn/mes/pro/work-record/"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<WorkRecordStatusBar @change="handleRefresh" />
|
||||
|
||||
<Grid table-title="工作记录列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['mes:pro-workrecord:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
|
@ -139,8 +139,14 @@ export const MesAutoCodeRuleCode = {
|
|||
PRO_ROUTE_CODE: 'PRO_ROUTE_CODE',
|
||||
PRO_TASK_CODE: 'PRO_TASK_CODE',
|
||||
PRO_WORK_ORDER_CODE: 'PRO_WORK_ORDER_CODE',
|
||||
QC_DEFECT_CODE: 'QC_DEFECT_CODE',
|
||||
QC_INDICATOR_CODE: 'QC_INDICATOR_CODE',
|
||||
QC_TEMPLATE_CODE: 'QC_TEMPLATE_CODE',
|
||||
TM_TOOL_TYPE_CODE: 'TM_TOOL_TYPE_CODE',
|
||||
TM_TOOL_CODE: 'TM_TOOL_CODE',
|
||||
WM_AREA_CODE: 'WM_AREA_CODE',
|
||||
WM_LOCATION_CODE: 'WM_LOCATION_CODE',
|
||||
WM_WAREHOUSE_CODE: 'WM_WAREHOUSE_CODE',
|
||||
} as const;
|
||||
|
||||
/** MES 生产工单状态枚举 */
|
||||
|
|
@ -194,6 +200,21 @@ export const MesProAndonLevelEnum = {
|
|||
LEVEL3: 3,
|
||||
} as const;
|
||||
|
||||
/** MES 上下工状态类型枚举 */
|
||||
export const MesProWorkRecordTypeEnum = {
|
||||
CLOCK_IN: 1,
|
||||
CLOCK_OUT: 2,
|
||||
} as const;
|
||||
|
||||
/** MES 质检结果值类型枚举 */
|
||||
export const MesQcResultValueType = {
|
||||
FLOAT: 1,
|
||||
INTEGER: 2,
|
||||
TEXT: 3,
|
||||
DICT: 4,
|
||||
FILE: 5,
|
||||
} as const;
|
||||
|
||||
/** MES 编码规则分段类型枚举 */
|
||||
export const MesAutoCodePartTypeEnum = {
|
||||
INPUT: 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue