|
|
@ -42,12 +42,38 @@ |
|
|
</el-checkbox> |
|
|
</el-checkbox> |
|
|
<div v-if="isShowCheckboxListOther(option)"> |
|
|
<div v-if="isShowCheckboxListOther(option)"> |
|
|
<el-input v-model="checkboxListValue.otherValues[option.otherCode]" |
|
|
<el-input v-model="checkboxListValue.otherValues[option.otherCode]" |
|
|
:class="{ 'error-border': isOtherInputError(option.otherCode) }" |
|
|
|
|
|
:placeholder="option.otherPlaceholder || '请输入'" @blur="onCheckboxListOtherBlur($event, option.otherCode)"/> |
|
|
|
|
|
|
|
|
:class="{ 'error-border': isOtherInputError(option.otherCode) }" |
|
|
|
|
|
:placeholder="option.otherPlaceholder || '请输入'" |
|
|
|
|
|
@blur="onCheckboxListOtherBlur($event, option.otherCode)" /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</el-checkbox-group> |
|
|
</el-checkbox-group> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div v-else-if="type === 'checkboxTree'" class="flex1 checkbox-list-container" |
|
|
|
|
|
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"> |
|
|
|
|
|
<div v-for="group in item.options" :key="group.value" class="checkbox-tree-group"> |
|
|
|
|
|
<el-checkbox :label="group.value" :disabled="getDisabled()" |
|
|
|
|
|
:value="getCheckboxTreeChecked(group.value)" |
|
|
|
|
|
:indeterminate="getCheckboxTreeIndeterminate(group.value)" |
|
|
|
|
|
@change="onCheckboxTreeParentChange(group, $event)"> |
|
|
|
|
|
{{ group.label }} |
|
|
|
|
|
</el-checkbox> |
|
|
|
|
|
<div v-if="group.children && group.children.length > 0" class="checkbox-tree-children"> |
|
|
|
|
|
<div v-for="child in group.children" :key="child.value" class="checkbox-tree-item"> |
|
|
|
|
|
<el-checkbox :label="child.value" :disabled="getDisabled()" |
|
|
|
|
|
:value="getCheckboxTreeChecked(child.value)" |
|
|
|
|
|
@change="onCheckboxTreeChildChange(group, child.value, $event)"> |
|
|
|
|
|
{{ child.label }} |
|
|
|
|
|
</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]" |
|
|
|
|
|
placeholder="请输入" @blur="onCheckboxTreeOtherBlur(child.value, $event)" /> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
<el-date-picker v-else-if="type === 'dateTime'" type="datetime" class="flex1" |
|
|
<el-date-picker v-else-if="type === 'dateTime'" type="datetime" class="flex1" |
|
|
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue" |
|
|
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue" |
|
|
:disabled="getDisabled()" format="yyyy/MM/dd HH:mm:ss" :placeholder="getPlaceholder()" |
|
|
:disabled="getDisabled()" format="yyyy/MM/dd HH:mm:ss" :placeholder="getPlaceholder()" |
|
|
@ -87,7 +113,8 @@ |
|
|
<div slot="tip" class="el-upload__tip">支持扩展名:.rar .zip .doc .docx .pdf .jpg,文件大小不超过2MB</div> |
|
|
<div slot="tip" class="el-upload__tip">支持扩展名:.rar .zip .doc .docx .pdf .jpg,文件大小不超过2MB</div> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
</template> |
|
|
</template> |
|
|
<div v-else-if="type === 'checkboxTag'" class="flex1 checkbox-tag-wrapper" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"> |
|
|
|
|
|
|
|
|
<div v-else-if="type === 'checkboxTag'" class="flex1 checkbox-tag-wrapper" |
|
|
|
|
|
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"> |
|
|
<div v-for="(tag, tagIndex) in checkboxTagList" :key="tagIndex" class="checkbox-tag-container"> |
|
|
<div v-for="(tag, tagIndex) in checkboxTagList" :key="tagIndex" class="checkbox-tag-container"> |
|
|
<div class="checkbox-tag-item"> |
|
|
<div class="checkbox-tag-item"> |
|
|
<el-checkbox v-model="tag.checked" :disabled="getDisabled()" |
|
|
<el-checkbox v-model="tag.checked" :disabled="getDisabled()" |
|
|
@ -95,8 +122,8 @@ |
|
|
<div class="tag-content blue-border"> |
|
|
<div class="tag-content blue-border"> |
|
|
<el-input v-if="templateFillType === 'preFill'" v-model="tag.tagValue" |
|
|
<el-input v-if="templateFillType === 'preFill'" v-model="tag.tagValue" |
|
|
:ref="'tagInput_' + tagIndex" :maxlength="item.maxlength || 20" |
|
|
:ref="'tagInput_' + tagIndex" :maxlength="item.maxlength || 20" |
|
|
@blur="onTagBlur(tagIndex)" @keyup.enter.native="onTagBlur(tagIndex)" |
|
|
|
|
|
placeholder="请输入" size="mini" class="tag-input" /> |
|
|
|
|
|
|
|
|
@blur="onTagBlur(tagIndex)" @keyup.enter.native="onTagBlur(tagIndex)" placeholder="请输入" |
|
|
|
|
|
size="mini" class="tag-input" /> |
|
|
<el-tag v-else :type="'info'" class="tag-display" :closable="false"> |
|
|
<el-tag v-else :type="'info'" class="tag-display" :closable="false"> |
|
|
{{ tag.tagValue }} |
|
|
{{ tag.tagValue }} |
|
|
</el-tag> |
|
|
</el-tag> |
|
|
@ -110,13 +137,16 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div v-else-if="type === 'fqyq'" :class="getFillTypeStyle()"> |
|
|
<div v-else-if="type === 'fqyq'" :class="getFillTypeStyle()"> |
|
|
<el-radio-group v-model="fqyqValue.mainRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'mainRadio')"> |
|
|
|
|
|
|
|
|
<el-radio-group v-model="fqyqValue.mainRadio" :disabled="getDisabled()" |
|
|
|
|
|
@input="onFqyqRadioChange($event, 'mainRadio')"> |
|
|
<div class="item-center mb-10"> |
|
|
<div class="item-center mb-10"> |
|
|
<el-radio label="是">是</el-radio> |
|
|
<el-radio label="是">是</el-radio> |
|
|
<div class="item-center" v-if="fqyqValue.mainRadio === '是'"> |
|
|
<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> |
|
|
|
|
|
|
|
|
<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> |
|
|
<div class="fs-14 mr-10">是否在规定时间完成</div> |
|
|
<el-radio-group v-model="fqyqValue.subRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'subRadio')"> |
|
|
|
|
|
|
|
|
<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 label="否"></el-radio> |
|
|
<el-radio label="否"></el-radio> |
|
|
</el-radio-group> |
|
|
</el-radio-group> |
|
|
@ -197,7 +227,7 @@ import moment from "moment"; |
|
|
import { deepClone } from "@/utils/index"; |
|
|
import { deepClone } from "@/utils/index"; |
|
|
import { getuuid } from "@/utils/index.js"; |
|
|
import { getuuid } from "@/utils/index.js"; |
|
|
import { getToken } from "@/utils/auth" |
|
|
import { getToken } from "@/utils/auth" |
|
|
import { isValueEmpty } from '@/utils/index.js'; |
|
|
|
|
|
|
|
|
import { isValueEmpty, getDefaultValueByOptions } from '@/utils/index.js'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"], |
|
|
inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"], |
|
|
@ -256,14 +286,15 @@ export default { |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
let initialValue = this.value; |
|
|
let initialValue = this.value; |
|
|
|
|
|
console.log(this.value, "check value"); |
|
|
let initialOtherValues = {}, checkboxTagList = []; |
|
|
let initialOtherValues = {}, checkboxTagList = []; |
|
|
|
|
|
|
|
|
if(this.type === 'checkboxList' && !this.value) { |
|
|
|
|
|
|
|
|
if (this.type === 'checkboxList' && !this.value) { |
|
|
initialValue = { |
|
|
initialValue = { |
|
|
checkboxValues: [], |
|
|
checkboxValues: [], |
|
|
otherValues: {} |
|
|
otherValues: {} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (this.type === 'checkboxTag' && Array.isArray(this.value)) { |
|
|
} else if (this.type === 'checkboxTag' && Array.isArray(this.value)) { |
|
|
// checkboxTag类型,value是数组格式 |
|
|
// checkboxTag类型,value是数组格式 |
|
|
checkboxTagList = this.value.map(tag => ({ |
|
|
checkboxTagList = this.value.map(tag => ({ |
|
|
@ -271,11 +302,14 @@ export default { |
|
|
tagValue: tag.tagValue || '' |
|
|
tagValue: tag.tagValue || '' |
|
|
})); |
|
|
})); |
|
|
} else if (this.type === 'fqyq' && !this.value) { |
|
|
} else if (this.type === 'fqyq' && !this.value) { |
|
|
initialValue = {mainRadio: '', subRadio: '',inputValue:""}; |
|
|
|
|
|
|
|
|
initialValue = { mainRadio: '', subRadio: '', inputValue: "" }; |
|
|
|
|
|
} else if (this.type === 'checkboxTree' && !this.value) { |
|
|
|
|
|
const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []); |
|
|
|
|
|
initialValue = { checkedValues: defaultCheckedValue, otherValues: {} }; |
|
|
} |
|
|
} |
|
|
return { |
|
|
return { |
|
|
inputValue: initialValue, |
|
|
inputValue: initialValue, |
|
|
oldValue: initialValue, // 记录上一次的值 |
|
|
|
|
|
|
|
|
oldValue: typeof initialValue === 'object' ? JSON.parse(JSON.stringify(initialValue)) : initialValue, // 记录上一次的值 |
|
|
showModal: false, // 控制模态框显示 |
|
|
showModal: false, // 控制模态框显示 |
|
|
modificationRecords: [], // 存储修改记录 |
|
|
modificationRecords: [], // 存储修改记录 |
|
|
modalTimer: null, // 用于延迟隐藏模态框 |
|
|
modalTimer: null, // 用于延迟隐藏模态框 |
|
|
@ -288,7 +322,7 @@ export default { |
|
|
checkboxTagList: checkboxTagList, // checkboxTag类型的列表数据 |
|
|
checkboxTagList: checkboxTagList, // checkboxTag类型的列表数据 |
|
|
oldCheckboxTagList: JSON.parse(JSON.stringify(checkboxTagList)), // 记录上一次的checkboxTagList |
|
|
oldCheckboxTagList: JSON.parse(JSON.stringify(checkboxTagList)), // 记录上一次的checkboxTagList |
|
|
fqyqValue: initialValue, // fqyq类型的值 |
|
|
fqyqValue: initialValue, // fqyq类型的值 |
|
|
oldFqyqValue: {...initialValue}, // 记录上一次的fqyq值 |
|
|
|
|
|
|
|
|
oldFqyqValue: { ...initialValue }, // 记录上一次的fqyq值 |
|
|
checkboxListValue: initialValue, // checkboxList类型的值 |
|
|
checkboxListValue: initialValue, // checkboxList类型的值 |
|
|
oldCheckboxListValue: JSON.parse(JSON.stringify(initialValue)), // 记录上一次的checkboxList值 |
|
|
oldCheckboxListValue: JSON.parse(JSON.stringify(initialValue)), // 记录上一次的checkboxList值 |
|
|
uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 |
|
|
uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 |
|
|
@ -301,13 +335,16 @@ export default { |
|
|
}, |
|
|
}, |
|
|
pendingUploadFile: null, // 用于存储待上传的文件 |
|
|
pendingUploadFile: null, // 用于存储待上传的文件 |
|
|
pendingRemoveFile: null, // 用于存储待删除的文件 |
|
|
pendingRemoveFile: null, // 用于存储待删除的文件 |
|
|
currentTagIndex:-1,//当前选中的checkboxTag索引 |
|
|
|
|
|
currentHandleType:'',//当前操作的类型 |
|
|
|
|
|
currentOtherCode:'',//当前操作的otherCode |
|
|
|
|
|
|
|
|
currentTagIndex: -1,//当前选中的checkboxTag索引 |
|
|
|
|
|
currentHandleType: '',//当前操作的类型 |
|
|
|
|
|
currentOtherCode: '',//当前操作的otherCode |
|
|
|
|
|
currentCheckboxTreeValue: '',//当前操作的checkboxTree值 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
value(newVal) { |
|
|
value(newVal) { |
|
|
|
|
|
console.log(newVal, "newVal") |
|
|
|
|
|
|
|
|
if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') { |
|
|
if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') { |
|
|
this.checkboxListValue = JSON.parse(JSON.stringify(newVal)); |
|
|
this.checkboxListValue = JSON.parse(JSON.stringify(newVal)); |
|
|
} else if (this.type === 'checkboxTag' && Array.isArray(newVal)) { |
|
|
} else if (this.type === 'checkboxTag' && Array.isArray(newVal)) { |
|
|
@ -324,7 +361,7 @@ export default { |
|
|
subRadio: newVal.subRadio || '' |
|
|
subRadio: newVal.subRadio || '' |
|
|
}; |
|
|
}; |
|
|
} else { |
|
|
} else { |
|
|
this.inputValue = newVal; |
|
|
|
|
|
|
|
|
this.inputValue = typeof newVal === 'object' ? JSON.parse(JSON.stringify(newVal)) : newVal; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -360,7 +397,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getFlexClass() { |
|
|
getFlexClass() { |
|
|
const noFlexArr = ["radio", "checkboxTag","fqyq"] |
|
|
|
|
|
|
|
|
const noFlexArr = ["radio", "checkboxTag", "fqyq"] |
|
|
return noFlexArr.includes(this.type) ? '' : 'flex1' |
|
|
return noFlexArr.includes(this.type) ? '' : 'flex1' |
|
|
}, |
|
|
}, |
|
|
getDecimalDigits() { |
|
|
getDecimalDigits() { |
|
|
@ -598,6 +635,8 @@ export default { |
|
|
}; |
|
|
}; |
|
|
if (type === "mix") { |
|
|
if (type === "mix") { |
|
|
params.mixType = true; |
|
|
params.mixType = true; |
|
|
|
|
|
} else if (item.qxbdType) { |
|
|
|
|
|
params.qxbdType = item.qxbdType; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
EventBus.$emit(eventName, params) |
|
|
EventBus.$emit(eventName, params) |
|
|
@ -679,7 +718,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
getFillTypeStyle(type) { |
|
|
getFillTypeStyle(type) { |
|
|
const { fillType } = this.item; |
|
|
const { fillType } = this.item; |
|
|
const filterType = ["attachment","checkboxTag","fqyq"] |
|
|
|
|
|
|
|
|
const filterType = ["attachment", "checkboxTag", "fqyq", "checkboxTree"] |
|
|
const typeObj = { |
|
|
const typeObj = { |
|
|
actFill: "orange-border",//实际填写的边框颜色 |
|
|
actFill: "orange-border",//实际填写的边框颜色 |
|
|
green: "green-border", |
|
|
green: "green-border", |
|
|
@ -821,7 +860,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 检查是否显示显示checkboxList的其他输入框 |
|
|
// 检查是否显示显示checkboxList的其他输入框 |
|
|
isShowCheckboxListOther(option) { |
|
|
isShowCheckboxListOther(option) { |
|
|
const {checkboxValues } = this.checkboxListValue |
|
|
|
|
|
|
|
|
const { checkboxValues } = this.checkboxListValue |
|
|
if (!checkboxValues) { |
|
|
if (!checkboxValues) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@ -880,6 +919,148 @@ export default { |
|
|
this.checkboxListValue.otherValues[otherCode] = e.target.value; |
|
|
this.checkboxListValue.otherValues[otherCode] = e.target.value; |
|
|
this.onCommonHandleSaveRecord(e.target.value); |
|
|
this.onCommonHandleSaveRecord(e.target.value); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 检查checkboxTree的某个值是否被选中 |
|
|
|
|
|
isCheckboxTreeChecked(value) { |
|
|
|
|
|
if (!this.inputValue || !this.inputValue.checkedValues) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
const checkedItem = this.inputValue.checkedValues.find(item => item.label === value); |
|
|
|
|
|
return checkedItem && checkedItem.checked; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 检查checkboxTree的其他输入框是否有错误 |
|
|
|
|
|
isCheckboxTreeOtherInputError(value) { |
|
|
|
|
|
if (!this.error) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return isValueEmpty(this.inputValue.otherValues[value]); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取checkboxTree的选中值 |
|
|
|
|
|
getCheckboxTreeChecked(value) { |
|
|
|
|
|
const { checkedValues } = this.inputValue |
|
|
|
|
|
const o = checkedValues.find(item => item.label === value) || {}; |
|
|
|
|
|
return !!o.checked; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取或创建checkedItem |
|
|
|
|
|
getOrCreateCheckedItem(value) { |
|
|
|
|
|
let checkedItem = this.inputValue.checkedValues.find(item => item.label === value); |
|
|
|
|
|
if (!checkedItem) { |
|
|
|
|
|
checkedItem = { label: value, checked: false }; |
|
|
|
|
|
this.inputValue.checkedValues.push(checkedItem); |
|
|
|
|
|
} |
|
|
|
|
|
return checkedItem; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 父级checkbox变化处理 |
|
|
|
|
|
onCheckboxTreeParentChange(group, checked) { |
|
|
|
|
|
this.currentHandleType = 'checkboxTreeCheckbox'; |
|
|
|
|
|
this.currentCheckboxTreeValue = group.value; |
|
|
|
|
|
|
|
|
|
|
|
// 设置父级状态 |
|
|
|
|
|
const parentItem = this.getOrCreateCheckedItem(group.value); |
|
|
|
|
|
parentItem.checked = checked; |
|
|
|
|
|
|
|
|
|
|
|
// 同步所有子级状态 |
|
|
|
|
|
if (group.children && group.children.length > 0) { |
|
|
|
|
|
group.children.forEach(child => { |
|
|
|
|
|
const childItem = this.getOrCreateCheckedItem(child.value); |
|
|
|
|
|
childItem.checked = checked; |
|
|
|
|
|
// 如果取消选中,清除otherValues |
|
|
|
|
|
if (!checked) { |
|
|
|
|
|
delete this.inputValue.otherValues[child.value]; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.onCommonHandleSaveRecord(); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 子级checkbox变化处理 |
|
|
|
|
|
onCheckboxTreeChildChange(group, childValue, checked) { |
|
|
|
|
|
this.currentHandleType = 'checkboxTreeCheckbox'; |
|
|
|
|
|
this.currentCheckboxTreeValue = childValue; |
|
|
|
|
|
|
|
|
|
|
|
// 设置子级状态 |
|
|
|
|
|
const childItem = this.getOrCreateCheckedItem(childValue); |
|
|
|
|
|
childItem.checked = checked; |
|
|
|
|
|
|
|
|
|
|
|
// 如果取消选中,清除otherValues |
|
|
|
|
|
if (!checked) { |
|
|
|
|
|
delete this.inputValue.otherValues[childValue]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 更新父级状态 |
|
|
|
|
|
this.updateParentState(group); |
|
|
|
|
|
|
|
|
|
|
|
this.onCommonHandleSaveRecord(); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 更新父级状态(根据子级状态) |
|
|
|
|
|
updateParentState(group) { |
|
|
|
|
|
if (!group.children || group.children.length === 0) return; |
|
|
|
|
|
|
|
|
|
|
|
const parentItem = this.getOrCreateCheckedItem(group.value); |
|
|
|
|
|
const childValues = group.children.map(child => child.value); |
|
|
|
|
|
|
|
|
|
|
|
// 统计子级选中状态 |
|
|
|
|
|
let checkedCount = 0; |
|
|
|
|
|
let totalCount = childValues.length; |
|
|
|
|
|
|
|
|
|
|
|
childValues.forEach(childValue => { |
|
|
|
|
|
const childItem = this.inputValue.checkedValues.find(item => item.label === childValue); |
|
|
|
|
|
if (childItem && childItem.checked) { |
|
|
|
|
|
checkedCount++; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 根据子级状态设置父级状态 |
|
|
|
|
|
if (checkedCount === 0) { |
|
|
|
|
|
// 全部未选中,父级取消选中 |
|
|
|
|
|
parentItem.checked = false; |
|
|
|
|
|
} else if (checkedCount === totalCount) { |
|
|
|
|
|
// 全部选中,父级选中 |
|
|
|
|
|
parentItem.checked = true; |
|
|
|
|
|
} |
|
|
|
|
|
// 部分选中时,父级保持当前状态(由indeterminate显示半选) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取父级的半选状态 |
|
|
|
|
|
getCheckboxTreeIndeterminate(groupValue) { |
|
|
|
|
|
if (!this.inputValue || !this.inputValue.checkedValues) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 找到对应的group |
|
|
|
|
|
const group = this.item.options.find(opt => opt.value === groupValue); |
|
|
|
|
|
if (!group || !group.children || group.children.length === 0) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const childValues = group.children.map(child => child.value); |
|
|
|
|
|
let checkedCount = 0; |
|
|
|
|
|
|
|
|
|
|
|
childValues.forEach(childValue => { |
|
|
|
|
|
const childItem = this.inputValue.checkedValues.find(item => item.label === childValue); |
|
|
|
|
|
if (childItem && childItem.checked) { |
|
|
|
|
|
checkedCount++; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 半选状态:有子级被选中但不是全部 |
|
|
|
|
|
return checkedCount > 0 && checkedCount < childValues.length; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// checkboxTree的其他输入框失去焦点处理 |
|
|
|
|
|
onCheckboxTreeOtherBlur(value, e) { |
|
|
|
|
|
this.currentHandleType = "checkboxTreeOther"; |
|
|
|
|
|
this.currentCheckboxTreeValue = value; |
|
|
|
|
|
this.inputValue.otherValues[value] = e.target.value; |
|
|
|
|
|
this.onCommonHandleSaveRecord(e.target.value); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 点击question图标 |
|
|
// 点击question图标 |
|
|
onClickQuestion() { |
|
|
onClickQuestion() { |
|
|
const { templateFillType } = this; |
|
|
const { templateFillType } = this; |
|
|
@ -908,25 +1089,37 @@ export default { |
|
|
this.visible = true; |
|
|
this.visible = true; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getCheckboxListInfo(){ |
|
|
|
|
|
const { otherValues,checkboxValues } = this.checkboxListValue; |
|
|
|
|
|
const { otherValues: oldOtherValues,checkboxValues: oldCheckboxValues } = this.oldCheckboxListValue; |
|
|
|
|
|
|
|
|
getCheckboxListInfo() { |
|
|
|
|
|
const { otherValues, checkboxValues } = this.checkboxListValue; |
|
|
|
|
|
const { otherValues: oldOtherValues, checkboxValues: oldCheckboxValues } = this.oldCheckboxListValue; |
|
|
const o = { |
|
|
const o = { |
|
|
"checkboxListValue":{oldValue:oldCheckboxValues,newValue:checkboxValues,des:""}, |
|
|
|
|
|
"checkboxListOther":{oldValue:oldOtherValues[this.currentOtherCode],newValue:otherValues[this.currentOtherCode],des:"样品信息:"}, |
|
|
|
|
|
|
|
|
"checkboxListValue": { oldValue: oldCheckboxValues, newValue: checkboxValues, des: "" }, |
|
|
|
|
|
"checkboxListOther": { oldValue: oldOtherValues[this.currentOtherCode], newValue: otherValues[this.currentOtherCode], des: "样品信息:" }, |
|
|
} |
|
|
} |
|
|
return o[this.currentHandleType]; |
|
|
return o[this.currentHandleType]; |
|
|
}, |
|
|
}, |
|
|
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:"是否在规定时间完成:"} |
|
|
|
|
|
|
|
|
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.currentHandleType]; |
|
|
return o[this.currentHandleType]; |
|
|
}, |
|
|
}, |
|
|
|
|
|
getCheckboxTreeInfo() { |
|
|
|
|
|
const { checkedValues, otherValues } = this.inputValue; |
|
|
|
|
|
const { checkedValues: oldCheckedValues, otherValues: oldOtherValues } = this.oldValue; |
|
|
|
|
|
const { currentHandleType, currentCheckboxTreeValue } = this; |
|
|
|
|
|
const newItem = checkedValues.find(item => item.label === currentCheckboxTreeValue); |
|
|
|
|
|
const oldItem = oldCheckedValues.find(item => item.label === currentCheckboxTreeValue); |
|
|
|
|
|
const o = { |
|
|
|
|
|
"checkboxTreeCheckbox": { oldValue: oldItem, newValue: newItem, des: "" }, |
|
|
|
|
|
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}:` }, |
|
|
|
|
|
} |
|
|
|
|
|
return o[currentHandleType]; |
|
|
|
|
|
}, |
|
|
async onCommonHandleSaveRecord(val) { |
|
|
async onCommonHandleSaveRecord(val) { |
|
|
const isEmpty = isValueEmpty(this.inputValue); |
|
|
const isEmpty = isValueEmpty(this.inputValue); |
|
|
if (this.error && !isEmpty) { |
|
|
if (this.error && !isEmpty) { |
|
|
@ -970,14 +1163,13 @@ export default { |
|
|
this.$emit("change", this.inputValue); |
|
|
this.$emit("change", this.inputValue); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 值发生了变化,需要弹出密码输入框 |
|
|
// 值发生了变化,需要弹出密码输入框 |
|
|
let isSame = true, isOldValueEmpty = true; |
|
|
let isSame = true, isOldValueEmpty = true; |
|
|
const { currentHandleType } = this; |
|
|
const { currentHandleType } = this; |
|
|
// 如果是checkboxList类型,需要同时比较otherValues |
|
|
// 如果是checkboxList类型,需要同时比较otherValues |
|
|
if (this.type === 'checkboxList') { |
|
|
if (this.type === 'checkboxList') { |
|
|
const current = this.getCheckboxListInfo(); |
|
|
const current = this.getCheckboxListInfo(); |
|
|
isSame = this.isEqual(current.oldValue,current.newValue); |
|
|
|
|
|
|
|
|
isSame = this.isEqual(current.oldValue, current.newValue); |
|
|
isOldValueEmpty = isValueEmpty(current.oldValue); |
|
|
isOldValueEmpty = isValueEmpty(current.oldValue); |
|
|
} else if (this.type === "checkboxTag") { |
|
|
} else if (this.type === "checkboxTag") { |
|
|
// checkboxTag类型,只比较当前tagIndex的数据 |
|
|
// checkboxTag类型,只比较当前tagIndex的数据 |
|
|
@ -987,13 +1179,25 @@ export default { |
|
|
isOldValueEmpty = isValueEmpty(oldTag.checked); |
|
|
isOldValueEmpty = isValueEmpty(oldTag.checked); |
|
|
} else if (this.type === "fqyq") { |
|
|
} else if (this.type === "fqyq") { |
|
|
const current = this.getFqyqInfo(); |
|
|
const current = this.getFqyqInfo(); |
|
|
isSame = this.isEqual(current.oldValue,current.newValue); |
|
|
|
|
|
|
|
|
isSame = this.isEqual(current.oldValue, current.newValue); |
|
|
isOldValueEmpty = isValueEmpty(current.oldValue); |
|
|
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); |
|
|
|
|
|
} else { |
|
|
|
|
|
isSame = this.isEqual(current.oldValue, current.newValue); |
|
|
|
|
|
isOldValueEmpty = isValueEmpty(current.oldValue); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
isSame = this.isEqual(this.oldValue, this.inputValue) |
|
|
isSame = this.isEqual(this.oldValue, this.inputValue) |
|
|
isOldValueEmpty = isValueEmpty(this.oldValue); |
|
|
isOldValueEmpty = isValueEmpty(this.oldValue); |
|
|
} |
|
|
} |
|
|
console.log(isSame,isOldValueEmpty,this.fqyqValue,this.oldFqyqValue,"isSame") |
|
|
|
|
|
|
|
|
console.log(isSame, isOldValueEmpty, this.currentCheckboxTreeValue, this.oldValue, this.inputValue, "isSame") |
|
|
if (isSame) { |
|
|
if (isSame) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
@ -1030,13 +1234,10 @@ export default { |
|
|
this.fqyqValue = JSON.parse(JSON.stringify(this.oldFqyqValue)); |
|
|
this.fqyqValue = JSON.parse(JSON.stringify(this.oldFqyqValue)); |
|
|
oldValue = { ...this.fqyqValue }; |
|
|
oldValue = { ...this.fqyqValue }; |
|
|
} |
|
|
} |
|
|
this.inputValue = this.oldValue; |
|
|
|
|
|
|
|
|
this.inputValue = typeof oldValue === 'object' ? JSON.parse(JSON.stringify(oldValue)) : oldValue; |
|
|
this.$emit('input', oldValue); // 触发 v-model 更新 |
|
|
this.$emit('input', oldValue); // 触发 v-model 更新 |
|
|
// this.$emit("blur", this.oldValue); |
|
|
// this.$emit("blur", this.oldValue); |
|
|
this.$emit("change", oldValue, "cancel"); |
|
|
this.$emit("change", oldValue, "cancel"); |
|
|
if (this.item.type === "clickable") { |
|
|
|
|
|
this.$emit("resetRecord"); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//处理更新记录 |
|
|
//处理更新记录 |
|
|
@ -1059,14 +1260,27 @@ export default { |
|
|
isModify = oldTag.checked !== undefined; |
|
|
isModify = oldTag.checked !== undefined; |
|
|
} else if (this.type === "fqyq") { |
|
|
} else if (this.type === "fqyq") { |
|
|
const current = this.getFqyqInfo(); |
|
|
const current = this.getFqyqInfo(); |
|
|
recordOldVlaue = `${current.des+current.oldValue}`; |
|
|
|
|
|
recordValue = `${current.des+current.newValue}`; |
|
|
|
|
|
isModify = !!this.oldFqyqValue.mainRadio |
|
|
|
|
|
}else if(this.type === "checkboxList"){ |
|
|
|
|
|
|
|
|
recordOldVlaue = `${current.des + current.oldValue}`; |
|
|
|
|
|
recordValue = `${current.des + current.newValue}`; |
|
|
|
|
|
isModify = !!this.oldFqyqValue.mainRadio |
|
|
|
|
|
} else if (this.type === "checkboxList") { |
|
|
const current = this.getCheckboxListInfo(); |
|
|
const current = this.getCheckboxListInfo(); |
|
|
recordOldVlaue = `${current.des+(current.oldValue || '')}`; |
|
|
|
|
|
recordValue = `${current.des+(current.newValue || '')}`; |
|
|
|
|
|
|
|
|
recordOldVlaue = `${current.des + (current.oldValue || '')}`; |
|
|
|
|
|
recordValue = `${current.des + (current.newValue || '')}`; |
|
|
isModify = !!current.oldValue; |
|
|
isModify = !!current.oldValue; |
|
|
|
|
|
} else if (this.type === "checkboxTree") { |
|
|
|
|
|
// checkboxTree类型,记录当前操作的值变化 |
|
|
|
|
|
const current = this.getCheckboxTreeInfo(); |
|
|
|
|
|
if (this.currentHandleType === "checkboxTreeCheckbox") { |
|
|
|
|
|
const { oldValue, newValue } = current; |
|
|
|
|
|
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}`; |
|
|
|
|
|
isModify = !!current.oldValue; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
const record = { |
|
|
const record = { |
|
|
...baseInfo, |
|
|
...baseInfo, |
|
|
@ -1118,7 +1332,7 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//用户输入密码并点击确定,保存修改 |
|
|
//用户输入密码并点击确定,保存修改 |
|
|
this.oldValue = value; // 更新旧值 |
|
|
|
|
|
|
|
|
this.oldValue = typeof value === 'object' ? JSON.parse(JSON.stringify(value)) : value; // 更新旧值 |
|
|
this.$emit("blur", value); |
|
|
this.$emit("blur", value); |
|
|
this.$emit('input', value); |
|
|
this.$emit('input', value); |
|
|
this.$emit("change", value, data ? "save" : ""); |
|
|
this.$emit("change", value, data ? "save" : ""); |
|
|
@ -1757,6 +1971,7 @@ export default { |
|
|
border-color: #f9c588; |
|
|
border-color: #f9c588; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.el-radio__inner { |
|
|
.el-radio__inner { |
|
|
border-color: #f9c588; |
|
|
border-color: #f9c588; |
|
|
} |
|
|
} |
|
|
@ -1814,17 +2029,39 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
.fqyq-input{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.fqyq-input { |
|
|
width: 500px; |
|
|
width: 500px; |
|
|
margin-right:10px; |
|
|
|
|
|
|
|
|
margin-right: 10px; |
|
|
} |
|
|
} |
|
|
.mb-10{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.mb-10 { |
|
|
margin-bottom: 10px; |
|
|
margin-bottom: 10px; |
|
|
} |
|
|
} |
|
|
.fs-14{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.fs-14 { |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
} |
|
|
} |
|
|
.mr-10{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.mr-10 { |
|
|
margin-right: 10px; |
|
|
margin-right: 10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.checkbox-tree-children { |
|
|
|
|
|
margin-left: 30px; |
|
|
|
|
|
padding: 16px 0; |
|
|
|
|
|
gap: 16px; |
|
|
|
|
|
display: grid; |
|
|
|
|
|
grid-template-columns: repeat(4, 1fr); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.checkbox-tree-item { |
|
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
|
|
|
.checkbox-tree-input-container{ |
|
|
|
|
|
margin-left: 10px; |
|
|
|
|
|
width: 500px; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |