Browse Source

feat:[模板管理][update]

lkf
luojie 3 months ago
parent
commit
98ec06f3f6
9 changed files with 155 additions and 51 deletions
  1. +33
    -19
      src/components/Template/BaseInfoFormPcakge.vue
  2. +82
    -4
      src/components/Template/CustomTable.vue
  3. +2
    -4
      src/components/Template/HandleFormItem.vue
  4. +2
    -2
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  5. +2
    -0
      src/views/business/comps/template/comps/sp/SWYPFXFFXZKPZB.vue
  6. +5
    -2
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  7. +1
    -0
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue
  8. +5
    -5
      src/views/business/comps/template/formConfig/SWYPFXFFXYPZBBTableConfig.js
  9. +23
    -15
      src/views/business/comps/template/formConfig/paralleAndLadderConfig.js

+ 33
- 19
src/components/Template/BaseInfoFormPcakge.vue View File

@ -176,6 +176,7 @@
<script> <script>
import HandleFormItem from "./HandleFormItem.vue"; import HandleFormItem from "./HandleFormItem.vue";
import LineLabel from "./LineLabel.vue"; import LineLabel from "./LineLabel.vue";
import _ from "lodash";
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
components: { components: {
@ -379,7 +380,15 @@ export default {
} else { } else {
result[subKey] = formData[subKey] || formFields[subKey] || ''; result[subKey] = formData[subKey] || formFields[subKey] || '';
} }
config[subKey] = { label: currentConfig.label, subKey, type: currentConfig.subType, fillType: currentConfig.subFillType || currentConfig.fillType }
config[subKey] = { label: currentConfig.label, subKey, type: currentConfig.subType, fillType: currentConfig.subFillType || currentConfig.fillType, selectTo: currentConfig.selectTo }
}
// compareTo
if (currentConfig.compareTo && formData[currentConfig.compareTo] && result[key]) {
const compareToValue = formData[currentConfig.compareTo];
const currentValue = result[key];
this.compareFieldsIsEqual(currentValue,compareToValue,key)
} }
}); });
@ -393,6 +402,17 @@ export default {
this.formFields = result; this.formFields = result;
this.allFieldsConfig = config; this.allFieldsConfig = config;
}, },
//
compareFieldsIsEqual(currentValue,compareToValue,key) {
if(!currentValue || !compareToValue) return;
// compareTo
if (_.isEqual(currentValue,compareToValue)) {
//
this.$set(this.orangeBgFields, key, false);
} else {
this.$set(this.orangeBgFields, key, true);
}
},
// //
getDisabled() { getDisabled() {
const { item } = this; const { item } = this;
@ -500,34 +520,28 @@ export default {
}, },
onBlur(key, val) { onBlur(key, val) {
// compareTo fillType==="actFill"compareToinput // compareTo fillType==="actFill"compareToinput
this.onValueChangeCompareTo(key, val);
this.$emit("blur", { key, value: val, ...this.formFields });
},
onValueChangeCompareTo(key, val) {
// compareTo fillType==="actFill"compareToinput
const currentFieldConfig = this.allFieldsConfig[key]; const currentFieldConfig = this.allFieldsConfig[key];
if (currentFieldConfig && currentFieldConfig.fillType === "actFill" && currentFieldConfig.compareTo) { if (currentFieldConfig && currentFieldConfig.fillType === "actFill" && currentFieldConfig.compareTo) {
const compareToKey = currentFieldConfig.compareTo; const compareToKey = currentFieldConfig.compareTo;
const compareToValue = this.formFields[compareToKey]; const compareToValue = this.formFields[compareToKey];
// compareTo
if (val !== compareToValue) {
this.$set(this.orangeBgFields, key, true);
} else {
//
this.$set(this.orangeBgFields, key, false);
}
this.compareFieldsIsEqual(val,compareToValue,key);
} }
this.$emit("blur", { key, value: val, ...this.formFields });
}, },
onSelectChange(key, val) { onSelectChange(key, val) {
// //
const currentConfig = this.allFieldsConfig[key]; const currentConfig = this.allFieldsConfig[key];
// //
// if (currentConfig && currentConfig.multiple) {
// //
// this.formFields[key] = Array.isArray(val) ? val : (val ? [val] : []);
// } else {
//
console.log(currentConfig,"currentConfig")
if(currentConfig.selectTo){
this.formFields[currentConfig.selectTo] = val;
}
this.onValueChangeCompareTo(key, val);
this.formFields[key] = val; this.formFields[key] = val;
// }
this.$emit("select", { key, value: val }); this.$emit("select", { key, value: val });
// //
if (this.errors[key]) { if (this.errors[key]) {

+ 82
- 4
src/components/Template/CustomTable.vue View File

@ -205,7 +205,10 @@ export default {
handler(newData) { handler(newData) {
const { stepTableFormData = [], headerSelectFields = {} } = newData; const { stepTableFormData = [], headerSelectFields = {} } = newData;
this.updateDataSource(stepTableFormData); this.updateDataSource(stepTableFormData);
this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields))
this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields));
// compareTo
this.checkCompareToOnDataLoad();
} }
}, },
localDataSource: { localDataSource: {
@ -424,10 +427,71 @@ export default {
error.field === col.headerSelectKey) error.field === col.headerSelectKey)
); );
}, },
// compareTo
checkCompareToLogic(rowIndex, colIndex, colKey, value) {
const col = this.columns[colIndex];
// compareTo
if (col && col.bodyFillType === "actFill" && col.compareTo) {
const compareToValue = this.localDataSource[rowIndex][col.compareTo];
// compareTo
if (value !== compareToValue) {
this.setOrangeBg(rowIndex, colIndex, colKey, true);
} else {
//
this.setOrangeBg(rowIndex, colIndex, colKey, false);
}
}
},
// compareTo
checkCompareToOnDataLoad() {
// compareTo
this.localDataSource.forEach((row, rowIndex) => {
this.columns.forEach((col, colIndex) => {
if (col.bodyFillType === "actFill" && col.compareTo) {
const currentValue = row[col.prop];
const compareToValue = row[col.compareTo];
if (currentValue !== undefined && compareToValue !== undefined) {
// compareTo
if (currentValue !== compareToValue) {
this.setOrangeBg(rowIndex, colIndex, col.prop, true);
} else {
//
this.setOrangeBg(rowIndex, colIndex, col.prop, false);
}
}
}
// compareTo
if (col.bodySubFillType === "actFill" && col.bodySubCompareTo) {
const currentValue = row[col.bodySubKey];
const compareToValue = row[col.bodySubCompareTo];
if (currentValue !== undefined && compareToValue !== undefined) {
// compareTo
if (currentValue !== compareToValue) {
this.setOrangeBg(rowIndex, colIndex, col.bodySubKey, true);
} else {
//
this.setOrangeBg(rowIndex, colIndex, col.bodySubKey, false);
}
}
}
});
});
},
// //
onBodyValueChange(rowIndex, colIndex, value) { onBodyValueChange(rowIndex, colIndex, value) {
const col = this.columns[colIndex]; const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.prop] = value; this.localDataSource[rowIndex][col.prop] = value;
// compareTo
this.checkCompareToLogic(rowIndex, colIndex, col.prop, value);
// //
this.formErrors = this.formErrors.filter(error => this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex && !(error.rowIndex === rowIndex &&
@ -440,6 +504,20 @@ export default {
onBodySubValueChange(rowIndex, colIndex, value) { onBodySubValueChange(rowIndex, colIndex, value) {
const col = this.columns[colIndex]; const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.bodySubKey] = value; this.localDataSource[rowIndex][col.bodySubKey] = value;
// compareTo
if (col && col.bodySubFillType === "actFill" && col.bodySubCompareTo) {
const compareToValue = this.localDataSource[rowIndex][col.bodySubCompareTo];
// compareTo
if (value !== compareToValue) {
this.setOrangeBg(rowIndex, colIndex, col.bodySubKey, true);
} else {
//
this.setOrangeBg(rowIndex, colIndex, col.bodySubKey, false);
}
}
// //
this.formErrors = this.formErrors.filter(error => this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex && !(error.rowIndex === rowIndex &&
@ -464,7 +542,7 @@ export default {
label: this.$t(col.label), label: this.$t(col.label),
precision: currentItem[col.bodyPrecisionKey] || col.precision, precision: currentItem[col.bodyPrecisionKey] || col.precision,
copyFrom: col.copyFrom || "", copyFrom: col.copyFrom || "",
compareTo: col.bodyCompareTo, // compareTo
compareTo: col.compareTo, // compareTo
type: col.bodyType || "input", type: col.bodyType || "input",
}; };
if (col.bodyDisabled) { if (col.bodyDisabled) {
@ -555,8 +633,8 @@ export default {
// //
const col = this.columns.find(c => c.prop === colKey); const col = this.columns.find(c => c.prop === colKey);
if (col && col.bodyFillType === "actFill" && col.bodyCompareTo) {
const compareToValue = this.localDataSource[rowIndex][col.bodyCompareTo];
if (col && col.bodyFillType === "actFill" && col.compareTo) {
const compareToValue = this.localDataSource[rowIndex][col.compareTo];
// compareTo // compareTo
if (value !== compareToValue) { if (value !== compareToValue) {

+ 2
- 4
src/components/Template/HandleFormItem.vue View File

@ -352,7 +352,7 @@ export default {
const o = records[0]; const o = records[0];
if (!o.reply && templateFillType == 'qc') {//qc if (!o.reply && templateFillType == 'qc') {//qc
content = o.content; content = o.content;
} else if (!o.content && templateFillType == 'actFill') {//qc
} else if (templateFillType == 'actFill') {//qc
content = o.reply; content = o.reply;
} }
} }
@ -367,9 +367,6 @@ export default {
} else if (!this.error && isEmpty) { } else if (!this.error && isEmpty) {
this.$emit('update:error', true); this.$emit('update:error', true);
} }
console.log(this.oldValue,this.inputValue,"onCommonHandleSaveRecord")
//
console.log(this.oldValue,this.in)
// //
const isSame = this.isEqual(this.oldValue, this.inputValue); const isSame = this.isEqual(this.oldValue, this.inputValue);
if(isSame){ if(isSame){
@ -395,6 +392,7 @@ export default {
// //
handleUpdateRecord(data) { handleUpdateRecord(data) {
const baseInfo = this.getCommonRecordInfo(); const baseInfo = this.getCommonRecordInfo();
if(!this.oldValue && !this.inputValue) return;
const record = { const record = {
...baseInfo, ...baseInfo,
oldValue: this.oldValue, oldValue: this.oldValue,

+ 2
- 2
src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue View File

@ -303,7 +303,7 @@ export default {
bodyType: "inputNumber", bodyType: "inputNumber",
bodyFillType: "actFill", bodyFillType: "actFill",
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: "targetStartSolutionVolume",//
compareTo: "targetStartSolutionVolume",//
copyFrom: "targetStartSolutionVolume",// copyFrom: "targetStartSolutionVolume",//
}, },
{ {
@ -334,7 +334,7 @@ export default {
bodyType: "inputNumber", bodyType: "inputNumber",
bodyFillType: "actFill", bodyFillType: "actFill",
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: "targetDiluentVolume",//
compareTo: "targetDiluentVolume",//
copyFrom: "targetDiluentVolume",// copyFrom: "targetDiluentVolume",//
}, },
{ {

+ 2
- 0
src/views/business/comps/template/comps/sp/SWYPFXFFXZKPZB.vue View File

@ -139,6 +139,7 @@ export default {
label: 'template.common.versionNumber', label: 'template.common.versionNumber',
type: "input", type: "input",
fillType: "actFill", fillType: "actFill",
prepend:"V",
maxlength: 50 maxlength: 50
}, },
// //
@ -168,6 +169,7 @@ export default {
type: "select", type: "select",
fillType: "actFill", fillType: "actFill",
otherCode: "actOther", otherCode: "actOther",
compareTo: "pre",
multiple: true, multiple: true,
options: this.getDictOptions('business_pztj') options: this.getDictOptions('business_pztj')
} }

+ 5
- 2
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -135,6 +135,7 @@ export default {
fillType: "actFill", fillType: "actFill",
otherCode: "actOther", otherCode: "actOther",
multiple: true, multiple: true,
compareTo: "pre",
options: this.getDictOptions('business_pztj') options: this.getDictOptions('business_pztj')
} }
} }
@ -181,7 +182,8 @@ export default {
subKey: "targetPreConcentrationUnit", subKey: "targetPreConcentrationUnit",
fillType: "preFill", fillType: "preFill",
subOptions: this.getDictOptions('business_nddw'), subOptions: this.getDictOptions('business_nddw'),
maxlength: 10
maxlength: 10,
selectTo:"targetActConcentrationUnit",//
}, },
targetActConcentration: { targetActConcentration: {
label: 'template.common.targetActConcentration', label: 'template.common.targetActConcentration',
@ -202,7 +204,8 @@ export default {
subKey: "targetPreVolumeUnit", subKey: "targetPreVolumeUnit",
subOptions: this.getDictOptions('business_tjdw'), subOptions: this.getDictOptions('business_tjdw'),
fillType: "preFill", fillType: "preFill",
maxlength: 10
maxlength: 10,
selectTo:"targetActVolumeUnit",//
}, },
targetActVolume: { targetActVolume: {
label: 'template.common.targetActVolume', label: 'template.common.targetActVolume',

+ 1
- 0
src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue View File

@ -90,6 +90,7 @@
</template> </template>
<script> <script>
import { EventBus } from "@/utils/eventBus";
import BaseInfoFormPcakge from "@/components/Template/BaseInfoFormPcakge"; import BaseInfoFormPcakge from "@/components/Template/BaseInfoFormPcakge";
import LineLabel from "@/components/Template/LineLabel"; import LineLabel from "@/components/Template/LineLabel";
import TableList from "@/components/Template/Table"; import TableList from "@/components/Template/Table";

+ 5
- 5
src/views/business/comps/template/formConfig/SWYPFXFFXYPZBBTableConfig.js View File

@ -56,7 +56,7 @@ export const getSWYPFXFFXYPZBBTableConfig = (
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: 'yjryxql',
compareTo: 'yjryxql',
copyFrom: 'yjryxql' copyFrom: 'yjryxql'
}, },
{ {
@ -80,7 +80,7 @@ export const getSWYPFXFFXYPZBBTableConfig = (
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: 'yjjzxql',
compareTo: 'yjjzxql',
copyFrom: 'yjjzxql' copyFrom: 'yjjzxql'
}, },
{ {
@ -155,7 +155,7 @@ export const getSWYPFXFFXYPZBBTQHSLTableConfig = ($this, selectKey) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: 'yjryxql',
compareTo: 'yjryxql',
copyFrom: 'yjryxql' copyFrom: 'yjryxql'
}, },
{ {
@ -179,7 +179,7 @@ export const getSWYPFXFFXYPZBBTQHSLTableConfig = ($this, selectKey) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: 'yjgzyxql',
compareTo: 'yjgzyxql',
copyFrom: 'yjgzyxql' copyFrom: 'yjgzyxql'
}, },
{ {
@ -203,7 +203,7 @@ export const getSWYPFXFFXYPZBBTQHSLTableConfig = ($this, selectKey) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
bodyCompareTo: 'yjxsyxql',
compareTo: 'yjxsyxql',
copyFrom: 'yjxsyxql' copyFrom: 'yjxsyxql'
}, },
{ {

+ 23
- 15
src/views/business/comps/template/formConfig/paralleAndLadderConfig.js View File

@ -46,7 +46,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetStartSolutionVolume' //复制哪个字段
copyFrom: 'targetStartSolutionVolume', //复制哪个字段
compareTo: 'targetStartSolutionVolume' //比较哪个字段
}, },
{ {
label: '预设稀释液体积', label: '预设稀释液体积',
@ -77,7 +78,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetDiluentVolume' //复制哪个字段
copyFrom: 'targetDiluentVolume', //复制哪个字段
compareTo: 'targetDiluentVolume', //比较哪个字段
}, },
{ {
label: '预设目标溶液浓度', label: '预设目标溶液浓度',
@ -107,8 +109,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyPrecisionKey: 'actSolutionConcentrationPrecision', bodyPrecisionKey: 'actSolutionConcentrationPrecision',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetSolutionConcentration', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionConcentration', //比较哪个字段
}, },
{ {
label: '预设目标溶液体积', label: '预设目标溶液体积',
@ -139,7 +141,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyPrecisionKey: 'actSolutionVolumePrecision', bodyPrecisionKey: 'actSolutionVolumePrecision',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetSolutionVolume', //复制哪个字段 copyFrom: 'targetSolutionVolume', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionVolume', //比较哪个字段
} }
] ]
} }
@ -183,8 +186,8 @@ export const getParallelColumnsConfig = ($this) => {
showBodySub: $this.fillType === 'preFill', showBodySub: $this.fillType === 'preFill',
bodyPrecisionKey: 'actSolutionConcentrationPrecision', bodyPrecisionKey: 'actSolutionConcentrationPrecision',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetSolutionConcentration', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionConcentration', //比较哪个字段
}, },
{ {
label: '预设目标溶液体积', label: '预设目标溶液体积',
@ -211,11 +214,10 @@ export const getParallelColumnsConfig = ($this) => {
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodySubFillType: 'preFill', bodySubFillType: 'preFill',
showBodySub: $this.fillType === 'preFill', showBodySub: $this.fillType === 'preFill',
bodyPrecisionKey: 'actSolutionVolumePrecision', bodyPrecisionKey: 'actSolutionVolumePrecision',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetSolutionVolume', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionVolume', //比较哪个字段
}, },
{ {
label: '目标溶液有效周期', label: '目标溶液有效周期',
@ -249,7 +251,8 @@ export const getParallelColumnsConfig = ($this) => {
prop: 'actStartSolutionCode', prop: 'actStartSolutionCode',
width: 280, width: 280,
bodyType: 'clickable', bodyType: 'clickable',
bodyFillType: 'actFill'
bodyFillType: 'actFill',
compareTo: 'startSolutionCode', //比较哪个字段
}, },
{ {
label: '预设原始溶液浓度', label: '预设原始溶液浓度',
@ -270,7 +273,8 @@ export const getParallelColumnsConfig = ($this) => {
width: 280, width: 280,
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyDisabled: true
bodyDisabled: true,
compareTo: 'targetStartSolutionConcentration', //比较哪个字段
}, },
{ {
label: '预设原始溶液体积', label: '预设原始溶液体积',
@ -302,7 +306,9 @@ export const getParallelColumnsConfig = ($this) => {
width: 280, width: 280,
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10
bodyMaxlength: 10,
compareTo: 'targetStartSolutionVolume', //比较哪个字段
copyFrom: 'targetStartSolutionVolume' //复制哪个字段
}, },
{ {
@ -332,7 +338,8 @@ export const getParallelColumnsConfig = ($this) => {
width: 280, width: 280,
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10
bodyMaxlength: 10,
compareTo: 'targetDiluentVolume' //比较哪个字段
} }
] ]
} }
@ -366,7 +373,8 @@ export const getLadderFormConfig = ($this) => {
type: 'input', type: 'input',
fillType: 'actFill', fillType: 'actFill',
disabled: true, disabled: true,
maxlength: 10
maxlength: 10,
compareTo: 'targetStartSolution', //比较哪个字段
}, },
solution: { solution: {
label: '稀释液', label: '稀释液',

Loading…
Cancel
Save