| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- <template>
- <el-drawer
- v-model="dialogVisible"
- :title="title"
- resizable
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- :destroy-on-close="true"
- size="70%"
- :before-close="handleClosed"
- >
- <div class="attack-risk-form">
- <h1 class="form-title">风险知情书(附件)</h1>
- <!-- 基本信息 -->
- <el-row :gutter="40">
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="row">
- <text>长者姓名</text>
- <search-the-elderly ref="selectElderRef" :disabled="isDetail" @update_elder="elderUp" v-model="dataForm.elderName" :tId="dataForm.tenantId"/>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="row">
- <text>档案号</text>
- <el-input v-if="!isDetail" v-model="dataForm.contractNumber" disabled />
- <el-text v-else disabled="">{{dataForm.contractNumber}}</el-text>
- </el-col>
- </el-row>
- <el-row :gutter="40">
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="row">
- <text>入院日期</text>
- <el-input v-if="!isDetail" :model-value="dayjs(dataForm.checkInTime).format('YYYY-MM-DD')=='Invalid Date'?'':dayjs(dataForm.checkInTime).format('YYYY-MM-DD')" disabled />
- <el-text v-else disabled="">{{dayjs(dataForm.checkInTime).format('YYYY-MM-DD')}}</el-text>
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="row">
- <text>床位号</text>
- <el-input v-if="!isDetail" v-model="dataForm.bedName" disabled />
- <el-text v-else disabled="">{{dataForm.bedName}}</el-text>
- </el-col>
- </el-row>
- <el-row :gutter="40">
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="row">
- <text>记录人</text>
- <el-input :disabled="isDetail" v-model="form.assessor" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="row">
- <text>记录日期</text>
- <el-date-picker :disabled="isDetail" v-model="form.assessDate" type="date" style="width: 100%;"/>
- </el-col>
- </el-row>
- <!-- 内容区域 -->
- <div class="form-body">
- <RiskDisclosureBody
- v-model="riskDisclosureForm"
- :is-text-mode="isDetail"
- />
- </div>
- </div>
- <template #footer>
- <el-button @click="handleClosed">关闭</el-button>
-
- <el-button style="margin-left: 22px;margin-right: 30px" v-loading="formLoading" type="primary" v-show="!isDetail" @click="submitForm">确定</el-button>
- </template>
- </el-drawer>
- </template>
- <script lang="ts" setup>
- import { computed, ref, watch, reactive } from 'vue'
- import dayjs from 'dayjs'
- import RiskDisclosureBody from '../components/RiskDisclosureBody.vue'
- import { attackRiskCreate, attackRiskUpdate } from "@/api/social-work";
- const message = useMessage() // 消息弹窗
- const { t } = useI18n() // 国际化
- const title = ref('')
- const dialogVisible = ref(false) // 弹窗
- const formRef = ref() // 表单 Ref
- const riskDisclosureForm = ref() // 表单 Ref
- const isDetail = ref(false) // 是否详情打开
- const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
- let dataForm = ref({
- // 表单字段
- id: undefined,
- idCard: '',
- contractNumber: '', //档案号
- elderName: '',//长者姓名
- bedName: '', //床位号
- elderAge: '', //年龄
- elderSex: '', //性别
- checkInTime: '', //入院日期
- elderId: '',
- tenantId: undefined
- })
- const elderUp = (e) => {
- dataForm.value.elderName = e.elderName
- dataForm.value.elderId = e.id
- dataForm.value.elderSex = e.elderSex === 1 ? '男' : '女'
- dataForm.value.bedName = e.bedName || ''
- dataForm.value.checkInTime = e.checkInTime
- dataForm.value.contractNumber = e.contractNumber||e.fileNumber
- dataForm.value.elderAge = e.elderAge
- }
- // ========== 攻击风险因素评估量表 表单序列化方法 ==========
- defineExpose({ open }) // 提供 open 方法,用于打开弹窗
- /** 提交表单 */
- const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
- const submitForm = async () => {
- if (formLoading.value) {
- return
- }
- formLoading.value = true
- // 提交请求
- try {
- const assessData = serializeFormData()
- const tempParams = {
- ...dataForm.value,
- assessData: JSON.stringify(assessData),
- attackLevel: form.attackLevel,
- riskLevel: form.riskLevel,
- assessor: form.assessor,
- assessScore: form.attackLevel,
- assessDate: form.assessDate ? dayjs(form.assessDate).format('YYYY-MM-DD') : ''
- }
- if (dataForm.value.id) {
- const res = await attackRiskUpdate(tempParams)
- if (res) {
- message.success(t('common.updateSuccess'))
- dialogVisible.value = false
- // 发送操作成功的事件
- emit('success')
- }
- } else {
- const res = await attackRiskCreate(tempParams)
- if (res) {
- message.success(t('common.createSuccess'))
- dialogVisible.value = false
- // 发送操作成功的事件
- emit('success')
- }
- }
- } finally {
- setTimeout(() => {
- formLoading.value = false
- }, 500)
- }
- }
- /** 重置表单 */
- const resetForm = () => {
- formRef.value?.resetFields()
-
- }
- // 关闭表单
- const handleClosed = () => {
- dialogVisible.value = false
- resetForm()
- }
- </script>
- <style scoped lang="scss">
- .form-title {
- text-align: center;
- font-size: 20px;
- width: 100%;
- margin-bottom: 20px;
- }
- .attack-risk-form {
- max-width: 1200px;
- margin: 0 auto;
- background: #fff;
- .info-row {
- display: flex;
- gap: 40px;
- width: 100%;
- flex-direction: row;
- align-items: center;
- margin-bottom: 10px;
- .info-item {
- display: flex;
- align-items: center;
- gap: 8px;
- .label {
- width: 82px;
- text-align: right;
- margin-right: 4px;
- white-space: nowrap;
- }
- }
- }
- .form-body {
- border: 1px solid #333;
- padding: 15px;
- }
- // 调整 Element Plus 组件样式
- :deep(.el-input__inner) {
- height: 28px;
- line-height: 28px;
- border-top: none;
- border-left: none;
- border-right: none;
- border-radius: 0;
- padding: 0 4px;
- &:focus {
- border-color: #409eff;
- }
- }
- :deep(.el-checkbox__label),
- :deep(.el-radio__label) {
- padding-left: 4px;
- }
- }
- .row{
- margin-bottom: 12px;
- display: flex;
- flex-direction: row;
- align-items: center;
- text{
- text-align: right;
- margin-right: 4px;
- width: 82px;
- }
- }
- // NGASR自杀风险评估量表 特有样式
- .total-score-section {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 15px;
- background: #f5f7fa;
- border-radius: 4px;
- margin-bottom: 20px;
- .total-score {
- display: flex;
- align-items: baseline;
- gap: 4px;
- .score-label {
- font-size: 16px;
- font-weight: bold;
- }
- .score-value {
- font-size: 28px;
- font-weight: bold;
- color: #409eff;
- }
- .score-max {
- font-size: 14px;
- color: #909399;
- }
- }
- .risk-level {
- font-size: 16px;
- font-weight: bold;
- padding: 8px 16px;
- border-radius: 4px;
- &.risk-none {
- color: #67c23a;
- background: #f0f9eb;
- }
- &.risk-low {
- color: #e6a23c;
- background: #fdf6ec;
- }
- &.risk-medium {
- color: #f56c6c;
- background: #fef0f0;
- }
- &.risk-high {
- color: #f56c6c;
- background: #fef0f0;
- border: 1px solid #f56c6c;
- }
- }
- }
- .assessment-table {
- width: 100%;
- border-collapse: collapse;
- margin-bottom: 20px;
- table {
- width: 100%;
- border: 1px solid #333;
- th, td {
- border: 1px solid #333;
- padding: 12px;
- text-align: left;
- vertical-align: top;
- }
- th {
- background: #f5f7fa;
- font-weight: bold;
- text-align: center;
- }
- .content-col {
- width: 65%;
- }
- .level-col {
- width: 10%;
- text-align: center;
- }
- .select-col {
- width: 25%;
- text-align: center;
- }
- .content {
- text-align: left;
- .content-title {
- font-weight: bold;
- margin-bottom: 8px;
- }
- .content-item {
- margin-left: 15px;
- margin-bottom: 4px;
- font-size: 13px;
- }
- }
- .level {
- text-align: center;
- font-weight: bold;
- }
- .select {
- text-align: center;
- :deep(.el-radio) {
- margin-right: 0;
- }
- }
- }
- }
- .risk-judgment-section {
- margin: 20px 0;
- padding: 15px;
- background: #f5f7fa;
- border-radius: 4px;
- border: 1px solid #e4e7ed;
- .risk-judgment-title {
- font-weight: bold;
- font-size: 16px;
- margin-bottom: 12px;
- color: #303133;
- }
- .risk-options {
- display: flex;
- flex-wrap: wrap;
- gap: 20px;
- :deep(.el-radio) {
- margin-right: 0;
- }
- }
- }
- .preventive-section {
- margin: 20px 0;
- padding: 15px;
- background: #f5f7fa;
- border-radius: 4px;
- border: 1px solid #e4e7ed;
- .preventive-title {
- font-weight: bold;
- font-size: 16px;
- margin-bottom: 12px;
- color: #303133;
- }
- .preventive-options {
- display: flex;
- flex-wrap: wrap;
- gap: 15px;
- :deep(.el-checkbox) {
- margin-right: 20px;
- margin-bottom: 8px;
- }
- .other-input {
- width: 200px;
- margin-left: 10px;
- }
- }
- }
- .signature-section {
- margin: 20px 0;
- padding: 15px;
- background: #f5f7fa;
- border-radius: 4px;
- border: 1px solid #e4e7ed;
- .signature-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: 20px;
- }
- .signature-item {
- display: flex;
- align-items: center;
- gap: 10px;
- &.date-item {
- :deep(.el-date-picker) {
- width: 150px;
- }
- }
- }
- .signature-label {
- font-weight: bold;
- white-space: nowrap;
- }
- .signature-input {
- width: 150px;
- }
- .date-picker {
- width: 150px;
- }
- }
- .note-section {
- margin-top: 20px;
- padding: 15px;
- background: #f5f7fa;
- border-radius: 4px;
- border: 1px solid #e4e7ed;
- .note-title {
- font-weight: bold;
- font-size: 16px;
- margin-bottom: 12px;
- color: #303133;
- }
- .note-content {
- font-size: 13px;
- line-height: 1.8;
- color: #606266;
- p {
- margin: 5px 0;
- }
- .indent {
- margin-left: 20px;
- }
- }
- }
- </style>
|