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>
import HandleFormItem from "./HandleFormItem.vue";
import LineLabel from "./LineLabel.vue";
import _ from "lodash";
export default {
inject: ['templateFillType'],
components: {
@ -379,7 +380,15 @@ export default {
} else {
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.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() {
const { item } = this;
@ -500,34 +520,28 @@ export default {
},
onBlur(key, val) {
// 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];
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.compareFieldsIsEqual(val,compareToValue,key);
}
this.$emit("blur", { key, value: val, ...this.formFields });
},
onSelectChange(key, val) {
//
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.$emit("select", { key, value: val });
//
if (this.errors[key]) {

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

@ -205,7 +205,10 @@ export default {
handler(newData) {
const { stepTableFormData = [], headerSelectFields = {} } = newData;
this.updateDataSource(stepTableFormData);
this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields))
this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields));
// compareTo
this.checkCompareToOnDataLoad();
}
},
localDataSource: {
@ -424,10 +427,71 @@ export default {
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) {
const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.prop] = value;
// compareTo
this.checkCompareToLogic(rowIndex, colIndex, col.prop, value);
//
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
@ -440,6 +504,20 @@ export default {
onBodySubValueChange(rowIndex, colIndex, value) {
const col = this.columns[colIndex];
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 =>
!(error.rowIndex === rowIndex &&
@ -464,7 +542,7 @@ export default {
label: this.$t(col.label),
precision: currentItem[col.bodyPrecisionKey] || col.precision,
copyFrom: col.copyFrom || "",
compareTo: col.bodyCompareTo, // compareTo
compareTo: col.compareTo, // compareTo
type: col.bodyType || "input",
};
if (col.bodyDisabled) {
@ -555,8 +633,8 @@ export default {
//
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
if (value !== compareToValue) {

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

@ -352,7 +352,7 @@ export default {
const o = records[0];
if (!o.reply && templateFillType == 'qc') {//qc
content = o.content;
} else if (!o.content && templateFillType == 'actFill') {//qc
} else if (templateFillType == 'actFill') {//qc
content = o.reply;
}
}
@ -367,9 +367,6 @@ export default {
} else if (!this.error && isEmpty) {
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);
if(isSame){
@ -395,6 +392,7 @@ export default {
//
handleUpdateRecord(data) {
const baseInfo = this.getCommonRecordInfo();
if(!this.oldValue && !this.inputValue) return;
const record = {
...baseInfo,
oldValue: this.oldValue,

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

@ -303,7 +303,7 @@ export default {
bodyType: "inputNumber",
bodyFillType: "actFill",
bodyMaxlength: 10,
bodyCompareTo: "targetStartSolutionVolume",//
compareTo: "targetStartSolutionVolume",//
copyFrom: "targetStartSolutionVolume",//
},
{
@ -334,7 +334,7 @@ export default {
bodyType: "inputNumber",
bodyFillType: "actFill",
bodyMaxlength: 10,
bodyCompareTo: "targetDiluentVolume",//
compareTo: "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',
type: "input",
fillType: "actFill",
prepend:"V",
maxlength: 50
},
//
@ -168,6 +169,7 @@ export default {
type: "select",
fillType: "actFill",
otherCode: "actOther",
compareTo: "pre",
multiple: true,
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",
otherCode: "actOther",
multiple: true,
compareTo: "pre",
options: this.getDictOptions('business_pztj')
}
}
@ -181,7 +182,8 @@ export default {
subKey: "targetPreConcentrationUnit",
fillType: "preFill",
subOptions: this.getDictOptions('business_nddw'),
maxlength: 10
maxlength: 10,
selectTo:"targetActConcentrationUnit",//
},
targetActConcentration: {
label: 'template.common.targetActConcentration',
@ -202,7 +204,8 @@ export default {
subKey: "targetPreVolumeUnit",
subOptions: this.getDictOptions('business_tjdw'),
fillType: "preFill",
maxlength: 10
maxlength: 10,
selectTo:"targetActVolumeUnit",//
},
targetActVolume: {
label: 'template.common.targetActVolume',

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

@ -90,6 +90,7 @@
</template>
<script>
import { EventBus } from "@/utils/eventBus";
import BaseInfoFormPcakge from "@/components/Template/BaseInfoFormPcakge";
import LineLabel from "@/components/Template/LineLabel";
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',
bodyFillType: 'actFill',
bodyMaxlength: 10,
bodyCompareTo: 'yjryxql',
compareTo: 'yjryxql',
copyFrom: 'yjryxql'
},
{
@ -80,7 +80,7 @@ export const getSWYPFXFFXYPZBBTableConfig = (
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10,
bodyCompareTo: 'yjjzxql',
compareTo: 'yjjzxql',
copyFrom: 'yjjzxql'
},
{
@ -155,7 +155,7 @@ export const getSWYPFXFFXYPZBBTQHSLTableConfig = ($this, selectKey) => {
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10,
bodyCompareTo: 'yjryxql',
compareTo: 'yjryxql',
copyFrom: 'yjryxql'
},
{
@ -179,7 +179,7 @@ export const getSWYPFXFFXYPZBBTQHSLTableConfig = ($this, selectKey) => {
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10,
bodyCompareTo: 'yjgzyxql',
compareTo: 'yjgzyxql',
copyFrom: 'yjgzyxql'
},
{
@ -203,7 +203,7 @@ export const getSWYPFXFFXYPZBBTQHSLTableConfig = ($this, selectKey) => {
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10,
bodyCompareTo: 'yjxsyxql',
compareTo: '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',
bodyFillType: 'actFill',
bodyMaxlength: 10,
copyFrom: 'targetStartSolutionVolume' //复制哪个字段
copyFrom: 'targetStartSolutionVolume', //复制哪个字段
compareTo: 'targetStartSolutionVolume' //比较哪个字段
},
{
label: '预设稀释液体积',
@ -77,7 +78,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10,
copyFrom: 'targetDiluentVolume' //复制哪个字段
copyFrom: 'targetDiluentVolume', //复制哪个字段
compareTo: 'targetDiluentVolume', //比较哪个字段
},
{
label: '预设目标溶液浓度',
@ -107,8 +109,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyPrecisionKey: 'actSolutionConcentrationPrecision',
bodyMaxlength: 10,
copyFrom: 'targetSolutionConcentration', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionConcentration', //比较哪个字段
},
{
label: '预设目标溶液体积',
@ -139,7 +141,8 @@ export const getLadderColumnsConfig = ($this) => {
bodyPrecisionKey: 'actSolutionVolumePrecision',
bodyMaxlength: 10,
copyFrom: 'targetSolutionVolume', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionVolume', //比较哪个字段
}
]
}
@ -183,8 +186,8 @@ export const getParallelColumnsConfig = ($this) => {
showBodySub: $this.fillType === 'preFill',
bodyPrecisionKey: 'actSolutionConcentrationPrecision',
bodyMaxlength: 10,
copyFrom: 'targetSolutionConcentration', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionConcentration', //比较哪个字段
},
{
label: '预设目标溶液体积',
@ -211,11 +214,10 @@ export const getParallelColumnsConfig = ($this) => {
bodyFillType: 'actFill',
bodySubFillType: 'preFill',
showBodySub: $this.fillType === 'preFill',
bodyPrecisionKey: 'actSolutionVolumePrecision',
bodyMaxlength: 10,
copyFrom: 'targetSolutionVolume', //复制哪个字段
bodySubPlaceholder: '请输入保留小数位数'
bodySubPlaceholder: '请输入保留小数位数',
compareTo: 'targetSolutionVolume', //比较哪个字段
},
{
label: '目标溶液有效周期',
@ -249,7 +251,8 @@ export const getParallelColumnsConfig = ($this) => {
prop: 'actStartSolutionCode',
width: 280,
bodyType: 'clickable',
bodyFillType: 'actFill'
bodyFillType: 'actFill',
compareTo: 'startSolutionCode', //比较哪个字段
},
{
label: '预设原始溶液浓度',
@ -270,7 +273,8 @@ export const getParallelColumnsConfig = ($this) => {
width: 280,
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyDisabled: true
bodyDisabled: true,
compareTo: 'targetStartSolutionConcentration', //比较哪个字段
},
{
label: '预设原始溶液体积',
@ -302,7 +306,9 @@ export const getParallelColumnsConfig = ($this) => {
width: 280,
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10
bodyMaxlength: 10,
compareTo: 'targetStartSolutionVolume', //比较哪个字段
copyFrom: 'targetStartSolutionVolume' //复制哪个字段
},
{
@ -332,7 +338,8 @@ export const getParallelColumnsConfig = ($this) => {
width: 280,
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyMaxlength: 10
bodyMaxlength: 10,
compareTo: 'targetDiluentVolume' //比较哪个字段
}
]
}
@ -366,7 +373,8 @@ export const getLadderFormConfig = ($this) => {
type: 'input',
fillType: 'actFill',
disabled: true,
maxlength: 10
maxlength: 10,
compareTo: 'targetStartSolution', //比较哪个字段
},
solution: {
label: '稀释液',

Loading…
Cancel
Save