Commit 8fa86e09 authored by songrui's avatar songrui

简易筛查表单接口对接

parent b186fe49
import { fetchBase } from './fetch.js' import { fetchBase } from './fetch.js'
// 简易筛查 新增
export function addSimpleScreen(params, loading = true) {
return fetchBase({ url: `/v1/h5-app/add-simple-screen`, body: params, loading })
}
...@@ -455,8 +455,9 @@ export function getQuestion(key, info) { ...@@ -455,8 +455,9 @@ export function getQuestion(key, info) {
remark: '建议进一步检查前列腺特异性抗原、前列腺特异性抗原正常—定期复查、前列腺特异性抗原升—高前列腺磁共振及穿刺活检' remark: '建议进一步检查前列腺特异性抗原、前列腺特异性抗原正常—定期复查、前列腺特异性抗原升—高前列腺磁共振及穿刺活检'
} }
} }
const result = questions['q' + key] const q = questions['q' + key]
return result ? new Question(result, info) : {} const result = q ? new Question(q, info) : {}
return { ...result, key }
} }
class Question { class Question {
......
...@@ -35,7 +35,8 @@ export default { ...@@ -35,7 +35,8 @@ export default {
// 操作步骤 // 操作步骤
setp: 1, setp: 1,
// 步骤1中选中的癌种 // 步骤1中选中的癌种
species: [] species: [],
baseInfo: {}
} }
}, },
computed: { computed: {
...@@ -53,13 +54,18 @@ export default { ...@@ -53,13 +54,18 @@ export default {
onNext() { onNext() {
this.$refs.base.submit().then(res => { this.$refs.base.submit().then(res => {
console.log(res) console.log(res)
this.baseInfo = res
this.species = res.species || [] this.species = res.species || []
this.setp = 2 this.setp = 2
}) })
}, },
submit() { submit() {
this.$refs.question.submit().then(res => { this.$refs.question.submit().then(res => {
console.log(res) const result = {
...this.baseInfo,
details: res
}
console.log(result)
}) })
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:label="q.title" :label="q.title"
:rules="[{ required: true, message: '请选择' }]"> :rules="[{ required: true, message: '请选择' }]">
<template #input> <template #input>
<van-radio-group v-model="q.value" @change="onChange($event, item)"> <van-radio-group v-model="q.value" @change="onChange($event, item)" class="pl-2">
<van-radio v-for="a in q.answer.cont" shape="dot" class="mt-2" <van-radio v-for="a in q.answer.cont" shape="dot" class="mt-2"
:name="a.value" :key="a.value">{{a.name}}</van-radio> :name="a.value" :key="a.value">{{a.name}}</van-radio>
</van-radio-group> </van-radio-group>
...@@ -65,15 +65,26 @@ export default { ...@@ -65,15 +65,26 @@ export default {
console.log(this.formData) console.log(this.formData)
}, },
onChange(val, item) { onChange(val, item) {
console.log(val, item) // console.log(val, item)
console.log('高危判断', item.check()) // console.log('高危判断', item.check())
item.highRisk = item.check() ? 1 : 2 item.highRisk = item.check() ? 1 : 2
}, },
submit() { submit() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(res => {
console.log(res, this.formData) console.log(res, this.formData)
resolve(this.formData) const result = {}
this.formData.forEach(e => {
const issue = {}
e.issue.forEach(i => {
issue[i.key] = i.value
})
result[e.key] = {
highRisk: e.highRisk,
...issue
}
})
resolve(result)
}).catch(err => { }).catch(err => {
console.warn(err) console.warn(err)
}) })
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
label-width="100%" label-width="100%"
:rules="rules.species"> :rules="rules.species">
<template #input> <template #input>
<van-checkbox-group v-model="form.species" class="pt-2"> <van-checkbox-group v-model="form.species" class="pt-2 pl-2">
<van-checkbox v-for="(item, index) in cancerArray" :key="index" <van-checkbox v-for="(item, index) in cancerArray" :key="index"
:name="item.value" shape="square" :name="item.value" shape="square"
class="mb-3">{{ item.name }}</van-checkbox> class="mb-3">{{ item.name }}</van-checkbox>
......
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