npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mzzt-common

v1.0.9

Published

中台公共组件

Readme

mzzt-common

中台公共组件

用法见文档

import { divCodePro,getDivTextPro } from "mzzt-common";
// 获取字典数据  
 const applicableArea:any = ref([])
 divCodePro('REGION_AREA_STA_C').then((res:any)=>{
   applicableArea.value = res
 })
// 取值
getDivTextPro('REGION_AREA_STA_C','a9cddb6e35e04462ad11a66a2dbbf922').then(res=>{
  console.log('值输出',res)
})
//取值替换
const arr = [
  {
    item:'code',
    code:'a9cddb6e35e04462ad11a66a2dbbf922',
    name:''
  },
  {
    item:'code2',
    code:'a9cddb6e35e04462ad11a66a2dbbf922',
    name:''
  }
]
async function change(obj:any){
  for (let index = 0; index < obj.length; index++) {
    const element = obj[index];
    element.name = await getDivTextPro('REGION_AREA_STA_C',element.code)
  }
  return obj
}
change(arr).then(res=>{
  console.log(res)
})
//多字典取值方法 mzzt-common 1.0.5后支持
import { useDict } from "mzzt-common";
const {dicts,translateDictValue} = useDict(['DATA_SAFETY_LEVEL','DATA_CHECK_FAIL_TYPE'])
//注意
dicts为响应式ref变量,JS文档中translateDictValue函数取值请确保dicts已加载完成数据,否则建议使用getDivTextPro异步取值。
//html中使用
<div>{{ dicts['DATA_SAFETY_LEVEL'] }}</div>
<div>{{ translateDictValue('DATA_SAFETY_LEVEL','A') }}

生僻字

//由于不同环境服务地址不同,请确保互联网门户里添加
# 门户 服务门户
VITE_APP_APP_NAME = 'fwmh'
//显示
import { spzShow } from "mzzt-common";
//生僻字加载后调用此方法,传入容器名
//如果生僻字有动态更改,可用watch监听数据变化后调用此方法
spzShow(['#spzName'])

//输入
//
import Spz from 'mzzt-common/ui/SpzTs.vue';

<!-- spzid 输入框ID -->
<a-input
  class="spz"
  id="dds"
  v-model:value="ruleForm2.name"
  allowClear
  style="width: 100%"
  placeholder="请输入姓名"
/>
<Spz @spzdata="spzdata" spzid="dds" />

<!-- 返回事件回调 -->
const spzdata = (data: any) => {
  ruleForm2.name = data
}

鉴权

分别提供权限代码、角色代码、组织机构代码校验的JS方法
checkPermission(... authCode){
  #未开户鉴权时,直接返回true
  #校验当前登陆用户的权限代码集里是否包括authCode
}
checkRole(... roleCode){
  #未开户鉴权时,直接返回true
  #校验当用登陆用户的角色代码集里是否包括roleCode
}
checkOrgan(... organCode){
  #未开户鉴权时,直接返回true
  #校验当前合建用户的所在的工作机构代码是否为指定的organCode
}
前端VUE页面import鉴权JS组件, 在控件中增加鉴权属性: v-if="checkPermission(<操作对应的权限代码,或角色代码>)"
v-if="checkPermission(['JCXX0002_ADD'])"

获取用户信息

执行getUserInfo()返回用户信息