1
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
<div class="toolbar">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="!props.diagnosisId || !!props.readOnly"
|
||||
:disabled="!props.diagnosisId || !!props.readOnly || !hasDailyRecordPermission"
|
||||
@click="handleAdd"
|
||||
v-perms="['tcm.diagnosisTodo/add']"
|
||||
v-perms="DAILY_RECORD_PERMS"
|
||||
>
|
||||
+ 新增待办
|
||||
</el-button>
|
||||
@@ -55,7 +55,7 @@
|
||||
link
|
||||
type="danger"
|
||||
@click="handleCancel(row)"
|
||||
v-perms="['tcm.diagnosisTodo/cancel']"
|
||||
v-perms="DAILY_RECORD_PERMS"
|
||||
>
|
||||
取消
|
||||
</el-button>
|
||||
@@ -114,8 +114,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { diagnosisTodoLists, diagnosisTodoAdd, diagnosisTodoCancel } from '@/api/tcm'
|
||||
import { computed } from 'vue'
|
||||
import { hasPermission } from '@/utils/perm'
|
||||
import feedback from '@/utils/feedback'
|
||||
|
||||
const DAILY_RECORD_PERMS = ['tcm.diagnosis/dailyRecord']
|
||||
|
||||
interface Props {
|
||||
diagnosisId: number | null | undefined
|
||||
patientId?: number | null
|
||||
@@ -124,6 +128,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const hasDailyRecordPermission = computed(() => hasPermission(DAILY_RECORD_PERMS))
|
||||
|
||||
// pager 与项目内 <pagination v-model="pager" /> 约定的字段保持一致
|
||||
const pager = reactive({
|
||||
@@ -137,7 +142,7 @@ const pager = reactive({
|
||||
const filterStatus = ref<number | ''>('')
|
||||
|
||||
const fetchList = async () => {
|
||||
if (!props.diagnosisId || Number(props.diagnosisId) <= 0) {
|
||||
if (!props.diagnosisId || Number(props.diagnosisId) <= 0 || !hasDailyRecordPermission.value) {
|
||||
pager.lists = []
|
||||
pager.count = 0
|
||||
return
|
||||
@@ -221,7 +226,7 @@ const disablePastDate = (date: Date) => {
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
if (!props.diagnosisId || props.readOnly) {
|
||||
if (!props.diagnosisId || props.readOnly || !hasDailyRecordPermission.value) {
|
||||
feedback.msgWarning('诊单未保存,无法添加待办')
|
||||
return
|
||||
}
|
||||
@@ -260,6 +265,7 @@ const handleAddSubmit = async () => {
|
||||
|
||||
// ========== 取消 ==========
|
||||
const handleCancel = async (row: any) => {
|
||||
if (!hasDailyRecordPermission.value || props.readOnly) return
|
||||
try {
|
||||
await feedback.confirm(`确认取消「${row.remind_time_text} · ${truncate(row.content, 30)}」吗?`)
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user