+
-
-
-
+
{{ row[col.bodySubKey] }}
@@ -161,11 +183,11 @@ export default {
type: String,
default: '',
},
- //循环组件的情况下需要用这个来区分字段
- prefixKey:{
- type: String,
- default: "",
- }
+ //循环组件的情况下需要用这个来区分字段
+ prefixKey: {
+ type: String,
+ default: "",
+ }
},
data() {
return {
@@ -185,10 +207,10 @@ export default {
this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields))
}
},
- localDataSource:{
+ localDataSource: {
immediate: true,
deep: true,
- handler(newVal,oldVal){
+ handler(newVal, oldVal) {
// if(newVal.length == 0){
// return
// }
@@ -200,22 +222,40 @@ export default {
// this.initHeaderSelectValues();
},
methods: {
+ //获取其他下拉框的配置
+ getOtherItem(sItem) {
+ console.log(sItem, "other sItem")
+ return {
+ label: sItem.otherLabel ? this.$t(sItem.otherLabel) : this.$t("template.common.other"),
+ fillType: sItem.bodyFillType,
+ maxlength: sItem.otherMaxlength || 50,
+ parentLabel: sItem.label,
+ type:"input"
+ }
+ },
+ //判断是否显示其他输入框
+ isShowOther(v = []) {
+ // 确保v是数组类型,以避免类型错误
+ const arr = Array.isArray(v) ? v : [v];
+ //和凡哥商量,只要value为负数都显示其他
+ return arr.some(item => item < 0);
+ },
isShowBodySub(col) {
- if(col.hasOwnProperty("disabled")){
+ if (col.hasOwnProperty("disabled")) {
return col.showBodySub
}
return col.bodySubType && col.bodySubKey;
},
// 点击事件
handleClickable(col, rowIndex, colIndex) {
- console.log("clickable",rowIndex,colIndex, col)
- if (this.templateFillType !== 'actFill') {
- // return
- }
- this.$emit("clickable", col,rowIndex)
+ console.log("clickable", rowIndex, colIndex, col)
+ if (this.templateFillType !== 'actFill') {
+ // return
+ }
+ this.$emit("clickable", col, rowIndex)
},
isShowAddRos() {
- if(this.showAddRow !== undefined){
+ if (this.showAddRow !== undefined) {
return this.showAddRow
}
return this.templateFillType === 'preFill';
@@ -244,9 +284,9 @@ export default {
// 直接获取表单数据,不做校验
getFilledFormData() {
return {
- stepTableFormData: [...this.localDataSource],
- headerSelectFields: this.headerSelectFields,
- };
+ stepTableFormData: [...this.localDataSource],
+ headerSelectFields: this.headerSelectFields,
+ };
},
// 获取最新数据
getFormData() {
@@ -301,7 +341,7 @@ export default {
if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) {
// 检查主字段
const mainValue = row[col.prop];
- if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType!=='span') {
+ if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span') {
const errorItem = {
rowIndex,
colIndex,
@@ -314,7 +354,7 @@ export default {
}
// 检查子字段(如果有)
- if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType!=='span') {
+ if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span') {
const subValue = row[col.bodySubKey];
console.log(col, subValue, "subValue")
if (this.isValueEmpty(subValue)) {
@@ -329,10 +369,27 @@ export default {
this.formErrors.push(errorItem);
}
}
+ // 检查其他输入框
+ if (col.otherCode) {
+ const otherValue = row[col.otherCode];
+
+ if (this.isValueEmpty(otherValue)) {
+ const errorItem = {
+ rowIndex,
+ colIndex,
+ field: col.bodySubKey,
+ label: `${this.$t(col.label)}单位`,
+ error: `请填写${this.$t(col.otherLabel) ? this.$t(col.otherLabel) : '其他'}信息`
+ };
+ errors.push(errorItem);
+ this.formErrors.push(errorItem);
+ }
+ }
+
}
});
});
- console.log(errors,this.localDataSource,"errors")
+ console.log(errors, this.localDataSource, "errors")
return {
valid: errors.length === 0,
errors: errors
@@ -398,7 +455,7 @@ export default {
options: col.bodyOptions,
maxlength: col.bodyMaxlength,
label: this.$t(col.label),
- precision: currentItem[col.bodyPrecisionKey] || col.precision ,
+ precision: currentItem[col.bodyPrecisionKey] || col.precision,
copyFrom: col.copyFrom || "",
compareTo: col.bodyCompareTo, // 添加 compareTo 字段
type: col.bodyType || "input",
@@ -436,10 +493,10 @@ export default {
},
onAddRow() {
this.addRow({
- actSolutionVolumePrecision: 3,//小数点精度默认为3
- actSolutionConcentrationPrecision: 3,//小数点精度默认为3
- targetDiluentVolumePrecision: 3,//小数点精度默认为3
- targetStartSolutionVolumePrecision: 3,//小数点精度默认为3
+ actSolutionVolumePrecision: 3,//小数点精度默认为3
+ actSolutionConcentrationPrecision: 3,//小数点精度默认为3
+ targetDiluentVolumePrecision: 3,//小数点精度默认为3
+ targetStartSolutionVolumePrecision: 3,//小数点精度默认为3
});
},
// 添加行
@@ -487,12 +544,12 @@ export default {
},
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);
@@ -501,7 +558,7 @@ export default {
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) {
@@ -509,7 +566,7 @@ export default {
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);
@@ -518,7 +575,7 @@ export default {
this.setOrangeBg(rowIndex, this.columns.findIndex(c => c.bodySubKey === colKey), colKey, false);
}
}
-
+
this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] });
}
}
@@ -664,10 +721,20 @@ export default {
padding: 20px 0;
margin-top: 20px;
}
+
.flex1 {
flex: 1;
}
-.flex{
+
+.flex {
display: flex;
}
+
+.other-title {
+ text-align: right;
+ margin: 0 10px;
+ font-size: 14px;
+ font-weight: normal;
+ color: #606266;
+}
\ No newline at end of file
diff --git a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
index ac19ada..98fb46e 100644
--- a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
+++ b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
@@ -150,10 +150,16 @@ export const getParallelColumnsConfig = ($this) => {
label: '目标溶液编号',
prop: 'targetSolutionCode',
bodyType: 'select',
- bodyOptions: $this.getDictOptions('business_sp_jmdyzqdyp'),
+ bodyOptions: [
+ {label: '目标溶液1',value:'目标溶液1'},
+ {label: '目标溶液2',value:'目标溶液2'},
+ {label: '其他',value:-1},
+
+ ],
subType: 'span',
subKey: 'subTargetSolutionCode',
bodyFillType: 'preFill',
+ otherCode: 'targetSolutionCodeOther',
width: 280
},
{