yxh
2026-10-05 936c01060eea0924b88ca5c35d221a972a6aba7d
src/views/ecg/checktype/index.vue
@@ -6,46 +6,17 @@
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
      label-width="80px"
    >
      <el-form-item label="检查类型名" prop="name">
      <el-form-item label="项目名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入检查类型名"
          placeholder="请输入检查项目名称"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="检查类型值" prop="value">
        <el-input
          v-model="queryParams.value"
          placeholder="请输入检查类型值"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="允许准备中人数" prop="readyNum">
        <el-input
          v-model="queryParams.readyNum"
          placeholder="请输入允许准备中人数"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker
          v-model="queryParams.createTime"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="daterange"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
          class="!w-220px"
        />
      </el-form-item>
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
@@ -73,24 +44,52 @@
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="检查类型名" align="center" prop="name" />
      <el-table-column label="检查类型值" align="center" prop="value" />
      <el-table-column label="允许准备中人数" align="center" prop="readyNum" />
      <!-- 需求9:不再显示数据库 id;改为显示**可编辑**的「排序序号」(越小越靠前) -->
      <el-table-column label="排序序号" align="center" prop="sort" width="130px">
        <template #default="scope">
          <el-input-number
            v-model="scope.row.sort"
            :min="0"
            :controls="false"
            size="small"
            style="width: 100%"
            @change="handleSortChange(scope.row)"
          />
        </template>
      </el-table-column>
      <el-table-column label="项目名称" align="center" prop="name" width="180px"/>
      <el-table-column label="项目值" align="center" prop="value" />
      <el-table-column label="候诊人数" align="center" prop="readyNum" />
<!--      <el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px />-->
      <el-table-column label="需要设备领用" align="center" prop="needDevReady">
        <template #default="scope">
          {{scope.row.needDevReady === 0 ? "不需要":"需要"}}
        </template>
      </el-table-column>
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
      <el-table-column label="操作" align="center" min-width="120px">
      <el-table-column label="叫号列" align="center" prop="callingColumn" />
      <el-table-column label="显示患者条码" align="center" prop="displayBarcode" />
      <el-table-column label="需要确费" align="center" prop="expenseRecognition" />
      <el-table-column label="时段预约人数" align="center" prop="timeslotBookNum" />
      <el-table-column label="时段预留人数" align="center" prop="timeslotReservedNum" />
      <el-table-column label="预约注意事项" align="center" prop="notes" />
      <el-table-column label="序号前缀" align="center" prop="seqPrefix" />
      <el-table-column label="亲和项目" align="center" prop="affinityCheckTypes" >
        <template #default="scope">
          <div v-for="(checkType, subIndex) in scope.row.affinityCheckTypes" :key="subIndex">
            {{getCheckTypeName(checkType)}}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" min-width="200px" fixed="right">
        <template #default="scope">
          <el-button
            link
            type="primary"
            @click="openQueueSequenceForm(scope.row)"
            v-hasPermi="['ecg:check-type:update']"
          >
            预约时段
          </el-button>
          <el-button
            link
            type="primary"
@@ -121,20 +120,27 @@
  <!-- 表单弹窗:添加/修改 -->
  <CheckTypeForm ref="formRef" @success="getList" />
  <!-- 预约时段维护弹窗:维护该检查项目各时段的取号规则(增/删/改) -->
  <QueueSequenceForm ref="queueSequenceFormRef" />
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import {dateFormatter, dateFormatter2} from '@/utils/formatTime'
import download from '@/utils/download'
import { CheckTypeApi, CheckTypeVO } from '@/api/ecg/checktype'
import CheckTypeForm from './CheckTypeForm.vue'
import QueueSequenceForm from './QueueSequenceForm.vue'
import {useCheckTypeStore} from "@/store/modules/checkType";
import {getCheckTypeName} from "../../../utils/checkTypeFormatter";
/** 检查类型 列表 */
/** 检查项目 列表 */
defineOptions({ name: 'CheckType' })
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const checkTypeStore = useCheckTypeStore();
const loading = ref(true) // 列表的加载中
const list = ref<CheckTypeVO[]>([]) // 列表的数据
@@ -146,10 +152,39 @@
  value: undefined,
  readyNum: undefined,
  createTime: [],
  needDevReady: undefined
  needDevReady: undefined,
  callingColumn: undefined,
  displayBarcode: undefined,
  expenseRecognition: undefined,
  timeslotBookNum: undefined,
  timeslotReservedNum: undefined,
  affinityCheckTypes: undefined
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
/** 预约时段维护弹窗 */
const queueSequenceFormRef = ref()
/** 打开「预约时段」维护弹窗(传入整行,便于显示检查项目名称) */
const openQueueSequenceForm = (row: CheckTypeVO) => {
  queueSequenceFormRef.value.open(row)
}
/**
 * 需求9:列表内直接修改「排序序号」后保存。
 *
 * 仅提交 id 与 sort 两个字段 —— 后端 update 为「按非空字段更新」,
 * 其余字段传 null 不会被覆盖,避免把整行数据回写造成意外。
 */
const handleSortChange = async (row: CheckTypeVO) => {
  try {
    await CheckTypeApi.updateCheckType({ id: row.id, sort: row.sort } as CheckTypeVO)
    message.success('排序已更新')
    await getList()   // 重新拉取,使列表顺序按新的 sort 排好
  } catch {
    await getList()   // 失败时回滚显示
  }
}
/** 查询列表 */
const getList = async () => {
@@ -202,7 +237,7 @@
    // 发起导出
    exportLoading.value = true
    const data = await CheckTypeApi.exportCheckType(queryParams)
    download.excel(data, '检查类型.xls')
    download.excel(data, '检查项目.xls')
  } catch {
  } finally {
    exportLoading.value = false
@@ -213,4 +248,4 @@
onMounted(() => {
  getList()
})
</script>
</script>