Commit 412b204e authored by songrui's avatar songrui

机构、医生、科室选择组件

parent 2cb0af21
......@@ -18,4 +18,19 @@ export function getResidentByPage(params) {
// 查询待随访列表
export function getVisitAll(params, loading = true) {
return fetchBase({ url: `/chronic-admin/v1/chronic-visit-task/query-all-list`, body: params, loading })
}
// 根据单位名称模糊查询单位信息
export function getUnitByName(orgName) {
return fetchBase({ url: `/tumour-admin/v1/sys-user/org-by-name/${orgName}` })
}
// 根据单位id查询科室
export function getOfficeList(unitId) {
return fetchBase({ url: `/tumour-admin/v1/sys-user/org-office/${unitId}` })
}
// 根据科室id查询医生
export function getOfficeDoctor(unitId, officeId) {
return fetchBase({ url: `/tumour-admin/v1/sys-user/org-office-doctors/${unitId}/${officeId}` })
}
\ No newline at end of file
......@@ -25,6 +25,7 @@ export default {
buttonPrimaryBorderColor: '#607FF0',
buttonDefaultBorderColor: '#BFBFBF',
buttonNormalFontSize: '.16rem',
loadingSpinnerColor: '#607FF0',
// 表单相关
cellVerticalPadding: '.15rem',
cellTextColor: '#262626',
......
<template>
<van-popup :show="innerShow" position="bottom"
class="doc-unit">
<van-picker :loading="loading"
title="科室选择"
:columns="array"
:columns-field-names="fieldNames"
v-model="innerValue"
@confirm="onConfirm"
@cancel="onCancel"
>
</van-picker>
</van-popup>
</template>
<script>
import { getOfficeList } from '@/api/doctor/generalFU.js'
export default {
name: 'DocUnit',
props: {
show: Boolean,
value: [String, Number],
unitId: [String, Number],
fieldNames: {
type: Object,
default: () => {
return {text: 'officeName', value: 'id'}
}
}
},
emits: ['update:show', 'update:value', 'change'],
data() {
return {
innerValue: undefined,
array: [],
loading: false,
}
},
computed: {
innerShow() {
return this.show
},
innerUnitId() {
return this.unitId
}
},
created() {
this.getData()
},
methods: {
getData() {
this.array = []
this.loading = true
getOfficeList(this.innerUnitId).then(res => {
this.array = res.data || []
}).finally(() => {
this.loading = false
})
},
onConfirm({ selectedValues, selectedOptions }) {
this.$emit('update:value', selectedValues[0])
this.$emit('change', selectedOptions[0])
this.$emit('update:show', false)
},
onCancel() {
this.$emit('update:show', false)
}
},
watch: {
value: {
handler(value) {
if (value == null) return
this.innerValue = [value]
},
immediate: true
},
unitId: {
handler() {
this.getData()
}
},
}
}
</script>
<style lang="less" scoped>
</style>
<template>
<van-popup :show="innerShow" position="bottom"
class="doc-unit">
<van-picker :loading="loading"
title="医生选择"
:columns="array"
:columns-field-names="fieldNames"
v-model="innerValue"
@confirm="onConfirm"
@cancel="onCancel"
>
</van-picker>
</van-popup>
</template>
<script>
import { getOfficeDoctor } from '@/api/doctor/generalFU.js'
export default {
name: 'DocUnit',
props: {
show: Boolean,
value: [String, Number],
unitId: [String, Number],
officeId: [String, Number],
fieldNames: {
type: Object,
default: () => {
return {text: 'staffName', value: 'id'}
}
}
},
emits: ['update:show', 'update:value', 'change'],
data() {
return {
innerValue: undefined,
array: [],
loading: false,
}
},
computed: {
params() {
return {
unitId: this.unitId,
officeId: this.officeId
}
},
innerShow() {
return this.show
},
innerUnitId() {
return this.unitId
}
},
created() {
this.getData()
},
methods: {
getData() {
this.array = []
if (!this.officeId) return
this.loading = true
getOfficeDoctor(this.innerUnitId, this.officeId).then(res => {
this.array = res.data || []
}).finally(() => {
this.loading = false
})
},
onConfirm({ selectedValues, selectedOptions }) {
this.$emit('update:value', selectedValues[0])
this.$emit('change', selectedOptions[0])
this.$emit('update:show', false)
},
onCancel() {
this.$emit('update:show', false)
}
},
watch: {
value: {
handler(value) {
if (value == null) return
this.innerValue = [value]
},
immediate: true
},
params: {
handler() {
this.getData()
}
},
}
}
</script>
<style lang="less" scoped>
</style>
<template>
<van-popup :show="innerShow" position="bottom"
class="doc-unit">
<van-picker :loading="loading"
title="机构选择"
:columns="array"
:columns-field-names="fieldNames"
v-model="innerValue"
@confirm="onConfirm"
@cancel="onCancel"
>
<template #columns-top>
<van-search v-model="searchStr" placeholder="请输入搜索关键词" clearable
@search="onSearch"/>
</template>
</van-picker>
</van-popup>
</template>
<script>
import { getUnitByName } from '@/api/doctor/generalFU.js'
import { debounce } from '@/utils/common.js'
export default {
name: 'DocUnit',
props: {
show: Boolean,
value: [String, Number],
valueName: String,
fieldNames: {
type: Object,
default: () => {
return {text: 'unitName', value: 'id'}
}
}
},
emits: ['update:show', 'update:value', 'change'],
data() {
return {
innerValue: undefined,
array: [],
loading: false,
searchStr: ''
}
},
computed: {
innerShow() {
return this.show
}
},
created() {
this.onSearch = debounce(this.onSearch, 500)
this.onSearch('')
},
methods: {
onSearch(value) {
if (this.loading) return
this.array = []
if (!value) {
return
}
if (!value.trim()) return
this.loading = true
this.getData(value).then(res => {
// console.log(res.data)
this.array = res.data || []
}).finally(() => {
this.loading = false
})
},
getData(query) {
return getUnitByName(query)
},
onConfirm({ selectedValues, selectedOptions }) {
this.$emit('update:value', selectedValues[0])
this.$emit('change', selectedOptions[0])
this.$emit('update:show', false)
this.searchStr = ''
},
onCancel() {
this.$emit('update:show', false)
}
},
watch: {
value: {
handler(value) {
if (value == null) return
this.innerValue = [value]
},
immediate: true
},
valueName: {
handler(value) {
if (!value) {
return
}
this.onSearch(value)
},
immediate: true
},
searchStr(val) {
if (!val) return
this.onSearch(val)
}
}
}
</script>
<style lang="less" scoped>
</style>
......@@ -31,18 +31,18 @@
</div>
<div class='mt-3 flex items-center'>
<div class='detail-left'>
高危评估
是否逾期
</div>
<div class='detail-right'>
高危人群
{{ item.isOverdueName }}
</div>
</div>
<div class='mt-3 flex items-center'>
<div class='detail-left'>
专病高危评估
逾期天数
</div>
<div class='detail-right'>
高血压高危
{{ item.overdueDay }} 天
</div>
</div>
<div class='flex mt-3' style='align-items: baseline'>
......
......@@ -93,6 +93,11 @@
</div>
</div>
</div>
<van-button round type="primary" @click="() => show = true">open</van-button>
<!-- <DocUnit v-model:show="show" v-model:value="value1" @change="(option) => value2 = option"/> -->
<!-- <DocOffice v-model:show="show" v-model:value="value1" @change="(option) => value2 = option" unitId="21649"/> -->
<DocOfficeDoctor v-model:show="show" v-model:value="value1" @change="(option) => value2 = option" unitId="21649" officeId="36234"/>
{{value1}}
</div>
</template>
......@@ -102,10 +107,16 @@ import { validateIdCard } from '@/utils/commonReg.js'
import { setLocalStorage, getLocalStorage } from '@/utils/common.js'
import { showFailToast } from 'vant'
import ChronicTag from '@/doctor/components/chronicTag/ChronicTag.vue'
import DocUnit from '@/doctor/components/docUnit/DocUnit.vue'
import DocOffice from '@/doctor/components/docOffice/DocOffice.vue'
import DocOfficeDoctor from '@/doctor/components/docOfficeDoctor/DocOfficeDoctor.vue'
export default {
components: {
ChronicTag
ChronicTag,
DocUnit,
DocOffice,
DocOfficeDoctor
},
data() {
return {
......@@ -114,7 +125,10 @@ export default {
// 历史记录
history: [],
result: {},
state: 1
state: 1,
show: false,
value1: undefined,
value2: undefined
}
},
computed: {
......
......@@ -48,6 +48,24 @@ export function getLocalStorage(key) {
return JSON.parse(result)
}
/**
* 防抖
* @param {Function} fu
* @param {Number} wait
* @returns
*/
export function debounce(fu, wait = 300) {
let timer
return function () {
const context = this
const args = [...arguments]
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fu.apply(context, args)
}, wait)
}
}
/**
* 请求参数处理
* @param {Object} source 原数据
......
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