|
|
@@ -0,0 +1,291 @@
|
|
|
+<template>
|
|
|
+ <PageWrapper>
|
|
|
+ <Card
|
|
|
+ :bordered="false"
|
|
|
+ :active-tab-key="activeKey"
|
|
|
+ :tab-list="tabList"
|
|
|
+ style="height: 800px"
|
|
|
+ @tabChange="
|
|
|
+ key => {
|
|
|
+ activeKey = key;
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <p :key="0" v-if="activeKey == 0">
|
|
|
+ <Row>
|
|
|
+ <Col :span="6">
|
|
|
+ <Card title="病区属性" style="height: 680px">
|
|
|
+ <template #extra
|
|
|
+ ><Button size="small" v-auth="['sys:wardProperties:add']" @click="handleAddAttr"
|
|
|
+ >+</Button
|
|
|
+ ></template
|
|
|
+ >
|
|
|
+ <Row>
|
|
|
+ <div class="type-title">阴性</div>
|
|
|
+ </Row>
|
|
|
+ <Row v-for="item in attributeFeminineList" :key="item.key" style="margin: 4px 0">
|
|
|
+ <Tag
|
|
|
+ class="attrs"
|
|
|
+ closable
|
|
|
+ @close="handleDeleteAttr(item.key)"
|
|
|
+ @click="handleSelectWard(item)"
|
|
|
+ :value="item.key"
|
|
|
+ >{{ item.label }}
|
|
|
+ </Tag>
|
|
|
+ </Row>
|
|
|
+ <Row>
|
|
|
+ <div class="type-title">阳性</div>
|
|
|
+ </Row>
|
|
|
+ <Row v-for="item in attributePositiveList" :key="item.key" style="margin: 4px 0">
|
|
|
+ <Tag
|
|
|
+ class="attrs"
|
|
|
+ closable
|
|
|
+ @close="handleDeleteAttr(item.key)"
|
|
|
+ @click="handleSelectWard(item)"
|
|
|
+ :value="item.key"
|
|
|
+ >{{ item.label }}</Tag
|
|
|
+ >
|
|
|
+ </Row>
|
|
|
+ </Card>
|
|
|
+ </Col>
|
|
|
+ <Col :span="1" />
|
|
|
+ <Col :span="17">
|
|
|
+ <Card title="病区信息" style="height: 680px">
|
|
|
+ <template #extra
|
|
|
+ ><Button size="small" v-auth="['sys:wardInfo:add']" @click="handleAddInfo"
|
|
|
+ >+</Button
|
|
|
+ ></template
|
|
|
+ >
|
|
|
+ <BasicTable @register="registerTable">
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.key === 'disable'">
|
|
|
+ <Tag :color="formatDictColor(disableOptions, record.disable)">
|
|
|
+ {{ formatDictValue(disableOptions, record.disable) }}
|
|
|
+ </Tag>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'action'">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ auth: 'sys:wardInfo:status',
|
|
|
+ icon: 'icon-minus-square|iconfont',
|
|
|
+ tooltip: '停用',
|
|
|
+ label: '',
|
|
|
+ color: 'error',
|
|
|
+ ifShow: record.disable == 0,
|
|
|
+ popConfirm: {
|
|
|
+ title: '是否确认停用',
|
|
|
+ placement: 'left',
|
|
|
+ confirm: handleChangeState.bind(null, record),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ auth: 'sys:wardInfo:status',
|
|
|
+ icon: 'icon-plus|iconfont',
|
|
|
+ tooltip: '启用',
|
|
|
+ label: '',
|
|
|
+ ifShow: record.disable == 1,
|
|
|
+ color: 'error',
|
|
|
+ popConfirm: {
|
|
|
+ title: '是否确认启用',
|
|
|
+ placement: 'left',
|
|
|
+ confirm: handleChangeState.bind(null, record),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ auth: 'sys:wardInfo:edit',
|
|
|
+ icon: 'icon-edit|iconfont',
|
|
|
+ tooltip: '编辑',
|
|
|
+ label: '',
|
|
|
+ onClick: handleEdit.bind(null, record),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </Card>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </p>
|
|
|
+ <p :key="1" v-else> 班次设置 </p>
|
|
|
+ </Card>
|
|
|
+ </PageWrapper>
|
|
|
+ <WardTypeFormModal @register="registerWardTypeModal" @success="handleWardTypeSuccess" />
|
|
|
+ <WardInfoFormModal @register="registerWardInfoModal" @success="handleWardInfoSuccess" />
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+ import { onBeforeMount, ref } from 'vue';
|
|
|
+ import { PageWrapper } from '/@/components/Page';
|
|
|
+ import { Button, Card, Row, Col, Tag } from 'ant-design-vue';
|
|
|
+ import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
|
+ import { wardInfoColumns } from './data';
|
|
|
+ import WardTypeFormModal from './wardTypeFormModal.vue';
|
|
|
+ import WardInfoFormModal from './wardInfoFormModal.vue';
|
|
|
+ import { getWardInfo, changeStatus } from '/@/api/biz/management/wardInfo';
|
|
|
+ import { getAttrList, deleteWardType } from '/@/api/biz/management/wardType';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import { listDictModel } from '/@/api/common';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { formatDictColor, formatDictValue } from '/@/utils';
|
|
|
+ const { createConfirm, createMessage } = useMessage();
|
|
|
+ const tabList = ref([
|
|
|
+ { key: 0, tab: '病区管理', type: 'WARD' },
|
|
|
+ { key: 1, tab: '工作日班次', type: 'WORK' },
|
|
|
+ ]);
|
|
|
+ const activeKey = ref(0);
|
|
|
+ const attributePositiveList = ref([]); // 阳性列表
|
|
|
+ const attributeFeminineList = ref([]); // 阴性列表
|
|
|
+ const disableOptions = ref();
|
|
|
+ onBeforeMount(async () => {
|
|
|
+ disableOptions.value = await listDictModel({ dictCode: 'sys_disable_type' });
|
|
|
+ await getWardType();
|
|
|
+ });
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ api: getWardInfo,
|
|
|
+ rowKey: 'id',
|
|
|
+ columns: wardInfoColumns,
|
|
|
+ showIndexColumn: 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,
|
|
|
+ bordered: true,
|
|
|
+ actionColumn: {
|
|
|
+ width: 320,
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ },
|
|
|
+ beforeFetch: handleBeforeFetch,
|
|
|
+ sortFn: handleSortFn,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [registerWardTypeModal, { openModal: openWardTypeModal }] = useModal();
|
|
|
+ const [registerWardInfoModal, { openModal: openWardInfoModal }] = useModal();
|
|
|
+ const tableSort = ref([
|
|
|
+ {
|
|
|
+ field: 'sort',
|
|
|
+ direction: 'ASC',
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ const selectType = ref();
|
|
|
+
|
|
|
+ // 方法区
|
|
|
+ // 获取病区信息前事件
|
|
|
+ function handleBeforeFetch(params) {
|
|
|
+ return { ...params, propertiesId: selectType.value, orders: tableSort.value };
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleSortFn() {}
|
|
|
+ // 打开新增属性方法
|
|
|
+ function handleAddAttr() {
|
|
|
+ openWardTypeModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 打开删除属性方法
|
|
|
+ async function handleDeleteAttr(id) {
|
|
|
+ createConfirm({
|
|
|
+ content: '你确定要删除?',
|
|
|
+ iconType: 'warning',
|
|
|
+ onOk: async () => {
|
|
|
+ await deleteWardType([id]);
|
|
|
+ createMessage.success('属性删除成功!');
|
|
|
+ await getWardType();
|
|
|
+ },
|
|
|
+ onCancel: async () => {
|
|
|
+ attributePositiveList.value = [];
|
|
|
+ attributeFeminineList.value = [];
|
|
|
+ await getWardType();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //打开新增病区信息方法
|
|
|
+ function handleAddInfo() {
|
|
|
+ openWardInfoModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 打开编辑病区信息方法
|
|
|
+ function handleEdit(record: Recordable) {
|
|
|
+ openWardInfoModal(true, {
|
|
|
+ record,
|
|
|
+ isUpdate: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 停用启用病区方法
|
|
|
+ async function handleChangeState(record) {
|
|
|
+ const notes = record.disable == 0 ? '停用' : '启用';
|
|
|
+ createConfirm({
|
|
|
+ content: '是否确定要' + notes + '此病区',
|
|
|
+ iconType: 'warning',
|
|
|
+ onOk: async () => {
|
|
|
+ await changeStatus(record.id);
|
|
|
+ createMessage.success('病区' + notes + '成功!');
|
|
|
+ reload();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存成功回调事件
|
|
|
+ async function handleWardTypeSuccess() {
|
|
|
+ await getWardType();
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleWardInfoSuccess() {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+
|
|
|
+ async function getWardType() {
|
|
|
+ const attrList = await getAttrList();
|
|
|
+ attributePositiveList.value = []; // 阳性列表
|
|
|
+ attributeFeminineList.value = [];
|
|
|
+ attrList.forEach(item => {
|
|
|
+ if (item.positive) {
|
|
|
+ attributePositiveList.value.push({ label: item.name, key: item.id });
|
|
|
+ } else {
|
|
|
+ attributeFeminineList.value.push({ label: item.name, key: item.id });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 通过病区属性搜索病区信息
|
|
|
+ function handleSelectWard(e) {
|
|
|
+ selectType.value = e.key;
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+ ::v-deep(.ant-card-head) {
|
|
|
+ background-color: #f6f8fa !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .type-title {
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #000a18;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attrs {
|
|
|
+ background: #fff !important;
|
|
|
+ height: 32px !important;
|
|
|
+ line-height: 32px !important;
|
|
|
+ font-weight: 400 !important;
|
|
|
+ color: #17233d !important;
|
|
|
+ font-size: 14px !important;
|
|
|
+ border-radius: 4px !important;
|
|
|
+ border: 1px solid #c2ccd4 !important;
|
|
|
+ }
|
|
|
+</style>
|
|
|
+
|
|
|
+function $forceUpdate() { throw new Error('Function not implemented.'); }
|