单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-09-15 3e8f5d89e44c5f467b94d49f40b0ee3d307c89c3
src/views/mobile/bedsideAuxiliaryScreen/components/StartDialysis/index.vue
@@ -39,40 +39,221 @@
</template>
<script lang="ts">
import { reactive, toRefs } from "vue";
import { computed, reactive, toRefs } from "vue";
import closeImg from "@/img/close.png";
import { addDefaultRowApi } from '@/api/patient_hemo_med_start/index';
import type { StartRecord } from '@/api/patient_hemo_med_start/types/index.type';
import { addDefaultRowApi } from "@/api/patient_hemo_med_start/index";
import type { StartRecord } from "@/api/patient_hemo_med_start/types/index.type";
import { useBedsideAuxiliaryScreenStore } from "@/store/bedsideAuxiliaryScreen";
import { getInventoryItemListApi } from "@/api/inventory/itemDict";
import { getUsersByRoleCodeApi } from "@/api/user/index";
import { getDictTypeApi } from "@/api/dict/index";
import { DictType } from "@/api/dict/types/index.type";
interface FormData extends Omit<StartRecord, 'startCcType' | 'startCcASideDirection'> {
interface FormData
  extends Omit<StartRecord, "startCcType" | "startCcASideDirection"> {
  /** 穿刺方式 */
  startCcType: string[];
  /** 穿刺方向 */
  startCcASideDirection: string[];
}
interface State {
  loading: boolean;
  show: boolean;
  formData: FormData | {};
  doneUseNsyOptions: any[];
  doneUseHlbOptions: any[];
  disposablePipelineOptions: any[];
  hemofiltrationTubeOptions: any[];
  nurseOptions: any[];
  punctureMethodOptions: any[];
  typePunctureNeedleOptions: any[];
  punctureDirectionOptions: any[];
  punctureNeedleOptions: any[];
}
export default {
  name: "StartDialysis",
  setup() {
    const bedsideAuxiliaryScreenStore = useBedsideAuxiliaryScreenStore();
    const state = reactive<State>({
      loading: false,
      show: false,
      formData: {}
      formData: {},
      doneUseNsyOptions: [], // 透析浓缩液列表
      doneUseHlbOptions: [], // 透析护理包列表
      disposablePipelineOptions: [], // 一次性使用管路列表
      hemofiltrationTubeOptions: [], // 血滤管列表
      nurseOptions: [], // 护士列表
      punctureMethodOptions: [], // 穿刺方式列表
      typePunctureNeedleOptions: [], // 穿刺针类型列表
      punctureDirectionOptions: [], // 穿刺方向列表
      punctureNeedleOptions: [], // 穿刺针列表
    });
    const openDialog = () => {
    const recordCode = computed(() => {
      return bedsideAuxiliaryScreenStore.deviceData.signedIn.透析单编号;
    });
    const clientCode = computed(() => {
      return bedsideAuxiliaryScreenStore.deviceData.客户编号;
    });
    const openDialog = async () => {
      state.show = true;
      state.loading = true;
      try {
        const promiseFuns = [];
        if (state.doneUseNsyOptions.length <= 0) {
          promiseFuns.push(getDoneUseNsys());
        }
        if (state.doneUseHlbOptions.length <= 0) {
          promiseFuns.push(getdoneUseHlbs());
        }
        if (state.disposablePipelineOptions.length <= 0) {
          promiseFuns.push(getDisposablePipelines());
        }
        if (state.hemofiltrationTubeOptions.length <= 0) {
          promiseFuns.push(getHemofiltrationTubes());
        }
        if (state.punctureNeedleOptions.length <= 0) {
          promiseFuns.push(getPunctureNeedles());
        }
        if (state.nurseOptions.length <= 0) {
          promiseFuns.push(getNurses());
        }
        if (state.punctureMethodOptions.length <= 0) {
          promiseFuns.push(getPunctureMethods());
        }
        if (state.typePunctureNeedleOptions.length <= 0) {
          promiseFuns.push(getTypePunctureNeedles());
        }
        if (state.punctureDirectionOptions.length <= 0) {
          promiseFuns.push(getPunctureDirectionOptions());
        }
        await Promise.all(promiseFuns);
      } catch (error) {
        console.error("开始透析初始化失败", error);
        state.show = false;
      } finally {
        state.loading = false;
      }
    };
    const getStartData = async () => {
        const { data } = await addDefaultRowApi(`recordCode=`)
    /**
     * 获取开始透析默认数据
     */
    // const getStartData = async () => {
    //   const { data } = await addDefaultRowApi(`recordCode=${recordCode}`);
    // };
        
    /**
     * 获取透析浓缩液字典数据
     */
    const getDoneUseNsys = async () => {
      const params = {
        page: 0,
        size: 0,
        wherecondition: `inventory_type_code='IT2112291619002680' and is_show = 1 and client_code='${clientCode.value}'`,
        ordercondition: "item_is_use desc, item_sort_order asc",
        isPure: 0,
      };
      const { data } = await getInventoryItemListApi(params);
      state.doneUseNsyOptions = data.list;
    };
    /**
     * 获取透析护理包字典数据
     */
    const getdoneUseHlbs = async () => {
      const params = {
        page: 0,
        size: 0,
        wherecondition: `inventory_type_code='IT2112291619003161' and is_show = 1 and client_code='${clientCode.value}'`,
        ordercondition: "item_is_use desc, item_sort_order asc",
        isPure: 0,
      };
      const { data } = await getInventoryItemListApi(params);
      state.doneUseHlbOptions = data.list;
    };
    /**
     * 获取一次性使用管路字典数据
     */
    const getDisposablePipelines = async () => {
      const params = {
        page: 0,
        size: 0,
        wherecondition: `inventory_type_code='IT2112291619006054' and is_show = 1 and client_code='${clientCode.value}'`,
        ordercondition: "item_is_use desc, item_sort_order asc",
        isPure: 0,
      };
      const { data } = await getInventoryItemListApi(params);
      state.disposablePipelineOptions = data.list;
    };
    /**
     * 获取血滤管字典数据
     */
    const getHemofiltrationTubes = async () => {
      const params = {
        page: 1,
        size: 10,
        wherecondition: `inventory_type_code='IT9024215920713quQV' and is_show = 1 and client_code='${clientCode.value}'`,
        ordercondition: "item_is_use desc, item_sort_order asc",
        isPure: 0,
      };
      const { data } = await getInventoryItemListApi(params);
      state.hemofiltrationTubeOptions = data.list;
    };
    /**
     * 获取穿刺针字典数据
     */
    const getPunctureNeedles = async () => {
      const params = {
        page: 1,
        size: 10,
        wherecondition: `inventory_type_code='IT3561011130526051' and is_show = 1 and client_code='${clientCode.value}'`,
        ordercondition: "item_is_use desc, item_sort_order asc",
        isPure: 0,
      };
      const { data } = await getInventoryItemListApi(params);
      state.punctureNeedleOptions = data.list;
    };
    /**
     * 获取护士数据
     */
    const getNurses = async () => {
      const { data } = await getUsersByRoleCodeApi(
        `clientCode=${clientCode.value}&roleClass=nurse`
      );
      state.nurseOptions = data;
    };
    /**
     * 获取穿刺方式字典数据
     */
    const getPunctureMethods = async () => {
      const { data } = await getDictTypeApi({ dictType: DictType.穿刺方式 });
      state.punctureMethodOptions = data;
    };
    /**
     * 获取穿刺针类型字典数据
     */
    const getTypePunctureNeedles = async () => {
      const { data } = await getDictTypeApi({ dictType: DictType.穿刺针类型 });
      state.typePunctureNeedleOptions = data;
    };
    /**
     * 获取穿刺针方向字典数据
     */
    const getPunctureDirectionOptions = async () => {
      const { data } = await getDictTypeApi({ dictType: DictType.穿刺方向 });
      state.punctureDirectionOptions = data;
    };
    const handleCancel = () => {