From 3897a86d1a714cca8087d589f55b00446679e48e Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期一, 08 十二月 2025 22:46:53 +0800
Subject: [PATCH] 通用界面补充

---
 pages/Repair/input.vue              | 1566 +++++++++++++++++++++++++++++++++++++++++++++++
 pages/Repair/DefectRegistration.vue |  361 ++++++++++
 2 files changed, 1,927 insertions(+), 0 deletions(-)

diff --git a/pages/Repair/DefectRegistration.vue b/pages/Repair/DefectRegistration.vue
new file mode 100644
index 0000000..00a42d3
--- /dev/null
+++ b/pages/Repair/DefectRegistration.vue
@@ -0,0 +1,361 @@
+<template>
+	<view class="content">
+		<!-- 澶撮儴鏍囬 -->
+		
+
+		<!-- 琛ㄥ崟鍖哄煙 -->
+		<view class="form-container">
+			<!-- 鏌ヨ宸ュ崟 -->
+			<view class="form-item">
+				<text class="label">鏌ヨ宸ュ崟</text>
+				<input class="input" type="text" v-model="formData.queryWorkOrder" placeholder="璇疯緭鍏ユ煡璇㈠伐鍗�" @input="onQueryWorkOrderChange" />
+			</view>
+
+			<!-- 鐢熶骇宸ュ崟 -->
+			<view class="form-item">
+				<text class="label">鐢熶骇宸ュ崟</text>
+				<picker class="picker" :range="productionWorkOrderOptions" range-key="text" :value="productionWorkOrderIndex" @change="onProductionWorkOrderChange">
+					<view class="picker-content">
+						{{ productionWorkOrderOptions[productionWorkOrderIndex] ? productionWorkOrderOptions[productionWorkOrderIndex].text : '璇烽�夋嫨/鎵弿鐢熶骇宸ュ崟' }}
+					</view>
+				</picker>
+				<view class="scan-icon" @click="scanProductionWorkOrder">
+					<uni-icons type="scan" size="24" color="#28a745"></uni-icons>
+				</view>
+			</view>
+
+			<!-- 浜у搧缂栫爜 -->
+			<view class="form-item">
+				<text class="label">浜у搧缂栫爜</text>
+				<view class="value">{{ formData.productCode }}</view>
+			</view>
+
+			<!-- 浜у搧鍚嶇О -->
+			<view class="form-item">
+				<text class="label">浜у搧鍚嶇О</text>
+				<view class="value">{{ formData.productName }}</view>
+			</view>
+
+			<!-- 宸ュ簭 -->
+			<view class="form-item">
+				<text class="label">宸ュ簭</text>
+				<picker class="picker" :range="processOptions" range-key="text" :value="processIndex" @change="onProcessChange">
+					<view class="picker-content">
+						{{ processOptions[processIndex] ? processOptions[processIndex].text : '璇烽�夋嫨/鎵弿宸ュ簭' }}
+					</view>
+				</picker>
+                <view class="scan-icon" @click="scanProcess">
+					<uni-icons type="scan" size="24" color="#28a745"></uni-icons>
+				</view>
+			</view>
+
+			<!-- 涓嶈壇绫诲瀷 -->
+			<view class="form-item">
+				<text class="label">涓嶈壇绫诲瀷</text>
+				<picker class="picker" :range="defectTypeOptions" range-key="text" :value="defectTypeIndex" @change="onDefectTypeChange">
+					<view class="picker-content">
+						{{ defectTypeOptions[defectTypeIndex] ? defectTypeOptions[defectTypeIndex].text : '璇烽�夋嫨/鎵弿涓嶈壇绫诲瀷' }}
+					</view>
+				</picker>
+                <view class="scan-icon" @click="scanDefectType">
+					<uni-icons type="scan" size="24" color="#28a745"></uni-icons>
+				</view>
+			</view>
+
+			<!-- 涓嶈壇椤圭洰 -->
+			<view class="form-item">
+				<text class="label">涓嶈壇椤圭洰</text>
+				<picker class="picker" :range="defectItemOptions" range-key="text" :value="defectItemIndex" @change="onDefectItemChange">
+					<view class="picker-content">
+						{{ defectItemOptions[defectItemIndex] ? defectItemOptions[defectItemIndex].text : '璇烽�夋嫨/鎵弿涓嶈壇椤圭洰' }}
+					</view>
+				</picker>
+                 <view class="scan-icon" @click="scanDefectItem">
+					<uni-icons type="scan" size="24" color="#28a745"></uni-icons>
+				</view>
+			</view>
+
+			<!-- 涓嶈壇鏉$爜 -->
+			<view class="form-item">
+				<text class="label">涓嶈壇鏉$爜</text>
+				<input class="input" type="text" v-model="formData.defectBarcode" placeholder="璇疯緭鍏ヤ笉鑹潯鐮�" />
+			</view>
+
+			<!-- 鏉$爜鏁伴噺 -->
+			<view class="form-item">
+				<text class="label">鏉$爜鏁伴噺</text>
+				<input class="input" type="number" v-model="formData.barcodeQuantity" placeholder="璇疯緭鍏ユ潯鐮佹暟閲�" />
+			</view>
+
+			<!-- 鎻愮ず淇℃伅 -->
+			<view class="form-item">
+				<text class="label">鎻愮ず淇℃伅</text>
+				<view class="value hint">{{ formData.hintInfo }}</view>
+			</view>
+		</view>
+
+		<!-- 鎻愪氦鎸夐挳 -->
+		<view class="footer">
+			<button class="submit-btn" @click="submitForm">鐧昏鎻愪氦</button>
+		</view>
+	</view>
+</template>
+
+<script>
+import uniIcons from "@/components/uni-icons/uni-icons.vue"
+
+export default {
+	components: {uniIcons},
+	data() {
+		return {
+			formData: {
+				queryWorkOrder: '',
+				productionWorkOrder: '',
+				productCode: '',
+				productName: '',
+				process: '',
+				defectType: '',
+				defectItem: '',
+				defectBarcode: '',
+				barcodeQuantity: '',
+				hintInfo: ''
+			},
+			productionWorkOrderOptions: [],
+			productionWorkOrderIndex: -1,
+			processOptions: [],
+			processIndex: -1,
+			defectTypeOptions: [],
+			defectTypeIndex: -1,
+			defectItemOptions: [],
+			defectItemIndex: -1
+		};
+	},
+	onLoad() {
+		this.initData();
+	},
+	methods: {
+		goBack() {
+			uni.navigateBack();
+		},
+		initData() {
+			// 棰勭暀API璋冪敤浣嶇疆
+            this.loadProductionWorkOrders();
+            this.loadProcesses();
+            this.loadDefectTypes();
+            this.loadDefectItems();
+		},
+        loadProductionWorkOrders() {
+            // 妯℃嫙API鑾峰彇鐢熶骇宸ュ崟鍒楄〃
+            // this.$post({url: '/api/getWorkOrders'}).then(...)
+            this.productionWorkOrderOptions = [
+				{text: 'MO-20231201001', value: 'WO001'}, 
+				{text: 'MO-20231201002', value: 'WO002'}
+			];
+        },
+        loadProcesses() {
+            // 妯℃嫙API鑾峰彇宸ュ簭鍒楄〃
+             this.processOptions = [
+				 {text: 'SMT璐寸墖', value: 'P001'}, 
+				 {text: 'DIP鎻掍欢', value: 'P002'},
+				 {text: '缁勮', value: 'P003'}
+			 ];
+        },
+        loadDefectTypes() {
+             // 妯℃嫙API鑾峰彇涓嶈壇绫诲瀷鍒楄〃
+             this.defectTypeOptions = [
+				 {text: '鐗╂枡涓嶈壇', value: 'DT001'}, 
+				 {text: '鍒剁▼涓嶈壇', value: 'DT002'}
+			 ];
+        },
+        loadDefectItems() {
+             // 妯℃嫙API鑾峰彇涓嶈壇椤圭洰鍒楄〃
+             this.defectItemOptions = [
+				 {text: '铏氱剨', value: 'DI001'}, 
+				 {text: '鐭矾', value: 'DI002'},
+				 {text: '缂轰欢', value: 'DI003'}
+			 ];
+        },
+		onQueryWorkOrderChange(e) {
+			// 瀹炴椂鏌ヨ宸ュ崟瀵瑰簲涓嬫媺妗嗗彂鐢熷彉鍖�
+            const query = this.formData.queryWorkOrder;
+            console.log('Querying work orders with:', query);
+            
+			// 杩欓噷搴旇璋冪敤鎺ュ彛鏍规嵁杈撳叆鍐呭绛涢�夌敓浜у伐鍗�
+			// this.$post({url: '/api/searchWorkOrders', data: {keyword: query}}).then(...)
+			
+			// 妯℃嫙绛涢��
+			if(query) {
+				this.productionWorkOrderOptions = this.productionWorkOrderOptions.filter(item => item.text.includes(query));
+			} else {
+				this.loadProductionWorkOrders(); // 鎭㈠榛樿鍒楄〃
+			}
+		},
+		onProductionWorkOrderChange(e) {
+			this.productionWorkOrderIndex = e.target.value;
+			const selected = this.productionWorkOrderOptions[this.productionWorkOrderIndex];
+			if (selected) {
+				this.formData.productionWorkOrder = selected.value;
+				// 妯℃嫙鏍规嵁宸ュ崟甯﹀嚭浜у搧淇℃伅
+				this.formData.productCode = 'PROD-' + selected.value;
+				this.formData.productName = '浜у搧 ' + selected.text;
+			}
+		},
+		onProcessChange(e) {
+			this.processIndex = e.target.value;
+			if (this.processOptions[this.processIndex]) {
+				this.formData.process = this.processOptions[this.processIndex].value;
+			}
+		},
+		onDefectTypeChange(e) {
+			this.defectTypeIndex = e.target.value;
+			if (this.defectTypeOptions[this.defectTypeIndex]) {
+				this.formData.defectType = this.defectTypeOptions[this.defectTypeIndex].value;
+			}
+		},
+		onDefectItemChange(e) {
+			this.defectItemIndex = e.target.value;
+			if (this.defectItemOptions[this.defectItemIndex]) {
+				this.formData.defectItem = this.defectItemOptions[this.defectItemIndex].value;
+			}
+		},
+        scanProductionWorkOrder() {
+            uni.scanCode({
+                success: (res) => {
+                    console.log('Scanned:', res.result);
+                    // 澶勭悊鎵弿缁撴灉锛岃嚜鍔ㄩ�変腑瀵瑰簲宸ュ崟
+					uni.showToast({title: '鎵弿鎴愬姛: ' + res.result, icon: 'none'});
+                }
+            });
+        },
+        scanProcess() {
+             uni.scanCode({
+                 success: (res) => {
+                     console.log('Scanned Process:', res.result);
+					 uni.showToast({title: '鎵弿鎴愬姛: ' + res.result, icon: 'none'});
+                 }
+             });
+        },
+		scanDefectType() {
+		     uni.scanCode({
+		         success: (res) => {
+		             console.log('Scanned DefectType:', res.result);
+					 uni.showToast({title: '鎵弿鎴愬姛: ' + res.result, icon: 'none'});
+		         }
+		     });
+		},
+		scanDefectItem() {
+		     uni.scanCode({
+		         success: (res) => {
+		             console.log('Scanned DefectItem:', res.result);
+					 uni.showToast({title: '鎵弿鎴愬姛: ' + res.result, icon: 'none'});
+		         }
+		     });
+		},
+		submitForm() {
+			console.log('Submitting:', this.formData);
+			if (!this.formData.productionWorkOrder) {
+				uni.showToast({title: '璇烽�夋嫨鐢熶骇宸ュ崟', icon: 'none'});
+				return;
+			}
+            // 鎻愪氦閫昏緫
+			// this.$post({url: '/api/submitDefect', data: this.formData}).then(...)
+			
+            uni.showToast({
+                title: '鐧昏鎻愪氦鎴愬姛',
+                icon: 'success'
+            });
+		}
+	}
+};
+</script>
+
+<style>
+.content {
+    background-color: #f5f5f5;
+    min-height: 100vh;
+	display: flex;
+	flex-direction: column;
+}
+.page-header {
+    background-color: #90CAF9; /* Light Blue */
+    padding: 44px 15px 10px 15px; /* Status bar padding */
+}
+.header-content {
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+}
+.page-title {
+    font-size: 18px;
+    font-weight: bold;
+    color: #333;
+}
+.header-right {
+	color: #fff;
+	font-size: 14px;
+}
+.form-container {
+    background-color: #fff;
+    margin-top: 0;
+	flex: 1;
+}
+.form-item {
+    display: flex;
+    align-items: center;
+    padding: 12px 15px;
+    border-bottom: 1px solid #eee;
+}
+.label {
+    width: 90px;
+    font-size: 15px;
+    color: #333;
+}
+.input {
+    flex: 1;
+    font-size: 15px;
+}
+.value {
+    flex: 1;
+    font-size: 15px;
+    color: #666;
+}
+.picker {
+    flex: 1;
+}
+.picker-content {
+    font-size: 15px;
+    color: #333;
+}
+.scan-icon {
+    width: 30px;
+    height: 30px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+	margin-left: 10px;
+	background-color: #4CD964; /* Green background for icon */
+	border-radius: 4px;
+}
+.scan-icon uni-icons {
+	/* Make icon white if background is green, but uni-icons color prop handles it */
+}
+/* Override uni-icons color to white since background is green */
+.scan-icon ::v-deep span {
+	color: #fff !important; 
+}
+
+.footer {
+    padding: 20px;
+}
+.submit-btn {
+    background-color: #7B68EE; /* Purple */
+    color: #fff;
+    border-radius: 5px;
+    font-size: 16px;
+	height: 44px;
+	line-height: 44px;
+}
+.hint {
+    color: #999;
+}
+</style>
\ No newline at end of file
diff --git a/pages/Repair/input.vue b/pages/Repair/input.vue
new file mode 100644
index 0000000..2e246d8
--- /dev/null
+++ b/pages/Repair/input.vue
@@ -0,0 +1,1566 @@
+<template>
+  <view class="container">
+    <view class="content">
+      <!-- 鍔ㄦ�佽〃鍗曞尯鍩� -->
+      <view id="divid" class="form-container">
+        <!-- 鍔ㄦ�佺敓鎴愮殑琛ㄥ崟鍐呭 -->
+        <view class="uni-form" v-if="formData.length > 0">
+          <block v-for="(item, index) in formData" :key="index">
+            <!-- 鏂囨湰杈撳叆妗� -->
+          <view class="form-item" v-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '3'">
+            <text class="form-label">{{ item[1] }}</text>
+            <view class="scan-input-container">
+              <input 
+                :id="item[0]" 
+                :disabled="item[3] === '1'"
+                :readonly="item[3] === '1'" 
+                type="text" 
+                class="form-input" 
+                :class="{'readonly': item[3] === '1'}"
+                v-model="formValues[item[0]]" 
+                :placeholder="'璇疯緭鍏�'+item[1]"
+                @keyup="(e) => handleKeyUp(e, item[7], item[8], item[0], item[9], item[10])"
+                @confirm="() => enterSearch({keyCode: 13}, item[7], item[8], item[0], item[9], item[10])"
+               :focus="autoFocusId === item[0]"
+			  />
+              <!-- 娣诲姞鎵爜鍥炬爣锛屾牴鎹甶tem[13]鍐冲畾鏄惁鏄剧ず -->
+              <view 
+               v-if="item[3] === '0'" 
+                class="scan-icon-btn" 
+                @tap="() => scanQRCode(item[0])"
+              >
+                <uni-icons type="scan" size="20" color="#5677fc"></uni-icons>
+              </view>
+            </view>
+          </view>
+            <!-- 涓嬫媺閫夋嫨妗� -->
+            <view class="form-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '2'">
+              <text class="form-label">{{ item[1] }}</text>
+              <view class="select-wrapper">
+                <input 
+                  type="text" 
+                  :id="'selectList-'+item[0]+'-'+item[1]" 
+                  class="form-input select-input" 
+                  readonly 
+                  placeholder="璇风偣鍑婚�夋嫨" 
+                  @tap="() => openList(item[0], item[1])"
+                />
+                <view class="select-icon">
+                  <uni-icons type="right" size="16" color="#999"></uni-icons>
+                </view>
+              </view>
+            </view>
+            
+      
+            <!-- 鎵弿閫夋嫨妗� -->
+            <view class="form-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '4'">
+              <text class="form-label">{{ item[1] }}</text>
+              <!-- 绉婚櫎杩欎釜闅愯棌鐨刬nput锛屼笉鍐嶉渶瑕� -->
+              <!-- <input :id="item[0]" v-model="formValues[item[0]]" type="hidden"> -->
+              <view class="scan-select-container">
+                <input 
+                  type="text" 
+                  class="form-input scan-input" 
+                  :id="item[0]" 
+                  v-model="formValues[item[0]]" 
+                  @keyup="(e) => handleScanKeyUp(e, item[8], item[0], item[10], item[7])"
+                  @confirm="() => enterScanSelect({keyCode: 13}, item[8], item[0], item[10], item[7])"
+                  :placeholder="'璇烽�夋嫨/鎵弿'+item[1]"
+                />
+                <picker 
+                  :id="'select-'+item[0]" 
+                  :range="selectOptions[item[0]] || []" 
+                  @change="(e) => getCheckItem(item[8], item[0], item[10], item[7], e)"
+                >
+                  <view class="select-btn">
+                    <uni-icons type="down" size="18" color="#fff"></uni-icons>
+                  </view>
+                </picker>
+              </view>
+            </view>
+			
+            <!-- 鐓х墖鎸夐挳 -->
+            <view class="form-item button-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '9'">
+              <view class="action-button photo-btn" @tap="() => photoButton(item)">
+                <uni-icons type="camera" size="18" color="#fff" style="margin-right: 5px;"></uni-icons>
+                <text>{{ item[1] }}</text>
+              </view>
+            </view>
+            
+            <!-- 鍒楄〃鎸夐挳 -->
+            <view class="form-item button-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '11'">
+              <view class="action-button list-btn" @tap="() => listButton(item)">
+                <uni-icons type="list" size="18" color="#fff" style="margin-right: 5px;"></uni-icons>
+                <text>{{ item[1] }}</text>
+              </view>
+            </view>
+            
+            <!-- 鎵撳嵃鎸夐挳 -->
+            <view class="form-item button-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '13'">
+              <view class="action-button print-btn" @tap="() => clickPrintBtn(item)">
+                <uni-icons type="paperplane" size="18" color="#fff" style="margin-right: 5px;"></uni-icons>
+                <text>{{ item[1] }}</text>
+              </view>
+            </view>
+            
+            <!-- 寮�鍏� -->
+            <view class="form-item switch-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR')">
+              <text class="form-label">{{ item[1] }}</text>
+              <input :id="item[0]" v-model="formValues[item[0]]" type="hidden">
+              <switch 
+                :id="item[0]+'-switch'" 
+                :data-href="item[0]" 
+                @change="(e) => switchChange(e, item[0])"
+                color="#5677fc"
+                class="custom-switch"
+              />
+            </view>
+            
+            <!-- 鏂囨湰鍩� -->
+            <view class="form-item" v-else-if="item[2] === 'MEMO'">
+              <text class="form-label">{{ item[1] }}</text>
+              <textarea 
+                :id="item[0]" 
+                v-model="formValues[item[0]]" 
+                class="form-textarea"
+                :disabled="item[3] === '1'"
+                :readonly="item[3] === '1'" 
+                :class="{'readonly': item[3] === '1'}"
+                :style="{'height': item[14]+'px'}"
+              ></textarea>
+            </view>
+            
+            <!-- 鎸夐挳 -->
+            <view class="form-item button-item" v-else-if="item[2] === 'BUTTON'">
+              <view class="action-button normal-btn" @tap="() => clickButton(item)">
+                <text>{{ item[1] }}</text>
+              </view>
+            </view>
+            
+            <!-- 澶氶�夌紪杈� -->
+            <view class="form-item button-item" v-else-if="item[2] === 'EDIT' && item[4] === '11'">
+              <view class="action-button list-btn" @tap="() => listButton(item)">
+                <uni-icons type="list" size="18" color="#fff" style="margin-right: 5px;"></uni-icons>
+                <text>{{ item[1] }}</text>
+              </view>
+            </view>
+            
+            <!-- 澶氶�夋壂鎻� -->
+            <view class="form-item" v-else-if="item[2] === 'EDIT' && item[4] === '4'">
+              <text class="form-label">{{ item[1] }}</text>
+              <input :id="item[0]" v-model="formValues[item[0]]" type="hidden">
+              <view class="scan-select-container">
+                <input 
+                  type="text" 
+                  class="form-input scan-input" 
+                  :id="'scanSelect-mul'+item[0]" 
+                  v-model="scanValues['mul'+item[0]]"
+                  @keyup="(e) => enterScanSelect(e, item[8], item[0], item[10], item[7])" 
+                  :placeholder="'璇烽�夋嫨/鎵弿'+item[1]"
+                />
+                <picker 
+                  mode="multiSelector"
+                  :id="'select-mul'+item[0]" 
+                  :range="selectOptions['mul'+item[0]] || []" 
+                  @change="(e) => getCheckMultiItem(item[8], item[0], item[10], item[7], e)"
+                >
+                  <view class="select-btn">
+                    <uni-icons type="down" size="18" color="#fff"></uni-icons>
+                  </view>
+                </picker>
+              </view>
+            </view>
+          </block>
+        </view>
+      </view>
+      
+    
+      <!-- 琛ㄦ牸鍖哄煙 -->
+      <view id="tableDiv" class="table-container" v-if="showTable">
+        <view class="table-header">
+          <text class="table-title">鏌ヨ缁撴灉</text>
+        </view>
+        <scroll-view scroll-y class="table-scroll">
+          <view class="table">
+            <!-- 琛ㄥご -->
+            <view class="thead">
+              <view class="tr">
+                <view 
+                  class="th" 
+                  v-for="(col, colIndex) in tableColumns" 
+                  :key="colIndex"
+                  :style="getColumnStyle(col)"
+                >
+                  {{ getColumnName(col) }}
+                </view>
+              </view>
+              
+              <!-- 鎼滅储琛� -->
+              <view class="tr search-row">
+                <view 
+                  class="td search-cell" 
+                  v-for="(col, colIndex) in tableColumns" 
+                  :key="colIndex"
+                  :style="getColumnStyle(col)"
+                >
+                  <input 
+                    type="text" 
+                    class="search-input" 
+                    v-model="searchValues[colIndex]" 
+                    :placeholder="'鎼滅储...'" 
+                    @input="filterTableData"
+                  />
+                </view>
+              </view>
+            </view>
+            
+            <!-- 琛ㄦ牸鍐呭 -->
+            <view class="tbody">
+              <view 
+                class="tr" 
+                v-for="(row, rowIndex) in filteredTableData" 
+                :key="rowIndex"
+                :class="{'tr-alter': rowIndex % 2 === 1}"
+                @tap="() => handleRowTap(row)"
+              >
+                <view 
+                  class="td" 
+                  v-for="(col, colIndex) in tableColumns" 
+                  :key="colIndex"
+                  :style="getColumnStyle(col)"
+                  @longpress="() => showFullContent(row[colIndex])"
+                >
+                  <rich-text :nodes="formatCellContent(row[colIndex])"></rich-text>
+                </view>
+              </view>
+            </view>
+          </view>
+        </scroll-view>
+      </view>
+	  
+	  
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      title: 'MES绉诲姩缁堢',
+      username: '',
+      formData: [],
+      formValues: {},
+      scanValues: {},
+      selectOptions: {},
+      tableColumns: [],
+      tableData: [],
+      searchValues: {}, // 瀛樺偍姣忓垪鐨勬悳绱㈠��
+      filteredTableData: [], // 杩囨护鍚庣殑琛ㄦ牸鏁版嵁
+      showTable: false,
+      isCommitted: false, // 璇锋眰鏄惁宸叉彁浜ゆ爣璇�
+      bluetoothSocket: null,
+      device: null,
+	  autoFocusId: '' // 鐢ㄤ簬鑷姩鑱氱劍鐨処D
+    };
+  },
+  onReady(){
+	  this.username = this.setUsrCode();
+	  this.title = uni.getStorageSync("functionName") || 'MES绉诲姩缁堢';
+	  uni.setNavigationBarTitle({
+	    title: this.title
+	  });  
+  },
+  onLoad() {
+     this.getData();
+     // 鍒濆鍖栬摑鐗欐墦鍗版満
+     if (this.$store.state.serverInfo.Bluetooth === 'true') {
+       this.initBluetooth();
+     }
+   },
+  methods: {
+    // 杩斿洖涓婁竴椤�
+    goBack() {
+      uni.navigateBack();
+    },  
+    // 鑾峰彇鐢ㄦ埛浠g爜
+    setUsrCode() {
+      return uni.getStorageSync("code") || '';
+    },
+    
+    // 鑾峰彇琛ㄥ崟鏁版嵁
+    getData() {
+      uni.showLoading({
+        title: '鍔犺浇涓�...'
+      });
+      
+      uni.request({
+        url: this.$store.state.serverInfo.serverAPI + '/modules/getRfSetup',
+        data: {
+          functionName: uni.getStorageSync("functionName")
+        },
+        method: 'POST',
+        timeout: 60000,
+        header: {
+          'Content-Type': 'application/json'
+        },
+        success: (res) => {
+          if (res.data.status === 0 && res.data.data && res.data.data.setupData) {
+            let fData = res.data.data.setupData;
+            console.log("鍘熷鏁版嵁:", fData);
+            
+            // 澶勭悊鍥炶溅绗﹀彿
+            if (typeof fData === 'string') {
+              while (fData.indexOf('\\r\\n') !== -1) {
+                fData = fData.replace("\\r\\n", " ");
+              }
+              
+              // 瑙f瀽瀛楃涓蹭负琛ㄥ崟鏁版嵁鏁扮粍
+              try {
+                // 鎸夋柟鎷彿鍒嗗壊瀛楁
+                const fieldsStr = fData.split('[');
+                const formFields = [];
+                
+                // 浠庣储寮�1寮�濮嬶紝鍥犱负绗竴涓厓绱犳槸绌虹殑鎴栧墠缂�
+                for (let i = 1; i < fieldsStr.length; i++) {
+                  // 鍘绘帀缁撳熬鐨勬柟鎷彿骞舵寜#鍒嗗壊灞炴��
+                  const fieldStr = fieldsStr[i].replace(']', '');
+                  const fieldProps = fieldStr.split('#');
+                  formFields.push(fieldProps);
+                }
+                
+                this.formData = formFields;
+                console.log("瑙f瀽鍚庣殑琛ㄥ崟鏁版嵁:", this.formData);
+                
+                // 鍒濆鍖栬〃鍗曞��
+                this.formData.forEach(item => {
+                  if (item[12]) {
+                    this.$set(this.formValues, item[0], item[12]);
+                  } else {
+                    this.$set(this.formValues, item[0], '');
+                  }
+                  
+                  // 鍒濆鍖栨壂鎻忓��
+                  if (item[4] === '4') {
+                    this.$set(this.scanValues, item[0], '');
+                  }
+                });
+                
+                // 鑱氱劍绗竴涓緭鍏ユ
+               this.$nextTick(() => {
+                 // 鎵惧埌绗竴涓緭鍏ユ骞惰仛鐒�
+                 const firstInput = this.formData.find(item => item[4] === '3' || item[4] === '4');
+                 if (firstInput) {
+                   setTimeout(() => {
+                     this.focusInput(firstInput[0]);
+                   }, 300);
+                 }
+               });
+                
+                // 鍒濆鍖栦笅鎷夋鏁版嵁
+                this.getSelectData();
+                // 鎵цSQL璇彞鐨勯粯璁ゅ��
+                this.getExcuteSql();
+              } catch (error) {
+                console.error("瑙f瀽琛ㄥ崟鏁版嵁鍑洪敊:", error);
+                uni.showToast({
+                  title: '瑙f瀽琛ㄥ崟鏁版嵁鍑洪敊',
+				  content: "瑙f瀽琛ㄥ崟鏁版嵁鍑洪敊: " + err.errMsg,
+                  icon: 'none'
+                });
+              }
+            } else {
+              console.error("setupData涓嶆槸瀛楃涓茬被鍨�");
+              uni.showToast({
+                title: '鏁版嵁鏍煎紡閿欒',
+                icon: 'none'
+              });
+            }
+          } else {
+            uni.showToast({
+              title: res.data.message || '鑾峰彇鏁版嵁澶辫触',
+			  content: res.data.message || '鑾峰彇鏁版嵁澶辫触',
+              icon: 'none'
+            });
+          }
+        },
+        fail: (err) => {
+          console.error("璇锋眰澶辫触:", err);
+          uni.showToast({
+            title: "鏈嶅姟鍣ㄦ柇寮�",
+            icon: 'none'
+          });
+        },
+        complete: () => {
+          uni.hideLoading();
+        }
+      });
+    },
+	 // 鎵弿浜岀淮鐮�
+	  scanQRCode(fieldId) {
+	    // #ifdef APP-PLUS
+	    // 璋冪敤鍘熺敓鎵爜鍔熻兘
+	    uni.scanCode({
+	      scanType: ['qrCode', 'barCode'], // 鍚屾椂鏀寔浜岀淮鐮佸拰鏉″舰鐮�
+	      success: (res) => {
+	        console.log('鎵爜鎴愬姛:', res);
+	        // 灏嗘壂鐮佺粨鏋滆缃埌瀵瑰簲鐨勮緭鍏ユ
+	        this.formValues[fieldId] = res.result;
+	        
+	        // 鏌ユ壘褰撳墠瀛楁鐨勯厤缃�
+	        const fieldConfig = this.formData.find(item => item[0] === fieldId);
+	        if (fieldConfig) {
+	          // 濡傛灉鏈夐厤缃殑鍥炶溅浜嬩欢锛屽垯瑙﹀彂
+	          if (fieldConfig[7] !== 'N') {
+	            this.doProByFile8(fieldConfig[8], fieldId);
+	          }
+	          
+	          // 濡傛灉鏈夐厤缃殑璺宠浆瀛楁锛屽垯鑱氱劍鍒颁笅涓�涓瓧娈�
+	          if (fieldConfig[10] !== '') {
+	            this.formValues[fieldConfig[10]] = '';
+	            this.focusInput(fieldConfig[10]);
+	          }
+	        }
+	      },
+	      fail: (err) => {
+	        console.error('鎵爜澶辫触:', err);
+	        uni.showToast({
+	          title: '鎵爜澶辫触',
+	          icon: 'none'
+	        });
+	      }
+	    });
+	    // #endif
+	    
+	    // #ifdef H5
+	    uni.showToast({
+	      title: 'H5鐜涓嶆敮鎸佹壂鐮佸姛鑳�',
+	      icon: 'none'
+	    });
+	    // #endif
+	  },
+    formatCellContent(content) {
+      if (content === undefined || content === null) {
+        return '';
+      }
+      
+      // 灏嗗瓧绗︿覆杞崲涓哄瓧绗︿覆
+      const strContent = String(content);
+      
+      // 妫�鏌ユ槸鍚﹀寘鍚�<br>鏍囩
+      if (strContent.includes('<br>')) {
+        return strContent;
+      } else {
+        return strContent;
+      }
+    },
+    
+    // 鏄剧ず瀹屾暣鍐呭
+    showFullContent(content) {
+      if (!content) return;
+      
+      uni.showModal({
+        title: '瀹屾暣鍐呭',
+        content: String(content).replace(/<br>/g, '\n'),
+        showCancel: false,
+        confirmText: '鍏抽棴'
+      });
+    },
+    // 鑱氱劍杈撳叆妗�
+//     focusInput(id) {
+//   setTimeout(() => {
+//     // 浣跨敤uni-app鐨勫師鐢烝PI
+//     uni.createSelectorQuery()
+//       .select('#' + id)
+//       .boundingClientRect(data => {
+//         if (data) {
+//           // 鍏冪礌瀛樺湪锛屽皾璇曡仛鐒�
+//           uni.createSelectorQuery()
+//             .select('#' + id)
+//             .fields({
+//               context: true
+//             }, res => {
+//               if (res && res.context) {
+//                 res.context.focus();
+//               } else {
+//                 console.log('鏃犳硶鑾峰彇鍏冪礌涓婁笅鏂�:', id);
+//               }
+//             })
+//             .exec();
+//         } else {
+//           console.log('鏈壘鍒板厓绱�:', id);
+//         }
+//       })
+//       .exec();
+//   }, 500); // 澧炲姞寤惰繜鏃堕棿
+// },
+    // 鑱氱劍杈撳叆妗� - 绠�鍖栫増
+    focusInput(id) {
+      console.log('灏濊瘯鑱氱劍鍏冪礌:', id);
+      
+      // 璁剧疆涓�涓复鏃跺彉閲忥紝鐢ㄤ簬鑷姩鑱氱劍
+      this.autoFocusId = id;
+      
+      // 浣跨敤nextTick纭繚DOM宸叉洿鏂�
+      this.$nextTick(() => {
+        setTimeout(() => {
+          // 閲嶇疆鑷姩鑱氱劍ID锛岃Е鍙戣鍥炬洿鏂�
+          this.autoFocusId = '';
+          
+          // 鍐嶆璁剧疆锛岃Е鍙戣嚜鍔ㄨ仛鐒�
+          setTimeout(() => {
+            this.autoFocusId = id;
+          }, 100);
+        }, 200);
+      });
+    },
+    // 澶勭悊閿洏鎸夐敭浜嬩欢
+    handleKeyUp(e, file7, str, fileId, file9, file10) {
+      // 鍙湁鍦ㄦ寜涓嬪洖杞﹂敭(13)鎴朤ab閿�(9)鏃舵墠瑙﹀彂
+      if (e.keyCode === 13 || e.keyCode === 9) {
+        // 娣诲姞寤惰繜锛岀‘淇濊緭鍏ュ畬鎴�
+        setTimeout(() => {
+          this.enterSearch(e, file7, str, fileId, file9, file10);
+        }, 100);
+      }
+    },
+    
+    // 澶勭悊鎵弿杈撳叆閿洏浜嬩欢
+    handleScanKeyUp(e, file8, fileId, file10, file7) {
+      // 鍙湁鍦ㄦ寜涓嬪洖杞﹂敭(13)鎴朤ab閿�(9)鏃舵墠瑙﹀彂
+      if (e.keyCode === 13 || e.keyCode === 9) {
+        // 娣诲姞寤惰繜锛岀‘淇濊緭鍏ュ畬鎴�
+        setTimeout(() => {
+          this.enterScanSelect(e, file8, fileId, file10, file7);
+        }, 100);
+      }
+    },
+    // 鍥炶溅鎼滅储
+    enterSearch(e, file7, str, fileId, file9, file10) {
+      // 妫�鏌ユ槸鍚︽湁 keyCode锛屽鏋滄病鏈夊垯榛樿涓哄洖杞﹂敭
+      const keyCode = e.keyCode || e.which || 13;
+      
+      if (keyCode == 13 || keyCode == 9) {
+        console.log('瑙﹀彂鍥炶溅鎼滅储:', fileId, file7, str);
+        
+        // 鍒ゆ柇鏄惁闇�瑕佽皟鐢ㄥ瓨鍌ㄨ繃绋�
+        if (file7 != 'N') {
+          this.doProByFile8(str, fileId);
+        }
+        
+        // 鍒ゆ柇璺宠浆瀛楁
+        if (file9 == '1') {
+          // 鍥炶溅鑷姩璺宠嚦涓嬩竴闈炲彧璇诲瓧娈�
+          this.focusNextInput(fileId);
+        }
+        if (file9 == '0' && file10 == '') {
+          // 鍥炶溅鍚庡氨鍋滅暀鍦ㄦ湰瀛楁锛屾湰瀛楁鍐呭鍏堟竻绌�
+          this.formValues[fileId] = '';
+          this.focusInput(fileId);
+        }
+        if (file10 != '') {
+          // 璺宠嚦鎸囧畾瀛楁锛屽綋瑕佹眰璺冲埌鎸囧畾瀛楁鏃讹紝杩欎釜鎸囧畾瀛楁鍙婂悗闈㈤『搴忕殑瀛楁妗嗗唴瀹瑰潎闇�瑕佹竻绌�
+          this.formValues[file10] = '';
+          this.focusInput(file10);
+        }
+      }
+    },
+	focusNextInput(currentId) {
+	  // 鎵惧埌褰撳墠瀛楁鍦� formData 涓殑绱㈠紩
+	  const currentIndex = this.formData.findIndex(item => item[0] === currentId);
+	  if (currentIndex === -1) return;
+	  
+	  // 浠庡綋鍓嶅瓧娈典箣鍚庢煡鎵剧涓�涓潪鍙鐨勮緭鍏ュ瓧娈�
+	  for (let i = currentIndex + 1; i < this.formData.length; i++) {
+	    const item = this.formData[i];
+	    // 妫�鏌ユ槸鍚︽槸鍙緭鍏ュ瓧娈典笖闈炲彧璇�
+	    if ((item[4] === '3' || item[4] === '4') && item[3] !== '1') {
+	      this.focusInput(item[0]);
+	      return;
+	    }
+	  }
+	},
+    
+    // 鎵弿閫夋嫨妗嗗洖杞︿簨浠�
+    enterScanSelect(e, file8, fileId, file10, file7) {
+      const keyCode = e.keyCode || e.which || 13;
+      
+      if (keyCode == 13 || keyCode == 9) {
+        console.log('瑙﹀彂鎵弿閫夋嫨鍥炶溅:', fileId, file7, file8);
+        const value = this.formValues[fileId]; // 鐩存帴浣跨敤formValues
+        
+        if (value == '') {
+          uni.showToast({
+            title: '璇锋壂鎻�',
+            icon: 'none'
+          });
+          return false;
+        }
+        
+        // 涓嶅啀闇�瑕佽繖涓�琛岋紝鍥犱负宸茬粡鐩存帴缁戝畾鍒癴ormValues
+        // this.formValues[fileId] = value;
+        
+        if (file7 != 'N') {
+          this.doProByFile8(file8, fileId);
+        }
+        
+        if (file10 != '') {
+          this.focusInput(file10);
+        }
+      }
+    },
+    
+    // 涓嬫媺妗嗛�夋嫨浜嬩欢
+    getCheckItem(file8, fileId, file10, file7, e) {
+      const index = e.detail.value;
+      const value = this.selectOptions[fileId][index];
+      
+      if (!value) {
+        uni.showToast({
+          title: '璇烽�夋嫨',
+          icon: 'none'
+        });
+        this.formValues[fileId] = '';
+        return false;
+      }
+      
+      // 涓嶅啀闇�瑕乻canValues
+      // this.scanValues[fileId] = value;
+      this.formValues[fileId] = value;
+      
+      if (file7 != 'N') {
+        this.doProByFile8(file8, fileId);
+      }
+      
+      if (file10 != '') {
+        this.formValues[file10] = '';
+        this.focusInput(file10);
+      }
+    },
+    
+    // 澶氶�夋閫夋嫨浜嬩欢
+    getCheckMultiItem(file8, fileId, file10, file7, e) {
+      const indexes = e.detail.value;
+      const values = indexes.map(index => this.selectOptions['mul' + fileId][index]);
+      
+      if (values.length === 0) {
+        uni.showToast({
+          title: '璇烽�夋嫨',
+          icon: 'none'
+        });
+        this.scanValues['mul' + fileId] = '';
+        this.formValues[fileId] = '';
+        return false;
+      }
+      
+      const str = values.join('@');
+      
+      this.scanValues['mul' + fileId] = str;
+      this.formValues[fileId] = str;
+      
+      if (file7 != 'N') {
+        this.doProByFile8(file8, fileId);
+      }
+      
+      if (file10 != '') {
+        this.formValues[file10] = '';
+        this.focusInput(file10);
+      }
+    },
+	
+	// 杩囨护琛ㄦ牸鏁版嵁
+	filterTableData() {
+	  // 濡傛灉娌℃湁鎼滅储鏉′欢锛屾樉绀哄叏閮ㄦ暟鎹�
+	  if (Object.keys(this.searchValues).length === 0 || 
+	      Object.values(this.searchValues).every(v => !v)) {
+	    this.filteredTableData = this.tableData;
+	    return;
+	  }
+	  
+	  // 鏍规嵁鎼滅储鏉′欢杩囨护鏁版嵁
+	  this.filteredTableData = this.tableData.filter(row => {
+	    // 妫�鏌ユ瘡涓�鍒楁槸鍚︾鍚堟悳绱㈡潯浠�
+	    return Object.keys(this.searchValues).every(colIndex => {
+	      const searchValue = this.searchValues[colIndex];
+	      // 濡傛灉璇ュ垪娌℃湁鎼滅储鍊硷紝鍒欒涓虹鍚堟潯浠�
+	      if (!searchValue) return true;
+	      
+	      const cellValue = String(row[colIndex] || '').toLowerCase();
+	      return cellValue.includes(searchValue.toLowerCase());
+	    });
+	  });
+	},
+	
+	// 澶勭悊琛ㄦ牸鏁版嵁鍙樺寲鏃舵洿鏂拌繃婊ょ粨鏋�
+	updateFilteredData() {
+	  this.searchValues = {}; // 閲嶇疆鎼滅储鏉′欢
+	  this.filteredTableData = this.tableData; // 閲嶇疆杩囨护缁撴灉
+	},
+    
+    // 寮�鍏冲垏鎹簨浠�
+    switchChange(e, fileId) {
+      this.formValues[fileId] = e.detail.value ? "1" : "0";
+    },
+    
+    // 鑾峰彇涓嬫媺妗嗘暟鎹�
+    getSelectData() {
+      this.formData.forEach(item => {
+        if ((item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '4') {
+          this.getExcProc(item[0], uni.getStorageSync("code") + '[_N', '', 'select');
+        } else if (item[2] === 'EDIT' && item[4] === '4') {
+          this.getExcProc(item[0], uni.getStorageSync("code") + '[_N', '', 'select');
+        }
+      });
+    },
+    
+    // 鎵цSQL璇彞鐨勯粯璁ゅ��
+    getExcuteSql() {
+      this.formData.forEach(item => {
+        if (item[3] === '1' && (item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '3') {
+          let upperValue = item[12] ? item[12].toUpperCase() : '';
+          
+          // 杩囨护鏁版嵁搴撳叧閿瘝
+          const reg = new RegExp(/INSERT|DELETE|UPDATE|DROP|TRUNCATE/);
+          if (reg.test(upperValue)) {
+            return;
+          }
+          
+          upperValue = upperValue.replace('{USERCODE}', uni.getStorageSync("code"));
+          if (upperValue.substring(0, 6) === "SELECT") {
+            this.getExcuteSqlData(upperValue, item[0]);
+          }
+        }
+      });
+    },
+    
+    // 鎵цSQL鏌ヨ璇彞
+    getExcuteSqlData(str, inputId) {
+      uni.request({
+        url: this.$store.state.serverInfo.serverAPI + '/getExcuteSql',
+        data: {
+          str: str
+        },
+        method: 'POST',
+        timeout: 30000,
+        success: (res) => {
+          if (res.data.result) {
+            this.formValues[inputId] = res.data.data[0];
+          } else {
+            uni.showToast({
+              title: res.data.message,
+              icon: 'none'
+            });
+          }
+        },
+        fail: (err) => {
+          uni.showToast({
+            title: '澶辫触!澶辫触绫诲瀷鏄�:' + err.errMsg,
+            icon: 'none'
+          });
+        }
+      });
+    },
+    
+    // 鎵撳紑鍒楄〃椤甸潰
+    openList(fileId, fileName) {
+      uni.navigateTo({
+        url: '/pages/BasePage/select_search_list?file_name=' + fileId + '&title_name=' + fileName
+      });
+    },
+    
+    // 鎵ц瀛樺偍杩囩▼
+    doProByFile8(file8, fileId) {
+      if (this.isCommitted === false) {
+        this.isCommitted = true;
+        this.doProByFile8Prc(file8, fileId);
+      } else {
+        return false;
+      }
+    },
+    
+    // 鎵ц瀛樺偍杩囩▼澶勭悊
+    doProByFile8Prc(file8, fileId) {
+      try {
+        const date = file8.substring(1, file8.length - 1);
+        const a = date.split("}{");
+        const iput = a[0].split(',');
+        
+        let fileValue = uni.getStorageSync("code") + '[';
+        for (let i = 0; i < iput.length; i++) {
+          let fv = this.formValues[iput[i]] || '';
+          fv = fv.trim();
+          fileValue += fv + '[';
+        }
+        fileValue = fileValue.substring(0, fileValue.length - 1);
+        console.log(12);
+        if (a[1]) {
+          const input = a[1].split(',');
+          if (input[input.length - 1] === 'FVIEW') {
+            this.getExcProc(fileId, fileValue, a[1], 'cursor+proc');
+          } else {
+            this.getExcProc(fileId, fileValue, a[1], 'proc');
+          }
+        } else {
+          this.getExcProc(fileId, fileValue, a[1], 'proc');
+        }
+      } catch (e) {
+        uni.showModal({
+          title: '閿欒',
+          content: "鍔熻兘鍙戠敓寮傚父锛岃鑱旂郴IT浜哄憳",
+          showCancel: false
+        });
+        this.isCommitted = false;
+        return false;
+      }
+    },
+    
+    // 鎵ц瀛樺偍杩囩▼API
+    // 鎵ц瀛樺偍杩囩▼API
+    getExcProc(fileName, fileValue, outFiles, stype) {
+      const fileId = fileName;
+      fileName = fileName.replace(/\s+/g, "");
+      
+      uni.request({
+        url: this.$store.state.serverInfo.serverAPI + '/modules/getExcProc',
+        data: {
+          functionName: uni.getStorageSync("functionName"),
+          fileName: fileName,
+          pmachtype: '',
+          fileValue: fileValue,
+          outFiles: outFiles
+        },
+        method: 'POST',
+        timeout: 60000,
+        header: {
+          'Content-Type': 'application/json'
+        },
+        success: (res) => {
+          console.log(JSON.stringify(res.data));
+          if (res.data.data) {
+            if (stype.indexOf('proc') !== -1) {
+              const msg_1 = res.data.message;
+              if (msg_1 && msg_1.indexOf('999!*') !== -1) {
+                uni.showModal({
+                  title: '璀﹀憡鎻愰啋',
+                  content: res.data.message,
+                  showCancel: false
+                });
+              } else {
+                console.log(1);
+                this.afterProc(res.data);
+              }
+            } else if (stype.indexOf('select') !== -1) {
+              console.log(2);
+              const t = res.data.data.split(',');
+              const options = t.filter(item => item.length > 0);
+              
+              if (fileName.startsWith('mul')) {
+                this.$set(this.selectOptions, fileName, options);
+              } else {
+                this.$set(this.selectOptions, fileName, options);
+              }
+            }
+            
+            if (stype.indexOf('cursor') !== -1) {
+              const valueData = res.data.data.toString();
+              const t1 = valueData.substring(valueData.indexOf(',') + 1, valueData.length);
+              const tData = t1.split(',');
+              const table = tData[tData.length - 1].split('{');
+              
+              // 澶勭悊琛ㄥご
+              const headerRow = table[0].split('@');
+              this.tableColumns = headerRow;
+              
+              // 澶勭悊鏁版嵁琛�
+              const rows = [];
+              for (let i = 1; i < table.length; i++) {
+                if (table[i].length > 0) {
+                  rows.push(table[i].split('@'));
+                }
+              }
+              this.tableData = rows;
+              this.filteredTableData = rows; // 鍒濆鍖栬繃婊ゅ悗鐨勬暟鎹�
+              this.searchValues = {}; // 閲嶇疆鎼滅储鏉′欢
+              this.showTable = true;
+            }
+            
+            if (stype.indexOf('print') !== -1) {
+              const da = res.data.data[0];
+              if (da && da.length > 0) {
+                da.splice(0, 1);
+                this.printByIds(da.toString());
+              }
+            }
+          } else {
+            this.playerNo();
+            uni.showModal({
+              title: '鎻愮ず',
+              content: res.data.message,
+              showCancel: false,
+              success: () => {
+                this.formValues[fileId] = "";
+                this.focusInput(fileId);
+              }
+            });
+          }
+          this.isCommitted = false;
+        },
+        fail: (err) => {
+          this.isCommitted = false;
+          uni.showToast({
+            title: "璇锋眰澶辫触: " + err.errMsg,
+            content: "璇锋眰澶辫触: " + err.errMsg,
+            icon: 'none'
+          });
+        }
+      });
+    },
+    
+    // 澶勭悊瀛樺偍杩囩▼杩斿洖缁撴灉
+    afterProc(data) {
+      this.playerYes();
+      console.log('澶勭悊杩斿洖鏁版嵁:', JSON.stringify(data));
+      
+      // 妫�鏌ユ暟鎹牸寮�
+      if (!data.data || !Array.isArray(data.data)) {
+        console.error('杩斿洖鏁版嵁鏍煎紡涓嶆纭�:', data);
+        return;
+      }
+      
+      // 閬嶅巻鏁版嵁鏁扮粍
+      for (let i = 0; i < data.data.length; i++) {
+        const t = data.data[i];
+        
+        // 妫�鏌ユ暟缁勫厓绱犳槸鍚︽湁鏁�
+        if (!Array.isArray(t) || t.length < 2) {
+          console.warn('鏁版嵁椤规牸寮忎笉姝g‘:', t);
+          continue;
+        }
+        
+        const fieldId = t[0];
+        const fieldValue = t[1];
+        
+        // 妫�鏌ュ瓧娈礗D鏄惁瀛樺湪浜庤〃鍗曞�间腑
+        if (this.formValues.hasOwnProperty(fieldId)) {
+          if (typeof fieldValue === 'string' && fieldValue.indexOf("{") === -1) {
+            this.formValues[fieldId] = fieldValue;
+          } else if (typeof fieldValue === 'string') {
+            const a = fieldValue.split('{');
+            this.setSelect(a, fieldId);
+          } else {
+            console.warn('瀛楁鍊肩被鍨嬩笉姝g‘:', fieldValue);
+          }
+        } else {
+          console.warn('琛ㄥ崟涓笉瀛樺湪瀛楁:', fieldId);
+        }
+      }
+    },
+    
+    // 璁剧疆涓嬫媺妗嗛�夐」
+    setSelect(t, fileName) {
+      const options = t.filter(item => item.length > 0);
+      this.$set(this.selectOptions, fileName, options);
+      this.formValues[fileName] = '';
+    },
+    
+    // 鐐瑰嚮鎸夐挳
+    clickButton(item) {
+      const file10 = item[10];
+      const file8 = item[8];
+      
+      this.doProByFile8(file8, item[0]);
+      
+      if (file10 !== '') {
+        this.formValues[file10] = '';
+        this.focusInput(file10);
+      }
+    },
+    
+    // 鐐瑰嚮鎷嶇収鎸夐挳
+    photoButton(item) {
+      uni.navigateTo({
+        url: '/pages/BasePage/ftp/pictrue_add'
+      });
+    },
+    
+    // 鐐瑰嚮鍒楄〃鎸夐挳
+    listButton(item) {
+      const file8 = item[8];
+      this.doProByFile8Cursor(file8, item[0], item[2]);
+    },
+    
+    // 鎵ц鍒楄〃鏌ヨ
+    doProByFile8Cursor(file8, fileId, fileType) {
+      const date = file8.substring(1, file8.length - 1);
+      const a = date.split("}{");
+      const iput = a[0].split(',');
+      
+      let fileValue = uni.getStorageSync("code") + '[';
+      for (let i = 0; i < iput.length; i++) {
+        let fv = this.formValues[iput[i]] || '';
+        fv = fv.trim();
+        fileValue += fv + '[';
+      }
+      fileValue = fileValue.substring(0, fileValue.length - 1);
+      
+      if (fileType === 'EDIT') {
+        this.getCursor(fileId, fileValue, a[1], 'cursor');
+      } else {
+        this.getExcProc(fileId, fileValue, a[1], 'cursor');
+      }
+    },
+    
+    // 鑾峰彇娓告爣鏁版嵁
+    // 鑾峰彇娓告爣鏁版嵁
+    getCursor(fileName, fileValue, outFiles, stype) {
+      const fileId = fileName;
+      fileName = fileName.replace(/\s+/g, "");
+      
+      uni.request({
+        url: this.$store.state.serverInfo.serverAPI + '/getCursor',
+        data: {
+          functionName: uni.getStorageSync("functionName"),
+          fileName: fileName,
+          pmachtype: '',
+          fileValue: encodeURIComponent(fileValue),
+          outFiles: outFiles
+        },
+        method: 'POST',
+        timeout: 60000,
+        header: {
+          'Content-Type': 'application/json'
+        },
+        success: (res) => {
+          if (res.data.result) {
+            if (res.data.data[0]) {
+              uni.showModal({
+                title: '閿欒',
+                content: "鍔熻兘鍙戠敓寮傚父锛岃鑱旂郴IT浜哄憳",
+                showCancel: false
+              });
+            } else {
+              const tdata = res.data.data[2];
+              const col = res.data.data[3];
+              
+              this.tableColumns = col;
+              this.tableData = tdata.map(item => Object.values(item));
+              this.filteredTableData = this.tableData; // 鍒濆鍖栬繃婊ゅ悗鐨勬暟鎹�
+              this.searchValues = {}; // 閲嶇疆鎼滅储鏉′欢
+              this.showTable = true;
+            }
+          } else {
+            uni.showToast({
+              title: res.data.message,
+              icon: 'none'
+            });
+          }
+        },
+        fail: (err) => {
+          uni.showToast({
+            title: "璇锋眰澶辫触: " + err.errMsg,
+            icon: 'none'
+          });
+        }
+      });
+    },
+    
+    // 鐐瑰嚮鎵撳嵃鎸夐挳
+    clickPrintBtn(item) {
+      try {
+        const file8 = item[8];
+        const file10 = item[10];
+        const fileId = item[0];
+        
+        const date = file8.substring(1, file8.length - 1);
+        const a = date.split("}{");
+        const iput = a[0].split(',');
+        
+        let fileValue = uni.getStorageSync("code") + '[';
+        for (let i = 0; i < iput.length; i++) {
+          let fv = this.formValues[iput[i]] || '';
+          fileValue += fv + '[';
+        }
+        fileValue = fileValue.substring(0, fileValue.length - 1);
+        
+        // 鍏堟竻绌哄瓧娈�
+        if (file10 !== '') {
+          this.formValues[file10] = '';
+          this.focusInput(file10);
+        }
+        
+        setTimeout(() => {
+          if (a[1]) {
+            const input = a[1].split(',');
+         if (input[input.length - 1] === 'FVIEW') {
+              this.getExcProc(fileId, fileValue, a[1], 'cursor+print');
+            } else {
+              this.getExcProc(fileId, fileValue, a[1], 'print');
+            }
+          }
+        }, 100);
+      } catch (e) {
+        uni.showModal({
+          title: '閿欒',
+          content: "鍔熻兘鍙戠敓寮傚父锛岃鑱旂郴IT浜哄憳",
+          showCancel: false
+        });
+      }
+    },
+    
+    // 鍒濆鍖栬摑鐗欐墦鍗版満
+    initBluetooth() {
+      // #ifdef APP-PLUS
+      try {
+        const main = plus.android.runtimeMainActivity();
+        const BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
+        const UUID = plus.android.importClass("java.util.UUID");
+        
+        const uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
+        const BAdapter = BluetoothAdapter.getDefaultAdapter();
+        BAdapter.cancelDiscovery(); // 鍋滄鎵弿
+        
+        const address_mac = uni.getStorageSync("printMac") || "DC:1D:30:3F:D2:50";
+        this.device = BAdapter.getRemoteDevice(address_mac);
+        plus.android.importClass(this.device);
+        
+        this.bluetoothSocket = this.device.createInsecureRfcommSocketToServiceRecord(uuid);
+        plus.android.importClass(this.bluetoothSocket);
+      } catch (err) {
+        console.log(err);
+        uni.showToast({
+          title: "钃濈墮杩炴帴寮傚父锛�",
+          icon: 'none'
+        });
+      }
+      // #endif
+    },
+    
+    // 鎵撳嵃鏍囩
+    printByIds(ids) {
+      // #ifdef APP-PLUS
+      try {
+        if (!this.bluetoothSocket) {
+          uni.showToast({
+            title: "钃濈墮鏈繛鎺�",
+            icon: 'none'
+          });
+          return;
+        }
+        
+        uni.request({
+          url: this.$store.state.serverInfo.serverAPI + '/getPrintData',
+          data: {
+            ids: ids
+          },
+          method: 'POST',
+          timeout: 60000,
+          success: (res) => {
+            if (res.data.result) {
+              const printData = res.data.data;
+              this.doPrint(printData);
+            } else {
+              uni.showToast({
+                title: res.data.msg,
+                icon: 'none'
+              });
+            }
+          },
+          fail: (err) => {
+            uni.showToast({
+              title: "璇锋眰澶辫触: " + err.errMsg,
+			  content: "璇锋眰澶辫触: " + err.errMsg,
+              icon: 'none'
+            });
+          }
+        });
+      } catch (e) {
+        uni.showToast({
+          title: "鎵撳嵃寮傚父: " + e.message,
+          icon: 'none'
+        });
+      }
+      // #endif
+    },
+    
+    // 鎵ц鎵撳嵃
+    doPrint(printData) {
+      // #ifdef APP-PLUS
+      try {
+        this.bluetoothSocket.connect();
+        const outputStream = this.bluetoothSocket.getOutputStream();
+        plus.android.importClass(outputStream);
+        
+        for (let i = 0; i < printData.length; i++) {
+          const item = printData[i];
+          const template = item.template;
+          const data = item.data;
+          
+          // 杩欓噷鍙互鏍规嵁妯℃澘鍜屾暟鎹敓鎴愭墦鍗板唴瀹�
+          const printContent = this.generatePrintContent(template, data);
+          
+          outputStream.write(plus.android.newByteArray(printContent));
+          outputStream.flush();
+        }
+        
+        outputStream.close();
+        this.bluetoothSocket.close();
+        
+        uni.showToast({
+          title: "鎵撳嵃鎴愬姛",
+          icon: 'success'
+        });
+      } catch (e) {
+        uni.showToast({
+          title: "鎵撳嵃澶辫触: " + e.message,
+          icon: 'none'
+        });
+      }
+      // #endif
+    },
+    
+    // 鐢熸垚鎵撳嵃鍐呭
+    generatePrintContent(template, data) {
+      // 鏍规嵁妯℃澘鍜屾暟鎹敓鎴愭墦鍗板唴瀹�
+      // 杩欓噷闇�瑕佹牴鎹疄闄呮墦鍗版満鍜屾ā鏉挎牸寮忚繘琛屽疄鐜�
+      return new Uint8Array([0x1B, 0x40]); // 绀轰緥: 鎵撳嵃鏈哄垵濮嬪寲鍛戒护
+    },
+    
+    // 鎾斁鎴愬姛鎻愮ず闊�
+    playerYes() {
+      // #ifdef APP-PLUS
+      try {
+        const context = plus.audio.createPlayer('static/audio/yes.mp3');
+        context.play();
+      } catch (e) {
+        console.log('鎾斁鎻愮ず闊冲け璐�:', e);
+      }
+      // #endif
+    },
+    
+    // 鎾斁澶辫触鎻愮ず闊�
+    playerNo() {
+      // #ifdef APP-PLUS
+      try {
+        const context = plus.audio.createPlayer('static/audio/no.mp3');
+        context.play();
+      } catch (e) {
+        console.log('鎾斁鎻愮ず闊冲け璐�:', e);
+      }
+      // #endif
+    },
+    
+    // 鑾峰彇鍒楀鏍峰紡
+    getColumnStyle(col) {
+      if (col.indexOf('_') !== -1) {
+        const tArr = col.split('_');
+        return { width: tArr[1] + '%' };
+      }
+      return {};
+    },
+    
+    // 鑾峰彇鍒楀悕
+    getColumnName(col) {
+      if (col.indexOf('_') !== -1) {
+        const tArr = col.split('_');
+        return tArr[0];
+      }
+      return col;
+    }
+  }
+};
+</script>
+
+<style>
+/* 椤甸潰瀹瑰櫒 */
+.container {
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  background-color: #f5f7fa;
+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
+}
+
+/* 鍐呭鍖哄煙 */
+.content {
+  flex: 1;
+  overflow-y: auto;
+  padding: 8px;
+}
+
+/* 琛ㄥ崟瀹瑰櫒 */
+.form-container {
+  margin-bottom: 12px;
+}
+
+/* 琛ㄥ崟椤� */
+.form-item {
+  display: flex;
+  align-items: center;
+  margin-bottom: 8px;
+  background-color: #fff;
+  border-radius: 6px;
+  padding: 0 10px;
+  min-height: 44px;
+  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
+}
+
+.form-label {
+  width: 80px;
+  font-size: 14px;
+  color: #333;
+  font-weight: 500;
+  padding-right: 10px;
+  flex-shrink: 0;
+}
+
+.form-input {
+  flex: 1;
+  height: 44px;
+  padding: 0 10px;
+  font-size: 14px;
+  border: none;
+  background-color: transparent;
+}
+
+.form-input.readonly {
+  color: #999;
+  background-color: #f5f5f5;
+  border-radius: 4px;
+  
+}
+
+.form-textarea {
+  flex: 1;
+  padding: 10px;
+  font-size: 14px;
+  border: none;
+  background-color: transparent;
+  min-height: 60px;
+}
+
+.form-textarea.readonly {
+  color: #999;
+  background-color: #f5f5f5;
+  border-radius: 4px;
+  
+}
+
+/* 涓嬫媺閫夋嫨妗� */
+.select-wrapper {
+  flex: 1;
+  position: relative;
+}
+
+.select-icon {
+  position: absolute;
+  right: 10px;
+  top: 50%;
+  transform: translateY(-50%);
+  pointer-events: none;
+}
+
+/* 鎵弿閫夋嫨妗� */
+.scan-select-container {
+  flex: 1;
+  display: flex;
+  align-items: center;
+}
+
+.scan-input {
+  flex: 1;
+}
+
+.select-btn {
+  width: 36px;
+  height: 36px;
+  background: linear-gradient(135deg, #5677fc, #8a9ffc);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border-radius: 4px;
+  margin-left: 8px;
+}
+
+.select-btn.readonly-btn {
+  background: linear-gradient(135deg, #e0e0e0, #d0d0d0);
+  cursor: not-allowed;
+}
+
+/* 鎸夐挳鏍峰紡 */
+.button-item {
+  justify-content: center;
+  padding: 6px 0;
+}
+
+.action-button {
+  width: 100%;
+  height: 40px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border-radius: 6px;
+  color: #fff;
+  font-size: 14px;
+  font-weight: 500;
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+}
+
+.normal-btn {
+  background: linear-gradient(135deg, #5677fc, #8a9ffc);
+}
+
+.photo-btn {
+  background: linear-gradient(135deg, #52c41a, #95de64);
+}
+
+.list-btn {
+  background: linear-gradient(135deg, #fa8c16, #ffc53d);
+}
+
+.print-btn {
+  background: linear-gradient(135deg, #13c2c2, #5cdbd3);
+}
+
+/* 寮�鍏虫牱寮� */
+.switch-item {
+  justify-content: space-between;
+}
+
+.custom-switch {
+  transform: scale(0.8);
+}
+
+/* 琛ㄦ牸鏍峰紡 */
+.table-container {
+  background-color: #fff;
+  border-radius: 6px;
+  overflow: hidden;
+  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
+  margin-top: 8px;
+}
+
+.table-header {
+  padding: 10px;
+  background-color: #f9fafc;
+  border-bottom: 1px solid #edf0f7;
+}
+
+.table-title {
+  font-size: 14px;
+  font-weight: 600;
+  color: #333;
+}
+
+.table-scroll {
+  max-height: 300px;
+}
+
+.table {
+  width: 100%;
+  table-layout: fixed;
+}
+
+.tr {
+  display: flex;
+  border-bottom: 1px solid #edf0f7;
+  min-height: 44px;
+}
+
+.tr-alter {
+  background-color: #f9fafc;
+}
+
+.th, .td {
+  flex: 1;
+  padding: 10px 6px;
+  text-align: center;
+  font-size: 13px;
+  word-break: break-word;
+  white-space: normal;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.td {
+  min-height: 44px;
+  position: relative;
+}
+
+.th {
+  background-color: #f5f7fa;
+  color: #333;
+  font-weight: 600;
+  position: sticky;
+  top: 0;
+  z-index: 2;
+}
+
+/* 琛ㄦ牸鎼滅储琛屾牱寮� */
+.search-row {
+  background-color: #f0f2f5;
+  border-bottom: 1px solid #ddd;
+}
+
+.search-cell {
+  padding: 5px 3px;
+}
+
+.search-input {
+  width: 100%;
+  height: 30px;
+  border: 1px solid #ddd;
+  border-radius: 4px;
+  padding: 0 5px;
+  font-size: 12px;
+  background-color: #fff;
+}
+
+/* 纭繚琛ㄥご鍥哄畾鍦ㄩ《閮� */
+.thead {
+  position: sticky;
+  top: 0;
+  z-index: 10;
+}
+
+/* 閫傞厤灏忓睆骞� */
+@media screen and (max-width: 320px) {
+  .form-label {
+    width: 70px;
+    font-size: 13px;
+  }
+  
+  .form-input, .form-textarea {
+    font-size: 13px;
+  }
+  
+  .action-button {
+    font-size: 13px;
+  }
+}
+.scan-input-container {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  position: relative;
+}
+
+/* 鎵爜鍥炬爣鎸夐挳 */
+.scan-icon-btn {
+  width: 36px;
+  height: 36px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  position: absolute;
+  right: 0;
+  top: 50%;
+  transform: translateY(-50%);
+  z-index: 1;
+}
+
+/* 璋冩暣甯︽壂鐮佸浘鏍囩殑杈撳叆妗嗗唴杈硅窛 */
+.scan-input-container .form-input {
+  padding-right: 36px;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3