Commit 783617c3 authored by gengchunlei's avatar gengchunlei

居民端小程序 v1.2 时间选择插件以及通用随访数据流通逻辑修复

parent a0a6db25
......@@ -52,7 +52,7 @@ export default {
if (!token) {
token = sessionStorage.getItem('token')
if (process.env.NODE_ENV !== 'production') {
token = '33ba1a56-770a-4fc4-83c7-68e1dc0abb15'
token = 'cc6ad5f4-6527-415e-8184-b65ae7ba734d'
}
}
if (token) {
......
<template>
<!-- 弹出层 -->
<van-popup v-model:show="data.isPicker" position="bottom" round @close="confirmOn">
<van-picker ref="picker" title="请选择时间" :columns="data.columns" @cancel="cancelOn"
@confirm="onConfirm" v-model="data.selectedValues" />
</van-popup>
</template>
<script setup>
import { reactive, watch, getCurrentInstance } from "vue";
const customFieldName = {
text: "value",
value: "values",
children: ""
};
const data = reactive({
isPicker: false, //是否显示弹出层
columns: [], //所有时间列
selectedValues: [], //控件选择的时间值
showType: [] //控制显示时间格式 年月日时分秒
});
const props = defineProps({
// 传入的显影状态
showPicker: {
type: Boolean
},
// 传入的值
values: {
type: String
},
showType: {
type: Array,
default:() => {
return ['year', 'month', 'day', 'hour', 'minute', 'second']
}
}
});
//定义要向父组件传递的事件
const emit = defineEmits(["changeValue", "confirm"]);
watch(
() => props.showPicker,
val => {
data.isPicker = val;
data.showType = props.showType
data.columns = [];
getcolumns();
},
{
immediate: true//立即监听--进入就会执行一次 监听显影状态
}
);
function getcolumns() {
let strtime = props.values; //传入的时间
//console.log(strtime); 2023-09-05 19:28:00
let date = new Date(strtime.replace(/-/g, "/"));
// console.log(date); Wed Aug 09 2023 14:53:15 GMT+0800 (中国标准时间)
let timeVaules = date.getTime();
let dateVaules;
if (props.values != "") {
dateVaules = new Date(timeVaules);
} else {
dateVaules = new Date(); //没有传入时间则默认当前时刻
}
let Y = dateVaules.getFullYear();
let M = dateVaules.getMonth();
let D = dateVaules.getDate();
let h = dateVaules.getHours();
let m = dateVaules.getMinutes();
let s = dateVaules.getSeconds();
if(data.showType.includes('year')) {
let year = []; //获取前后十年数组
year.values = [];
let Currentday = new Date().getFullYear();
for (let i = Currentday - 10; i < Currentday + 10; i++) {
year.push({ text: i.toString(), value: i });
}
year.defaultIndex = year.values.indexOf(Y); //设置默认选项当前年
// 个位数补0
const _M = M < 10 ? `0${M + 1}` : M.toString(); //月份比实际获取的少1,所以要加1
const _D = D < 10 ? `0${D}` : D.toString();
const _h = h < 10 ? `0${h}` : h.toString();
const _m = m < 10 ? `0${m}` : m.toString();
const _s = s < 10 ? `0${s}` : s.toString();
// 生成年月日时分秒时间值
data.selectedValues.push(Y);
data.selectedValues.push(_M);
data.selectedValues.push(_D);
data.selectedValues.push(_h);
data.selectedValues.push(_m);
data.selectedValues.push(_s);
data.columns.push(year); //生成年列
}
if (data.showType.includes('month')) {
let month = []; //获取12月数组
month = Object.keys(Array.apply(null, { length: 13 })).map(function (item) {
if (+item + 1 <= 10) {
return { text: "0" + item, value: "0" + item };
} else if (+item + 1 == 11) {
return { text: +item, value: +item };
} else {
return {
text: (+item + 0).toString(),
value: (+item + 0).toString()
};
}
});
month.splice(0, 1);
data.columns.push(month); //生成月列
}
if (data.showType.includes('day')) {
//获取当月的天数
let days = getCountDays(Y, M + 1);
let day = []; //创建当月天数数组
day = Object.keys(Array.apply(null, { length: days + 1 })).map(function (
item
) {
if (+item + 1 <= 10) {
return { text: "0" + item, value: "0" + item };
} else if (+item + 1 == 11) {
return { text: +item, value: +item };
} else {
return {
text: (+item + 0).toString(),
value: (+item + 0).toString()
};
}
});
day.splice(0, 1);
data.columns.push(day); //生成日列
}
if (data.showType.includes('hour')) {
let hour = []; //创建小时数组
hour = Object.keys(Array.apply(null, { length: 24 })).map(function (item) {
if (+item + 1 <= 10) {
return { text: "0" + item, value: "0" + item };
} else if (+item + 1 == 11) {
return { text: +item, value: +item };
} else {
return {
text: (+item + 0).toString(),
value: (+item + 0).toString()
};
}
});
data.columns.push(hour); //生成小时列
}
if (data.showType.includes('minute')) {
let mi = []; //创建分钟数组
mi = Object.keys(Array.apply(null, { length: 60 })).map(function (item) {
if (+item + 1 <= 10) {
return { text: "0" + item, value: "0" + item };
} else if (+item + 1 == 11) {
return { text: +item, value: +item };
} else {
return {
text: (+item + 0).toString(),
value: (+item + 0).toString()
};
}
});
data.columns.push(mi);//生成分钟列
}
if (data.showType.includes('second')) {
let ss = []; //创建秒数数组
ss = Object.keys(Array.apply(null, { length: 60 })).map(function (item) {
if (+item + 1 <= 10) {
return { text: "0" + item, value: "0" + item };
} else if (+item + 1 == 11) {
return { text: +item, value: +item };
} else {
return {
text: (+item + 0).toString(),
value: (+item + 0).toString()
};
}
});
data.columns.push(ss);//生成秒钟列
}
}
function getCountDays(year, month) {
//获取某年某月多少天
let day = new Date(year, month, 0);
return day.getDate();
}
// 关闭弹框
function confirmOn() {
emit("changeValue");
}
//时间选择器关闭 值不改变并关闭弹框
function cancelOn({ selectedValues }) {
confirmOn()
}
// 时间选择器确定 值改变
function onConfirm({ selectedValues }) {
let endval =
selectedValues[0] +
"-" +
selectedValues[1] +
"-" +
selectedValues[2] +
" " +
selectedValues[3] +
":" +
selectedValues[4] +
":" +
selectedValues[5];
confirmOn()
emit("confirm", endval);
}
</script>
......@@ -87,10 +87,10 @@ export default {
this.innerImage = [...this.imageData]
} else {
this.innerImage = [
{ fileType: 'pdf', id: 1, trueDownloadUrl: testUrl },
{ fileType: 'png', id: 2, trueDownloadUrl: testUrl },
{ fileType: 'png', id: 3, trueDownloadUrl: testUrl },
{ fileType: 'png', id: 4, trueDownloadUrl: 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 }
]
}
},
......
......@@ -2,7 +2,7 @@
<div class="p-1 flex flex-col mp3">
<div v-if="file.annexFileName" class="text-12 mb-1 text-ellipsis">{{ file.annexFileName }}</div>
<div class="flex items-center justify-between gap-x-2.5">
<div class="shrink-0 play-bt" @click="start(file)">
<div class="shrink-0 play-bt" @click.stop="start(file)">
<doc-icon type="doc-play" v-if="!player.playing"/>
<doc-icon type="doc-pause" v-else/>
</div>
......
<template>
<div class="mp4">
<div class="flex flex-wrap justify-between video-list">
<div v-for="item in files" :key="item.annexId">
<div v-for="item in files" :key="item.annexId" @click.stop="start(item)">
<div class="item">
<div class="shrink-0 play-bt" @click="start(item)">
<div class="shrink-0 play-bt" >
<doc-icon type="doc-play" />
</div>
<span class="close-btn" @click.stop="removeBtn(item)" v-if="remove">
......
<template>
<van-popup v-model:show='innerShow' position='right' :style="{ height: '100%', width: '100%' }">
<van-popup v-if='innerShow' 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'>
......@@ -9,11 +9,17 @@
</div>
<div class='grow overflow-y-auto pl-4 pr-4 pt-3 pb-3'>
{{fileType}}
<div>
<div class='flex flex-col '>
<!-- 文本 -->
<div class='card' v-if='contentList?.length'>
<div class='card' v-if='contentList?.length' @click='selectFiletype(1)'>
<div class='flex justify-between items-center'>
<div class='font-semibold mb-1'>文本</div>
<van-checkbox-group v-model="fileType" shape="square" icon-size="16px">
<van-checkbox :name="1"></van-checkbox>
</van-checkbox-group>
</div>
<div class='conten-bg'>
<div v-for='item in contentList' :key='item.templateMode' class='mb-1 flex'
:style='`order: ${item.templateMode}`'>
......@@ -24,16 +30,30 @@
</div>
</div>
</div>
<div class='card mt-4' v-if='mp4List?.length'>
<div class='font-semibold mb-1'>视频</div>
<div class='card mt-4' v-if='mp4List?.length' @click='selectFiletype(3)'>
<div class='flex justify-between items-center'>
<div class='font-semibold mb-1'>视频</div>
<van-checkbox-group v-model="fileType" shape="square" icon-size="16px">
<van-checkbox :name="3"></van-checkbox>
</van-checkbox-group>
</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='card flex flex-col mt-4' style='row-gap: .06rem;' v-if='mp3List?.length' @click='selectFiletype(2)'>
<div class='flex justify-between items-center'>
<div class='font-semibold mb-1'>音频</div>
<van-checkbox-group v-model="fileType" shape="square" icon-size="16px">
<van-checkbox :name="2"></van-checkbox>
</van-checkbox-group>
</div>
<div class='conten-bg'>
<Mp3 :file='item' v-for='item in mp3List' :key='item.annexId'
:activeMediaUrl='activeMediaUrl'
......@@ -66,7 +86,8 @@ export default {
data() {
return {
info: {},
activeMediaUrl: ''
activeMediaUrl: '',
fileType: [1, 2, 3],
}
},
computed: {
......@@ -105,8 +126,16 @@ export default {
}).finally(() => {
})
},
selectFiletype(val) {
let index = this.fileType.findIndex(item => item == val)
if (index >= 0) {
this.fileType = this.fileType.filter(item => item != val)
} else {
this.fileType.push(val)
}
},
toUse() {
this.$emit('selectedInfo', this.id)
this.$emit('selectedInfo', this.id, this.fileType)
this.onBack()
},
onBack() {
......
......@@ -5,7 +5,7 @@
<div @click='onBack' class='text-12 back-bt'>
<doc-icon type='doc-left2' />
</div>
<div>随访详情</div>
<div>选择内容</div>
<div class='text-primary left-btn' @click='openSearch'>筛查</div>
</div>
......@@ -77,7 +77,14 @@
</van-popup>
<!-- 查看详情组件-->
<temDetail v-if='detailShow' :show='detailShow' :id='selectRecord.id' @closeDetail='detailClosed' @selectedInfo='detailToUse' :overlay='false'></temDetail>
<temDetail v-if='detailShow && innerShow'
:show='detailShow'
:id='selectRecord.id'
@closeDetail='detailClosed'
@selectedInfo='detailToUse'
:overlay='false'
></temDetail>
</div>
</div>
</van-popup>
......@@ -199,13 +206,13 @@ export default {
this.detailShow = val
},
//列表引用
toUse(record) {
this.$emit('selectRecord', record.id)
toUse(record, typeList = [1, 2, 3]) {
this.$emit('selectRecord', record.id, typeList)
this.onBack()
},
//详情选中引用
detailToUse(val) {
this.$emit('selectRecord', val)
detailToUse(val, typeList = []) {
this.$emit('selectRecord', val, typeList)
this.onBack()
},
onBack() {
......
......@@ -117,10 +117,13 @@
</div>
</div>
</div>
<van-popup v-model:show='showTime1' position='bottom'>
<van-date-picker v-model='currentTime1' @confirm='timeConfirm1' @cancel='showTime1 = false' />
</van-popup>
<DataTime
:values='startTime'
:showType="['year', 'month', 'day', 'hour']"
@changeValue='showTime1 = false'
:showPicker='showTime1'
@confirm='timeConfirm1'
/>
</div>
<!-- 上传随访照片-->
......@@ -186,10 +189,11 @@ import TemList from '@/doctor/components/template/temList'
import { getTemplateDetail } from '@/api/doctor/workbench'
import GuideTextVideo from '@/doctor/followUp/generalFU/form/GuideTextVideo'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn'
import DataTime from '@/doctor/components/dataTime/dataTime'
export default {
name: 'GeneralFUForm',
components: { CheckBtn, GuideTextVideo, TemList, DocImageUpload, DocIcon },
components: { DataTime, CheckBtn, GuideTextVideo, TemList, DocImageUpload, DocIcon },
props: {
info: {
default: () => {
......@@ -226,7 +230,8 @@ export default {
nextVisitDateRange: {
min: undefined,
max: undefined
}
},
startTime: ''
}
},
watch: {
......@@ -295,12 +300,12 @@ export default {
let info = fetchDataHandle(data, {
visitWayRules: 'strToArrNum',
groupsArrays: 'strToArrNum',
publicizeType: 'strToArrNum',
publicizeType: 'strToArrNum'
})
let isSmsIsWx = []
if (info.id) {
const {isSms, isWx} = info
const { isSms, isWx } = info
if (isSms == 1) {
isSmsIsWx = [1]
}
......@@ -327,11 +332,11 @@ export default {
disposalOpinion: info.disposalOpinion,
uploadVisitRecord: info.uploadVisitRecord,
sceneVisitImage: info.sceneVisitImage,
screenTime: info.screenTime || new dayjs().add(1, 'day').format('YYYY-MM-DD HH'),
screenTime: info.screenTime || new dayjs().add(1, 'day').format('YYYY-MM-DD HH:00:00'),
sendInfo: info.sendInfo,
publicizeType: info.publicizeType,
guide: info.guide || {},
publicize: info.publicize || {},
publicize: info.publicize || {}
}
return form
},
......@@ -340,8 +345,8 @@ export default {
this.showDate = false
},
//催检日期选择
timeConfirm1({ selectedValues }) {
this.form.screenTime = selectedValues.join('-')
timeConfirm1(selectedValues) {
this.form.screenTime = dayjs(selectedValues).format('YYYY-MM-DD HH:00:00')
this.showTime1 = false
},
toShowTem(val) {
......@@ -352,18 +357,35 @@ export default {
this.showTem = val
},
//获取选中的模板
async getSelectTem(val) {
if (val) {
async getSelectTem(val, selectType = []) {
if (val && selectType && selectType.length) {
let par = { id: val }
let result = await getTemplateDetail(par)
const { data } = result
let obj = {
annexList: [],
contentList: [],
drugsList: []
}
let mp3List = data.annexList && data.annexList.filter(item => item.type == 2)
let mp4List = data.annexList && data.annexList.filter(item => item.type == 3)
if (selectType.includes(1)) { //是否返回文本选中
obj.contentList = data.contentList
obj.drugsList = data.drugsList
}
if (selectType.includes(2)) {//是否返回音频选中
obj.annexList = [...obj.annexList ,...mp3List]
}
if (selectType.includes(3)) {//是否返回视频选中
obj.annexList = [...obj.annexList, ...mp4List]
}
//健康指导
if (this.showTwo && this.citeInfo == 1) {
this.setGuide(data)
this.setGuide(obj)
}
//宣教内容
if (this.showThree && this.citeInfo == 2) {
this.setPublicize(data)
this.setPublicize(obj)
}
}
},
......@@ -605,8 +627,8 @@ export default {
let time = dayjs(this.form.screenTime).format('YYYY-MM-DD HH:00:00')
let content = `${this.modeEnumList?.urgeResidentShow ? `${this.firstForm?.residentsRecord?.residentName}先生/女士,` : `您好,`}请您于${time}${this.authInfo.unitName}进行专病高危筛查/慢病复查,祝早日恢复健康!`
let res = {
...this.form,
urgentInsContent: content,
...this.form,
urgentInsContent: content
}
//健康指导
if (this.showTwo) {
......@@ -621,7 +643,7 @@ export default {
let resObj = {
annexList: [],
contentList: [],
drugsList: [],
drugsList: []
}
//文本
if (this.form?.publicizeType?.includes(1)) {
......
......@@ -291,9 +291,9 @@ export default {
]
let infoC = info.contentList || []
//判断父组件的数据里是否存在 无 的选项
let resList = infoC.filter(item => item.templateMode != 1)
if (!resList.length) {
contentList = [...initC, ...infoC]
let resList = infoC.filter(item => item.templateMode == 1)
if (!resList.length) { //不存在无选项
contentList = [ ...initC, ...infoC]
} else {
contentList = [...infoC]
}
......@@ -321,7 +321,6 @@ export default {
}
})
const form = {
id: info.id,
templateType: info.templateType,
......
......@@ -2,7 +2,7 @@
<div>
<van-nav-bar :title="routerDetail.id ? '修改通用随访': '新增通用随访'" left-text='' left-arrow
@click-left='toBack'></van-nav-bar>
<div class='p-4 h-overflow'>
<div class='p-4 h-overflow' ref='all'>
<base-info :info='info'
:modeEnumList='modeEnumList'
v-show='step == 1'
......@@ -186,7 +186,7 @@ export default {
this.modeEnumList = getModeEnum(this.info)
},
async toNext(val) {
window.scrollTo(0, 0)
this.$refs.all.scrollTo(0, 0)
if (val == 2) {
this.firstForm = await this.$refs.baseInfo.onSubmit()
}
......
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