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-poney

v1.0.43

Published

sp-poney

Downloads

3

Readme

通用数据管理说明
  • 使用流程:
    • 新建表字段模型
    • 新建表对应字典数据
    • 设置表字段关联关系
    • 新建表字段对应前端组件类型
    • 新建表对应数据模板
    • 设置表对应组件及前端显示配置
    • 调取对应通用数据模型方法
    • 前端展示
获取字典列表或者字典树
  • 方法名:_getDic(options = {})
  • 请求方式:POST
  • 参数
    • {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 = {})
  • 请求方式:POST
  • 参数
    • {Object} options 配置项
    • {String} options.url = /api_data/form/data/transfer 接口地址
    • {Number} options.tableId 关联表ID
    • {Number} options.columnValue 关联表主键值
    • {Array} options.searchColumnName 查询关联字段
  • 例如:
      _getColumnsValue({
        columnValue: '03ea8b5c34',
        tableId: 24,
        searchColumnName: 'name'
      })
  • 返回的主要形式:
    {
      data: "张三"
    }
通用模板生成
  • 方法名:_getDataAddModule(options = {})
  • 请求方式:POST
  • 参数
    • {Object} options
    • {String} options.moduleCode 数据模板编码
    • {String} options.moduleUrl = /api_data/form/data/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,
        "isPrimaryKey": true,
        "length": null,
        "orderNum": 1780,
        "value": null,
        // 关联模式
        "unionInfo": {
          "unionKeyType": "none",
          "mainUnionColumn": null,
          "mainTableId": null,
          "fkTablename": null
        }
      }]
  • 说明:模板生成的同时也会生成字典数据,字典数据存在于项对象objDic属性中。
通用模板获取并按主键、搜索字段、显示字段分组(一般用于列表页)
  • 方法名:_getSearchItem(options = {})
  • 请求方式:POST
  • 参数
    • {Object} options
    • {String} options.moduleCode 数据模板编码
    • {String} options.moduleUrl = /api_data/form/data/generate/ 模板接口地址
    • {String} options.dicUrl = /api_data/sys/dictItem/list 字典接口地址
  • 例如:
      _getDataAddModule({
        moduleCode: 'M_LIST'
      })
  • 返回的主要形式:
    {
      currentPrimary,
      dataSearchFilter,
      dataShowColumns
    }
  • 说明:模板生成的同时也会生成字典数据,字典数据存在于项对象objDic属性中。
获取通用数据列表
  • 方法名:_getDataList(options = {})
  • 请求方式:POST
  • 参数
    • {Object} options
    • {String} options.moduleCode 数据模板编码
    • {Array} options.condition 搜索条件
    • {Number} options.pageSize 页大小
    • {Number} options.pageNum 页码
    • {Array} options.columns 列表字段集合
    • {String} options.listUrl = /api_data/form/data/list 列表接口地址
    • {Boolean} options.isPager = true 是否分页
  • 例如:
      _getDataList({
        moduleCode: 'M_LIST',
        pageSize: 10,
        pageNum: 1,
        columns:"通用模板生成返回的数组",
        condition:[
          {
              field: `columnName`,
              matchType: 'CT',
              tableName: `tableName`,
              value: `value`
          }
        ],
        isPager: false
      })
  • matchType说明:
    • EQ:等于
    • CT:包含
    • ST:以...开始
    • ED:以...结束
    • IN:在...之间
    • NE:不等于
    • GT:大于
    • GE:大于等于
    • LT:小于
    • LE:小于等于
    • CR:圆(仅限于地理坐标系,value格式lng,lat@radius,radius单位为千米)
    • PL:矩形(仅限于地理坐标系,value格式lng,lat@lng,lat,分别为左下角和右上角经纬度坐标)
  • 返回的主要形式:
      [
        {
          name: "张三",
          age: 18
        },
        {
          name: "张三",
          age: 18
        }
      ]
获取通用数据详情
  • 方法名:_getDataDetail(options = {})
  • 请求方式:POST
  • 参数
    • {Object} options
    • {String} options.moduleCode 数据模板编码
    • {Object} options.condition 搜索条件
    • {String} options.moduleUrl = /api_data/form/data/generate/ 模板接口地址
    • {String} options.dicUrl = /api_data/sys/dictItem/list 字典接口地址
  • 例如:
      _getDataDetail({
        moduleCode: 'M_DETAIL',
        condition:{
          "表名.列名": "查询的值"
        },
      })
  • 返回的主要形式:
      {
        name: "张三",
        age: 18
      }
  • 说明:获取详情的同时会翻译字典关联模型。
通用数据新增
- 方法名:_addData(options = {})
- 请求方式:POST
- 参数
  * {Object} options 
  * {Array}  options.data                                       数据
  * {String} options.url = /api_data/form/data/add              接口地址
- 例如:
  ``` js
    _addData({
      moduleCode: 'M_DETAIL',
      data:[
              {
                "tableName": "tableName1",
                "data": [
                  { "columnName": "number", "value": "2020122914" },
                  { "columnName": "name", "value": "网络安全法" },
                  { "columnName": "type", "value": "1" },
                  { "columnName": "issued_time", "value": "2020-12-29" },
                  { "columnName": "issued_by", "value": "国务院" }
                ]
              },
              {
                "tableName": "tableName2",
                "data": [
                  { "columnName": "number", "value": "2020122914" },
                  { "columnName": "name", "value": "网络安全法" },
                  { "columnName": "type", "value": "1" },
                  { "columnName": "issued_time", "value": "2020-12-29" },
                  { "columnName": "issued_by", "value": "国务院" }
                ]
              }
            ]
    })
  ```
- data说明:
  - 提交的`data`按`数据表`分组,可用`_groupByTable`分组。
通用数据删除
- 方法名:_delData(options = {})
- 请求方式:POST
- 参数
  * {Object} options
  * {Object} options.condition                                       删除条件
  * {String} options.url = /api_data/form/data/delete                接口地址
- 例如:
    _delData({
      data:{
        "conditions":{
          "tableName.columnName":"value"
          }
        }
    })
通用数据修改
- 方法名:_updateData(options = {})
- 请求方式:POST
- 参数
  * {Object} options 
  * {Array}  options.data                                       数据
  * {String} options.url = /api_data/form/data/update           接口地址
- 例如:
  ``` js
    _updateData({
      data:[
            {
              "condition":[
                  {
                    "tableName":"knowledge_law",
                    "columnName":"id",
                    "value":"a6fbbec300e04784995604144120074d"
                  }
                ],
              "data":[
                  {"columnName":"number","value":"10100"},
                  {"columnName":"name","value":"测试"},
                  {"columnName":"type","value":"5"}
              ],
              "tableName":"knowledge_law"
            }
          ]
    })
  ```
- data说明:
  - 提交的`data`按`数据表`分组,可用`_generateUpdateData`分组。