Commit 486a011c authored by gengchunlei's avatar gengchunlei

居民端小程序 v1.2 医生端图片组件调整以及随访表单微信小程序绑定电话获取

parent 267448ad
......@@ -6,6 +6,7 @@ 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'
......@@ -34,3 +35,18 @@ export function getResidentInfo(idCard) {
export function getResidentByInfo(params) {
return fetchBase({ url: `/chronic-resident/v1/chronic-residents-record/query-resident-info-by-id-card`, body: params, loading: true })
}
// 文件上传
export function fileUpload(params) {
return fetchBase({ url: `/chronic-admin/v1/pictures-info/qiniu`, body: params, contentType: 'file' })
}
// 获取模板管理数据
export function getTemplateList() {
return fetchBase({ url: `/tumour-admin/v1/h5-app/dict`, loading: true })
}
//模板数据主键查询
export function getTemplateById() {
return fetchBase({ url: `/tumour-admin/v1/h5-app/dict`, loading: true })
}
\ No newline at end of file
......@@ -13,6 +13,10 @@ export function getChronicResidentsId(residentInfoId) {
loading: true
})
}
//获取居民是否存在微信电话
export function getResidentWX(params) {
return fetchBase({ url: `/chronic-admin/v1/chronic-residents-record/query-resident-is-wx`, body: params, loading: true})
}
// 主键查询
export function fetchCurrencyById(params) {
......
......@@ -52,7 +52,7 @@ export default {
if (!token) {
token = sessionStorage.getItem('token')
if (process.env.NODE_ENV !== 'production') {
token = 'c05b4361-deec-4a64-92d5-b6f4b54ec89b'
token = 'e85be59c-b842-4e7a-b8eb-b9be87df2b56'
}
}
if (token) {
......
......@@ -3,7 +3,7 @@
<div v-if="isPdf" class="p-2 flex items-center view-pdf">
<doc-icon type="doc-PDF" style="font-size: .48rem" class="shrink-0"/>
<span class="grow px-4 text-ellipsis">{{name}}</span>
<span class="close-btn" @click="removeBtn" v-if="remove">
<span class="close-btn" @click.stop="removeBtn" v-if="remove">
<doc-icon type="close-circle" />
</span>
</div>
......@@ -22,7 +22,7 @@
<div class="doc-image-default">加载失败</div>
</slot>
</div>
<span class="close-btn" @click="removeBtn" v-if="remove">
<span class="close-btn" @click.stop="removeBtn" v-if="remove">
<doc-icon type="close-circle" />
</span>
</template>
......@@ -105,9 +105,11 @@ export default {
width: 100%;
height: 100%;
min-height: 90px;
border: 1px dashed #d9d9d9;
background: #fafafa;
img {
width: 100%;
height: 100%;
height: 90px;
object-fit: contain;
}
}
......
<template>
<div class="doc-image-upload">
<div class="text-12 description">{{ description }}</div>
<div class="mt-2 py-3 text-center upload-btn" @click="fileSelect">
<doc-icon type="doc-upload" class="mr-2 text-16"/>
<div class='doc-image-upload'>
<div class='text-12 description'>{{ description }}</div>
<div class='mt-2 py-3 text-center upload-btn' @click='fileSelect'>
<doc-icon type='doc-upload' class='mr-2 text-16' />
<span>{{ btText }}</span>
</div>
<div class="flex flex-wrap mt-4 image-box">
<div v-for="item in innerImage.filter(e => e.fileType != 'pdf')" :key="item.id"
class="item-img">
<DocImage :src="item.url" remove/>
<div class='flex flex-wrap mt-4 image-box'>
<div v-for="item in innerImage.filter(e => e.fileType != 'pdf')" :key='item.id'
class='item-img' @click.stop='toPreview(item)'>
<DocImage :src='item.trueDownloadUrl' remove @onRemove='removeImage(item)' />
</div>
<div v-for="item in innerImage.filter(e => e.fileType == 'pdf')" :key="item.id"
class="item-pdf">
<DocImage isPdf :src="item.url" name="pdf文件名称" remove/>
<div v-for="item in innerImage.filter(e => e.fileType == 'pdf')" :key='item.id'
class='item-pdf'>
<DocImage isPdf :src='item.trueDownloadUrl' name='pdf文件名称' remove @onRemove='removeImage(item)' />
</div>
</div>
<input type="file"
accept=".jpg,.jpeg,.png,.pdf"
ref="fileElem"
style="display: none;"
@change="handleFiles"
:key="inputKey">
<input type='file'
accept='.jpg,.jpeg,.png,.pdf'
ref='fileElem'
style='display: none;'
@change='handleFiles'
:key='inputKey'>
<van-overlay :show='imgShow' @click='imgShow = false'>
<div class='wrapper'>
<van-swipe class='block' :initial-swipe='initSwipe'>
<van-swipe-item v-for="image in innerImage.filter(e => e.fileType != 'pdf')" :key='image'>
<img :src='image.trueDownloadUrl' style='width: 100%;height: 100%' />
</van-swipe-item>
</van-swipe>
</div>
</van-overlay>
</div>
</template>
<script>
import DocImage from './DocImage.vue'
import { showToast } from 'vant'
import { fileUpload } from '@/api/base'
const testUrl = 'https://beta-tumour.zmnyjk.com/chronic-admin/file-proxy/chronic/20241125/1732502450600434289.png?e=1732610606&token=yrkyCAltqk1WVrw1ZNWUl5F5gLxE0O8LJ0Vq4hzi:RYbssXLQIEX6KTcVk5u4tWaxb9o='
export default {
name: 'DocImageUpload',
components:{
components: {
DocImage
},
props: {
......@@ -56,7 +67,10 @@ export default {
spinning: false,
inputKey: '1',
// viewer显示
visible: false
visible: false,
//显示图片所在位置
initSwipe: 0,
imgShow: false
}
},
computed: {
......@@ -67,16 +81,16 @@ export default {
return this.innerImage.map(e => e.id).join(',')
}
},
methods:{
methods: {
init() {
if (this.imageData?.length) {
this.innerImage = [...this.imageData]
} else {
this.innerImage = [
{ fileType: 'pdf', id: 1, url: testUrl },
{ fileType: 'png', id: 2, url: testUrl },
{ fileType: 'png', id: 3, url: testUrl },
{ fileType: 'png', id: 4, url: testUrl },
{ fileType: 'pdf', id: 1, trueDownloadUrl: testUrl },
{ fileType: 'png', id: 2, trueDownloadUrl: testUrl },
{ fileType: 'png', id: 3, trueDownloadUrl: testUrl },
{ fileType: 'png', id: 4, trueDownloadUrl: testUrl }
]
}
},
......@@ -102,7 +116,6 @@ export default {
this.addImage(result)
this.inputKey = Math.random().toString(16).substring(2, 6)
this.$emit('change', this.ids, this.innerImage)
this.formItemContext.onFieldChange()
}).finally(() => {
this.spinning = false
})
......@@ -133,6 +146,13 @@ export default {
if (!item) return
this.innerImage = this.innerImage.filter(e => e.id != item.id)
this.$emit('change', this.ids, this.innerImage)
},
//图片预览
toPreview(val) {
let res = this.innerImage.filter(e => e.fileType != 'pdf')
let index = res.findIndex(e => val.id == e.id)
this.initSwipe = index
this.imgShow = true
}
},
watch: {
......@@ -146,32 +166,49 @@ export default {
}
</script>
<style lang="less" scoped>
<style lang='less' scoped>
.description {
color: #A5AEBE;
}
.upload-btn {
color: var(--van-primary-color);
border: 1px solid #eee;
background-color: #FAFAFA;
border-radius: 8px;
}
.image-box {
row-gap: 8px;
column-gap: 12px;
.item-img {
width: calc(33.3vw - 8px);
width: calc(33.3% - 8px);
}
.item-pdf {
width: 100%;
}
>div {
width: calc(33.3vw - 8px);
> div {
width: calc(33.3% - 8px);
position: relative;
border-radius: 2px;
img {
object-fit: contain;
}
}
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.block {
width: 100%;
}
}
</style>
......@@ -315,6 +315,7 @@ const defaultForm = (info = {}) => {
//随访类型
visitWayRules: undefined,
visitWayRulesName: undefined,
sendNumber: undefined,
}
Reflect.ownKeys(form).forEach(key => {
if (info[key] != undefined) {
......@@ -528,11 +529,13 @@ export default {
personId,
visitWay,
visitWayRules,
sendNumber,
...others
} = this.form
let par = {
visitWay,
visitWayRules,
sendNumber,
residentInfoId: this.form.residentInfoId,
residentsRecord: {
...others,
......@@ -541,7 +544,7 @@ export default {
}
resolve(par)
}).catch((e) => {
console.warn('ArchiveCommon error', e)
console.warn('baseInfo error', e)
})
})
}
......
......@@ -2,10 +2,32 @@
<div>
<van-form ref='form'>
<div class='label-title' v-if='showPush'>请选择推送渠道</div>
<checkBtn class='mt-3' column-1 :options='vxList' v-model:value='checkVx' :fieldNames="{text: 'name', value: 'value'}"></checkBtn>
<van-field
v-model='form.isSmsIsWxStr'
style='padding: 0px'
:rules='rules.isSmsIsWxStr'
>
<template #input>
<div class='w-full'>
<checkBtn class='mt-3'
column-1
text-align='left'
:options='vxList'
v-model:value='checkVx'
:fieldNames="{text: 'name', value: 'value'}"
></checkBtn>
<div class='push-lab'>随访信息将通过小程序消息推送给居民</div>
<checkBtn class='mt-3' column-1 :options='messageList' v-model:value='checkMessage' :fieldNames="{text: 'name', value: 'value'}"></checkBtn>
<checkBtn class='mt-3'
column-1
text-align='left'
:options='messageList'
v-model:value='checkMessage'
:fieldNames="{text: 'name', value: 'value'}"
></checkBtn>
<div class='push-lab'>随访信息将通过短信方式发送给居民</div>
</div>
</template>
</van-field>
<div :class="['label-title', {'mt-5': showPush}]">随访单位</div>
<van-field
......@@ -14,6 +36,7 @@
readonly
placeholder='随访单位'
class='input-back mt-2 form-input'
:rules='rules.visitUnitName'
@click='show1 = true'
/>
<DocUnit v-model:show='show1' v-model:value='form.visitUnitId' @change='changeUnit' />
......@@ -25,6 +48,7 @@
readonly
placeholder='随访科室'
class='input-back mt-2 form-input'
:rules='rules.visitOfficeName'
@click='show2 = true'
/>
<DocOffice v-model:show='show2' v-model:value='form.visitOfficeId' @change='changeOffice'
......@@ -37,6 +61,7 @@
readonly
placeholder='随访医生'
class='input-back mt-2 form-input'
:rules='rules.visitDoctorName'
@click='show3 = true'
/>
......@@ -85,8 +110,15 @@ export default {
checkVx: undefined,
messageList: [],
checkMessage: undefined,
form: {},
rules: {}
form: {
isSmsIsWx: []
},
rules: {
isSmsIsWxStr: [{ required: true, message: '请选择' }],
visitUnitName: [{ required: true, message: '请选择' }],
visitOfficeName: [{ required: true, message: '请选择' }],
visitDoctorName: [{ required: true, message: '请选择' }],
}
}
},
watch: {
......@@ -95,7 +127,47 @@ export default {
this.form = this.setForm(this.info)
},
immediate: true
},
'firstForm.residentsRecord': {
handler() {
this.vxList = this.getVxEnum(this.firstForm)
this.messageList = this.getMessageEnum(this.firstForm.residentsRecord)
},
immediate: true,
deep:true
},
'checkMessage': {
handler() {
this.form.isSms = 2
if (this.checkMessage) {
this.form.isSms = 1
this.form.isSmsIsWx.push(1)
this.form.isSmsIsWxStr = 1
} else {
this.form.isSmsIsWx = this.form.isSmsIsWx.filter(item => item !=1)
//判断推送渠道是否存在值
if (!this.checkVx) {
this.form.isSmsIsWxStr = ''
}
}
}
},
'checkVx': {
handler() {
this.form.isWx = 2
if (this.checkVx) {
this.form.isWx = 1
this.form.isSmsIsWx.push(2)
this.form.isSmsIsWxStr = 2
} else {
this.form.isSmsIsWx = this.form.isSmsIsWx.filter(item => item !=2)
//判断推送渠道是否存在值
if (!this.checkMessage) {
this.form.isSmsIsWxStr = ''
}
}
}
},
},
computed: {
authInfo() {
......@@ -114,17 +186,13 @@ export default {
return res
}
},
mounted() {
this.vxList = this.getVxEnum(this.firstForm.residentsRecord)
this.messageList = this.getMessageEnum(this.firstForm.residentsRecord)
},
methods: {
//微信
getVxEnum(patientInfo = {}) {
return [{ name: `微信 ${patientInfo.weixinTel ? `(${this.$phoneHide(patientInfo.weixinTel)}已注册小程序)` : `(未注册小程序)`}`, value:1 }]
return [{ name: `微信 ${patientInfo.sendNumber ? `(${this.$phoneHide(patientInfo.sendNumber)}已注册小程序)` : `(未注册小程序)`}`, value:2 }]
},
getMessageEnum(patientInfo = {}) {
return [{ name: `短信 ${patientInfo.telephone ? `(手机号 ${this.$phoneHide(patientInfo.telephone)})` : `(手机号 不存在)`}`, value: 2 }]
return [{ name: `短信 ${patientInfo.telephone ? `(手机号 ${this.$phoneHide(patientInfo.telephone)})` : `(手机号 不存在)`}`, value: 1 }]
},
setForm(info) {
const form = {
......@@ -147,7 +215,10 @@ export default {
createOfficeName: this.authInfo.officeName,
// 录入医生
createDoctorId: this.authInfo.relationId,
createDoctorName: this.authInfo.nickName
createDoctorName: this.authInfo.nickName,
isSms: 2,
isWx: 2,
isSmsIsWx: [],
}
Reflect.ownKeys(form).forEach(key => {
if (info[key] != undefined) {
......@@ -186,7 +257,6 @@ export default {
resolve(par)
}).catch((e) => {
console.warn('ArchiveCommon error', e)
reject(e)
})
})
}
......
......@@ -51,7 +51,7 @@ import BaseInfo from '@/doctor/followUp/generalFU/form/BaseInfo'
import {
addCurrency,
fetchCurrencyById,
getChronicResidentsId,
getChronicResidentsId, getResidentWX,
updateCurrency,
upLoadMultifile
} from '@/api/doctor/generalFU'
......@@ -163,6 +163,7 @@ export default {
}
} else {
const res = await getChronicResidentsId(this.routerDetail.residentInfoId)
const weixinInfo = await getResidentWX({residentInfoId: this.routerDetail.residentInfoId})
const {
id,
createDate,
......@@ -177,7 +178,8 @@ export default {
} = res.data
this.info = {
personId: id,
...others
...others,
sendNumber: weixinInfo?.data?.telephone
}
this.info.diseaseType = this.routerDetail.diseaseType
}
......
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