From a49845f424ae5b1e43e391837a55c43ce07ea62d Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期三, 01 四月 2026 15:02:47 +0800
Subject: [PATCH] #前端
---
rsf-design/src/views/basic-info/loc/modules/loc-dialog.vue | 320 +++++++++++++----------------------------------------
1 files changed, 79 insertions(+), 241 deletions(-)
diff --git a/rsf-design/src/views/basic-info/loc/modules/loc-dialog.vue b/rsf-design/src/views/basic-info/loc/modules/loc-dialog.vue
index a3a88c2..4765f26 100644
--- a/rsf-design/src/views/basic-info/loc/modules/loc-dialog.vue
+++ b/rsf-design/src/views/basic-info/loc/modules/loc-dialog.vue
@@ -35,6 +35,7 @@
import {
buildLocDialogModel,
createLocFormState,
+ filterLocAreaOptionsByWarehouse,
getLocBinaryOptions,
getLocStatusOptions,
getLocUseStatusOptions
@@ -56,17 +57,53 @@
const isEdit = computed(() => props.dialogType === 'edit')
const dialogTitle = computed(() => (isEdit.value ? '缂栬緫搴撲綅' : '鏂板搴撲綅'))
- const filteredAreaOptions = computed(() => {
- if (!form.warehouseId) {
- return props.areaOptions
+ const filteredAreaOptions = computed(() =>
+ filterLocAreaOptionsByWarehouse(props.areaOptions || [], form.warehouseId)
+ )
+
+ function createInputFormItem(label, key, placeholder, extraProps = {}, extraConfig = {}) {
+ return {
+ label,
+ key,
+ type: 'input',
+ props: {
+ placeholder,
+ clearable: true,
+ ...extraProps
+ },
+ ...extraConfig
}
- return (props.areaOptions || []).filter((item) => {
- if (item?.warehouseId === undefined || item?.warehouseId === null) {
- return true
- }
- return Number(item.warehouseId) === Number(form.warehouseId)
- })
- })
+ }
+
+ function createNumberFormItem(label, key, placeholder, extraProps = {}, extraConfig = {}) {
+ return {
+ label,
+ key,
+ type: 'number',
+ props: {
+ min: 0,
+ controlsPosition: 'right',
+ placeholder,
+ ...extraProps
+ },
+ ...extraConfig
+ }
+ }
+
+ function createSelectFormItem(label, key, placeholder, options, extraProps = {}, extraConfig = {}) {
+ return {
+ label,
+ key,
+ type: 'select',
+ props: {
+ placeholder,
+ clearable: true,
+ options,
+ ...extraProps
+ },
+ ...extraConfig
+ }
+ }
const rules = computed(() => ({
warehouseId: [{ required: true, message: '璇烽�夋嫨浠撳簱', trigger: 'change' }],
@@ -80,237 +117,38 @@
}))
const formItems = computed(() => [
- {
- label: '浠撳簱',
- key: 'warehouseId',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨浠撳簱',
- clearable: true,
- filterable: true,
- options: props.warehouseOptions
- }
- },
- {
- label: '搴撳尯',
- key: 'areaId',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨搴撳尯',
- clearable: true,
- filterable: true,
- options: filteredAreaOptions.value
- }
- },
- {
- label: '搴撲綅鍙�',
- key: 'code',
- type: 'input',
- props: {
- placeholder: '璇疯緭鍏ュ簱浣嶅彿',
- clearable: true
- }
- },
- {
- label: '搴撲綅绫诲瀷',
- key: 'typeIds',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨搴撲綅绫诲瀷',
- clearable: true,
- multiple: true,
- collapseTags: true,
- filterable: true,
- options: props.locTypeOptions
- }
- },
- {
- label: '浣跨敤鐘舵��',
- key: 'useStatus',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨浣跨敤鐘舵��',
- clearable: true,
- filterable: true,
- options: getLocUseStatusOptions()
- }
- },
- {
- label: '鐘舵��',
- key: 'status',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨鐘舵��',
- clearable: true,
- options: getLocStatusOptions()
- }
- },
- {
- label: '鎺�',
- key: 'row',
- type: 'number',
- props: {
- min: 0,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ユ帓'
- }
- },
- {
- label: '鍒�',
- key: 'col',
- type: 'number',
- props: {
- min: 0,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ュ垪'
- }
- },
- {
- label: '灞�',
- key: 'lev',
- type: 'number',
- props: {
- min: 0,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ュ眰'
- }
- },
- {
- label: '宸烽亾',
- key: 'channel',
- type: 'number',
- props: {
- min: 0,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ュ贩閬�'
- }
- },
- {
- label: '瀹瑰櫒缂栫爜',
- key: 'barcode',
- type: 'input',
- props: {
- placeholder: '璇疯緭鍏ュ鍣ㄧ紪鐮�',
- clearable: true
- }
- },
- {
- label: '瀛樻斁鍗曚綅',
- key: 'unit',
- type: 'input',
- props: {
- placeholder: '璇疯緭鍏ュ瓨鏀惧崟浣�',
- clearable: true
- }
- },
- {
- label: '铏氭嫙搴撲綅',
- key: 'flagLogic',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨铏氭嫙搴撲綅',
- clearable: true,
- options: getLocBinaryOptions()
- }
- },
- {
- label: '鏍囩绠$悊',
- key: 'flagLabelMange',
- type: 'select',
- props: {
- placeholder: '璇烽�夋嫨鏍囩绠$悊',
- clearable: true,
- options: getLocBinaryOptions()
- }
- },
- {
- label: '闀�',
- key: 'length',
- type: 'number',
- props: {
- min: 0,
- step: 0.01,
- precision: 2,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ラ暱'
- }
- },
- {
- label: '瀹�',
- key: 'width',
- type: 'number',
- props: {
- min: 0,
- step: 0.01,
- precision: 2,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ュ'
- }
- },
- {
- label: '楂�',
- key: 'height',
- type: 'number',
- props: {
- min: 0,
- step: 0.01,
- precision: 2,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ラ珮'
- }
- },
- {
- label: '鏈�澶ч浂浠舵暟',
- key: 'maxParts',
- type: 'number',
- props: {
- min: 0,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ユ渶澶ч浂浠舵暟'
- }
- },
- {
- label: '鏈�澶у寘瑁呮暟',
- key: 'maxPack',
- type: 'number',
- props: {
- min: 0,
- controlsPosition: 'right',
- placeholder: '璇疯緭鍏ユ渶澶у寘瑁呮暟'
- }
- },
- {
- label: '鍔熻兘灞炴��',
- key: 'fucAtrrs',
- type: 'input',
- span: 24,
- props: {
- placeholder: '璇疯緭鍏ュ姛鑳藉睘鎬�',
- clearable: true
- }
- },
- {
- label: '灞炴��',
- key: 'locAttrs',
- type: 'input',
- span: 24,
- props: {
- placeholder: '璇疯緭鍏ュ睘鎬�',
- clearable: true
- }
- },
- {
- label: '澶囨敞',
- key: 'memo',
- type: 'input',
- span: 24,
- props: {
- type: 'textarea',
- rows: 3,
- placeholder: '璇疯緭鍏ュ娉�',
- clearable: true
- }
- }
+ createSelectFormItem('浠撳簱', 'warehouseId', '璇烽�夋嫨浠撳簱', props.warehouseOptions, { filterable: true }),
+ createSelectFormItem('搴撳尯', 'areaId', '璇烽�夋嫨搴撳尯', filteredAreaOptions.value, { filterable: true }),
+ createInputFormItem('搴撲綅鍙�', 'code', '璇疯緭鍏ュ簱浣嶅彿'),
+ createSelectFormItem('搴撲綅绫诲瀷', 'typeIds', '璇烽�夋嫨搴撲綅绫诲瀷', props.locTypeOptions, {
+ multiple: true,
+ collapseTags: true,
+ filterable: true
+ }),
+ createSelectFormItem('浣跨敤鐘舵��', 'useStatus', '璇烽�夋嫨浣跨敤鐘舵��', getLocUseStatusOptions(), { filterable: true }),
+ createSelectFormItem('鐘舵��', 'status', '璇烽�夋嫨鐘舵��', getLocStatusOptions()),
+ createNumberFormItem('鎺�', 'row', '璇疯緭鍏ユ帓'),
+ createNumberFormItem('鍒�', 'col', '璇疯緭鍏ュ垪'),
+ createNumberFormItem('灞�', 'lev', '璇疯緭鍏ュ眰'),
+ createNumberFormItem('宸烽亾', 'channel', '璇疯緭鍏ュ贩閬�'),
+ createInputFormItem('瀹瑰櫒缂栫爜', 'barcode', '璇疯緭鍏ュ鍣ㄧ紪鐮�'),
+ createInputFormItem('瀛樻斁鍗曚綅', 'unit', '璇疯緭鍏ュ瓨鏀惧崟浣�'),
+ createSelectFormItem('铏氭嫙搴撲綅', 'flagLogic', '璇烽�夋嫨铏氭嫙搴撲綅', getLocBinaryOptions()),
+ createSelectFormItem('鏍囩绠$悊', 'flagLabelMange', '璇烽�夋嫨鏍囩绠$悊', getLocBinaryOptions()),
+ createNumberFormItem('闀�', 'length', '璇疯緭鍏ラ暱', { step: 0.01, precision: 2 }),
+ createNumberFormItem('瀹�', 'width', '璇疯緭鍏ュ', { step: 0.01, precision: 2 }),
+ createNumberFormItem('楂�', 'height', '璇疯緭鍏ラ珮', { step: 0.01, precision: 2 }),
+ createNumberFormItem('鏈�澶ч浂浠舵暟', 'maxParts', '璇疯緭鍏ユ渶澶ч浂浠舵暟'),
+ createNumberFormItem('鏈�澶у寘瑁呮暟', 'maxPack', '璇疯緭鍏ユ渶澶у寘瑁呮暟'),
+ createInputFormItem('鍔熻兘灞炴��', 'fucAtrrs', '璇疯緭鍏ュ姛鑳藉睘鎬�', {}, { span: 24 }),
+ createInputFormItem('灞炴��', 'locAttrs', '璇疯緭鍏ュ睘鎬�', {}, { span: 24 }),
+ createInputFormItem(
+ '澶囨敞',
+ 'memo',
+ '璇疯緭鍏ュ娉�',
+ { type: 'textarea', rows: 3 },
+ { span: 24 }
+ )
])
const loadFormData = () => {
--
Gitblit v1.9.1