Browse Source

feat:[模板管理][checkbox-tree]

ouqian
luojie 1 month ago
parent
commit
b8303b7e36
1 changed files with 11 additions and 40 deletions
  1. +11
    -40
      src/components/Template/HandleFormItem.vue

+ 11
- 40
src/components/Template/HandleFormItem.vue View File

@ -67,7 +67,7 @@
</el-checkbox>
<div v-if="(child.value === '样品信息' || child.value === '其他') && isCheckboxTreeChecked(child.value)"
class="checkbox-tree-input-container">
<el-input v-model="inputValue.otherValues[child.value]"
<el-input maxlength = "100" v-model="inputValue.otherValues[child.value]"
placeholder="请输入" @blur="onCheckboxTreeOtherBlur(child.value, $event)" />
</div>
</div>
@ -224,10 +224,8 @@ import Question from "./icons/Question.vue";
import DecimalInput from "./DecimalInput.vue";
import { EventBus } from "@/utils/eventBus";
import moment from "moment";
import { deepClone } from "@/utils/index";
import { getuuid } from "@/utils/index.js";
import { getuuid,isEqual ,deepClone,getDefaultValueByOptions,isValueEmpty} from "@/utils/index.js";
import { getToken } from "@/utils/auth"
import { isValueEmpty, getDefaultValueByOptions } from '@/utils/index.js';
export default {
inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
@ -339,6 +337,7 @@ export default {
currentHandleType: '',//
currentOtherCode: '',//otherCode
currentCheckboxTreeValue: '',//checkboxTree
}
},
watch: {
@ -1169,32 +1168,32 @@ export default {
// checkboxListotherValues
if (this.type === 'checkboxList') {
const current = this.getCheckboxListInfo();
isSame = this.isEqual(current.oldValue, current.newValue);
isSame = isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
} else if (this.type === "checkboxTag") {
// checkboxTagtagIndex
const currentTag = this.checkboxTagList[this.currentTagIndex];
const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {};
isSame = this.isEqual(oldTag.checked, currentTag.checked);
isOldValueEmpty = isValueEmpty(oldTag.checked);
isSame = isEqual(oldTag.checked, currentTag.checked);
isOldValueEmpty = oldTag.checked===undefined;
} else if (this.type === "fqyq") {
const current = this.getFqyqInfo();
isSame = this.isEqual(current.oldValue, current.newValue);
isSame = isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
} else if (this.type === "checkboxTree") {
const current = this.getCheckboxTreeInfo();
const { oldValue, newValue } = current;
if (currentHandleType === "checkboxTreeCheckbox") {
isSame = this.isEqual(oldValue.checked, newValue.checked);
isOldValueEmpty = isValueEmpty(oldValue.checked);
isSame = isEqual(oldValue.checked, newValue.checked);
isOldValueEmpty = oldValue.checked===undefined;
} else {
isSame = this.isEqual(current.oldValue, current.newValue);
isSame = isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
}
} else {
isSame = this.isEqual(this.oldValue, this.inputValue)
isSame = isEqual(this.oldValue, this.inputValue)
isOldValueEmpty = isValueEmpty(this.oldValue);
}
console.log(isSame, isOldValueEmpty, this.currentCheckboxTreeValue, this.oldValue, this.inputValue, "isSame")
@ -1352,17 +1351,6 @@ export default {
})
},
//
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;
},
//
getCommonRecordInfo() {
const { nickName, name } = this.$store.getters;
@ -1385,23 +1373,6 @@ export default {
}
return commonInfo;
},
//
isValueEmpty(value) {
if (value === null || value === undefined || value === '') {
return true;
}
if (typeof value === 'string' && value.trim() === '') {
return true;
}
if (Array.isArray(value) && value.length === 0) {
return true;
}
if (Object.keys(value).length === 0) {
return true;
}
return false;
},
// checkboxListotherCode
isOtherInputError(otherCode) {
if (!this.error) {

Loading…
Cancel
Save