Commit e3dd7b55 authored by gengchunlei's avatar gengchunlei

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

parent 1e0d46f9
...@@ -21,6 +21,6 @@ export function getTemplateByPage(params) { ...@@ -21,6 +21,6 @@ export function getTemplateByPage(params) {
} }
// 模板 主键查询 // 模板 主键查询
export function getTemplateDetail(id, loading = true) { export function getTemplateDetail(params, loading = true) {
return fetchBase({ url: `/tumour-admin/v1/template/query-id/${id}`, loading }) return fetchBase({ url: `/tumour-admin/v1/template/query-id/${params.id}`, loading })
} }
\ No newline at end of file
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,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 = 'eb060856-4b3b-4231-8c0f-1dff5b3c7657' token = '3e478192-7f9d-4d77-b36a-cb8bac2896d3'
} }
} }
if (token) { 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> <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> </template>
<script> <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 { export default {
name: 'temDetail', name: 'temDetail',
components: { Mp4, Mp3 },
props: {
show: { default: false },
id: String
},
data() { 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> </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> </style>
\ No newline at end of file
<template> <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='bg flex flex-col'>
<div class='p-3 flex items-center shrink-0 justify-between title bg-white'> <div class='p-3 flex items-center shrink-0 justify-between title bg-white'>
<div @click='onBack' class='text-12 back-bt'> <div @click='onBack' class='text-12 back-bt'>
...@@ -24,19 +24,21 @@ ...@@ -24,19 +24,21 @@
<div class='flex flex-col gap-y-2.5'> <div class='flex flex-col gap-y-2.5'>
<div> <div>
<span class='label'>模板分类</span> <span class='label'>模板分类</span>
<span>{{ item.idCard }}</span> <span>{{ item.templateClassifyTrans }}</span>
</div> </div>
<div> <div>
<span class='label'>模板名称</span> <span class='label'>模板名称</span>
<span>{{ item.serviceTypeName }}</span> <span>{{ item.templateName }}</span>
</div> </div>
</div> </div>
<div class='divider my-3'></div> <div class='divider my-3'></div>
<div class='bt-group'> <div class='bt-group'>
<div> <van-button round size='small' class='doc-btn-primary mr-3'
<van-button round size='small' class='doc-btn-primary mr-3' @click='toDetail(item)'>查看</van-button> @click='toDetail(item)'>查看
<van-button round size='small' class='doc-btn-primary' @click='toDetail(item)'>引用</van-button> </van-button>
</div> <van-button round size='small' class='doc-btn-primary' @click='toUse(item)'>
引用
</van-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -73,6 +75,9 @@ ...@@ -73,6 +75,9 @@
</div> </div>
</div> </div>
</van-popup> </van-popup>
<!-- 查看详情组件-->
<temDetail v-if='detailShow' :show='detailShow' :id='selectRecord.id' @closeDetail='detailClosed' @selectedInfo='detailToUse' :overlay='false'></temDetail>
</div> </div>
</div> </div>
</van-popup> </van-popup>
...@@ -83,6 +88,7 @@ import { showToast } from 'vant' ...@@ -83,6 +88,7 @@ import { showToast } from 'vant'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn' import CheckBtn from '@/doctor/components/checkBtn/CheckBtn'
import { getTemplateByPage } from '@/api/doctor/workbench' import { getTemplateByPage } from '@/api/doctor/workbench'
import { useStore } from '@/doctor/store' import { useStore } from '@/doctor/store'
import TemDetail from '@/doctor/components/template/temDetail'
const DefaultForm = { const DefaultForm = {
templateName: undefined, templateName: undefined,
...@@ -97,7 +103,7 @@ const DefaultForm = { ...@@ -97,7 +103,7 @@ const DefaultForm = {
export default { export default {
name: 'temList', name: 'temList',
components: { CheckBtn }, components: { TemDetail, CheckBtn },
props: { props: {
show: { default: false } show: { default: false }
}, },
...@@ -116,7 +122,11 @@ export default { ...@@ -116,7 +122,11 @@ export default {
isRefreshDisable: false, isRefreshDisable: false,
// 搜索弹出框 // 搜索弹出框
searchVisible: false, searchVisible: false,
form: { ...DefaultForm } form: { ...DefaultForm },
//是否展示详情弹窗
detailShow: false,
//选中项
selectRecord: {}
} }
}, },
computed: { computed: {
...@@ -182,17 +192,21 @@ export default { ...@@ -182,17 +192,21 @@ export default {
this.searchVisible = true this.searchVisible = true
}, },
toDetail(record) { toDetail(record) {
if (!record) return this.selectRecord = record
if (record.residentInfoId == null) { this.detailShow = true
showToast('暂时无法查看 详情信息') },
return detailClosed(val) {
} this.detailShow = val
this.$router.push({ },
path: '/doctor/patient-detail', //列表引用
query: { toUse(record) {
residentInfoId: record.residentInfoId this.$emit('selectRecord', record.id)
} this.onBack()
}) },
//详情选中引用
detailToUse(val) {
this.$emit('selectRecord', val)
this.onBack()
}, },
onBack() { onBack() {
this.$emit('closed', false) this.$emit('closed', false)
......
...@@ -244,6 +244,7 @@ import Mp3 from '@/residentWX/components/mediaPlay/Mp3.vue' ...@@ -244,6 +244,7 @@ import Mp3 from '@/residentWX/components/mediaPlay/Mp3.vue'
import Mp4 from '@/residentWX/components/mediaPlay/Mp4' import Mp4 from '@/residentWX/components/mediaPlay/Mp4'
import ImagePreview from '@/residentWX/components/imagePreview/imagePreview' import ImagePreview from '@/residentWX/components/imagePreview/imagePreview'
import { fetchCurrencyById, messageResend } from '@/api/doctor/generalFU' import { fetchCurrencyById, messageResend } from '@/api/doctor/generalFU'
import { getTemplateDetail } from '@/api/doctor/workbench'
export default { export default {
name: 'CurrencyFUDetail.vue', name: 'CurrencyFUDetail.vue',
...@@ -364,7 +365,6 @@ export default { ...@@ -364,7 +365,6 @@ export default {
}, },
methods: { methods: {
async load() { async load() {
debugger
if (!this.routerDetail.relationId) { if (!this.routerDetail.relationId) {
showToast('未获取到信息') showToast('未获取到信息')
return return
...@@ -372,7 +372,7 @@ export default { ...@@ -372,7 +372,7 @@ export default {
let par = { let par = {
id: this.routerDetail.relationId id: this.routerDetail.relationId
} }
fetchCurrencyById(par).then(res => { getTemplateDetail(par).then(res => {
let result = res.data || {} let result = res.data || {}
this.info = result this.info = result
this.dataHandle() this.dataHandle()
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
class='input-back mt-2 form-input' class='input-back mt-2 form-input'
/> />
</div> </div>
</div> </div>
</div> </div>
<!-- 催检--> <!-- 催检-->
...@@ -117,7 +118,7 @@ ...@@ -117,7 +118,7 @@
</van-form> </van-form>
<div> <div>
<temList :show='showTem' @closed='closedTem'></temList> <temList :show='showTem' @closed='closedTem' @selectRecord='getSelectTem'></temList>
</div> </div>
</div> </div>
</template> </template>
...@@ -130,6 +131,7 @@ import { showToast } from 'vant' ...@@ -130,6 +131,7 @@ import { showToast } from 'vant'
import { fetchDataHandle } from '@/utils/common' import { fetchDataHandle } from '@/utils/common'
import DocImageUpload from '@/doctor/components/docImageUpload/DocImageUpload' import DocImageUpload from '@/doctor/components/docImageUpload/DocImageUpload'
import TemList from '@/doctor/components/template/temList' import TemList from '@/doctor/components/template/temList'
import { getTemplateDetail } from '@/api/doctor/workbench'
export default { export default {
name: 'GeneralFUForm', name: 'GeneralFUForm',
...@@ -287,6 +289,14 @@ export default { ...@@ -287,6 +289,14 @@ export default {
closedTem(val) { closedTem(val) {
this.showTem = val this.showTem = val
}, },
//获取选中的模板
async getSelectTem(val) {
if (val) {
let par = { id: val }
let result = await getTemplateDetail(par)
console.log(result)
}
},
onSubmit() { onSubmit() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$refs.form.validate().then(() => { this.$refs.form.validate().then(() => {
......
<template>
<van-form ref='form'
class='grow flex flex-col' style='min-height: 1px;flex-wrap: nowrap;'>
<div class='flex flex-col' v-if='fileType?.includes(1)'>
<div class='health mt-2'>
<!-- 无选项-->
<div class='health-cell mt-2' v-for="item in form.contentList.filter(e => e.templateModeTrans == '无')">
<div class='no-req-label'>{{contentTitle}}</div>
<van-field
v-model='item.templateContent'
rows='1'
autosize
type='textarea'
placeholder='请输入'
class='input-back mt-2 form-input'
/>
</div>
<!-- 更多选项-->
<div class='no-req-label mt-2'>更多{{contentTitle}}</div>
<van-field
v-model='form.contentSelectName'
readonly
is-link
placeholder='请选择'
class='input-back mt-2 form-input'
:rules='rules.contentSelectName'
@click='showContentSelect= true'
@change='contentSelectChange'
/>
<van-popup v-model:show='showContentSelect' position='bottom'>
<div class='p-4'>
<div class='flex justify-between mb-4'>
<div class='greyColor' @click='showContentSelect = false'>取消</div>
<div class='blueColor' @click='contentSelectConfirm'>确认</div>
</div>
<CheckBtn multiple column-2 :options='contentArray' v-model:value='checkContentSelect'
:fieldNames="{text: 'name', value: 'value'}" />
</div>
</van-popup>
<div class='health-cell mt-2' v-for="item in form.contentList">
<template v-if='item.templateMode === 5'>
<div class='no-req-label'>药物指导</div>
<div v-for='(item, index) in form.drugsList' :key='item._id'>
<div class='text-driver' v-if='index'></div>
<DocDrug v-model:value='item.drugsCode' placeholder='拼音码查询药品' style='width: 198px'
:valueName="selectData.drugsList ? selectData.drugsList[index]?.helpCode : ''"
@change='drugChange($event, item)' />
<div class='flex items-center justify-between w-full mt-2'>
<van-field
v-model='item.dose'
placeholder='输入'
label='剂量:'
type="digit"
class='input-back form-input'
style='flex: 1'
/>
<van-field
v-model='item.doseUnitName'
readonly
placeholder='请选择'
class='input-back ml-2 form-input'
style='width: .8rem'
@click='showDoseUnit= true'
/>
</div>
<van-popup v-model:show='showDoseUnit' position='bottom'>
<div class='p-4'>
<van-picker
:columns-field-names="{ text: 'name', value: 'value' }"
:columns="store.getDict('CP00081')"
@confirm='doseUnitConfirm'
@cancel='showDoseUnit = false'
/>
</div>
</van-popup>
<van-field
v-model='item.frequencyName'
readonly
is-link
label='频次:'
placeholder='请选择'
class='input-back mt-2 form-input'
@click='showFrequency= true'
/>
<van-popup v-model:show='showFrequency' position='bottom'>
<div class='p-4'>
<van-picker
:columns-field-names="{ text: 'name', value: 'value' }"
:columns="store.getDict('CP00084')"
@confirm='frequencyConfirm'
@cancel='showFrequency = false'
/>
</div>
</van-popup>
<van-field
v-model='item.usageMethodName'
readonly
is-link
label='用法:'
placeholder='请选择'
class='input-back mt-2 form-input'
@click='showUsageMethod= true'
/>
<van-popup v-model:show='showUsageMethod' position='bottom'>
<div class='p-4'>
<van-picker
:columns-field-names="{ text: 'name', value: 'value' }"
:columns="store.getDict('CP00083')"
@confirm='usageMethodConfirm'
@cancel='showUsageMethod = false'
/>
</div>
</van-popup>
<div class='mt-2 text-center'>
<van-button type='primary' ghost class='btn-br' @click='addDrug'>增加</van-button>
<van-button ghost class='btn-br ml-4'
@click='minusDrug(item, index)'
v-if='form?.drugsList?.length > 1'
>删除</van-button>
</div>
</div>
</template>
<div class='no-req-label'>{{item.name}}</div>
<van-field
v-model='item.templateContent'
rows='1'
autosize
type='textarea'
placeholder='请输入'
class='input-back mt-2 form-input'
/>
</div>
</div>
</div>
<div v-if='fileType.includes(2)' class='w-full'>
<DocMediaUpload class='p-3 media-upload'
accept='.mp3'
:mediasData='_audio'
:showBtn='false'
@change='(ids, videoList) => form._audio = videoList'
/>
</div>
<div v-if='fileType.includes(3)' class='w-full'>
<DocMediaUpload class=' p-3 media-upload'
btText='上传视频'
description='支持扩展名:.MP4最大支持300M,最多支持上传3个视频文件'
accept='.mp4'
:mediasData='_video'
:showBtn='false'
@change='(ids, videoList) => form._video = videoList' />
</div>
</van-form>
</template>
<script>
import DocMediaUpload from '@/components/docMediaUpload/DocMediaUpload'
import { fetchDataHandle } from '@/utils/common'
import { requiredInput, requiredSelect } from '@/utils/commonReg'
import { useStore } from '@/doctor/store'
import DocDrug from '@/doctor/components/docDrug/DocDrug'
export default {
name: 'GuideTextVideo',
components: { DocDrug, DocMediaUpload },
props: {
info: {
default: () => {
return {}
}
},
//内容标题
contentTitle: {
default: () => {
return '宣教内容'
}
},
// 文件类型 1:文本 2、文字播报 3、视频
fileType: Array,
// 分类
classify: Number,
requireFlag: { default: true }
},
data() {
return {
store: useStore(),
//更多指导内容
showContentSelect: false,
checkContentSelect: [],
//药物剂量
showDoseUnit: false,
//药物频次
showFrequency: false,
//药物用法
showUsageMethod: false,
form: {},
selectData: {},
rules: {}
}
},
computed: {
contentArray() {
let res = []
res = this.$dict('DC00084').filter(item => item.value !=1)
return res
},
// 音频、视频 回显使用
_video() {
const annexList = this.selectData.annexList || []
return annexList.filter(e => e.type === 3).map(e => {
return {
annexFileName: e.annexFileName,
trueDownloadUrl: e.annexUrl,
annexUrl: e.annexUrl,
relativeUrl: e.relativeUrl,
fileType: 'mp4',
md5Hash: e.annexMd5,
id: e.annexId
}
})
},
_audio() {
const annexList = this.selectData.annexList || []
return annexList.filter(e => e.type === 2).map(e => {
return {
annexFileName: e.annexFileName,
trueDownloadUrl: e.annexUrl,
annexUrl: e.annexUrl,
relativeUrl: e.relativeUrl,
fileType: 'mp3',
md5Hash: e.annexMd5,
id: e.annexId
}
})
}
},
watch: {
'info': {
handler() {
if (this.info) {
this.selectData = fetchDataHandle(this.info || {}, {
templateType: 'strToArrNum',
fileType: 'strToArrNum'
})
const annexList = this.selectData.annexList || []
this.selectData._video = annexList.filter(e => e.type === 3)
this.selectData._audio = annexList.filter(e => e.type === 2)
this.form = this.setTemForm(this.selectData)
} else {
this.form = this.setTemForm({})
}
},
immediate: true
},
'requireFlag': {
handler() {
if (this.requireFlag) {
this.rules = {
contentSelect: [requiredSelect],
templateType: [requiredSelect],
templateName: [requiredInput],
fileType: [requiredSelect]
}
} else {
this.rules = {
contentSelect: [{ required: false }],
templateType: [{ required: false }],
templateName: [{ required: false }],
fileType: [{ required: false }]
}
}
},
immediate: true
}
},
methods: {
//指导和宣教赋值
setTemForm(info = {}) {
const contentList = info.contentList || []
const drugsList = info?.drugsList?.length ? info.drugsList.map(e => {
if (e.id) {
e._id = e.id
}
return e
}) : []
const form = {
id: info.id,
templateType: info.templateType,
templateName: info.templateName,
templateMode: info.templateMode || 1,
fileType: info.fileType || [1],
templateClassify: info.templateClassify || 1,
businessType: info.businessType || 1,
contentList: JSON.parse(JSON.stringify(contentList)),
contentSelect: contentList.map(e => e.templateMode),
drugsList: JSON.parse(JSON.stringify(drugsList)),
annexList: info.annexList || [],
// 存放上传后返回的id
_video: JSON.parse(JSON.stringify(info._video || [])),
_audio: JSON.parse(JSON.stringify(info._audio || [])),
drugSelect: 1
}
return form
},
// 选择的模板内容变化
contentSelectChange() {
const cont = this.form.contentList || []
const addValue = this.checkContentSelect.filter(e => !cont.find(i => i.templateMode === e))
const delValue = cont.filter(i => !this.checkContentSelect.includes(i.templateMode)).map(e => e.templateMode)
if (delValue.length) {
this.form.contentList = this.form.contentList.filter(e => !delValue.includes(e.templateMode))
// 药物指导处理
if (delValue.includes(5)) {
this.form.drugsList = []
}
}
if (addValue.length) {
addValue.forEach(e => {
this.form.contentList.push({
templateMode: e,
templateModeTrans: this.store.getDictValue('DC00084', e),
templateContent: undefined,
id: undefined
})
})
// 药物指导处理
if (addValue.includes(5)) {
this.addDrug()
}
}
},
// 添加药品
addDrug() {
this.form.drugsList.push(this.drugItem())
},
drugItem() {
let rowId = 0
if (this.form.drugsList.length > 0) {
rowId = Math.max.apply(null, this.form.drugsList.map(item => Number(item._id)))
}
return {
_id: rowId + 1,
// 药品名称
drugsName: undefined,
drugsCode: undefined,
// 剂量单位,[CP00081]
doseUnit: 1,
// 每次剂量
dose: undefined,
// 频次,[CP00084]
frequency: undefined,
// 用法,[CP00083]
usageMethod: undefined,
// 每日几次
// dayTime: undefined,
helpCode: undefined
}
},
drugChange(option, item) {
item.drugsName = option.chemicalName
item.helpCode = option.helpCode
},
minusDrug(item, index) {
this.form.drugsList = this.form.drugsList.filter(e => e._id !== item._id)
},
getRef() {
return this.$refs.form
},
contentSelectConfirm() {
let res = []
this.contentArray.forEach(item => {
let selected = this.checkContentSelect.filter(i => i == item.value)
if (selected && selected.length) {
res.push(item.name)
}
})
if (this.checkContentSelect && this.checkContentSelect.length) {
this.form.contentSelect = this.checkContentSelect.join()
this.form.contentSelectName = res.join()
}
this.showContentSelect = false
},
doseUnitConfirm({ selectedValues, selectedOptions }) {
this.form.doseUnit = selectedValues[0]
this.form.doseUnitName = selectedOptions[0].name
this.showDoseUnit = false
},
frequencyConfirm({ selectedValues, selectedOptions }) {
this.form.frequency = selectedValues[0]
this.form.frequencyName = selectedOptions[0].name
this.showFrequency = false
},
usageMethodConfirm({ selectedValues, selectedOptions }) {
this.form.usageMethod = selectedValues[0]
this.form.usageMethodName = selectedOptions[0].name
this.showUsageMethod = false
},
submit() {
return new Promise((resolve, reject) => {
this.$refs.form.validate().then(valid => {
/* if (this.form.fileType.includes(3) && !this.form._video.length) {
this.$message.info('请上传视频')
return
}
if (this.form.fileType.includes(2) && !this.form._audio.length) {
this.$message.info('请上传音频')
return
}*/
const query = fetchDataHandle({ ...this.form }, {
templateType: 'arrToStr',
fileType: 'arrToStr'
})
const annexList = []
query._video.forEach(e => {
annexList.push({
type: 3,
annexId: e.annexId,
relativeUrl: e.relativeUrl,
annexFileName: e.annexFileName
})
})
query._audio.forEach(e => {
annexList.push({
type: 2,
annexId: e.annexId,
relativeUrl: e.relativeUrl,
annexFileName: e.annexFileName
})
})
query.annexList = annexList
const contentList = query.contentList
const item = contentList.find(e => e.templateMode == 5)
if (item) {
const drugsList = query.drugsList
let str = ''
drugsList.forEach(e => {
str = `药品名:${e.drugsName} 剂量:${e.dose} ${this.$dictValue('CP00081', e.doseUnit)} 频次:${this.$dictValue('CP00084', e.frequency)} 用法:${this.$dictValue('CP00083', e.usageMethod)}\n` + str
})
item.templateContent = str
}
resolve(query)
}).catch(e => {
reject(e)
})
})
},
getForm() {
return new Promise((resolve, reject) => {
const query = fetchDataHandle({ ...this.form }, {
templateType: 'arrToStr',
fileType: 'arrToStr'
})
const annexList = []
query._video.forEach(e => {
annexList.push({
type: 3,
annexId: e.annexId,
annexUrl: e.annexUrl,
relativeUrl: e.relativeUrl,
annexFileName: e.annexFileName
})
})
query._audio.forEach(e => {
annexList.push({
type: 2,
annexId: e.annexId,
annexUrl: e.annexUrl,
relativeUrl: e.relativeUrl,
annexFileName: e.annexFileName
})
})
query.annexList = annexList
const contentList = query.contentList
const item = contentList.find(e => e.templateMode == 5)
if (item) {
const drugsList = query.drugsList
let str = ''
drugsList.forEach(e => {
str = `药品名:${e.drugsName} 剂量:${e.dose} ${this.$dictValue('CP00081', e.doseUnit)} 频次:${this.$dictValue('CP00084', e.frequency)} 用法:${this.$dictValue('CP00083', e.usageMethod)}\n` + str
})
item.templateContent = str
}
resolve(query)
})
}
}
}
</script>
<style lang='less' scoped>
.action-box {
width: 56px;
font-size: 20px;
.svg-icon {
vertical-align: baseline;
}
}
.drug-list {
background-color: #F5F5F5;
}
.health {
padding: 1px 8px 8px 8px;
background: #FAFAFA;
border-radius: 8px;
.health-cell {
padding: 8px;
background: #FFFFFF;
border-radius: 8px;
}
}
.no-req-label {
font-size: 13px;
color: #595959;
font-weight: 500;
}
.form-input {
padding: 8px 12px;
border-radius: 8px;
}
.input-back {
background: #FAFAFA;
}
.text-driver {
border: 1px solid #EEEEEE;
margin-bottom: 8px;
}
.btn-br {
border-radius: 38px;
width: 112px;
padding: 4px 8px;
}
</style>
\ No newline at end of file
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