Commit e3dd7b55 authored by gengchunlei's avatar gengchunlei

居民端小程序 v1.2 通用随访表单

parent 1e0d46f9
......@@ -21,6 +21,6 @@ export function getTemplateByPage(params) {
}
// 模板 主键查询
export function getTemplateDetail(id, loading = true) {
return fetchBase({ url: `/tumour-admin/v1/template/query-id/${id}`, loading })
export function getTemplateDetail(params, loading = true) {
return fetchBase({ url: `/tumour-admin/v1/template/query-id/${params.id}`, loading })
}
\ No newline at end of file
......@@ -52,7 +52,7 @@ export default {
if (!token) {
token = sessionStorage.getItem('token')
if (process.env.NODE_ENV !== 'production') {
token = 'eb060856-4b3b-4231-8c0f-1dff5b3c7657'
token = '3e478192-7f9d-4d77-b36a-cb8bac2896d3'
}
}
if (token) {
......
<template>
<van-field
v-model='innerValue'
readonly
is-link
label="药品名称:"
placeholder='请选择'
class='input-back mt-2 form-input'
@click='showDrug= true'
/>
<van-popup v-model:show='showDrug' position='bottom'>
<div class='p-4'>
<van-search v-model="value" :placeholder="placeholder" @search="onSearch"/>
<van-picker
class='mt-4'
:columns="array"
:columns-field-names="fieldNames"
@confirm="drugConfirm"
@cancel="showDrug = false"
/>
</div>
</van-popup>
</template>
<script>
import { getDrug } from '@/api/base.js'
import { Form } from 'ant-design-vue'
export default {
name: 'DocDrug',
props: {
value: [String, Number],
valueName: String,
placeholder: String,
fieldNames: {
type: Object,
default: () => {
return {text: 'chemicalName', values: 'id'}
}
}
},
emits: ['update:value', 'change'],
data() {
return {
innerValue: null,
array: [],
loading: false,
showDrug: false,
}
},
created() {
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 => {
this.array = res.data || []
}).finally(() => {
this.loading = false
})
},
getData(query) {
return getDrug(query)
},
drugConfirm(value) {
this.$emit('update:value', value)
let option = this.array.find(e => e[this.fieldNames.values] === value) || {}
this.$emit('change', option)
if (!value) {
this.onSearch('')
}
}
},
watch: {
value: {
handler(value) {
this.innerValue = value
},
immediate: true
},
valueName: {
handler(value) {
if (!value) {
return
}
this.onSearch(value)
},
immediate: true
},
}
}
</script>
<style lang="less" scoped>
.form-input {
padding: 8px 12px;
border-radius: 8px;
}
.input-back {
background: #FAFAFA;
}
</style>
<template>
<van-popup v-model:show='innerShow' position='right' :style="{ height: '100%', width: '100%' }">
<div class='flex flex-col' style='height: 100vh'>
<div class='p-3 text-black text-center shrink-0 doc-nav-bar'>
<span @click='onBack' class='text-12 back-bt'>
<doc-icon type='doc-left2' />
</span>
<span>查看内容</span>
</div>
<div class='grow overflow-y-auto pl-4 pr-4 pt-3 pb-3'>
<div>
<div class='flex flex-col '>
<!-- 文本 -->
<div class='card' v-if='contentList?.length'>
<div class='font-semibold mb-1'>文本</div>
<div class='conten-bg'>
<div v-for='item in contentList' :key='item.templateMode' class='mb-1 flex'
:style='`order: ${item.templateMode}`'>
<span class='shrink-0 mr-1'
v-if="item.templateModeTrans != '无'">{{ item.templateModeTrans }} :</span>
<span> {{ item.templateContent }}</span>
</div>
</div>
</div>
</div>
<div class='card mt-4' v-if='mp4List?.length'>
<div class='font-semibold mb-1'>视频</div>
<div class='conten-bg'>
<Mp4 :files='mp4List' :activeMediaUrl='activeMediaUrl'
@play='e => activeMediaUrl = e.annexUrl' />
</div>
</div>
<div class='card flex flex-col mt-4' style='row-gap: .06rem;' v-if='mp3List?.length'>
<div class='font-semibold mb-1'>音频</div>
<div class='conten-bg'>
<Mp3 :file='item' v-for='item in mp3List' :key='item.annexId'
:activeMediaUrl='activeMediaUrl'
@play='e => activeMediaUrl = e.annexUrl' />
</div>
</div>
</div>
</div>
<div class='bbtn'>
<van-button type='primary' @click='toUse'>引用</van-button>
</div>
</div>
</van-popup>
</template>
<script>
import { showToast } from 'vant'
import { getTemplateDetail } from '@/api/doctor/workbench'
import Mp3 from '@/doctor/components/mediaPlay/Mp3.vue'
import Mp4 from '@/doctor/components/mediaPlay/Mp4.vue'
export default {
name: 'temDetail',
components: { Mp4, Mp3 },
props: {
show: { default: false },
id: String
},
data() {
return {
info: {},
activeMediaUrl: ''
}
},
computed: {
innerShow() {
return this.show
},
contentList() {
return this.info.contentList
},
// 文件内容
annexList() {
return this.info?.annexList || []
},
mp3List() {
return this.annexList.filter(e => e.type == 2)
},
mp4List() {
return this.annexList.filter(e => e.type == 3)
}
},
created() {
this.load()
},
methods: {
async load() {
if (!this.id) {
showToast('未获取到信息')
return
}
let par = {
id: this.id
}
getTemplateDetail(par).then(res => {
let result = res.data || {}
this.info = result
}).finally(() => {
})
},
toUse() {
this.$emit('selectedInfo', this.id)
this.onBack()
},
onBack() {
this.$emit('closeDetail', false)
}
}
}
</script>
<style scoped>
<style scoped lang='less'>
@import url('../../utils/common.less');
.bbtn {
padding: 8px 12px;
border-top: 1px solid #D7D8DA;
button {
width: 100%;
border-radius: 100px
}
}
.card {
border: 1px solid #CFD5DE;
padding: 8px;
border-radius: 8px;
color: #262626;
}
.conten-bg {
background: #F8FAFC;
padding: 6px 10px;
border-radius: 4px;
}
</style>
\ No newline at end of file
<template>
<van-popup v-model:show='innerShow' position='right' :style="{ height: '100%', width: '100%' }">
<van-popup v-model:show='innerShow' position='right' :style="{ height: '100%', width: '100%' }" :overlay='false'>
<div class='bg flex flex-col'>
<div class='p-3 flex items-center shrink-0 justify-between title bg-white'>
<div @click='onBack' class='text-12 back-bt'>
......@@ -24,19 +24,21 @@
<div class='flex flex-col gap-y-2.5'>
<div>
<span class='label'>模板分类</span>
<span>{{ item.idCard }}</span>
<span>{{ item.templateClassifyTrans }}</span>
</div>
<div>
<span class='label'>模板名称</span>
<span>{{ item.serviceTypeName }}</span>
<span>{{ item.templateName }}</span>
</div>
</div>
<div class='divider my-3'></div>
<div class='bt-group'>
<div>
<van-button round size='small' class='doc-btn-primary mr-3' @click='toDetail(item)'>查看</van-button>
<van-button round size='small' class='doc-btn-primary' @click='toDetail(item)'>引用</van-button>
</div>
<van-button round size='small' class='doc-btn-primary mr-3'
@click='toDetail(item)'>查看
</van-button>
<van-button round size='small' class='doc-btn-primary' @click='toUse(item)'>
引用
</van-button>
</div>
</div>
</div>
......@@ -73,6 +75,9 @@
</div>
</div>
</van-popup>
<!-- 查看详情组件-->
<temDetail v-if='detailShow' :show='detailShow' :id='selectRecord.id' @closeDetail='detailClosed' @selectedInfo='detailToUse' :overlay='false'></temDetail>
</div>
</div>
</van-popup>
......@@ -83,6 +88,7 @@ import { showToast } from 'vant'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn'
import { getTemplateByPage } from '@/api/doctor/workbench'
import { useStore } from '@/doctor/store'
import TemDetail from '@/doctor/components/template/temDetail'
const DefaultForm = {
templateName: undefined,
......@@ -97,7 +103,7 @@ const DefaultForm = {
export default {
name: 'temList',
components: { CheckBtn },
components: { TemDetail, CheckBtn },
props: {
show: { default: false }
},
......@@ -116,7 +122,11 @@ export default {
isRefreshDisable: false,
// 搜索弹出框
searchVisible: false,
form: { ...DefaultForm }
form: { ...DefaultForm },
//是否展示详情弹窗
detailShow: false,
//选中项
selectRecord: {}
}
},
computed: {
......@@ -182,17 +192,21 @@ export default {
this.searchVisible = true
},
toDetail(record) {
if (!record) return
if (record.residentInfoId == null) {
showToast('暂时无法查看 详情信息')
return
}
this.$router.push({
path: '/doctor/patient-detail',
query: {
residentInfoId: record.residentInfoId
}
})
this.selectRecord = record
this.detailShow = true
},
detailClosed(val) {
this.detailShow = val
},
//列表引用
toUse(record) {
this.$emit('selectRecord', record.id)
this.onBack()
},
//详情选中引用
detailToUse(val) {
this.$emit('selectRecord', val)
this.onBack()
},
onBack() {
this.$emit('closed', false)
......
......@@ -244,6 +244,7 @@ import Mp3 from '@/residentWX/components/mediaPlay/Mp3.vue'
import Mp4 from '@/residentWX/components/mediaPlay/Mp4'
import ImagePreview from '@/residentWX/components/imagePreview/imagePreview'
import { fetchCurrencyById, messageResend } from '@/api/doctor/generalFU'
import { getTemplateDetail } from '@/api/doctor/workbench'
export default {
name: 'CurrencyFUDetail.vue',
......@@ -364,7 +365,6 @@ export default {
},
methods: {
async load() {
debugger
if (!this.routerDetail.relationId) {
showToast('未获取到信息')
return
......@@ -372,7 +372,7 @@ export default {
let par = {
id: this.routerDetail.relationId
}
fetchCurrencyById(par).then(res => {
getTemplateDetail(par).then(res => {
let result = res.data || {}
this.info = result
this.dataHandle()
......
......@@ -43,6 +43,7 @@
class='input-back mt-2 form-input'
/>
</div>
</div>
</div>
<!-- 催检-->
......@@ -117,7 +118,7 @@
</van-form>
<div>
<temList :show='showTem' @closed='closedTem'></temList>
<temList :show='showTem' @closed='closedTem' @selectRecord='getSelectTem'></temList>
</div>
</div>
</template>
......@@ -130,6 +131,7 @@ import { showToast } from 'vant'
import { fetchDataHandle } from '@/utils/common'
import DocImageUpload from '@/doctor/components/docImageUpload/DocImageUpload'
import TemList from '@/doctor/components/template/temList'
import { getTemplateDetail } from '@/api/doctor/workbench'
export default {
name: 'GeneralFUForm',
......@@ -287,6 +289,14 @@ export default {
closedTem(val) {
this.showTem = val
},
//获取选中的模板
async getSelectTem(val) {
if (val) {
let par = { id: val }
let result = await getTemplateDetail(par)
console.log(result)
}
},
onSubmit() {
return new Promise((resolve, reject) => {
this.$refs.form.validate().then(() => {
......
This diff is collapsed.
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