egg-born-module-a-base-sync
Advanced tools
Comparing version 1.2.16 to 1.2.17
@@ -69,10 +69,10 @@ const require3 = require('require3'); | ||
// create | ||
async create({ atomClass, user }) { | ||
async create({ atomClass, item, user }) { | ||
// atomClass | ||
atomClass = await ctx.meta.atomClass.get(atomClass); | ||
// atom | ||
const atom = { }; | ||
// item | ||
item = item || { }; | ||
const atomId = await this._add({ | ||
atomClass, | ||
atom, | ||
atom: item, | ||
user, | ||
@@ -89,3 +89,3 @@ }); | ||
key: { atomId }, | ||
atom, | ||
item, | ||
user, | ||
@@ -97,3 +97,3 @@ }, | ||
// save itemId | ||
let atomName = atom.atomName; | ||
let atomName = item.atomName; | ||
if (!atomName) { | ||
@@ -104,3 +104,3 @@ // sequence | ||
} | ||
const atomFlow = atom.atomFlow === undefined ? atomClass.flow : atom.atomFlow; | ||
const atomFlow = item.atomFlow === undefined ? atomClass.flow : item.atomFlow; | ||
await this._update({ | ||
@@ -107,0 +107,0 @@ atom: { |
@@ -8,2 +8,3 @@ module.exports = app => { | ||
atomClass: this.ctx.request.body.atomClass, | ||
item: this.ctx.request.body.item, | ||
user: this.ctx.user.op, | ||
@@ -10,0 +11,0 @@ }); |
@@ -5,4 +5,4 @@ module.exports = app => { | ||
async create({ atomClass, user }) { | ||
return await this.ctx.meta.atom.create({ atomClass, user }); | ||
async create({ atomClass, item, user }) { | ||
return await this.ctx.meta.atom.create({ atomClass, item, user }); | ||
} | ||
@@ -9,0 +9,0 @@ |
@@ -7,3 +7,3 @@ export default { | ||
onAction({ ctx, action, item }) { | ||
if (action.menu === 1 && action.action === 'create') { | ||
if (action.name === 'create' || action.action === 'create') { | ||
// create | ||
@@ -16,11 +16,18 @@ return ctx.$api.post('/a/base/atom/create', { | ||
}, | ||
item, | ||
}).then(key => { | ||
ctx.$utils.extend(item, key); | ||
// event | ||
ctx.$meta.eventHub.$emit('atom:action', { key, action }); | ||
// write | ||
return ctx.$store.dispatch('a/base/getActions').then(actionsAll => { | ||
let actionWrite = actionsAll[item.module][item.atomClassName].write; | ||
actionWrite = ctx.$utils.extend({}, actionWrite); | ||
return ctx.$meta.util.performAction({ ctx, action: actionWrite, item }); | ||
}); | ||
// menu | ||
if (action.menu === 1) { | ||
item = ctx.$utils.extend({}, item, key); | ||
// write | ||
return ctx.$store.dispatch('a/base/getActions').then(actionsAll => { | ||
let actionWrite = actionsAll[item.module][item.atomClassName].write; | ||
actionWrite = ctx.$utils.extend({}, actionWrite); | ||
return ctx.$meta.util.performAction({ ctx, action: actionWrite, item }); | ||
}); | ||
} | ||
// just return key | ||
return key; | ||
}); | ||
@@ -27,0 +34,0 @@ } else if (action.name === 'delete') { |
{ | ||
"name": "egg-born-module-a-base-sync", | ||
"version": "1.2.16", | ||
"version": "1.2.17", | ||
"title": "Base", | ||
@@ -5,0 +5,0 @@ "eggBornModule": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
975922
14318