1.0.30 • Published 4 years ago

sp-common-data v1.0.30

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

通用数据管理说明

  • 使用流程:

    • 新建表字段模型
    • 新建表对应字典数据
    • 设置表字段关联关系
    • 新建表字段对应前端组件类型
    • 新建表对应数据模板
    • 设置表对应组件及前端显示配置
    • 调取对应通用数据模型方法
    • 前端展示
  • 获取字典列表或者字典树
    • 方法名:_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
        }
    • 说明:获取详情的同时会翻译字典关联模型。

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

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.22

4 years ago

1.0.23

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago