mirror of
https://github.com/steedos/steedos-platform
synced 2024-11-23 01:16:43 +00:00
引入内置表
This commit is contained in:
parent
113fee02fa
commit
ee51892063
@ -2,4 +2,4 @@ Creator.Apps.hr =
|
||||
url: "/creator/hr"
|
||||
name: "HR"
|
||||
icon: "ion-ios-people-outline"
|
||||
objects: ["flow_roles"]
|
||||
objects: ["organizations", "flow_roles"]
|
||||
|
@ -94,36 +94,7 @@ Creator.initApps = ()->
|
||||
|
||||
Creator.getObjectSchema = (obj) ->
|
||||
|
||||
baseFields =
|
||||
owner:
|
||||
type: "text",
|
||||
omit: true
|
||||
space:
|
||||
type: "text",
|
||||
omit: true
|
||||
created:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
created_by:
|
||||
type: "text",
|
||||
omit: true
|
||||
modified:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
modified_by:
|
||||
type: "text",
|
||||
omit: true
|
||||
last_activity:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
last_viewed:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
last_referenced:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
|
||||
_.extend(obj.fields, baseFields)
|
||||
_.extend(obj.fields, Creator.baseObject.fields)
|
||||
|
||||
schema = {}
|
||||
_.each obj.fields, (field, field_name)->
|
||||
@ -140,14 +111,17 @@ Creator.getObjectSchema = (obj) ->
|
||||
fs.type = "Date"
|
||||
else if field.type == "datetime"
|
||||
fs.type = "Date"
|
||||
else if field.type == "master_detail"
|
||||
else if field.type == "lookup" or field.type == "master_detail"
|
||||
fs.type = "String"
|
||||
if Meteor.isClient
|
||||
fs.autoform.type="universe-select"
|
||||
fs.autoform.optionsMethod="creator.object_options"
|
||||
fs.autoform.optionsMethodParams=
|
||||
reference_to: field.reference_to
|
||||
space: Session.get("spaceId")
|
||||
if field.reference_to == "users"
|
||||
fs.autoform.type = "selectuser"
|
||||
else
|
||||
fs.autoform.type="universe-select"
|
||||
fs.autoform.optionsMethod="creator.object_options"
|
||||
fs.autoform.optionsMethodParams=
|
||||
reference_to: field.reference_to
|
||||
space: Session.get("spaceId")
|
||||
else if field.type == "select"
|
||||
fs.type = "String"
|
||||
fs.autoform.type = "select2"
|
||||
|
29
creator/packages/steedos-creator/models/base.coffee
Normal file
29
creator/packages/steedos-creator/models/base.coffee
Normal file
@ -0,0 +1,29 @@
|
||||
Creator.baseObject =
|
||||
fields:
|
||||
owner:
|
||||
type: "lookup",
|
||||
reference_to: "users"
|
||||
space:
|
||||
type: "text",
|
||||
omit: true
|
||||
created:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
created_by:
|
||||
type: "text",
|
||||
omit: true
|
||||
modified:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
modified_by:
|
||||
type: "text",
|
||||
omit: true
|
||||
last_activity:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
last_viewed:
|
||||
type: "datetime",
|
||||
omit: true
|
||||
last_referenced:
|
||||
type: "datetime",
|
||||
omit: true
|
@ -1,61 +1,81 @@
|
||||
db.objects = new Mongo.Collection('objects');
|
||||
Creator.Objects.objects =
|
||||
name: "objects"
|
||||
label: "Objects"
|
||||
icon: "ion-ios-people-outline"
|
||||
fields:
|
||||
name:
|
||||
label: "Name"
|
||||
type: "text"
|
||||
description:
|
||||
label: "Name"
|
||||
type: "text"
|
||||
list_views:
|
||||
default:
|
||||
columns: ["name", "description", "modified"]
|
||||
permissions:
|
||||
default:
|
||||
allowCreate: false
|
||||
allowDelete: false
|
||||
allowEdit: false
|
||||
allowRead: true
|
||||
modifyAllRecords: false
|
||||
viewAllRecords: false
|
||||
# db.objects._simpleSchema = new SimpleSchema
|
||||
# name:
|
||||
# type: String
|
||||
# max: 50
|
||||
# code:
|
||||
# type: String
|
||||
# max: 50
|
||||
# description:
|
||||
# type: String
|
||||
# optional: true
|
||||
# max: 50
|
||||
# autoform:
|
||||
# rows: 2
|
||||
# schema:
|
||||
# type: String
|
||||
# optional: true
|
||||
# autoform:
|
||||
# rows: 10
|
||||
# created:
|
||||
# type: Date,
|
||||
# optional: true
|
||||
# autoform:
|
||||
# omit: true
|
||||
# created_by:
|
||||
# type: String,
|
||||
# optional: true
|
||||
# autoform:
|
||||
# omit: true
|
||||
# modified:
|
||||
# type: Date,
|
||||
# optional: true
|
||||
# autoform:
|
||||
# omit: true
|
||||
# modified_by:
|
||||
# type: String,
|
||||
# optional: true
|
||||
# autoform:
|
||||
# omit: true
|
||||
|
||||
db.objects._simpleSchema = new SimpleSchema
|
||||
name:
|
||||
type: String
|
||||
max: 50
|
||||
code:
|
||||
type: String
|
||||
max: 50
|
||||
description:
|
||||
type: String
|
||||
optional: true
|
||||
max: 50
|
||||
autoform:
|
||||
rows: 2
|
||||
schema:
|
||||
type: String
|
||||
optional: true
|
||||
autoform:
|
||||
rows: 10
|
||||
created:
|
||||
type: Date,
|
||||
optional: true
|
||||
autoform:
|
||||
omit: true
|
||||
created_by:
|
||||
type: String,
|
||||
optional: true
|
||||
autoform:
|
||||
omit: true
|
||||
modified:
|
||||
type: Date,
|
||||
optional: true
|
||||
autoform:
|
||||
omit: true
|
||||
modified_by:
|
||||
type: String,
|
||||
optional: true
|
||||
autoform:
|
||||
omit: true
|
||||
|
||||
db.objects.attachSchema(db.objects._simpleSchema);
|
||||
# db.objects.attachSchema(db.objects._simpleSchema);
|
||||
|
||||
|
||||
TabularTables["objects"] = new Tabular.Table
|
||||
name: "objects",
|
||||
collection: db.objects,
|
||||
columns: [
|
||||
{ data: "name" },
|
||||
{ data: "code" },
|
||||
{ data: "description" },
|
||||
{ data: "modified" }
|
||||
]
|
||||
dom: "tp"
|
||||
extraFields: ["_id", "space", "schema"]
|
||||
lengthChange: false
|
||||
ordering: false
|
||||
pageLength: 10
|
||||
info: false
|
||||
searching: true
|
||||
autoWidth: true
|
||||
# TabularTables["objects"] = new Tabular.Table
|
||||
# name: "objects",
|
||||
# collection: db.objects,
|
||||
# columns: [
|
||||
# { data: "name" },
|
||||
# { data: "code" },
|
||||
# { data: "description" },
|
||||
# { data: "modified" }
|
||||
# ]
|
||||
# dom: "tp"
|
||||
# extraFields: ["_id", "space", "schema"]
|
||||
# lengthChange: false
|
||||
# ordering: false
|
||||
# pageLength: 10
|
||||
# info: false
|
||||
# searching: true
|
||||
# autoWidth: true
|
||||
|
20
creator/packages/steedos-creator/models/organization.coffee
Normal file
20
creator/packages/steedos-creator/models/organization.coffee
Normal file
@ -0,0 +1,20 @@
|
||||
Creator.Objects.organizations =
|
||||
name: "organizations"
|
||||
label: "Organizations"
|
||||
icon: "ion-ios-people-outline"
|
||||
fields:
|
||||
name:
|
||||
label: "Name"
|
||||
type: "text"
|
||||
required: true
|
||||
list_views:
|
||||
default:
|
||||
columns: ["name", "modified"]
|
||||
permissions:
|
||||
default:
|
||||
allowCreate: true
|
||||
allowDelete: true
|
||||
allowEdit: true
|
||||
allowRead: true
|
||||
modifyAllRecords: false
|
||||
viewAllRecords: false
|
20
creator/packages/steedos-creator/models/user.coffee
Normal file
20
creator/packages/steedos-creator/models/user.coffee
Normal file
@ -0,0 +1,20 @@
|
||||
Creator.Objects.users =
|
||||
name: "users"
|
||||
label: "Users"
|
||||
icon: "ion-ios-people-outline"
|
||||
fields:
|
||||
name:
|
||||
label: "Name"
|
||||
type: "text"
|
||||
required: true
|
||||
list_views:
|
||||
default:
|
||||
columns: ["name", "username"]
|
||||
permissions:
|
||||
default:
|
||||
allowCreate: false
|
||||
allowDelete: false
|
||||
allowEdit: false
|
||||
allowRead: true
|
||||
modifyAllRecords: false
|
||||
viewAllRecords: false
|
@ -79,7 +79,12 @@ Package.onUse(function(api) {
|
||||
|
||||
api.addFiles('core.coffee');
|
||||
|
||||
api.addFiles('models/base.coffee');
|
||||
api.addFiles('models/object.coffee');
|
||||
|
||||
api.addFiles('models/organization.coffee');
|
||||
api.addFiles('models/user.coffee');
|
||||
api.addFiles('models/flow_role.coffee');
|
||||
|
||||
api.addFiles('server/methods/object_options.coffee', 'server');
|
||||
api.addFiles('server/publications/object.coffee', 'server');
|
||||
|
Loading…
Reference in New Issue
Block a user