UNPKG

lj-publish-test3

Version:

A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features

263 lines (193 loc) 7.82 kB
基础配置: 1、buttonConf(操作栏配置) 已删除, 1、searchConf(搜索栏配置),使用baseOptionConf 已删除, 3、columnConf(显示列配置),使用baseOptionConf 4、baseOptionConf(添加,修改项配置) 5、menuConf(左侧菜单配置) 数据表: 1、test(测试表) 表:baseOptionConf modelType:模块类别 prop:字段属性名称 label:显示名称 ord:排序码 insert:1添加显示,0不显示 update:1添加显示,0不显示 search:1添加显示,0不显示 table:1添加显示,0不显示 formType input类型:1、text,2、file,3、radio,4、checkbox,5、select等 defaultValues:默认显示数据(下拉框,其他) verification:验证格式(非空,长度,正则,等验证) 接口 分页查询: {"table":"test","attrs":{},"page_num":"10","curpage":"1"} 地址:http://192.168.1.236:3000/getdocument 类型:post 参数:{"table":"test","attrs":{ "address": "上海"},"page_num":"10","curpage":"1"} 返回:{ "result": "ok", "count": 2, "data": [ { "_id": "5cb467053649193d265fd81a", "water": "0.1", "switchStatus": "男", "equipmentId": "FG348388", "leakingAlarm": "1", "name": "账号", "address": "上海" }, { "_id": "5cb53632b2449444b2d0502a", "water": "0.1", "switchStatus": "online", "equipmentId": "JH46345", "leakingAlarm": "false", "name": "账号2", "address": "上海" } ] } 新增 地址:http://192.168.1.236:3000/document 类型:post 参数:{"table":"test","attrs":{ "water": "0.1", "switchStatus": "online", "equipmentId": "JH46345", "leakingAlarm": "false", "name": "账号2", "address": "上海" }} 返回:{ "result": "ok", "data": { "n": 1, "ok": 1 } } 修改一条记录 地址:http://192.168.1.236:3000/modifydocument 类型:post 参数:{"table":"test","updates":{"address":"北京"},"attrs":{"_id": "5cb467053649193d265fd81a"}} 返回:{ "result": "ok", "data": { "n": 1, "nModified": 1, "ok": 1 } } mongo in条件查询,修改 {"table":"test","updates":{ "name":"3" },"attrs":{"_id":{"$in":["5cb467053649193d265fd81a","5cb683df706684544db12253"]}},"not_token":true,"dbname":"test"} 多条记录修改 multi_modifier {table:"m_kid_t",dbname:"lora",not_token:true,attrs:{_id:{$in:[]}},updates:{$set:{class_id:"",classname0:this.classname,teacher1_0:this.dialogMsg.teacher}}} 修改多条记录 地址:http://192.168.1.236:3000/modifymultidocument 类型:post 参数:{"table":"test","updates":{"switchStatus":"2"},"attrs":{"address": "上海"}} 返回:{ "result": "ok", "data": { "n": 2, "nModified": 2, "ok": 1 } } 修改多条记录 地址:http://192.168.1.236:3000/dodocument 类型:post 参数:{"table":"test","attrs":{"_id": "5cb81b68763f4eb14ac25621"}} 返回:{ "result": "ok", "data": { "n": 1, "ok": 1 } } 3 插入多条数据 curl -l -H "Content-type: application/json" -X POST -d '{"table":"test","attrs":[ {"water":"0.2","switchStatus":"online","equipmentId":"898602B11915A0035696","leakingAlarm":"false"} ]}' http://127.0.0.1:3000/multidocument { "result": "ok", "status": 1, "data": { "count": 0, "data": [], "msg": "增加成功" } } 1.左侧菜单添加功能按钮2.右侧添加新菜单制作的新组建 插入一个数组 地址:http://192.168.1.236:3000/modifier 类型:post 参数:{"table":"test","updates":{$push:{"addresses":{"name":"dfdsf"}}},"attrs":{"_id": "5cb467053649193d265fd81a"}} 删除 $pull 修改 {"table":"test","updates":{$set:{"addresses.name":"newcontent","addresses.age":"newage"}},"attrs":{"_id": "5cb467053649193d265fd81a","children.path":"/system"}} 添加{"table":"menuConf","updates":{"$push":{"children":{"name":"dfdsf"}}},"attrs":{"_id": "5d26ef6df3e8f701da21e46e"},"dbname": "test", "not_token": true} 删除{"table":"menuConf","updates":{"$pull":{"children":{"name":"set测试1"}}},"attrs":{"_id": "5d26ef6df3e8f701da21e46e"},"dbname": "test", "not_token": true} 修改{"table":"menuConf","updates":{"$set":{"children.$.name":"set测试1"}},"attrs":{"_id": "5d26ef6df3e8f701da21e46e","children.path":"/dfg"},"dbname": "test", "not_token": true} 修改{"table":"menuConf","updates":{"$set":{"children.$.name":"set测试1"}},"attrs":{"_id": "5d26ef6df3e8f701da21e46e","children":{"name":"set测试"},"dbname": "test", "not_token": true} 返回:{ "result": "ok", "data": { "n": 1, "nModified": 1, "ok": 1 } } 修改数组里面符合条件的某一项, 比如{_id:1111,'a':1,'attr':[{id:1,path:"aaa"},{id:2,path:"bbb"}]} 要改id:2的path为888 修改{"table":"menuConf","updates":{"$set":{"attr.$[element].path":888}},options: { arrayFilters: [ { 'element.id':2 } ]},"attrs":{"_id":1111,"attr":{"id":2},"dbname": "test", "not_token": true} 修改多条记录: 地址:multi_modifier 类型:post 参数:同modifier 删除多个记录 地址 delmultidocument modifier 多级 // 3级 // db.getCollection('test').updateOne({_id:ObjectId("5f8509eb56bda4625423379c")} // ,{$push:{"children.$[element].children":{k:1}}} // ,{arrayFilters:[{'element.path':'/ssss'}]}) // 4级 // db.getCollection('test').updateOne({_id:ObjectId("5f8509eb56bda4625423379c")} // ,{$push:{"children.$[element0].children.$[element].children":{k:1}}} // ,{arrayFilters:[{'element0.children':{$exists:true}},{'element.path':'/ssss'}]}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$pull:{"children":{path:'/a'}}}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$pull:{"children.$[element].children":{d:1}}} ,{arrayFilters:[{'element.path':'/a'}]}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$pull:{"children.$[].children.$[element].children":{path:''}}} ,{arrayFilters:[{'element.path':'/b'}]}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$pull:{"children.$[].children.$[element].children":{path:1}}} ,{arrayFilters:[{'element.children.path':''}]}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$set:{"children.$[element].children":'labels'}} ,{arrayFilters:[{'element.path':'/a'}]}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$set:{"children.$[element].labels":'labels'}} ,{arrayFilters:[{'element.path':'/a'}]}) db.getCollection('test').updateOne({_id:ObjectId("5cf603466433c53a19263ee6")} ,{$set:{"children.$[].children.$[element].path":'path',"children.$[].children.$[element].label":'b_label'}} ,{arrayFilters:[{'element.children.path':'/b'}]}) agg_filter1 多级获取 "aggreg_attrs": [ {"$match":{"_id":"5f8509eb56bda4625423379c"}}, {"$unwind":"$children"}, {"$project":{"children":"$children.children"}}, {"$unwind":"$children"}, {"$project":{"children":"$children.children"}}, {"$unwind":"$children"}, {"$project":{"children":"$children.children"}}, {"$unwind":"$children"}, {"$project":{"children.children":0}}, {"$match":{"children.path":"/b5"}} ],