Commit 332e5324 authored by miaojiale's avatar miaojiale

修复年龄回显

parent 6117df42
......@@ -95,12 +95,17 @@
slot="append"
class="toothBit"
@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 }}
</template>
<template v-if="item.prepend" slot="prepend">
<template
v-if="item.prepend"
slot="prepend"
>
{{ item.prepend }}
</template>
</el-input>
......@@ -125,10 +130,16 @@
"
@blur="handleBlur"
>
<template v-if="item.append" slot="append">
<template
v-if="item.append"
slot="append"
>
{{ item.append }}
</template>
<template v-if="item.prepend" slot="prepend">
<template
v-if="item.prepend"
slot="prepend"
>
{{ item.prepend }}
</template>
</el-input>
......@@ -157,7 +168,10 @@
</template>
<!-- 计数器 -->
<div v-if="item.type === 'number'" style="display: inline-table">
<div
v-if="item.type === 'number'"
style="display: inline-table"
>
<el-input-number
v-model="form[item.prop]"
:readonly="item.readonly"
......@@ -176,8 +190,7 @@
v-if="item.append"
class="el-input-group__append"
style="line-height: 28px"
>{{ item.append }}</span
>
>{{ item.append }}</span>
</div>
<!-- 单选框 -->
......@@ -191,8 +204,7 @@
v-for="(opt, optIndex) in item.dicData"
:key="optIndex"
:label="opt.value"
>{{ opt.label }}</el-radio
>
>{{ opt.label }}</el-radio>
</el-radio-group>
<!-- 单选框只读 -->
<!-- <div
......@@ -221,8 +233,7 @@
v-for="(opt, optIndex) in item.dicData"
:key="optIndex"
:label="opt.value"
>{{ opt.label }}</el-checkbox
>
>{{ opt.label }}</el-checkbox>
</el-checkbox-group>
</template>
......@@ -333,8 +344,7 @@
$route.path != '/followupresearch'
"
style="margin-left: 12px"
>{{ age + (age ? "岁" : "") }}</span
>
>{{ form['age'] + (form['age'] ? "岁" : "") }}</span>
</div>
<!-- 年 -->
<el-date-picker
......@@ -433,8 +443,7 @@
<span
v-if="item.importantField && !getVwForm.detail"
class="important_field"
>{{ item.importantFieldDesc || "*" }}</span
>
>{{ item.importantFieldDesc || "*" }}</span>
</div>
</el-form-item>
</el-col>
......@@ -473,15 +482,15 @@ export default {
},
getPatientId: {
type: Function,
default: () => {},
default: () => { },
},
getDefectsSet: {
type: Function,
default: () => {},
default: () => { },
},
configForms: {
type: Function,
default: () => {},
default: () => { },
},
},
props: {
......@@ -500,7 +509,7 @@ export default {
columnIndex: Number,
group: Array,
},
data() {
data () {
return {
// age: "",
pickerOptions,
......@@ -513,11 +522,11 @@ export default {
...mapGetters({
age: ["table/age"],
}),
getVwForm() {
getVwForm () {
return this.vwForm()
},
//重要字段空数据且填写表单时添加重点
isEmpty() {
isEmpty () {
const { importantField, prop } = this.item
if (!importantField || this.getVwForm.detail) return ""
......@@ -529,14 +538,14 @@ export default {
}
return empty ? "empty-tip" : ""
},
defectsSet() {
defectsSet () {
return this.getDefectsSet ? this.getDefectsSet() : []
},
patientId() {
patientId () {
return this.getPatientId ? this.getPatientId() : ""
},
},
created() {
created () {
this.timerangeReset()
this.numberReset()
this.checkboxReset()
......@@ -562,19 +571,19 @@ export default {
}
}
},
mounted() {
mounted () {
this.showFormItem()
console.log(this.activeName)
},
beforeDestroy() {
beforeDestroy () {
this.$watch(
() => this.form[this.item.prop],
(newVal, oldVal) => {}
(newVal, oldVal) => { }
)
},
methods: {
// 获取医联体列表
getMedicalunionList() {
getMedicalunionList () {
getMedicalunionList().then((res) => {
if (res.code == 1) {
this.unionList = [...res.data]
......@@ -583,17 +592,17 @@ export default {
}
})
},
scrollToView() {
scrollToView () {
if (this.$refs["JY_LCYY"]) {
this.$refs["JY_LCYY"].$el.scrollIntoView({ behavior: "smooth" })
}
},
openToothBit() {
openToothBit () {
this.$refs.dialog.open()
},
// 处理timerange 重置后不能选择的问题
timerangeReset() {
timerangeReset () {
if (this.item.type === "timerange") {
this.$watch(`form.${this.item.prop}`, (val) => {
if (val && val.length === 1) {
......@@ -603,7 +612,7 @@ export default {
}
},
// 处理number 默认为0的问题
numberReset() {
numberReset () {
if (this.item.type === "number") {
this.$watch(
`form.${this.item.prop}`,
......@@ -618,7 +627,7 @@ export default {
},
// 处理数组 默认值的问题
checkboxReset() {
checkboxReset () {
const { type, multiple, value } = this.item
if (
type === "checkbox" ||
......@@ -641,7 +650,7 @@ export default {
},
// 处理复选框排斥
checkboxRepel(val) {
checkboxRepel (val) {
const { repelValue, repel } = this.item
if (repel && repelValue) {
const len = val.length
......@@ -658,7 +667,7 @@ export default {
}
},
// 处理运算规则
handleAlgorithm() {
handleAlgorithm () {
const { algorithm } = this.item
if (algorithm) {
const algorithmArr = algorithm.split(";") //多个规则数组集合
......@@ -675,13 +684,13 @@ export default {
if (process.includes("stop")) return
try {
this.$set(this.form, target, eval(process))
} catch {}
} catch { }
}
})
}
},
// 自定义方法规则
handleSelfProcess(algorithmValue) {
handleSelfProcess (algorithmValue) {
const type = algorithmValue[0]
const ruleTarget = algorithmValue[1]
const ruleArgs = algorithmValue[2]
......@@ -719,7 +728,7 @@ export default {
val && this.$set(this.form, ruleTarget, val)
},
// 根据生日设置年龄回显
getAge() {
getAge () {
if (this.form.birthday && this.form.survey_time) {
var birthday = new Date(this.form.birthday.replace(/-/g, "/"))
let d = new Date(this.form.survey_time.replace(/-/g, "/"))
......@@ -733,6 +742,7 @@ export default {
: 0)
this.$store.commit("table/setAge", age)
this.form.age = this.age
console.log('年龄有问题', this.form);
console.log(this.form.age, "---", age)
} else {
let age = ""
......@@ -742,21 +752,21 @@ export default {
}
},
// 获取prop prop 以{}包裹
getProp(value) {
getProp (value) {
if (!value) return ""
return value.replace(/[{][\w]*[}]/g, (word) => {
return word.replace(/{|}/g, "")
})
},
// 获取运算过程
getProcess(value) {
getProcess (value) {
return value.replace(/[{][\w]*[}]/g, (word) => {
const actualValue = this.form[word.replace(/{|}/g, "")]
return actualValue ? actualValue : "stop"
})
},
// 表单子项控制显隐
showFormItem() {
showFormItem () {
const { dynamicshSet, prop, noImmediate } = this.item
if (dynamicshSet && dynamicshSet.length > 0) {
this.$watch(
......@@ -962,11 +972,11 @@ export default {
}
},
//
handleBlur() {
handleBlur () {
this.handleAlgorithm()
},
// 每个表单值改变的方法
handleChange(val) {
handleChange (val) {
this.checkboxRepel(val)
this.handleAlgorithm()
// !设置年龄
......@@ -987,7 +997,7 @@ export default {
this.$emit("formChange")
// ['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)
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment