han 2 vuotta sitten
vanhempi
commit
2b304378eb

+ 23 - 10
src/views/biz/visit/check/data.ts

@@ -45,35 +45,36 @@ export const BasicTab = [
 ];
 export const BasicTabActive = BasicTab[0].key;
 
-export const columns: BasicColumn[] = [
+export const checkColumns: BasicColumn[] = [
   {
     title: '姓名',
     dataIndex: 'name',
-    width: 150,
-    align: 'left',
   },
   {
     title: '信息',
     dataIndex: 'gender',
-    width: 150,
-    align: 'left',
   },
   {
     title: '查房时间',
     dataIndex: 'patrolTime',
-    width: 200,
-    align: 'left',
   },
   {
     title: '最新查房内容',
     dataIndex: 'content',
-    align: 'left',
   },
   {
     title: '记录人',
     dataIndex: 'recorder',
-    width: 120,
-    align: 'left',
+  },
+];
+export const columns: BasicColumn[] = [
+  {
+    title: '查房时间',
+    dataIndex: 'patrolTime',
+  },
+  {
+    title: '查房内容',
+    dataIndex: 'content',
   },
 ];
 
@@ -96,6 +97,7 @@ export const dataFormSchema: FormSchema[] = [
       };
     },
   },
+
   {
     label: '记录',
     field: 'content',
@@ -118,3 +120,14 @@ export const viewSchema: DescItem[] = [
     field: 'content',
   },
 ];
+// 历史记录查看
+export const data: DescItem[] = [
+  {
+    label: '查房时间',
+    field: 'patrolTime',
+  },
+  {
+    label: '查房内容',
+    field: 'content',
+  },
+];

+ 14 - 13
src/views/biz/visit/check/formModal.vue

@@ -13,24 +13,21 @@
 </template>
 <script lang="ts" setup>
   import { ref, computed, unref } from 'vue';
-  import { BasicModal } from '/@/components/Modal';
-  import { useModalInner } from '/@/components/Modal';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, useForm } from '/@/components/Form';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { dataFormSchema } from './data';
 
-  import {
-    archivesPatrolWardAdd,
-    archivesPatrolWardEdit,
-    archivesPatrolWardDetail,
-  } from '/@/api/biz/visit/checkApi';
+  import { checkAdd, checkEdit, checkDetail } from '/@/api/biz/visit/checkApi';
+  import dayjs from 'dayjs';
 
   const emit = defineEmits(['success', 'register']);
 
   const getTitle = computed(() => (!unref(isUpdate) ? '新增查房' : '编辑查房'));
-  const width = '45%';
+  const width = '35%';
   const isUpdate = ref(false);
   const rowId = ref();
+  const patientBasicId = ref('');
 
   const { createMessage } = useMessage();
   const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
@@ -45,9 +42,12 @@
     await resetFields();
     setModalProps({ confirmLoading: false });
     isUpdate.value = !!data?.isUpdate;
-
+    patientBasicId.value = data.record?.patientBasicId;
+    await setFieldsValue({
+      patrolTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
+    });
     if (unref(isUpdate)) {
-      const resData = await archivesPatrolWardDetail(data.record.id);
+      const resData = await checkDetail(data.record.id);
       rowId.value = resData.id;
       await setFieldsValue({
         ...resData,
@@ -55,14 +55,15 @@
     }
   });
 
-  //提交按钮事件
+  // 提交按钮事件
   async function handleSubmit() {
     try {
       const values = await validate();
       setModalProps({ confirmLoading: true });
+      values.patientBasicId = patientBasicId.value;
       !unref(isUpdate)
-        ? await archivesPatrolWardAdd({ ...values })
-        : await archivesPatrolWardEdit({ ...values, id: rowId.value });
+        ? await checkAdd({ ...values })
+        : await checkEdit({ ...values, id: rowId.value });
       !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
       closeModal();
       emit('success', {

+ 112 - 42
src/views/biz/visit/check/index.vue

@@ -12,15 +12,24 @@
         />
         <XTForm :form-data="formData" @change="callFormChange" @click="callFormClick" />
       </div>
-      <div class="flex mb-2" v-if="siftData.length">
-        <Sift :data="siftData" @close="callClose" />
-      </div>
       <BasicTable @register="registerTable">
         <template #bodyCell="{ column, record }">
           <template v-if="column.key === 'name'">
             <span :class="['table-dot', 'table-dot--' + record.status]" />
             <span>{{ record.name }}</span>
           </template>
+          <template v-if="column.key === 'gender'">
+            <Icon
+              v-if="record.gender == 'pb_sex_man'"
+              icon="icon-xt-male_sm|iconfont"
+              color="#0057FF"
+            />
+            <Icon
+              v-if="record.gender == 'pb_sex_woman'"
+              icon="icon-xt-female_sm|iconfont"
+              color="#FF0066"
+            />({{ record.age }})</template
+          >
           <template v-if="column.key === 'patrolTime'">
             {{ record.patrolTime ? dayjs(record.patrolTime).format('YYYY-MM-DD') : '' }}
           </template>
@@ -29,35 +38,46 @@
             <TableAction
               :dropDownActions="[
                 {
-                  auth: 'storage:config:edit',
+                  auth: 'storage:config:query',
                   tooltip: '查房记录',
                   label: '查房记录',
-                  ifShow: !record.master,
+                  onClick: handleDetail.bind(null, record),
+                  // ifShow: !record.master,
                 },
                 {
-                  auth: 'storage:config:edit',
+                  auth: 'archives:patrolWard:edit',
                   tooltip: '编辑',
                   label: '编辑',
                   onClick: handleEdit.bind(null, record),
                 },
+                {
+                  auth: 'storage:config:remove',
+                  tooltip: '关注',
+                  label: '关注',
+                  color: 'error',
+                  popConfirm: {
+                    title: '是否确定要关注?',
+                    placement: 'left',
+                    confirm: handleCancel.bind(null, record),
+                  },
+                },
                 {
                   auth: 'storage:config:remove',
                   tooltip: '取消关注',
                   label: '取消关注',
                   color: 'error',
-                  // popConfirm: {
-                  //   title: '是否确定要取消关注?',
-                  //   placement: 'left',
-                  //   confirm: handleDelete.bind(null, record),
-                  // },
+                  popConfirm: {
+                    title: '是否确定要取消关注?',
+                    placement: 'left',
+                    confirm: handleCancel.bind(null, record),
+                  },
                 },
               ]"
               :actions="[
                 {
-                  auth: 'sys:log:query',
-                  // icon: 'icon-eye|iconfont',
+                  auth: 'archives:patrolWard:query',
+                  icon: 'icon-eye|iconfont',
                   tooltip: '查房',
-                  label: '查房',
                   onClick: handleView.bind(null, record),
                 },
               ]"
@@ -68,6 +88,7 @@
     </div>
     <FormModal @register="registerModal" @success="handleSuccess" />
     <ViewDrawer @register="registerDrawerView" @success="handleSuccess" />
+    <!-- <DatailModal @register="registerModalView" /> -->
   </div>
 </template>
 
@@ -75,16 +96,18 @@
   import { XTTitle } from '/@/components/XTTitle/index';
   import { XTTab } from '/@/components/XTTab/index';
   import { XTForm } from '/@/components/XTForm/index';
-  import { Sift } from '/@/components/XTList/index';
+  import { Icon } from '/@/components/Icon';
   import { BasicTable, useTable, TableAction } from '/@/components/TableCard';
-  import { BasicTab, BasicTabActive, columns } from './data';
+  import { BasicTab, BasicTabActive, checkColumns } from './data';
   import { ref } from 'vue';
-  // import { useRouter } from 'vue-router';
+  import { useRouter } from 'vue-router';
+
   import {
-    archivesPatrolWardQueryCheckRoomRecord,
-    archivesPatrolWardQueryPersonNumber,
+    checkQueryCheckRoomRecord,
+    checkQueryPersonNumber,
+    checkFollowOrNo,
   } from '/@/api/biz/visit/checkApi';
-  // import { formatDictColor, formatDictFontColor, formatDictValue } from '/@/utils';
+
   import { onMounted, reactive } from 'vue';
   import dayjs from 'dayjs';
   import { useModal } from '/@/components/Modal';
@@ -92,42 +115,44 @@
   import ViewDrawer from './viewDrawer.vue';
   import { useDrawer } from '@/components/Drawer';
 
-  // const bizDictOptions = reactive<any>({});
+  import { useMessage } from '/@/hooks/web/useMessage';
+
   //路由跳转
-  // const router = useRouter();
+
+  const router = useRouter();
   const activeKey = ref(BasicTabActive);
   const tabData = ref(BasicTab);
   const [registerModal, { openModal }] = useModal();
   const [registerDrawerView, { openDrawer, openDrawer: openDrawerView }] = useDrawer();
 
   onMounted(async () => {
-    const personNumber = await archivesPatrolWardQueryPersonNumber();
-    console.log('🚀 ~ file: index.vue:104 ~ onMounted ~ stats:', personNumber);
+    const stats = await checkQueryPersonNumber();
+    console.log('🚀 ~ file: index.vue:104 ~ onMounted ~ stats:', stats);
     tabData.value = tabData.value.map(ele => {
       if (ele.key == '0') {
-        ele.value = personNumber.all;
+        ele.value = stats.all;
       }
       if (ele.key == '1') {
-        ele.value = personNumber.dialysisPatients;
+        ele.value = stats.dialysisPatients;
       }
       if (ele.key == '2') {
-        ele.value = personNumber.noDialysisPatients;
+        ele.value = stats.noDialysisPatients;
       }
       if (ele.key == '3') {
-        ele.value = personNumber.newPatient;
+        ele.value = stats.newPatient;
       }
       if (ele.key == '4') {
-        ele.value = personNumber.attention;
+        ele.value = stats.attention;
       }
       return ele;
     });
     console.log('🚀 ~ file: index.vue:118 ~ onMounted ~ tabData.value:', tabData.value);
   });
   const [registerTable, { reload }] = useTable({
-    api: archivesPatrolWardQueryCheckRoomRecord,
+    api: checkQueryCheckRoomRecord,
     // exportAuthList: ['sys:log:export'],
     rowKey: 'id',
-    columns,
+    columns: checkColumns,
     showIndexColumn: true,
     bordered: true,
     actionColumn: {
@@ -138,6 +163,7 @@
     beforeFetch: handleBeforeFetch,
     afterFetch: handleAfterFetch,
   });
+
   // 筛选数据
   const siftData = ref([]);
 
@@ -185,6 +211,9 @@
   }
 
   function handleAfterFetch(data) {
+    // data.forEach(item => {
+    //   item.status = 2;
+    // });
     return data;
   }
 
@@ -196,6 +225,22 @@
     });
   }
 
+  //查房记录事件
+  function handleDetail(record: Recordable) {
+    router.push({
+      path: '../../bizArchives/detail',
+      query: {
+        id: record.id,
+        accessId: record.accessId,
+        name: record.name,
+        gender: record.gender,
+        age: record.age,
+      },
+    });
+  }
+
+  const { createMessage } = useMessage();
+
   // 编辑按钮事件
   function handleEdit(record: Recordable) {
     openModal(true, {
@@ -204,6 +249,15 @@
     });
   }
 
+  // 取消按钮事件
+  async function handleCancel(record) {
+    // clearSelectedRowKeys();
+    await checkFollowOrNo(record.id);
+    createMessage.success('操作成功!');
+    await reload();
+    // await getTab();
+  }
+
   // 弹窗回调事件
   async function handleSuccess({ isUpdate, values }) {
     console.log(isUpdate);
@@ -248,18 +302,34 @@
       });
     }
   }
+</script>
 
-  async function callClose(data) {
-    if (data.type == 'clear') {
-      console.log('清空全部');
-      siftData.value = [];
+<style lang="less" scoped>
+  .table-dot {
+    display: inline-block;
+    width: 10px;
+    height: 10px;
+    margin-right: 6px;
+    border-radius: 50%;
+
+    &hb--1 {
+      background-color: #1bc1b3;
     }
-    if (data.type == 'close') {
-      console.log('删除部分条件');
-      siftData.value = siftData.value.filter(ele => {
-        return ele.field != data.item?.field;
-      });
+
+    &--2 {
+      background-color: #d3d8dd;
+    }
+
+    &--3 {
+      background-color: #f7b500;
+    }
+
+    &--4 {
+      background-color: #3cf;
     }
-    await reload();
   }
-</script>
+
+  ::v-deep(.ant-btn-link) {
+    color: rgb(61 65 85 / 100%);
+  }
+</style>

+ 125 - 15
src/views/biz/visit/check/viewDrawer.vue

@@ -8,54 +8,112 @@
       :width="width"
     >
       <Description @register="registerDesc" :data="descData" />
-    </BasicDrawer>
+      <div>
+        <a-button type="primary" size="large" class="btn-add" @click="handleCreate">新增</a-button>
+      </div>
 
-    <Button
-      v-auth="['storage:config:add']"
-      type="primary"
-      @click="handleCreate"
-      preIcon="icon-plus|iconfont"
-    >
-      新增
-    </Button>
-    <FormModal @register="registerModal" @success="handleSuccess" />
+      <BasicTable @register="registerTable">
+        <template #bodyCell="{ column, record }">
+          <template v-if="column.key === 'action'">
+            <TableAction
+              :actions="[
+                {
+                  auth: 'archives:patrolWard:edit',
+                  icon: 'icon-edit|iconfont',
+                  // label: '编辑',
+                  onClick: handleEdit.bind(null, record),
+                },
+                {
+                  auth: 'visit:handoverShifts:edit',
+                  icon: 'icon-xt-details_delete_default|iconfont',
+                  tooltip: '删除',
+                  popConfirm: {
+                    title: '是否确认删除',
+                    placement: 'left',
+                    confirm: handleDelete.bind(null, record),
+                  },
+                },
+              ]"
+            />
+          </template>
+        </template>
+      </BasicTable>
+      <FormModal @register="registerModal" @success="handleSuccess" />
+    </BasicDrawer>
   </div>
 </template>
 <script lang="ts" setup>
-  import { onBeforeMount, ref } from 'vue'; // onBeforeMount,
+  import { onBeforeMount, ref, nextTick } from 'vue'; // onBeforeMount,
   import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
   import { Description, useDescription } from '/@/components/Description';
-  import { viewSchema } from './data';
+  import { viewSchema, columns } from './data';
 
-  import { archivesPatrolWardDetail } from '/@/api/biz/visit/checkApi';
+  import { checkDetail, checkRemove, checkQueryPage } from '/@/api/biz/visit/checkApi';
   import { listDictModel } from '/@/api/common';
+  import { useMessage } from '/@/hooks/web/useMessage';
   import FormModal from './formModal.vue';
+  import { BasicTable, useTable, TableAction } from '/@/components/TableCard';
   import { formatDictValue } from '/@/utils';
   import { useModal } from '/@/components/Modal';
 
   const descData = ref({});
+  const lists = ref([]);
   const getTitle = '查看查房记录';
+
   const width = '45%';
   const [registerModal, { openModal }] = useModal();
+  const { createMessage } = useMessage();
+  // const siftData = ref([]);
+  // const activeKey = ref();
+  const patientBasicId = ref();
 
   const typeOptions = ref();
   onBeforeMount(async () => {
     typeOptions.value = await listDictModel({ dictCode: 'sys_login_log_type' });
   });
   // 新增按钮事件
-  function handleCreate() {
+
+  function handleCreate(data) {
     openModal(true, {
       isUpdate: false,
+      record: data,
     });
   }
   const [registerDrawer] = useDrawerInner(async data => {
     console.log('::::::::::', data.record);
-    const resData = await archivesPatrolWardDetail(data.record.id);
+    const resData = await checkDetail(data.record.id);
+    patientBasicId.value = resData.patientBasicId;
     descData.value = {
       ...resData,
       type: formatDictValue(typeOptions.value, resData.type),
     };
+    const params = {
+      pageNum: 1,
+      pageSize: 999,
+      patientBasicId: resData.patientBasicId,
+    };
+    const list = await checkQueryPage(params);
+    console.log(list);
+    if (list && list.data) {
+      lists.value = list.data;
+    }
+    await nextTick();
+    await setTableData(lists.value);
+  });
+  const [registerTable, { reload, setTableData }] = useTable({
+    dataSource: lists.value,
+    rowKey: 'id',
+    columns,
+    showIndexColumn: false,
+    bordered: true,
+    actionColumn: {
+      width: 200,
+      title: '操作',
+      dataIndex: 'action',
+    },
+    afterFetch: handleAfterFetch,
   });
+
   const [registerDesc] = useDescription({
     schema: viewSchema,
     column: 1,
@@ -64,9 +122,61 @@
       width: '120px',
     },
   });
+
+  // 编辑按钮事件
+  function handleEdit(record: Recordable) {
+    openModal(true, {
+      record,
+      isUpdate: true,
+    });
+  }
+
+  // 删除按钮事件
+  // async function handleDelete(record: Recordable) {
+  //   if (record) {
+  //     await archivesPatrolWardRemove([record.id]);
+  //     createMessage.success('删除成功!');
+  //     clearSelectedRowKeys();
+  //     await reload();
+  //   } else {
+  //     createConfirm({
+  //       content: '你确定要删除?',
+  //       iconType: 'warning',
+  //       onOk: async () => {
+  //         const keys = getSelectRowKeys();
+  //         await archivesPatrolWardRemove(keys);
+  //         createMessage.success('删除成功!');
+  //         await reload();
+  //       },
+  //     });
+  //   }
+  // }
+  function handleAfterFetch(data) {
+    // data.forEach(item => {
+    //   item.status = 2;
+    // });
+    return data;
+  }
+  // 删除按钮事件
+  async function handleDelete(record: Recordable) {
+    console.log('🚀 ~ file: index.vue:141 ~ handleDelete ~ record', record);
+    await checkRemove([record.id]);
+    createMessage.success('删除成功!');
+    await reload();
+  }
+
   // 弹窗回调事件
   async function handleSuccess({ isUpdate, values }) {
     console.log(isUpdate);
     console.log(values);
   }
 </script>
+
+<style lang="less" scoped>
+  .btn-add {
+    margin: 2%;
+    float: right;
+    width: 100px;
+    border-radius: 4px;
+  }
+</style>