|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import _ from 'lodash' |
|
|
|
import { getuuid, isEqual, isValueEmpty } from '@/utils/index.js' |
|
|
|
import { getuuid, isEqual, isValueEmpty,isRegent } from '@/utils/index.js' |
|
|
|
import { isShowOtherByCheckboxTree } from '@/utils/formPackageCommon.js' |
|
|
|
import moment from 'moment' |
|
|
|
|
|
|
|
@ -52,8 +52,8 @@ export default { |
|
|
|
if (currentConfig?.selectTo) { |
|
|
|
this.formFields[currentConfig?.selectTo] = val |
|
|
|
if (this.errors[currentConfig?.selectTo]) { |
|
|
|
this.$set(this.errors, currentConfig?.selectTo, false) |
|
|
|
} |
|
|
|
this.$set(this.errors, currentConfig?.selectTo, false) |
|
|
|
} |
|
|
|
} |
|
|
|
this.onValueChangeCompareTo(key, val) |
|
|
|
this.formFields[key] = val |
|
|
|
@ -76,10 +76,9 @@ export default { |
|
|
|
}, |
|
|
|
//试剂/仪器等弹窗提交
|
|
|
|
onRegentSubmit(data, inputValue, key, item) { |
|
|
|
this.updateFormData(key, inputValue) |
|
|
|
this.formFields[`selectInfo_${key}`] = data.selectInfo; |
|
|
|
if(data.type === "yq"){ |
|
|
|
this.formFields[`yqInfo_${key}`] = data.row; |
|
|
|
this.formFields[`selectInfo_${key}`] = JSON.parse(JSON.stringify(data.selectInfo)); |
|
|
|
if (data.type === "yq") { |
|
|
|
this.formFields[`yqInfo_${key}`] = JSON.parse(JSON.stringify(data.row)); |
|
|
|
} |
|
|
|
this.$emit('onRegentSubmit', { |
|
|
|
selectInfo: data, |
|
|
|
@ -87,9 +86,10 @@ export default { |
|
|
|
key, |
|
|
|
config: item |
|
|
|
}) |
|
|
|
this.updateFormData(key, inputValue) |
|
|
|
}, |
|
|
|
onBeforeReagentSubmit(data, callback, key) { |
|
|
|
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields }) |
|
|
|
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields }) |
|
|
|
}, |
|
|
|
getRegentItem(item, fieldCode = 'type') { |
|
|
|
const type = item[fieldCode] |
|
|
|
@ -139,7 +139,7 @@ export default { |
|
|
|
}, |
|
|
|
//更新表单数据
|
|
|
|
updateFormData(key, value, data) { |
|
|
|
const { isUpdateRecord, signData,record } = data || {} |
|
|
|
const { isUpdateRecord, signData, record } = data || {} |
|
|
|
// 深拷贝当前表单数据,避免直接修改原数据
|
|
|
|
const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)) |
|
|
|
|
|
|
|
@ -149,10 +149,10 @@ export default { |
|
|
|
if (this.errors[key]) { |
|
|
|
this.$set(this.errors, key, false) |
|
|
|
} |
|
|
|
const re = record||{ |
|
|
|
oldValue: this.oldFormFields[key], |
|
|
|
inputValue: value |
|
|
|
} |
|
|
|
const re = record || { |
|
|
|
oldValue: this.oldFormFields[key], |
|
|
|
inputValue: value |
|
|
|
} |
|
|
|
if (isUpdateRecord) { |
|
|
|
setTimeout(() => { |
|
|
|
this.$refs[key][0].handleUpdateRecord(signData, re) |
|
|
|
@ -392,36 +392,40 @@ export default { |
|
|
|
if (item.config?.thirdOtherCode) { |
|
|
|
config[item.config?.thirdOtherCode] = item.config?.thirdOtherCode |
|
|
|
} |
|
|
|
if (isRegent(item.config) || isRegent(item.config,"subType")) { |
|
|
|
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
|
|
|
|
// 优先使用this.formFields中以selectInfo_开头的字段
|
|
|
|
let selectInfoKeys = [], yqInfoKeys = []; |
|
|
|
if (this.formFields) { |
|
|
|
selectInfoKeys = Object.keys(this.formFields).filter((key) => |
|
|
|
key.startsWith('selectInfo_') |
|
|
|
) |
|
|
|
yqInfoKeys = Object.keys(this.formFields).filter((key) => |
|
|
|
key.startsWith('yqInfo_') |
|
|
|
) |
|
|
|
} |
|
|
|
// 如果this.formFields中没有,则使用formData中的
|
|
|
|
if (selectInfoKeys.length === 0 && formData) { |
|
|
|
selectInfoKeys = Object.keys(formData).filter((key) => |
|
|
|
key.startsWith('selectInfo_') |
|
|
|
) |
|
|
|
} |
|
|
|
if (yqInfoKeys.length === 0 && formData) { |
|
|
|
yqInfoKeys = Object.keys(formData).filter((key) => |
|
|
|
key.startsWith('yqInfo_') |
|
|
|
) |
|
|
|
} |
|
|
|
selectInfoKeys.forEach((key) => { |
|
|
|
result[key] = this.formFields[key] || formData[key] || '' |
|
|
|
}) |
|
|
|
yqInfoKeys.forEach((key) => { |
|
|
|
result[key] = this.formFields[key] || formData[key] || '' |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
|
|
|
|
// 优先使用this.formFields中以selectInfo_开头的字段
|
|
|
|
let selectInfoKeys = [],yqInfoKeys = []; |
|
|
|
if (this.formFields) { |
|
|
|
selectInfoKeys = Object.keys(this.formFields).filter((key) => |
|
|
|
key.startsWith('selectInfo_') |
|
|
|
) |
|
|
|
yqInfoKeys = Object.keys(this.formFields).filter((key) => |
|
|
|
key.startsWith('yqInfo_') |
|
|
|
) |
|
|
|
} |
|
|
|
// 如果this.formFields中没有,则使用formData中的
|
|
|
|
if (selectInfoKeys.length === 0 && formData) { |
|
|
|
selectInfoKeys = Object.keys(formData).filter((key) => |
|
|
|
key.startsWith('selectInfo_') |
|
|
|
) |
|
|
|
} |
|
|
|
if (yqInfoKeys.length === 0 && formData) { |
|
|
|
yqInfoKeys = Object.keys(formData).filter((key) => |
|
|
|
key.startsWith('yqInfo_') |
|
|
|
) |
|
|
|
} |
|
|
|
selectInfoKeys.forEach((key) => { |
|
|
|
result[key] = this.formFields[key] || formData[key] || '' |
|
|
|
}) |
|
|
|
yqInfoKeys.forEach((key) => { |
|
|
|
result[key] = this.formFields[key] || formData[key] || '' |
|
|
|
}) |
|
|
|
|
|
|
|
// 更新表单字段
|
|
|
|
this.formFields = { ...result } |
|
|
|
this.allFieldsConfig = config |
|
|
|
@ -661,8 +665,8 @@ export default { |
|
|
|
getFormDataByKey(key) { |
|
|
|
return this.formFields[key] |
|
|
|
}, |
|
|
|
onBeforeSaveRecord(data, callback, item){ |
|
|
|
this.$emit('beforeSaveRecord', {data, callback,item}) |
|
|
|
onBeforeSaveRecord(data, callback, item) { |
|
|
|
this.$emit('beforeSaveRecord', { data, callback, item }) |
|
|
|
}, |
|
|
|
onBlur(key, val) { |
|
|
|
// compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
|
|
|
|
|