Commit dc4b62eb authored by songrui's avatar songrui

初筛表单

parent 0723fc54
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
if (!token) { if (!token) {
token = sessionStorage.getItem('token') token = sessionStorage.getItem('token')
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
token = '6cc7a6e9-e78f-49f2-947b-91fc3e163f55' token = '572426d2-302f-4e35-ba69-edc612a205bf'
} }
} }
if (token) { if (token) {
...@@ -190,4 +190,54 @@ export default { ...@@ -190,4 +190,54 @@ export default {
display: none; display: none;
} }
} }
// form表单
.doc-form {
.doc-form-label {
color: #595959;
margin-top: 20px;
margin-bottom: 8px;
&[required]::after {
content: "*";
color: red;
font-weight: bold;
margin-left: 4px;
}
}
.van-field {
background-color: #FAFAFA;
padding: 8px 12px;
border-radius: 8px;
&::after {
display: none;
}
}
.no-back {
background-color: #fff;
}
.tip-box {
margin-top: 20px;
margin-bottom: 8px;
.doc-form-label {
margin: 0
}
>span {
color: #8C8C8C;
font-size: 12px;
}
}
}
// 单选
.doc-radio-group {
column-gap: 10px;
.van-radio {
background-color: #FAFAFA;
padding: 8px 12px;
border-radius: 8px;
justify-content: space-between;
margin-right: 0;
flex-grow: 1;
}
}
</style> </style>
...@@ -57,8 +57,8 @@ export default { ...@@ -57,8 +57,8 @@ export default {
}) })
}, },
onConfirm({ selectedValues, selectedOptions }) { onConfirm({ selectedValues, selectedOptions }) {
this.$emit('update:value', selectedValues[0]) this.$emit('update:value', selectedValues[0] || {})
this.$emit('change', selectedOptions[0]) this.$emit('change', selectedOptions[0] || {})
this.$emit('update:show', false) this.$emit('update:show', false)
}, },
onCancel() { onCancel() {
......
...@@ -64,8 +64,8 @@ export default { ...@@ -64,8 +64,8 @@ export default {
}) })
}, },
onConfirm({ selectedValues, selectedOptions }) { onConfirm({ selectedValues, selectedOptions }) {
this.$emit('update:value', selectedValues[0]) this.$emit('update:value', selectedValues[0] || {})
this.$emit('change', selectedOptions[0]) this.$emit('change', selectedOptions[0] || {})
this.$emit('update:show', false) this.$emit('update:show', false)
}, },
onCancel() { onCancel() {
......
...@@ -74,8 +74,8 @@ export default { ...@@ -74,8 +74,8 @@ export default {
return getUnitByName(query) return getUnitByName(query)
}, },
onConfirm({ selectedValues, selectedOptions }) { onConfirm({ selectedValues, selectedOptions }) {
this.$emit('update:value', selectedValues[0]) this.$emit('update:value', selectedValues[0] || {})
this.$emit('change', selectedOptions[0]) this.$emit('change', selectedOptions[0] || {})
this.$emit('update:show', false) this.$emit('update:show', false)
this.searchStr = '' this.searchStr = ''
}, },
......
<template>
<div class="doctor-info">
<div class="doc-form-label" required>筛查单位</div>
<van-field is-link
v-model='form.screenUnitName'
readonly
placeholder='请选择'
name="screenUnitId"
@click="showUnit = true"
:rules="[{ required: true, message: '请选择' }]"
/>
<DocUnit v-model:show="showUnit"
v-model:value="form.screenUnitId"
:valueName="form?.screenUnitName"
@change="unitChange"
/>
<div class="doc-form-label" required>筛查科室</div>
<van-field is-link
v-model='form.screenOfficeName'
readonly
placeholder='请选择'
name="screenOfficeId"
@click="showOffice = true"
:rules="[{ required: true, message: '请选择' }]"
/>
<DocOffice v-model:show="showOffice"
v-model:value="form.screenOfficeId"
:unitId="form.screenUnitId"
@change="officeChange"
/>
<div class="doc-form-label" required>筛查医生</div>
<van-field is-link
v-model='form.screenDoctorName'
readonly
placeholder='请选择'
name="screenDoctorId"
@click="showDoctor = true"
:rules="[{ required: true, message: '请选择' }]"
/>
<DocOfficeDoctor v-model:show="showDoctor"
:allowClear="false"
v-model:value="form.screenDoctorId"
:unitId="form.screenUnitId"
:officeId="form.screenOfficeId"
@change="(option) => { form.screenDoctorName = option.staffName }"
/>
</div>
</template>
<script>
import { useStore } from '@/doctor/store'
import dayjs from 'dayjs'
import DocUnit from '@/doctor/components/docUnit/DocUnit.vue'
import DocOffice from '@/doctor/components/docOffice/DocOffice.vue'
import DocOfficeDoctor from '@/doctor/components/docOfficeDoctor/DocOfficeDoctor.vue'
const defaultForm = (info = {}) => {
const form = {
createDate: undefined,
// 随访单位
screenUnitId: undefined,
screenUnitName: undefined,
// 随访科室
screenOfficeId: undefined,
screenOfficeName: undefined,
// 随访医生
screenDoctorId: undefined,
screenDoctorName: undefined,
// 录入单位
createUnitId: undefined,
createUnitName: undefined,
// 录入科室
createOfficeId: undefined,
createOfficeName: undefined,
// 录入医生
createDoctorId: undefined,
createDoctorName: undefined
}
Reflect.ownKeys(form).forEach(key => {
if (info[key] != undefined) {
form[key] = info[key]
}
})
return form
}
export default {
components: {
DocUnit,
DocOffice,
DocOfficeDoctor
},
props: {
info: { default: () => ({}) }
},
data() {
return {
form: {},
store: useStore(),
showUnit: false,
showOffice: false,
showDoctor: false
}
},
computed: {
authInfo() {
return this.store.authInfo
}
},
methods: {
initForm() {
this.form.createDate = dayjs().format('YYYY-MM-DD')
// 随访单位
this.form.screenUnitId = this.authInfo.unitId
this.form.screenUnitName = this.authInfo.unitName
// 随访科室
this.form.screenOfficeId = this.authInfo.officeId
this.form.screenOfficeName = this.authInfo.officeName
// 随访医生
this.form.screenDoctorId = this.authInfo.relationId
this.form.screenDoctorName = this.authInfo.nickName
// 录入单位
this.form.createUnitId = this.authInfo.unitId
this.form.createUnitName = this.authInfo.unitName
// 录入科室
this.form.createOfficeId = this.authInfo.officeId
this.form.createOfficeName = this.authInfo.officeName
// 录入医生
this.form.createDoctorId = this.authInfo.relationId
this.form.createDoctorName = this.authInfo.nickName
},
unitChange(option = {}) {
this.form.screenUnitName = option.unitName
this.form.screenDoctorId = undefined
this.form.screenDoctorName = undefined
this.form.screenOfficeId = undefined
this.form.screenOfficeName = undefined
},
officeChange(option = {}) {
this.form.screenOfficeName = option.officeName
this.form.screenDoctorId = undefined
this.form.screenDoctorName = undefined
},
submit() {
return this.form
}
},
watch: {
info: {
handler(info) {
this.form = defaultForm(info)
if (!this.info.id) {
this.initForm()
}
},
immediate: true
}
}
}
</script>
<style lang="less" scoped></style>
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:backFunc="onBack"></DocNavBar> :backFunc="onBack"></DocNavBar>
<div class="p-4 overflow-y-auto grow" ref="all"> <div class="p-4 overflow-y-auto grow" ref="all">
<archiveCommon :info="baseInfo" v-if="step == 1"></archiveCommon> <archiveCommon :info="baseInfo" v-if="step == 1"></archiveCommon>
<FormCont v-else-if="step == 2"/> <FormCont v-else-if="step == 2" ref="FormCont"/>
<Result v-else-if="step == 3" :residentInfoId="residentInfoId"/> <Result v-else-if="step == 3" :residentInfoId="residentInfoId"/>
</div> </div>
<div class="shrink-0" v-if="step !== 3"> <div class="shrink-0" v-if="step !== 3">
...@@ -65,8 +65,12 @@ export default { ...@@ -65,8 +65,12 @@ export default {
} }
}, },
toNext(val) { toNext(val) {
this.$refs.all.scrollTo(0, 0) if (val == 3) {
this.$refs.FormCont.submit()
return
}
this.step = val this.step = val
this.$refs.all.scrollTo(0, 0)
}, },
onBack() { onBack() {
if (this.step == 1) { if (this.step == 1) {
......
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