GeneralFUForm.vue 13.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
<template>
    <div>
        <van-form ref='form'>
            <div class='title'>随访信息</div>
            <div v-if='showOne'>
                <div class='label-title'>随访内容</div>
                <van-field
                    v-model='form.visitContent'
                    placeholder='随访内容'
                    class='input-back mt-2 form-input'
                    rows='2'
                    autosize
                    type='textarea'
                    :rules='rules.visitContent'
                />
            </div>
            <div v-if='showOne'>
                <div class='no-req-label mt-5'>处置意见</div>
                <van-field
                    v-model='form.disposalOpinion'
                    rows='2'
                    autosize
                    type='textarea'
                    placeholder='处置意见'
                    class='input-back mt-2 form-input'
                />
            </div>
            <div v-if='showTwo'>
                <div class='no-req-label mt-5'>健康指导</div>
                <div class='health mt-2'>
                    <div class='health-cell mt-2' v-for='item in form.visitHealthGuideList'>
                        <div class='no-req-label' v-if="item.name != '无'">{{ 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='showFour'>
                <div class='no-req-label mt-5'>催检内容</div>
                <div class='tel-back mt-2'>
                    <div class='tel'>
                        <div style='text-indent: 2em;line-height: .2rem'>
                            <span v-if='modeEnumList.urgeResidentShow'>{{ firstForm.residentsRecord.residentName }}先生/女士,</span>
                            <span v-else>您好,</span>
                            <span>请您于{{ form.screenTime }}</span>
                            <span>{{ authInfo.unitName }}</span>
                            <span>进行专病高危筛查/慢病复查,</span>
                            <span>祝早日康复!</span>
                        </div>
                        <div class='mt-2' style='text-align: center' @click='showTime1 = true'>
                            <span style='color: #607FF0'>修改日期</span>
                        </div>
                    </div>
                </div>
                <van-popup v-model:show='showTime1' position='bottom'>
                    <van-date-picker  v-model='currentTime1' @confirm='timeConfirm1' @cancel='showTime1 = false' />
                </van-popup>

            </div>

<!--            上传随访照片-->
            <div v-if='showOne'>
                <div class='no-req-label mt-5'>上传随访记录</div>
             <DocImageUpload
                 description="支持上传jpg、png、jpeg文件,大小请在10M以内"
                 lengthMessage="抱歉,最多可上传6个文件。"
                 :imageData="[]"
                 @change="(ids, option) => form.uploadVisitRecord = ids"
                 :maxLength="6"
                 class="mt-2"
             />
            </div>
<!--            现场随访照片-->
            <div>
                <div class='no-req-label mt-5'>现场随访照片</div>
                <DocImageUpload
                    description="支持上传jpg、png、jpeg文件,大小请在10M以内"
                    lengthMessage="抱歉,最多可上传6个文件。"
                    :imageData="[]"
                    @change="(ids, option) => form.sceneVisitImage = ids"
                    :maxLength="6"
                    class="mt-2"
                />
            </div>


            <div>
                <div class='label-title mt-5'>下次随访日期</div>
                <van-field
                    v-model='form.nextVisitDate'
                    is-link
                    readonly
                    name='nextVisitDate'
                    placeholder='下次随访日期'
                    class='input-back mt-2 form-input'
                    :rules='rules.nextVisitDate'
                    @click='showDate = true' />
                <van-popup v-model:show='showDate' position='bottom'>
                    <van-date-picker v-model='form._nextVisitDate'
                                     :min-date='nextVisitDateRange.min'
                                     :max-date='nextVisitDateRange.max'
                                     @confirm='dataConfirm' @cancel='showDate = false' />
                </van-popup>
            </div>
        </van-form>
    </div>
</template>

<script>
import { useStore } from '@/resident/store'
import dayjs from 'dayjs'
import DocIcon from '@/components/docIcon/DocIcon'
import { showToast } from 'vant'
import { fetchDataHandle } from '@/utils/common'
import DocImageUpload from '@/doctor/components/docImageUpload/DocImageUpload'

export default {
    name: 'GeneralFUForm',
    components: { DocImageUpload, DocIcon },
    props: {
        info: {
            default: () => {
                return {}
            }
        },
        firstForm: {
            default: () => {
                return {}
            }
        },
        modeEnumList: {
            default: () => {
                return {}
            }
        }
    },
    data() {
        return {
            store: useStore(),
            form: {},
            //展示用
            imgList: [],
            imgList2: [],
            //input图片值
            imgInputList1: [],
            imgInputList2: [],
            showDate: false,
            showTime1: false,
            currentTime1: null,
            showImgList: [],
            initSwipe: 0,
            rules: {
                visitContent: [{ required: true, message: '请输入' }],
                nextVisitDate: [{ required: true, message: '请选择' }]
            },
            // 筛查日期可选范围
            nextVisitDateRange: {
                min: undefined,
                max: undefined
            }
        }
    },
    watch: {
        'info': {
            handler() {
                this.form = this.setForm(this.info)
            },
            immediate: true
        }
    },
    computed: {
        authInfo() {
            return this.store.$state.authInfo
        },
        //复检
        showOne() {
            const { visitWayRules } = this.firstForm
            let res = false
            let list = visitWayRules && visitWayRules.split(',').map(item => Number(item))
            if (list && list.includes(1)) {
                res = true
            }
            return res
        },
        //指导
        showTwo() {
            const { visitWayRules } = this.firstForm
            let res = false
            let list = visitWayRules && visitWayRules.split(',').map(item => Number(item))
            if (list && list.includes(2)) {
                res = true
            }
            return res
        },
        //宣教
        showThree() {
            const { visitWayRules } = this.firstForm
            let res = false
            let list = visitWayRules && visitWayRules.split(',').map(item => Number(item))
            if (list && list.includes(3)) {
                res = true
            }
            return res
        },
        //催检
        showFour() {
            const { visitWayRules } = this.firstForm
            let res = false
            let list = visitWayRules && visitWayRules.split(',').map(item => Number(item))
            if (list && list.includes(4)) {
                res = true
            }
            return res
        },
    },
    created() {
        const date = dayjs()
        this.nextVisitDateRange.max = new Date(date.year() + 10, date.month(), date.date())
        this.nextVisitDateRange.min = new Date(date.year(), date.month(), date.date() + 1)
        this.form._nextVisitDate = [date.year(), date.month(), date.date() + 1]
        let time = new dayjs().add(1, 'day').format('YYYY-MM-DD')
        this.currentTime1 = time.split('-')
    },
    methods: {
        setForm(info = {}) {
            const modeArray = this.store.getDict('DC00084')
            let visitHealthGuideList = []
            if (info.healthGuideContent) {
                visitHealthGuideList = JSON.parse(info.healthGuideContent)
            }
            const form = {
                id: info.id,
                diseaseType: info.diseaseType,
                visitDate: info.visitDate || new dayjs(),
                nextVisitDate: info.nextVisitDate ||  new dayjs().add(1, 'day').format('YYYY-MM-DD'),
                isSms: info.isSms,
                isWx: info.isWx,
                screenTime: new dayjs().add(1, 'day').format('YYYY-MM-DD'),
                visitContent: info.visitContent,
                disposalOpinion: info.disposalOpinion,
                uploadVisitRecord: info.uploadVisitRecord,
                sceneVisitImage: info.sceneVisitImage,
                sendInfo: info.sendInfo,
                visitHealthGuideList: modeArray.map(e => {
                    const item = visitHealthGuideList.find(i => i.templateMode === e.value)
                    return {
                        templateMode: e.value,
                        name: e.name,
                        templateContent: item ? item.templateContent : '',
                        id: item ? item.visitId : ''
                    }
                })

            }
            return form
        },
        dataConfirm({ selectedValues }) {
            this.form.nextVisitDate = selectedValues.join('-')
            this.showDate = false
        },
        //催检日期选择
        timeConfirm1({ selectedValues }) {
            this.form.screenTime = selectedValues.join('-')
            this.showTime1 = false
        },
        onSubmit() {
            return new Promise((resolve, reject) => {
                this.$refs.form.validate().then(() => {
                    if (this.imgList.length > 6 || this.imgList2.length > 8) {
                        return
                    }
                    let time = dayjs(this.form.screenTime).format('YYYY-MM-DD')
                    let content = `${this.modeEnumList.urgeResidentShow ? `${this.firstForm.residentsRecord.residentName}先生/女士,` : `您好,`}请您于${time}${this.authInfo.unitName}进行专病高危筛查/慢病复查,祝早日恢复健康!`
                    let par = {
                        img1: this.imgList || [],
                        img2: this.imgList2 || [],
                        imgInput1: this.imgInputList1,
                        imgInput2: this.imgInputList2,
                        ...this.form,
                        urgentInsContent: content,
                        healthGuideContent: JSON.stringify(this.form.visitHealthGuideList)
                    }
                    resolve(par)
                }).catch((e) => {
                    console.warn('generaFu error', e)
                    // reject(e)
                })
            })
        }
    }
}
</script>

<style scoped lang='less'>
.title {
    font-weight: bold;
    margin-bottom: 20px;
}

.label-title {
    font-size: 13px;
    color: #595959;
    font-weight: 500;

    &::after {
        content: "*";
        color: red;
        font-weight: bold;
        margin-left: 4px;
    }
}

.no-req-label {
    font-size: 13px;
    color: #595959;
    font-weight: 500;
}

.form-input {
    padding: 8px 12px;
    border-radius: 8px;
}

.input-back {
    background: #FAFAFA;
}

.tel-back {
    background: #F5F5F5;
    padding: 8px;
    border-radius: 0px 0px 8px 8px;
}

.tel {
    background: #FFFFFF;
    padding: 8px;
    border-radius: 8px;
}

.tel-label {
    color: #607FF0;
    font-weight: bold;
}

.p-12-0 {
    padding: 12px 0px;
}

.health {
    padding: 1px 8px 8px 8px;
    background: #FAFAFA;
    border-radius: 8px;

    .health-cell {
        padding: 8px;
        background: #FFFFFF;
        border-radius: 8px;
    }
}

.tips {
    color: #A5AEBE;
    font-size: 12px;
    margin-top: 8px;
}

.img-btn {
    border: 1px solid #EEEEEE;
    background: #FAFAFA;
    border-radius: 8px;
    padding: 14px 46px;
    text-align: center;
    color: #607FF0;
}

.doc-up {
    font-size: 20px;
}

.pdf {
    border: 1px solid #EEEEEE;
    border-radius: 8px;
    padding: 8px;
}

.remove {
    font-size: 24px;
    position: absolute;
    right: -8px;
    top: -9px;
    z-index: 1;
}

.wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;

    .block {
        width: 100%;
        height: 300px;
    }
}

:deep(.van-cell-group--inset) {
    overflow: visible;
}

:deep(.van-cell) {
    overflow: visible;
}

:deep(.van-field__error-message) {
    position: absolute;
}

:deep(.van-cell:after) {
    border-bottom: 0px;
}

.warn {
    color: #ee0a24;
    text-align: left;
}

</style>

<style lang='less'>
.custom-image-preview .van-image-preview__container .van-image-preview__item:not(:first-child):not(last-child) {
    display: block !important;
}

.van-image__img {
    width: 100%;
}

.van-swipe__track {
    width: 100% !important;
}

.van-swipe-item {
    width: 100% !important;
}
</style>