Commit bb9e40c3 authored by songrui's avatar songrui

文件名称修改

parent eff07d64
<template>
<div class="h-full chronic-home">
<router-view v-slot="{ Component }">
<Transition name="route" mode="out-in">
<component :is="Component" v-if="visible"/>
</Transition>
</router-view>
</div>
</template>
<script>
import { getDict } from './api/base.js'
import { useStore } from './store/index.js'
export default {
data() {
return {
visible: false
}
},
setup() {
const store = useStore()
return { store }
},
created() {
this.init()
},
methods: {
async init() {
console.log(this.visible)
const res = await getDict()
this.store.$patch({ dict: res.data || {} })
this.visible = true
}
}
}
</script>
<style lang="less" scoped>
</style>
import { fetchBase } from '@/utils/fetch.js'
import { setSessionStorage, getSessionStorage } from '@/utils/common.js'
// 获取字典
export function getDict() {
return fetchBase({ url: `/tumour-admin/v1/h5-app/dict`, loading: true })
}
// 区划编码查询下级
export function getAreaChild(parentCode, loading = true) {
const key = 'chronic-area-cache'
return new Promise((resolve, reject) => {
const result = getSessionStorage(key) || {}
if (result[parentCode]) {
resolve(result[parentCode])
return
}
fetchBase({ url: `/tumour-admin/v1/h5-app/child-area/${parentCode}`, loading }).then(res => {
result[parentCode] = res.data
setSessionStorage(key, result)
resolve(res.data)
}).catch(err => {
reject(err)
})
})
}
// 居民基本信息查询
export function getResidentInfo(idCard) {
return fetchBase({ url: `/tumour-admin/v1/h5-app/residents/${idCard}`, loading: true })
}
<template>
<div class="h-full flex flex-col id-check">
<div class="flex py-2">
<div class="px-4 title">基本信息</div>
<div class="text-12">请准确填写您的证件信息,标*内容为必填</div>
</div>
<van-form label-width="5em" ref="form">
<van-field required
v-model="form.certificateTypeTrans"
is-link
readonly
name="certificateType"
label="证件类型"
placeholder="请选择"
disabled/>
<van-field v-model="form.idCard"
required
center
clearable
name="idCard"
label="证件号码"
placeholder="请输入"
:rules="rules.idCard"
>
</van-field>
</van-form>
<div class="px-4 pb-4 grow flex flex-col justify-end">
<van-button type="primary" block
@click="submit">下一步</van-button>
</div>
</div>
</template>
<script>
import { useStore } from '@/chronic/store/index.js'
import { idCardRule } from '@/utils/commonReg.js'
export default {
data() {
return {
form: {
idCard: '',
certificateType: 1,
certificateTypeTrans: ''
},
rules: {
idCard: [{ required: true, message: '请输入' }, idCardRule],
certificateType: [{ required: true, message: '请选择' }]
}
}
},
setup() {
const store = useStore()
return { store }
},
created() {
this.init()
},
methods: {
init() {
console.log(this.store, this.store.getDictValue('DC00004', this.form.certificateType))
this.form.certificateTypeTrans = this.store.getDictValue('DC00004', this.form.certificateType)
},
submit() {
this.$refs.form.validate().then(res => {
console.log(res, this.form)
}).catch(err => {
console.warn(err)
})
}
}
}
</script>
<style lang="less" scoped>
@import '../../../utils/common.less';
</style>
<template>
<div class="h-full pb-5 flex flex-col ">
<div class="p-3 text-16 text-black text-center shrink-0 top-bar">
<span class="back-bt" @click="onBack" v-if="setp >= 2">
<doc-icon type="doc-left" />
</span>
<span>慢病自我初筛</span>
</div>
<div class="grow overflow-y-auto">
<IdCheck v-show="setp === 1"/>
</div>
</div>
</template>
<script>
import { showNotify } from 'vant'
import IdCheck from './IdCheck.vue'
export default {
components: {
IdCheck
},
data() {
return {
// 操作步骤
setp: 1,
}
},
computed: {
routeQuery() {
return this.$route.query
},
doctorId() {
return this.routeQuery.doctorId
}
},
created() {
if (!this.doctorId) {
showNotify({ type: 'warning', message: '未获取到医生信息', duration: 0 })
}
},
methods: {
onBack() {
if (this.setp === 1) return
this.setp--
}
}
}
</script>
<style lang="less" scoped>
.top-bar {
position: relative;
border-bottom: 1px solid #0000001A;
.back-bt {
position: absolute;
left: .16rem;
}
}
</style>
import { defineStore } from 'pinia'
export const useStore = defineStore('chronic', {
state: () => {
return {
// 字典
dict: []
}
},
getters: {},
actions: {
getDict(dict) {
if (!dict) return []
return this.dict[dict] || []
},
getDictValue(dict, value) {
let array = []
if (typeof dict === 'string') {
array = this.dict[dict]
} else {
array = dict
}
if (!array || !array.length) {
return ''
}
let temp = array.find(e => e.value == value) || {}
return temp.name || ''
}
}
})
.title {
font-weight: 600;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
background: var(--van-primary-color);
height: 16px;
width: 4px;
margin-right: 4px;
}
}
\ No newline at end of file
...@@ -12,19 +12,7 @@ const routes = [ ...@@ -12,19 +12,7 @@ const routes = [
component: () => import(/* webpackChunkName: "page-tumour" */ '@/tumour/screening/simple/form/Index.vue') component: () => import(/* webpackChunkName: "page-tumour" */ '@/tumour/screening/simple/form/Index.vue')
} }
] ]
}, }
{
path: '/chronic',
name: 'chronic',
component: () => import(/* webpackChunkName: "page-chronic" */ '@/chronic/Chronic.vue'),
children: [
{
path: 'screening/first/form',
name: 'chronic-screening-first-form',
component: () => import(/* webpackChunkName: "page-chronic" */ '@/chronic/screening/first/form/Index.vue')
}
]
},
] ]
const router = createRouter({ const router = createRouter({
......
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