首页 > 其他分享 >ssts-hospital-web-master项目实战记录二十六:项目迁移-Hook实现(useDataStore)

ssts-hospital-web-master项目实战记录二十六:项目迁移-Hook实现(useDataStore)

时间:2024-02-27 23:55:05浏览次数:19  
标签:设置 web string ssts hospital state DICT key dict

记录时间:2024-02-27

一、useDataStore模块实现

store/useDataStore.ts

import { defineStore } from 'pinia' import {   DICT_PAGE,   DICT_COMMON,   DICT_DEVICE,   DICT_SYSTEM,   DICT_STATIC,   DICT_NULL,   DICT_CONFIG,   DICT_OUT } from '@/const'
export const useDataStore = defineStore('data', {   state: () => ({     dict: {       // 版本信息       version: '',       // 版本数据       versionData: {},
      // 终端信息       terminalIp: '',       operatorId: '',       terminal: {},       deviceList: [],
      // 流程信息       flowKey: '',       flow: {},       linkFlowKey: '',       linkFlowPage: '',       businessTrace: '',       tradeId: '',
      // 参数信息       page: {},       common: {},       device: {},       system: {},       staticValue: {},       nullValue: {},       config: {},       out: {},
      // 页面信息       msg: '',       error: '',       voice: '',
      // 凭条信息       receiptList: [],
      // 前台管理信息       manage: {}     },
    // 加载和标志位     DataDictPageLoadFlag: false,     FrontManageFlag: false,     BankSignInFlag: false,     NetOnlineFlag: false,
    // 页面目录     BasePageDir: null,     BizPageDir: null,
    // 医保签到标志     YBSignNo: null,     YBSignDate: null,
    // 打印机纸张索引列表     ReceiptPrinterPaperIndexList: [0],     LabelPrinterPaperIndexList: [0],     DocumentPrinterPaperIndexList: [0, 1]   }),   actions: {     // 设置版本信息     setVersion(version: string) {       this.dict.version = version     },
    // 设置版本数据     setVersionData(key: string, value: any) {       if (key && this.dict.versionData) {         this.dict.versionData[key] = value       }     },
    // 设置终端Ip     setTerminalIp(terminalIp: string) {       this.dict.terminalIp = terminalIp     },
    // 设置操作员     setOperatorId(operatorId: string) {       this.dict.operatorId = operatorId     },
    // 设置终端信息     setTerminal(terminal: any) {       this.dict.terminal = terminal     },
    // 设置设备列表     setDeviceList(deviceList: any) {       this.dict.deviceList = deviceList     },
    // 设置流程键     setFlowKey(flowKey: string) {       this.dict.flowKey = flowKey     },
    // 设置流程信息     setFlow(flow: any) {       this.dict.flow = flow     },
    // 设置链接流程键     setLinkFlowKey(linkFlowKey: string) {       this.dict.linkFlowKey = linkFlowKey     },
    // 设置链接流程页     setLinkFlowPage(linkFlowPage: any) {       this.dict.linkFlowPage = linkFlowPage     },
    // 设置业务流程     setBusinessTrace(businessTrace: any) {       this.dict.businessTrace = businessTrace     },
    // 设置交易ID     setTradeId(tradeId: string) {       this.dict.tradeId = tradeId     },
    // 设置参数信息     syncData(dictType: string, key: string, value: any) {       const dictMap = {         [DICT_PAGE]: this.dict.page,         [DICT_COMMON]: this.dict.common,         [DICT_DEVICE]: this.dict.device,         [DICT_SYSTEM]: this.dict.system,         [DICT_STATIC]: this.dict.staticValue,         [DICT_NULL]: this.dict.nullValue,         [DICT_CONFIG]: this.dict.config,         [DICT_OUT]: this.dict.out       }
      if (key && dictMap[dictType]) {         dictMap[dictType][key] = value       } else {         console.warn(`Unknown dictType: ${dictType} or invalid key: ${key}`)       }     },
    // 设置消息信息     setMsg(msg: string) {       this.dict.msg = msg     },
    // 设置错误信息     setError(error: string) {       this.dict.error = error     },
    // 设置错误信息(未定义流程)     setErrorUndefinedFlow(flowKey: string) {       this.dict.error = `流程[${flowKey}]未定义。`     },
    // 设置错误信息(未定义流水)     setErrorUndefinedTrace(adapterTrace: string) {       this.dict.error = `交易流水[${adapterTrace}]未定义。`     },
    // 设置语音信息     setVoice(voice: string) {       this.dict.voice = voice     },
    // 设置凭条信息     setReceiptList(receiptList: any) {       this.dict.receiptList = receiptList     },
    // 设置前台管理信息     setManage(key: string, value: any) {       if (key && this.dict.manage) {         this.dict.manage[key] = value       }     }   },   getters: {     // 获取版本信息     getVersion: (state) => state.dict.version,     // 获取版本数据     getversionData: (state) => state.dict.versionData,     // 获取终端Ip     getTerminalIp: (state) => state.dict.terminalIp,     // 获取操作员     getOperatorId: (state) => state.dict.operatorId,     // 获取终端信息     getTerminal: (state) => state.dict.terminal,     // 获取设备列表     getDeviceList: (state) => state.dict.deviceList,     // 获取流程键     getFlowKey: (state) => state.dict.flowKey,     // 获取流程信息     getFlow: (state) => state.dict.flow,     // 获取链接流程键     getLinkFlowKey: (state) => state.dict.linkFlowKey,     // 获取链接流程页     getLinkFlowPage: (state) => state.dict.linkFlowPage,     // 获取业务流程     getBusinessTrace: (state) => state.dict.businessTrace,     // 获取交易ID     getTradeId: (state) => state.dict.tradeId,     // 获取参数信息     getPage: (state) => state.dict.page,     getCommon: (state) => state.dict.common,     getDevice: (state) => state.dict.device,     getSystem: (state) => state.dict.system,     getStatic: (state) => state.dict.staticValue,     getNull: (state) => state.dict.nullValue,     getConfig: (state) => state.dict.config,     getOut: (state) => state.dict.out,     // 获取消息信息     getMsg: (state) => state.dict.msg,     // 获取错误信息     getError: (state) => state.dict.error,     // 获取语音信息     getVoice: (state) => state.dict.voice,     // 获取凭条信息     getReceiptList: (state) => state.dict.receiptList,     // 获取前台管理信息     getManage: (state) => state.dict.manage   } })

 

二、调用示例

test-page-use-data-store.vue <script setup lang="ts"> import { DICT_SYSTEM } from '@/const' import { useDataStore } from '@/store/useDataStore'
const dataStore = useDataStore() dataStore.setVersion('1.0.0') dataStore.syncData(DICT_SYSTEM, 'test', '123')
</script>
<template>   <div>     <p>       <button @click="dataStore.setVersion('1.0.0')">setVersion('1.0.0')</button>       <button @click="dataStore.setVersion('2.0.0')">setVersion('2.0.0')</button>     </p>     <p>version: {{ dataStore.getVersion }}</p>     <p>system: {{ dataStore.getSystem }}</p>   </div> </template>
<style scoped></style>

 

三、运行测试

 

 

翻译

搜索

复制

<iframe></iframe>

标签:设置,web,string,ssts,hospital,state,DICT,key,dict
From: https://www.cnblogs.com/lizhigang/p/18038799

相关文章

  • 从sql注入到web安全
    一、事情起因去年底的时候我看到几个国内开源框架又出来SQL注入,联想起HVV时候的各种OA、ERP的SQL注入。我觉得SQL注入这个事情是该有人管管了。二、Mybatis的一点回顾https://github.com/mybatis/mybatis-3/issues/1941如上,我在2020年开始就一直在和官方讨论${}的风险问题,官......
  • 手写web框架
    重新认识HTTPhttp请求报文包含三个部分(请求行+请求头+请求体)请求行请求行包含三个内容:method+request-URI+http-version--例如GET/icwork/?Search=productHTTP/1.1请求方法请求方法作用get通过请求URI获得资源post用于添加新的资源,用于......
  • CTFHUB-web-信息泄露-目录遍历
    开启靶场http://challenge-a4aa9ff53d890618.sandbox.ctfhub.com:10800/查看此处源代码,没有发现有用信息点击开始寻找flag挨个点几个目录寻找flag在目录1/2下发现了flag提交一手,直接成功。可以参考此链接(纯小白,无教程思路有限)https://www.cnblogs.com/quail2333/p/12......
  • CTFHUB-web-信息泄露-PHPINFO
    开启题目访问只有这一个页面,看一下flag在没在页面里信息发现:https://www.cnblogs.com/Cl0ud/p/15999347.html系统版本信息配置文件位置allow_url_fopen&allow_url_include文件包含必看选项之一,如果allow_url_fopen和allow_url_include都为On的时候,则文件包含函数......
  • 纯手撸web框架
    纯手撸web框架(1)纯手撸#encoding:utf8#author:heart#blog_url:https://www.cnblogs.com/ssrheart/#time:2024/2/26importsocketserver=socket.socket()server.bind(('127.0.0.1',8080))server.listen(5)whileTrue:conn,addr=server.a......
  • 【soap】idea生成WebServices接口
    目录1.创建接口2.生成wsdl文件3.在soapUI中,生成6个文件4.将生成的文件拷贝到工程中5.在service-config中注册服务1.创建接口新建一个webServices工程,按照接口规范生成接口、请求类、响应类。注意:(请求响应的实体中添加基本属性及get/set方法、满参构造、空参构造)//此接口与下方......
  • ssts-hospital-web-master项目实战记录二十六:项目迁移-Hook实现(usCountdown)
    记录时间:2024-02-27记录时间:2024-02-26一、useCountdown模块实现hooks/useCountdown.tsimport{ref,onUnmounted}from'vue'exportfunctionuseCountdown(initialSeconds:number){ constcounter=ref(initialSeconds) letinterval:ReturnType<typeof......
  • 【内容管理及平台建设】上海道宁为您提供全媒体信息管理平台——WebFuture
     在数字化、智能化的浪潮下我们的生活和工作方式正在经历前所未有的变革  动易软件是综合性软件平台更是一种全新的生活和工作方式为客户提供互联网内容管理移动互联网内容管理全媒体内容管理的平台建设及技术服务  PART01:开发商......
  • PC端web通过自定义协议唤起应用
    写注册表调用WindowsRegistryEditorVersion5.00[HKEY_CURRENT_USER\Software\Classes\test]@="URL:TestProtocol"[HKEY_CURRENT_USER\Software\Classes\test\shell][HKEY_CURRENT_USER\Software\Classes\test\shell\open][HKEY_CURRENT_USER\......
  • C#程序全局异常处理—WPF和Web API两种模式
    C#程序的全局异常处理,网上搜下资料都是一大堆,我这里最近也是独立做一个B/S结构的小项目,后面又增加了需求用WPF实现相同的功能,这里将我所使用的全局异常处理方式做一个简短的总结分享。WebAPI项目的全局异常处理这种项目下,我们可以直接自定义一个全局异常的过滤器,用来处理全局......