From e68d19dec1575d5ab9e7e596c4069f4ab8b6f31e Mon Sep 17 00:00:00 2001
From: luojie <125330818@qq.com>
Date: Sun, 4 Jan 2026 16:54:30 +0800
Subject: [PATCH] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86][tab?=
=?UTF-8?q?le=E7=BB=84=E4=BB=B6=E6=8A=BD=E7=A6=BB]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Template/BaseInfoFormPcakge.vue | 16 ++++-
src/components/Template/CustomTable.vue | 80 ++++++++++++----------
src/components/Template/DecimalInput.vue | 6 +-
src/components/Template/HandleFormItem.vue | 2 +
.../business/comps/template/TemplateTable.vue | 3 +-
.../business/comps/template/comps/sp/Demo.vue | 2 +-
.../comps/template/comps/sp/SWYPBQGZYZBB.vue | 78 ++++++++++++++++++---
.../comps/template/mixins/templateMixin.js | 19 +++--
8 files changed, 149 insertions(+), 57 deletions(-)
diff --git a/src/components/Template/BaseInfoFormPcakge.vue b/src/components/Template/BaseInfoFormPcakge.vue
index d140ebc..6010ad1 100644
--- a/src/components/Template/BaseInfoFormPcakge.vue
+++ b/src/components/Template/BaseInfoFormPcakge.vue
@@ -94,7 +94,10 @@
-
+
-
-
+
{{ row[col.prop] }}
-
+
-
-
-
-
{{ row[col.bodySubKey] }}
@@ -98,10 +93,15 @@ export default {
// { label: '状态', prop: 'status', type: 'select', options: [{value:1,label:'启用'},...], selected: null }
// ]
},
- dataSource: {
- type: Array,
- required: true
- }
+ formData: {
+ type: Object,
+ default:()=>{
+ return {
+ stepTableFormData: [],
+ headerSelectFields: {}
+ }
+ }
+ },
},
data() {
return {
@@ -110,19 +110,18 @@ export default {
}
},
watch: {
- dataSource: {
+ formData:{
immediate: true,
handler(newData) {
- this.localDataSource = JSON.parse(JSON.stringify(newData));
- // 初始化表头选择器值
+ console.log(newData,"newData")
+ const {stepTableFormData = [], headerSelectFields = {}} = newData;
+ this.updateDataSource(stepTableFormData);
+ this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields))
}
},
- columns: {
- immediate: true,
- handler(newColumns) {
- this.initHeaderSelectValues();
- }
- }
+ },
+ mounted() {
+ this.initHeaderSelectValues();
},
methods: {
// 初始化表头选择器值
@@ -133,7 +132,6 @@ export default {
headerSelectObj[col.headerSelectKey] = col.defaultValue || col.headerOptions[0].value || ""
}
});
- console.log(headerSelectObj,"headerSelectObj")
this.headerSelectFields = headerSelectObj;
},
// 获取最新数据
@@ -146,7 +144,7 @@ export default {
return new Promise((resolve,reject)=>{
if(validateResult.valid){
resolve({
- dataSource: [...this.localDataSource],
+ stepTableFormData: [...this.localDataSource],
headerSelectFields: this.headerSelectFields,
})
}else{
@@ -238,33 +236,41 @@ export default {
label: ""
}
},
- getBodyItem(col) {
- return {
+ getBodyItem(col,rowIndex) {
+ const currentItem = this.localDataSource[rowIndex];
+ const item = {
fillType: col.bodyFillType,
options: col.bodyOptions,
- maxLength: col.bodyMaxLength,
- label: ""
+ maxlength: col.bodyMaxlength,
+ label: col.label,
+ precision: currentItem[col.bodyPrecisionKey] || col.precision || 0,
+ };
+ if(col.bodyDisabled){
+ item.disabled = col.bodyDisabled;
}
+ return item
},
getBodySubItem(col) {
- return {
+ const item = {
fillType: col.bodySubFillType,
options: col.bodySubOptions,
+ maxlength: col.bodySubMaxlength,
label: "",
+ placeholder:col.bodySubPlaceholder||"请输入"
}
- },
- getPrecisionNumberItem(col) {
- return {
- fillType: col.bodySubFillType,
- options: col.bodySubOptions,
- label: "",
- placeholder:"请输入保留小数位数"
+ if(col.bodySubDisabled){
+ item.disabled = col.bodySubDisabled;
}
},
// 删除行
deleteRow(rowIndex) {
this.localDataSource.splice(rowIndex, 1);
this.$emit('row-delete', rowIndex);
+ },
+ // 更新数据方法,可在formData变更时调用,也可由父组件调用
+ updateDataSource(dataSource = []) {
+ // 深拷贝数据以避免直接修改原始数据
+ this.localDataSource = JSON.parse(JSON.stringify(dataSource || []));
}
}
};
diff --git a/src/components/Template/DecimalInput.vue b/src/components/Template/DecimalInput.vue
index 0fe677c..27dd81e 100644
--- a/src/components/Template/DecimalInput.vue
+++ b/src/components/Template/DecimalInput.vue
@@ -1,5 +1,5 @@
-
+