|
|
|
@ -72,13 +72,20 @@ |
|
|
|
</div> |
|
|
|
<div v-else-if="type === 'radioTree'" class="flex1 radio-tree-container" |
|
|
|
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '') + (error ? ' form-error-border' : '') + (item.noBorder ? ' no-border' : '') + (item.layout === 'horizontal' ? ' flex' : '')"> |
|
|
|
<el-radio-group v-model="inputValue" :disabled="getDisabled()" @change="onRadioTreeChange"> |
|
|
|
<el-radio-group v-model="inputValue.checkedValues" :disabled="getDisabled()" @input="onRadioTreeChange"> |
|
|
|
<div v-for="option in item.options" :key="option.value" class="radio-tree-item"> |
|
|
|
<el-radio :label="option.value"> |
|
|
|
{{ option.label }} |
|
|
|
</el-radio> |
|
|
|
<div v-if="isShowOtherByCheckboxTree(option.value) && inputValue.checkedValues === option.value" |
|
|
|
class="checkbox-tree-input-container"> |
|
|
|
<el-input maxlength="100" v-model="inputValue.otherValues[option.value]" |
|
|
|
:disabled="getDisabled()" placeholder="请输入" |
|
|
|
@blur="onCheckboxTreeOtherBlur(option.value, $event)" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</div> |
|
|
|
<el-date-picker v-else-if="type === 'dateTime' || type === 'datePicker'" |
|
|
|
:type="type === 'dateTime' ? 'datetime' : 'date'" class="flex1" |
|
|
|
@ -305,9 +312,11 @@ export default { |
|
|
|
})); |
|
|
|
} else if (this.type === 'fqyq' && !this.value) { |
|
|
|
initialValue = { mainRadio: '', subRadio: '', inputValue: "" }; |
|
|
|
} else if (this.type === 'checkboxTree' && !this.value) { |
|
|
|
} else if ((this.type === 'checkboxTree') && !this.value) { |
|
|
|
const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []); |
|
|
|
initialValue = { checkedValues: defaultCheckedValue, otherValues: {} }; |
|
|
|
} else if ((this.type === 'radioTree') && !this.value) { |
|
|
|
initialValue = { checkedValues: "", otherValues: {} }; |
|
|
|
} |
|
|
|
const { type } = this; |
|
|
|
return { |
|
|
|
@ -748,7 +757,7 @@ export default { |
|
|
|
}, |
|
|
|
getFillTypeStyle(type) { |
|
|
|
const { fillType } = this.item; |
|
|
|
const filterType = ["attachment", "checkboxTag", "fqyq", "checkboxTree", "radio"] |
|
|
|
const filterType = ["attachment", "checkboxTag", "fqyq", "checkboxTree", "radio","radioTree"] |
|
|
|
const typeObj = { |
|
|
|
actFill: "orange-border",//实际填写的边框颜色 |
|
|
|
blxjsh: "orange-border",//实际填写的边框颜色 |
|
|
|
@ -863,7 +872,9 @@ export default { |
|
|
|
this.onCommonHandleSaveRecord(this.inputValue); |
|
|
|
}, |
|
|
|
onRadioTreeChange(val) { |
|
|
|
this.inputValue = val; |
|
|
|
this.inputValue.checkedValues = val; |
|
|
|
this.currentHandleType = 'checkboxTreeCheckbox'; |
|
|
|
this.currentCheckboxTreeValue = val; |
|
|
|
this.onCommonHandleSaveRecord(this.inputValue); |
|
|
|
}, |
|
|
|
// 下拉框失去焦点处理 |
|
|
|
@ -1126,6 +1137,16 @@ export default { |
|
|
|
} |
|
|
|
return o[currentHandleType]; |
|
|
|
}, |
|
|
|
getRadioTreeInfo() { |
|
|
|
const { checkedValues, otherValues } = this.inputValue; |
|
|
|
const { checkedValues: oldCheckedValues, otherValues: oldOtherValues } = this.oldValue; |
|
|
|
const { currentHandleType, currentCheckboxTreeValue } = this; |
|
|
|
const o = { |
|
|
|
"checkboxTreeCheckbox": { oldValue: oldCheckedValues, newValue: checkedValues, des: "" }, |
|
|
|
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}:`, key: this.fieldKey + "_" + checkedValues }, |
|
|
|
} |
|
|
|
return o[currentHandleType]; |
|
|
|
}, |
|
|
|
async onCommonHandleSaveRecord(val) { |
|
|
|
const isEmpty = isValueEmpty(this.inputValue); |
|
|
|
if (this.error && !isEmpty) { |
|
|
|
@ -1197,6 +1218,17 @@ export default { |
|
|
|
isOldValueEmpty = this.isUnSubmitted(current.key); |
|
|
|
} |
|
|
|
|
|
|
|
} else if(this.type === "radioTree"){ |
|
|
|
const current = this.getRadioTreeInfo(); |
|
|
|
const { oldValue = {}, newValue = {} } = current; |
|
|
|
if (this.currentHandleType === "checkboxTreeCheckbox") { |
|
|
|
isSame = isEqual(oldValue, newValue); |
|
|
|
console.log(oldValue,newValue,oldValue !== newValue,"newValue") |
|
|
|
isOldValueEmpty = oldValue === newValue; |
|
|
|
} else { |
|
|
|
isSame = isEqual(current.oldValue, current.newValue); |
|
|
|
isOldValueEmpty = this.isUnSubmitted(current.key); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (this.type === "checkbox") { |
|
|
|
isSame = isEqual(this.oldValue, this.inputValue) |
|
|
|
@ -1221,6 +1253,7 @@ export default { |
|
|
|
//是否提交过 |
|
|
|
isUnSubmitted(key) { |
|
|
|
const finallyKey = key || this.fieldKey; |
|
|
|
console.log(this.getSubmittedCodes(),finallyKey,"finallyKey") |
|
|
|
const has = this.getSubmittedCodes().includes(finallyKey) |
|
|
|
return !has; |
|
|
|
}, |
|
|
|
@ -1289,10 +1322,23 @@ export default { |
|
|
|
recordOldVlaue = `${oldValue?.label || ''}:${oldValue?.checked ? '勾选' : '未勾选'}`; |
|
|
|
recordValue = `${newValue.label || ''}:${newValue.checked ? '勾选' : '未勾选'}`; |
|
|
|
isModify = newValue.checked !== undefined; |
|
|
|
} else { |
|
|
|
recordOldVlaue = `${current.des + (current.oldValue || '')}`; |
|
|
|
recordValue = `${current.des + (current.newValue || '')}`; |
|
|
|
finallyKey = current.key; |
|
|
|
isModify = !!current.oldValue; |
|
|
|
} |
|
|
|
} else if (this.type === "radioTree") { |
|
|
|
const current = this.getRadioTreeInfo(); |
|
|
|
if (this.currentHandleType === "checkboxTreeCheckbox") { |
|
|
|
const { oldValue = {}, newValue = {} } = current; |
|
|
|
recordOldVlaue = `${oldValue || ''}`; |
|
|
|
recordValue = `${newValue || ''}`; |
|
|
|
isModify = newValue !== oldValue; |
|
|
|
} else { |
|
|
|
recordOldVlaue = `${current.des + (current.oldValue || '')}`; |
|
|
|
recordValue = `${current.des + (current.newValue || '')}`; |
|
|
|
finallyKey = current.key; |
|
|
|
isModify = !!current.oldValue; |
|
|
|
} |
|
|
|
} else if (this.type === "checkbox") { |
|
|
|
@ -2120,4 +2166,11 @@ export default { |
|
|
|
.record-row{ |
|
|
|
text-align: left; |
|
|
|
} |
|
|
|
.radio-tree-item{ |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
&:not(:last-child) { |
|
|
|
margin-bottom: 10px; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |