diff --git a/src/components/Template/BaseInfoFormPcakge.vue b/src/components/Template/BaseInfoFormPcakge.vue
index fbf19ae..86e013b 100644
--- a/src/components/Template/BaseInfoFormPcakge.vue
+++ b/src/components/Template/BaseInfoFormPcakge.vue
@@ -9,12 +9,14 @@
{{ sItem.label }}
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
{{ sItem.label }}
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
@@ -27,7 +29,8 @@
{{ sItem.label }}
+ @copy="onCopy(sItem, key)" @change="onSelectChange(key, $event)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
@@ -54,19 +57,23 @@
{{ sItem.label }}
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
+ @copy="onCopy(sItem, key)" @change="onSelectChange(key, $event)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
@@ -80,24 +87,29 @@
{{ sItem.label }}
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
+ @copy="onCopy(sItem, key)" @change="onSelectChange(key, $event)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
其他
+ @copy="onCopy(sItem, key)" :error="errors[sItem.otherCode]" @update:error="errors[sItem.otherCode] = false"
+ :orange-bg="orangeBgFields[sItem.otherCode]" />
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
+ @copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" :error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
+ :orange-bg="orangeBgFields[sItem.subKey]" />
{{ formFields[sItem.subKey] }}
@@ -108,9 +120,11 @@
+ @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
+ :orange-bg="orangeBgFields[key]" />
+ @copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" :error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
+ :orange-bg="orangeBgFields[sItem.subKey]" />
{{ formFields[sItem.subKey] }}
@@ -153,6 +167,7 @@ export default {
formFields: {},//表单绑定字段
allFieldsConfig: {},//包含config的所有字段,主要用于校验表单是否填写
errors: {},//存储表单错误信息,用于标红提示
+ orangeBgFields: {},// 存储需要橙色背景的字段
};
},
watch: {
@@ -394,6 +409,21 @@ export default {
return this.formFields[key];
},
onBlur(key, val) {
+ // compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
+ const currentFieldConfig = this.allFieldsConfig[key];
+ if (currentFieldConfig && currentFieldConfig.fillType === "actFill" && currentFieldConfig.compareTo) {
+ const compareToKey = currentFieldConfig.compareTo;
+ const compareToValue = this.formFields[compareToKey];
+
+ // 比较当前值和compareTo值,如果不相等则设置橙色背景
+ if (val !== compareToValue) {
+ this.$set(this.orangeBgFields, key, true);
+ } else {
+ // 相等则移除橙色背景
+ this.$set(this.orangeBgFields, key, false);
+ }
+ }
+
this.$emit("blur", { key, value: val ,...this.formFields});
},
onSelectChange(key, val) {
@@ -519,7 +549,7 @@ export default {
margin-right: 24px;
}
.sub-select{
- width: auto;
+ width: 100px;
margin-left: 10px;
}
.clickable{
diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue
index 18a1ecf..36e791e 100644
--- a/src/components/Template/CustomTable.vue
+++ b/src/components/Template/CustomTable.vue
@@ -40,21 +40,24 @@
class="body-input" :item="getBodyItem(col, rowIndex)" v-model="row[col.prop]"
@change="onBodyValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.prop)"
- @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
+ @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
+ :orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
+ @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
+ :orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
+ @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
+ :orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
{{ row[col.prop] }}
@@ -66,7 +69,8 @@
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)" v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
- @update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)" />
+ @update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
+ :orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
{{ row[col.bodySubKey] }}
@@ -140,7 +144,8 @@ export default {
return {
localDataSource: [],
headerSelectFields: {},
- formErrors: [] // 表单错误状态管理
+ formErrors: [], // 表单错误状态管理
+ orangeBgCells: {} // 存储需要橙色背景的单元格 {rowIndex-colIndex: true/false}
}
},
watch: {
@@ -338,6 +343,7 @@ export default {
label: col.label,
precision: currentItem[col.bodyPrecisionKey] || col.precision || 0,
copyFrom: col.copyFrom || "",
+ compareTo: col.bodyCompareTo, // 添加 compareTo 字段
};
if (col.bodyDisabled) {
item.disabled = col.bodyDisabled;
@@ -352,6 +358,7 @@ export default {
label: "",
placeholder: col.bodySubPlaceholder || "请输入",
precision: col.subPrecision || 0,
+ compareTo: col.bodySubCompareTo, // 添加 compareTo 字段
}
if (col.bodySubDisabled) {
item.disabled = col.bodySubDisabled;
@@ -402,8 +409,50 @@ export default {
onSubBlur(rowIndex, colKey, value) {
this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] });
},
+ // 检查是否需要橙色背景
+ hasOrangeBg(rowIndex, colIndex, field) {
+ const key = `${rowIndex}-${colIndex}-${field}`;
+ return this.orangeBgCells[key] || false;
+ },
+ // 设置橙色背景状态
+ setOrangeBg(rowIndex, colIndex, field, status) {
+ const key = `${rowIndex}-${colIndex}-${field}`;
+ this.$set(this.orangeBgCells, key, status);
+ },
onBlur(rowIndex, colKey) {
const value = this.localDataSource[rowIndex][colKey];
+
+ // 查找对应的列配置
+ const col = this.columns.find(c => c.prop === colKey);
+ if (col && col.bodyFillType === "actFill" && col.bodyCompareTo) {
+ const compareToValue = this.localDataSource[rowIndex][col.bodyCompareTo];
+
+ // 比较当前值和compareTo值,如果不相等则设置橙色背景
+ if (value !== compareToValue) {
+ this.setOrangeBg(rowIndex, this.columns.findIndex(c => c.prop === colKey), colKey, true);
+ } else {
+ // 相等则移除橙色背景
+ this.setOrangeBg(rowIndex, this.columns.findIndex(c => c.prop === colKey), colKey, false);
+ }
+ }
+
+ this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] });
+ },
+ onSubBlur(rowIndex, colKey, value) {
+ // 查找对应的列配置
+ const col = this.columns.find(c => c.bodySubKey === colKey);
+ if (col && col.bodySubFillType === "actFill" && col.bodySubCompareTo) {
+ const compareToValue = this.localDataSource[rowIndex][col.bodySubCompareTo];
+
+ // 比较当前值和compareTo值,如果不相等则设置橙色背景
+ if (value !== compareToValue) {
+ this.setOrangeBg(rowIndex, this.columns.findIndex(c => c.bodySubKey === colKey), colKey, true);
+ } else {
+ // 相等则移除橙色背景
+ this.setOrangeBg(rowIndex, this.columns.findIndex(c => c.bodySubKey === colKey), colKey, false);
+ }
+ }
+
this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] });
}
}
diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue
index 1baf768..42bf536 100644
--- a/src/components/Template/HandleFormItem.vue
+++ b/src/components/Template/HandleFormItem.vue
@@ -2,31 +2,31 @@
-
-
+
{{ value }}
{{getPlaceholder()}}
@@ -76,6 +76,11 @@ export default {
type: Boolean,
default: false
},
+ // 橙色背景状态
+ orangeBg: {
+ type: Boolean,
+ default: false
+ },
},
data() {
return {
@@ -347,6 +352,15 @@ export default {
border-color: #f56c6c;
}
}
+
+.orange-bg {
+ background-color: #FFF1F1 !important; // 橙色背景,透明度适中
+
+ input, textarea, .el-input__inner, .el-textarea__inner {
+ background-color: #FFF1F1 !important;
+ }
+}
+
.clickable{
cursor: pointer;
width: auto;
diff --git a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
index 4a66cc9..d0fc61e 100644
--- a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
+++ b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
@@ -305,6 +305,7 @@ export default {
bodyType: "inputNumber",
bodyFillType: "actFill",
bodyMaxlength: 10,
+ bodyCompareTo: "targetStartSolutionVolume",//与哪个字段比较
copyFrom: "targetStartSolutionVolume",//复制哪个字段
},
{
@@ -336,6 +337,7 @@ export default {
bodyType: "inputNumber",
bodyFillType: "actFill",
bodyMaxlength: 10,
+ bodyCompareTo: "targetDiluentVolume",//与哪个字段比较
copyFrom: "targetDiluentVolume",//复制哪个字段
},
{
diff --git a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
index d0aa4b0..619e716 100644
--- a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
+++ b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
@@ -183,6 +183,7 @@ export default {
type: "inputNumber",
subType: "select",
subKey: "targetActConcentrationUnit",
+ compareTo: "targetPreConcentration",//与哪个字段比较
fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_nddw'),
@@ -206,6 +207,7 @@ export default {
fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_tjdw'),
+ compareTo: "targetPreVolume",//与哪个字段比较
copyFrom: "targetPreVolume",//复制哪个字段
maxlength:10
},