#
zhou zhou
13 小时以前 54444275ff8ef4ed966377dce3b34f07d63836a3
#
4个文件已修改
282 ■■■■ 已修改文件
App.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
locale/zh-Hans.json 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/InManagement/ContainerBinding/Container_Binding.vue 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/settings/settings.vue 224 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
        }
locale/zh-Hans.json
@@ -74,7 +74,14 @@
        "orderCombSeparator": "组托材料分隔符",
        "orderCombArrayIndex": "组托材料分割后数组索引",
        "orderCombStartPos": "组托材料起始位",
        "inputPlaceholder": "请输入"
        "inputPlaceholder": "请输入",
        "containerBindingFields": "组托列表显示字段",
        "manageFields": "管理字段",
        "addField": "添加字段",
        "fieldName": "字段名",
        "fieldLabel": "显示名称(i18n key)",
        "restoreDefault": "恢复默认",
        "fieldRequired": "字段名和显示名称不能为空"
    },
    "common": {
        "confirm": "确认",
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 = ';'
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>