|
@@ -143,6 +143,16 @@ class TableService extends CrudService {
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
+ async copy(data) {
|
|
|
+ // !id:表id;!project:复制到的项目下;dir:复制到的文件夹下
|
|
|
+ let table = await this.model.findById(data);
|
|
|
+ if (!table) return false;
|
|
|
+ table = JSON.parse(JSON.stringify(table));
|
|
|
+ const nt = _.pick(table, ['name', 'name_zh', 'columns', 'sort', 'remark']);
|
|
|
+ nt.project = data.project;
|
|
|
+ if (data.dir) nt.dir = data.dir;
|
|
|
+ await this.model.create(nt);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = TableService;
|