diff --git a/services/standard-object-database/main/default/objects/objects/buttons/reset.button.js b/services/standard-object-database/main/default/objects/objects/buttons/reset.button.js
new file mode 100644
index 0000000000..f04b159622
--- /dev/null
+++ b/services/standard-object-database/main/default/objects/objects/buttons/reset.button.js
@@ -0,0 +1,16 @@
+/*
+ * @Author: baozhoutaon@hotoa.com
+ * @Date: 2022-03-29 20:33:44
+ * @LastEditors: baozhoutao@steedos.com
+ * @LastEditTime: 2024-03-21 10:45:57
+ * @Description:
+ */
+module.exports = {
+ resetVisible: function (object_name, record_id, permission, data) {
+ if(Meteor.settings.public.enable_saas){
+ return false;
+ }
+ var record = data && data.record;
+ return record && record.is_system && record.is_customize && record.created;
+ }
+}
\ No newline at end of file
diff --git a/services/standard-object-database/main/default/objects/objects/buttons/reset.button.yml b/services/standard-object-database/main/default/objects/objects/buttons/reset.button.yml
new file mode 100644
index 0000000000..d36bf67b62
--- /dev/null
+++ b/services/standard-object-database/main/default/objects/objects/buttons/reset.button.yml
@@ -0,0 +1,79 @@
+name: reset
+amis_schema: |-
+ {
+ "type": "service",
+ "body": [
+ {
+ "type": "button",
+ "label": "重置",
+ "id": "u:delete_object",
+ "onEvent": {
+ "click": {
+ "actions": [
+ {
+ "actionType": "dialog",
+ "dialog": {
+ "type": "dialog",
+ "title": "重置对象: ${record.label}",
+ "body": [
+ {
+ "type": "tpl",
+ "tpl": "
",
+ "inline": true,
+ "id": "u:6d0819fc0bda"
+ }
+ ],
+ "id": "u:b5c0f98dc113",
+ "closeOnEsc": false,
+ "closeOnOutside": false,
+ "showCloseButton": true,
+ "data": {
+ "&": "$$",
+ "recordId": "${recordId}"
+ },
+ "onEvent": {
+ "confirm": {
+ "weight": 0,
+ "actions": [
+ {
+ "componentId": "",
+ "args": {
+ "api": {
+ "url": "/service/api/~database-objects/reset",
+ "method": "post",
+ "data": {
+ "objectName": "${record.name}"
+ }
+ },
+ "messages": {}
+ },
+ "actionType": "ajax"
+ },
+ {
+ "actionType": "custom",
+ "script": "window.location.reload();"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ],
+ "weight": 0
+ }
+ }
+ }
+ ],
+ "regions": [
+ "body"
+ ],
+ "data": {
+ },
+ "bodyClassName": "p-0",
+ "id": "u:46d1821365fc"
+ }
+is_enable: true
+label: 重置
+'on': record_only_more
+type: amis_button
+visible: true
\ No newline at end of file
diff --git a/services/standard-object-database/main/default/services/database-objects.service.js b/services/standard-object-database/main/default/services/database-objects.service.js
index 92bf800885..4ed9b446e2 100644
--- a/services/standard-object-database/main/default/services/database-objects.service.js
+++ b/services/standard-object-database/main/default/services/database-objects.service.js
@@ -2,10 +2,15 @@
* @Author: baozhoutao@steedos.com
* @Date: 2023-04-21 16:25:07
* @LastEditors: baozhoutao@steedos.com
- * @LastEditTime: 2023-05-18 09:26:18
+ * @LastEditTime: 2024-03-21 11:58:43
* @Description:
*/
var packageServiceName = '~database-objects'
+
+const { getObject } = require('@steedos/objectql');
+
+const sleep = async (ms) => new Promise(resolve => setTimeout(resolve, ms));
+
function isPatternTrigger(data){
const {listenTo} = data;
if(listenTo === '*'){
@@ -36,7 +41,19 @@ module.exports = {
* Actions
*/
actions: {
-
+ resetObject: {
+ rest: {
+ method: "POST",
+ path: "/reset"
+ },
+ async handler(ctx) {
+ const { objectName } = ctx.params;
+ await getObject('objects').directDelete({filters: ['name','=', objectName]});
+ await getObject('object_fields').directDelete({filters: ['object','=', objectName]});
+ await sleep(2 * 1000)
+ return true;
+ }
+ }
},
/**