From ef905a448385c2a78f3ebaa51d2420e1d7765bb9 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期四, 24 七月 2025 23:30:14 +0800
Subject: [PATCH] 优化首检模块UI和功能
---
pages/QC/SJ/detail.vue | 12 +-
CLAUDE.md | 122 ++++++++++++++++++++++++++++++
pages/QC/SJ/List.vue | 17 +++
pages/QC/SJ/Add.vue | 79 +++++++++++--------
4 files changed, 187 insertions(+), 43 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..a7e52b7
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,122 @@
+# CLAUDE.md
+
+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+
+## Project Overview
+
+This is a **uni-app** mobile application project for Quality Control (QC) and Warehouse management in a Manufacturing Execution System (MES). The application is built for PDA devices and supports quality inspection processes and warehouse operations.
+
+- **Framework**: uni-app (Vue 2.x based)
+- **App Name**: GS-MES-AP (骞挎繁绉戞妧 MES Application)
+- **Target Platform**: Android mobile/PDA devices
+- **UI Framework**: uView UI library
+
+## Build and Development Commands
+
+This is a uni-app project that builds through HBuilderX IDE or uni-app CLI. The build output is generated in the `unpackage/` directory:
+
+- **Development Build**: Use HBuilderX IDE or `npm run dev:app-plus` for development
+- **Production Build**: APK files are generated in `unpackage/release/apk/`
+- **Cache**: Build cache and temporary files are stored in `unpackage/cache/`
+- **Testing**: Use HBuilderX IDE's built-in testing tools or deploy to PDA devices for testing
+
+**Note**: This project does not have traditional npm scripts. Development and building are primarily done through HBuilderX IDE.
+
+## Architecture Overview
+
+### Core Structure
+- **Entry Point**: `main.js` - Contains Vue prototypes, global mixins, and API configuration
+- **State Management**: `store/index.js` - Vuex store with server configuration and minimal state
+- **Routing**: `pages.json` - uni-app page configuration with tabBar navigation
+- **Global Config**: `manifest.json` - App configuration including permissions and build settings
+
+### Key Directories
+- `pages/BasePages/` - Core app pages (login, main menu, user profile)
+- `pages/QC/` - Quality Control modules (鏉ユ枡妫�楠� LLJ, 宸℃ XJ, 棣栨 SJ, 鍏ュ簱妫� RKJ)
+- `pages/Warehouse/` - Warehouse operations (inventory, purchasing, allocation)
+- `components/` - Reusable UI components and third-party integrations
+- `static/` - Static assets (images, audio files, CSS)
+- `uni_modules/` - uni-app plugin modules including uView UI
+
+### API Architecture
+- **Base API**: Configured in Vuex store with environment-specific URLs
+- **Request Methods**: Custom Vue prototypes (`$post`, `$get`, `$uni_request`) with loading states
+- **Authentication**: User login state managed globally via `$loginInfo`
+- **Error Handling**: Centralized error handling with toast messages
+
+### Main Features
+1. **Quality Control (QC)**:
+ - 鏉ユ枡妫�楠� (LLJ) - Incoming Material Inspection
+ - 宸℃ (XJ) - Patrol Inspection
+ - 棣栨 (SJ) - First Article Inspection
+ - 鍏ュ簱妫� (RKJ) - Warehouse Inspection
+
+2. **Warehouse Operations**:
+ - Purchase inventory management
+ - Material allocation and transfers
+ - Barcode printing and scanning
+
+3. **Common Functions**:
+ - Barcode/QR code scanning
+ - Photo capture and upload
+ - Bluetooth printing integration
+ - Offline data synchronization
+
+### Navigation Structure
+- **Tab Bar**: 3 main tabs (棣栭〉/Home, 娑堟伅涓績/Message Center, 鎴戠殑/Profile)
+- **Menu System**: Dynamic menu loading based on user permissions via `$getUserMenu()`
+- **Page Flow**: List 鈫� Detail 鈫� Form pattern for most workflows
+
+## Development Guidelines
+
+### Server Configuration
+The app connects to different servers based on environment:
+- Development: `http://localhost:10054` or `http://192.168.1.104:10056/api`
+- Check `store/index.js` for current active server endpoints
+
+### Global Utilities
+- `$showMessage()` - Display toast notifications
+- `$showDialog()` - Show confirmation dialogs
+- `$camera()` - Camera/photo selection functionality
+- `$getDate()` - Date formatting utilities
+- `$getUrlParams()` - URL parameter parsing
+
+### Component Dependencies
+- **uView UI**: Primary UI component library
+- **Custom Components**: Scanner, printer utilities in `components/kk-printer/`
+- **Third-party**: Charts (u-charts), maps (amap), markdown parsing
+
+### File Upload System
+Image uploads use base64 encoding via `$fileUpload()` method, sending to `/Base/saveImage` endpoint.
+
+### Authentication System
+- User authentication is managed through `$loginInfo` object in `main.js`
+- Login state persists using `uni.getStorageSync()` and `uni.setStorageSync()`
+- Global mixin `globalMixin.js` provides `checkUserAuth()` for automatic login verification
+- Users are redirected to `/pages/BasePages/login` if not authenticated
+
+### Request Architecture
+- **$post()** and **$get()**: Standard API requests with automatic loading indicators
+- **$uni_request()**: Core request method with error handling and status checking
+- **$toERP()**: External ERP system integration requests
+- **$postSyncPost()**: Promise-based synchronous POST requests
+- All requests automatically handle loading states, error messages, and network failures
+
+### Hardware Integration
+- **Camera**: Native camera access via `$camera()` with image compression options
+- **Barcode Scanner**: QR/barcode scanning capabilities for PDA devices
+- **Bluetooth Printing**: Printer integration through `components/kk-printer/`
+- **Device Permissions**: Configured in `manifest.json` for camera, storage, network, and Bluetooth access
+
+### Page Architecture Patterns
+- **List Pages**: Pagination with pull-to-refresh and infinite scroll
+- **Detail Pages**: Read-only view with navigation to edit forms
+- **Add/Edit Forms**: Input validation and submission with photo upload capabilities
+- **Scan Pages**: Barcode scanning with immediate data processing
+
+### Environment Configuration
+Current server endpoints are configured in `store/index.js`:
+- **Development**: `http://localhost:5184/api`
+- **Internal Network**: `http://192.168.11.251:10054`
+- **Testing**: `http://192.168.1.104:10056/api` or `10057/api`
+- Switch between environments by updating `serverAPI` in the Vuex store
\ No newline at end of file
diff --git a/pages/QC/SJ/Add.vue b/pages/QC/SJ/Add.vue
index fcc02df..fdedfb1 100644
--- a/pages/QC/SJ/Add.vue
+++ b/pages/QC/SJ/Add.vue
@@ -53,12 +53,8 @@
<view class="info-value highlight">{{ formData.daa008 }}</view>
</view>
<view v-if="formData.remarks" class="info-block">
- <view class="info-label">涓嶅悎鏍兼弿杩帮細</view>
- <view class="info-value">{{ formData.remarks }}</view>
- </view>
- <view v-if="formData.comments" class="info-block">
<view class="info-label">澶囨敞锛�</view>
- <view class="info-value">{{ formData.comments }}</view>
+ <view class="info-value">{{ formData.remarks }}</view>
</view>
</view>
@@ -137,9 +133,8 @@
<button v-if="!isUpdate && !formData.statusUser && !isShowTable" class="secondary-btn" @click="removeXJ">
鍒犻櫎鍗曟嵁
</button>
- <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="saveRemarks">娣诲姞涓嶅悎鏍兼弿杩�</button>
- <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="saveComments">娣诲姞澶囨敞</button>
- <button v-if="!isUpdate && !isShowTable" class="primary-btn" @click="submit">瀹℃牳鍗曟嵁</button>
+ <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="saveRemarks">娣诲姞澶囨敞</button>
+ <button v-if="!isUpdate && !isShowTable && formData.fSubmit != 1" class="primary-btn" @click="submit">瀹℃牳鍗曟嵁</button>
<button v-if="isShowTable" class="secondary-btn" @click="getTable">鑾峰彇妫�楠岄」鐩�</button>
<button v-if="isShowTable && isUpdate" class="primary-btn" @click="saveTable">鐢熸垚妫�楠岄」鐩�</button>
</view>
@@ -147,28 +142,14 @@
<!-- 寮圭獥 -->
<view v-if="remarksPopup" class="overlay">
<view class="popup">
- <h3>淇敼涓嶅悎鏍兼弿杩�</h3>
- <form>
- <view class="form-group">
- <label class="form-label">涓嶅悎鏍兼弿杩�:</label>
- <input v-model="remarks" class="form-input" type="text"/>
- </view>
- <button class="updateBut" @click="editRemarks">淇敼</button>
- <button @click="remarksPopup = !remarksPopup">鍙栨秷</button>
- </form>
- </view>
- </view>
-
- <view v-if="commentsPopup" class="overlay">
- <view class="popup">
<h3>淇敼澶囨敞</h3>
<form>
<view class="form-group">
<label class="form-label">澶囨敞:</label>
- <input v-model="comments" class="form-input" type="text"/>
+ <textarea v-model="remarks" class="form-input form-textarea" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�..."></textarea>
</view>
- <button class="updateBut" @click="editComments">淇敼</button>
- <button @click="commentsPopup = !commentsPopup">鍙栨秷</button>
+ <button class="updateBut" @click="editRemarks">淇敼</button>
+ <button @click="remarksPopup = !remarksPopup">鍙栨秷</button>
</form>
</view>
</view>
@@ -191,6 +172,7 @@
comments: "",
statusUser: "",
itemId: "",
+ fSubmit: 0,
},
DAA020List: [],
@@ -300,17 +282,26 @@
}).then(res => {
//2024-11-28 kyy 鏍¢獙鍚堟牸鎻愪氦澧炲姞鎻愮ず
+ console.log("瀹屾暣鍝嶅簲鏁版嵁:", res);
console.log("Status Code鐨勫��:", res.statusCode);
- if (res.statusCode === 200) {
+ console.log("杩斿洖鐨勬暟鎹�:", res.data);
+
+ // 妫�鏌ュ绉嶆垚鍔熸潯浠�
+ if (res.statusCode === 200 || res.status === 0 || res.data === true || res.data.tbBillList === true) {
this.$showMessage("鎴愬姛鎻愪氦妫�楠�");
- // 浣跨敤setTimeout鍦�7绉掑悗闅愯棌娑堟伅
+ // 鎻愪氦鎴愬姛鍚庤烦杞埌鍒楄〃椤甸潰
setTimeout(() => {
- this.hideCustomMessage();
- }, 7000); // 7000姣绛変簬7绉�
+ uni.navigateTo({
+ url: '/pages/QC/SJ/List'
+ });
+ }, 1500); // 1.5绉掑悗璺宠浆锛岃鐢ㄦ埛鐪嬪埌鎴愬姛鎻愮ず
} else {
- this.$showMessage(res.data.message);
+ this.$showMessage(res.data.message || res.message || "鎻愪氦澶辫触");
}
+ }).catch(err => {
+ console.log("鎻愪氦鍑洪敊:", err);
+ this.$showMessage("鎻愪氦澶辫触锛岃閲嶈瘯");
})
},
@@ -426,7 +417,7 @@
this.$post({
url: "/SJ/SetQSItems",
data: {
- itemId: this.formData.itemNo
+ itemNo: this.formData.itemNo
}
}).then(res => {
if (res.data.tbBillList.length > 0) {
@@ -459,7 +450,7 @@
this.$post({
url: "/SJ/SetQSItems",
data: {
- itemId: this.formData.itemNo
+ itemNo: this.formData.itemNo
}
}).then(res => {
if (res.data.tbBillList.length > 0) {
@@ -1001,8 +992,9 @@
padding: 20px;
border: 1px solid #ccc;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
- width: 68vw;
- height: 25vh;
+ width: 85vw;
+ min-height: 35vh;
+ max-height: 60vh;
border-radius: 8px;
}
@@ -1035,6 +1027,13 @@
border-radius: 4px;
font-size: 14px;
box-sizing: border-box;
+}
+
+.popup .form-textarea {
+ min-height: 120px;
+ resize: vertical;
+ font-family: inherit;
+ line-height: 1.5;
}
.popup-buttons {
@@ -1155,6 +1154,18 @@
width: 6px;
height: 6px;
}
+
+ /* 绉诲姩绔脊鍑烘浼樺寲 */
+ .popup {
+ width: 95vw;
+ min-height: 40vh;
+ max-height: 70vh;
+ padding: 15px;
+ }
+
+ .popup .form-textarea {
+ min-height: 100px;
+ }
}
/* 骞虫澘璁惧鏍峰紡 */
diff --git a/pages/QC/SJ/List.vue b/pages/QC/SJ/List.vue
index 0360664..7125a48 100644
--- a/pages/QC/SJ/List.vue
+++ b/pages/QC/SJ/List.vue
@@ -35,9 +35,15 @@
<view v-if="item.urgent == 1" class="badge urgent">鎬ユ枡</view>
<view v-if="item.isFirst == 1" class="badge normal">棣栨</view>
<view class="card-title">妫�楠屽崟鍙�: {{ item.billNo }}</view>
- <view :class="{'status-pending': current === 0, 'status-assigned': current === 0 && item.statusUser, 'status-pass': current === 1 && item.result === '鍚堟牸', 'status-fail': current === 1 && item.result === '涓嶅悎鏍�'}"
+ <view :class="{
+ 'status-pending': !item.result && current === 0,
+ 'status-assigned': current === 0 && item.statusUser && !item.result,
+ 'status-pass': item.result === '鍚堟牸',
+ 'status-fail': item.result === '涓嶅悎鏍�',
+ 'status-submitted': !item.result && current === 1
+ }"
class="status">
- {{ current === 0 ? (item.statusUser ? '宸插垎閰�' : '鏈彁浜�') : (item.result ? item.result : '宸叉彁浜�') }}
+ {{ current === 0 ? (item.result ? item.result : '鏈彁浜�') : (item.result ? item.result : '宸叉彁浜�') }}
</view>
</view>
@@ -460,7 +466,12 @@
}
.status-fail {
- background: linear-gradient(135deg, #e74c3c, #c0392b);
+ background: linear-gradient(135deg, #3498db, #2980b9);
+ color: white;
+}
+
+.status-submitted {
+ background: linear-gradient(135deg, #95a5a6, #7f8c8d);
color: white;
}
diff --git a/pages/QC/SJ/detail.vue b/pages/QC/SJ/detail.vue
index 366942d..b8fc3ea 100644
--- a/pages/QC/SJ/detail.vue
+++ b/pages/QC/SJ/detail.vue
@@ -76,7 +76,7 @@
<view class="info-value">{{ formData.result }}</view>
</view>
<view v-if="formData.remarks" class="info-item">
- <view class="info-label">涓嶅悎鏍兼弿杩�</view>
+ <view class="info-label">澶囨敞</view>
<view class="info-value danger">{{ formData.remarks }}</view>
</view>
</view>
@@ -104,7 +104,7 @@
</button>
<button class="btn upload-btn" @click="saveRemarks">
<uni-icons color="#fff" size="16" type="compose"></uni-icons>
- 涓嶅悎鏍兼弿杩�
+ 澶囨敞
</button>
</view>
</view>
@@ -118,7 +118,7 @@
</button>
<button class="btn upload-btn" @click="saveRemarks">
<uni-icons color="#fff" size="16" type="compose"></uni-icons>
- 涓嶅悎鏍兼弿杩�
+ 澶囨敞
</button>
</view>
<view class="input-wrapper" style="margin-top: 15px;">
@@ -181,13 +181,13 @@
</view>
</view>
- <!-- 寮瑰嚭灞� - 涓嶅悎鏍兼弿杩� -->
+ <!-- 寮瑰嚭灞� - 澶囨敞 -->
<view v-if="remarksPopup" class="overlay">
<view class="popup">
- <h3>淇敼涓嶅悎鏍兼弿杩�</h3>
+ <h3>淇敼澶囨敞</h3>
<form>
<view class="form-group">
- <label class="form-label">涓嶅悎鏍兼弿杩�:</label>
+ <label class="form-label">澶囨敞:</label>
<input v-model="remarks" class="form-input" type="text"/>
</view>
<view class="popup-buttons">
--
Gitblit v1.9.3