fan 2 лет назад
Родитель
Сommit
ee07805b86

+ 2 - 1
src/components/Form/src/BasicForm.vue

@@ -409,7 +409,8 @@
       color: #000a18;
     }
 
-    .ant-radio-wrapper {
+    .ant-radio-wrapper,
+    .ant-checkbox-wrapper {
       margin: 0 24px 0 0;
       color: #818694;
 

+ 0 - 104
src/components/XTUpload/src/FileList.vue

@@ -1,104 +0,0 @@
-<script lang="tsx">
-  import { defineComponent, CSSProperties, watch, nextTick } from 'vue';
-  import { fileListProps } from './props';
-  import { isFunction } from '/@/utils/is';
-  import { useModalContext } from '/@/components/Modal/src/hooks/useModalContext';
-
-  export default defineComponent({
-    name: 'FileList',
-    props: fileListProps,
-    setup(props) {
-      const modalFn = useModalContext();
-      watch(
-        () => props.dataSource,
-        () => {
-          nextTick(() => {
-            modalFn?.redoModalHeight?.();
-          });
-        },
-      );
-      return () => {
-        const { columns, actionColumn, dataSource } = props;
-        const columnList = [...columns, actionColumn];
-        return (
-          <table class="file-table">
-            <colgroup>
-              {columnList.map(item => {
-                const { width = 0, dataIndex } = item;
-                const style: CSSProperties = {
-                  width: `${width}px`,
-                  minWidth: `${width}px`,
-                };
-                return <col style={width ? style : {}} key={dataIndex} />;
-              })}
-            </colgroup>
-            <thead>
-              <tr class="file-table-tr">
-                {columnList.map(item => {
-                  const { title = '', align = 'center', dataIndex } = item;
-                  return (
-                    <th class={['file-table-th', align]} key={dataIndex}>
-                      {title}
-                    </th>
-                  );
-                })}
-              </tr>
-            </thead>
-            <tbody>
-              {dataSource.map((record = {}, index) => {
-                return (
-                  <tr class="file-table-tr" key={`${index + record.name || ''}`}>
-                    {columnList.map(item => {
-                      const { dataIndex = '', customRender, align = 'center' } = item;
-                      const render = customRender && isFunction(customRender);
-                      return (
-                        <td class={['file-table-td', align]} key={dataIndex}>
-                          {render
-                            ? customRender?.({ text: record[dataIndex], record })
-                            : record[dataIndex]}
-                        </td>
-                      );
-                    })}
-                  </tr>
-                );
-              })}
-            </tbody>
-          </table>
-        );
-      };
-    },
-  });
-</script>
-<style lang="less">
-  .file-table {
-    width: 100%;
-    border-collapse: collapse;
-
-    .center {
-      text-align: center;
-    }
-
-    .left {
-      text-align: left;
-    }
-
-    .right {
-      text-align: right;
-    }
-
-    &-th,
-    &-td {
-      padding: 12px 8px;
-    }
-
-    thead {
-      background-color: @background-color-light;
-    }
-
-    table,
-    td,
-    th {
-      border: 1px solid @border-color-base;
-    }
-  }
-</style>

+ 17 - 14
src/components/XTUpload/src/XTUpload.vue

@@ -59,8 +59,6 @@
           />
         </div>
         <div class="flex">
-          <!-- <span class="mr-2">30%</span> -->
-          <!-- <a :href="item.absolutePath" target="_blank" class="mr-2">预览</a> -->
           <span class="upload-filelist--error" v-if="item.status == 'error'">上传失败</span>
           <span class="upload-filelist--color" @click="handleRemove(item, 0)">删除</span>
         </div>
@@ -83,12 +81,12 @@
   // utils
   import { isFunction, isArray } from '/@/utils/is';
   import { warn } from '/@/utils/log';
-  // import FileList from './FileList.vue';
   import { nanoid } from 'nanoid';
   import locales from '/@/utils/locales';
   // import { getPreviewUrl, postFileRemoveByIds } from '/@/api/common';
   import { getPreviewUrl } from '/@/api/common';
   import UploadPreviewModal from './UploadPreviewModal.vue';
+  import { ResultEnum } from '@/enums/httpEnum';
 
   export default defineComponent({
     name: 'XTUpload',
@@ -98,7 +96,6 @@
       Upload,
       Alert,
       UploadPreviewModal,
-      // FileList,
     },
     props: {
       ...uploadContainerProps,
@@ -227,24 +224,26 @@
               item.percent = complete;
             },
           );
-          item.status = UploadResultStatus.SUCCESS;
+          item.status =
+            data.code == ResultEnum.SUCCESS ? UploadResultStatus.SUCCESS : UploadResultStatus.ERROR;
           item.responseData = data;
-          console.log(
-            '🚀 ~ file: XTUpload.vue:191 ~ handleStartUpload ~ fileListRef.value:',
-            fileListRef.value,
-          );
           fileListRef.value.forEach(ele => {
-            const responseData = ele.responseData;
-            if (responseData.code == '00000') {
+            const responseData = ele.responseData as any;
+            if (responseData.code == ResultEnum.SUCCESS) {
               fileList.value.push(responseData.data);
+            } else {
+              createMessage.error(responseData.errorMsg);
             }
           });
           fileListRef.value = fileListRef.value.filter(ele => {
-            return ele.status != UploadResultStatus.SUCCESS;
+            return (
+              ele.status != UploadResultStatus.SUCCESS ||
+              String(ele.responseData?.code) != ResultEnum.SUCCESS
+            );
           });
           return {
-            success: true,
-            error: null,
+            success: data.code == ResultEnum.SUCCESS ? true : false,
+            error: data.code == ResultEnum.SUCCESS ? null : data.errorMsg,
           };
         } catch (e) {
           console.log(e);
@@ -325,6 +324,10 @@
       &__text {
         height: 32px;
         width: 100%;
+        flex: 1;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
       }
     }
 

+ 5 - 1
src/utils/http/axios/checkStatus.ts

@@ -11,7 +11,11 @@ const { createMessage, createErrorModal } = useMessage();
 const error = createMessage.error!;
 const stp = projectSetting.sessionTimeoutProcessing;
 
-export function checkStatus(status: number, msg: string, errorMessageMode: ErrorMessageMode = 'message'): void {
+export function checkStatus(
+  status: number,
+  msg: string,
+  errorMessageMode: ErrorMessageMode = 'message',
+): void {
   const userStore = useUserStoreWithOut();
   let errMessage = '';
 

+ 5 - 6
src/views/biz/archives/diagnosisHistory/FormModal.vue

@@ -583,12 +583,11 @@
   }
   // 回调
   async function callEditChange({ record }) {
-    console.log('🚀 ~ file: FormModal.vue:638 ~ callEditChange ~ record:', record);
-    console.log(
-      '🚀 ~ file: FormModal.vue:648 ~ callEditChange ~ tableRecordType.value:',
-      tableRecordType.value,
-    );
-
+    // console.log('🚀 ~ file: FormModal.vue:638 ~ callEditChange ~ record:', record);
+    // console.log(
+    //   '🚀 ~ file: FormModal.vue:648 ~ callEditChange ~ tableRecordType.value:',
+    //   tableRecordType.value,
+    // );
     if (
       record.type == DiagnosisEnum.complications_field ||
       record.type == DiagnosisEnum.clinic_field ||

+ 1 - 1
src/views/biz/archives/medicalDocuments/FormModal.vue

@@ -76,7 +76,7 @@
         ...values,
         id: rowId.value,
       });
-      values.fileIds = values.files.map(ele => ele.id);
+      values.fileIds = values.files && values.files.map(ele => ele.id);
       console.log('🚀 ~ file: FormModal.vue:71 ~ handleSubmit ~ values:', {
         ...values,
         id: rowId.value,

+ 1 - 1
src/views/biz/archives/medicalDocuments/data.ts

@@ -51,7 +51,7 @@ export const dataFormSchema: FormSchema[] = [
       api: uploadApi,
       maxSize: 20,
       maxNumber: 10,
-      helpText: '支持上传图片/pdf/docx/ppt/xlsx文件,文件大小不超过20M',
+      helpText: '文件大小不超过20M',
       accept: ['image/*', '.pdf', '.doc', '.docx', '.ppt', '.pptx', '.xls', '.xlsx'],
     },
     colProps: {

+ 23 - 6
src/views/biz/archives/medicalDocuments/index.vue

@@ -26,10 +26,19 @@
             v-model:current="page.current"
             :total="page.total"
             :pageSize="page.size"
+            :hideOnSinglePage="true"
             @change="handlePageChange"
           />
         </div>
-        <iframe :id="fileIds[page.current - 1]" class="doc-iframe" :src="previewUrl" />
+        <iframe
+          v-if="fileIds.length && previewUrl"
+          :id="fileIds[page.current - 1]"
+          class="doc-iframe"
+          :src="previewUrl"
+        />
+        <div class="doc-cnt doc-cnt--empty" v-else>
+          <a-empty />
+        </div>
       </div>
     </div>
     <FormModal @register="registerModal" @success="callSuccess" />
@@ -80,7 +89,6 @@
   const previewUrl = ref('');
   async function getData() {
     const res = await archivesMedicalDocumentsQueryList(props.info?.id);
-    console.log('🚀 ~ file: index.vue:105 ~ getData ~ res:', res);
     listData.value = res.map(ele => {
       const obj = {
         id: ele.id,
@@ -97,7 +105,9 @@
       selected.value = listData.value[0]['id'];
       page.total = listData.value[0]['attachment'] || 0;
       fileIds.value = listData.value[0]['fileIds'];
-      await handlePreview(fileIds.value[0]);
+      if (fileIds.value.length) {
+        await handlePreview(fileIds.value[0]);
+      }
       isFirstLoad.value = false;
     }
   }
@@ -115,8 +125,16 @@
   }
   // 预览文件地址
   async function handlePreview(id) {
-    const res = await getPreviewUrl(id);
-    previewUrl.value = res;
+    if (id == undefined) {
+      previewUrl.value = '';
+      return;
+    }
+    try {
+      const res = await getPreviewUrl(id);
+      previewUrl.value = res || '';
+    } catch (error) {
+      previewUrl.value = '';
+    }
   }
   // 回调
   async function callItemClick(data) {
@@ -134,7 +152,6 @@
     });
   }
   async function callDelete(data) {
-    console.log('🚀 ~ file: index.vue:131 ~ data:', data);
     createConfirm({
       content: '你确定要删除?',
       iconType: 'warning',

+ 2 - 0
src/views/biz/bed/memo/FormModal.vue

@@ -63,7 +63,9 @@
   async function handleSubmit() {
     try {
       const values = await validate();
+      console.log('🚀 ~ file: FormModal.vue:66 ~ handleSubmit ~ values:', values);
       setModalProps({ confirmLoading: true });
+      values.appointmentSailingsSort = values.appointmentSailingsSort.sort();
       !unref(isUpdate)
         ? await bedScheduledMemoAdd({ ...values })
         : await bedScheduledMemoEdit({ ...values, id: rowId.value });

+ 20 - 16
src/views/biz/bed/memo/data.ts

@@ -1,7 +1,7 @@
 import dayjs from 'dayjs';
 import { BasicColumn, FormSchema } from '/@/components/Table';
 import { archivesPatientBasicQueryPage } from '@/api/biz/archives/patientBasicApi';
-
+import { getSailings } from '/@/api/biz/management/working';
 export const columns: BasicColumn[] = [
   {
     title: '填写日期',
@@ -85,22 +85,26 @@ export const dataFormSchema: FormSchema[] = [
     label: '预约班次',
     field: 'appointmentSailingsSort',
     required: true,
-    component: 'CheckboxGroup',
+    component: 'ApiCheckboxGroup',
     componentProps: {
-      options: [
-        {
-          label: '第一班',
-          value: '1',
-        },
-        {
-          label: '第二班',
-          value: '2',
-        },
-        {
-          label: '第三班',
-          value: '3',
-        },
-      ],
+      api: getSailings,
+      resultField: 'infos',
+      valueField: 'sort',
+      labelField: 'name',
+      // options: [
+      //   {
+      //     label: '第一班',
+      //     value: '1',
+      //   },
+      //   {
+      //     label: '第二班',
+      //     value: '2',
+      //   },
+      //   {
+      //     label: '第三班',
+      //     value: '3',
+      //   },
+      // ],
     },
   },
   {

+ 42 - 14
src/views/biz/bed/person/FormModal.vue

@@ -16,13 +16,15 @@
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, useForm } from '/@/components/Form';
   import { useMessage } from '/@/hooks/web/useMessage';
-  import { dataFormSchema } from './data';
+  import { BasicWeekEnum, dataFormSchema } from './data';
 
   import {
     bedScheduledPersonAdd,
     bedScheduledPersonEdit,
     bedScheduledPersonDetail,
   } from '/@/api/biz/bed/scheduledPersonApi';
+  import { getWorkingDay } from '/@/api/biz/management/working';
+
   import dayjs from 'dayjs';
 
   const emit = defineEmits(['success', 'register']);
@@ -31,9 +33,10 @@
   const width = '45%';
   const isUpdate = ref(false);
   const rowId = ref();
+  const specialNeedWeekOption = ref([]);
 
   const { createMessage } = useMessage();
-  const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
+  const [registerForm, { setFieldsValue, resetFields, validate, updateSchema }] = useForm({
     labelWidth: 100,
     schemas: dataFormSchema,
     showActionButtonGroup: false,
@@ -52,26 +55,35 @@
     if (unref(isUpdate)) {
       const resData = await bedScheduledPersonDetail(data.record.id);
       console.log('🚀 ~ file: FormModal.vue:54 ~ resData:', resData);
-      rowId.value = resData.id;
+      rowId.value = resData.patientBasicId;
+      const workingDay = await getWorkingDay();
+      let specialNeedWeek = [];
+      // const specialNeedWeekOption = [];
+      for (const i in workingDay) {
+        if (workingDay[i]) {
+          specialNeedWeek = specialNeedWeek.concat(i);
+        }
+        specialNeedWeekOption.value.push({
+          label: BasicWeekEnum[i],
+          value: i,
+        });
+      }
       const fieldsData = Object.assign(resData, {
         frequency: {
           input: 1,
           dictValue: resData.frequency?.week == 1 ? 'week_1' : 'week_2',
         },
+        specialNeedWeek,
       });
       console.log('🚀 ~ file: FormModal.vue:62 ~ fieldsData:', fieldsData);
+      await updateSchema({
+        field: 'specialNeedWeek',
+        componentProps: {
+          options: specialNeedWeekOption.value,
+        },
+      });
       await setFieldsValue({
         ...fieldsData,
-        // ...resData,
-        // machine: ['pump_single'],
-        // patientUniqueNo: resData.patientUniqueNo,
-        // archivesCreateTime: resData.archivesCreateTime,
-        // patientType: resData.patientType,
-        // special: resData.special,
-        // frequency: {
-        //   input: 1,
-        //   dictValue: resData.frequency?.week == 1 ? 'week_1' : 'week_2',
-        // },
       });
     } else {
       await setFieldsValue({
@@ -84,10 +96,26 @@
   async function handleSubmit() {
     try {
       const values = await validate();
+      values.frequency = {
+        week: values.frequency.dictValue,
+        times: values.frequency.input,
+      };
+      values.specialNeed = {};
+      specialNeedWeekOption.value.forEach(ele => {
+        if (values.specialNeedWeek.includes(ele.value)) {
+          values.specialNeed[ele.value] = true;
+        } else {
+          values.specialNeed[ele.value] = false;
+        }
+      });
+      values.specialNeed['sailingSorts'] = values.sailingSorts.sort();
+      delete values.specialNeedWeek;
+      delete values.sailingSorts;
+      console.log('🚀 ~ file: FormModal.vue:98 ~ handleSubmit ~ values:', values);
       setModalProps({ confirmLoading: true });
       !unref(isUpdate)
         ? await bedScheduledPersonAdd({ ...values })
-        : await bedScheduledPersonEdit({ ...values, id: rowId.value });
+        : await bedScheduledPersonEdit({ ...values, patientBasicId: rowId.value });
       !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
       closeModal();
       emit('success', {

+ 39 - 29
src/views/biz/bed/person/data.ts

@@ -1,5 +1,6 @@
 import { BasicColumn, FormSchema } from '/@/components/Table';
 import { listDictModel } from '@/api/common';
+import { getSailings } from '/@/api/biz/management/working';
 
 // export const BasicWeek = [
 //   {
@@ -204,20 +205,25 @@ export const dataFormSchema: FormSchema[] = [
     required: true,
     component: 'CheckboxGroup',
     componentProps: {
-      options: [
-        {
-          label: '第一班',
-          value: '1',
-        },
-        {
-          label: '第二班',
-          value: '2',
-        },
-        {
-          label: '第三班',
-          value: '3',
-        },
-      ],
+      options: [],
+      // api: getSailings,
+      // resultField: 'infos',
+      // valueField: 'sort',
+      // labelField: 'name',
+      // options: [
+      //   {
+      //     label: '第一班',
+      //     value: '1',
+      //   },
+      //   {
+      //     label: '第二班',
+      //     value: '2',
+      //   },
+      //   {
+      //     label: '第三班',
+      //     value: '3',
+      //   },
+      // ],
     },
     show: ({ values }) => {
       return values.special == 1;
@@ -230,22 +236,26 @@ export const dataFormSchema: FormSchema[] = [
     label: '期望班次',
     field: 'sailingSorts',
     required: true,
-    component: 'CheckboxGroup',
+    component: 'ApiCheckboxGroup',
     componentProps: {
-      options: [
-        {
-          label: '第一班',
-          value: '1',
-        },
-        {
-          label: '第二班',
-          value: '2',
-        },
-        {
-          label: '第三班',
-          value: '3',
-        },
-      ],
+      api: getSailings,
+      resultField: 'infos',
+      valueField: 'sort',
+      labelField: 'name',
+      // options: [
+      //   {
+      //     label: '第一班',
+      //     value: '1',
+      //   },
+      //   {
+      //     label: '第二班',
+      //     value: '2',
+      //   },
+      //   {
+      //     label: '第三班',
+      //     value: '3',
+      //   },
+      // ],
     },
     show: ({ values }) => {
       return values.special == 1;