Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
agcs2.0-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liang
agcs2.0-web
Commits
332e5324
Commit
332e5324
authored
Sep 13, 2023
by
miaojiale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复年龄回显
parent
6117df42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
49 deletions
+59
-49
FormItemSelf.vue
src/components/FormComponents/CustomForm/FormItemSelf.vue
+59
-49
No files found.
src/components/FormComponents/CustomForm/FormItemSelf.vue
View file @
332e5324
...
@@ -95,12 +95,17 @@
...
@@ -95,12 +95,17 @@
slot=
"append"
slot=
"append"
class=
"toothBit"
class=
"toothBit"
@
click=
"openToothBit"
@
click=
"openToothBit"
>
{{
item
.
append
||
"
牙位
"
}}
</el-button
>
{{
item
.
append
||
"
牙位
"
}}
</el-button>
<template
v-else-if=
"item.append"
slot=
"append"
>
>
<template
v-else-if=
"item.append"
slot=
"append"
>
{{
item
.
append
}}
{{
item
.
append
}}
</
template
>
</
template
>
<
template
v-if=
"item.prepend"
slot=
"prepend"
>
<
template
v-if=
"item.prepend"
slot=
"prepend"
>
{{
item
.
prepend
}}
{{
item
.
prepend
}}
</
template
>
</
template
>
</el-input>
</el-input>
...
@@ -125,10 +130,16 @@
...
@@ -125,10 +130,16 @@
"
"
@
blur=
"handleBlur"
@
blur=
"handleBlur"
>
>
<
template
v-if=
"item.append"
slot=
"append"
>
<
template
v-if=
"item.append"
slot=
"append"
>
{{
item
.
append
}}
{{
item
.
append
}}
</
template
>
</
template
>
<
template
v-if=
"item.prepend"
slot=
"prepend"
>
<
template
v-if=
"item.prepend"
slot=
"prepend"
>
{{
item
.
prepend
}}
{{
item
.
prepend
}}
</
template
>
</
template
>
</el-input>
</el-input>
...
@@ -157,7 +168,10 @@
...
@@ -157,7 +168,10 @@
</
template
>
</
template
>
<!-- 计数器 -->
<!-- 计数器 -->
<div
v-if=
"item.type === 'number'"
style=
"display: inline-table"
>
<div
v-if=
"item.type === 'number'"
style=
"display: inline-table"
>
<el-input-number
<el-input-number
v-model=
"form[item.prop]"
v-model=
"form[item.prop]"
:readonly=
"item.readonly"
:readonly=
"item.readonly"
...
@@ -176,8 +190,7 @@
...
@@ -176,8 +190,7 @@
v-if=
"item.append"
v-if=
"item.append"
class=
"el-input-group__append"
class=
"el-input-group__append"
style=
"line-height: 28px"
style=
"line-height: 28px"
>
{{ item.append }}
</span
>
{{ item.append }}
</span>
>
</div>
</div>
<!-- 单选框 -->
<!-- 单选框 -->
...
@@ -191,8 +204,7 @@
...
@@ -191,8 +204,7 @@
v-for=
"(opt, optIndex) in item.dicData"
v-for=
"(opt, optIndex) in item.dicData"
:key=
"optIndex"
:key=
"optIndex"
:label=
"opt.value"
:label=
"opt.value"
>
{{ opt.label }}
</el-radio
>
{{ opt.label }}
</el-radio>
>
</el-radio-group>
</el-radio-group>
<!-- 单选框只读 -->
<!-- 单选框只读 -->
<!-- <div
<!-- <div
...
@@ -221,8 +233,7 @@
...
@@ -221,8 +233,7 @@
v-for=
"(opt, optIndex) in item.dicData"
v-for=
"(opt, optIndex) in item.dicData"
:key=
"optIndex"
:key=
"optIndex"
:label=
"opt.value"
:label=
"opt.value"
>
{{
opt
.
label
}}
</el-checkbox
>
{{
opt
.
label
}}
</el-checkbox>
>
</el-checkbox-group>
</el-checkbox-group>
</
template
>
</
template
>
...
@@ -333,8 +344,7 @@
...
@@ -333,8 +344,7 @@
$route.path != '/followupresearch'
$route.path != '/followupresearch'
"
"
style=
"margin-left: 12px"
style=
"margin-left: 12px"
>
{{ age + (age ? "岁" : "") }}
</span
>
{{ form['age'] + (form['age'] ? "岁" : "") }}
</span>
>
</div>
</div>
<!-- 年 -->
<!-- 年 -->
<el-date-picker
<el-date-picker
...
@@ -433,8 +443,7 @@
...
@@ -433,8 +443,7 @@
<span
<span
v-if=
"item.importantField && !getVwForm.detail"
v-if=
"item.importantField && !getVwForm.detail"
class=
"important_field"
class=
"important_field"
>
{{ item.importantFieldDesc || "*" }}
</span
>
{{ item.importantFieldDesc || "*" }}
</span>
>
</div>
</div>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
...
@@ -473,15 +482,15 @@ export default {
...
@@ -473,15 +482,15 @@ export default {
},
},
getPatientId
:
{
getPatientId
:
{
type
:
Function
,
type
:
Function
,
default
:
()
=>
{},
default
:
()
=>
{
},
},
},
getDefectsSet
:
{
getDefectsSet
:
{
type
:
Function
,
type
:
Function
,
default
:
()
=>
{},
default
:
()
=>
{
},
},
},
configForms
:
{
configForms
:
{
type
:
Function
,
type
:
Function
,
default
:
()
=>
{},
default
:
()
=>
{
},
},
},
},
},
props
:
{
props
:
{
...
@@ -500,7 +509,7 @@ export default {
...
@@ -500,7 +509,7 @@ export default {
columnIndex
:
Number
,
columnIndex
:
Number
,
group
:
Array
,
group
:
Array
,
},
},
data
()
{
data
()
{
return
{
return
{
// age: "",
// age: "",
pickerOptions
,
pickerOptions
,
...
@@ -513,11 +522,11 @@ export default {
...
@@ -513,11 +522,11 @@ export default {
...
mapGetters
({
...
mapGetters
({
age
:
[
"
table/age
"
],
age
:
[
"
table/age
"
],
}),
}),
getVwForm
()
{
getVwForm
()
{
return
this
.
vwForm
()
return
this
.
vwForm
()
},
},
//重要字段空数据且填写表单时添加重点
//重要字段空数据且填写表单时添加重点
isEmpty
()
{
isEmpty
()
{
const
{
importantField
,
prop
}
=
this
.
item
const
{
importantField
,
prop
}
=
this
.
item
if
(
!
importantField
||
this
.
getVwForm
.
detail
)
return
""
if
(
!
importantField
||
this
.
getVwForm
.
detail
)
return
""
...
@@ -529,14 +538,14 @@ export default {
...
@@ -529,14 +538,14 @@ export default {
}
}
return
empty
?
"
empty-tip
"
:
""
return
empty
?
"
empty-tip
"
:
""
},
},
defectsSet
()
{
defectsSet
()
{
return
this
.
getDefectsSet
?
this
.
getDefectsSet
()
:
[]
return
this
.
getDefectsSet
?
this
.
getDefectsSet
()
:
[]
},
},
patientId
()
{
patientId
()
{
return
this
.
getPatientId
?
this
.
getPatientId
()
:
""
return
this
.
getPatientId
?
this
.
getPatientId
()
:
""
},
},
},
},
created
()
{
created
()
{
this
.
timerangeReset
()
this
.
timerangeReset
()
this
.
numberReset
()
this
.
numberReset
()
this
.
checkboxReset
()
this
.
checkboxReset
()
...
@@ -562,19 +571,19 @@ export default {
...
@@ -562,19 +571,19 @@ export default {
}
}
}
}
},
},
mounted
()
{
mounted
()
{
this
.
showFormItem
()
this
.
showFormItem
()
console
.
log
(
this
.
activeName
)
console
.
log
(
this
.
activeName
)
},
},
beforeDestroy
()
{
beforeDestroy
()
{
this
.
$watch
(
this
.
$watch
(
()
=>
this
.
form
[
this
.
item
.
prop
],
()
=>
this
.
form
[
this
.
item
.
prop
],
(
newVal
,
oldVal
)
=>
{}
(
newVal
,
oldVal
)
=>
{
}
)
)
},
},
methods
:
{
methods
:
{
// 获取医联体列表
// 获取医联体列表
getMedicalunionList
()
{
getMedicalunionList
()
{
getMedicalunionList
().
then
((
res
)
=>
{
getMedicalunionList
().
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
if
(
res
.
code
==
1
)
{
this
.
unionList
=
[...
res
.
data
]
this
.
unionList
=
[...
res
.
data
]
...
@@ -583,17 +592,17 @@ export default {
...
@@ -583,17 +592,17 @@ export default {
}
}
})
})
},
},
scrollToView
()
{
scrollToView
()
{
if
(
this
.
$refs
[
"
JY_LCYY
"
])
{
if
(
this
.
$refs
[
"
JY_LCYY
"
])
{
this
.
$refs
[
"
JY_LCYY
"
].
$el
.
scrollIntoView
({
behavior
:
"
smooth
"
})
this
.
$refs
[
"
JY_LCYY
"
].
$el
.
scrollIntoView
({
behavior
:
"
smooth
"
})
}
}
},
},
openToothBit
()
{
openToothBit
()
{
this
.
$refs
.
dialog
.
open
()
this
.
$refs
.
dialog
.
open
()
},
},
// 处理timerange 重置后不能选择的问题
// 处理timerange 重置后不能选择的问题
timerangeReset
()
{
timerangeReset
()
{
if
(
this
.
item
.
type
===
"
timerange
"
)
{
if
(
this
.
item
.
type
===
"
timerange
"
)
{
this
.
$watch
(
`form.
${
this
.
item
.
prop
}
`
,
(
val
)
=>
{
this
.
$watch
(
`form.
${
this
.
item
.
prop
}
`
,
(
val
)
=>
{
if
(
val
&&
val
.
length
===
1
)
{
if
(
val
&&
val
.
length
===
1
)
{
...
@@ -603,7 +612,7 @@ export default {
...
@@ -603,7 +612,7 @@ export default {
}
}
},
},
// 处理number 默认为0的问题
// 处理number 默认为0的问题
numberReset
()
{
numberReset
()
{
if
(
this
.
item
.
type
===
"
number
"
)
{
if
(
this
.
item
.
type
===
"
number
"
)
{
this
.
$watch
(
this
.
$watch
(
`form.
${
this
.
item
.
prop
}
`
,
`form.
${
this
.
item
.
prop
}
`
,
...
@@ -618,7 +627,7 @@ export default {
...
@@ -618,7 +627,7 @@ export default {
},
},
// 处理数组 默认值的问题
// 处理数组 默认值的问题
checkboxReset
()
{
checkboxReset
()
{
const
{
type
,
multiple
,
value
}
=
this
.
item
const
{
type
,
multiple
,
value
}
=
this
.
item
if
(
if
(
type
===
"
checkbox
"
||
type
===
"
checkbox
"
||
...
@@ -641,7 +650,7 @@ export default {
...
@@ -641,7 +650,7 @@ export default {
},
},
// 处理复选框排斥
// 处理复选框排斥
checkboxRepel
(
val
)
{
checkboxRepel
(
val
)
{
const
{
repelValue
,
repel
}
=
this
.
item
const
{
repelValue
,
repel
}
=
this
.
item
if
(
repel
&&
repelValue
)
{
if
(
repel
&&
repelValue
)
{
const
len
=
val
.
length
const
len
=
val
.
length
...
@@ -658,7 +667,7 @@ export default {
...
@@ -658,7 +667,7 @@ export default {
}
}
},
},
// 处理运算规则
// 处理运算规则
handleAlgorithm
()
{
handleAlgorithm
()
{
const
{
algorithm
}
=
this
.
item
const
{
algorithm
}
=
this
.
item
if
(
algorithm
)
{
if
(
algorithm
)
{
const
algorithmArr
=
algorithm
.
split
(
"
;
"
)
//多个规则数组集合
const
algorithmArr
=
algorithm
.
split
(
"
;
"
)
//多个规则数组集合
...
@@ -675,13 +684,13 @@ export default {
...
@@ -675,13 +684,13 @@ export default {
if
(
process
.
includes
(
"
stop
"
))
return
if
(
process
.
includes
(
"
stop
"
))
return
try
{
try
{
this
.
$set
(
this
.
form
,
target
,
eval
(
process
))
this
.
$set
(
this
.
form
,
target
,
eval
(
process
))
}
catch
{}
}
catch
{
}
}
}
})
})
}
}
},
},
// 自定义方法规则
// 自定义方法规则
handleSelfProcess
(
algorithmValue
)
{
handleSelfProcess
(
algorithmValue
)
{
const
type
=
algorithmValue
[
0
]
const
type
=
algorithmValue
[
0
]
const
ruleTarget
=
algorithmValue
[
1
]
const
ruleTarget
=
algorithmValue
[
1
]
const
ruleArgs
=
algorithmValue
[
2
]
const
ruleArgs
=
algorithmValue
[
2
]
...
@@ -719,7 +728,7 @@ export default {
...
@@ -719,7 +728,7 @@ export default {
val
&&
this
.
$set
(
this
.
form
,
ruleTarget
,
val
)
val
&&
this
.
$set
(
this
.
form
,
ruleTarget
,
val
)
},
},
// 根据生日设置年龄回显
// 根据生日设置年龄回显
getAge
()
{
getAge
()
{
if
(
this
.
form
.
birthday
&&
this
.
form
.
survey_time
)
{
if
(
this
.
form
.
birthday
&&
this
.
form
.
survey_time
)
{
var
birthday
=
new
Date
(
this
.
form
.
birthday
.
replace
(
/-/g
,
"
/
"
))
var
birthday
=
new
Date
(
this
.
form
.
birthday
.
replace
(
/-/g
,
"
/
"
))
let
d
=
new
Date
(
this
.
form
.
survey_time
.
replace
(
/-/g
,
"
/
"
))
let
d
=
new
Date
(
this
.
form
.
survey_time
.
replace
(
/-/g
,
"
/
"
))
...
@@ -727,12 +736,13 @@ export default {
...
@@ -727,12 +736,13 @@ export default {
d
.
getFullYear
()
-
d
.
getFullYear
()
-
birthday
.
getFullYear
()
-
birthday
.
getFullYear
()
-
(
d
.
getMonth
()
<
birthday
.
getMonth
()
||
(
d
.
getMonth
()
<
birthday
.
getMonth
()
||
(
d
.
getMonth
()
==
birthday
.
getMonth
()
&&
(
d
.
getMonth
()
==
birthday
.
getMonth
()
&&
d
.
getDate
()
<
birthday
.
getDate
())
d
.
getDate
()
<
birthday
.
getDate
())
?
1
?
1
:
0
)
:
0
)
this
.
$store
.
commit
(
"
table/setAge
"
,
age
)
this
.
$store
.
commit
(
"
table/setAge
"
,
age
)
this
.
form
.
age
=
this
.
age
this
.
form
.
age
=
this
.
age
console
.
log
(
'
年龄有问题
'
,
this
.
form
);
console
.
log
(
this
.
form
.
age
,
"
---
"
,
age
)
console
.
log
(
this
.
form
.
age
,
"
---
"
,
age
)
}
else
{
}
else
{
let
age
=
""
let
age
=
""
...
@@ -742,21 +752,21 @@ export default {
...
@@ -742,21 +752,21 @@ export default {
}
}
},
},
// 获取prop prop 以{}包裹
// 获取prop prop 以{}包裹
getProp
(
value
)
{
getProp
(
value
)
{
if
(
!
value
)
return
""
if
(
!
value
)
return
""
return
value
.
replace
(
/
[
{
][\w]
*
[
}
]
/g
,
(
word
)
=>
{
return
value
.
replace
(
/
[
{
][\w]
*
[
}
]
/g
,
(
word
)
=>
{
return
word
.
replace
(
/{|}/g
,
""
)
return
word
.
replace
(
/{|}/g
,
""
)
})
})
},
},
// 获取运算过程
// 获取运算过程
getProcess
(
value
)
{
getProcess
(
value
)
{
return
value
.
replace
(
/
[
{
][\w]
*
[
}
]
/g
,
(
word
)
=>
{
return
value
.
replace
(
/
[
{
][\w]
*
[
}
]
/g
,
(
word
)
=>
{
const
actualValue
=
this
.
form
[
word
.
replace
(
/{|}/g
,
""
)]
const
actualValue
=
this
.
form
[
word
.
replace
(
/{|}/g
,
""
)]
return
actualValue
?
actualValue
:
"
stop
"
return
actualValue
?
actualValue
:
"
stop
"
})
})
},
},
// 表单子项控制显隐
// 表单子项控制显隐
showFormItem
()
{
showFormItem
()
{
const
{
dynamicshSet
,
prop
,
noImmediate
}
=
this
.
item
const
{
dynamicshSet
,
prop
,
noImmediate
}
=
this
.
item
if
(
dynamicshSet
&&
dynamicshSet
.
length
>
0
)
{
if
(
dynamicshSet
&&
dynamicshSet
.
length
>
0
)
{
this
.
$watch
(
this
.
$watch
(
...
@@ -860,8 +870,8 @@ export default {
...
@@ -860,8 +870,8 @@ export default {
const
newVal
=
Array
.
isArray
(
this
.
form
[
targetItem
.
prop
])
const
newVal
=
Array
.
isArray
(
this
.
form
[
targetItem
.
prop
])
?
[]
?
[]
:
targetItem
.
type
===
"
number
"
:
targetItem
.
type
===
"
number
"
?
undefined
?
undefined
:
""
:
""
this
.
$set
(
this
.
form
,
targetItem
.
prop
,
newVal
)
this
.
$set
(
this
.
form
,
targetItem
.
prop
,
newVal
)
}
}
if
(
this
.
type
===
"
form
"
)
{
if
(
this
.
type
===
"
form
"
)
{
...
@@ -962,11 +972,11 @@ export default {
...
@@ -962,11 +972,11 @@ export default {
}
}
},
},
//
//
handleBlur
()
{
handleBlur
()
{
this
.
handleAlgorithm
()
this
.
handleAlgorithm
()
},
},
// 每个表单值改变的方法
// 每个表单值改变的方法
handleChange
(
val
)
{
handleChange
(
val
)
{
this
.
checkboxRepel
(
val
)
this
.
checkboxRepel
(
val
)
this
.
handleAlgorithm
()
this
.
handleAlgorithm
()
// !设置年龄
// !设置年龄
...
@@ -987,7 +997,7 @@ export default {
...
@@ -987,7 +997,7 @@ export default {
this
.
$emit
(
"
formChange
"
)
this
.
$emit
(
"
formChange
"
)
// ['is_one_year','is_subtotal_history','is_ppi','is_symptom','is_subtotal_history','is_disease','is_tumour']
// ['is_one_year','is_subtotal_history','is_ppi','is_symptom','is_subtotal_history','is_disease','is_tumour']
},
},
validUpload
(
prop
)
{
validUpload
(
prop
)
{
this
.
$emit
(
"
validUpload
"
,
prop
)
this
.
$emit
(
"
validUpload
"
,
prop
)
},
},
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment