Browse Source

feat:[模板管理][update]

lkf
luojie 3 months ago
parent
commit
fe24eb9538
4 changed files with 31 additions and 19 deletions
  1. +6
    -5
      src/components/Template/BaseInfoFormPcakge.vue
  2. +12
    -14
      src/components/Template/CustomTable.vue
  3. +11
    -0
      src/utils/index.js
  4. +2
    -0
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue

+ 6
- 5
src/components/Template/BaseInfoFormPcakge.vue View File

@ -176,7 +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";
import { isEqual } from "@/utils/index.js";
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
components: { components: {
@ -406,7 +406,7 @@ export default {
compareFieldsIsEqual(currentValue,compareToValue,key) { compareFieldsIsEqual(currentValue,compareToValue,key) {
if(!currentValue || !compareToValue) return; if(!currentValue || !compareToValue) return;
// compareTo // compareTo
if (_.isEqual(currentValue,compareToValue)) {
if (isEqual(currentValue,compareToValue)) {
// //
this.$set(this.orangeBgFields, key, false); this.$set(this.orangeBgFields, key, false);
} else { } else {
@ -524,11 +524,12 @@ export default {
this.$emit("blur", { key, value: val, ...this.formFields }); this.$emit("blur", { key, value: val, ...this.formFields });
}, },
onValueChangeCompareTo(key, val) {
onValueChangeCompareTo(key, val, compKey) {
console.log(key,val,compKey,"compKey")
// compareTo fillType==="actFill"compareToinput // compareTo fillType==="actFill"compareToinput
const currentFieldConfig = this.allFieldsConfig[key]; const currentFieldConfig = this.allFieldsConfig[key];
if (currentFieldConfig && currentFieldConfig.fillType === "actFill" && currentFieldConfig.compareTo) {
const compareToKey = currentFieldConfig.compareTo;
if (currentFieldConfig && currentFieldConfig.fillType === "actFill" && (currentFieldConfig.compareTo || compKey)) {
const compareToKey = compKey || currentFieldConfig.compareTo;
const compareToValue = this.formFields[compareToKey]; const compareToValue = this.formFields[compareToKey];
this.compareFieldsIsEqual(val,compareToValue,key); this.compareFieldsIsEqual(val,compareToValue,key);
} }

+ 12
- 14
src/components/Template/CustomTable.vue View File

@ -141,7 +141,8 @@
</template> </template>
<script> <script>
import HandleFormItem from "./HandleFormItem.vue"
import HandleFormItem from "./HandleFormItem.vue";
import { isEqual } from "@/utils/index.js";
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
name: 'CustomTable', name: 'CustomTable',
@ -450,18 +451,15 @@ export default {
// compareTo // compareTo
this.localDataSource.forEach((row, rowIndex) => { this.localDataSource.forEach((row, rowIndex) => {
this.columns.forEach((col, colIndex) => { this.columns.forEach((col, colIndex) => {
if (col.bodyFillType === "actFill" && col.compareTo) {
const currentValue = row[col.prop];
const currentValue = row[col.prop];
const compareToValue = row[col.compareTo]; 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);
}
if ( col.compareTo && currentValue && compareToValue) {
// compareTo
if (!isEqual(currentValue, compareToValue)) {
this.setOrangeBg(rowIndex, colIndex, col.prop, true);
} else {
//
this.setOrangeBg(rowIndex, colIndex, col.prop, false);
} }
} }
@ -470,9 +468,9 @@ export default {
const currentValue = row[col.bodySubKey]; const currentValue = row[col.bodySubKey];
const compareToValue = row[col.bodySubCompareTo]; const compareToValue = row[col.bodySubCompareTo];
if (currentValue !== undefined && compareToValue !== undefined) {
if (!!currentValue&& !!compareToValue) {
// compareTo // compareTo
if (currentValue !== compareToValue) {
if (!isEqual(currentValue, compareToValue)) {
this.setOrangeBg(rowIndex, colIndex, col.bodySubKey, true); this.setOrangeBg(rowIndex, colIndex, col.bodySubKey, true);
} else { } else {
// //

+ 11
- 0
src/utils/index.js View File

@ -398,3 +398,14 @@ export function caesarDecipher(str) {
return decrypt(atob(str)); return decrypt(atob(str));
} }
//比较值是否相等,不需要比较类型
export const isEqual = (oldValue, nowValue) =>{
if (oldValue === null || nowValue === null) {
return oldValue === nowValue;
}
if (typeof oldValue === 'object' && typeof nowValue === 'object') {
return JSON.stringify(oldValue) === JSON.stringify(nowValue);
}
return oldValue == nowValue;
}

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

@ -332,6 +332,7 @@ export default {
const packageRef = this.$refs[`${ref}${this.currentRowIndex}`][0]; const packageRef = this.$refs[`${ref}${this.currentRowIndex}`][0];
if(currentSubKey === "subStartSolution"){ if(currentSubKey === "subStartSolution"){
packageRef.updateFormData("targetAcSolution", row.nd); packageRef.updateFormData("targetAcSolution", row.nd);
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd,"targetStartSolution");
} }
packageRef.updateFormData(currentSubKey, code); packageRef.updateFormData(currentSubKey, code);
this.currentSubKey = ""; this.currentSubKey = "";
@ -342,6 +343,7 @@ export default {
actStartSolutionCode: code, actStartSolutionCode: code,
targetAcSolution: row.nd, targetAcSolution: row.nd,
}) })
} }
} }
this.$refs.selectReagentDialogRef.onCancel() this.$refs.selectReagentDialogRef.onCancel()

Loading…
Cancel
Save