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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sp-common-data

v1.0.30

Published

sp-common-data

Downloads

3

Readme

通用数据管理说明

  • 使用流程:

    • 新建表字段模型
    • 新建表对应字典数据
    • 设置表字段关联关系
    • 新建表字段对应前端组件类型
    • 新建表对应数据模板
    • 设置表对应组件及前端显示配置
    • 调取对应通用数据模型方法
    • 前端展示
  • 获取字典列表或者字典树
    • 方法名:_getDic(options = {})
    • 参数
      • {Object} options
      • {String} options.code 字典编码
      • {String} options.url = /api_data/sys/dictItem/list 接口地址
    • 例如:
        _getDic({
          code: 'sylx'
        })
    • 返回的主要形式:
      {
        data:[
          {
            "itemText":"一级",
            "itemValue":"1"
          },
          {
            "itemText":"二级",
            "itemValue":"2"
          }
        ]
      }
    • 说明:请求对应字典后会将字典存储在localStorage,本项目在启动时会检测部署版本号,版本号不一致则清楚本地localStorage数据。
  • 获取通用值关联
    • 方法名:_getColumnsValue(options = {})
    • 参数
      • {Object} options 配置项
      • {String} options.url = /api_data/sys/common/transfer 接口地址
      • {Number} options.tableId 关联表ID
      • {Number} options.columnValue 关联表主键值
      • {Array} options.searchColumnName 查询关联字段
    • 例如:
        _getColumnsValue({
          columnValue: '03ea8b5c34',
          tableId: 24,
          searchColumnName: 'name'
        })
    • 返回的主要形式:
      {
        data: "张三"
      }
  • 通用模板生成
    • 方法名:_getDataAddModule(options = {})
    • 参数
      • {Object} options
      • {String} options.moduleCode 数据模板编码
      • {String} options.moduleUrl = /api_data/sys/module/generate 模板接口地址
      • {String} options.dicUrl = /api_data/sys/dictItem/list 字典接口地址
    • 例如:
        _getDataAddModule({
          moduleCode: 'M_LIST'
        })
    • 返回的主要形式:
        [
          {
          "tableName": "mhjy_yagl_yajbxx",
          "componentType": "input",
          // 前端组件配置
          "objComponent": {
            "componentName": "文本框",
            "componentCode": "input",
            "prefix": "",
            "sufix": "",
            "regular": "dsd"
          },
          // 字段属性配置
          "defaultDefine": null,
          "frontComment": "主键ID",
          "frontName": "id",
          "columnName": "ID",
          "isEdit": false,
          "isRequired": true,
          "isSearch": false,
          "isShow": false,
          "primaryKey": true,
          "length": null,
          "orderNum": 1780,
          "value": null,
          // 关联模式
          "objFk": {
            "fkType": "none",
            "fkColumn": null,
            "fkTableId": null,
            "fkTablename": null
          }
        }]
    • 说明:模板生成的同时也会生成字典数据,字典数据存在于项对象objDic属性中。
  • 获取通用数据列表
    • 方法名:_getDataList(options = {})
    • 参数
      • {Object} options
      • {String} options.moduleCode 数据模板编码
      • {Object} options.condition 搜索条件
      • {Number} options.pageSize 页大小
      • {Number} options.pageNum 页码
      • {Array} options.columns 列表字段集合
      • {String} options.listUrl = /api_data/sys/module/data/pageList 列表接口地址
    • 例如:
        _getDataList({
          moduleCode: 'M_LIST',
          pageSize: 10,
          pageNum: 1,
          columns:"通用模板生成返回的数组",
          condition:{
            "表名.列名": "查询的值"
          },
        })
    • 返回的主要形式:
        [
          {
            name: "张三",
            age: 18
          },
          {
            name: "张三",
            age: 18
          }
        ]
  • 获取通用数据详情
    • 方法名:_getDataDetail(options = {})

    • 参数

      • {Object} options
      • {String} options.moduleCode 数据模板编码
      • {Object} options.condition 搜索条件
      • {String} options.moduleUrl = /api_data/sys/module/generate 模板接口地址
      • {String} options.dicUrl = /api_data/sys/dictItem/list 字典接口地址
    • 例如:

        _getDataDetail({
          moduleCode: 'M_DETAIL',
          condition:{
            "表名.列名": "查询的值"
          },
        })
    • 返回的主要形式:

        {
          name: "张三",
          age: 18
        }
    • 说明:获取详情的同时会翻译字典关联模型。

    • 通用数据新增
    • 通用数据删除
    • 通用数据修改