From f6feff7d471ab34763ee125357da4b08405a16ff Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期二, 02 十二月 2025 08:32:33 +0800
Subject: [PATCH] #
---
pages/basics/matQuery.vue | 303 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 282 insertions(+), 21 deletions(-)
diff --git a/pages/basics/matQuery.vue b/pages/basics/matQuery.vue
index 28d2a09..4fa1c85 100644
--- a/pages/basics/matQuery.vue
+++ b/pages/basics/matQuery.vue
@@ -3,39 +3,251 @@
<view>
<view class="container">
<view class="text-box">
- <view><text>鍟嗗搧缂栫爜</text></view>
- <view><text>1111</text></view>
+ <view class="text-title"><text>鐗╂枡缂栫爜</text></view>
+ <view class="text-title"><text>{{matData.matnr}}</text></view>
</view>
<view class="text-box">
- <view><text>鍟嗗搧鍚嶇О</text></view>
- <view>鏄剧ず鍣�</view>
+ <view class="text-title"><text>鐗╂枡鍚嶇О</text></view>
+ <view class="text-title">{{matData.maktx}}</view>
</view>
<view class="text-box">
- <view><text>瑙勬牸</text></view>
- <view>24鑻卞</view>
+ <view class="text-title"><text>瀹㈡埛PO</text></view>
+ <view class="text-title"><input type="text" v-model="matData.standby1"></view>
</view>
<view class="text-box">
- <view><text>鎵瑰彿</text></view>
- <view>YC-897998776</view>
+ <view class="text-title"><text>鏉$爜UPC</text></view>
+ <view class="text-title"><input type="text" v-model="matData.standby2"></view>
</view>
<view class="text-box">
- <view><text>鏁伴噺</text></view>
- <view>269</view>
+ <view class="text-title"><text>瀹㈡埛SKU</text></view>
+ <view class="text-title"><input type="text" v-model="matData.standby3"></view>
</view>
- <view class="foot flex justify-center">
- <label for="">
- <button class="cu-btn bg-blue">鎻愬彇</button>
- </label>
+ <view class="text-box">
+ <view class="text-title"><text>璐т富鍚嶇О</text></view>
+ <view class="text-title"><input type="text" v-model="matData.boxType1"></view>
+ </view>
+ <view class="text-box">
+ <view class="text-title"><text>渚涘簲鍟�</text></view>
+ <view class="text-title"><input type="text" v-model="matData.supp"></view>
+ </view>
+ <view class="text-box">
+ <view class="text-title"><text>閲囪喘鍗曞彿</text></view>
+ <view class="text-title"><input type="text" v-model="matData.boxType3"></view>
+ </view>
+ <view class="text-box">
+ <view class="text-title"><text>澶囨敞</text></view>
+ <view class="text-title"><input type="text" v-model="matData.memo"></view>
+ </view>
+ <view class="text-box">
+ <view class="text-title"><text>鏁伴噺</text></view>
+ <view class="text-title">
+ <view>
+ <uni-number-box :value="matData.anfme" :max="999999999" :step="1" color="#747474" @change="changeValue"/>
+ </view>
+ </view>
</view>
</view>
+ </view>
+ <view class="foot flex justify-center">
+ <label>
+ <button class="cu-btn bg-blue" @click="back()">鎻愬彇</button>
+ </label>
</view>
</scroll-view>
</template>
<script>
+export default {
+ data() {
+ const now = new Date();
+ const formatTime = (date) => {
+ return {
+ year: String(date.getFullYear()),
+ month: String(date.getMonth() + 1).padStart(2, '0'),
+ day: String(date.getDate()).padStart(2, '0'),
+ hour: String(date.getHours()).padStart(2, '0'),
+ minute: String(date.getMinutes()).padStart(2, '0'),
+ second: String(date.getSeconds()).padStart(2, '0'),
+ };
+ };
+ return {
+ matData: {
+ matnr: null,
+ maktx: null,
+ standby1: null,
+ anfme: null,
+ standby2: null,
+ standby3: null,
+ supp: null,
+ boxType1: null,
+ boxType3: null,
+ memo:null,
+ startTime: '',
+ endTime: ''
+ },
+ commonProps: [
+ '4Ni','6Ni', '8Ni', '10Ni', '闀�閾�', '鏈壊',
+ '闀�闀�', '鐢甸晙', '鐜懓閲�', 'PVD鎷変笣閲戝皝鍝戞补', 'PVD鎷変笣闀嶅皝鍝戞补',
+ '鐢垫吵浜氶粦', '姘撮晙鏋伆', '鎷変笣', '閽涢噾', '浜櫧',
+ '浣撴姏娌欓摐鏈壊', '鎶涘厜', '杩囩爞'
+ ],
+ selectedIndex: -1,
+ startTime: formatTime(now),
+ endTime: formatTime(now),
+ baseIP: '',
+ basePORT: '',
+ };
+ },
+ onLoad(option) {
+ let that = this;
+
+ // #ifdef APP-NVUE
+ const eventChannel = this.$scope.eventChannel;
+ // #endif
+ // #ifndef APP-NVUE
+ const eventChannel = this.getOpenerEventChannel();
+ // #endif
+
+ eventChannel.on('matData', function (data) {
+ Object.assign(that.matData, data.data); // 淇濇寔鍝嶅簲寮�
+ that.matData.anfme = 1;
+
+ if (that.matData.proType) {
+ that.selectedIndex = that.commonProps.indexOf(that.matData.proType);
+ }
+ });
+ },
+
+ methods: {
+ onPropChange(e) {
+ this.selectedIndex = e.detail.value;
+ this.matData.proType = this.commonProps[this.selectedIndex];
+ },
+
+ validateNumber(field, type) {
+ const value = this[type][field];
+ // 鍙厑璁歌緭鍏ユ暟瀛�
+ if (!/^\d*$/.test(value)) {
+ this[type][field] = value.replace(/\D/g, ''); // 鍘婚櫎闈炴暟瀛楀瓧绗�
+ }
+
+ let max = 59; // 榛樿鏈�澶у��
+ if (field === 'year') max = 9999; // 骞存渶澶у�间负 9999
+ if (field === 'month') max = 12; // 鏈堟渶澶у�间负 12
+ if (field === 'day') max = 31; // 鏃ユ渶澶у�间负 31
+ if (field === 'hour') max = 23; // 灏忔椂鏈�澶у�间负 23
+ if (field === 'minute' || field === 'second') max = 59; // 鍒嗛挓鍜岀鏈�澶у�间负 59
+
+ // 闄愬埗杈撳叆鑼冨洿
+ if (parseInt(value, 10) > max) {
+ this[type][field] = max.toString(); // 濡傛灉瓒呭嚭鑼冨洿锛岃缃负鏈�澶у��
+ }
+
+ // 鑷姩鏇存柊瀹屾暣鏃堕棿
+ this.updateFullDate(type);
+ },
+ clearInput(field, type) {
+ this[type][field] = ''; // 娓呯┖鎸囧畾瀛楁鐨勫��
+ },
+ updateFullDate(type) {
+ const timeData = this[type];
+ const { year, month, day, hour, minute, second } = timeData;
+ if (
+ year.length === 4 &&
+ month.length === 2 &&
+ day.length === 2 &&
+ hour.length === 2 &&
+ minute.length === 2 &&
+ second.length === 2
+ ) {
+ // 鎷艰涓哄畬鏁存椂闂�
+ const fullDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
+ // 楠岃瘉鏄惁绗﹀悎鏈夋晥鐨勬椂闂存牸寮�
+ if (this.isValidDate(fullDate)) {
+ this.matData[type === 'startTime' ? 'startTime' : 'endTime'] = fullDate;
+ } else {
+ uni.showToast({ title: '鏃堕棿鏍煎紡閿欒', icon: 'none', duration: 2000 });
+ }
+ }
+ },
+
+ isValidDate(dateStr) {
+ const date = new Date(dateStr);
+ return date.toString() !== 'Invalid Date' && dateStr === this.formatDateTime(date);
+ },
+
+ formatDateTime(date) {
+ const yyyy = date.getFullYear();
+ const MM = String(date.getMonth() + 1).padStart(2, '0');
+ const dd = String(date.getDate()).padStart(2, '0');
+ const HH = String(date.getHours()).padStart(2, '0');
+ const mm = String(date.getMinutes()).padStart(2, '0');
+ const ss = String(date.getSeconds()).padStart(2, '0');
+ return `${yyyy}-${MM}-${dd} ${HH}:${mm}:${ss}`;
+ },
+ blur() { },
+ focus() { },
+ changeLog() { },
+ changeValue(value) {
+ this.matData.anfme = value;
+ },
+ back() {
+ if (this.matData.anfme === 0) {
+ uni.showToast({ title: '璇疯緭鍏ユ暟閲�', icon: 'none', position: 'top' });
+ return;
+ }
+ this.getOpenerEventChannel().emit('matList', { data: this.matData });
+ uni.vibrateShort();
+ uni.navigateBack({});
+ },
+ },
+};
</script>
+
<style>
+ .attr-row {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .half-box {
+ width: 50%;
+ box-sizing: border-box;
+ border: 1rpx solid #ccc;
+ height: 60rpx;
+ border-radius: 8rpx;
+ background-color: #f9f9f9;
+ font-size: 24rpx;
+ display: flex;
+ align-items: center;
+ padding: 0 10rpx;
+ /* 缁熶竴瀛椾綋澶у皬锛屽乏鍙冲唴杈硅窛锛屽幓鎺変笂涓嬪唴杈硅窛纭繚鍨傜洿灞呬腑 */
+ }
+
+ .picker-box {
+ width: 100%;
+ /* 璁﹑icker鍐呭鎾戞弧鐩掑瓙 */
+ height: 60rpx;
+ line-height: 60rpx;
+ /* 琛岄珮鍨傜洿灞呬腑 */
+ }
+
+ input.half-box {
+ border: none;
+ outline: none;
+ /* 鍘绘帀input榛樿杈规 */
+ background-color: transparent;
+ /* 鑳屾櫙閫忔槑锛岃input鑳屾櫙璺熺埗鐩掑瓙涓�鑷� */
+ font-size: 24rpx;
+ /* 缁ф壙瀛椾綋澶у皬 */
+ height: 60rpx;
+ line-height: 60rpx;
+ /* 璁╂枃瀛楀瀭鐩村眳涓� */
+ }
+
.container {
width: 100%;
height: 100%;
@@ -47,27 +259,57 @@
margin-top: 20rpx;
margin-left: 10%;
width: 80%;
- font-size: 36rpx;
- font-weight: 700;
+ font-size: 32rpx;
+ font-weight: 400;
color: #434343;
border-bottom: 1rpx solid #e8e8e8;
}
.text-box:last-child {
- border-bottom: 1px solid #000000;
+ border-bottom: none;
}
- .text-box view {
+ .text-box .text-title {
width: 30%;
+ height: 100rpx;
float: left;
display: inline-block;
}
- .text-box view:last-child {
+ .text-box .text-title:last-child {
display: inline-block;
- margin-left: 10%;
- width: 60%;
+ margin-left: 2%;
+ width: 72%;
+ font-size: 30rpx;
+ font-weight: 400;
+ color: #747474;
+ display: flex;
+ align-items: center;
+ }
+ .text-box .text-title:last-child input {
+ border-bottom: 1rpx solid #e8e8e8 ;
+ width: 100%;
+ }
+ .text-title input {
+ text-align: center;
+ border: 1rpx solid #e8e8e8;
+ border-radius: 5rpx;
+ padding: 5rpx;
+ font-size: 28rpx;
+ color: #747474;
+ }
+ .text-title text {
+ font-size: 28rpx;
+ color: #434343;
+ }
+ .text-title year{
+ display: inline-block;
+ margin-left: 2%;
+ width: 72%;
font-size: 30rpx;
font-weight: 400;
color: #747474;
}
+
+
+
.foot {
width: 100%;
@@ -79,4 +321,23 @@
border-top: 1px solid #d8d8d8;
z-index: 1;
}
+ .text-box {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 20rpx;
+ margin-left: 10%;
+ width: 80%;
+ border-bottom: 1rpx solid #e8e8e8;
+ padding-bottom: 10rpx;
+ }
+
+ /* 鏍囩閮ㄥ垎鏍峰紡 */
+ .label {
+ width: 20%;
+ font-size: 30rpx;
+ color: #434343;
+ }
+
+
</style>
--
Gitblit v1.9.1