Compare commits
6 Commits
db87adf26a
...
2107dfa261
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2107dfa261 | ||
|
|
4fd2c32cd7 | ||
|
|
5d0d653b11 | ||
|
|
39f0d1e126 | ||
|
|
c8f50782af | ||
|
|
27835e73ac |
@@ -1,2 +1,5 @@
|
||||
# 开发环境
|
||||
VITE_APP_BASE_API = '/api'
|
||||
VITE_APP_BASE_API='/api'
|
||||
|
||||
|
||||
VITE_APP_BASE_URL='http://192.168.1.38:18081'
|
||||
@@ -1,2 +1,4 @@
|
||||
# 生产环境
|
||||
VITE_APP_BASE_API = '/prod-api'
|
||||
VITE_APP_BASE_API=/prod-api
|
||||
|
||||
VITE_APP_BASE_URL=http://127.0.0.1:18081
|
||||
3
global.d.ts
vendored
3
global.d.ts
vendored
@@ -1,5 +1,4 @@
|
||||
// declare module '@/*';
|
||||
declare module '@/components/*';
|
||||
declare module '@/views/*';
|
||||
declare module '@/api/*';
|
||||
declare module '@/App.vue';
|
||||
declare module '@/api/*';
|
||||
2
src/api/data/model.d.ts
vendored
2
src/api/data/model.d.ts
vendored
@@ -2,7 +2,7 @@ export interface QueryParams {
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
orderByColumn?: string;
|
||||
isAsc?: boolean;
|
||||
isAsc?: string;
|
||||
qrCode?: string;
|
||||
createTimeBegin?: string;
|
||||
createTimeEnd?: string;
|
||||
|
||||
@@ -13,7 +13,7 @@ const errCodeMap: { [key: string]: string } = {
|
||||
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API as string,
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ service.interceptors.request.use(
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
console.log(response)
|
||||
// console.log(response);
|
||||
const code = response.data.code || 200;
|
||||
const data = response.data;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<a-row :gutter="[0, 12]">
|
||||
<a-col :span="8" class="modal-label">LMS 状态</a-col>
|
||||
<a-col :span="16" class="modal-value">
|
||||
<a-switch v-model:checked="isOnline" checked-children="在线" un-checked-children="离线" @change="handleToggleOnline" />
|
||||
<a-switch v-model:checked="isOnline" checked-children="在线" un-checked-children="离线" :loading="loading" @click="handleToggleOnline" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[0, 12]">
|
||||
@@ -37,6 +37,7 @@ import { message } from 'ant-design-vue';
|
||||
const { visible: dialogVisible, show, hide } = useDialog();
|
||||
|
||||
const isOnline = ref(false);
|
||||
const loading = ref(false);
|
||||
const lmsStatus = computed(() => isOnline.value ? '在线' : '离线');
|
||||
|
||||
const onlineStatusClass = computed(() => {
|
||||
@@ -45,12 +46,19 @@ const onlineStatusClass = computed(() => {
|
||||
|
||||
// 当请求发送成功后才切换状态
|
||||
async function handleToggleOnline(checked: boolean | string | number) {
|
||||
await updateLmsWorkMode(checked ? 1 : 0).then(() => {
|
||||
console.log('checked', checked);
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
await updateLmsWorkMode(checked ? 1 : 0);
|
||||
isOnline.value = Boolean(checked);
|
||||
message.success('切换成功');
|
||||
}).catch((error) => {
|
||||
} catch (e) {
|
||||
isOnline.value = !Boolean(checked);
|
||||
message.error('切换失败');
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const modalTitle = ref('LMS 状态');
|
||||
|
||||
@@ -3,8 +3,7 @@ import { EventSourcePolyfill } from 'event-source-polyfill';
|
||||
import { generateUUID } from './uuidUtils';
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
// const defaultServerUrl = 'http://192.168.1.38:18081/sse';
|
||||
const defaultServerUrl = 'http://127.0.0.1:18081/sse';
|
||||
const defaultServerUrl = import.meta.env.VITE_APP_BASE_URL + '/sse';
|
||||
|
||||
interface EventData {
|
||||
timestamp: string;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<a-form layout="inline" :model="formData">
|
||||
<a-form-item label="日期范围">
|
||||
<a-range-picker v-model:value="formData.dateRange" :placeholder="['开始日期', '结束日期']"
|
||||
format="YYYY-MM-DD hh:mm:ss" class="date-range-picker" show-time />
|
||||
format="YYYY-MM-DD hh:mm:ss" show-time />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
@@ -237,111 +237,54 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "@/assets/styles/variables" as *;
|
||||
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.l1-data-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
padding: $spacing-lg;
|
||||
padding: 20px;
|
||||
background: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
margin-bottom: $spacing-lg;
|
||||
flex-shrink: 0;
|
||||
.page-header {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.page-title {
|
||||
font-size: $title-font-size;
|
||||
color: $text-dark;
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
background: $bg-light;
|
||||
padding: $spacing-lg;
|
||||
border-radius: $border-radius-lg;
|
||||
margin-bottom: $spacing-lg;
|
||||
flex-shrink: 0;
|
||||
|
||||
.filter-label {
|
||||
font-weight: 500;
|
||||
color: $text-dark;
|
||||
font-size: $content-font-size;
|
||||
}
|
||||
}
|
||||
|
||||
.table-section {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.ant-table-wrapper) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.ant-spin-container,
|
||||
.ant-table {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ant-table-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ant-table-body {
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-content {
|
||||
.ant-descriptions {
|
||||
margin-top: $spacing-md;
|
||||
}
|
||||
.page-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.ant-btn-primary) {
|
||||
background: $primary-color;
|
||||
border-color: $primary-color;
|
||||
|
||||
&:hover {
|
||||
background: $primary-light;
|
||||
border-color: $primary-light;
|
||||
}
|
||||
.filter-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.l1-data-container {
|
||||
padding: $spacing-md;
|
||||
.table-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
.ant-row {
|
||||
flex-direction: column;
|
||||
gap: $spacing-md;
|
||||
.detail-content {
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ant-col {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
:deep(.ant-table-thead > tr > th) {
|
||||
background: #f8fafc;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.date-range-picker {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.ant-table-tbody > tr:hover > td) {
|
||||
background: #f0f9ff;
|
||||
}
|
||||
|
||||
:deep(.ant-descriptions-item-label) {
|
||||
font-weight: 600;
|
||||
background: #f8fafc;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,13 +8,8 @@
|
||||
<div class="filter-section">
|
||||
<a-form layout="inline" :model="formData">
|
||||
<a-form-item label="日期范围">
|
||||
<a-range-picker
|
||||
v-model:value="formData.dateRange"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
format="YYYY-MM-DD hh:mm:ss"
|
||||
class="date-range-picker"
|
||||
show-time
|
||||
/>
|
||||
<a-range-picker v-model:value="formData.dateRange" :placeholder="['开始日期', '结束日期']"
|
||||
format="YYYY-MM-DD hh:mm:ss" show-time />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
@@ -37,17 +32,10 @@
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<div class="table-section">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="tableData"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@change="handleTableChange"
|
||||
row-key="id"
|
||||
size="middle"
|
||||
:scroll="{ x: 1200 }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<a-table :columns="columns" :data-source="tableData" :loading="loading" :pagination="pagination"
|
||||
@change="handleTableChange" row-key="id" size="middle" :scroll="{ x: 1200 }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'index'">{{ index + 1 }}</template>
|
||||
<template v-if="column.key === 'createTime'">
|
||||
{{ formatDateTime(record.createTime) }}
|
||||
</template>
|
||||
@@ -86,24 +74,19 @@
|
||||
查看详情
|
||||
</a-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ record[column.key as string] }}
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<a-modal
|
||||
v-model:open="detailModalVisible"
|
||||
title="L4数据详情"
|
||||
width="800px"
|
||||
:footer="null"
|
||||
>
|
||||
<a-modal v-model:open="detailModalVisible" title="L4数据详情" width="800px" :footer="null">
|
||||
<div v-if="selectedRecord" class="detail-content">
|
||||
<a-descriptions :column="2" bordered>
|
||||
<a-descriptions-item
|
||||
v-for="(value, key) in selectedRecord"
|
||||
:key="key"
|
||||
:label="columns.find((col) => col.key === key)?.title || key"
|
||||
>
|
||||
<a-descriptions-item v-for="(value, key) in selectedRecord" :key="key"
|
||||
:label="columns.find((col) => col.key === key)?.title || key">
|
||||
<template v-if="key === 'createTime'">
|
||||
{{ formatDateTime(value) }}
|
||||
</template>
|
||||
@@ -148,13 +131,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { getL4Data } from '@/api/data';
|
||||
import { columns } from './data';
|
||||
import type { QueryParams } from '@/api/data/model';
|
||||
import type { L4Data } from './types';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import { idText } from 'typescript';
|
||||
|
||||
type DateRangeType = [Dayjs, Dayjs] | undefined;
|
||||
|
||||
@@ -209,6 +193,8 @@ const fetchData = async () => {
|
||||
const params: QueryParams = {
|
||||
pageNum: pagination.current,
|
||||
pageSize: pagination.pageSize,
|
||||
orderByColumn: 'id',
|
||||
isAsc: 'desc'
|
||||
};
|
||||
|
||||
// 添加日期范围筛选
|
||||
@@ -278,7 +264,7 @@ onMounted(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
.l4-data-container {
|
||||
padding: 20px;
|
||||
background: #f5f5f5;
|
||||
@@ -287,13 +273,13 @@ onMounted(() => {
|
||||
|
||||
.page-header {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0;
|
||||
|
||||
.page-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
@@ -304,10 +290,6 @@ onMounted(() => {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.date-range-picker {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.table-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
|
||||
@@ -182,17 +182,15 @@ const handleSseMessage = (data: string) => {
|
||||
console.log('收到SSE消息:', data);
|
||||
};
|
||||
|
||||
// Status handlers are now managed by individual modal components
|
||||
|
||||
// 检测设备表单数据
|
||||
const detectForm = reactive({
|
||||
workOrderCode: 'SKT202507220001',
|
||||
productCode: 'JH1008611',
|
||||
employeeCode: 'ZDXTEST',
|
||||
processName: 'T-自动组装测试',
|
||||
resourceName: 'T-A自动组装测试',
|
||||
equipmentCode: 'JH.02.101.13-219',
|
||||
fixtureCode: 'JH0001',
|
||||
workOrderCode: '',
|
||||
productCode: '',
|
||||
employeeCode: '',
|
||||
processName: '',
|
||||
resourceName: '',
|
||||
equipmentCode: '',
|
||||
fixtureCode: '',
|
||||
confirmSequence: '',
|
||||
detectionData: '',
|
||||
sequenceCount: 1
|
||||
@@ -200,18 +198,18 @@ const detectForm = reactive({
|
||||
|
||||
// 包装设备表单数据
|
||||
const packageForm = reactive({
|
||||
customerSelection: '上海电子科技有限公司',
|
||||
productModel: 'A538-09-高精度传感器',
|
||||
employeeCode: 'OP-7853',
|
||||
processName: '自动包装',
|
||||
resourceName: '包装台2号',
|
||||
equipmentCode: 'EQ-PK-002',
|
||||
fixtureCode: 'FX-PK-002-B',
|
||||
packingResult: '正常',
|
||||
sequenceNumber: 'SN-A538-09-2023-00018',
|
||||
passStationCount: 18,
|
||||
fullBoxCount: 25,
|
||||
passStationSequence: 'SN-A538-09-2023-00018'
|
||||
customerSelection: '',
|
||||
productModel: '',
|
||||
employeeCode: '',
|
||||
processName: '',
|
||||
resourceName: '',
|
||||
equipmentCode: '',
|
||||
fixtureCode: '',
|
||||
packingResult: '',
|
||||
sequenceNumber: '',
|
||||
passStationCount: '',
|
||||
fullBoxCount: '',
|
||||
passStationSequence: ''
|
||||
});
|
||||
|
||||
// 编辑模式切换
|
||||
@@ -473,22 +471,10 @@ onBeforeUnmount(() => {
|
||||
</div>
|
||||
</div>
|
||||
<a-form :model="packageForm" :rules="packageRules" class="device-info" ref="packageFormRef" :colon="false"
|
||||
hideRequiredMark :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
|
||||
hideRequiredMark :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
|
||||
<a-row :gutter="32">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="客户选择" name="customerSelection">
|
||||
<a-input v-model:value="packageForm.customerSelection" class="edit-input"
|
||||
:disabled="!isPackageEditMode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="产品型号" name="productModel">
|
||||
<a-input v-model:value="packageForm.productModel" class="edit-input"
|
||||
:disabled="!isPackageEditMode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="工号" name="employeeCode">
|
||||
<a-form-item label="员工工号" name="employeeCode">
|
||||
<a-input v-model:value="packageForm.employeeCode" class="edit-input"
|
||||
:disabled="!isPackageEditMode" />
|
||||
</a-form-item>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import Components from "unplugin-vue-components/vite"; // 按需组件自动导入
|
||||
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
@@ -7,44 +7,49 @@ import IconsResolver from 'unplugin-icons/resolver';
|
||||
import path from 'path';
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://192.168.1.38:18081",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||
},
|
||||
"/prod-api": {
|
||||
target: "http://127.0.0.1:18081",
|
||||
changeOrigin: true,
|
||||
export default defineConfig(({ mode }) => {
|
||||
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
|
||||
return {
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
Components({
|
||||
dts: true, //生成components.d.ts 全局定义文件
|
||||
resolvers: [
|
||||
AntDesignVueResolver({
|
||||
//对使用到的全局ant design vue组件进行类型导入
|
||||
importStyle: false, // 不动态引入css,这个不强求
|
||||
}),
|
||||
// 自动导入 lucide 图标
|
||||
IconsResolver({
|
||||
prefix: "i", // 比如用 <i-a-arrow-down />
|
||||
enabledCollections: ["lucide"],
|
||||
}),
|
||||
],
|
||||
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx$/], //包含的文件类型
|
||||
}),
|
||||
Icons({
|
||||
autoInstall: true, // 没安装的图标库会自动下载
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: env.VITE_APP_BASE_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||
},
|
||||
"/prod-api": {
|
||||
target: env.VITE_APP_BASE_URL,
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
Components({
|
||||
dts: true, //生成components.d.ts 全局定义文件
|
||||
resolvers: [
|
||||
AntDesignVueResolver({
|
||||
//对使用到的全局ant design vue组件进行类型导入
|
||||
importStyle: false, // 不动态引入css,这个不强求
|
||||
}),
|
||||
// 自动导入 lucide 图标
|
||||
IconsResolver({
|
||||
prefix: "i", // 比如用 <i-a-arrow-down />
|
||||
enabledCollections: ["lucide"],
|
||||
}),
|
||||
],
|
||||
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.tsx$/], //包含的文件类型
|
||||
}),
|
||||
Icons({
|
||||
autoInstall: true, // 没安装的图标库会自动下载
|
||||
}),
|
||||
],
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user