|
|
|
@ -110,12 +110,13 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-else-if="type === 'fqyq'" :class="getFillTypeStyle()"> |
|
|
|
<el-radio-group> |
|
|
|
<div class="item-center"> |
|
|
|
<el-radio-group v-model="fqyqValue.mainRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'mainRadio')"> |
|
|
|
<div class="item-center mb-10"> |
|
|
|
<el-radio label="是">是</el-radio> |
|
|
|
<div class="item-center"> |
|
|
|
<el-input class="fqyq-input" maxlength="100" v-model="inputValue" :disabled="getDisabled()" placeholder="请输入"></el-input> |
|
|
|
<el-radio-group v-model="inputValue"> |
|
|
|
<div class="item-center" v-if="fqyqValue.mainRadio === '是'"> |
|
|
|
<el-input class="fqyq-input" maxlength="100" v-model="fqyqValue.inputValue" :disabled="getDisabled()" placeholder="请输入" @blur="onFqyqInputBlur" ></el-input> |
|
|
|
<div class="fs-14 mr-10">是否在规定时间完成</div> |
|
|
|
<el-radio-group v-model="fqyqValue.subRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'subRadio')"> |
|
|
|
<el-radio label="是"></el-radio> |
|
|
|
<el-radio label="否"></el-radio> |
|
|
|
</el-radio-group> |
|
|
|
@ -253,7 +254,7 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
let initialValue = this.value; |
|
|
|
let initialOtherValues = {}, checkboxTagList = []; |
|
|
|
let initialOtherValues = {}, checkboxTagList = [], fqyqValue = {}; |
|
|
|
|
|
|
|
// 如果是checkboxList类型且value是对象格式 |
|
|
|
if (this.type === 'checkboxList' && this.value && typeof this.value === 'object') { |
|
|
|
@ -267,7 +268,9 @@ export default { |
|
|
|
checked: tag.checked, |
|
|
|
tagValue: tag.tagValue || '' |
|
|
|
})); |
|
|
|
} |
|
|
|
} else if (this.type === 'fqyq' && !this.value) { |
|
|
|
initialValue = {mainRadio: '', subRadio: '',inputValue:""}; |
|
|
|
} |
|
|
|
return { |
|
|
|
inputValue: initialValue, |
|
|
|
oldValue: initialValue, // 记录上一次的值 |
|
|
|
@ -284,6 +287,8 @@ export default { |
|
|
|
checkboxValue: this.getChecked(),//是否选中 |
|
|
|
checkboxTagList: checkboxTagList, // checkboxTag类型的列表数据 |
|
|
|
oldCheckboxTagList: JSON.parse(JSON.stringify(checkboxTagList)), // 记录上一次的checkboxTagList |
|
|
|
fqyqValue: initialValue, // fqyq类型的值 |
|
|
|
oldFqyqValue: {...initialValue}, // 记录上一次的fqyq值 |
|
|
|
uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 |
|
|
|
regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], //试剂/仪器/供试品等类型 |
|
|
|
selectRegentInfo: {},//选择的试剂/仪器/供试品等信息 |
|
|
|
@ -295,6 +300,7 @@ export default { |
|
|
|
pendingUploadFile: null, // 用于存储待上传的文件 |
|
|
|
pendingRemoveFile: null, // 用于存储待删除的文件 |
|
|
|
currentTagIndex:-1,//当前选中的checkboxTag索引 |
|
|
|
currentFqyqType:'',//当前选中的fqyq操作的类型 |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -309,7 +315,14 @@ export default { |
|
|
|
checked: tag.checked, |
|
|
|
tagValue: tag.tagValue || '' |
|
|
|
})); |
|
|
|
} else { |
|
|
|
} else if (this.type === 'fqyq' && newVal && typeof newVal === 'object') { |
|
|
|
// fqyq类型 |
|
|
|
this.fqyqValue = { |
|
|
|
mainRadio: newVal.mainRadio || '', |
|
|
|
inputValue: newVal.inputValue || '', |
|
|
|
subRadio: newVal.subRadio || '' |
|
|
|
}; |
|
|
|
} else { |
|
|
|
this.inputValue = this.type === 'checkboxList' && !Array.isArray(newVal) ? [] : newVal; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -346,7 +359,7 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getFlexClass() { |
|
|
|
const noFlexArr = ["radio", "checkboxTag"] |
|
|
|
const noFlexArr = ["radio", "checkboxTag","fqyq"] |
|
|
|
return noFlexArr.includes(this.type) ? '' : 'flex1' |
|
|
|
}, |
|
|
|
getDecimalDigits() { |
|
|
|
@ -665,13 +678,14 @@ export default { |
|
|
|
}, |
|
|
|
getFillTypeStyle(type) { |
|
|
|
const { fillType } = this.item; |
|
|
|
const filterType = ["attachment","checkboxTag","fqyq"] |
|
|
|
const typeObj = { |
|
|
|
actFill: "orange-border",//实际填写的边框颜色 |
|
|
|
green: "green-border", |
|
|
|
preFill: "blue-border",//预填写的边框颜色 |
|
|
|
} |
|
|
|
// 如果有错误状态,返回红色边框样式,覆盖原有的边框颜色 |
|
|
|
if (this.error && this.type !== "attachment" && this.type !== "checkboxTag") { |
|
|
|
if (this.error && !filterType.includes(this.type)) { |
|
|
|
return "error-border"; |
|
|
|
} |
|
|
|
return typeObj[fillType] || "" |
|
|
|
@ -857,6 +871,21 @@ export default { |
|
|
|
this.$emit('input', [...this.checkboxTagList]); |
|
|
|
this.$emit('change', [...this.checkboxTagList]); |
|
|
|
}, |
|
|
|
|
|
|
|
// fqyq 主radio变化处理 |
|
|
|
onFqyqRadioChange(val, radioType) { |
|
|
|
this.fqyqValue[radioType] = val; |
|
|
|
this.currentFqyqType = radioType; |
|
|
|
this.onCommonHandleSaveRecord(); |
|
|
|
}, |
|
|
|
|
|
|
|
// fqyq 输入框失去焦点 |
|
|
|
onFqyqInputBlur(e) { |
|
|
|
this.fqyqValue.inputValue = e.target.value; |
|
|
|
this.currentFqyqType = 'inputValue'; |
|
|
|
this.onCommonHandleSaveRecord(this.fqyqValue.inputValue); |
|
|
|
}, |
|
|
|
|
|
|
|
// 统一处理失去焦点事件 |
|
|
|
onBlur(e) { |
|
|
|
this.onCommonHandleSaveRecord(e.target.value); |
|
|
|
@ -889,6 +918,16 @@ export default { |
|
|
|
this.visible = true; |
|
|
|
} |
|
|
|
}, |
|
|
|
getFqyqInfo(){ |
|
|
|
const { mainRadio,inputValue,subRadio } = this.fqyqValue; |
|
|
|
const { mainRadio: oldMainRadio,inputValue: oldInputValue,subRadio: oldSubRadio } = this.oldFqyqValue; |
|
|
|
const o ={ |
|
|
|
"mainRadio":{oldValue:oldMainRadio,newValue:mainRadio,des:""}, |
|
|
|
"inputValue":{oldValue:oldInputValue,newValue:inputValue,des:""}, |
|
|
|
"subRadio":{oldValue:oldSubRadio,newValue:subRadio,des:"是否在规定时间完成:"} |
|
|
|
} |
|
|
|
return o[this.currentFqyqType]; |
|
|
|
}, |
|
|
|
async onCommonHandleSaveRecord(val) { |
|
|
|
const isEmpty = this.isValueEmpty(this.inputValue); |
|
|
|
if (this.error && !isEmpty) { |
|
|
|
@ -945,11 +984,15 @@ export default { |
|
|
|
const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {}; |
|
|
|
isSame = this.isEqual(oldTag.checked, currentTag.checked); |
|
|
|
isOldValueEmpty = this.isValueEmpty(oldTag.checked); |
|
|
|
|
|
|
|
}else{ |
|
|
|
} else if (this.type === "fqyq") { |
|
|
|
const current = this.getFqyqInfo(); |
|
|
|
isSame = this.isEqual(current.oldValue,current.newValue); |
|
|
|
isOldValueEmpty = this.isValueEmpty(current.oldValue); |
|
|
|
} else { |
|
|
|
isSame = this.isEqual(this.oldValue, this.inputValue) |
|
|
|
isOldValueEmpty = this.isValueEmpty(this.oldValue); |
|
|
|
} |
|
|
|
console.log(isSame,isOldValueEmpty,this.fqyqValue,this.oldFqyqValue,"isSame") |
|
|
|
if (isSame) { |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -981,6 +1024,10 @@ export default { |
|
|
|
this.checkboxTagList = JSON.parse(JSON.stringify(this.oldCheckboxTagList)); |
|
|
|
oldValue = [...this.checkboxTagList]; |
|
|
|
} |
|
|
|
} else if (this.type === "fqyq") { |
|
|
|
// 如果没有指定字段,回退整个对象 |
|
|
|
this.fqyqValue = JSON.parse(JSON.stringify(this.oldFqyqValue)); |
|
|
|
oldValue = { ...this.fqyqValue }; |
|
|
|
} |
|
|
|
this.inputValue = this.oldValue; |
|
|
|
this.$emit('input', oldValue); // 触发 v-model 更新 |
|
|
|
@ -1008,8 +1055,12 @@ export default { |
|
|
|
const currentTag = this.checkboxTagList[this.currentTagIndex] || {}; |
|
|
|
recordOldVlaue = `${oldTag.tagValue || ''}:${oldTag.checked ? '勾选' : '未勾选'}`; |
|
|
|
recordValue = `${currentTag.tagValue || ''}:${currentTag.checked ? '勾选' : '未勾选'}`; |
|
|
|
isModify = oldTag.checked !== undefined |
|
|
|
|
|
|
|
isModify = oldTag.checked !== undefined; |
|
|
|
} else if (this.type === "fqyq") { |
|
|
|
const current = this.getFqyqInfo(); |
|
|
|
recordOldVlaue = `${current.des+current.oldValue}`; |
|
|
|
recordValue = `${current.des+current.newValue}`; |
|
|
|
isModify = !!this.oldFqyqValue.mainRadio |
|
|
|
} |
|
|
|
const record = { |
|
|
|
...baseInfo, |
|
|
|
@ -1040,6 +1091,9 @@ export default { |
|
|
|
// 如果没有指定tagIndex,更新整个数组 |
|
|
|
this.oldCheckboxTagList = JSON.parse(JSON.stringify(this.checkboxTagList)); |
|
|
|
} |
|
|
|
} else if (this.type === "fqyq") { |
|
|
|
// 如果没有指定字段,更新整个对象 |
|
|
|
this.oldFqyqValue = JSON.parse(JSON.stringify(this.fqyqValue)); |
|
|
|
} |
|
|
|
let value = this.inputValue; |
|
|
|
if (this.type === 'checkboxList') { |
|
|
|
@ -1049,6 +1103,8 @@ export default { |
|
|
|
}; |
|
|
|
} else if (this.type === "checkboxTag") { |
|
|
|
value = [...this.checkboxTagList]; |
|
|
|
} else if (this.type === "fqyq") { |
|
|
|
value = { ...this.fqyqValue }; |
|
|
|
} |
|
|
|
if (this.type === "button") { |
|
|
|
this.$emit('clickButton', this.item, this.inputValue, data); |
|
|
|
@ -1692,6 +1748,9 @@ export default { |
|
|
|
border-color: #f9c588; |
|
|
|
} |
|
|
|
} |
|
|
|
.el-radio__inner { |
|
|
|
border-color: #f9c588; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1748,6 +1807,15 @@ export default { |
|
|
|
} |
|
|
|
.fqyq-input{ |
|
|
|
width: 500px; |
|
|
|
margin-left: 10px; |
|
|
|
margin-right:10px; |
|
|
|
} |
|
|
|
.mb-10{ |
|
|
|
margin-bottom: 10px; |
|
|
|
} |
|
|
|
.fs-14{ |
|
|
|
font-size: 14px; |
|
|
|
} |
|
|
|
.mr-10{ |
|
|
|
margin-right: 10px; |
|
|
|
} |
|
|
|
</style> |