From 54444275ff8ef4ed966377dce3b34f07d63836a3 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 05 三月 2026 15:46:05 +0800
Subject: [PATCH] #
---
pages/settings/settings.vue | 224 +++++++++++++++++++++++++++++++++++++++++---
locale/zh-Hans.json | 9 +
App.vue | 8 +
pages/InManagement/ContainerBinding/Container_Binding.vue | 41 ++-----
4 files changed, 234 insertions(+), 48 deletions(-)
diff --git a/App.vue b/App.vue
index de4cdae..8a79cac 100644
--- a/App.vue
+++ b/App.vue
@@ -13,7 +13,13 @@
orderCombNeedSplit: true,
orderCombSeparator: ';',
orderCombArrayIndex: 0,
- orderCombStartPos: 3
+ orderCombStartPos: 3,
+ containerBindingFields: [
+ { field: 'maktx', label: 'container.matName' },
+ { field: 'specs', label: 'container.matSpec' },
+ { field: 'batch', label: 'container.matBatch' },
+ { field: 'anfme', label: 'container.matQty' }
+ ]
}
uni.setStorageSync('appSettings', appSettings)
}
diff --git a/locale/zh-Hans.json b/locale/zh-Hans.json
index 65fe64e..98d4492 100644
--- a/locale/zh-Hans.json
+++ b/locale/zh-Hans.json
@@ -74,7 +74,14 @@
"orderCombSeparator": "缁勬墭鏉愭枡鍒嗛殧绗�",
"orderCombArrayIndex": "缁勬墭鏉愭枡鍒嗗壊鍚庢暟缁勭储寮�",
"orderCombStartPos": "缁勬墭鏉愭枡璧峰浣�",
- "inputPlaceholder": "璇疯緭鍏�"
+ "inputPlaceholder": "璇疯緭鍏�",
+ "containerBindingFields": "缁勬墭鍒楄〃鏄剧ず瀛楁",
+ "manageFields": "绠$悊瀛楁",
+ "addField": "娣诲姞瀛楁",
+ "fieldName": "瀛楁鍚�",
+ "fieldLabel": "鏄剧ず鍚嶇О(i18n key)",
+ "restoreDefault": "鎭㈠榛樿",
+ "fieldRequired": "瀛楁鍚嶅拰鏄剧ず鍚嶇О涓嶈兘涓虹┖"
},
"common": {
"confirm": "纭",
diff --git a/pages/InManagement/ContainerBinding/Container_Binding.vue b/pages/InManagement/ContainerBinding/Container_Binding.vue
index 096e17f..47cf08b 100644
--- a/pages/InManagement/ContainerBinding/Container_Binding.vue
+++ b/pages/InManagement/ContainerBinding/Container_Binding.vue
@@ -86,33 +86,9 @@
</view>
<view class="card-content">
- <view class="info-row">
- <text class="info-label">{{ $t('container.matName') }}</text>
- <text class="info-value">
- {{ item.maktx || '-' }}
- </text>
- </view>
- <view class="info-row">
- <view class="info-col">
- <text class="info-label">{{ $t('container.matSpec') }}</text>
- <text class="info-value">
- {{ item.specs || '-' }}
- </text>
- </view>
- <view class="info-col">
- <text class="info-label">{{ $t('container.matBatch') }}</text>
- <text class="info-value highlight">
- {{ item.batch || '-' }}
- </text>
- </view>
- </view>
- <view class="info-row">
- <view class="info-col">
- <text class="info-label">{{ $t('container.matQty') }}</text>
- <text class="info-value qty">
- {{ item.anfme }}
- </text>
- </view>
+ <view class="info-row" v-for="(field, idx) in displayFields" :key="idx">
+ <text class="info-label">{{ $t(field.label) }}</text>
+ <text class="info-value">{{ item[field.field] || '-' }}</text>
</view>
</view>
@@ -275,7 +251,13 @@
orderCombNeedSplit: true,
orderCombSeparator: ';',
orderCombArrayIndex: 0,
- orderCombStartPos: 3
+ orderCombStartPos: 3,
+ displayFields: [
+ { field: 'maktx', label: 'container.matName' },
+ { field: 'specs', label: 'container.matSpec' },
+ { field: 'batch', label: 'container.matBatch' },
+ { field: 'anfme', label: 'container.matQty' }
+ ]
}
},
onShow() {
@@ -285,6 +267,9 @@
this.orderCombSeparator = settings.orderCombSeparator || ';'
this.orderCombArrayIndex = settings.orderCombArrayIndex !== undefined ? Number(settings.orderCombArrayIndex) : 0
this.orderCombStartPos = settings.orderCombStartPos !== undefined ? Number(settings.orderCombStartPos) : 3
+ if (settings.containerBindingFields && settings.containerBindingFields.length > 0) {
+ this.displayFields = settings.containerBindingFields
+ }
} else {
this.orderCombNeedSplit = true
this.orderCombSeparator = ';'
diff --git a/pages/settings/settings.vue b/pages/settings/settings.vue
index d81b169..4b8c9f2 100644
--- a/pages/settings/settings.vue
+++ b/pages/settings/settings.vue
@@ -63,26 +63,88 @@
></u--input>
</view>
- <!-- 鍥炬爣/绠ご绫诲瀷锛堜緥濡傝烦杞叾瀹冭缃〉锛� -->
- <!-- 鍙互鏍规嵁闇�瑕佹墿灞� v-else-if="item.type === 'link'" -->
- </u-cell>
-
- <!-- 濡傛灉闇�瑕侀厤缃洿澶氳缃」锛屽彲浠ュ弬鑰冧笅鏂圭殑鏍峰紡缁撴瀯 -->
- <!--
- <u-cell
- title="鍏朵粬璁剧疆"
- :border="true"
- :isLink="true"
- size="large"
- titleStyle="font-size: 30rpx; color: #333333;"
- >
- <view slot="icon" class="cell-icon-wrap bg-yellow">
- <u-icon name="setting" color="#ffffff" size="20"></u-icon>
+ <!-- displayFields 绫诲瀷璁剧疆椤癸紙鐐瑰嚮鎵撳紑寮圭獥锛� -->
+ <view slot="value" v-else-if="item.type === 'displayFields'" @tap="openFieldsPopup(item.key)">
+ <text style="color: #909399; font-size: 26rpx;">{{ $t('settings.manageFields') }} 鈻�</text>
</view>
</u-cell>
- -->
</u-cell-group>
</view>
+
+ <!-- 瀛楁绠$悊寮圭獥 -->
+ <u-popup
+ :show="showFieldsPopup"
+ mode="bottom"
+ round="12"
+ @close="showFieldsPopup = false"
+ >
+ <view class="fields-popup">
+ <view class="fields-popup-header">
+ <text class="fields-popup-title">{{ $t('settings.containerBindingFields') }}</text>
+ <text class="fields-popup-restore" @tap="restoreDefaultFields">{{ $t('settings.restoreDefault') }}</text>
+ </view>
+
+ <!-- 宸查厤缃瓧娈靛垪琛� -->
+ <view class="fields-list">
+ <view
+ class="field-item"
+ v-for="(field, idx) in editingFields"
+ :key="idx"
+ >
+ <view class="field-info">
+ <text class="field-name">{{ field.field }}</text>
+ <text class="field-label">{{ $t(field.label) }}</text>
+ </view>
+ <u-icon
+ name="minus-circle-fill"
+ color="#f56c6c"
+ size="22"
+ @click="removeField(idx)"
+ ></u-icon>
+ </view>
+ </view>
+
+ <!-- 娣诲姞鏂板瓧娈� -->
+ <view class="add-field-section">
+ <view class="add-field-row">
+ <u--input
+ v-model="newFieldName"
+ :placeholder="$t('settings.fieldName')"
+ border="surround"
+ customStyle="flex: 1; margin-right: 16rpx;"
+ ></u--input>
+ <u--input
+ v-model="newFieldLabel"
+ :placeholder="$t('settings.fieldLabel')"
+ border="surround"
+ customStyle="flex: 1;"
+ ></u--input>
+ </view>
+ <u-button
+ type="primary"
+ size="small"
+ :text="$t('settings.addField')"
+ @click="addField"
+ customStyle="margin-top: 16rpx;"
+ ></u-button>
+ </view>
+
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="fields-popup-footer">
+ <u-button
+ :text="$t('common.cancel')"
+ @click="showFieldsPopup = false"
+ customStyle="flex: 1; margin-right: 20rpx;"
+ ></u-button>
+ <u-button
+ type="primary"
+ :text="$t('common.confirm')"
+ @click="saveFields"
+ customStyle="flex: 1;"
+ ></u-button>
+ </view>
+ </view>
+ </u-popup>
</view>
</template>
@@ -97,8 +159,25 @@
orderCombNeedSplit: true,
orderCombSeparator: ';',
orderCombArrayIndex: 0,
- orderCombStartPos: 3
- }
+ orderCombStartPos: 3,
+ containerBindingFields: [
+ { field: 'maktx', label: 'container.matName' },
+ { field: 'specs', label: 'container.matSpec' },
+ { field: 'batch', label: 'container.matBatch' },
+ { field: 'anfme', label: 'container.matQty' }
+ ]
+ },
+ showFieldsPopup: false,
+ editingFieldsKey: '',
+ editingFields: [],
+ newFieldName: '',
+ newFieldLabel: '',
+ defaultContainerBindingFields: [
+ { field: 'maktx', label: 'container.matName' },
+ { field: 'specs', label: 'container.matSpec' },
+ { field: 'batch', label: 'container.matBatch' },
+ { field: 'anfme', label: 'container.matQty' }
+ ]
}
},
computed: {
@@ -152,6 +231,13 @@
iconName: 'play-right-fill',
iconBgColor: 'bg-green',
type: 'number'
+ },
+ {
+ key: 'containerBindingFields',
+ title: this.$t('settings.containerBindingFields'),
+ iconName: 'grid-fill',
+ iconBgColor: 'bg-green',
+ type: 'displayFields'
}
]
}
@@ -172,6 +258,36 @@
methods: {
saveSettings() {
uni.setStorageSync('appSettings', this.appSettings)
+ },
+ openFieldsPopup(key) {
+ this.editingFieldsKey = key
+ this.editingFields = JSON.parse(JSON.stringify(this.appSettings[key] || []))
+ this.newFieldName = ''
+ this.newFieldLabel = ''
+ this.showFieldsPopup = true
+ },
+ removeField(idx) {
+ this.editingFields.splice(idx, 1)
+ },
+ addField() {
+ if (!this.newFieldName || !this.newFieldLabel) {
+ uni.showToast({ title: this.$t('settings.fieldRequired'), icon: 'none' })
+ return
+ }
+ this.editingFields.push({
+ field: this.newFieldName,
+ label: this.newFieldLabel
+ })
+ this.newFieldName = ''
+ this.newFieldLabel = ''
+ },
+ restoreDefaultFields() {
+ this.editingFields = JSON.parse(JSON.stringify(this.defaultContainerBindingFields))
+ },
+ saveFields() {
+ this.appSettings[this.editingFieldsKey] = JSON.parse(JSON.stringify(this.editingFields))
+ this.saveSettings()
+ this.showFieldsPopup = false
}
}
}
@@ -215,4 +331,76 @@
.bg-green {
background-color: #63d98f;
}
+
+/* 瀛楁绠$悊寮圭獥鏍峰紡 */
+.fields-popup {
+ padding: 40rpx 30rpx;
+ max-height: 70vh;
+}
+
+.fields-popup-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 30rpx;
+}
+
+.fields-popup-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.fields-popup-restore {
+ font-size: 26rpx;
+ color: #409eff;
+}
+
+.fields-list {
+ max-height: 400rpx;
+ overflow-y: auto;
+ margin-bottom: 30rpx;
+}
+
+.field-item {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 20rpx 16rpx;
+ background-color: #f5f7fa;
+ border-radius: 8rpx;
+ margin-bottom: 12rpx;
+}
+
+.field-info {
+ display: flex;
+ flex-direction: column;
+}
+
+.field-name {
+ font-size: 28rpx;
+ color: #303133;
+ font-weight: 500;
+}
+
+.field-label {
+ font-size: 24rpx;
+ color: #909399;
+ margin-top: 4rpx;
+}
+
+.add-field-section {
+ padding: 20rpx 0;
+ border-top: 1px solid #ebeef5;
+}
+
+.add-field-row {
+ display: flex;
+ align-items: center;
+}
+
+.fields-popup-footer {
+ display: flex;
+ margin-top: 30rpx;
+}
</style>
--
Gitblit v1.9.1