Compare commits

...

21 Commits

Author SHA1 Message Date
tao
317f2847ac 配置 eslint 与 prettier 2026-01-14 16:35:46 +08:00
tao
09b921009e 出站优化:判断是否为末站点 2026-01-14 09:21:15 +08:00
tao
1728ed1b3a 作业编码初始化 bug 修复 2026-01-13 17:00:10 +08:00
tao
7e32e9931d 绑定设备参数 bug 修复 2026-01-13 09:16:29 +08:00
tao
ba71c3e42c 全局表格及按钮样式优化 2026-01-13 09:16:09 +08:00
tao
82210f6c26 进站/出站后刷新工序列表 2026-01-12 17:29:19 +08:00
tao
863fcf7b61 目录结构变更 2026-01-12 17:28:57 +08:00
tao
9a1fec8cbc 优化系统全局状态管理结构 2026-01-12 17:17:58 +08:00
tao
84797e76cd 修改工控机名称 2026-01-12 17:15:11 +08:00
tao
70021db98f 新建复制粘贴方法 2026-01-12 17:14:39 +08:00
tao
0361053f67 封装 Hold 按钮/模态框组件 2026-01-12 17:14:02 +08:00
tao
85828dd1a6 优化 Header 组件样式 2026-01-12 17:13:43 +08:00
tao
faf9b7c9a4 登录/登出优化 2026-01-12 11:46:28 +08:00
tao
4371ced698 优化刷新方法 2026-01-09 16:51:27 +08:00
tao
c7f118dab1 主材出站界面优化 2026-01-09 16:37:16 +08:00
tao
541edc1f4e 入站细节调整 2026-01-09 16:36:49 +08:00
tao
44878e2979 配置出站后路由跳转 2026-01-09 10:11:27 +08:00
tao
cd6a96442c 优化 Title 组件结构 2026-01-09 10:11:16 +08:00
tao
734d16539a 增加修改主材出站接口 2026-01-09 10:11:07 +08:00
tao
31a13fcee9 增加刷新作业信息功能 2026-01-09 10:09:19 +08:00
tao
ef5eae7e0f 更改页签名、登录页名 2026-01-08 11:08:54 +08:00
97 changed files with 7306 additions and 4073 deletions

5
.prettierignore Normal file
View File

@@ -0,0 +1,5 @@
# 忽略打包输出目录
dist
# 忽略依赖目录
node_modules

25
.prettierrc Normal file
View File

@@ -0,0 +1,25 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"objectWrap": "preserve",
"bracketSpacing": true,
"semi": false,
"experimentalOperatorPosition": "end",
"experimentalTernaries": false,
"singleQuote": true,
"jsxSingleQuote": false,
"quoteProps": "preserve",
"trailingComma": "all",
"singleAttributePerLine": false,
"htmlWhitespaceSensitivity": "ignore",
"vueIndentScriptAndStyle": false,
"proseWrap": "preserve",
"endOfLine": "lf",
"insertPragma": false,
"printWidth": 80,
"requirePragma": false,
"tabWidth": 2,
"useTabs": true,
"embeddedLanguageFormatting": "auto",
"cursorOffset": -1
}

3
commitlint.config.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
}

3
components.d.ts vendored
View File

@@ -24,6 +24,7 @@ declare module 'vue' {
AMenu: typeof import('ant-design-vue/es')['Menu'] AMenu: typeof import('ant-design-vue/es')['Menu']
AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
AModal: typeof import('ant-design-vue/es')['Modal'] AModal: typeof import('ant-design-vue/es')['Modal']
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
AProgress: typeof import('ant-design-vue/es')['Progress'] AProgress: typeof import('ant-design-vue/es')['Progress']
ARow: typeof import('ant-design-vue/es')['Row'] ARow: typeof import('ant-design-vue/es')['Row']
ASelect: typeof import('ant-design-vue/es')['Select'] ASelect: typeof import('ant-design-vue/es')['Select']
@@ -38,8 +39,10 @@ declare module 'vue' {
ATypographyText: typeof import('ant-design-vue/es')['TypographyText'] ATypographyText: typeof import('ant-design-vue/es')['TypographyText']
DictTag: typeof import('./src/components/common/DictTag/index.vue')['default'] DictTag: typeof import('./src/components/common/DictTag/index.vue')['default']
Header: typeof import('./src/components/common/Header/index.vue')['default'] Header: typeof import('./src/components/common/Header/index.vue')['default']
HoldTraceOrder: typeof import('./src/components/traceOrderManage/holdTraceOrder.vue')['default']
ILucideBuilding: typeof import('~icons/lucide/building')['default'] ILucideBuilding: typeof import('~icons/lucide/building')['default']
ILucideChevronDown: typeof import('~icons/lucide/chevron-down')['default'] ILucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']
ILucideChevronUp: typeof import('~icons/lucide/chevron-up')['default']
ILucideCopy: typeof import('~icons/lucide/copy')['default'] ILucideCopy: typeof import('~icons/lucide/copy')['default']
ILucideCpu: typeof import('~icons/lucide/cpu')['default'] ILucideCpu: typeof import('~icons/lucide/cpu')['default']
ILucideLoader: typeof import('~icons/lucide/loader')['default'] ILucideLoader: typeof import('~icons/lucide/loader')['default']

53
eslint.config.mjs Normal file
View File

@@ -0,0 +1,53 @@
/**
* ESLint Flat 配置ESLint 9
* 适用于Vue 3 + TypeScript + Prettier
*/
import pluginVue from 'eslint-plugin-vue' // Vue 官方 ESLint 插件
import {
defineConfigWithVueTs, // 用于组合 Vue + TS 的 Flat 配置
vueTsConfigs, // 官方提供的 TypeScript 推荐规则集合
} from '@vue/eslint-config-typescript'
import prettierPlugin from 'eslint-plugin-prettier' // 将 Prettier 作为 ESLint 规则使用
import prettierConfig from 'eslint-config-prettier' // 关闭与 Prettier 冲突的 ESLint 规则
export default defineConfigWithVueTs(
// 1. 全局忽略配置(必须放在最前面)
{
// 不对构建产物和依赖目录进行 ESLint 校验
ignores: ['dist/**', 'node_modules/**'],
},
// 2. Vue 相关基础规则(包含模板语法支持)
pluginVue.configs['flat/essential'],
// 3. TypeScript 推荐规则(脚本逻辑部分)
vueTsConfigs.recommended,
// 4. Prettier 相关配置:只负责格式化,不干扰语义规则
{
// 注册需要用到的插件
plugins: {
prettier: prettierPlugin, // Prettier 插件
},
// 自定义规则
rules: {
// 关闭与 Prettier 冲突的 ESLint 规则
...prettierConfig.rules,
// 将 Prettier 的格式化结果作为 ESLint 的告警输出
'prettier/prettier': 'warn',
},
},
// 5. 自定义规则
{
rules: {
// Vue 规则
'vue/multi-word-component-names': 'off',
// TypeScript 规则
'@typescript-eslint/no-explicit-any': 'off',
},
},
)

6
global.d.ts vendored
View File

@@ -1,4 +1,4 @@
// declare module '@/*'; // declare module '@/*';
declare module '@/components/*'; declare module '@/components/*'
declare module '@/views/*'; declare module '@/views/*'
declare module '@/api/*'; declare module '@/api/*'

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>工业 HMI 自动采集设备</title> <title>宏禧 MES 过站平台</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

10
lint-staged.config.cjs Normal file
View File

@@ -0,0 +1,10 @@
module.exports = {
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [
'prettier --write--parser json',
],
'package.json': ['prettier --write'],
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
'*.{scss,less,style,html}': ['stylelint --fix', 'prettier --write'],
'*.md': ['prettier --write'],
}

2248
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,10 @@
"scripts": { "scripts": {
"dev": "vite --host --open", "dev": "vite --host --open",
"build": "vite build", "build": "vite build",
"preview": "vite preview" "preview": "vite preview",
"lint": "eslint \"src/**/*.{ts,vue}\"",
"lint:fix": "eslint \"src/**/*.{ts,vue}\" --fix",
"format": "prettier --write \"src/**/*.{ts,vue,js,json,css,md}\""
}, },
"dependencies": { "dependencies": {
"@types/lodash": "^4.17.21", "@types/lodash": "^4.17.21",
@@ -24,14 +27,29 @@
"@types/event-source-polyfill": "^1.0.5", "@types/event-source-polyfill": "^1.0.5",
"@types/js-cookie": "^3.0.6", "@types/js-cookie": "^3.0.6",
"@types/node": "^24.0.3", "@types/node": "^24.0.3",
"@typescript-eslint/eslint-plugin": "^8.53.0",
"@typescript-eslint/parser": "^8.53.0",
"@vitejs/plugin-vue": "^5.2.3", "@vitejs/plugin-vue": "^5.2.3",
"@vue/eslint-config-typescript": "^14.6.0",
"@vue/tsconfig": "^0.7.0", "@vue/tsconfig": "^0.7.0",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-vue": "^10.6.2",
"event-source-polyfill": "^1.0.31", "event-source-polyfill": "^1.0.31",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"lint-staged": "^16.2.7",
"prettier": "^3.7.4",
"sass-embedded": "^1.89.2", "sass-embedded": "^1.89.2",
"typescript": "~5.8.3", "typescript": "~5.8.3",
"unplugin-icons": "^22.2.0", "unplugin-icons": "^22.2.0",
"vite": "^6.3.5", "vite": "^6.3.5",
"vue-tsc": "^2.2.8" "vue-tsc": "^2.2.8"
},
"lint-staged": {
"*.{ts,js,vue}": [
"eslint --fix",
"prettier --write"
]
} }
} }

View File

@@ -1,10 +1,10 @@
<template> <template>
<a-config-provider :locale="zhCN"> <a-config-provider :locale="zhCN">
<router-view /> <router-view />
</a-config-provider> </a-config-provider>
</template> </template>
<script setup> <script setup lang="ts">
import zhCN from 'ant-design-vue/es/locale/zh_CN'; import zhCN from 'ant-design-vue/es/locale/zh_CN'
import 'dayjs/locale/zh-cn'; import 'dayjs/locale/zh-cn'
</script> </script>

40
src/api/common.d.ts vendored
View File

@@ -1,11 +1,11 @@
export type ID = number | string; export type ID = number | string
export type IDS = (number | string)[]; export type IDS = (number | string)[]
export interface BaseEntity { export interface BaseEntity {
createBy?: string; createBy?: string
createTime?: string; createTime?: string
updateBy?: string; updateBy?: string
updateTime?: string; updateTime?: string
} }
/** /**
@@ -16,24 +16,24 @@ export interface BaseEntity {
* @param isAsc 是否升序 * @param isAsc 是否升序
*/ */
export interface PageQuery { export interface PageQuery {
isAsc?: string; isAsc?: string
orderByColumn?: string; orderByColumn?: string
pageNum?: number; pageNum?: number
pageSize?: number; pageSize?: number
[key: string]: any; [key: string]: any
} }
export interface ApiResponse<T = any> { export interface ApiResponse<T = any> {
code?: number; code?: number
msg?: string; msg?: string
data?: T; data?: T
rows: T[]; rows: T[]
total?: number; total?: number
token?: string; token?: string
img?: string; img?: string
uuid?: string; uuid?: string
captchaOnOff?: boolean; captchaOnOff?: boolean
} }

View File

@@ -1,36 +0,0 @@
import request from "@/api/request";
import type { ID } from "@/api/common";
// 查询设备管理详细
export function getEquipmentByCode(code: string) {
return request({
url: '/basic/equipment/code/' + code,
method: 'get'
})
}
// 查询设备进站记录列表
export function listEquipmentEntry(params: any) {
return request({
url: "/mes/equipment-entry-log/list",
method: "get",
params,
});
}
// 新增设备进站记录
export function addEquipmentEntry(data: any) {
return request({
url: "/mes/equipment-entry-log",
method: "post",
data,
});
}
// 删除设备进站记录
export function delEquipmentEntry(id: ID) {
return request({
url: "/mes/equipment-entry-log/" + id,
method: "delete",
});
}

View File

@@ -1,72 +0,0 @@
import request from "@/api/request";
import type { LotTraceOrderData, LotTraceOrderQuery } from "./model";
import type { ID } from "@/api/common";
// 查询随工单列表
export function listLotTraceOrder(params: LotTraceOrderQuery) {
return request({
url: "/mes/lot-trace-order/list",
method: "get",
params,
});
}
// 高级查询随工单列表
export function advListLotTraceOrder(params: LotTraceOrderQuery) {
return request({
url: "/mes/lot-trace-order/advList",
method: "get",
params,
});
}
// 查询随工单详细
export function getLotTraceOrder(id: ID) {
return request({
url: "/mes/lot-trace-order/" + id,
method: "get",
});
}
// 新增随工单
export function addLotTraceOrder(data: LotTraceOrderData) {
return request({
url: "/mes/lot-trace-order",
method: "post",
data,
});
}
// 修改随工单
export function updateLotTraceOrder(data: LotTraceOrderData) {
return request({
url: "/mes/lot-trace-order",
method: "put",
data,
});
}
// 删除随工单
export function delLotTraceOrder(id: ID) {
return request({
url: "/mes/lot-trace-order/" + id,
method: "delete",
});
}
// 关闭随工单
export function closeLotTraceOrder(id: ID) {
return request({
url: "/mes/lot-trace-order/close/" + id,
method: "put",
});
}
// 新增质量异常联络单
export function addQualityAbnormalContact(data: any) {
return request({
url: "/mes/qualityAbnormalContact",
method: "post",
data,
});
}

View File

@@ -1,54 +0,0 @@
import request from "@/api/request";
import type { ID } from "@/api/common";
// 查询库位列表
export function listStorageLocation(params: any) {
return request({
url: "/wip/storageLocation/list",
method: "get",
params,
});
}
// 高级查询库位列表
export function advListStorageLocation(params: any) {
return request({
url: "/wip/storageLocation/advList",
method: "get",
params,
});
}
// 查询库位详细
export function getStorageLocation(id: ID) {
return request({
url: "/wip/storageLocation/" + id,
method: "get",
});
}
// 新增库位
export function addStorageLocation(data: any) {
return request({
url: "/wip/storageLocation",
method: "post",
data,
});
}
// 修改库位
export function updateStorageLocation(data: any) {
return request({
url: "/wip/storageLocation",
method: "put",
data,
});
}
// 删除库位
export function delStorageLocation(id: ID) {
return request({
url: "/wip/storageLocation/" + id,
method: "delete",
});
}

View File

@@ -1,37 +0,0 @@
import request from "@/api/request";
import type { ID } from "@/api/common";
// 查询站点绑定治具列表
export function listStationBindMask(params: any) {
return request({
url: "/mes/station/mask/list",
method: "get",
params,
});
}
// 为站点绑定治具
export function batchBindMasksToStation(stationId: ID, maskIds: ID[]) {
return request({
url: "/mes/station/" + stationId + "/bind/mask",
method: "put",
data: maskIds,
});
}
// 为站点绑定治具组
export function bindMaskCombinationToStations(data: any) {
return request({
url: "/mes/station/bind/mask-combination",
method: "put",
data,
});
}
// 站点解绑治具
export function unbindStationMask(stationMaskId: ID) {
return request({
url: "/mes/station/bind-mask/" + stationMaskId,
method: "delete",
});
}

View File

@@ -1,81 +0,0 @@
import request from "@/api/request";
import type { MaskCombinationData, MaskCombinationQuery } from "./model";
import type { ID } from "@/api/common";
// 查询治具组合列表
export function listMaskCombination(params: MaskCombinationQuery) {
return request({
url: "/tpm/mask/combination/list",
method: "get",
params,
});
}
// 查询治具组合包含的治具列表
export function listCombinationAssignMask(id: ID, params: MaskCombinationQuery) {
return request({
url: "/tpm/mask/combination/" + id + "/masks",
method: "get",
params,
});
}
// 高级查询治具组合列表
export function advListMaskCombination(params: MaskCombinationQuery) {
return request({
url: "/tpm/mask/combination/advList",
method: "get",
params,
});
}
// 查询治具组合详细
export function getMaskCombination(id: ID) {
return request({
url: "/tpm/mask/combination/" + id,
method: "get",
});
}
// 新增治具组合
export function addMaskCombination(data: MaskCombinationData) {
return request({
url: "/tpm/mask/combination",
method: "post",
data,
});
}
// 修改治具组合
export function updateMaskCombination(data: MaskCombinationData) {
return request({
url: "/tpm/mask/combination",
method: "put",
data,
});
}
// 删除治具组合
export function delMaskCombination(id: ID) {
return request({
url: "/tpm/mask/combination/" + id,
method: "delete",
});
}
// 新增治具组合与治具关联关系
export function addMaskCombinationAssignment(data: MaskCombinationData) {
return request({
url: "/tpm/mask/combination/assignment",
method: "post",
data,
});
}
// 删除治具组合与治具关联关系
export function delMaskCombinationAssignment(id: ID) {
return request({
url: "/tpm/mask/combination/assignment/" + id,
method: "delete",
});
}

View File

@@ -1,26 +0,0 @@
import { BaseEntity, PageQuery, type ID } from "@/api/common";
/**
* 治具组合查询参数
*/
export interface MaskCombinationQuery extends PageQuery {
combinationName?: string;
combinationCode?: string;
combinationStatus?: string;
remark?: string;
searchValue?: string;
tempId?: string;
timeRange?: [string, string];
}
/**
* 治具组合数据
*/
export interface MaskCombinationData extends BaseEntity {
combinationName?: string;
combinationCode?: string;
combinationStatus?: string;
remark?: string;
searchValue?: string;
tempId?: string;
timeRange?: [string, string];
}

View File

@@ -1,188 +0,0 @@
import { BaseEntity, PageQuery, type ID } from "@/api/common";
/**
* 随工单查询参数
*/
export interface LotTraceOrderQuery extends PageQuery {
/** 编码 */
code?: string;
/** 状态 */
status?: string;
/** 主生产计划的ID */
mpsId?: number;
/** 主生产计划编码 */
mpsCode?: string;
/** 订单类型 */
orderType?: string;
/** 主生产计划明细ID */
mpsDetailId?: number;
/** 批号 */
batchNo?: string;
/** 主生产计划明细序号 */
mpsDetailSeq?: number;
/** 目标产品ID */
tarMaterialId?: number;
/** 主物料ID */
masterMaterialId?: number;
/** 生产版本ID */
prodVersionId?: number;
/** 计划数量 */
planQty?: number;
/** OK数量 */
okQty?: number;
/** NG数量 */
ngQty?: number;
/** 未完成数量 */
unfinishedQty?: number;
/** 单位ID */
unitId?: number;
/** 计划开始时间范围 */
planStartTimeRange?: [string, string];
/** 计划结束时间范围 */
planEndTimeRange?: [string, string];
/** 扩展字段1 */
extStr1?: string;
/** 扩展字段2 */
extStr2?: string;
/** 扩展字段3 */
extStr3?: string;
/** 扩展字段4 */
extStr4?: string;
/** 扩展字段5 */
extStr5?: string;
/** 扩展字段6 */
extStr6?: string;
/** 扩展字段7 */
extStr7?: string;
/** 扩展字段8 */
extStr8?: string;
/** 扩展字段9 */
extStr9?: string;
/** 扩展字段10 */
extStr10?: string;
/** 扩展字段11 */
extStr11?: string;
/** 扩展字段12 */
extStr12?: string;
/** 扩展字段13 */
extStr13?: string;
/** 扩展字段14 */
extStr14?: string;
/** 扩展字段15 */
extStr15?: string;
/** 扩展字段16 */
extStr16?: string;
/** 扩展整型1 */
extInt1?: number;
/** 扩展整型2 */
extInt2?: number;
/** 扩展小数1 */
extDec1?: number;
/** 扩展小数2 */
extDec2?: number;
/** 扩展日期1范围 */
extDate1Range?: [string, string];
/** 扩展日期2范围 */
extDate2Range?: [string, string];
/** 删除标志 */
delStatus?: string;
/** 创建时间范围 */
createTimeRange?: [string, string];
/** 更新时间范围 */
updateTimeRange?: [string, string];
}
/**
* 随工单数据
*/
export interface LotTraceOrderData extends BaseEntity {
/** 主键ID */
id?: ID;
/** 编码 */
code?: string;
/** 状态 */
status?: string;
/** 主生产计划的ID */
mpsId?: number;
/** 主生产计划编码 */
mpsCode?: string;
/** 订单类型 */
orderType?: string;
/** 主生产计划明细ID */
mpsDetailId?: number;
/** 批号 */
batchNo?: string;
/** 主生产计划明细序号 */
mpsDetailSeq?: number;
/** 目标产品ID */
tarMaterialId?: number;
/** 目标产品名称 */
tarMaterialName?: string;
/** 目标产品编码 */
tarMaterialCode?: string;
/** 主物料ID */
masterMaterialId?: number;
/** 生产版本ID */
prodVersionId?: number;
/** 计划数量 */
planQty?: number;
/** OK数量 */
okQty?: number;
/** NG数量 */
ngQty?: number;
/** 未完成数量 */
unfinishedQty?: number;
/** 单位ID */
unitId?: number;
/** 计划开始时间 */
planStartTime?: string;
/** 计划结束时间 */
planEndTime?: string;
/** 扩展字段1 */
extStr1?: string;
/** 扩展字段2 */
extStr2?: string;
/** 扩展字段3 */
extStr3?: string;
/** 扩展字段4 */
extStr4?: string;
/** 扩展字段5 */
extStr5?: string;
/** 扩展字段6 */
extStr6?: string;
/** 扩展字段7 */
extStr7?: string;
/** 扩展字段8 */
extStr8?: string;
/** 扩展字段9 */
extStr9?: string;
/** 扩展字段10 */
extStr10?: string;
/** 扩展字段11 */
extStr11?: string;
/** 扩展字段12 */
extStr12?: string;
/** 扩展字段13 */
extStr13?: string;
/** 扩展字段14 */
extStr14?: string;
/** 扩展字段15 */
extStr15?: string;
/** 扩展字段16 */
extStr16?: string;
/** 扩展整型1 */
extInt1?: number;
/** 扩展整型2 */
extInt2?: number;
/** 扩展小数1 */
extDec1?: number;
/** 扩展小数2 */
extDec2?: number;
/** 扩展日期1 */
extDate1?: string;
/** 扩展日期2 */
extDate2?: string;
/** 备注 */
remark?: string;
/** 删除标志 */
delStatus?: string;
}

View File

@@ -1,2 +0,0 @@
export * from './infeed'
export * from './outfeed'

View File

@@ -1,61 +0,0 @@
import request from "@/api/request";
import type { ID } from "@/api/common";
// 查询主材进站列表
export function listMainMaterialEntryLog(params: any) {
return request({
url: "/mes/station/entry-log/main-material/list",
method: "get",
params,
});
}
// 查询主材进站详细
export function getMainMaterialEntryLog(id: ID) {
return request({
url: "/mes/station/entry-log/main-material/" + id,
method: "get",
});
}
// 新增主材Wafer进站
export function addWaferEntryLog(data: any) {
return request({
url: "/mes/station/entry-log/main-material/wafer",
method: "post",
data,
});
}
// 通过载具新增主材Wafer进站
export function addWaferEntryLogByCarrier(data: any) {
return request({
url: "/mes/station/entry-log/main-material/wafer/by-carrier",
method: "post",
data,
});
}
// 新增主材Die进站
export function addDieEntryLog(data: any) {
return request({
url: "/mes/station/entry-log/main-material/die",
method: "post",
data,
});
}
// 通过载具新增主材Die进站
export function addDieEntryLogByCarrier(data: any) {
return request({
url: "/mes/station/entry-log/main-material/die/by-carrier",
method: "post",
data,
});
}
// 删除主材进站
export function delMainMaterialEntryLog(id: ID) {
return request({
url: "/mes/station/entry-log/main-material/" + id,
method: "delete",
});
}

View File

@@ -1,45 +0,0 @@
import request from "@/api/request";
import type { ID } from "@/api/common";
// 查询主材出站列表
export function listMainMaterialOutboundLog(params: any) {
return request({
url: "/mes/station/out-log/main-material/list",
method: "get",
params,
});
}
// 查询主材出站详细
export function getMainMaterialOutboundLog(id: ID) {
return request({
url: "/mes/station/out-log/main-material/" + id,
method: "get",
});
}
// 新增主材出站
export function batchAddMainMaterialOutboundLog(data: any) {
return request({
url: "/mes/station/out-log/main-material/batch",
method: "post",
data,
});
}
// 新增主材出站
export function addWaferDieOutboundLogBySpecifiedNg(data: any) {
return request({
url: "/mes/station/out-log/main-material/wafer-die/by-specified-ng",
method: "post",
data,
});
}
// 删除主材出站
export function delMainMaterialOutboundLog(id: ID) {
return request({
url: "/mes/station/out-log/main-material/" + id,
method: "delete",
});
}

View File

@@ -1,72 +0,0 @@
import request from "@/api/request";
import type { ID } from "@/api/common";
import type { MesStationQuery, MesStationData } from "./model";
// 查询站点列表
export function listStation(params: MesStationQuery) {
return request({
url: "/mes/station/list",
method: "get",
params,
});
}
// 高级查询站点列表
export function advListStation(params: MesStationQuery) {
return request({
url: "/mes/station/advList",
method: "get",
params,
});
}
// 查询站点详细
export function getStation(id: ID) {
return request({
url: "/mes/station/" + id,
method: "get",
});
}
// 新增站点
export function addStation(data: MesStationData) {
return request({
url: "/mes/station",
method: "post",
data,
});
}
// 修改站点
export function updateStation(data: MesStationData) {
return request({
url: "/mes/station",
method: "put",
data,
});
}
// 删除站点
export function delStation(id: ID) {
return request({
url: "/mes/station/" + id,
method: "delete",
});
}
// 站点开工
export function startStation(id: ID) {
return request({
url: "/mes/station/" + id + "/start",
method: "put",
});
}
// 站点完工
export function completeStation(id: ID, location: any) {
return request({
url: '/mes/station/' + id + '/complete',
method: 'put',
data: location
})
}

View File

@@ -1,71 +0,0 @@
import { BaseEntity, PageQuery, type ID } from "@/api/common";
/**
* 站点查询参数
*/
export interface MesStationQuery extends PageQuery {
/** 随工单ID */
traceOrderId?: number;
/** 随工单编码 */
traceOrderCode?: string;
/** 站点序号 */
seqNo?: number;
/** 站点名称 */
name?: string;
/** 站点编码 */
code?: string;
/** 状态 */
status?: string;
/** 计划数量最小值 */
planQtyMin?: number;
/** 计划数量最大值 */
planQtyMax?: number;
/** 合格数量最小值 */
okQtyMin?: number;
/** 合格数量最大值 */
okQtyMax?: number;
/** 不合格数量最小值 */
ngQtyMin?: number;
/** 不合格数量最大值 */
ngQtyMax?: number;
/** 进站时间范围开始 */
arrivalTimeStart?: string;
/** 进站时间范围结束 */
arrivalTimeEnd?: string;
/** 出战时间范围开始 */
departureTimeStart?: string;
/** 出战时间范围结束 */
departureTimeEnd?: string;
/** 删除标志 */
delStatus?: string;
}
/**
* 站点数据
*/
export interface MesStationData extends BaseEntity {
/** 主键ID */
id?: number;
/** 随工单ID */
traceOrderId?: number;
/** 站点序号 */
seqNo?: number;
/** 站点名称 */
name?: string;
/** 站点编码 */
code?: string;
/** 状态 */
status?: string;
/** 计划数量 */
planQty?: number;
/** 合格数量 */
okQty?: number;
/** 不合格数量 */
ngQty?: number;
/** 进站时间 */
arrivalTime?: string;
/** 出战时间 */
departureTime?: string;
/** 删除标志 */
delStatus?: string;
}

View File

@@ -1,93 +1,93 @@
import axios from "axios"; import axios from 'axios'
import router from "@/router"; import router from '@/router'
import { getToken, removeToken } from "@/utils/auth"; import { getToken, removeToken } from '@/utils/auth'
import { Modal, notification } from "ant-design-vue"; import { Modal, notification } from 'ant-design-vue'
import type { AxiosInstance, AxiosRequestConfig } from "axios"; import type { AxiosInstance, AxiosRequestConfig } from 'axios'
import type { ApiResponse } from "@/api/common"; import type { ApiResponse } from '@/api/common'
const errCodeMap: { [key: string]: string } = { const errCodeMap: { [key: string]: string } = {
"403": "当前操作没有权限", '403': '当前操作没有权限',
"404": "访问资源不存在", '404': '访问资源不存在',
default: "系统未知错误,请反馈给管理员", default: '系统未知错误,请反馈给管理员',
}; }
// 创建axios实例 // 创建axios实例
const service: AxiosInstance = axios.create({ const service: AxiosInstance = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API, baseURL: import.meta.env.VITE_APP_BASE_API,
timeout: 10000, timeout: 10000,
}); })
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config) => { (config) => {
config.headers = config.headers || {}; config.headers = config.headers || {}
config.headers["Accept-Language"] = "zh-CN"; config.headers['Accept-Language'] = 'zh-CN'
const token = getToken(); const token = getToken()
if (token) { if (token) {
config.headers["Authorization"] = `Bearer ${token}`; config.headers['Authorization'] = `Bearer ${token}`
} }
return config; return config
}, },
(error) => { (error) => {
return Promise.reject(error); return Promise.reject(error)
} },
); )
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
(response) => { (response) => {
if (response.config.responseType === "blob") { if (response.config.responseType === 'blob') {
return response.data; return response.data
} }
const code = response.data.code || 200; const code = response.data.code || 200
const data = response.data; const data = response.data
switch (code) { switch (code) {
case 200: case 200:
return data; return data
case 401: case 401:
Modal.error({ Modal.error({
title: "系统提示", title: '系统提示',
content: "登录状态已过期,请重新登录", content: '登录状态已过期,请重新登录',
onOk: () => { onOk: () => {
removeToken(); removeToken()
router.replace({ name: 'Login' }); router.replace({ name: 'Login' })
}, },
}); })
return Promise.reject(data); return Promise.reject(data)
case 500: case 500:
return Promise.reject(new Error(data.msg)); return Promise.reject(new Error(data.msg))
default: default:
notification.error({ notification.error({
message: "请求错误", message: '请求错误',
description: errCodeMap[code] || data?.msg || errCodeMap.default, description: errCodeMap[code] || data?.msg || errCodeMap.default,
}); })
return Promise.reject(data); return Promise.reject(data)
} }
}, },
(error) => { (error) => {
if (!error.__handled) { if (!error.__handled) {
const message = const message =
error.code === "ECONNABORTED" error.code === 'ECONNABORTED'
? "请求超时,请稍后重试" ? '请求超时,请稍后重试'
: error.message || "网络异常"; : error.message || '网络异常'
notification.error({ notification.error({
message: "网络错误", message: '网络错误',
description: message, description: message,
}); })
error.__handled = true; error.__handled = true
} }
return Promise.reject(error); return Promise.reject(error)
} },
); )
function request<T = any>(config: AxiosRequestConfig): Promise<ApiResponse<T>> { function request<T = any>(config: AxiosRequestConfig): Promise<ApiResponse<T>> {
return service(config) as Promise<ApiResponse<T>>; return service(config) as Promise<ApiResponse<T>>
} }
export default request; export default request

View File

@@ -2,51 +2,51 @@ import request from '@/api/request'
// 查询字典数据列表 // 查询字典数据列表
export function listData(params: any) { export function listData(params: any) {
return request({ return request({
url: '/system/dict/data/list', url: '/system/dict/data/list',
method: 'get', method: 'get',
params params,
}) })
} }
// 查询字典数据详细 // 查询字典数据详细
export function getData(dictCode: string) { export function getData(dictCode: string) {
return request({ return request({
url: '/system/dict/data/' + dictCode, url: '/system/dict/data/' + dictCode,
method: 'get' method: 'get',
}) })
} }
// 根据字典类型查询字典数据信息 // 根据字典类型查询字典数据信息
export function getDicts(dictType: string) { export function getDicts(dictType: string) {
return request({ return request({
url: '/system/dict/data/type/' + dictType, url: '/system/dict/data/type/' + dictType,
method: 'get' method: 'get',
}) })
} }
// 新增字典数据 // 新增字典数据
export function addData(data: any) { export function addData(data: any) {
return request({ return request({
url: '/system/dict/data', url: '/system/dict/data',
method: 'post', method: 'post',
data data,
}) })
} }
// 修改字典数据 // 修改字典数据
export function updateData(data: any) { export function updateData(data: any) {
return request({ return request({
url: '/system/dict/data', url: '/system/dict/data',
method: 'put', method: 'put',
data data,
}) })
} }
// 删除字典数据 // 删除字典数据
export function delData(dictCode: string) { export function delData(dictCode: string) {
return request({ return request({
url: '/system/dict/data/' + dictCode, url: '/system/dict/data/' + dictCode,
method: 'delete' method: 'delete',
}) })
} }

View File

@@ -3,59 +3,59 @@ import type { ID } from '@/api/common'
// 查询字典类型列表 // 查询字典类型列表
export function listType(params: any) { export function listType(params: any) {
return request({ return request({
url: "/system/dict/type/list", url: '/system/dict/type/list',
method: "get", method: 'get',
params, params,
}); })
} }
// 查询字典类型详细 // 查询字典类型详细
export function getType(dictId: ID) { export function getType(dictId: ID) {
return request({ return request({
url: "/system/dict/type/" + dictId, url: '/system/dict/type/' + dictId,
method: "get", method: 'get',
}); })
} }
// 新增字典类型 // 新增字典类型
export function addType(data: any) { export function addType(data: any) {
return request({ return request({
url: "/system/dict/type", url: '/system/dict/type',
method: "post", method: 'post',
data, data,
}); })
} }
// 修改字典类型 // 修改字典类型
export function updateType(data: any) { export function updateType(data: any) {
return request({ return request({
url: "/system/dict/type", url: '/system/dict/type',
method: "put", method: 'put',
data, data,
}); })
} }
// 删除字典类型 // 删除字典类型
export function delType(dictId: ID) { export function delType(dictId: ID) {
return request({ return request({
url: "/system/dict/type/" + dictId, url: '/system/dict/type/' + dictId,
method: "delete", method: 'delete',
}); })
} }
// 刷新字典缓存 // 刷新字典缓存
export function refreshCache() { export function refreshCache() {
return request({ return request({
url: "/system/dict/type/refreshCache", url: '/system/dict/type/refreshCache',
method: "delete", method: 'delete',
}); })
} }
// 获取字典选择框列表 // 获取字典选择框列表
export function getOptions() { export function getOptions() {
return request({ return request({
url: "/system/dict/type/optionselect", url: '/system/dict/type/optionselect',
method: "get", method: 'get',
}); })
} }

View File

@@ -1,27 +1,27 @@
import request from '@/api/request' import request from '@/api/request'
import type { LoginInfo } from './model'; import type { LoginInfo } from './model'
// 用户登录 // 用户登录
export function login(data: LoginInfo) { export function login(data: LoginInfo) {
return request({ return request({
url: '/login', url: '/login',
method: 'post', method: 'post',
data data,
}) })
} }
// 获取验证码 // 获取验证码
export function getCaptcha() { export function getCaptcha() {
return request({ return request({
url: '/captchaImage', url: '/captchaImage',
method: 'get' method: 'get',
}) })
} }
// 退出登录 // 退出登录
export function logout() { export function logout() {
return request({ return request({
url: '/logout', url: '/logout',
method: 'post' method: 'post',
}) })
} }

View File

@@ -1,6 +1,6 @@
export interface LoginInfo { export interface LoginInfo {
username: string username: string
password: string password: string
uuid: string uuid: string
code: string code: string
} }

View File

@@ -0,0 +1,36 @@
import request from '@/api/request'
import type { ID } from '@/api/common'
// 查询设备管理详细
export function getEquipmentByCode(code: string) {
return request({
url: '/basic/equipment/code/' + code,
method: 'get',
})
}
// 查询设备进站记录列表
export function listEquipmentEntry(params: any) {
return request({
url: '/mes/equipment-entry-log/list',
method: 'get',
params,
})
}
// 新增设备进站记录
export function addEquipmentEntry(data: any) {
return request({
url: '/mes/equipment-entry-log',
method: 'post',
data,
})
}
// 删除设备进站记录
export function delEquipmentEntry(id: ID) {
return request({
url: '/mes/equipment-entry-log/' + id,
method: 'delete',
})
}

View File

@@ -0,0 +1,72 @@
import request from '@/api/request'
import type { LotTraceOrderData, LotTraceOrderQuery } from './model'
import type { ID } from '@/api/common'
// 查询随工单列表
export function listLotTraceOrder(params: LotTraceOrderQuery) {
return request({
url: '/mes/lot-trace-order/list',
method: 'get',
params,
})
}
// 高级查询随工单列表
export function advListLotTraceOrder(params: LotTraceOrderQuery) {
return request({
url: '/mes/lot-trace-order/advList',
method: 'get',
params,
})
}
// 查询随工单详细
export function getLotTraceOrder(id: ID) {
return request({
url: '/mes/lot-trace-order/' + id,
method: 'get',
})
}
// 新增随工单
export function addLotTraceOrder(data: LotTraceOrderData) {
return request({
url: '/mes/lot-trace-order',
method: 'post',
data,
})
}
// 修改随工单
export function updateLotTraceOrder(data: LotTraceOrderData) {
return request({
url: '/mes/lot-trace-order',
method: 'put',
data,
})
}
// 删除随工单
export function delLotTraceOrder(id: ID) {
return request({
url: '/mes/lot-trace-order/' + id,
method: 'delete',
})
}
// 关闭随工单
export function closeLotTraceOrder(id: ID) {
return request({
url: '/mes/lot-trace-order/close/' + id,
method: 'put',
})
}
// 新增质量异常联络单
export function addQualityAbnormalContact(data: any) {
return request({
url: '/mes/qualityAbnormalContact',
method: 'post',
data,
})
}

View File

@@ -0,0 +1,54 @@
import request from '@/api/request'
import type { ID } from '@/api/common'
// 查询库位列表
export function listStorageLocation(params: any) {
return request({
url: '/wip/storageLocation/list',
method: 'get',
params,
})
}
// 高级查询库位列表
export function advListStorageLocation(params: any) {
return request({
url: '/wip/storageLocation/advList',
method: 'get',
params,
})
}
// 查询库位详细
export function getStorageLocation(id: ID) {
return request({
url: '/wip/storageLocation/' + id,
method: 'get',
})
}
// 新增库位
export function addStorageLocation(data: any) {
return request({
url: '/wip/storageLocation',
method: 'post',
data,
})
}
// 修改库位
export function updateStorageLocation(data: any) {
return request({
url: '/wip/storageLocation',
method: 'put',
data,
})
}
// 删除库位
export function delStorageLocation(id: ID) {
return request({
url: '/wip/storageLocation/' + id,
method: 'delete',
})
}

View File

@@ -0,0 +1,37 @@
import request from '@/api/request'
import type { ID } from '@/api/common'
// 查询站点绑定治具列表
export function listStationBindMask(params: any) {
return request({
url: '/mes/station/mask/list',
method: 'get',
params,
})
}
// 为站点绑定治具
export function batchBindMasksToStation(stationId: ID, maskIds: ID[]) {
return request({
url: '/mes/station/' + stationId + '/bind/mask',
method: 'put',
data: maskIds,
})
}
// 为站点绑定治具组
export function bindMaskCombinationToStations(data: any) {
return request({
url: '/mes/station/bind/mask-combination',
method: 'put',
data,
})
}
// 站点解绑治具
export function unbindStationMask(stationMaskId: ID) {
return request({
url: '/mes/station/bind-mask/' + stationMaskId,
method: 'delete',
})
}

View File

@@ -0,0 +1,84 @@
import request from '@/api/request'
import type { MaskCombinationData, MaskCombinationQuery } from './model'
import type { ID } from '@/api/common'
// 查询治具组合列表
export function listMaskCombination(params: MaskCombinationQuery) {
return request({
url: '/tpm/mask/combination/list',
method: 'get',
params,
})
}
// 查询治具组合包含的治具列表
export function listCombinationAssignMask(
id: ID,
params: MaskCombinationQuery,
) {
return request({
url: '/tpm/mask/combination/' + id + '/masks',
method: 'get',
params,
})
}
// 高级查询治具组合列表
export function advListMaskCombination(params: MaskCombinationQuery) {
return request({
url: '/tpm/mask/combination/advList',
method: 'get',
params,
})
}
// 查询治具组合详细
export function getMaskCombination(id: ID) {
return request({
url: '/tpm/mask/combination/' + id,
method: 'get',
})
}
// 新增治具组合
export function addMaskCombination(data: MaskCombinationData) {
return request({
url: '/tpm/mask/combination',
method: 'post',
data,
})
}
// 修改治具组合
export function updateMaskCombination(data: MaskCombinationData) {
return request({
url: '/tpm/mask/combination',
method: 'put',
data,
})
}
// 删除治具组合
export function delMaskCombination(id: ID) {
return request({
url: '/tpm/mask/combination/' + id,
method: 'delete',
})
}
// 新增治具组合与治具关联关系
export function addMaskCombinationAssignment(data: MaskCombinationData) {
return request({
url: '/tpm/mask/combination/assignment',
method: 'post',
data,
})
}
// 删除治具组合与治具关联关系
export function delMaskCombinationAssignment(id: ID) {
return request({
url: '/tpm/mask/combination/assignment/' + id,
method: 'delete',
})
}

View File

@@ -0,0 +1,26 @@
import { BaseEntity, PageQuery, type ID } from '@/api/common'
/**
* 治具组合查询参数
*/
export interface MaskCombinationQuery extends PageQuery {
combinationName?: string
combinationCode?: string
combinationStatus?: string
remark?: string
searchValue?: string
tempId?: ID
timeRange?: [string, string]
}
/**
* 治具组合数据
*/
export interface MaskCombinationData extends BaseEntity {
combinationName?: string
combinationCode?: string
combinationStatus?: string
remark?: string
searchValue?: string
tempId?: ID
timeRange?: [string, string]
}

188
src/api/traceOrderManage/model.d.ts vendored Normal file
View File

@@ -0,0 +1,188 @@
import { BaseEntity, PageQuery, type ID } from '@/api/common'
/**
* 随工单查询参数
*/
export interface LotTraceOrderQuery extends PageQuery {
/** 编码 */
code?: string
/** 状态 */
status?: string
/** 主生产计划的ID */
mpsId?: number
/** 主生产计划编码 */
mpsCode?: string
/** 订单类型 */
orderType?: string
/** 主生产计划明细ID */
mpsDetailId?: number
/** 批号 */
batchNo?: string
/** 主生产计划明细序号 */
mpsDetailSeq?: number
/** 目标产品ID */
tarMaterialId?: number
/** 主物料ID */
masterMaterialId?: number
/** 生产版本ID */
prodVersionId?: number
/** 计划数量 */
planQty?: number
/** OK数量 */
okQty?: number
/** NG数量 */
ngQty?: number
/** 未完成数量 */
unfinishedQty?: number
/** 单位ID */
unitId?: number
/** 计划开始时间范围 */
planStartTimeRange?: [string, string]
/** 计划结束时间范围 */
planEndTimeRange?: [string, string]
/** 扩展字段1 */
extStr1?: string
/** 扩展字段2 */
extStr2?: string
/** 扩展字段3 */
extStr3?: string
/** 扩展字段4 */
extStr4?: string
/** 扩展字段5 */
extStr5?: string
/** 扩展字段6 */
extStr6?: string
/** 扩展字段7 */
extStr7?: string
/** 扩展字段8 */
extStr8?: string
/** 扩展字段9 */
extStr9?: string
/** 扩展字段10 */
extStr10?: string
/** 扩展字段11 */
extStr11?: string
/** 扩展字段12 */
extStr12?: string
/** 扩展字段13 */
extStr13?: string
/** 扩展字段14 */
extStr14?: string
/** 扩展字段15 */
extStr15?: string
/** 扩展字段16 */
extStr16?: string
/** 扩展整型1 */
extInt1?: number
/** 扩展整型2 */
extInt2?: number
/** 扩展小数1 */
extDec1?: number
/** 扩展小数2 */
extDec2?: number
/** 扩展日期1范围 */
extDate1Range?: [string, string]
/** 扩展日期2范围 */
extDate2Range?: [string, string]
/** 删除标志 */
delStatus?: string
/** 创建时间范围 */
createTimeRange?: [string, string]
/** 更新时间范围 */
updateTimeRange?: [string, string]
}
/**
* 随工单数据
*/
export interface LotTraceOrderData extends BaseEntity {
/** 主键ID */
id?: ID
/** 编码 */
code?: string
/** 状态 */
status?: string
/** 主生产计划的ID */
mpsId?: number
/** 主生产计划编码 */
mpsCode?: string
/** 订单类型 */
orderType?: string
/** 主生产计划明细ID */
mpsDetailId?: number
/** 批号 */
batchNo?: string
/** 主生产计划明细序号 */
mpsDetailSeq?: number
/** 目标产品ID */
tarMaterialId?: number
/** 目标产品名称 */
tarMaterialName?: string
/** 目标产品编码 */
tarMaterialCode?: string
/** 主物料ID */
masterMaterialId?: number
/** 生产版本ID */
prodVersionId?: number
/** 计划数量 */
planQty?: number
/** OK数量 */
okQty?: number
/** NG数量 */
ngQty?: number
/** 未完成数量 */
unfinishedQty?: number
/** 单位ID */
unitId?: number
/** 计划开始时间 */
planStartTime?: string
/** 计划结束时间 */
planEndTime?: string
/** 扩展字段1 */
extStr1?: string
/** 扩展字段2 */
extStr2?: string
/** 扩展字段3 */
extStr3?: string
/** 扩展字段4 */
extStr4?: string
/** 扩展字段5 */
extStr5?: string
/** 扩展字段6 */
extStr6?: string
/** 扩展字段7 */
extStr7?: string
/** 扩展字段8 */
extStr8?: string
/** 扩展字段9 */
extStr9?: string
/** 扩展字段10 */
extStr10?: string
/** 扩展字段11 */
extStr11?: string
/** 扩展字段12 */
extStr12?: string
/** 扩展字段13 */
extStr13?: string
/** 扩展字段14 */
extStr14?: string
/** 扩展字段15 */
extStr15?: string
/** 扩展字段16 */
extStr16?: string
/** 扩展整型1 */
extInt1?: number
/** 扩展整型2 */
extInt2?: number
/** 扩展小数1 */
extDec1?: number
/** 扩展小数2 */
extDec2?: number
/** 扩展日期1 */
extDate1?: string
/** 扩展日期2 */
extDate2?: string
/** 备注 */
remark?: string
/** 删除标志 */
delStatus?: string
}

View File

@@ -0,0 +1,2 @@
export * from './infeed'
export * from './outfeed'

View File

@@ -0,0 +1,61 @@
import request from '@/api/request'
import type { ID } from '@/api/common'
// 查询主材进站列表
export function listMainMaterialEntryLog(params: any) {
return request({
url: '/mes/station/entry-log/main-material/list',
method: 'get',
params,
})
}
// 查询主材进站详细
export function getMainMaterialEntryLog(id: ID) {
return request({
url: '/mes/station/entry-log/main-material/' + id,
method: 'get',
})
}
// 新增主材Wafer进站
export function addWaferEntryLog(data: any) {
return request({
url: '/mes/station/entry-log/main-material/wafer',
method: 'post',
data,
})
}
// 通过载具新增主材Wafer进站
export function addWaferEntryLogByCarrier(data: any) {
return request({
url: '/mes/station/entry-log/main-material/wafer/by-carrier',
method: 'post',
data,
})
}
// 新增主材Die进站
export function addDieEntryLog(data: any) {
return request({
url: '/mes/station/entry-log/main-material/die',
method: 'post',
data,
})
}
// 通过载具新增主材Die进站
export function addDieEntryLogByCarrier(data: any) {
return request({
url: '/mes/station/entry-log/main-material/die/by-carrier',
method: 'post',
data,
})
}
// 删除主材进站
export function delMainMaterialEntryLog(id: ID) {
return request({
url: '/mes/station/entry-log/main-material/' + id,
method: 'delete',
})
}

View File

@@ -0,0 +1,54 @@
import request from '@/api/request'
import type { ID } from '@/api/common'
// 查询主材出站列表
export function listMainMaterialOutboundLog(params: any) {
return request({
url: '/mes/station/out-log/main-material/list',
method: 'get',
params,
})
}
// 查询主材出站详细
export function getMainMaterialOutboundLog(id: ID) {
return request({
url: '/mes/station/out-log/main-material/' + id,
method: 'get',
})
}
// 新增主材出站
export function batchAddMainMaterialOutboundLog(data: any) {
return request({
url: '/mes/station/out-log/main-material/batch',
method: 'post',
data,
})
}
// 新增主材出站
export function addWaferDieOutboundLogBySpecifiedNg(data: any) {
return request({
url: '/mes/station/out-log/main-material/wafer-die/by-specified-ng',
method: 'post',
data,
})
}
// 修改主材出站
export function updateMainMaterialOutboundLog(data: any) {
return request({
url: '/mes/station/out-log/main-material',
method: 'put',
data,
})
}
// 删除主材出站
export function delMainMaterialOutboundLog(id: ID) {
return request({
url: '/mes/station/out-log/main-material/' + id,
method: 'delete',
})
}

View File

@@ -0,0 +1,80 @@
import request from '@/api/request'
import type { ID } from '@/api/common'
import type { MesStationQuery, MesStationData } from './model'
// 查询站点列表
export function listStation(params: MesStationQuery) {
return request({
url: '/mes/station/list',
method: 'get',
params,
})
}
// 高级查询站点列表
export function advListStation(params: MesStationQuery) {
return request({
url: '/mes/station/advList',
method: 'get',
params,
})
}
// 查询站点详细
export function getStation(id: ID) {
return request({
url: '/mes/station/' + id,
method: 'get',
})
}
// 判断站点是否为最后一个站点
export function isLastStation(id: ID) {
return request({
url: '/mes/station/' + id + '/isLast',
method: 'get',
})
}
// 新增站点
export function addStation(data: MesStationData) {
return request({
url: '/mes/station',
method: 'post',
data,
})
}
// 修改站点
export function updateStation(data: MesStationData) {
return request({
url: '/mes/station',
method: 'put',
data,
})
}
// 删除站点
export function delStation(id: ID) {
return request({
url: '/mes/station/' + id,
method: 'delete',
})
}
// 站点开工
export function startStation(id: ID) {
return request({
url: '/mes/station/' + id + '/start',
method: 'put',
})
}
// 站点完工
export function completeStation(id: ID, location: any) {
return request({
url: '/mes/station/' + id + '/complete',
method: 'put',
data: location,
})
}

View File

@@ -0,0 +1,71 @@
import { BaseEntity, PageQuery, type ID } from '@/api/common'
/**
* 站点查询参数
*/
export interface MesStationQuery extends PageQuery {
/** 随工单ID */
traceOrderId?: ID
/** 随工单编码 */
traceOrderCode?: string
/** 站点序号 */
seqNo?: number
/** 站点名称 */
name?: string
/** 站点编码 */
code?: string
/** 状态 */
status?: string
/** 计划数量最小值 */
planQtyMin?: number
/** 计划数量最大值 */
planQtyMax?: number
/** 合格数量最小值 */
okQtyMin?: number
/** 合格数量最大值 */
okQtyMax?: number
/** 不合格数量最小值 */
ngQtyMin?: number
/** 不合格数量最大值 */
ngQtyMax?: number
/** 进站时间范围开始 */
arrivalTimeStart?: string
/** 进站时间范围结束 */
arrivalTimeEnd?: string
/** 出战时间范围开始 */
departureTimeStart?: string
/** 出战时间范围结束 */
departureTimeEnd?: string
/** 删除标志 */
delStatus?: string
}
/**
* 站点数据
*/
export interface MesStationData extends BaseEntity {
/** 主键ID */
id?: ID
/** 随工单ID */
traceOrderId?: ID
/** 站点序号 */
seqNo?: number
/** 站点名称 */
name?: string
/** 站点编码 */
code?: string
/** 状态 */
status?: string
/** 计划数量 */
planQty?: number
/** 合格数量 */
okQty?: number
/** 不合格数量 */
ngQty?: number
/** 进站时间 */
arrivalTime?: string
/** 出战时间 */
departureTime?: string
/** 删除标志 */
delStatus?: string
}

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -0,0 +1,11 @@
.ant-table {
.ant-table-thead > tr > th {
font-weight: bold;
font-size: clamp(14px, 1.2vw, 18px);
}
.ant-table-tbody > tr > td {
padding: 12px 8px;
font-size: clamp(12px, 1vw, 16px);
}
}

View File

@@ -1 +1,2 @@
@forward './button'; @forward './button';
@forward './ant-design';

View File

@@ -1,123 +1,155 @@
<template> <template>
<div> <div>
<template v-for="(item, index) in options"> <template v-for="(item, index) in options">
<template v-if="isValueMatch(item.value)"> <template v-if="isValueMatch(item.value)">
<span <span
v-if="(item.elTagType == 'default' || item.elTagType == '') && (item.elTagClass == '' || item.elTagClass == null)" v-if="
:key="item.value" :index="index" :class="item.elTagClass">{{ item.label + " " }}</span> (item.elTagType == 'default' || item.elTagType == '') &&
<a-tag v-else :disable-transitions="true" :key="item.value + ''" :index="index" :color="getColor(item.elTagType)" (item.elTagClass == '' || item.elTagClass == null)
:class="item.elTagClass + ' ' + size">{{ item.label + " " }}</a-tag> "
</template> :key="item.value"
</template> :index="index"
<template v-if="unmatch && showValue"> :class="item.elTagClass"
{{ unmatchArray || handleArray }} >
</template> {{ item.label + ' ' }}
</div> </span>
<a-tag
v-else
:disable-transitions="true"
:key="item.value + ''"
:index="index"
:color="getColor(item.elTagType)"
:class="item.elTagClass + ' ' + size"
>
{{ item.label + ' ' }}
</a-tag>
</template>
</template>
<template v-if="unmatch && showValue">
{{ unmatchArray || handleArray }}
</template>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
interface DictOption { interface DictOption {
label: string; label: string
value: string; value: string
elTagType?: string; elTagType?: string
elTagClass?: string; elTagClass?: string
} }
// 记录未匹配的项 // 记录未匹配的项
const unmatchArray = ref<any>([]) const unmatchArray = ref<any>([])
const props = defineProps({ const props = defineProps({
// 数据 // 数据
options: { options: {
type: Array as () => Array<DictOption>, type: Array as () => Array<DictOption>,
default: null, default: null,
}, },
// 当前的值 // 当前的值
value: [Number, String, Array], value: [Number, String, Array],
// 当未找到匹配的数据时显示value // 当未找到匹配的数据时显示value
showValue: { showValue: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
separator: { separator: {
type: String, type: String,
default: ",", default: ',',
}, },
size: { size: {
type: String, type: String,
default: 'mini', default: 'mini',
}, },
}) })
const values = computed(() => { const values = computed(() => {
if (props.value === null || typeof props.value === 'undefined' || props.value === '') return [] if (
if (typeof props.value === 'number' || typeof props.value === 'boolean') return [props.value] props.value === null ||
return Array.isArray(props.value) ? props.value.map(item => '' + item) : String(props.value).split(props.separator) typeof props.value === 'undefined' ||
props.value === ''
)
return []
if (typeof props.value === 'number' || typeof props.value === 'boolean')
return [props.value]
return Array.isArray(props.value)
? props.value.map((item) => '' + item)
: String(props.value).split(props.separator)
}) })
const unmatch = computed(() => { const unmatch = computed(() => {
unmatchArray.value = [] // eslint-disable-next-line vue/no-side-effects-in-computed-properties
// 没有value不显示 unmatchArray.value = []
if (props.value === null || typeof props.value === 'undefined' || props.value === '' || !Array.isArray(props.options) || props.options.length === 0) return false // 没有value不显示
// 传入值为数组 if (
let unmatch = false // 添加一个标志来判断是否有未匹配项 props.value === null ||
values.value.forEach(item => { typeof props.value === 'undefined' ||
if (!props.options.some(v => v.value == item)) { props.value === '' ||
unmatchArray.value.push(item) !Array.isArray(props.options) ||
unmatch = true // 如果有未匹配项将标志设置为true props.options.length === 0
} )
}) return false
return unmatch // 返回标志的值 // 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项
values.value.forEach((item) => {
if (!props.options.some((v) => v.value == item)) {
unmatchArray.value.push(item)
unmatch = true // 如果有未匹配项将标志设置为true
}
})
return unmatch // 返回标志的值
}) })
function handleArray(array: string[]) { function handleArray(array: string[]) {
if (array.length === 0) return "" if (array.length === 0) return ''
return array.reduce((pre, cur) => { return array.reduce((pre, cur) => {
return pre + " " + cur return pre + ' ' + cur
}) })
} }
function isValueMatch(itemValue: string) { function isValueMatch(itemValue: string) {
return values.value.some(val => val == itemValue) return values.value.some((val) => val == itemValue)
} }
function getColor(tagType: string | undefined) { function getColor(tagType: string | undefined) {
switch (tagType) { switch (tagType) {
case 'primary': case 'primary':
return 'processing' return 'processing'
case 'success': case 'success':
return 'success' return 'success'
case 'info': case 'info':
return 'info' return 'info'
case 'warning': case 'warning':
return 'warning' return 'warning'
case 'danger': case 'danger':
return 'error' return 'error'
default: default:
return 'default' return 'default'
} }
} }
</script> </script>
<style scoped> <style scoped>
.ant-tag+.ant-tag { .ant-tag + .ant-tag {
margin-left: 10px; margin-left: 10px;
} }
.ant-tag{ .ant-tag {
&.large { &.large {
font-size: 18px; font-size: 18px;
line-height: 28px; line-height: 28px;
} }
&.medium { &.medium {
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
} }
&.mini { &.mini {
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
} }
} }
</style> </style>

View File

@@ -1,143 +1,160 @@
<template> <template>
<header class="header-container" :class="{ 'hide-shadow': hideShadow }" <header
:style="{ height, zIndex, lineHeight: height }"> class="header-container"
<div class="opts left-opts" v-if="$slots['left-opts'] || title || $slots.title"> :class="{ 'hide-shadow': hideShadow }"
<a-button v-if="showBack" @click="back">返回</a-button> :style="{ height, zIndex, lineHeight: height }"
<a-button v-if="showHome" @click="backToHome">首页</a-button> >
<slot name="left-opts" /> <div
</div> class="opts left-opts"
<div class="title" v-if="title || $slots.title"> v-if="$slots['left-opts'] || title || $slots.title"
<slot name="title"> >
{{ title }} <a-button v-if="showBack" @click="back">返回</a-button>
</slot> <a-button v-if="showHome" @click="backToHome">首页</a-button>
</div> <slot name="left-opts" />
<div class="opts right-opts" v-if="$slots['right-opts'] || title || $slots.title"> </div>
<slot name="right-opts" /> <div class="title" v-if="title || $slots.title">
<a-button @click="handleLogout" type="primary" danger <slot name="title">
v-if="showLogout && username">退出{{ username }}</a-button> {{ title }}
</div> </slot>
<slot /> </div>
</header> <div
class="opts right-opts"
v-if="$slots['right-opts'] || title || $slots.title"
>
<slot name="right-opts" />
<a-button
@click="handleLogout"
type="primary"
danger
v-if="showLogout && username"
>
退出{{ username }}
</a-button>
</div>
<slot />
</header>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router'
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue'
import { useAuthStore, useUserStore } from '@/store'; import { useAuthStore, useUserStore } from '@/store'
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia'
defineProps({ defineProps({
showHome: { showHome: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showBack: { showBack: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showLogout: { showLogout: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
title: { title: {
type: String, type: String,
default: null, default: null,
}, },
hideShadow: { hideShadow: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
height: { height: {
type: String, type: String,
default: '6vh', default: '',
}, },
zIndex: { zIndex: {
type: Number, type: Number,
default: 999, default: 999,
} },
}); })
defineSlots<{ defineSlots<{
'default'(): any; 'default'(): any
'left-opts'(): any; 'left-opts'(): any
'title'(): any; 'title'(): any
'right-opts'(): any; 'right-opts'(): any
}>(); }>()
const emit = defineEmits(['back']); const emit = defineEmits(['back'])
const router = useRouter(); const router = useRouter()
const userStore = useUserStore(); const userStore = useUserStore()
const { username } = storeToRefs(userStore); const { username } = storeToRefs(userStore)
const authStore = useAuthStore(); const authStore = useAuthStore()
const handleLogout = () => { const handleLogout = () => {
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
content: `是否确认退出登录:${ username.value }`, content: `是否确认退出登录:${username.value}`,
okText: '确定', okText: '确定',
cancelText: '取消', cancelText: '取消',
onOk: () => { onOk: () => {
authStore.logout(); authStore.logout()
}, },
}); })
}; }
const back = () => { const back = () => {
emit('back'); emit('back')
defaultBack(); defaultBack()
}; }
const defaultBack = () => { const defaultBack = () => {
router.go(-1); router.go(-1)
}; }
const backToHome = () => { const backToHome = () => {
router.push({ name: 'Index' }); router.push({ name: 'Index' })
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.header-container { .header-container {
width: 100%; width: 100%;
padding: 0 1rem; padding: 6px 1rem;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
background-color: #1f2e54; background-color: #1f2e54;
color: #fff; color: #fff;
box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px; box-shadow:
rgba(0, 0, 0, 0.1) 0px 4px 6px -1px,
rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
&.hide-shadow { &.hide-shadow {
box-shadow: none; box-shadow: none;
} }
.title { .title {
flex: 14; flex: 14;
color: #fff; color: #fff;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-align: center; text-align: center;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: clamp(16px, 2.5vw, 32px); font-size: clamp(16px, 2.5vw, 32px);
font-weight: bold; font-weight: bold;
} }
.opts { .opts {
height: 100%; height: 100%;
flex: 5; flex: 5;
display: flex; display: flex;
align-items: center; align-items: center;
flex-shrink: 0; flex-shrink: 0;
gap: 8px; gap: 8px;
&.left-opts { &.left-opts {
justify-content: flex-start; justify-content: flex-start;
} }
&.right-opts { &.right-opts {
justify-content: flex-end; justify-content: flex-end;
} }
} }
} }
</style> </style>

View File

@@ -1,46 +1,46 @@
<template> <template>
<div class="title"> <div class="title">
<span>{{ name }}</span> <span>{{ name }}</span>
<a-space class="subtitle"> <a-space class="subtitle">
<slot name="extra" /> <slot />
<a-button v-if="showRefresh" size="small" type="primary" @click="handleRefresh"> <a-button v-if="showRefresh" size="small" @click="handleRefresh">
<template #icon><i-lucide-rotate-ccw /></template>刷新 <template #icon><i-lucide-rotate-ccw /></template>
</a-button> 刷新
</a-space> </a-button>
</div> </a-space>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
defineProps({ defineProps({
name: { name: {
type: String, type: String,
default: '', default: '',
}, },
showRefresh: { showRefresh: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
}); })
const slots = defineSlots<{ defineSlots<{
'default'(): any; 'default'(): any
'extra'(): any; }>()
}>();
const emit = defineEmits(['refresh']); const emit = defineEmits(['refresh'])
const handleRefresh = () => { const handleRefresh = () => {
emit('refresh'); emit('refresh')
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.title { .title {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
border-bottom: 1px solid #c9c9c9; border-bottom: 1px solid #c9c9c9;
padding-bottom: 7px; padding-bottom: 7px;
} }
</style> </style>

View File

@@ -0,0 +1,101 @@
<template>
<a-button class="action-btn" @click="handleHold">Hold</a-button>
<!-- Hold Modal -->
<a-modal
v-model:open="openHoldModal"
title="Hold 操作"
@cancel="handleCloseHold"
@ok="handleSubmitHold"
>
<a-form :colon="false" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-form-item label="工单编码">
<a-input v-model:value="traceOrderStore.traceOrderInfo.code" readonly />
</a-form-item>
<a-form-item label="目标产品编码">
<a-input
v-model:value="traceOrderStore.traceOrderInfo.tarMaterialCode"
readonly
/>
</a-form-item>
<a-form-item label="目标产品名称">
<a-input
v-model:value="traceOrderStore.traceOrderInfo.tarMaterialName"
readonly
/>
</a-form-item>
<a-form-item label="发起工序名称">
<a-input
v-model:value="traceOrderStore.stationInfo.operationTitle"
readonly
/>
</a-form-item>
<a-form-item label="产品规格">
<a-input readonly />
</a-form-item>
<a-form-item label="计划完成日期">
<a-date-picker
v-model:value="planFinishDate"
placeholder="选择计划完成日期"
valueFormat="YYYY-MM-DD HH:mm:ss"
show-time
style="width: 100%"
/>
</a-form-item>
</a-form>
</a-modal>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useDialog } from '@/utils/useDialog'
import { useTraceOrderStore } from '@/store'
import { message } from 'ant-design-vue'
import { addQualityAbnormalContact } from '@/api/traceOrderManage'
const traceOrderStore = useTraceOrderStore()
// useDialog 管理弹窗状态
const { visible: openHoldModal, show, hide } = useDialog()
const planFinishDate = ref('')
const handleHold = () => {
if (!traceOrderStore.currentTraceOrderCode) {
message.error('请先选择工单!')
return
}
show()
}
const handleCloseHold = () => {
planFinishDate.value = ''
hide()
}
const handleSubmitHold = async () => {
const tmpPlanFinishDate = planFinishDate.value
// 修改随工单状态
try {
message.success('Hold 成功!')
planFinishDate.value = ''
openHoldModal.value = false
} catch (error: any) {
message.error(error.message || 'Hold 失败')
return
}
// 添加修改记录
try {
addQualityAbnormalContact({
materialCode: traceOrderStore.traceOrderInfo.tarMaterialCode,
abnormalOperation: traceOrderStore.stationInfo.operationCode,
planFinishDate: tmpPlanFinishDate,
status: 'Hold',
})
} catch (error: any) {
message.error(error.message || '添加记录异常')
return
}
}
</script>

View File

@@ -1,21 +1,21 @@
import { createApp } from "vue"; import { createApp } from 'vue'
import App from "./App.vue"; import App from './App.vue'
// Pinia 状态管理 // Pinia 状态管理
import { createPinia } from "pinia"; import { createPinia } from 'pinia'
const pinia = createPinia(); const pinia = createPinia()
// Vue Router // Vue Router
import router from "./router"; import router from './router'
// 样式文件 // 样式文件
import "ant-design-vue/dist/reset.css"; import 'ant-design-vue/dist/reset.css'
import "@/assets/styles/index.scss"; import '@/assets/styles/index.scss'
const app = createApp(App); const app = createApp(App)
// 字典方法 // 字典方法
import { useDict } from "@/utils/dict"; import { useDict } from '@/utils/dict'
app.config.globalProperties.useDict = useDict; app.config.globalProperties.useDict = useDict
app.use(pinia).use(router).mount("#app"); app.use(pinia).use(router).mount('#app')

View File

@@ -1,120 +1,119 @@
import { createRouter, createWebHistory } from 'vue-router'; import { createRouter, createWebHistory } from 'vue-router'
import { getToken } from "@/utils/auth"; import { getToken } from '@/utils/auth'
const whiteList = ["/login"]; const whiteList = ['/login']
const routes = [ const routes = [
{ {
path: "/", path: '/',
name: "Index", name: 'Index',
component: () => import("@/views/index.vue"), component: () => import('@/views/index.vue'),
}, },
{ {
path: "/login", path: '/login',
name: "Login", name: 'Login',
component: () => import("@/views/login.vue"), component: () => import('@/views/login.vue'),
}, },
{ {
path: "/pwoManage", path: '/traceOrderManage',
name: "PwoManage", name: 'TraceOrderManage',
component: () => import("@/views/pwoManage/layout.vue"), component: () => import('@/views/traceOrderManage/layout.vue'),
redirect: { name: "PwoManageIndex" }, redirect: { name: 'TraceOrderManageIndex' },
children: [ children: [
{ {
path: "", path: '',
name: "PwoManageIndex", name: 'TraceOrderManageIndex',
component: () => import("@/views/pwoManage/index.vue"), component: () => import('@/views/traceOrderManage/index.vue'),
}, },
{ {
path: "infeed", path: 'infeed',
name: "Infeed", name: 'Infeed',
component: () => import("@/views/pwoManage/infeed/layout.vue"), component: () => import('@/views/traceOrderManage/infeed/layout.vue'),
redirect: { name: "PrimaryMaterial" }, redirect: { name: 'PrimaryMaterial' },
children: [ children: [
{ {
path: "primaryMaterial", path: 'primaryMaterial',
name: "PrimaryMaterial", name: 'PrimaryMaterial',
component: () => component: () =>
import("@/views/pwoManage/infeed/primaryMaterial/index.vue"), import('@/views/traceOrderManage/infeed/primaryMaterial/index.vue'),
}, },
{ {
path: "rawMaterial", path: 'rawMaterial',
name: "RawMaterial", name: 'RawMaterial',
component: () => component: () =>
import("@/views/pwoManage/infeed/rawMaterial/index.vue"), import('@/views/traceOrderManage/infeed/rawMaterial/index.vue'),
}, },
{ {
path: "mask", path: 'mask',
name: "Mask", name: 'Mask',
component: () => import("@/views/pwoManage/infeed/mask/index.vue"), component: () =>
}, import('@/views/traceOrderManage/infeed/mask/index.vue'),
{ },
path: "equipment", {
name: "Equipment", path: 'equipment',
component: () => name: 'Equipment',
import("@/views/pwoManage/infeed/equipment/index.vue"), component: () =>
}, import('@/views/traceOrderManage/infeed/equipment/index.vue'),
], },
}, ],
{ },
path: "outfeed", {
name: "Outfeed", path: 'outfeed',
component: () => import("@/views/pwoManage/outfeed/layout.vue"), name: 'Outfeed',
redirect: { name: "JobReport" }, component: () => import('@/views/traceOrderManage/outfeed/layout.vue'),
children: [ redirect: { name: 'JobReport' },
{ children: [
path: "jobReport", {
name: "JobReport", path: 'jobReport',
component: () => name: 'JobReport',
import("@/views/pwoManage/outfeed/jobReport/index.vue"), component: () =>
}, import('@/views/traceOrderManage/outfeed/jobReport/index.vue'),
{ },
path: "parameterConfiguration", {
name: "ParameterConfiguration", path: 'parameterConfiguration',
component: () => name: 'ParameterConfiguration',
import( component: () =>
"@/views/pwoManage/outfeed/parameterConfiguration/index.vue" import('@/views/traceOrderManage/outfeed/parameterConfiguration/index.vue'),
), },
}, {
{ path: 'processGuidance',
path: "processGuidance", name: 'ProcessGuidance',
name: "ProcessGuidance", component: () =>
component: () => import('@/views/traceOrderManage/outfeed/processGuidance/index.vue'),
import("@/views/pwoManage/outfeed/processGuidance/index.vue"), },
}, ],
], },
}, ],
], },
}, ]
];
const router = createRouter({ const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes routes,
}); })
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
const token = getToken(); const token = getToken()
// 已登录,访问 login → 跳首页 // 已登录,访问 login → 跳首页
if (token && to.path === "/login") { if (token && to.path === '/login') {
return next("/"); return next('/')
} }
// 白名单放行 // 白名单放行
if (whiteList.includes(to.path)) { if (whiteList.includes(to.path)) {
return next(); return next()
} }
// 未登录,访问受保护路由 // 未登录,访问受保护路由
if (!token) { if (!token) {
return next({ return next({
path: "/login", path: '/login',
query: { redirect: to.fullPath }, query: { redirect: to.fullPath },
}); })
} }
// 已登录,正常访问 // 已登录,正常访问
next(); next()
}); })
export default router; export default router

10
src/shim-vue.d.ts vendored
View File

@@ -1,5 +1,7 @@
declare module "*.vue" { declare module '*.vue' {
import type { DefineComponent } from "vue"; import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>;
export default component; // eslint-disable-next-line @typescript-eslint/no-empty-object-type
const component: DefineComponent<{}, {}, any>
export default component
} }

View File

@@ -1,74 +0,0 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { message, notification } from "ant-design-vue";
import { useUserStore } from "./user";
import { login, logout as logoutApi } from "@/api/system";
import { setToken, getToken, removeToken, setAccount, removeAccount } from "@/utils/auth";
import type { LoginInfo } from "@/api/system/model";
export const useAuthStore = defineStore("auth", () => {
const route = useRoute();
const router = useRouter();
const userStore = useUserStore();
const loginLoading = ref(false);
const token = ref(getToken() || null);
async function authLogin(params: LoginInfo, rememberMe: boolean) {
try {
loginLoading.value = true;
const res = await login(params);
if (res.code === 200) {
setToken(res.token as string);
await userStore.fetchUserInfo();
notification.success({
message: "登录成功",
description: `欢迎回来,${params.username}`,
duration: 3,
});
let userInfo = {};
if (rememberMe) {
userInfo = {
...params,
rememberMe
};
} else {
userInfo = {
username: params.username
};
}
userStore.clearUserInfo();
userStore.setUserInfo(userInfo);
const redirect = route.query.redirect || "/";
router.replace(redirect as string);
return res;
} else {
// 抛出错误,让调用方处理
throw new Error(res.msg || "登录失败");
}
} catch (error) {
throw error;
} finally {
loginLoading.value = false;
}
}
async function logout() {
// 在实际应用中,这里可以调用后端的退出登录接口
await logoutApi();
removeToken();
userStore.clearUserInfo();
await router.push("/login");
message.success("已成功退出");
}
return {
token,
loginLoading,
authLogin,
logout,
};
});

View File

@@ -1,63 +0,0 @@
import { defineStore } from "pinia";
import { ref } from "vue";
export const useDictStore = defineStore("dict", () => {
const dict = ref<any[]>([]);
// 获取字典
function getDict(_key: string) {
if (_key == null && _key == "") {
return null;
}
try {
dict.value.forEach(item => {
if (item.key == _key) {
return item.value;
}
});
} catch (e) {
return null;
}
}
// 设置字典
function setDict(_key: string, value: string | number) {
if (!_key) return;
dict.value.push({
key: _key,
value: value
});
}
// 删除字典
function removeDict(_key: string) {
var bln = false;
try {
dict.value.forEach((item, index) => {
if (item.key == _key) {
dict.value.splice(index, 1);
bln = true;
}
});
} catch (e) {
bln = false;
}
return bln;
}
// 清空字典
function cleanDict() {
dict.value = new Array();
}
// 初始字典
function initDict() { }
return {
dict,
getDict,
setDict,
removeDict,
cleanDict,
initDict,
};
});

View File

@@ -1,5 +1,7 @@
export * from './auth'; // 系统管理
export * from './user'; export * from './system/auth'
export * from './pwo'; export * from './system/dict'
export * from './job'; export * from './system/user'
export * from './dict';
// 工单管理
export * from './traceOrderManage/traceOrder'

View File

@@ -1,20 +0,0 @@
import { defineStore } from "pinia";
import { reactive } from "vue";
export const useJobStore = defineStore("job", () => {
const jobInfo = reactive<any>({});
function setInfo(job: any) {
Object.assign(jobInfo, job);
}
function resetInfo() {
Object.assign(jobInfo, {});
}
return {
jobInfo,
setInfo,
resetInfo,
};
});

View File

@@ -1,31 +0,0 @@
import { defineStore } from "pinia";
import { reactive } from "vue";
export interface PwoInfo {
code: string;
id: string | number;
orderType: string;
[key: string]: any;
}
export const usePwoStore = defineStore("pwo", () => {
const pwoInfo = reactive<PwoInfo>({
code: "",
id: "",
orderType: "",
});
function setInfo(info: PwoInfo) {
Object.assign(pwoInfo, info);
}
function resetInfo() {
Object.assign(pwoInfo, {});
}
return {
pwoInfo,
setInfo,
resetInfo,
};
});

74
src/store/system/auth.ts Normal file
View File

@@ -0,0 +1,74 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { message, notification } from 'ant-design-vue'
import { useUserStore } from './user'
import { login, logout as logoutApi } from '@/api/system'
import {
setToken,
getToken,
removeToken,
removeAccount,
getRememberMe,
} from '@/utils/auth'
import type { LoginInfo } from '@/api/system/model'
export const useAuthStore = defineStore('auth', () => {
const route = useRoute()
const router = useRouter()
const userStore = useUserStore()
const loginLoading = ref(false)
const token = ref(getToken() || null)
async function authLogin(params: LoginInfo, rememberMe: boolean) {
try {
loginLoading.value = true
const res = await login(params)
if (res.code === 200) {
setToken(res.token as string)
await userStore.fetchUserInfo()
notification.success({
message: '登录成功',
description: `欢迎回来,${params.username}`,
duration: 3,
})
if (rememberMe) {
userStore.setUserInfo({ ...params, rememberMe })
} else {
userStore.clearUserInfo()
userStore.setUsername(params.username)
}
const redirect = route.query.redirect || '/'
router.replace(redirect as string)
return res
} else {
// 抛出错误,让调用方处理
throw new Error(res.msg || '登录失败')
}
} catch (error) {
throw error
} finally {
loginLoading.value = false
}
}
async function logout() {
// 在实际应用中,这里可以调用后端的退出登录接口
await logoutApi()
removeToken()
if (!getRememberMe()) removeAccount()
await router.push('/login')
message.success('已成功退出')
}
return {
token,
loginLoading,
authLogin,
logout,
}
})

65
src/store/system/dict.ts Normal file
View File

@@ -0,0 +1,65 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useDictStore = defineStore('dict', () => {
const dict = ref<any[]>([])
// 获取字典
function getDict(_key: string) {
if (_key == null && _key == '') {
return null
}
try {
dict.value.forEach((item) => {
if (item.key == _key) {
return item.value
}
})
} catch (e) {
console.error(e)
return null
}
}
// 设置字典
function setDict(_key: string, value: string | number) {
if (!_key) return
dict.value.push({
key: _key,
value: value,
})
}
// 删除字典
function removeDict(_key: string) {
let bln = false
try {
dict.value.forEach((item, index) => {
if (item.key == _key) {
dict.value.splice(index, 1)
bln = true
}
})
} catch (e) {
console.error(e)
bln = false
}
return bln
}
// 清空字典
function cleanDict() {
dict.value = []
}
// 初始字典
function initDict() {}
return {
dict,
getDict,
setDict,
removeDict,
cleanDict,
initDict,
}
})

41
src/store/system/user.ts Normal file
View File

@@ -0,0 +1,41 @@
import { defineStore } from 'pinia'
import Cookies from 'js-cookie'
import { setAccount, removeAccount } from '@/utils/auth'
import { ref } from 'vue'
export const useUserStore = defineStore('user', () => {
const username = ref(Cookies.get('username') || '')
async function fetchUserInfo() {
// Simulate API call
}
function setUsername(name: string) {
username.value = name
}
function setUserInfo(params: any) {
username.value = params.username || ''
if (params.rememberMe) {
setAccount({
username: params.username,
password: params.password,
rememberMe: params.rememberMe,
})
}
}
function clearUserInfo() {
username.value = ''
removeAccount()
}
return {
username,
fetchUserInfo,
setUsername,
setUserInfo,
clearUserInfo,
}
})

View File

@@ -0,0 +1,148 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { message } from 'ant-design-vue'
import { debounce } from 'lodash'
import { listStation, getStation } from '@/api/traceOrderManage/station'
import { listLotTraceOrder, getLotTraceOrder } from '@/api/traceOrderManage'
export const useTraceOrderStore = defineStore('traceOrder', () => {
/* ========= 核心业务状态 ========= */
const currentTraceOrderId = ref<string | number>('')
const currentTraceOrderCode = ref<string>('')
const currentStationId = ref<string | number>('')
const currentStationCode = ref<string>('')
const traceOrderOptions = ref<any[]>([])
const traceOrderInfo = ref<any>({})
const stationInfo = ref<any>({})
const stationList = ref<any[]>([])
/* ========= actions ========= */
// 加载工单列表
const fetchTraceOrderOption = debounce(async (code: string) => {
if (!code) return
try {
const { rows } = await listLotTraceOrder({
code,
pageSize: 10,
pageNum: 1,
})
traceOrderOptions.value = rows.map((item) => {
return {
id: item.id,
label: item.code,
value: item.code,
}
})
} catch (error: any) {
message.error(error.message || '获取工单列表失败')
}
}, 500)
// 选择工单
async function selectTraceOrder(value: string, option: any) {
currentTraceOrderId.value = option.id
currentTraceOrderCode.value = value
try {
loadingTraceOrderInfo.value = true
if (!option.id) throw new Error()
const { data } = await getLotTraceOrder(option.id)
traceOrderInfo.value = data
await fetchStationList()
} catch (error: any) {
message.error(error.message || '获取工单信息失败')
} finally {
loadingTraceOrderInfo.value = false
}
}
// 获取工单信息
const loadingTraceOrderInfo = ref(false)
async function fetchTraceOrderInfo() {
if (!currentTraceOrderId.value) return
try {
loadingTraceOrderInfo.value = true
const { data } = await getLotTraceOrder(currentTraceOrderId.value)
traceOrderInfo.value = data
fetchStationList()
} catch (error: any) {
message.error(error.message || '刷新工单信息失败')
} finally {
loadingTraceOrderInfo.value = false
}
}
// 获取站点列表
const loadingStations = ref(false)
async function fetchStationList() {
if (!currentTraceOrderCode.value) return
try {
loadingStations.value = true
const res = await listStation({
traceOrderCode: currentTraceOrderCode.value,
})
stationList.value = (res.rows || []).map((item: any, idx: number) => {
return {
key: String(item.id ?? idx),
index: item.seqNo ?? idx + 1,
...item,
}
})
} catch (error: any) {
message.error(error?.msg || error?.message || '查询站点失败')
} finally {
loadingStations.value = false
}
}
// 获取站点信息
const loadingStationInfo = ref(false)
async function fetchStationInfo() {
if (!currentTraceOrderId.value) return
try {
loadingStationInfo.value = true
const { data } = await getStation(currentStationId.value)
stationInfo.value = data
} catch (error: any) {
console.log(error.message || '获取站点信息失败')
} finally {
loadingStationInfo.value = false
}
}
// 选择站点
async function selectStation(stationId: string) {
currentStationId.value = stationId
stationInfo.value =
stationList.value.find((s: any) => s.id === stationId) ?? {}
currentStationCode.value = stationInfo.value.code
}
async function refreshAll() {
await Promise.all([fetchTraceOrderInfo(), fetchStationList()])
}
return {
currentTraceOrderId,
currentTraceOrderCode,
currentStationId,
currentStationCode,
traceOrderOptions,
traceOrderInfo,
stationInfo,
stationList,
loadingTraceOrderInfo,
loadingStations,
loadingStationInfo,
selectTraceOrder,
selectStation,
refreshAll,
fetchTraceOrderOption,
fetchTraceOrderInfo,
fetchStationList,
fetchStationInfo,
}
})

View File

@@ -1,31 +0,0 @@
import { defineStore } from 'pinia';
import Cookies from 'js-cookie';
import { setAccount, removeAccount } from "@/utils/auth";
import { ref } from 'vue';
export const useUserStore = defineStore("user", () => {
const username = ref(Cookies.get('username') || '');
async function fetchUserInfo() {
// Simulate API call
}
function setUserInfo(params: any) {
setAccount({
username: params.username,
password: params.password,
rememberMe: params.rememberMe ? "true" : "false",
});
}
function clearUserInfo() {
removeAccount();
}
return {
username,
fetchUserInfo,
setUserInfo,
clearUserInfo,
}
});

View File

@@ -1,45 +1,53 @@
import Cookies from 'js-cookie'; import Cookies from 'js-cookie'
import { encrypt } from '@/utils/jsencrypt'; import { encrypt } from '@/utils/jsencrypt'
// 30 天 // 30 天
export const expiresTime = 30; export const expiresTime = 30
export const TokenKey = 'Admin-Token' export const TokenKey = 'Admin-Token'
export function getToken() { export function getToken() {
return Cookies.get(TokenKey) return Cookies.get(TokenKey)
} }
export function setToken(token: string) { export function setToken(token: string) {
return Cookies.set(TokenKey, token) return Cookies.set(TokenKey, token)
} }
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) return Cookies.remove(TokenKey)
} }
export interface AccountInfo { export interface AccountInfo {
username?: string; username?: string
password?: string; password?: string
rememberMe?: 'true' | 'false'; rememberMe?: 'true' | 'false'
}
export function getRememberMe() {
return Cookies.get('rememberMe')
} }
export function getAccount() { export function getAccount() {
return { return {
username: Cookies.get("username"), username: Cookies.get('username'),
password: Cookies.get("password"), password: Cookies.get('password'),
rememberMe: Cookies.get("rememberMe"), }
};
} }
export function setAccount(account: AccountInfo) { export function setAccount(account: AccountInfo) {
account.username && Cookies.set("username", account.username, { expires: expiresTime}); if (account.username)
account.password && Cookies.set("password", encrypt(account.password) as string, { expires: expiresTime}); Cookies.set('username', account.username, { expires: expiresTime })
account.rememberMe != null && Cookies.set("rememberMe", account.rememberMe, { expires: expiresTime}); if (account.password)
Cookies.set('password', encrypt(account.password) as string, {
expires: expiresTime,
})
if (account.rememberMe)
Cookies.set('rememberMe', account.rememberMe, { expires: expiresTime })
} }
export function removeAccount() { export function removeAccount() {
Cookies.remove("username"); Cookies.remove('username')
Cookies.remove("password"); Cookies.remove('password')
Cookies.remove("rememberMe"); Cookies.remove('rememberMe')
} }

View File

@@ -0,0 +1,8 @@
import { message } from 'ant-design-vue'
// 复制到剪贴板
export const handleCopy = async (text: string | number | undefined) => {
if (!text) return
await navigator.clipboard.writeText(String(text))
message.success(`已复制: ${text}`)
}

View File

@@ -1,4 +1,4 @@
import { ref, onMounted, onBeforeUnmount } from 'vue'; import { ref, onMounted, onBeforeUnmount } from 'vue'
/** /**
* 格式化日期时间 * 格式化日期时间
@@ -6,27 +6,30 @@ import { ref, onMounted, onBeforeUnmount } from 'vue';
* @param format 格式字符串,默认 'YYYY-MM-DD HH:mm:ss' * @param format 格式字符串,默认 'YYYY-MM-DD HH:mm:ss'
* @returns 格式化后的时间字符串 * @returns 格式化后的时间字符串
*/ */
export function formatDateTime(date: Date | number | string, format = 'YYYY-MM-DD HH:mm:ss'): string { export function formatDateTime(
const d = new Date(date); date: Date | number | string,
format = 'YYYY-MM-DD HH:mm:ss',
): string {
const d = new Date(date)
if (isNaN(d.getTime())) { if (isNaN(d.getTime())) {
return ''; return ''
} }
const year = d.getFullYear(); const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0'); const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0'); const day = String(d.getDate()).padStart(2, '0')
const hours = String(d.getHours()).padStart(2, '0'); const hours = String(d.getHours()).padStart(2, '0')
const minutes = String(d.getMinutes()).padStart(2, '0'); const minutes = String(d.getMinutes()).padStart(2, '0')
const seconds = String(d.getSeconds()).padStart(2, '0'); const seconds = String(d.getSeconds()).padStart(2, '0')
return format return format
.replace('YYYY', String(year)) .replace('YYYY', String(year))
.replace('MM', month) .replace('MM', month)
.replace('DD', day) .replace('DD', day)
.replace('HH', hours) .replace('HH', hours)
.replace('mm', minutes) .replace('mm', minutes)
.replace('ss', seconds); .replace('ss', seconds)
} }
/** /**
@@ -35,7 +38,7 @@ export function formatDateTime(date: Date | number | string, format = 'YYYY-MM-D
* @returns 当前时间字符串 * @returns 当前时间字符串
*/ */
export function getCurrentTime(format = 'YYYY-MM-DD HH:mm:ss'): string { export function getCurrentTime(format = 'YYYY-MM-DD HH:mm:ss'): string {
return formatDateTime(new Date(), format); return formatDateTime(new Date(), format)
} }
/** /**
@@ -44,28 +47,28 @@ export function getCurrentTime(format = 'YYYY-MM-DD HH:mm:ss'): string {
* @returns 响应式时间字符串 * @returns 响应式时间字符串
*/ */
export function useRealTime(format = 'YYYY-MM-DD HH:mm:ss') { export function useRealTime(format = 'YYYY-MM-DD HH:mm:ss') {
const currentTime = ref(getCurrentTime(format)); const currentTime = ref(getCurrentTime(format))
let timer: NodeJS.Timeout | null = null; let timer: NodeJS.Timeout | null = null
const startTimer = () => { const startTimer = () => {
timer = setInterval(() => { timer = setInterval(() => {
currentTime.value = getCurrentTime(format); currentTime.value = getCurrentTime(format)
}, 1000); }, 1000)
}; }
const stopTimer = () => { const stopTimer = () => {
if (timer) { if (timer) {
clearInterval(timer); clearInterval(timer)
timer = null; timer = null
} }
}; }
onMounted(startTimer); onMounted(startTimer)
onBeforeUnmount(stopTimer); onBeforeUnmount(stopTimer)
return { return {
currentTime, currentTime,
startTimer, startTimer,
stopTimer stopTimer,
}; }
} }

View File

@@ -1,4 +1,4 @@
import { useDictStore } from "@/store"; import { useDictStore } from '@/store'
import { getDicts } from '@/api/system/dict' import { getDicts } from '@/api/system/dict'
import { ref, toRefs } from 'vue' import { ref, toRefs } from 'vue'
@@ -6,21 +6,26 @@ import { ref, toRefs } from 'vue'
* 获取字典数据 * 获取字典数据
*/ */
export function useDict(...args: string[]) { export function useDict(...args: string[]) {
const res = ref<any>({}) const res = ref<any>({})
return (() => { return (() => {
args.forEach((dictType, index) => { args.forEach((dictType) => {
res.value[dictType] = [] res.value[dictType] = []
const dicts = useDictStore().getDict(dictType) const dicts = useDictStore().getDict(dictType)
if (dicts) { if (dicts) {
res.value[dictType] = dicts res.value[dictType] = dicts
} else { } else {
getDicts(dictType).then((resp: any) => { getDicts(dictType).then((resp: any) => {
res.value[dictType] = resp.data.map((p: any) => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass })) res.value[dictType] = resp.data.map((p: any) => ({
useDictStore().setDict(dictType, res.value[dictType]) label: p.dictLabel,
}) value: p.dictValue,
} elTagType: p.listClass,
}) elTagClass: p.cssClass,
return toRefs(res.value) }))
})() useDictStore().setDict(dictType, res.value[dictType])
})
}
})
return toRefs(res.value)
})()
} }

View File

@@ -1,31 +1,31 @@
import JSEncrypt from "jsencrypt"; import JSEncrypt from 'jsencrypt'
// 密钥对生成 http://web.chacuo.net/netrsakeypair // 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey = const publicKey =
"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n" + 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' +
"nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=="; 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
const privateKey = const privateKey =
"MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n" + 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' +
"7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n" + '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +
"PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n" + 'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' +
"kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n" + 'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' +
"cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n" + 'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' +
"DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n" + 'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' +
"YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n" + 'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' +
"UP8iWi1Qw0Y="; 'UP8iWi1Qw0Y='
// 加密 // 加密
export function encrypt(txt: string) { export function encrypt(txt: string) {
const encryptor = new JSEncrypt(); const encryptor = new JSEncrypt()
encryptor.setPublicKey(publicKey); // 设置公钥 encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt); // 对数据进行加密 return encryptor.encrypt(txt) // 对数据进行加密
} }
// 解密 // 解密
export function decrypt(txt: string) { export function decrypt(txt: string) {
const encryptor = new JSEncrypt(); const encryptor = new JSEncrypt()
encryptor.setPrivateKey(privateKey); // 设置私钥 encryptor.setPrivateKey(privateKey) // 设置私钥
return encryptor.decrypt(txt); // 对数据进行解密 return encryptor.decrypt(txt) // 对数据进行解密
} }

View File

@@ -1,7 +1,7 @@
export const delay = (time: number, data?: any) => { export const delay = (time: number, data?: any) => {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
resolve(data); resolve(data)
}, time); }, time)
}) as any; }) as any
}; }

View File

@@ -1,33 +1,33 @@
import { ref } from 'vue'; import { ref } from 'vue'
/** /**
* Dialog控制Hook * Dialog控制Hook
* @returns visible显隐状态、show显示、hide隐藏、toggle切换 * @returns visible显隐状态、show显示、hide隐藏、toggle切换
*/ */
export function useDialog(initialVisible:boolean = false): { export function useDialog(initialVisible: boolean = false): {
visible: import('vue').Ref<boolean>, visible: import('vue').Ref<boolean>
show: () => void, show: () => void
hide: () => void, hide: () => void
toggle: () => void toggle: () => void
} { } {
const visible = ref(initialVisible); const visible = ref(initialVisible)
const show = () => { const show = () => {
visible.value = true; visible.value = true
}; }
const hide = () => { const hide = () => {
visible.value = false; visible.value = false
}; }
const toggle = () => { const toggle = () => {
visible.value = !visible.value; visible.value = !visible.value
}; }
return { return {
visible, visible,
show, show,
hide, hide,
toggle toggle,
}; }
} }

View File

@@ -1,41 +1,43 @@
import { ref } from 'vue'; import { ref } from 'vue'
/** /**
* Loading控制Hook * Loading控制Hook
* @returns loading加载状态、startLoading开始加载、stopLoading停止加载、withLoading包装异步函数 * @returns loading加载状态、startLoading开始加载、stopLoading停止加载、withLoading包装异步函数
*/ */
export function useLoading(initialLoading = false) { export function useLoading(initialLoading = false) {
const loading = ref(initialLoading); const loading = ref(initialLoading)
const startLoading = () => { const startLoading = () => {
loading.value = true; loading.value = true
}; }
const stopLoading = () => { const stopLoading = () => {
loading.value = false; loading.value = false
}; }
/** /**
* 包装异步函数自动控制loading状态 * 包装异步函数自动控制loading状态
* @param fn 异步函数 * @param fn 异步函数
* @returns 包装后的函数 * @returns 包装后的函数
*/ */
const withLoading = <T extends (...args: any[]) => Promise<any>>(fn: T): T => { const withLoading = <T extends (...args: any[]) => Promise<any>>(
return (async (...args: any[]) => { fn: T,
startLoading(); ): T => {
try { return (async (...args: any[]) => {
const result = await fn(...args); startLoading()
return result; try {
} finally { const result = await fn(...args)
stopLoading(); return result
} } finally {
}) as T; stopLoading()
}; }
}) as T
}
return { return {
loading, loading,
startLoading, startLoading,
stopLoading, stopLoading,
withLoading withLoading,
}; }
} }

View File

@@ -3,9 +3,9 @@
* @returns 生成的UUID字符串 * @returns 生成的UUID字符串
*/ */
export function generateUUID(): string { export function generateUUID(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = Math.random() * 16 | 0; const r = (Math.random() * 16) | 0
const v = c === 'x' ? r : (r & 0x3 | 0x8); const v = c === 'x' ? r : (r & 0x3) | 0x8
return v.toString(16); return v.toString(16)
}); })
} }

View File

@@ -1,18 +1,22 @@
<template> <template>
<div class="ipc-dashboard"> <div class="ipc-dashboard">
<Header title="过站工控机" showLogout /> <Header title="MES 过站平台" showLogout />
<div class="menu-grid"> <div class="menu-grid">
<a-card class="menu-card" shadow="hover" @click="handleJumpTo('PwoManage')"> <a-card
<div class="icon-wrap"> class="menu-card"
<i-lucide-building /> shadow="hover"
</div> @click="handleJumpTo('TraceOrderManage')"
<div class="text"> >
<div class="title">工单管理</div> <div class="icon-wrap">
<div class="desc">管理生产工单和进度</div> <i-lucide-building />
</div> </div>
</a-card> <div class="text">
<!-- <div class="title">工单管理</div>
<div class="desc">管理生产工单和进度</div>
</div>
</a-card>
<!--
<a-card class="menu-card" shadow="hover" @click="handleJumpTo('stationControl')"> <a-card class="menu-card" shadow="hover" @click="handleJumpTo('stationControl')">
<div class="icon-wrap"> <div class="icon-wrap">
<i-lucide-monitor /> <i-lucide-monitor />
@@ -82,187 +86,187 @@
<div class="desc">系统参数配置</div> <div class="desc">系统参数配置</div>
</div> </div>
</a-card> --> </a-card> -->
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup lang="ts">
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router'
const router = useRouter(); const router = useRouter()
const handleJumpTo = (name) => { const handleJumpTo = (name: string) => {
router.push({ name }); router.push({ name })
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.ipc-dashboard { .ipc-dashboard {
background: #f5f7fa; background: #f5f7fa;
height: 100vh; height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
} }
.menu-grid { .menu-grid {
flex: 1; flex: 1;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 8vh 6vh; padding: 8vh 6vh;
gap: 4%; gap: 4%;
row-gap: 6vh; row-gap: 6vh;
.menu-card { .menu-card {
width: 22%; width: 22%;
cursor: pointer; cursor: pointer;
border-radius: 1vw; border-radius: 1vw;
overflow: visible; overflow: visible;
:deep(.ant-card-body) { :deep(.ant-card-body) {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 24px 16px; padding: 24px 16px;
gap: 1vh; gap: 1vh;
.icon-wrap { .icon-wrap {
width: 5vw; width: 5vw;
height: 5vw; height: 5vw;
border-radius: 50%; border-radius: 50%;
background: linear-gradient(180deg, #0c6bd1 0%, #1c6fb8 100%); background: linear-gradient(180deg, #0c6bd1 0%, #1c6fb8 100%);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #fff; color: #fff;
font-size: 3vw; font-size: 3vw;
} }
.text { .text {
text-align: center; text-align: center;
.title { .title {
font-size: 1.2vw; font-size: 1.2vw;
font-weight: 500; font-weight: 500;
margin-bottom: 6px; margin-bottom: 6px;
} }
.desc { .desc {
color: #8b96a7; color: #8b96a7;
font-size: 0.9vw; font-size: 0.9vw;
} }
} }
} }
} }
} }
:deep(.login-dialog) { :deep(.login-dialog) {
.ant-modal { .ant-modal {
width: 48vw; width: 48vw;
left: 26vw; left: 26vw;
border-radius: 16px !important; border-radius: 16px !important;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
overflow: hidden; overflow: hidden;
} }
.ant-modal-header { .ant-modal-header {
background: linear-gradient(135deg, #0c6bd1 0%, #1c6fb8 100%); background: linear-gradient(135deg, #0c6bd1 0%, #1c6fb8 100%);
border-bottom: none; border-bottom: none;
padding: 24px 20px !important; padding: 24px 20px !important;
.ant-modal-title { .ant-modal-title {
color: #fff; color: #fff;
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
} }
.ant-modal-close-x { .ant-modal-close-x {
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
font-size: 20px; font-size: 20px;
&:hover { &:hover {
color: #fff; color: #fff;
} }
} }
} }
.ant-modal-body { .ant-modal-body {
padding: 32px 28px !important; padding: 32px 28px !important;
} }
.login-form { .login-form {
.ant-form-item { .ant-form-item {
margin-bottom: 22px; margin-bottom: 22px;
.ant-form-item-label > label { .ant-form-item-label > label {
color: #1f2937; color: #1f2937;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
padding-bottom: 10px; padding-bottom: 10px;
} }
.ant-input { .ant-input {
font-size: 16px; font-size: 16px;
height: 42px; height: 42px;
border-radius: 8px; border-radius: 8px;
border: 1px solid #e5e7eb; border: 1px solid #e5e7eb;
transition: all 0.3s ease; transition: all 0.3s ease;
padding: 0 1rem; padding: 0 1rem;
&:focus, &:focus,
&:hover { &:hover {
border-color: #0c6bd1; border-color: #0c6bd1;
box-shadow: 0 0 0 3px rgba(12, 107, 209, 0.1); box-shadow: 0 0 0 3px rgba(12, 107, 209, 0.1);
} }
} }
.ant-input-password-icon { .ant-input-password-icon {
color: #bfbfbf; color: #bfbfbf;
&:hover { &:hover {
color: #0c6bd1; color: #0c6bd1;
} }
} }
} }
} }
.ant-modal-footer { .ant-modal-footer {
padding: 20px 28px !important; padding: 20px 28px !important;
border-top: 1px solid #f0f0f0; border-top: 1px solid #f0f0f0;
background: #fafafa; background: #fafafa;
border-radius: 0 0 16px 16px; border-radius: 0 0 16px 16px;
.ant-btn { .ant-btn {
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
border-radius: 8px; border-radius: 8px;
padding: 10px 32px !important; padding: 10px 32px !important;
transition: all 0.3s ease; transition: all 0.3s ease;
&:not(.btn-primary) { &:not(.btn-primary) {
border-color: #d9d9d9; border-color: #d9d9d9;
color: #595959; color: #595959;
&:hover { &:hover {
border-color: #0c6bd1; border-color: #0c6bd1;
color: #0c6bd1; color: #0c6bd1;
background: #f0f7ff; background: #f0f7ff;
} }
} }
} }
.btn-primary { .btn-primary {
background: linear-gradient(135deg, #0c6bd1 0%, #1c6fb8 100%); background: linear-gradient(135deg, #0c6bd1 0%, #1c6fb8 100%);
border: none; border: none;
color: #fff; color: #fff;
&:hover { &:hover {
box-shadow: 0 4px 16px rgba(12, 107, 209, 0.4); box-shadow: 0 4px 16px rgba(12, 107, 209, 0.4);
} }
} }
} }
} }
</style> </style>

View File

@@ -3,21 +3,21 @@ import { ref, reactive } from 'vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { getCaptcha } from '@/api/system' import { getCaptcha } from '@/api/system'
import type { LoginInfo } from '@/api/system/model' import type { LoginInfo } from '@/api/system/model'
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form'
import { useAuthStore } from '@/store'; import { useAuthStore } from '@/store'
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia'
import { getAccount } from '@/utils/auth'; import { getAccount, getRememberMe } from '@/utils/auth'
import { decrypt } from '@/utils/jsencrypt'; import { decrypt } from '@/utils/jsencrypt'
const authStore = useAuthStore(); const authStore = useAuthStore()
const { loginLoading } = storeToRefs(authStore); const { loginLoading } = storeToRefs(authStore)
// 表单数据 // 表单数据
const formData = reactive<LoginInfo>({ const formData = reactive<LoginInfo>({
username: '', username: '',
password: '', password: '',
uuid: '', uuid: '',
code: '', code: '',
}) })
// 验证码图片 // 验证码图片
@@ -28,60 +28,55 @@ const rememberMe = ref(false)
// 表单验证规则 // 表单验证规则
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
username: [ username: [{ required: true, message: '请输入用户名', trigger: 'change' }],
{ required: true, message: '请输入用户名', trigger: 'change' } password: [{ required: true, message: '请输入密码', trigger: 'change' }],
], code: [{ required: true, message: '请输入验证码', trigger: 'change' }],
password: [
{ required: true, message: '请输入密码', trigger: 'change' }
],
code: [
{ required: true, message: '请输入验证码', trigger: 'change' }
]
} }
// 获取验证码 // 获取验证码
const refreshCaptcha = async () => { const refreshCaptcha = async () => {
try { try {
captchaImg.value = '' captchaImg.value = ''
captchaLoading.value = true captchaLoading.value = true
await getCaptcha().then((res: any) => { await getCaptcha().then((res: any) => {
loadCaptchaFail.value = false; loadCaptchaFail.value = false
if (res.captchaOnOff) { if (res.captchaOnOff) {
captchaImg.value = "data:image/gif;base64," + res.img captchaImg.value = 'data:image/gif;base64,' + res.img
rules.code[0].required = true; rules.code[0].required = true
} else { } else {
rules.code[0].required = false; rules.code[0].required = false
} }
formData.uuid = res.uuid formData.uuid = res.uuid
formData.code = '' // 清空验证码输入 formData.code = '' // 清空验证码输入
}) })
} catch (error) { } catch (error) {
loadCaptchaFail.value = true; loadCaptchaFail.value = true
message.error('获取验证码失败') message.error('获取验证码失败')
console.error('获取验证码失败:', error) console.error('获取验证码失败:', error)
} finally { } finally {
captchaLoading.value = false captchaLoading.value = false
} }
} }
// 初始化 // 初始化
const initLoginForm = () => { const initLoginForm = () => {
const { username, password, rememberMe: isRememberMe } = getAccount(); const { username, password } = getAccount()
if (isRememberMe && isRememberMe === 'true') { const isRememberMe = getRememberMe()
rememberMe.value = true; if (isRememberMe && isRememberMe === 'true') {
formData.username = username || ''; rememberMe.value = true
formData.password = decrypt(password || '') || ''; formData.username = username || ''
} formData.password = decrypt(password || '') || ''
}
} }
// 登录处理 // 登录处理
const handleLogin = async () => { const handleLogin = async () => {
try { try {
await authStore.authLogin(formData, rememberMe.value); await authStore.authLogin(formData, rememberMe.value)
} catch (error: any) { } catch (error: any) {
message.error(error.message || error.msg || '登录失败'); message.error(error.message || error.msg || '登录失败')
await refreshCaptcha(); await refreshCaptcha()
} }
} }
initLoginForm() initLoginForm()
@@ -90,113 +85,122 @@ refreshCaptcha()
</script> </script>
<template> <template>
<div class="login-container"> <div class="login-container">
<!-- 背景图 --> <!-- 背景图 -->
<div class="login-background"></div> <div class="login-background"></div>
<!-- 登录框 --> <!-- 登录框 -->
<div class="login-box"> <div class="login-box">
<div class="login-header"> <div class="login-header">
<h2 class="login-title"> <h2 class="login-title">
<i-lucide-cpu class="title-icon" /> <i-lucide-cpu class="title-icon" />
工业控制系统 HMI 宏禧 MES 过站平台
</h2> </h2>
<p class="login-subtitle">请登录您的账户</p> <p class="login-subtitle">请登录您的账户</p>
</div> </div>
<a-form <a-form
:model="formData" :model="formData"
:rules="rules" :rules="rules"
@finish="handleLogin" @finish="handleLogin"
class="login-form" class="login-form"
layout="vertical" layout="vertical"
> >
<!-- 用户名 --> <!-- 用户名 -->
<a-form-item name="username" class="form-item"> <a-form-item name="username" class="form-item">
<a-input <a-input
v-model:value="formData.username" v-model:value="formData.username"
placeholder="请输入用户名" placeholder="请输入用户名"
size="large" size="large"
class="login-input" class="login-input"
allow-clear allow-clear
> >
<template #prefix> <template #prefix>
<i-lucide-user class="input-icon" /> <i-lucide-user class="input-icon" />
</template> </template>
</a-input> </a-input>
</a-form-item> </a-form-item>
<!-- 密码 --> <!-- 密码 -->
<a-form-item name="password" class="form-item"> <a-form-item name="password" class="form-item">
<a-input-password <a-input-password
v-model:value="formData.password" v-model:value="formData.password"
placeholder="请输入密码" placeholder="请输入密码"
size="large" size="large"
class="login-input" class="login-input"
:visibility-toggle="false" :visibility-toggle="false"
allow-clear allow-clear
> >
<template #prefix> <template #prefix>
<i-lucide-lock class="input-icon" /> <i-lucide-lock class="input-icon" />
</template> </template>
</a-input-password> </a-input-password>
</a-form-item> </a-form-item>
<!-- 验证码 --> <!-- 验证码 -->
<a-form-item name="code" class="form-item" v-if="rules.code[0].required"> <a-form-item
<div class="captcha-container"> name="code"
<a-input class="form-item"
v-model:value="formData.code" v-if="rules.code[0].required"
placeholder="请输入验证码" >
size="large" <div class="captcha-container">
class="login-input captcha-input" <a-input
allow-clear v-model:value="formData.code"
> placeholder="请输入验证码"
<template #prefix> size="large"
<i-lucide-shield-check class="input-icon" /> class="login-input captcha-input"
</template> allow-clear
</a-input> >
<div class="captcha-image-container" @click="refreshCaptcha"> <template #prefix>
<img <i-lucide-shield-check class="input-icon" />
v-if="captchaImg" </template>
:src="captchaImg" </a-input>
alt="验证码" <div class="captcha-image-container" @click="refreshCaptcha">
class="captcha-image" <img
/> v-if="captchaImg"
<div v-else-if="captchaLoading" class="captcha-loading"> :src="captchaImg"
<i-lucide-loader class="loading-icon" /> alt="验证码"
</div> class="captcha-image"
<div v-else-if="!captchaLoading && loadCaptchaFail" class="captcha-loading"> />
获取失败 <div v-else-if="captchaLoading" class="captcha-loading">
</div> <i-lucide-loader class="loading-icon" />
<div class="captcha-refresh-hint"> </div>
<i-lucide-refresh-cw class="refresh-icon" /> <div
点击刷新 v-else-if="!captchaLoading && loadCaptchaFail"
</div> class="captcha-loading"
</div> >
</div> 获取失败
</a-form-item> </div>
<div class="captcha-refresh-hint">
<i-lucide-refresh-cw class="refresh-icon" />
点击刷新
</div>
</div>
</div>
</a-form-item>
<a-form-item name="rememberMe" class="form-item"> <a-form-item name="rememberMe" class="form-item">
<a-checkbox v-model:checked="rememberMe" style="color: #ddd;">记住密码</a-checkbox> <a-checkbox v-model:checked="rememberMe" style="color: #ddd">
</a-form-item> 记住密码
</a-checkbox>
</a-form-item>
<!-- 登录按钮 --> <!-- 登录按钮 -->
<a-form-item class="form-item"> <a-form-item class="form-item">
<a-button <a-button
type="primary" type="primary"
html-type="submit" html-type="submit"
size="large" size="large"
:loading="loginLoading" :loading="loginLoading"
class="login-button" class="login-button"
block block
> >
{{ loginLoading ? '登录中...' : '登录' }} {{ loginLoading ? '登录中...' : '登录' }}
</a-button> </a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -224,319 +228,319 @@ $spacing-xl: 32px;
$transition: all 0.3s ease; $transition: all 0.3s ease;
.login-container { .login-container {
position: relative; position: relative;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
} }
.login-background { .login-background {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-image: url('/bg.jpg'); background-image: url('/bg.jpg');
background-size: cover; background-size: cover;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
filter: blur(2px); filter: blur(2px);
z-index: 1; z-index: 1;
&::after { &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
rgba(74, 144, 226, 0.3) 0%, rgba(74, 144, 226, 0.3) 0%,
rgba(58, 123, 213, 0.4) 50%, rgba(58, 123, 213, 0.4) 50%,
rgba(91, 160, 242, 0.3) 100% rgba(91, 160, 242, 0.3) 100%
); );
} }
} }
.login-box { .login-box {
position: relative; position: relative;
z-index: 2; z-index: 2;
width: 420px; width: 420px;
padding: $spacing-xl; padding: $spacing-xl;
background: $bg-glass; background: $bg-glass;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
border: 1px solid $border-light; border: 1px solid $border-light;
border-radius: $border-radius-lg; border-radius: $border-radius-lg;
box-shadow: box-shadow:
0 8px 32px rgba(0, 0, 0, 0.1), 0 8px 32px rgba(0, 0, 0, 0.1),
0 4px 16px rgba(0, 0, 0, 0.1), 0 4px 16px rgba(0, 0, 0, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.2); inset 0 1px 0 rgba(255, 255, 255, 0.2);
animation: slideInUp 0.6s ease-out; animation: slideInUp 0.6s ease-out;
} }
@keyframes slideInUp { @keyframes slideInUp {
from { from {
opacity: 0; opacity: 0;
transform: translateY(30px); transform: translateY(30px);
} }
to { to {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);
} }
} }
.login-header { .login-header {
text-align: center; text-align: center;
margin-bottom: $spacing-xl; margin-bottom: $spacing-xl;
.login-title { .login-title {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: $spacing-sm; gap: $spacing-sm;
font-size: 24px; font-size: 24px;
font-weight: 600; font-weight: 600;
color: $white; color: $white;
margin: 0 0 $spacing-sm 0; margin: 0 0 $spacing-sm 0;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
.title-icon { .title-icon {
font-size: 28px; font-size: 28px;
color: $primary-light; color: $primary-light;
} }
} }
.login-subtitle { .login-subtitle {
font-size: 14px; font-size: 14px;
color: $text-light; color: $text-light;
margin: 0; margin: 0;
opacity: 0.9; opacity: 0.9;
} }
} }
.login-form { .login-form {
.form-item { .form-item {
margin-bottom: $spacing-lg; margin-bottom: $spacing-lg;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
} }
.login-input { .login-input {
height: 48px; height: 48px;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: $border-radius; border-radius: $border-radius;
transition: $transition; transition: $transition;
&:hover { &:hover {
border-color: rgba(255, 255, 255, 0.4); border-color: rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.15);
} }
&:focus-within { &:focus-within {
border-color: $primary-light; border-color: $primary-light;
background: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.2);
box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2); box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
} }
:deep(.ant-input) { :deep(.ant-input) {
background: transparent; background: transparent;
border: none; border: none;
color: $white; color: $white;
font-size: 14px; font-size: 14px;
&::placeholder { &::placeholder {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
} }
} }
:deep(.ant-input-password-icon) { :deep(.ant-input-password-icon) {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
&:hover { &:hover {
color: $white; color: $white;
} }
} }
} }
.input-icon { .input-icon {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
font-size: 16px; font-size: 16px;
} }
} }
.captcha-container { .captcha-container {
display: flex; display: flex;
gap: $spacing-md; gap: $spacing-md;
align-items: stretch; align-items: stretch;
.captcha-input { .captcha-input {
flex: 1; flex: 1;
} }
.captcha-image-container { .captcha-image-container {
position: relative; position: relative;
width: 120px; width: 120px;
height: 48px; height: 48px;
border: 1px solid rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: $border-radius; border-radius: $border-radius;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
transition: $transition; transition: $transition;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
&:hover { &:hover {
border-color: $primary-light; border-color: $primary-light;
.captcha-refresh-hint { .captcha-refresh-hint {
opacity: 1; opacity: 1;
} }
} }
.captcha-image { .captcha-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
display: block; display: block;
} }
.captcha-loading { .captcha-loading {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
.loading-icon { .loading-icon {
color: $white; color: $white;
font-size: 20px; font-size: 20px;
animation: spin 1s linear infinite; animation: spin 1s linear infinite;
} }
} }
.captcha-refresh-hint { .captcha-refresh-hint {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.7);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: $white; color: $white;
font-size: 12px; font-size: 12px;
opacity: 0; opacity: 0;
transition: $transition; transition: $transition;
.refresh-icon { .refresh-icon {
font-size: 16px; font-size: 16px;
margin-bottom: 2px; margin-bottom: 2px;
} }
} }
} }
} }
@keyframes spin { @keyframes spin {
from { from {
transform: rotate(0deg); transform: rotate(0deg);
} }
to { to {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
.login-button { .login-button {
height: 48px; height: 48px;
background: linear-gradient(135deg, $primary-color 0%, $primary-dark 100%); background: linear-gradient(135deg, $primary-color 0%, $primary-dark 100%);
border: none; border: none;
border-radius: $border-radius; border-radius: $border-radius;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
transition: $transition; transition: $transition;
box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3); box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
&:hover { &:hover {
background: linear-gradient(135deg, $primary-light 0%, $primary-color 100%); background: linear-gradient(135deg, $primary-light 0%, $primary-color 100%);
transform: translateY(-2px); transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4); box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
} }
&:active { &:active {
transform: translateY(0); transform: translateY(0);
} }
.button-icon { .button-icon {
margin-right: $spacing-sm; margin-right: $spacing-sm;
font-size: 18px; font-size: 18px;
} }
:deep(.ant-btn-loading-icon) { :deep(.ant-btn-loading-icon) {
margin-right: $spacing-sm; margin-right: $spacing-sm;
} }
} }
// 表单验证错误样式 // 表单验证错误样式
:deep(.ant-form-item-has-error) { :deep(.ant-form-item-has-error) {
.login-input { .login-input {
border-color: $error-color; border-color: $error-color;
&:focus-within { &:focus-within {
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2); box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2);
} }
} }
.captcha-image-container { .captcha-image-container {
border-color: $error-color; border-color: $error-color;
} }
} }
:deep(.ant-form-item-explain-error) { :deep(.ant-form-item-explain-error) {
color: rgba(255, 255, 255, 0.9); color: rgba(255, 255, 255, 0.9);
background: rgba(255, 77, 79, 0.1); background: rgba(255, 77, 79, 0.1);
padding: 4px 8px; padding: 4px 8px;
border-radius: 4px; border-radius: 4px;
margin-top: 4px; margin-top: 4px;
font-size: 12px; font-size: 12px;
} }
// 响应式设计 // 响应式设计
@media (max-width: 768px) { @media (max-width: 768px) {
.login-box { .login-box {
width: 90%; width: 90%;
max-width: 380px; max-width: 380px;
padding: $spacing-lg; padding: $spacing-lg;
} }
.captcha-container { .captcha-container {
flex-direction: column; flex-direction: column;
.captcha-image-container { .captcha-image-container {
width: 100%; width: 100%;
height: 60px; height: 60px;
} }
} }
} }
@media (max-width: 480px) { @media (max-width: 480px) {
.login-box { .login-box {
padding: $spacing-md; padding: $spacing-md;
} }
.login-header .login-title { .login-header .login-title {
font-size: 20px; font-size: 20px;
.title-icon { .title-icon {
font-size: 24px; font-size: 24px;
} }
} }
} }
</style> </style>

View File

@@ -1,129 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, watch, getCurrentInstance } from 'vue';
import { useRouter } from 'vue-router';
import { message } from 'ant-design-vue';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { listStation } from '@/api/pwoManage/station';
import { usePwoStore, useJobStore } from '@/store';
const { proxy } = getCurrentInstance() as any
const { mes_station_status } = proxy.useDict("mes_station_status", "lot_trace_order_status")
interface TableItem {
key: string;
index: number;
operationTitle: string;
planQty: number;
okQty: number;
ngQty: number;
status: string;
[key: string]: any;
}
const router = useRouter();
const pwoStore = usePwoStore();
const jobStore = useJobStore();
const tableData = ref<TableItem[]>([]);
const columns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: '制程', dataIndex: 'operationTitle', key: 'operationTitle', align: 'center' },
{ title: '总数量', dataIndex: 'planQty', key: 'planQty', align: 'center' },
{ title: '合格数量', dataIndex: 'okQty', key: 'okQty', align: 'center' },
{ title: '报废数量', dataIndex: 'ngQty', key: 'ngQty', align: 'center' },
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center' },
{ title: '操作', key: 'action', align: 'center' },
];
const loadingStations = ref(false);
const fetchStations = async (traceOrderCode: string) => {
try {
loadingStations.value = true;
const res = await listStation({ traceOrderCode });
tableData.value = (res.rows || []).map((item: any, idx: number) => {
return {
key: String(item.id ?? idx),
index: item.seqNo ?? idx + 1,
...item,
} as TableItem;
});
} catch (error: any) {
message.error(error?.msg || error?.message || '查询站点失败');
} finally {
loadingStations.value = false;
}
};
const handleInfeed = (record: any) => {
jobStore.setInfo(record);
router.push({ name: 'Infeed' });
};
const handleOutfeed = () => {
router.push({ name: 'Outfeed' });
};
watch(
() => pwoStore.pwoInfo.code,
(val) => {
if (val) {
fetchStations(val);
}
},
{ immediate: true }
)
function rowClick(record: TableItem) {
return {
onClick: () => {
jobStore.setInfo(record);
},
};
}
</script>
<template>
<div class="table-wrapper">
<a-table
:dataSource="tableData"
:columns="columns as ColumnsType<TableItem>"
:pagination="false"
:loading="loadingStations"
bordered
sticky
rowKey="key"
class="custom-table"
:customRow="rowClick"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<DictTag :options="mes_station_status" :value="record.status" size="large" />
</template>
<template v-if="column.key === 'action'">
<a-space>
<a-button size="large" type="primary" @click="handleInfeed(record)">进站</a-button>
<a-button size="large" type="primary" danger @click="handleOutfeed">出站</a-button>
</a-space>
</template>
</template>
</a-table>
</div>
</template>
<style scoped lang="scss">
.table-wrapper {
height: 100%;
overflow: auto;
.custom-table {
:deep(.ant-table-thead > tr > th) {
background-color: #e6f7ff;
font-weight: bold;
}
:deep(.ant-table-tbody > tr > td) {
padding: 12px 8px;
}
}
}
</style>

View File

@@ -1,177 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from 'vue';
import { message } from 'ant-design-vue';
import { useJobStore } from '@/store';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import {
getEquipmentByCode,
listEquipmentEntry,
addEquipmentEntry,
delEquipmentEntry,
} from '@/api/pwoManage/equipment';
const jobStore = useJobStore();
interface EquipmentTableItem {
key: string;
equipmentName: string;
equipmentCode: string;
[key: string]: any;
}
const equipmentColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: '设备编码', dataIndex: 'equipmentCode', key: 'equipmentCode', align: 'center' },
{ title: '设备名称', dataIndex: 'equipmentTitle', key: 'equipmentTitle', align: 'center' },
{ title: '操作', dataIndex: 'action', key: 'action', align: 'center' },
];
const equipmentInfo = reactive({
equipmentTitle: '',
equipmentCode: '',
});
const fetchEquipmentInfo = async () => {
const { data } = await getEquipmentByCode(equipmentInput.value)
if (!data) {
message.error('设备不存在');
return;
}
Object.assign(equipmentInfo, data);
}
// 治具表格
const equipmentTableData = ref<EquipmentTableItem[]>([]);
const equipmentInput = ref<string>('');
const handleBind = async () => {
if (!equipmentInput.value) return;
try {
await addEquipmentEntry({
equipmentCode: equipmentInput.value,
stationCode: jobStore.jobInfo.code,
});
message.success('绑定成功');
equipmentInput.value = '';
fetchBoundEquipmentList();
} catch (error: any) {
message.error(`绑定失败: ${ error.message }`);
}
}
const handleUnbind = async (id: number) => {
try {
await delEquipmentEntry(id);
message.success('解绑成功');
fetchBoundEquipmentList();
} catch (error: any) {
message.error(`解绑失败: ${ error.message }`);
}
}
// 获取已绑定的设备列表
const loadingEquipmentTableData = ref(false);
const fetchBoundEquipmentList = async () => {
const stationId = jobStore.jobInfo.id;
if (!stationId) return;
loadingEquipmentTableData.value = true;
try {
const { rows } = await listEquipmentEntry({ stationId });
equipmentTableData.value = rows;
} catch (error: any) {
message.error(error.message || '查询治具列表失败');
} finally {
loadingEquipmentTableData.value = false;
}
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight
});
fetchBoundEquipmentList()
</script>
<template>
<div class="equipment__container">
<Title name="绑定设备列表" showRefresh @refresh="fetchBoundEquipmentList" />
<a-row class="main-content" :gutter="24">
<a-col :span="10" class="input__container">
<a-row :gutter="12">
<a-col :span="21">
<a-input size="large" v-model:value="equipmentInput" @pressEnter="fetchEquipmentInfo" placeholder="按下回车搜索" />
</a-col>
<a-col :span="3">
<a-button type="primary" size="large" @click="handleBind">绑定</a-button>
</a-col>
</a-row>
<div class="description-wrapper">
<a-descriptions :column="1" bordered>
<a-descriptions-item label="设备编码">{{ equipmentInfo.equipmentCode }}</a-descriptions-item>
<a-descriptions-item label="设备名称">{{ equipmentInfo.equipmentTitle }}</a-descriptions-item>
</a-descriptions>
</div>
</a-col>
<a-col :span="14">
<div class="table-wrapper" ref="customTable">
<a-table :dataSource="equipmentTableData" :columns="equipmentColumns as ColumnsType<EquipmentTableItem>"
:pagination="false" bordered sticky :scroll="{ y: tableHeight }" :loading="loadingEquipmentTableData">
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleUnbind(record.id)">解绑</a-button>
</template>
</template>
</a-table>
</div>
</a-col>
</a-row>
</div>
</template>
<style scoped lang="scss">
.equipment__container {
height: 100%;
display: flex;
flex-direction: column;
gap: 16px;
}
.main-content {
flex: 1;
overflow: hidden;
}
.input__container {
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.description-wrapper {
flex: 1;
overflow: auto;
}
}
.table-wrapper {
height: 100%;
overflow: auto;
}
</style>

View File

@@ -1,164 +0,0 @@
<script setup lang="ts">
import { ref, computed } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { startStation } from '@/api/pwoManage/station';
import { useJobStore } from '@/store/job';
import { message } from 'ant-design-vue';
const router = useRouter();
const route = useRoute();
const jobStore = useJobStore();
const menuItems = [
{ label: '主材', key: 'PrimaryMaterial', progress: 30 },
{ label: '治具', key: 'Mask', progress: 80 },
{ label: '设备', key: 'Equipment', progress: 80 },
];
const activeKey = computed(() => route.name as string);
const handleMenuClick = (name: string) => {
router.push({ name});
};
// 确认进站
const infeeding = ref(false);
const handleInfeed = async () => {
infeeding.value = true;
try {
await startStation(jobStore.jobInfo.id);
router.push({ name: 'PwoManage' });
} catch (error: any) {
message.error(error.message || '进站失败');
} finally {
infeeding.value = false;
}
};
const infeedChildRef = ref<any>(null);
/** 父组件对外暴露的方法 */
function renderTableHeight() {
infeedChildRef.value?.renderTableHeight();
}
defineExpose({
renderTableHeight
});
</script>
<template>
<a-spin :spinning="infeeding">
<a-row class="infeed-layout">
<a-col :span="20" class="content-wrapper">
<router-view v-slot="{ Component }">
<component :is="Component" ref="infeedChildRef" />
</router-view>
</a-col>
<a-col :span="4" class="menu-wrapper">
<div class="menu-list">
<span class="infeed-title">进站</span>
<div
v-for="item in menuItems"
:key="item.key"
class="menu-item"
:class="{ active: activeKey === item.key }"
@click="handleMenuClick(item.key)"
>
<div class="menu-content">
<span class="menu-title">{{ item.label }}</span>
<a-progress
:percent="item.progress"
:show-info="false"
size="small"
:stroke-color="activeKey === item.key ? '#1890ff' : undefined"
class="menu-progress"
/>
</div>
</div>
<a-button type="primary" size="large" @click="handleInfeed">确认进站</a-button>
</div>
</a-col>
</a-row>
</a-spin>
</template>
<style scoped lang="scss">
.infeed-layout {
height: 100%;
}
.menu-list {
display: flex;
flex-direction: column;
gap: 16px;
height: 100%;
}
.infeed-title {
font-size: 20px;
font-weight: 600;
border-bottom: 1px solid #c9c9c9;
padding: 0 0 8px;
}
.menu-item {
flex: 1;
background: #fff;
border-radius: 8px;
padding: 1vh 1vw;
cursor: pointer;
transition: all 0.3s;
border: 1px solid #f0f0f0;
box-shadow: 0 2px 4px rgba(0,0,0,0.02);
position: relative;
overflow: hidden;
&.active {
background: #e6f7ff;
border-color: #1890ff;
.menu-title {
color: #1890ff;
}
}
&:hover {
border-color: #47a5fd;
}
}
.menu-content {
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
}
.menu-title {
font-size: 18px;
font-weight: bold;
color: #333;
line-height: 1.5;
}
.menu-progress {
margin-bottom: 0 !important;
:deep(.ant-progress-bg) {
transition: all 0.3s;
}
}
.menu-wrapper {
padding: 12px;
border-radius: 7px;
background-color: #f3f3f3;
}
.content-wrapper {
height: 100%;
padding: 12px;
}
</style>

View File

@@ -1,214 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from 'vue';
import { message } from 'ant-design-vue';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { listMaskCombination } from "@/api/pwoManage/maskCombination";
import { listStationBindMask, bindMaskCombinationToStations, unbindStationMask } from "@/api/pwoManage/mask";
import { usePwoStore } from '@/store';
const pwoStore = usePwoStore();
interface MaskTableItem {
key: string;
operationTitle: string;
operationCode: string;
maskName: string;
maskCode: string;
[key: string]: any;
}
interface MaskCombinationItem {
key: string;
combinationCode: string;
combinationName: string;
combinationStatus: string;
[key: string]: any;
}
const maskColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: '工序编码', dataIndex: 'operationCode', key: 'operationCode', align: 'center' },
{ title: '工序名称', dataIndex: 'operationTitle', key: 'operationTitle', align: 'center' },
{ title: '治具编码', dataIndex: 'maskCode', key: 'maskCode', align: 'center' },
{ title: '治具名称', dataIndex: 'maskName', key: 'maskName', align: 'center' },
{ title: '操作', dataIndex: 'action', key: 'action', align: 'center' },
];
// 治具表格
const maskTableData = ref<MaskTableItem[]>([]);
const maskInput = ref<string>('');
const openMaskModal = ref(false)
const maskCombinationColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: '组合编码', dataIndex: 'combinationCode', key: 'combinationCode', align: 'center' },
{ title: '组合名称', dataIndex: 'combinationName', key: 'combinationName', align: 'center' },
{ title: '组合状态', dataIndex: 'combinationStatus', key: 'combinationStatus', align: 'center' },
{ title: '操作', dataIndex: 'action', key: 'action', align: 'center', width: 100 },
]
const maskCombinationTableData = ref<MaskCombinationItem[]>([])
const fetchCombinationList = async () => {
try {
const { rows, total } = await listMaskCombination({})
if (total as number <= 0) throw new Error('未查询到组合列表');
maskCombinationTableData.value = rows;
} catch (error: any) {
message.error(error.message || '获取工单信息失败');
}
}
const handleBind = async (id: number) => {
try {
await bindMaskCombinationToStations({
lotTraceOrderId: pwoStore.pwoInfo.id,
maskCombinationId: id
});
message.success('绑定成功');
fetchBoundMaskList();
openMaskModal.value = false;
} catch (error: any) {
message.error(`绑定失败: ${ error.message }`);
}
}
const handleUnbind = async (id: number) => {
try {
await unbindStationMask(id);
message.success('解绑成功');
fetchBoundMaskList();
openMaskModal.value = false;
} catch (error: any) {
message.error(`解绑失败: ${ error.message }`);
}
}
// 获取已绑定的治具列表
const loadingMask = ref(false);
const fetchBoundMaskList = async () => {
const traceOrderId = pwoStore.pwoInfo.id;
if (!traceOrderId) return;
loadingMask.value = true;
try {
const { rows, total } = await listStationBindMask({ traceOrderId })
if (total as number <= 0) return;
maskTableData.value = rows;
} catch (error: any) {
message.error(error.message || '查询治具列表失败');
} finally {
loadingMask.value = false;
}
}
const inspectingMask = reactive({
maskCode: '',
maskName: '',
})
const rowClick = (record: MaskTableItem) => {
inspectingMask.maskCode = record.maskCode;
inspectingMask.maskName = record.maskName;
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight
});
fetchCombinationList()
fetchBoundMaskList()
</script>
<template>
<div class="mask__container">
<a-row class="main-content" :gutter="24">
<a-col :span="14" class="mask-item__container">
<Title name="治具组合信息" showRefresh @refresh="fetchBoundMaskList" />
<a-button size="large" @click="() => openMaskModal = true">绑定治具组合</a-button>
<div class="table-wrapper" ref="customTable">
<a-table :dataSource="maskTableData" :columns="maskColumns as ColumnsType<MaskTableItem>"
:pagination="false" bordered sticky :scroll="{ y: tableHeight }" :loading="loadingMask">
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleUnbind(record.id)">解绑</a-button>
</template>
</template>
</a-table>
</div>
</a-col>
<a-col :span="10" class="mask-item__container">
<Title name="治具校验" />
<a-row>
<a-col :span="20">
<a-input size="large" v-model:value="maskInput" @pressEnter="" placeholder="按下回车校验" />
</a-col>
<a-col :span="3" :offset="1">
<a-button size="large" @click="">校验</a-button>
</a-col>
</a-row>
<div class="table-wrapper">
<a-descriptions bordered :column="1">
<a-descriptions-item label="治具编码"></a-descriptions-item>
<a-descriptions-item label="治具名称"></a-descriptions-item>
<a-descriptions-item label="治具组合"></a-descriptions-item>
<a-descriptions-item label="标准使用次数"></a-descriptions-item>
<a-descriptions-item label="当前使用次数"></a-descriptions-item>
<a-descriptions-item label="关联工序"></a-descriptions-item>
</a-descriptions>
</div>
</a-col>
</a-row>
<a-modal v-model:open="openMaskModal" title="绑定治具组合" width="50vw" :bodyStyle="{ padding: '20px 0' }" :footer="null">
<a-table :dataSource="maskCombinationTableData" :columns="maskCombinationColumns as ColumnsType<MaskCombinationItem>"
:pagination="false" bordered sticky :scroll="{ y: tableHeight }">
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleBind(record.id)">绑定</a-button>
</template>
</template>
</a-table>
</a-modal>
</div>
</template>
<style scoped lang="scss">
.mask__container {
height: 100%;
display: flex;
flex-direction: column;
}
.main-content {
flex: 1;
overflow: hidden;
.mask-item__container {
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.table-wrapper {
flex: 1;
overflow: auto;
}
}
}
</style>

View File

@@ -1,183 +0,0 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { usePwoStore, useJobStore } from '@/store'
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { message } from 'ant-design-vue'
import { listMainMaterialEntryLog, addWaferEntryLogByCarrier, addDieEntryLogByCarrier, addWaferEntryLog, addDieEntryLog, delMainMaterialEntryLog } from '@/api/pwoManage/primaryMaterial'
const pwoStore = usePwoStore();
const jobStore = useJobStore();
interface MaterialTableItem {
key: string;
carrierCode: string;
qrCode: string;
dieCode: string;
waferCode: string;
[key: string]: any;
}
const materialColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: '载具 ID', dataIndex: 'carrierCode', key: 'carrierCode', align: 'center' },
{ title: 'Wafer ID', dataIndex: 'waferCode', key: 'waferCode', align: 'center' },
{ title: 'Die ID', dataIndex: 'dieCode', key: 'dieCode', align: 'center' },
{ title: '二维码', dataIndex: 'qrCode', key: 'qrCode', align: 'center' },
{ title: '操作', key: 'action', align: 'center', width: 120 },
]
// 查询站点下主材信息
const loadingMaterialTableData = ref(false);
const fetchPrimaryMaterialList = async () => {
const stationId = jobStore.jobInfo.id;
if (!stationId) return;
loadingMaterialTableData.value = true;
try {
const { rows } = await listMainMaterialEntryLog({ stationId });
materialTableData.value = rows;
} catch (error: any) {
message.error(error.message || '查询站点下主材信息失败');
} finally {
loadingMaterialTableData.value = false;
}
};
const carrierInput = ref<string>('');
// 录入载具
const insertCarrier = async () => {
if (!carrierInput.value) return;
const form = {
carrierCode: carrierInput.value,
stationCode: jobStore.jobInfo.code
};
try {
if (materialType.value === "Wafer") {
await addWaferEntryLogByCarrier(form);
} else if (materialType.value === "Die") {
await addDieEntryLogByCarrier(form);
} else throw new Error('主材类型异常');
carrierInput.value = '';
message.success('添加成功');
fetchPrimaryMaterialList();
} catch (error: any) {
message.error(error.message || '添加载具失败');
return;
}
}
// 主材料表格
const materialTableData = ref<MaterialTableItem[]>([]);
const materialInput = ref<string>('');
// 录入主材料
const insertMaterial = async () => {
if (!materialInput.value) return;
const form = {
mainMaterialCodes: [materialInput.value],
stationCode: jobStore.jobInfo.code
};
try {
if (materialType.value === "Wafer") {
await addWaferEntryLog(form);
} else if (materialType.value === "Die") {
await addDieEntryLog(form);
} else throw new Error('主材类型异常');
materialInput.value = '';
message.success('添加成功');
fetchPrimaryMaterialList();
} catch (error: any) {
message.error(error.message || '添加主材失败');
return;
}
}
// 移除主材料
const handleRemoveMaterial = async (row: MaterialTableItem) => {
try {
await delMainMaterialEntryLog(row.id);
message.success('删除成功');
fetchPrimaryMaterialList();
} catch (error: any) {
message.error(error.message || '删除主材失败');
return;
}
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight
});
// 初始化主材类型
const materialType = ref()
if (pwoStore.pwoInfo.orderType) {
const num = parseInt(pwoStore.pwoInfo.orderType)
materialType.value = num % 4 === 0 ? 'Die' : 'Wafer'
} else {
materialType.value = '主材类型异常'
}
fetchPrimaryMaterialList()
</script>
<template>
<div class="primary-material__container">
<Title name="主材料进站" showRefresh @refresh="fetchPrimaryMaterialList" />
<a-form layout="inline" size="large">
<a-form-item label="主材类型">
<a-input v-model:value="materialType" disabled />
</a-form-item>
<a-form-item label="载具 ID">
<a-input v-model:value="carrierInput" @pressEnter="insertCarrier" placeholder="按下回车录入" allow-clear />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="insertCarrier">录入</a-button>
</a-form-item>
<a-form-item label="物料编码">
<a-input v-model:value="materialInput" @pressEnter="insertMaterial" placeholder="按下回车录入" allow-clear />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="insertMaterial">录入</a-button>
</a-form-item>
</a-form>
<div class="table-wrapper" ref="customTable">
<a-table :dataSource="materialTableData" :columns="materialColumns as ColumnsType<MaterialTableItem>"
:pagination="false" bordered sticky :scroll="{ y: tableHeight }" :loading="loadingMaterialTableData">
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button type="text" danger @click="handleRemoveMaterial(record as MaterialTableItem)">删除</a-button>
</template>
</template>
</a-table>
</div>
</div>
</template>
<style scoped lang="scss">
.primary-material__container {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.table-wrapper {
flex: 1;
overflow: auto;
}
}
</style>

View File

@@ -1,96 +0,0 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { message } from 'ant-design-vue';
interface MaterialTableItem {
key: string;
materialCode: string;
materialName: string;
num: number;
unit: string;
[key: string]: any;
}
const materialColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: '物料编码', dataIndex: 'materialCode', key: 'materialCode', align: 'center' },
{ title: '物料名称', dataIndex: 'materialName', key: 'materialName', align: 'center' },
{ title: '数量', dataIndex: 'num', key: 'num', align: 'center' },
{ title: '单位', dataIndex: 'unit', key: 'unit', align: 'center' },
{ title: '操作', key: 'action', align: 'center' },
]
// 材料表格
const materialTableData = ref<MaterialTableItem[]>([
{ key: '1', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '2', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '3', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '4', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '5', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '6', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '7', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '8', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '9', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '10', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '11', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '12', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
]);
// 确认材料
const handleSubmitMaterial = (index: number) => {
message.success(`${ index + 1 } 号进站`)
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 60
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight
});
</script>
<template>
<div class="raw-material__container">
<Title name="材料确认" showRefresh @refresh="" />
<div class="table-wrapper" ref="customTable">
<a-table :dataSource="materialTableData" :columns="materialColumns as ColumnsType<MaterialTableItem>"
:pagination="false" bordered sticky :scroll="{ y: tableHeight }">
<template #bodyCell="{ column, index }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleSubmitMaterial(index)">确认</a-button>
</template>
</template>
</a-table>
</div>
</div>
</template>
<style scoped lang="scss">
.raw-material__container {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.table-wrapper {
flex: 1;
overflow: auto;
}
}
</style>

View File

@@ -1,407 +0,0 @@
<script setup lang="ts">
import { ref, reactive, nextTick, onUnmounted, getCurrentInstance } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { message } from 'ant-design-vue';
import { debounce } from 'lodash';
import { usePwoStore, useJobStore } from '@/store';
import { listLotTraceOrder, getLotTraceOrder, addQualityAbnormalContact } from '@/api/pwoManage';
import type { LotTraceOrderData } from '@/api/pwoManage/model';
const { proxy } = getCurrentInstance() as any
const { mes_station_status, lot_trace_order_status } = proxy.useDict("mes_station_status", "lot_trace_order_status")
const route = useRoute();
const router = useRouter();
const pwoStore = usePwoStore();
const jobStore = useJobStore();
const workOrderInfo = reactive<LotTraceOrderData>({});
const processInfo = jobStore.jobInfo;
// 孙组件
const infeedRef = ref<any>(null);
const collapsed = ref(false);
const toggleCollapse = async () => {
collapsed.value = !collapsed.value;
await nextTick();
infeedRef.value?.renderTableHeight();
}
const redirectTo = (routeName: string) => {
router.push({ name: routeName });
if (routeName === 'PwoManage') {
handleRefresh();
}
}
const openHoldModal = ref(false);
const planFinishDate = ref('');
const handleHold = () => {
if (!workOrderInfo.code) {
message.error('请先选择工单!');
return;
}
openHoldModal.value = true;
};
const handleCloseHold = () => {
planFinishDate.value = '';
openHoldModal.value = false;
};
const handleSubmitHold = async () => {
const tmpPlanFinishDate = planFinishDate.value;
// 修改随工单状态
try {
message.success('Hold 成功!')
planFinishDate.value = '';
openHoldModal.value = false;
} catch (error: any) {
message.error(error.message || 'Hold 失败');
return;
}
// 添加修改记录
try {
addQualityAbnormalContact({
materialCode: workOrderInfo.tarMaterialCode,
abnormalOperation: processInfo.operationCode,
planFinishDate: tmpPlanFinishDate,
status: "Hold",
})
} catch (error: any) {
message.error(error.message || '添加记录异常');
return;
}
};
const handleCopy = async (text: string | number | undefined) => {
if (!text) return;
await navigator.clipboard.writeText(String(text));
message.success(`已复制: ${ text }`);
}
const pwoCodeOptions = ref<LotTraceOrderData[]>([])
const handleSearch = debounce(async (code: string) => {
if (!code) return;
try {
const { rows } = await listLotTraceOrder({
code,
pageSize: 10,
pageNum: 1,
});
pwoCodeOptions.value = rows.map(item => {
return {
id: item.id,
label: item.code,
value: item.code,
}
});
} catch (error: any) {
message.error(error.message || '获取工单信息失败');
}
}, 500)
const loadingPwoInfo = ref(false);
const handleChange = async (value: string, option: LotTraceOrderData) => {
workOrderInfo.code = value;
try {
loadingPwoInfo.value = true;
if (!option.id) throw new Error();
const { data } = await getLotTraceOrder(option.id)
Object.assign(workOrderInfo, data);
pwoStore.setInfo(data);
jobStore.resetInfo();
} catch (error: any) {
message.error(error.message || '获取工单信息失败');
} finally {
loadingPwoInfo.value = false;
}
}
// 刷新工单信息
const handleRefresh = async () => {
if (!workOrderInfo.id) return;
try {
loadingPwoInfo.value = true;
const { data } = await getLotTraceOrder(workOrderInfo.id)
Object.assign(workOrderInfo, data);
pwoStore.setInfo(data);
} catch (error: any) {
message.error(error.message || '刷新工单信息失败');
} finally {
loadingPwoInfo.value = false;
}
}
onUnmounted(() => {
pwoStore.resetInfo();
jobStore.resetInfo();
})
</script>
<template>
<div class="page-container">
<Header title="过站工控机" showHome showLogout>
<template #right-opts>
<a-button @click="toggleCollapse">{{ collapsed ? '展开' : '折叠' }}</a-button>
</template>
</Header>
<div class="content-wrapper">
<!-- Top Section -->
<div class="top-section">
<a-row :gutter="16" class="full-height-row">
<!-- Work Order Info -->
<a-col :span="13">
<a-spin :spinning="loadingPwoInfo">
<a-card title="工单信息" class="info-card" :bordered="false">
<a-form :model="workOrderInfo" :colon="false" v-show="!collapsed">
<a-row :gutter="36">
<a-col :span="12">
<a-form-item label="工单批次">
<a-input v-model:value="workOrderInfo.batchNo" readonly>
<template #suffix>
<a-button @click="handleCopy(workOrderInfo.batchNo)" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="工单状态">
<a-input readonly>
<template #prefix>
<DictTag :options="lot_trace_order_status" :value="workOrderInfo.status" size="medium" />
</template>
</a-input>
</a-form-item>
<a-form-item label="总计数量">
<a-input v-model:value="workOrderInfo.planQty" readonly>
<template #suffix>
<a-button @click="handleCopy(workOrderInfo.planQty)" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="产品编码">
<a-input v-model:value="workOrderInfo.tarMaterialCode" readonly>
<template #suffix>
<a-button @click="handleCopy(workOrderInfo.tarMaterialCode)" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="产品名称">
<a-input v-model:value="workOrderInfo.tarMaterialName" readonly>
<template #suffix>
<a-button @click="handleCopy(workOrderInfo.tarMaterialName)" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<!-- <a-form-item label="产品规格">
<a-input readonly>
<template #suffix>
<a-button @click="handleCopy('')" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item> -->
</a-col>
</a-row>
</a-form>
<template #extra>
<a-space>
工单编码
<a-select v-model:value="workOrderInfo.code" show-search placeholder="输入工单编码" style="width: 300px"
:show-arrow="false" :options="pwoCodeOptions" @search="handleSearch" :disabled="route.name !== 'PwoManageIndex'"
@change="(val, option) => handleChange(val as string, option as LotTraceOrderData)" />
<a-button @click="handleRefresh"><template #icon><i-lucide-rotate-cw /></template></a-button>
</a-space>
</template>
</a-card>
</a-spin>
</a-col>
<!-- Process Info -->
<a-col :span="8">
<a-card title="工序信息" class="info-card" :bordered="false">
<a-form :model="processInfo" :colon="false" v-show="!collapsed">
<a-form-item label="工序名称">
<a-input v-model:value="processInfo.operationTitle" readonly>
<template #suffix>
<a-button @click="handleCopy(processInfo.operationTitle)" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="工序状态">
<a-input readonly>
<template #prefix>
<DictTag :options="mes_station_status" :value="processInfo.status" size="medium" />
</template>
</a-input>
</a-form-item>
<a-form-item label="作业编码">
<a-input v-model:value="processInfo.code" readonly>
<template #suffix>
<a-button @click="handleCopy(processInfo.code)" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
</a-form>
</a-card>
</a-col>
<!-- Action Buttons -->
<a-col :span="3" class="action-buttons-col">
<div class="action-buttons" v-show="!collapsed">
<a-button class="action-btn green-btn" @click="redirectTo('PwoManage')">工单管理</a-button>
<a-button class="action-btn orange-btn" @click="redirectTo('PrimaryMaterial')">主材清单</a-button>
<a-button class="action-btn red-btn" @click="handleHold">Hold</a-button>
</div>
<a-card title="操作" class="info-card" :bordered="false" v-show="collapsed">
<template #extra>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="redirectTo('PwoManage')">工单管理</a-menu-item>
<a-menu-item key="2" @click="redirectTo('PrimaryMaterial')">主材清单</a-menu-item>
<a-menu-item key="4" @click="handleHold">Hold</a-menu-item>
</a-menu>
</template>
<a-button>
更多
<i-lucide-chevron-down />
</a-button>
</a-dropdown>
</template>
</a-card>
</a-col>
</a-row>
</div>
<!-- Bottom Section -->
<main class="bottom-section">
<router-view v-slot="{ Component }">
<component :is="Component" ref="infeedRef" />
</router-view>
</main>
</div>
<!-- Hold Modal -->
<a-modal
v-model:open="openHoldModal"
title="Hold 操作"
@cancel="handleCloseHold"
@ok="handleSubmitHold"
>
<a-form :colon="false" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-form-item label="工单编码">
<a-input v-model:value="workOrderInfo.code" readonly />
</a-form-item>
<a-form-item label="目标产品编码">
<a-input v-model:value="workOrderInfo.tarMaterialCode" readonly />
</a-form-item>
<a-form-item label="目标产品名称">
<a-input v-model:value="workOrderInfo.tarMaterialName" readonly />
</a-form-item>
<a-form-item label="发起工序名称">
<a-input v-model:value="processInfo.operationTitle" readonly />
</a-form-item>
<a-form-item label="产品规格">
<a-input readonly />
</a-form-item>
<a-form-item label="计划完成日期">
<a-date-picker v-model:value="planFinishDate" placeholder="选择计划完成日期"
valueFormat="YYYY-MM-DD HH:mm:ss" show-time style="width: 100%" />
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<style scoped lang="scss">
.page-container {
height: 100vh;
background-color: #f0f2f5;
display: flex;
flex-direction: column;
overflow: hidden;
}
.content-wrapper {
padding: 16px;
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
min-height: 0;
}
.top-section {
background: transparent;
}
:deep(.ant-spin-nested-loading),
:deep(.ant-spin-container) {
height: 100%;
}
.info-card {
height: 100%;
border-radius: 8px;
:deep(.ant-card-head) {
min-height: 48px;
padding: 0 16px;
border-bottom: none;
font-size: 20px;
}
:deep(.ant-card-body) {
padding: 1px 16px;
}
:deep(.ant-form-item) {
margin-bottom: 12px;
}
}
.action-buttons-col {
display: flex;
flex-direction: column;
}
.action-buttons {
display: flex;
flex-direction: column;
gap: 6px;
height: 100%;
.action-btn {
height: 48px;
font-size: 16px;
color: #fff;
border: none;
border-radius: 4px;
}
}
.bottom-section {
background: #fff;
padding: 12px 14px;
border-radius: 8px;
flex: 1;
min-height: 0;
overflow: auto;
}
</style>

View File

@@ -1,16 +0,0 @@
export interface WorkOrderInfo {
code?: string;
batchNo?: string;
status?: string;
tarMaterialName?: string;
tarMaterialCode?: string;
planQty?: number;
}
export interface ProcessInfo {
process?: string;
cut?: string;
jobCode?: string;
status?: string;
equipment?: string;
}

View File

@@ -1,169 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, computed, getCurrentInstance } from 'vue';
import { message } from 'ant-design-vue';
import { useJobStore } from '@/store';
import type { ColumnsType } from 'ant-design-vue/es/table/interface';
import { listMainMaterialEntryLog } from '@/api/pwoManage/primaryMaterial'
import { listMainMaterialOutboundLog } from '@/api/pwoManage/primaryMaterial';
const { proxy } = getCurrentInstance() as any
const { main_material_ok_level, main_material_ng_level } = proxy.useDict("main_material_ok_level", "main_material_ng_level")
const jobStore = useJobStore();
interface PrimaryMaterialTableItem {
key: string;
waferCode: string;
dieCode: string;
result: 'OK' | 'NG';
qualityLevel: string;
[key: string]: any;
}
const primaryMaterialColumns = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80 },
{ title: 'Wafer ID', dataIndex: 'waferCode', key: 'waferCode', align: 'center' },
{ title: 'Die ID', dataIndex: 'dieCode', key: 'dieCode', align: 'center' },
{ title: '结果', dataIndex: 'result', key: 'result', align: 'center' },
{ title: '质量等级', dataIndex: 'qualityLevel', key: 'qualityLevel' },
{ title: '操作', key: 'action', align: 'center', width: 120 },
];
// 总计数据
const totals = computed(() => {
let okNum = 0;
let ngNum = 0;
primaryMaterialTableData.value.forEach(({ result, qualityLevel }) => {
if (result === 'OK') {
okNum++;
} else {
ngNum++;
}
});
return { okNum, ngNum };
});
const primaryMaterialTableData = ref<PrimaryMaterialTableItem[]>([]);
const loadingPrimaryMaterialList = ref(false);
const fetchPrimaryMaterialList = async () => {
const stationId = jobStore.jobInfo.id;
if (!stationId) return;
loadingPrimaryMaterialList.value = true;
try {
const { rows } = await listMainMaterialEntryLog({ stationId });
primaryMaterialTableData.value = rows;
} catch (error: any) {
message.error(error.message || '查询治具列表失败');
} finally {
loadingPrimaryMaterialList.value = false;
}
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight
});
fetchPrimaryMaterialList()
</script>
<template>
<div class="equipment__container">
<Title name="主材报工" showRefresh @refresh="fetchPrimaryMaterialList" />
<div class="table-wrapper" ref="customTable">
<a-table :dataSource="primaryMaterialTableData" :columns="primaryMaterialColumns as ColumnsType<PrimaryMaterialTableItem>"
:pagination="false" bordered sticky size="middle" :scroll="{ y: tableHeight }"
:loading="loadingPrimaryMaterialList">
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'result'">
<a-switch v-model:checked="record.result" checked-children="NG" checkedValue="NG" un-checked-children="OK" unCheckedValue="OK" />
</template>
<template v-if="column.key === 'qualityLevel'">
<a-select v-model:value="record.qualityLevel" style="width: 80%" v-if="record.result === 'OK'">
<a-select-option v-for="dict in main_material_ok_level" :value="dict.value">{{ dict.label }}</a-select-option>
</a-select>
<a-select v-model:value="record.qualityLevel" style="width: 80%" v-else>
<a-select-option v-for="dict in main_material_ng_level" :value="dict.value">{{ dict.label }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'action'">
<a-button @click="">查看明细</a-button>
</template>
</template>
<template #summary>
<a-table-summary-row>
<a-table-summary-cell>总计</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>OK: {{ totals.okNum }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>NG: {{ totals.ngNum }}</a-typography-text>
</a-table-summary-cell>
</a-table-summary-row>
</template>
</a-table>
</div>
</div>
</template>
<style scoped lang="scss">
.equipment__container {
height: 100%;
display: flex;
flex-direction: column;
gap: 16px;
}
.main-content {
flex: 1;
overflow: hidden;
}
.input__container {
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.description-wrapper {
flex: 1;
overflow: auto;
}
}
.table-wrapper {
height: 100%;
overflow: auto;
}
::v-deep(.ant-switch) {
background-color: #04d903;
&:hover {
background-color: #02eb02;
}
&.ant-switch-checked {
background-color: #ff0000;
&:hover {
background-color: #ff2525;
}
}
}
</style>

View File

@@ -1,183 +0,0 @@
<script setup lang="ts">
import { ref, computed, reactive } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { message } from 'ant-design-vue';
import { listStorageLocation } from '@/api/pwoManage/location';
import { completeStation } from '@/api/pwoManage/station';
import { useJobStore } from '@/store';
const router = useRouter();
const route = useRoute();
const jobStore = useJobStore();
const menuItems = [
{ label: '主材报工', key: 'JobReport', progress: 30 },
{ label: '工序参数', key: 'ParameterConfiguration', progress: 80 },
{ label: '流转指引', key: 'ProcessGuidance', progress: 80 },
];
const activeKey = computed(() => route.name as string);
const handleMenuClick = (name: string) => {
router.push({ name });
};
const locationOptions = ref<any>([]);
const fetchLocationList = async () => {
try {
const { rows } = await listStorageLocation({});
locationOptions.value = rows;
} catch (error: any) {
message.error(error.message || '获取库位列表失败');
}
};
const openSelectLocation = ref(false);
const handleSelectLocation = () => {
fetchLocationList();
openSelectLocation.value = true;
};
const storage = reactive({});
const handleChangeLocation = (value: any, option: any) => {
Object.assign(storage, option);
};
// 确认出站
const outfeeding = ref(false);
const handleOutfeed = async () => {
outfeeding.value = true;
try {
await completeStation(jobStore.jobInfo.id, storage);
openSelectLocation.value = false;
message.success('出站成功');
} catch (error: any) {
message.error(error.message || '出站失败');
} finally {
outfeeding.value = false;
}
};
const outfeedChildRef = ref<any>(null);
/** 父组件对外暴露的方法 */
function renderTableHeight() {
outfeedChildRef.value?.renderTableHeight();
}
defineExpose({
renderTableHeight
});
fetchLocationList();
</script>
<template>
<a-spin :spinning="outfeeding">
<a-row class="outfeed-layout">
<a-col :span="20" class="content-wrapper">
<router-view v-slot="{ Component }">
<component :is="Component" ref="outfeedChildRef" />
</router-view>
</a-col>
<a-col :span="4" class="menu-wrapper">
<div class="menu-list">
<span class="outfeed-title">出站</span>
<div v-for="item in menuItems" :key="item.key" class="menu-item" :class="{ active: activeKey === item.key }"
@click="handleMenuClick(item.key)">
<div class="menu-content">
<span class="menu-title">{{ item.label }}</span>
<a-progress :percent="item.progress" :show-info="false" size="small"
:stroke-color="activeKey === item.key ? '#1890ff' : undefined" class="menu-progress" />
</div>
</div>
<a-button type="primary" size="large" @click="handleSelectLocation">确认出站</a-button>
</div>
</a-col>
</a-row>
<a-modal title="选择出站库位" :open="openSelectLocation" @ok="handleOutfeed" @cancel="openSelectLocation = false">
<a-select style="width: 100%" @change="handleChangeLocation" :options="locationOptions" :fieldNames="{ label: 'storageLocationCode', value: 'id' }" />
</a-modal>
</a-spin>
</template>
<style scoped lang="scss">
.outfeed-layout {
height: 100%;
}
.menu-list {
display: flex;
flex-direction: column;
gap: 16px;
height: 100%;
}
.outfeed-title {
font-size: 20px;
font-weight: 600;
border-bottom: 1px solid #c9c9c9;
padding: 0 0 8px;
}
.menu-item {
flex: 1;
background: #fff;
border-radius: 8px;
padding: 1vh 1vw;
cursor: pointer;
transition: all 0.3s;
border: 1px solid #f0f0f0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
position: relative;
overflow: hidden;
&.active {
background: #e6f7ff;
border-color: #1890ff;
.menu-title {
color: #1890ff;
}
}
&:hover {
border-color: #47a5fd;
}
}
.menu-content {
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
}
.menu-title {
font-size: 18px;
font-weight: bold;
color: #333;
line-height: 1.5;
}
.menu-progress {
margin-bottom: 0 !important;
:deep(.ant-progress-bg) {
transition: all 0.3s;
}
}
.menu-wrapper {
padding: 12px;
border-radius: 7px;
background-color: #f3f3f3;
}
.content-wrapper {
height: 100%;
padding: 12px;
}
</style>

View File

@@ -0,0 +1,108 @@
<script setup lang="ts">
import { getCurrentInstance } from 'vue'
import { useRouter } from 'vue-router'
import type { ColumnsType } from 'ant-design-vue/es/table/interface'
import { useTraceOrderStore } from '@/store'
const { proxy } = getCurrentInstance() as any
const { mes_station_status } = proxy.useDict('mes_station_status')
interface TableItem {
key: string
index: number
operationTitle: string
planQty: number
okQty: number
ngQty: number
status: string
[key: string]: any
}
const router = useRouter()
const traceOrderStore = useTraceOrderStore()
const columns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: '制程',
dataIndex: 'operationTitle',
key: 'operationTitle',
align: 'center',
},
{ title: '总数量', dataIndex: 'planQty', key: 'planQty', align: 'center' },
{ title: '合格数量', dataIndex: 'okQty', key: 'okQty', align: 'center' },
{ title: '报废数量', dataIndex: 'ngQty', key: 'ngQty', align: 'center' },
{ title: '状态', dataIndex: 'status', key: 'status', align: 'center' },
{ title: '操作', key: 'action', align: 'center' },
]
const handleInfeed = (record: any) => {
router.push({ name: 'Infeed' })
traceOrderStore.selectStation(record.id)
}
const handleOutfeed = (record: any) => {
router.push({ name: 'Outfeed' })
traceOrderStore.selectStation(record.id)
}
function rowClick(record: TableItem) {
return {
onClick: () => {
traceOrderStore.selectStation(record.id)
},
}
}
</script>
<template>
<div class="table-wrapper">
<a-table
:dataSource="traceOrderStore.stationList"
:columns="columns as ColumnsType<TableItem>"
:pagination="false"
:loading="traceOrderStore.loadingStations"
bordered
sticky
rowKey="key"
class="custom-table"
:customRow="rowClick"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<DictTag
:options="mes_station_status"
:value="record.status"
size="large"
/>
</template>
<template v-if="column.key === 'action'">
<a-space>
<a-button size="large" @click="handleInfeed(record)">进站</a-button>
<a-button
size="large"
type="primary"
danger
@click="handleOutfeed(record)"
>
出站
</a-button>
</a-space>
</template>
</template>
</a-table>
</div>
</template>
<style scoped lang="scss">
.table-wrapper {
height: 100%;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,214 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from 'vue'
import { message } from 'ant-design-vue'
import { useTraceOrderStore } from '@/store'
import type { ColumnsType } from 'ant-design-vue/es/table/interface'
import {
getEquipmentByCode,
listEquipmentEntry,
addEquipmentEntry,
delEquipmentEntry,
} from '@/api/traceOrderManage/equipment'
const traceOrderStore = useTraceOrderStore()
interface EquipmentTableItem {
key: string
equipmentName: string
equipmentCode: string
[key: string]: any
}
const equipmentColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: '设备编码',
dataIndex: 'equipmentCode',
key: 'equipmentCode',
align: 'center',
},
{
title: '设备名称',
dataIndex: 'equipmentTitle',
key: 'equipmentTitle',
align: 'center',
},
{ title: '操作', dataIndex: 'action', key: 'action', align: 'center' },
]
const equipmentInfo = reactive({
equipmentTitle: '',
equipmentCode: '',
})
const fetchEquipmentInfo = async () => {
const { data } = await getEquipmentByCode(equipmentInput.value)
if (!data) {
message.error('设备不存在')
return
}
Object.assign(equipmentInfo, data)
}
// 治具表格
const equipmentTableData = ref<EquipmentTableItem[]>([])
const equipmentInput = ref<string>('')
const handleBind = async () => {
if (!equipmentInput.value) return
try {
await addEquipmentEntry({
equipmentCode: equipmentInput.value,
stationCode: traceOrderStore.currentStationCode,
})
message.success('绑定成功')
equipmentInput.value = ''
fetchBoundEquipmentList()
} catch (error: any) {
message.error(`绑定失败: ${error.message}`)
}
}
const handleUnbind = async (id: number) => {
try {
await delEquipmentEntry(id)
message.success('解绑成功')
fetchBoundEquipmentList()
} catch (error: any) {
message.error(`解绑失败: ${error.message}`)
}
}
// 获取已绑定的设备列表
const loadingEquipmentTableData = ref(false)
const fetchBoundEquipmentList = async () => {
const stationId = traceOrderStore.currentStationId
if (!stationId) return
loadingEquipmentTableData.value = true
try {
const { rows } = await listEquipmentEntry({ stationId })
equipmentTableData.value = rows
} catch (error: any) {
message.error(error.message || '查询治具列表失败')
} finally {
loadingEquipmentTableData.value = false
}
}
const handleRefresh = () => {
fetchBoundEquipmentList()
renderTableHeight()
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight,
})
fetchBoundEquipmentList()
</script>
<template>
<div class="equipment__container">
<Title name="绑定设备列表" showRefresh @refresh="handleRefresh" />
<a-row class="main-content" :gutter="24">
<a-col :span="10" class="input__container">
<a-row :gutter="12">
<a-col :span="21">
<a-input
size="large"
v-model:value="equipmentInput"
@pressEnter="fetchEquipmentInfo"
placeholder="按下回车搜索"
/>
</a-col>
<a-col :span="3">
<a-button size="large" @click="handleBind">绑定</a-button>
</a-col>
</a-row>
<div class="description-wrapper">
<a-descriptions :column="1" bordered>
<a-descriptions-item label="设备编码">
{{ equipmentInfo.equipmentCode }}
</a-descriptions-item>
<a-descriptions-item label="设备名称">
{{ equipmentInfo.equipmentTitle }}
</a-descriptions-item>
</a-descriptions>
</div>
</a-col>
<a-col :span="14">
<div class="table-wrapper" ref="customTable">
<a-table
:dataSource="equipmentTableData"
:columns="equipmentColumns as ColumnsType<EquipmentTableItem>"
:pagination="false"
bordered
sticky
:scroll="{ y: tableHeight }"
:loading="loadingEquipmentTableData"
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleUnbind(record.id)">解绑</a-button>
</template>
</template>
</a-table>
</div>
</a-col>
</a-row>
</div>
</template>
<style scoped lang="scss">
.equipment__container {
height: 100%;
display: flex;
flex-direction: column;
gap: 16px;
}
.main-content {
flex: 1;
overflow: hidden;
}
.input__container {
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.description-wrapper {
flex: 1;
overflow: auto;
}
}
.table-wrapper {
height: 100%;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,169 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { startStation } from '@/api/traceOrderManage/station'
import { useTraceOrderStore } from '@/store'
import { message } from 'ant-design-vue'
const router = useRouter()
const route = useRoute()
const traceOrderStore = useTraceOrderStore()
const menuItems = [
{ label: '主材', key: 'PrimaryMaterial', progress: 30 },
{ label: '治具', key: 'Mask', progress: 80 },
{ label: '设备', key: 'Equipment', progress: 80 },
]
const activeKey = computed(() => route.name as string)
const handleMenuClick = (name: string) => {
router.push({ name })
}
// 确认进站
const infeeding = ref(false)
const handleInfeed = async () => {
infeeding.value = true
try {
await startStation(traceOrderStore.currentStationId)
message.success('进站成功')
traceOrderStore.fetchStationInfo()
traceOrderStore.fetchStationList()
router.push({ name: 'TraceOrderManage' })
} catch (error: any) {
message.error(error.message || '进站失败')
} finally {
infeeding.value = false
}
}
const infeedChildRef = ref<any>(null)
/** 父组件对外暴露的方法 */
function renderTableHeight() {
infeedChildRef.value?.renderTableHeight()
}
defineExpose({
renderTableHeight,
})
</script>
<template>
<a-spin :spinning="infeeding">
<a-row class="infeed-layout">
<a-col :span="20" class="content-wrapper">
<router-view v-slot="{ Component }">
<component :is="Component" ref="infeedChildRef" />
</router-view>
</a-col>
<a-col :span="4" class="menu-wrapper">
<div class="menu-list">
<span class="infeed-title">进站</span>
<div
v-for="item in menuItems"
:key="item.key"
class="menu-item"
:class="{ active: activeKey === item.key }"
@click="handleMenuClick(item.key)"
>
<div class="menu-content">
<span class="menu-title">{{ item.label }}</span>
<a-progress
:percent="item.progress"
:show-info="false"
size="small"
:stroke-color="activeKey === item.key ? '#1890ff' : undefined"
class="menu-progress"
/>
</div>
</div>
<a-button type="primary" size="large" @click="handleInfeed">
确认进站
</a-button>
</div>
</a-col>
</a-row>
</a-spin>
</template>
<style scoped lang="scss">
.infeed-layout {
height: 100%;
}
.menu-list {
display: flex;
flex-direction: column;
gap: 16px;
height: 100%;
}
.infeed-title {
font-size: 20px;
font-weight: 600;
border-bottom: 1px solid #c9c9c9;
padding: 0 0 8px;
}
.menu-item {
flex: 1;
background: #fff;
border-radius: 8px;
padding: 1vh 1vw;
cursor: pointer;
transition: all 0.3s;
border: 1px solid #f0f0f0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
position: relative;
overflow: hidden;
&.active {
background: #e6f7ff;
border-color: #1890ff;
.menu-title {
color: #1890ff;
}
}
&:hover {
border-color: #47a5fd;
}
}
.menu-content {
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
}
.menu-title {
font-size: 18px;
font-weight: bold;
color: #333;
line-height: 1.5;
}
.menu-progress {
margin-bottom: 0 !important;
:deep(.ant-progress-bg) {
transition: all 0.3s;
}
}
.menu-wrapper {
padding: 12px;
border-radius: 7px;
background-color: #f3f3f3;
}
.content-wrapper {
height: 100%;
padding: 12px;
}
</style>

View File

@@ -0,0 +1,306 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from 'vue'
import { message } from 'ant-design-vue'
import type { ColumnsType } from 'ant-design-vue/es/table/interface'
import { listMaskCombination } from '@/api/traceOrderManage/maskCombination'
import {
listStationBindMask,
bindMaskCombinationToStations,
unbindStationMask,
} from '@/api/traceOrderManage/mask'
import { useTraceOrderStore } from '@/store'
const traceOrderStore = useTraceOrderStore()
interface MaskTableItem {
key: string
operationTitle: string
operationCode: string
maskName: string
maskCode: string
[key: string]: any
}
interface MaskCombinationItem {
key: string
combinationCode: string
combinationName: string
combinationStatus: string
[key: string]: any
}
const maskColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: '工序编码',
dataIndex: 'operationCode',
key: 'operationCode',
align: 'center',
},
{
title: '工序名称',
dataIndex: 'operationTitle',
key: 'operationTitle',
align: 'center',
},
{
title: '治具编码',
dataIndex: 'maskCode',
key: 'maskCode',
align: 'center',
},
{
title: '治具名称',
dataIndex: 'maskName',
key: 'maskName',
align: 'center',
},
{ title: '操作', dataIndex: 'action', key: 'action', align: 'center' },
]
// 治具表格
const maskTableData = ref<MaskTableItem[]>([])
const maskInput = ref<string>('')
const openMaskModal = ref(false)
const maskCombinationColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: '组合编码',
dataIndex: 'combinationCode',
key: 'combinationCode',
align: 'center',
},
{
title: '组合名称',
dataIndex: 'combinationName',
key: 'combinationName',
align: 'center',
},
{
title: '组合状态',
dataIndex: 'combinationStatus',
key: 'combinationStatus',
align: 'center',
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
width: 100,
},
]
const maskCombinationTableData = ref<MaskCombinationItem[]>([])
const fetchCombinationList = async () => {
try {
const { rows, total } = await listMaskCombination({})
if ((total as number) <= 0) throw new Error('未查询到组合列表')
maskCombinationTableData.value = rows
} catch (error: any) {
message.error(error.message || '获取工单信息失败')
}
}
const handleBind = async (id: number) => {
try {
await bindMaskCombinationToStations({
lotTraceOrderId: traceOrderStore.currentTraceOrderId,
maskCombinationId: id,
})
message.success('绑定成功')
fetchBoundMaskList()
openMaskModal.value = false
} catch (error: any) {
message.error(`绑定失败: ${error.message}`)
}
}
const handleUnbind = async (id: number) => {
try {
await unbindStationMask(id)
message.success('解绑成功')
fetchBoundMaskList()
openMaskModal.value = false
} catch (error: any) {
message.error(`解绑失败: ${error.message}`)
}
}
// 获取已绑定的治具列表
const loadingMask = ref(false)
const fetchBoundMaskList = async () => {
const traceOrderId = traceOrderStore.currentTraceOrderId
if (!traceOrderId) return
loadingMask.value = true
try {
const { rows, total } = await listStationBindMask({ traceOrderId })
if ((total as number) <= 0) return
maskTableData.value = rows
} catch (error: any) {
message.error(error.message || '查询治具列表失败')
} finally {
loadingMask.value = false
}
}
const inspectingMask = reactive({
maskCode: '',
maskName: '',
})
const rowClick = (record: MaskTableItem) => {
return {
onClick: () => {
inspectingMask.maskCode = record.maskCode
inspectingMask.maskName = record.maskName
},
}
}
const handleRefresh = () => {
fetchBoundMaskList()
renderTableHeight()
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight,
})
fetchCombinationList()
fetchBoundMaskList()
</script>
<template>
<div class="mask__container">
<a-row class="main-content" :gutter="24">
<a-col :span="14" class="mask-item__container">
<Title name="治具组合信息" showRefresh @refresh="handleRefresh" />
<a-button size="large" @click="() => (openMaskModal = true)">
绑定治具组合
</a-button>
<div class="table-wrapper" ref="customTable">
<a-table
:dataSource="maskTableData"
:columns="maskColumns as ColumnsType<MaskTableItem>"
:pagination="false"
bordered
sticky
:scroll="{ y: tableHeight }"
:loading="loadingMask"
:customRow="rowClick"
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleUnbind(record.id)">解绑</a-button>
</template>
</template>
</a-table>
</div>
</a-col>
<a-col :span="10" class="mask-item__container">
<Title name="治具校验" />
<a-row>
<a-col :span="20">
<a-input
size="large"
v-model:value="maskInput"
placeholder="按下回车校验"
/>
</a-col>
<a-col :span="3" :offset="1">
<a-button size="large">校验</a-button>
</a-col>
</a-row>
<div class="table-wrapper">
<a-descriptions bordered :column="1">
<a-descriptions-item label="治具编码"></a-descriptions-item>
<a-descriptions-item label="治具名称"></a-descriptions-item>
<a-descriptions-item label="治具组合"></a-descriptions-item>
<a-descriptions-item label="标准使用次数"></a-descriptions-item>
<a-descriptions-item label="当前使用次数"></a-descriptions-item>
<a-descriptions-item label="关联工序"></a-descriptions-item>
</a-descriptions>
</div>
</a-col>
</a-row>
<a-modal
v-model:open="openMaskModal"
title="绑定治具组合"
width="50vw"
:bodyStyle="{ padding: '20px 0' }"
:footer="null"
>
<a-table
:dataSource="maskCombinationTableData"
:columns="maskCombinationColumns as ColumnsType<MaskCombinationItem>"
:pagination="false"
bordered
sticky
:scroll="{ y: tableHeight }"
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleBind(record.id)">绑定</a-button>
</template>
</template>
</a-table>
</a-modal>
</div>
</template>
<style scoped lang="scss">
.mask__container {
height: 100%;
display: flex;
flex-direction: column;
}
.main-content {
flex: 1;
overflow: hidden;
.mask-item__container {
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.table-wrapper {
flex: 1;
overflow: auto;
}
}
}
</style>

View File

@@ -0,0 +1,233 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useTraceOrderStore } from '@/store'
import type { ColumnsType } from 'ant-design-vue/es/table/interface'
import { message } from 'ant-design-vue'
import {
listMainMaterialEntryLog,
addWaferEntryLogByCarrier,
addDieEntryLogByCarrier,
addWaferEntryLog,
addDieEntryLog,
delMainMaterialEntryLog,
} from '@/api/traceOrderManage/primaryMaterial'
const traceOrderStore = useTraceOrderStore()
interface MaterialTableItem {
key: string
carrierCode: string
qrCode: string
dieCode: string
waferCode: string
[key: string]: any
}
const materialColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: '载具 ID',
dataIndex: 'carrierCode',
key: 'carrierCode',
align: 'center',
},
{
title: 'Wafer ID',
dataIndex: 'waferCode',
key: 'waferCode',
align: 'center',
},
{ title: 'Die ID', dataIndex: 'dieCode', key: 'dieCode', align: 'center' },
{ title: '二维码', dataIndex: 'qrCode', key: 'qrCode', align: 'center' },
{ title: '操作', key: 'action', align: 'center', width: 120 },
]
// 查询站点下主材信息
const loadingMaterialTableData = ref(false)
const fetchPrimaryMaterialList = async () => {
const stationId = traceOrderStore.currentStationId
if (!stationId) return
loadingMaterialTableData.value = true
try {
const { rows } = await listMainMaterialEntryLog({ stationId })
materialTableData.value = rows
} catch (error: any) {
message.error(error.message || '查询站点下主材信息失败')
} finally {
loadingMaterialTableData.value = false
}
}
const carrierInput = ref<string>('')
// 录入载具
const insertCarrier = async () => {
if (!carrierInput.value) return
const form = {
carrierCode: carrierInput.value,
stationCode: traceOrderStore.currentStationCode,
}
try {
if (materialType.value === 'Wafer') {
await addWaferEntryLogByCarrier(form)
} else if (materialType.value === 'Die') {
await addDieEntryLogByCarrier(form)
} else throw new Error('主材类型异常')
carrierInput.value = ''
message.success('添加成功')
fetchPrimaryMaterialList()
} catch (error: any) {
message.error(error.message || '添加载具失败')
return
}
}
// 主材料表格
const materialTableData = ref<MaterialTableItem[]>([])
const materialInput = ref<string>('')
// 录入主材料
const insertMaterial = async () => {
if (!materialInput.value) return
const form = {
mainMaterialCodes: [materialInput.value],
stationCode: traceOrderStore.currentStationCode,
}
try {
if (materialType.value === 'Wafer') {
await addWaferEntryLog(form)
} else if (materialType.value === 'Die') {
await addDieEntryLog(form)
} else throw new Error('主材类型异常')
materialInput.value = ''
message.success('添加成功')
fetchPrimaryMaterialList()
} catch (error: any) {
message.error(error.message || '添加主材失败')
return
}
}
// 移除主材料
const handleRemoveMaterial = async (row: MaterialTableItem) => {
try {
await delMainMaterialEntryLog(row.id)
message.success('删除成功')
fetchPrimaryMaterialList()
} catch (error: any) {
message.error(error.message || '删除主材失败')
return
}
}
const handleRefresh = () => {
fetchPrimaryMaterialList()
renderTableHeight()
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 50
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight,
})
// 初始化主材类型
const materialType = ref()
if (traceOrderStore.traceOrderInfo.orderType) {
const num = parseInt(traceOrderStore.traceOrderInfo.orderType)
materialType.value = num % 4 === 0 ? 'Die' : 'Wafer'
} else {
materialType.value = '主材类型异常'
}
fetchPrimaryMaterialList()
</script>
<template>
<div class="primary-material__container">
<Title name="主材料进站" showRefresh @refresh="handleRefresh" />
<a-form layout="inline" size="large">
<a-form-item label="主材类型">
<a-input v-model:value="materialType" disabled />
</a-form-item>
<a-form-item label="载具 ID">
<a-input
v-model:value="carrierInput"
@pressEnter="insertCarrier"
placeholder="按下回车录入"
allow-clear
/>
</a-form-item>
<a-form-item>
<a-button @click="insertCarrier">录入</a-button>
</a-form-item>
<a-form-item label="主材 ID">
<a-input
v-model:value="materialInput"
@pressEnter="insertMaterial"
placeholder="按下回车录入"
allow-clear
/>
</a-form-item>
<a-form-item>
<a-button @click="insertMaterial">录入</a-button>
</a-form-item>
</a-form>
<div class="table-wrapper" ref="customTable">
<a-table
:dataSource="materialTableData"
:columns="materialColumns as ColumnsType<MaterialTableItem>"
:pagination="false"
bordered
sticky
:scroll="{ y: tableHeight }"
:loading="loadingMaterialTableData"
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button
type="text"
danger
@click="handleRemoveMaterial(record as MaterialTableItem)"
>
删除
</a-button>
</template>
</template>
</a-table>
</div>
</div>
</template>
<style scoped lang="scss">
.primary-material__container {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.table-wrapper {
flex: 1;
overflow: auto;
}
}
</style>

View File

@@ -0,0 +1,136 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import type { ColumnsType } from 'ant-design-vue/es/table/interface'
import { message } from 'ant-design-vue'
interface MaterialTableItem {
key: string
materialCode: string
materialName: string
num: number
unit: string
[key: string]: any
}
const materialColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: '物料编码',
dataIndex: 'materialCode',
key: 'materialCode',
align: 'center',
},
{
title: '物料名称',
dataIndex: 'materialName',
key: 'materialName',
align: 'center',
},
{ title: '数量', dataIndex: 'num', key: 'num', align: 'center' },
{ title: '单位', dataIndex: 'unit', key: 'unit', align: 'center' },
{ title: '操作', key: 'action', align: 'center' },
]
// 材料表格
const materialTableData = ref<MaterialTableItem[]>([
{ key: '1', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '2', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '3', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '4', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '5', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '6', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '7', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '8', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{ key: '9', materialCode: '123', materialName: '物料1', num: 10, unit: '片' },
{
key: '10',
materialCode: '123',
materialName: '物料1',
num: 10,
unit: '片',
},
{
key: '11',
materialCode: '123',
materialName: '物料1',
num: 10,
unit: '片',
},
{
key: '12',
materialCode: '123',
materialName: '物料1',
num: 10,
unit: '片',
},
])
// 确认材料
const handleSubmitMaterial = (index: number) => {
message.success(`${index + 1} 号进站`)
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 60
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
renderTableHeight,
})
</script>
<template>
<div class="raw-material__container">
<Title name="材料确认" showRefresh />
<div class="table-wrapper" ref="customTable">
<a-table
:dataSource="materialTableData"
:columns="materialColumns as ColumnsType<MaterialTableItem>"
:pagination="false"
bordered
sticky
:scroll="{ y: tableHeight }"
>
<template #bodyCell="{ column, index }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'action'">
<a-button @click="handleSubmitMaterial(index)">确认</a-button>
</template>
</template>
</a-table>
</div>
</div>
</template>
<style scoped lang="scss">
.raw-material__container {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.table-wrapper {
flex: 1;
overflow: auto;
}
}
</style>

View File

@@ -0,0 +1,399 @@
<script setup lang="ts">
import { ref, nextTick, getCurrentInstance } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useTraceOrderStore } from '@/store'
import type { LotTraceOrderData } from '@/api/traceOrderManage/model'
import { handleCopy } from '@/utils/copyToClipboard'
const { proxy } = getCurrentInstance() as any
const { mes_station_status, lot_trace_order_status } = proxy.useDict(
'mes_station_status',
'lot_trace_order_status',
)
const route = useRoute()
const router = useRouter()
const traceOrderStore = useTraceOrderStore()
const redirectTo = (routeName: string) => {
router.push({ name: routeName })
}
// 孙组件
const infeedRef = ref<any>(null)
const collapsed = ref(false)
// 折叠
const toggleCollapse = async () => {
collapsed.value = !collapsed.value
await nextTick()
infeedRef.value?.renderTableHeight()
}
</script>
<template>
<div class="page-container">
<Header title="MES 过站平台" showHome showLogout>
<template #right-opts>
<a-button @click="toggleCollapse">
<template #icon>
<i-lucide-chevron-up v-if="!collapsed" />
<i-lucide-chevron-down v-else />
</template>
{{ collapsed ? '展开' : '折叠' }}
</a-button>
</template>
</Header>
<div class="content-wrapper">
<!-- Top Section -->
<div class="top-section">
<a-row :gutter="16" class="full-height-row">
<a-col :span="13">
<a-spin :spinning="traceOrderStore.loadingTraceOrderInfo">
<a-card title="工单信息" class="info-card" :bordered="false">
<a-form
:model="traceOrderStore.traceOrderInfo"
:colon="false"
v-show="!collapsed"
>
<a-row :gutter="36">
<a-col :span="12">
<a-form-item label="工单批次">
<a-input
v-model:value="traceOrderStore.traceOrderInfo.batchNo"
readonly
>
<template #suffix>
<a-button
@click="
handleCopy(
traceOrderStore.traceOrderInfo.batchNo,
)
"
size="small"
>
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="工单状态">
<a-input readonly>
<template #prefix>
<DictTag
:options="lot_trace_order_status"
:value="traceOrderStore.traceOrderInfo.status"
size="medium"
/>
</template>
</a-input>
</a-form-item>
<a-form-item label="总计数量">
<a-input
v-model:value="traceOrderStore.traceOrderInfo.planQty"
readonly
>
<template #suffix>
<a-button
@click="
handleCopy(
traceOrderStore.traceOrderInfo.planQty,
)
"
size="small"
>
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="产品编码">
<a-input
v-model:value="
traceOrderStore.traceOrderInfo.tarMaterialCode
"
readonly
>
<template #suffix>
<a-button
@click="
handleCopy(
traceOrderStore.traceOrderInfo
.tarMaterialCode,
)
"
size="small"
>
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="产品名称">
<a-input
v-model:value="
traceOrderStore.traceOrderInfo.tarMaterialName
"
readonly
>
<template #suffix>
<a-button
@click="
handleCopy(
traceOrderStore.traceOrderInfo
.tarMaterialName,
)
"
size="small"
>
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<!-- <a-form-item label="产品规格">
<a-input readonly>
<template #suffix>
<a-button @click="handleCopy('')" size="small">
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item> -->
</a-col>
</a-row>
</a-form>
<template #extra>
<a-space>
工单编码
<a-select
v-model:value="traceOrderStore.currentTraceOrderCode"
show-search
placeholder="输入工单编码"
style="width: 300px"
:show-arrow="false"
:options="traceOrderStore.traceOrderOptions"
@search="traceOrderStore.fetchTraceOrderOption"
:disabled="route.name !== 'TraceOrderManageIndex'"
@change="
(val, option) =>
traceOrderStore.selectTraceOrder(
val as string,
option as LotTraceOrderData,
)
"
/>
<a-button @click="traceOrderStore.fetchTraceOrderInfo">
<template #icon><i-lucide-rotate-cw /></template>
</a-button>
</a-space>
</template>
</a-card>
</a-spin>
</a-col>
<a-col :span="8">
<a-spin :spinning="traceOrderStore.loadingStationInfo">
<a-card title="工序信息" class="info-card" :bordered="false">
<a-form
:model="traceOrderStore.stationInfo"
:colon="false"
v-show="!collapsed"
>
<a-form-item label="工序名称">
<a-input
v-model:value="traceOrderStore.stationInfo.operationTitle"
readonly
>
<template #suffix>
<a-button
@click="
handleCopy(
traceOrderStore.stationInfo.operationTitle,
)
"
size="small"
>
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="工序状态">
<a-input readonly>
<template #prefix>
<DictTag
:options="mes_station_status"
:value="traceOrderStore.stationInfo.status"
size="medium"
/>
</template>
</a-input>
</a-form-item>
<a-form-item label="作业编码">
<a-input
v-model:value="traceOrderStore.stationInfo.code"
readonly
>
<template #suffix>
<a-button
@click="handleCopy(traceOrderStore.stationInfo.code)"
size="small"
>
<template #icon><i-lucide-copy /></template>
</a-button>
</template>
</a-input>
</a-form-item>
</a-form>
<template #extra>
<a-button @click="traceOrderStore.fetchStationInfo">
<template #icon><i-lucide-rotate-cw /></template>
</a-button>
</template>
</a-card>
</a-spin>
</a-col>
<!-- Action Buttons -->
<a-col :span="3" class="action-buttons-col">
<div class="action-buttons" v-show="!collapsed">
<a-button
class="action-btn"
@click="redirectTo('TraceOrderManage')"
:disabled="route.name == 'TraceOrderManageIndex'"
>
工单管理
</a-button>
<a-button
class="action-btn"
@click="redirectTo('PrimaryMaterial')"
disabled
>
主材清单
</a-button>
<HoldTraceOrder />
</div>
<a-card
title="操作"
class="info-card"
:bordered="false"
v-show="collapsed"
>
<template #extra>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item
key="1"
@click="redirectTo('TraceOrderManage')"
>
工单管理
</a-menu-item>
<a-menu-item
key="2"
@click="redirectTo('PrimaryMaterial')"
disabled
>
主材清单
</a-menu-item>
</a-menu>
</template>
<a-button>
更多
<i-lucide-chevron-down />
</a-button>
</a-dropdown>
</template>
</a-card>
</a-col>
</a-row>
</div>
<!-- Bottom Section -->
<main class="bottom-section">
<router-view v-slot="{ Component }">
<component :is="Component" ref="infeedRef" />
</router-view>
</main>
</div>
</div>
</template>
<style scoped lang="scss">
.page-container {
height: 100vh;
background-color: #f0f2f5;
display: flex;
flex-direction: column;
overflow: hidden;
}
.content-wrapper {
padding: 16px;
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
min-height: 0;
}
.top-section {
background: transparent;
}
:deep(.ant-spin-nested-loading),
:deep(.ant-spin-container) {
height: 100%;
}
.info-card {
height: 100%;
border-radius: 8px;
:deep(.ant-card-head) {
min-height: 48px;
padding: 0 16px;
border-bottom: none;
font-size: 20px;
}
:deep(.ant-card-body) {
padding: 1px 16px;
}
:deep(.ant-form-item) {
margin-bottom: 12px;
}
}
.action-buttons-col {
display: flex;
flex-direction: column;
}
// 传递给子组件的样式
:deep(.action-buttons) {
display: flex;
flex-direction: column;
gap: 6px;
height: 100%;
.action-btn {
height: 48px;
font-size: 20px;
font-weight: 500;
}
}
.bottom-section {
background: #fff;
padding: 12px 14px;
border-radius: 8px;
flex: 1;
min-height: 0;
overflow: auto;
}
</style>

16
src/views/traceOrderManage/model.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
export interface WorkOrderInfo {
code?: string
batchNo?: string
status?: string
tarMaterialName?: string
tarMaterialCode?: string
planQty?: number
}
export interface ProcessInfo {
process?: string
cut?: string
jobCode?: string
status?: string
equipment?: string
}

View File

@@ -0,0 +1,511 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed, getCurrentInstance } from 'vue'
import { message } from 'ant-design-vue'
import { useTraceOrderStore } from '@/store'
import type { ColumnsType } from 'ant-design-vue/es/table/interface'
import {
listMainMaterialEntryLog,
listMainMaterialOutboundLog,
batchAddMainMaterialOutboundLog,
updateMainMaterialOutboundLog,
delMainMaterialOutboundLog,
} from '@/api/traceOrderManage/primaryMaterial'
const { proxy } = getCurrentInstance() as any
const { main_material_ok_level, main_material_ng_level } = proxy.useDict(
'main_material_ok_level',
'main_material_ng_level',
)
const traceOrderStore = useTraceOrderStore()
interface PrimaryMaterialTableItem {
key: string
waferCode: string
dieCode: string
xcoordinates: string
ycoordinates: string
outputResult: 'OK' | 'NG'
qualityLevel: string
createBy: string
createTime: string
[key: string]: any
}
const primaryMaterialColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: 'Wafer ID',
dataIndex: 'waferCode',
key: 'waferCode',
align: 'center',
},
{ title: 'Die ID', dataIndex: 'dieCode', key: 'dieCode', align: 'center' },
{
title: 'Die X 坐标',
dataIndex: 'xcoordinates',
key: 'xcoordinates',
align: 'center',
},
{
title: 'Die Y 坐标',
dataIndex: 'ycoordinates',
key: 'ycoordinates',
align: 'center',
},
{
title: '结果',
dataIndex: 'outputResult',
key: 'outputResult',
align: 'center',
},
{ title: '质量等级', dataIndex: 'qualityLevel', key: 'qualityLevel' },
{ title: '创建人', dataIndex: 'createBy', key: 'createBy' },
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
{ title: '操作', key: 'action', align: 'center', width: 180 },
]
// 总计数据
const totals = computed(() => {
let okNum = 0
let ngNum = 0
primaryMaterialTableData.value.forEach(({ outputResult }) => {
if (outputResult === 'OK') {
okNum++
} else {
ngNum++
}
})
return { okNum, ngNum }
})
const primaryMaterialTableData = ref<PrimaryMaterialTableItem[]>([])
const loadingPrimaryMaterialList = ref(false)
const fetchPrimaryMaterialList = async () => {
const stationId = traceOrderStore.currentStationId
if (!stationId) return
loadingPrimaryMaterialList.value = true
try {
const { rows } = await listMainMaterialOutboundLog({ stationId })
primaryMaterialTableData.value = rows
} catch (error: any) {
message.error(error.message || '查询失败')
} finally {
loadingPrimaryMaterialList.value = false
}
}
const openPickPrimaryMaterial = ref(false)
interface InfeedMaterialTableItem {
key: string
waferCode: string
dieCode: string
result: 'OK' | 'NG'
qualityLevel: string
[key: string]: any
}
const infeedMaterialColumns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 80,
},
{
title: 'Wafer ID',
dataIndex: 'waferCode',
key: 'waferCode',
align: 'center',
},
{ title: 'Die ID', dataIndex: 'dieCode', key: 'dieCode', align: 'center' },
{ title: '结果', dataIndex: 'result', key: 'result', align: 'center' },
{ title: '质量等级', dataIndex: 'qualityLevel', key: 'qualityLevel' },
]
const infeedMaterialTableData = ref<InfeedMaterialTableItem[]>([])
// 挑选主材
const handlePickPrimaryMaterial = async () => {
const stationId = traceOrderStore.currentStationId
if (!stationId) return
try {
const { rows } = await listMainMaterialEntryLog({ stationId })
infeedMaterialTableData.value = rows.map((item) => {
return {
...item,
result: 'OK',
qualityLevel: main_material_ok_level.value[0].value || '',
}
})
openPickPrimaryMaterial.value = true
} catch (err: any) {
message.error(err.message)
}
}
const openEditRecordModal = ref(false)
const editingRecord = reactive<any>({})
// 修改主材出站记录
const handleEditRecord = (record: any) => {
Object.assign(editingRecord, record)
openEditRecordModal.value = true
}
// 提交修改主材出站记录
const handleSubmitEdit = async () => {
try {
await updateMainMaterialOutboundLog(editingRecord)
openEditRecordModal.value = false
} catch (err: any) {
message.error(err.message || '修改失败')
}
}
// 删除主材出站记录
const handleDeleteRecord = async (record: any) => {
try {
await delMainMaterialOutboundLog(record.id)
message.success('删除成功')
} catch (err: any) {
message.error(err.message || '删除失败')
}
}
// 选择主材
const rowSelection = ref<any[]>([])
const selectedKeys = ref<any>([])
const handleChangeSelection = (
selectedRowKeys: any,
selectedRows: InfeedMaterialTableItem[],
) => {
selectedKeys.value = selectedRowKeys
rowSelection.value = selectedRows.map((item) => {
return {
mainMaterialId: item.waferId ?? item.dieId,
result: item.result,
qualityLevel: item.qualityLevel,
}
})
}
// 提交主材出站
const submitOutfeed = async () => {
const stationCode = traceOrderStore.currentStationCode
try {
await batchAddMainMaterialOutboundLog({
stationCode,
outbounds: rowSelection.value,
})
message.success('提交成功')
handleCancel()
fetchPrimaryMaterialList()
} catch (err: any) {
message.error(err.message || '提交失败')
}
}
// 取消选择主材
const handleCancel = () => {
rowSelection.value = []
selectedKeys.value = []
}
const handleRefresh = () => {
fetchPrimaryMaterialList()
renderTableHeight()
}
// 计算表格高度
const customTable = ref<HTMLElement | null>(null)
const tableHeight = ref(200)
const renderTableHeight = () => {
if (customTable.value) {
tableHeight.value = customTable.value.clientHeight - 60
console.log('元素高度:', tableHeight.value)
}
}
onMounted(() => {
renderTableHeight()
})
defineExpose({
totals,
renderTableHeight,
})
fetchPrimaryMaterialList()
</script>
<template>
<div class="equipment__container">
<Title name="主材报工" showRefresh @refresh="handleRefresh" />
<a-button size="large" @click="handlePickPrimaryMaterial">
选择主材
</a-button>
<div class="table-wrapper" ref="customTable">
<a-table
:dataSource="primaryMaterialTableData"
:columns="
primaryMaterialColumns as ColumnsType<PrimaryMaterialTableItem>
"
:pagination="false"
bordered
sticky
:scroll="{ y: tableHeight }"
:loading="loadingPrimaryMaterialList"
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'outputResult'">
<a-switch
v-model:checked="record.outputResult"
checked-children="NG"
checkedValue="NG"
un-checked-children="OK"
unCheckedValue="OK"
/>
</template>
<template v-if="column.key === 'qualityLevel'">
<a-select
v-model:value="record.qualityLevel"
style="width: 80%"
v-if="record.outputResult === 'NG'"
>
<a-select-option
v-for="dict in main_material_ng_level"
:key="dict.value"
:value="dict.value"
>
{{ dict.label }}
</a-select-option>
</a-select>
<a-select
v-model:value="record.qualityLevel"
style="width: 80%"
v-if="record.outputResult === 'OK'"
>
<a-select-option
v-for="dict in main_material_ok_level"
:key="dict.value"
:value="dict.value"
>
{{ dict.label }}
</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'action'">
<a-space>
<a-button @click="handleEditRecord(record)">修改</a-button>
<a-popconfirm
title="确定删除该记录?"
ok-text=""
cancel-text=""
@confirm="handleDeleteRecord(record)"
>
<a-button danger>删除</a-button>
</a-popconfirm>
</a-space>
</template>
</template>
<template #summary>
<a-table-summary-row>
<a-table-summary-cell>总计</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>OK: {{ totals.okNum }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>NG: {{ totals.ngNum }}</a-typography-text>
</a-table-summary-cell>
</a-table-summary-row>
</template>
</a-table>
</div>
<a-modal
v-model:open="openEditRecordModal"
title="修改主材出站记录"
@ok="handleSubmitEdit"
>
<a-form
:model="editingRecord"
:label-col="{ span: 4 }"
:wrapper-col="{ span: 20 }"
>
<a-form-item label="Wafer ID">
<a-input v-model:value="editingRecord.waferCode" disabled />
</a-form-item>
<a-form-item label="Die ID">
<a-input v-model:value="editingRecord.dieCode" disabled />
</a-form-item>
<a-form-item label="Die X 坐标">
<a-input v-model:value="editingRecord.xcoordinates" disabled />
</a-form-item>
<a-form-item label="Die Y 坐标">
<a-input v-model:value="editingRecord.ycoordinates" disabled />
</a-form-item>
<a-form-item
label="结果"
:rules="[{ required: true, message: '请选择结果!' }]"
>
<a-switch
v-model:checked="editingRecord.outputResult"
checked-children="NG"
checkedValue="NG"
un-checked-children="OK"
unCheckedValue="OK"
/>
</a-form-item>
<a-form-item
label="质量等级"
:rules="[{ required: true, message: '请选择质量等级!' }]"
>
<a-select
v-model:value="editingRecord.qualityLevel"
style="width: 80%"
v-if="editingRecord.outputResult === 'NG'"
>
<a-select-option
v-for="dict in main_material_ng_level"
:key="dict.value"
:value="dict.value"
>
{{ dict.label }}
</a-select-option>
</a-select>
<a-select
v-model:value="editingRecord.qualityLevel"
style="width: 80%"
v-if="editingRecord.outputResult === 'OK'"
>
<a-select-option
v-for="dict in main_material_ok_level"
:key="dict.value"
:value="dict.value"
>
{{ dict.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-form>
</a-modal>
<a-modal
v-model:open="openPickPrimaryMaterial"
title="选择主材出站"
width="50vw"
@ok="submitOutfeed"
@cancel="handleCancel"
>
已选择 {{ rowSelection.length }} 条主材
<a-table
:dataSource="infeedMaterialTableData"
:row-selection="{
selectedRowKeys: selectedKeys,
onChange: handleChangeSelection,
}"
row-key="id"
:columns="infeedMaterialColumns as ColumnsType<InfeedMaterialTableItem>"
:pagination="false"
bordered
sticky
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
<template v-if="column.key === 'result'">
<a-switch
v-model:checked="record.result"
checked-children="NG"
checkedValue="NG"
un-checked-children="OK"
unCheckedValue="OK"
/>
</template>
<template v-if="column.key === 'qualityLevel'">
<a-select
v-model:value="record.qualityLevel"
style="width: 80%"
v-if="record.result === 'NG'"
>
<a-select-option
v-for="dict in main_material_ng_level"
:key="dict.value"
:value="dict.value"
>
{{ dict.label }}
</a-select-option>
</a-select>
<a-select
v-model:value="record.qualityLevel"
style="width: 80%"
v-if="record.result === 'OK'"
>
<a-select-option
v-for="dict in main_material_ok_level"
:key="dict.value"
:value="dict.value"
>
{{ dict.label }}
</a-select-option>
</a-select>
</template>
</template>
</a-table>
</a-modal>
</div>
</template>
<style scoped lang="scss">
.equipment__container {
height: 100%;
display: flex;
flex-direction: column;
gap: 16px;
}
.main-content {
flex: 1;
overflow: hidden;
}
.input__container {
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
height: 100%;
.description-wrapper {
flex: 1;
overflow: auto;
}
}
.table-wrapper {
height: 100%;
overflow: auto;
}
::v-deep(.ant-switch) {
background-color: #04d903;
&:hover {
background-color: #02eb02;
}
&.ant-switch-checked {
background-color: #ff0000;
&:hover {
background-color: #ff2525;
}
}
}
</style>

View File

@@ -0,0 +1,223 @@
<script setup lang="ts">
import { ref, computed, reactive } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { message } from 'ant-design-vue'
import { listStorageLocation } from '@/api/traceOrderManage/location'
import {
completeStation,
isLastStation as getIsLastStation,
} from '@/api/traceOrderManage/station'
import { useTraceOrderStore } from '@/store'
const router = useRouter()
const route = useRoute()
const traceOrderStore = useTraceOrderStore()
const menuItems = [
{ label: '主材报工', key: 'JobReport', progress: 30 },
{ label: '工序参数', key: 'ParameterConfiguration', progress: 80 },
{ label: '流转指引', key: 'ProcessGuidance', progress: 80 },
]
const activeKey = computed(() => route.name as string)
const handleMenuClick = (name: string) => {
router.push({ name })
}
const locationOptions = ref<any>([])
const fetchLocationList = async () => {
try {
const { rows } = await listStorageLocation({})
locationOptions.value = rows
} catch (error: any) {
message.error(error.message || '获取库位列表失败')
}
}
const openSelectLocation = ref(false)
const handleOutfeed = async () => {
// 判断是否为末站点
const { data: isLastStation } = await getIsLastStation(
traceOrderStore.currentStationId,
)
if (isLastStation || outfeedChildRef.value?.totals.ngNum) {
fetchLocationList()
openSelectLocation.value = true
} else {
submitOutfeed()
}
}
const storage = reactive({})
const handleChangeLocation = (value: any, option: any) => {
Object.assign(storage, option)
}
const closeOutfeed = () => {
openSelectLocation.value = false
}
// 确认出站
const outfeeding = ref(false)
const submitOutfeed = async () => {
outfeeding.value = true
try {
await completeStation(traceOrderStore.currentStationId, storage)
openSelectLocation.value = false
message.success('出站成功')
traceOrderStore.fetchStationInfo()
traceOrderStore.fetchStationList()
router.push({ name: 'TraceOrderManage' })
} catch (error: any) {
message.error(error.message || '出站失败')
} finally {
outfeeding.value = false
}
}
const outfeedChildRef = ref<any>(null)
/** 父组件对外暴露的方法 */
function renderTableHeight() {
outfeedChildRef.value?.renderTableHeight()
}
defineExpose({
renderTableHeight,
})
fetchLocationList()
</script>
<template>
<a-spin :spinning="outfeeding">
<a-row class="outfeed-layout">
<a-col :span="20" class="content-wrapper">
<router-view v-slot="{ Component }">
<component :is="Component" ref="outfeedChildRef" />
</router-view>
</a-col>
<a-col :span="4" class="menu-wrapper">
<div class="menu-list">
<span class="outfeed-title">出站</span>
<div
v-for="item in menuItems"
:key="item.key"
class="menu-item"
:class="{ active: activeKey === item.key }"
@click="handleMenuClick(item.key)"
>
<div class="menu-content">
<span class="menu-title">{{ item.label }}</span>
<a-progress
:percent="item.progress"
:show-info="false"
size="small"
:stroke-color="activeKey === item.key ? '#1890ff' : undefined"
class="menu-progress"
/>
</div>
</div>
<a-button type="primary" size="large" @click="handleOutfeed">
确认出站
</a-button>
</div>
</a-col>
</a-row>
<a-modal
title="选择出站库位"
:open="openSelectLocation"
@ok="submitOutfeed"
@cancel="closeOutfeed"
>
<a-select
style="width: 100%"
@change="handleChangeLocation"
:options="locationOptions"
:fieldNames="{ label: 'storageLocationCode', value: 'id' }"
/>
</a-modal>
</a-spin>
</template>
<style scoped lang="scss">
.outfeed-layout {
height: 100%;
}
.menu-list {
display: flex;
flex-direction: column;
gap: 16px;
height: 100%;
}
.outfeed-title {
font-size: 20px;
font-weight: 600;
border-bottom: 1px solid #c9c9c9;
padding: 0 0 8px;
}
.menu-item {
flex: 1;
background: #fff;
border-radius: 8px;
padding: 1vh 1vw;
cursor: pointer;
transition: all 0.3s;
border: 1px solid #f0f0f0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
position: relative;
overflow: hidden;
&.active {
background: #e6f7ff;
border-color: #1890ff;
.menu-title {
color: #1890ff;
}
}
&:hover {
border-color: #47a5fd;
}
}
.menu-content {
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
}
.menu-title {
font-size: 18px;
font-weight: bold;
color: #333;
line-height: 1.5;
}
.menu-progress {
margin-bottom: 0 !important;
:deep(.ant-progress-bg) {
transition: all 0.3s;
}
}
.menu-wrapper {
padding: 12px;
border-radius: 7px;
background-color: #f3f3f3;
}
.content-wrapper {
height: 100%;
padding: 12px;
}
</style>

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"></script> <script setup lang="ts"></script>
<template> <template>
<div></div> <div></div>
</template> </template>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"></script> <script setup lang="ts"></script>
<template> <template>
<div></div> <div></div>
</template> </template>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>

View File

@@ -1,56 +1,55 @@
import { defineConfig, loadEnv } from 'vite'; import { defineConfig, loadEnv } from 'vite'
import Components from "unplugin-vue-components/vite"; // 按需组件自动导入 import Components from 'unplugin-vue-components/vite' // 按需组件自动导入
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers"; import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue'
import Icons from 'unplugin-icons/vite'; import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'; import IconsResolver from 'unplugin-icons/resolver'
import path from 'path'; import path from 'path'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
const env = loadEnv(mode, process.cwd()); return {
resolve: {
return { alias: {
resolve: { '@': path.resolve(__dirname, 'src'),
alias: { },
"@": path.resolve(__dirname, "src"), },
}, server: {
}, proxy: {
server: { '/api': {
proxy: { target: env.VITE_APP_BASE_URL,
"/api": { changeOrigin: true,
target: env.VITE_APP_BASE_URL, rewrite: (path) => path.replace(/^\/api\//, '/'),
changeOrigin: true, },
rewrite: (path) => path.replace(/^\/api\//, "/"), '/prod-api': {
}, target: env.VITE_APP_BASE_URL,
"/prod-api": { changeOrigin: true,
target: env.VITE_APP_BASE_URL, rewrite: (path) => path.replace(/^\/prod-api\//, '/'),
changeOrigin: true, },
rewrite: (path) => path.replace(/^\/prod-api\//, "/"), },
}, },
}, plugins: [
}, vue(),
plugins: [ Components({
vue(), dts: true, //生成components.d.ts 全局定义文件
Components({ resolvers: [
dts: true, //生成components.d.ts 全局定义文件 AntDesignVueResolver({
resolvers: [ //对使用到的全局ant design vue组件进行类型导入
AntDesignVueResolver({ importStyle: false, // 不动态引入css,这个不强求
//对使用到的全局ant design vue组件进行类型导入 }),
importStyle: false, // 不动态引入css,这个不强求 // 自动导入 lucide 图标
}), IconsResolver({
// 自动导入 lucide 图标 prefix: 'i', // 比如用 <i-a-arrow-down />
IconsResolver({ enabledCollections: ['lucide'],
prefix: "i", // 比如用 <i-a-arrow-down /> }),
enabledCollections: ["lucide"], ],
}), include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx$/], //包含的文件类型
], }),
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx$/], //包含的文件类型 Icons({
}), autoInstall: true, // 没安装的图标库会自动下载
Icons({ }),
autoInstall: true, // 没安装的图标库会自动下载 ],
}), }
], })
};
});