|
|
@@ -1,7 +1,320 @@
|
|
|
<template>
|
|
|
- <div> 占位符 </div>
|
|
|
+ <SimpleCard title="床位管理">
|
|
|
+ <template #headRight>
|
|
|
+ <Button type="primary" @click="handleCreate"
|
|
|
+ ><Icon icon="icon-xt-add_default|iconfont" :size="12" /> 新增床位
|
|
|
+ </Button>
|
|
|
+ </template>
|
|
|
+ <template #body>
|
|
|
+ <Row>
|
|
|
+ <Col :span="12">
|
|
|
+ <SimpleCard title="床位信息">
|
|
|
+ <template #headRight>
|
|
|
+ <div> <XTForm :form-data="formData" /> </div>
|
|
|
+ </template>
|
|
|
+ <template #body>
|
|
|
+ <BasicTable @register="bedInfoRegister">
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.key === 'infectiousDiseases'">
|
|
|
+ <div class="flex">
|
|
|
+ <div
|
|
|
+ v-for="item in record.infectiousDiseases"
|
|
|
+ :key="item"
|
|
|
+ :style="{
|
|
|
+ backgroundColor: formatDictColor(bizDictOptions.wardType, item),
|
|
|
+ color: formatDictFontColor(bizDictOptions.wardType, item),
|
|
|
+ padding: '1px 6px',
|
|
|
+ borderRadius: '2px',
|
|
|
+ marginRight: '4px',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ {{ formatDictValue(bizDictOptions.wardType, item) }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'action'">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ label: '更换',
|
|
|
+ tooltip: '更换',
|
|
|
+ disabled: !record.deviceId,
|
|
|
+ onClick: handleChangeDeivice.bind(null, record, column),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ifShow: record?.deviceId != null,
|
|
|
+ label: '解绑',
|
|
|
+ tooltip: '解绑',
|
|
|
+ popConfirm: {
|
|
|
+ title: '是否确定' + (record.deviceId ? '解绑' : '绑定') + '此设备?',
|
|
|
+ placement: 'left',
|
|
|
+ confirm: handleBinding.bind(null, record, column),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ifShow: record?.deviceId == null,
|
|
|
+ label: '绑定',
|
|
|
+ tooltip: '绑定',
|
|
|
+ onClick: handleBinding.bind(null, record, column),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ tooltip: '删除',
|
|
|
+ popConfirm: {
|
|
|
+ title: '是否取消删除?',
|
|
|
+ placement: 'left',
|
|
|
+ confirm: handleDelete.bind(null, record, column),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </template>
|
|
|
+ </SimpleCard>
|
|
|
+ </Col>
|
|
|
+ <Col :span="12">
|
|
|
+ <SimpleCard title="设备更换记录">
|
|
|
+ <template #headRight>
|
|
|
+ <div> <XTForm :form-Data="recordingFormData" /> </div>
|
|
|
+ </template>
|
|
|
+ <template #body>
|
|
|
+ <BasicTable @register="recordingRegister">
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.key === 'operationType'">
|
|
|
+ <span>{{
|
|
|
+ formatDictValue(bizDictOptions.operationType, record.operationType)
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'deviceType'">
|
|
|
+ <span
|
|
|
+ :class="['table-dot']"
|
|
|
+ :style="{
|
|
|
+ backgroundColor: formatDictPreColor(
|
|
|
+ bizDictOptions.deviceType,
|
|
|
+ record.deviceType,
|
|
|
+ ),
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ <span>{{ formatDictValue(bizDictOptions.deviceType, record.deviceType) }}</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </template>
|
|
|
+ </SimpleCard>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </template>
|
|
|
+ </SimpleCard>
|
|
|
+ <FormModal @register="registerModal" @success="callSuccess" />
|
|
|
+ <ChangeFormModal @register="registerChangeModal" @success="callSuccess" />
|
|
|
</template>
|
|
|
+<script setup lang="ts">
|
|
|
+ import { onBeforeMount, ref, reactive } from 'vue';
|
|
|
+ import { BasicTable, useTable, TableAction } from '@/components/Table';
|
|
|
+ import { Row, Col, Button } from 'ant-design-vue';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { bedInfoColumns, recordingColumns } from './data';
|
|
|
+ import FormModal from './formModal.vue';
|
|
|
+ import ChangeFormModal from './changeFormModal.vue';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import { SimpleCard } from '@/components/XTCard/index';
|
|
|
+ import { XTForm } from '/@/components/XTForm/index';
|
|
|
+ import Icon from '/@/components/Icon/src/Icon.vue';
|
|
|
+ import {
|
|
|
+ engineerBedQueryPage,
|
|
|
+ bedDeviceReplacePageQuery,
|
|
|
+ engineerBedRemove,
|
|
|
+ engineerBedDetail,
|
|
|
+ engineerBedEdit,
|
|
|
+ } from '/@/api/biz/engineer/bedApi';
|
|
|
+ import {
|
|
|
+ formatDictColor,
|
|
|
+ formatDictValue,
|
|
|
+ formatDictFontColor,
|
|
|
+ formatDictPreColor,
|
|
|
+ } from '@/utils';
|
|
|
+ import { listDictModelBatch } from '/@/api/common';
|
|
|
+ import dayjs from 'dayjs';
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
+ const [registerChangeModal, { openModal: openChangeFormModal }] = useModal();
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const bizDictData = ref([
|
|
|
+ { key: 'wardType', dictCode: 'pb_epidemic' },
|
|
|
+ { key: 'operationType', dictCode: 'beot' },
|
|
|
+ { key: 'deviceType', dictCode: 'bm_det' },
|
|
|
+ ]);
|
|
|
+ const bizDictOptions = reactive<any>({});
|
|
|
+ // 组件加载前事件
|
|
|
+ onBeforeMount(async () => {
|
|
|
+ const res = await listDictModelBatch(bizDictData.value.map(ele => ele.dictCode));
|
|
|
+ for (const i in res) {
|
|
|
+ const filter = bizDictData.value.filter(ele => ele.dictCode == i)[0];
|
|
|
+ bizDictOptions[filter.key] = res[i];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 床位信息列表
|
|
|
+ const [bedInfoRegister, { reload }] = useTable({
|
|
|
+ api: engineerBedQueryPage,
|
|
|
+ rowKey: 'id',
|
|
|
+ columns: bedInfoColumns,
|
|
|
+ showIndexColumn: false,
|
|
|
+ striped: false,
|
|
|
+ formConfig: {
|
|
|
+ labelWidth: 120,
|
|
|
+ autoSubmitOnEnter: true,
|
|
|
+ baseColProps: { xs: 24, sm: 12, md: 12, lg: 8 },
|
|
|
+ resetButtonOptions: {
|
|
|
+ preIcon: 'icon-delete|iconfont',
|
|
|
+ },
|
|
|
+ submitButtonOptions: {
|
|
|
+ preIcon: 'icon-search|iconfont',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ useSearchForm: false,
|
|
|
+ actionColumn: {
|
|
|
+ width: 150,
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ },
|
|
|
+ beforeFetch: handleBeforeFetch,
|
|
|
+ });
|
|
|
+ // 设备更换记录列表
|
|
|
+ const [recordingRegister, { reload: reloadRecording }] = useTable({
|
|
|
+ api: bedDeviceReplacePageQuery,
|
|
|
+ rowKey: 'id',
|
|
|
+ columns: recordingColumns,
|
|
|
+ showIndexColumn: false,
|
|
|
+ striped: false,
|
|
|
+ formConfig: {
|
|
|
+ labelWidth: 120,
|
|
|
+ autoSubmitOnEnter: true,
|
|
|
+ baseColProps: { xs: 24, sm: 12, md: 12, lg: 8 },
|
|
|
+ resetButtonOptions: {
|
|
|
+ preIcon: 'icon-delete|iconfont',
|
|
|
+ },
|
|
|
+ submitButtonOptions: {
|
|
|
+ preIcon: 'icon-search|iconfont',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ useSearchForm: false,
|
|
|
+ beforeFetch: handlebedDevuceBeforeFetch,
|
|
|
+ });
|
|
|
+ // 床位信息标头条件查询
|
|
|
+ const formData = [
|
|
|
+ {
|
|
|
+ name: 'text22',
|
|
|
+ componentType: 'Select',
|
|
|
+ placeholder: '请选择',
|
|
|
+ width: 150,
|
|
|
+ defaultValue: '1',
|
|
|
+ dicts: [
|
|
|
+ { label: '第一班', value: '1' },
|
|
|
+ { label: '第二班', value: '2' },
|
|
|
+ { label: '第三班', value: '3' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'text22',
|
|
|
+ componentType: 'Select',
|
|
|
+ placeholder: '请选择',
|
|
|
+ width: 150,
|
|
|
+ defaultValue: '1',
|
|
|
+ dicts: [
|
|
|
+ { label: '第一班', value: '1' },
|
|
|
+ { label: '第二班', value: '2' },
|
|
|
+ { label: '第三班', value: '3' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
|
|
|
-<script setup lang="ts"></script>
|
|
|
+ const recordingFormData = [
|
|
|
+ {
|
|
|
+ name: 'createTime',
|
|
|
+ componentType: 'RangePicker',
|
|
|
+ placeholder: '请选择',
|
|
|
+ format: 'YYYY-MM-DD',
|
|
|
+ valueFormat: 'YYYY-MM-DD',
|
|
|
+ defaultValue: [
|
|
|
+ dayjs().subtract(3, 'month').format('YYYY-MM-DD'),
|
|
|
+ dayjs().format('YYYY-MM-DD'),
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'searchNames',
|
|
|
+ componentType: 'Input',
|
|
|
+ prefix: 'icon-xt-search',
|
|
|
+ placeholder: '请输入设备编号',
|
|
|
+ width: 240,
|
|
|
+ },
|
|
|
+ ];
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
+ // 请求床位信息前事件
|
|
|
+ function handleBeforeFetch(params) {
|
|
|
+ return { ...params };
|
|
|
+ }
|
|
|
+ // 请求更换记录列表前事件
|
|
|
+ function handlebedDevuceBeforeFetch(params) {
|
|
|
+ return { ...params, orders: [{ field: 'updateTime', direction: 'DESC' }] };
|
|
|
+ }
|
|
|
+ // 删除床位信息
|
|
|
+ async function handleDelete(record) {
|
|
|
+ if (record) {
|
|
|
+ await engineerBedRemove([record.id]);
|
|
|
+ await reload();
|
|
|
+ await reloadRecording();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 新增床位信息
|
|
|
+ function handleCreate() {
|
|
|
+ openModal(true, {});
|
|
|
+ }
|
|
|
+ // 新增返回刷新
|
|
|
+ function callSuccess() {
|
|
|
+ reload();
|
|
|
+ reloadRecording();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 绑定设备、解绑方法
|
|
|
+ async function handleBinding(record) {
|
|
|
+ if (record && record.id) {
|
|
|
+ const detailRes = await engineerBedDetail(record.id);
|
|
|
+ if (detailRes && detailRes.deviceId) {
|
|
|
+ detailRes.deviceId = undefined;
|
|
|
+ const editParams = {
|
|
|
+ id: detailRes.id,
|
|
|
+ wardId: detailRes.wardId,
|
|
|
+ name: detailRes.wardName,
|
|
|
+ deviceId: null,
|
|
|
+ };
|
|
|
+ await engineerBedEdit(editParams);
|
|
|
+ createMessage.success('设备解绑成功');
|
|
|
+ await reload();
|
|
|
+ await reloadRecording();
|
|
|
+ } else {
|
|
|
+ openModal(true, {
|
|
|
+ isUpdate: true,
|
|
|
+ record,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 更换设备方法
|
|
|
+ function handleChangeDeivice(record) {
|
|
|
+ console.log('record:::::::', record);
|
|
|
+ openChangeFormModal(true, {
|
|
|
+ record,
|
|
|
+ });
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+ .table-dot {
|
|
|
+ display: inline-block;
|
|
|
+ width: 10px;
|
|
|
+ height: 10px;
|
|
|
+ margin-right: 6px;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+</style>
|