@steedos/standard-ui 2.7.0-beta.13 → 2.7.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2024-03-30 11:37:53
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2024-03-30 12:17:46
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
disable: function (object_name, record_id) {
|
|
10
|
+
const record = Creator.odata.get(object_name, record_id);
|
|
11
|
+
const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
|
|
12
|
+
swal({
|
|
13
|
+
title: '停用',
|
|
14
|
+
text: `确定要停用${record.name}?${nodesSelect}`,
|
|
15
|
+
html: true,
|
|
16
|
+
showCancelButton: true,
|
|
17
|
+
confirmButtonText: '启用',
|
|
18
|
+
cancelButtonText: TAPi18n.__('Cancel')
|
|
19
|
+
}, function (option) {
|
|
20
|
+
if (option) {
|
|
21
|
+
toastr.info(t('停用中,请稍后...'), null, {timeOut: false});
|
|
22
|
+
Steedos.authRequest(Steedos.absoluteUrl(`/api/v1/apps/${record_id}`), {
|
|
23
|
+
type: 'put', async: false, data: JSON.stringify({
|
|
24
|
+
doc: {
|
|
25
|
+
visible: false
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
success: function(){
|
|
29
|
+
setTimeout(function(){
|
|
30
|
+
if (record_id) {
|
|
31
|
+
SteedosUI.reloadRecord(object_name, record_id)
|
|
32
|
+
}
|
|
33
|
+
toastr.clear();
|
|
34
|
+
toastr.success(t('steedos_packages.disable.toastr_success'));
|
|
35
|
+
FlowRouter.reload()
|
|
36
|
+
}, 100)
|
|
37
|
+
},
|
|
38
|
+
error: function(XMLHttpRequest){
|
|
39
|
+
toastr.clear();
|
|
40
|
+
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
disableVisible: function (object_name, record_id) {
|
|
47
|
+
const record = Creator.odata.get(object_name, record_id);
|
|
48
|
+
if(record.visible){
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2024-03-30 11:37:53
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2024-03-30 12:18:00
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
enable: function (object_name, record_id) {
|
|
10
|
+
const record = Creator.odata.get(object_name,record_id);
|
|
11
|
+
const nodesSelect = Steedos.PackageRegistry.getNodesSelect();
|
|
12
|
+
swal({
|
|
13
|
+
title: `启用`,
|
|
14
|
+
text: `确定要启用${record.name}?${nodesSelect}`,
|
|
15
|
+
html: true,
|
|
16
|
+
showCancelButton: true,
|
|
17
|
+
confirmButtonText: '启用',
|
|
18
|
+
cancelButtonText: TAPi18n.__('Cancel')
|
|
19
|
+
}, function (option) {
|
|
20
|
+
if (option) {
|
|
21
|
+
toastr.info('启用中,请稍后...', null, {timeOut: false});
|
|
22
|
+
Steedos.authRequest(Steedos.absoluteUrl(`/api/v1/apps/${record_id}`), {type: 'put', async: false, data: JSON.stringify({
|
|
23
|
+
doc: {
|
|
24
|
+
visible: true
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
success: function(data){
|
|
28
|
+
if(data.status == 1){
|
|
29
|
+
toastr.clear();
|
|
30
|
+
toastr.error(data.msg);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
setTimeout(function(){
|
|
34
|
+
if (FlowRouter.current().params.record_id) {
|
|
35
|
+
SteedosUI.reloadRecord(object_name, record_id)
|
|
36
|
+
}
|
|
37
|
+
toastr.clear();
|
|
38
|
+
toastr.success('已启用');
|
|
39
|
+
FlowRouter.reload()
|
|
40
|
+
}, 100)
|
|
41
|
+
},
|
|
42
|
+
error: function(XMLHttpRequest){
|
|
43
|
+
toastr.clear();
|
|
44
|
+
toastr.error(XMLHttpRequest.responseJSON.error);
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
enableVisible: function (object_name,record_id) {
|
|
51
|
+
const record = Creator.odata.get(object_name,record_id);
|
|
52
|
+
if(record.visible){
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-ui",
|
|
3
|
-
"version": "2.7.0-beta.
|
|
3
|
+
"version": "2.7.0-beta.16",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
"description": "steedos package",
|
|
13
13
|
"repository": {},
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "6000bab910fb5fa326cca58c4f396ed6f9779aa4"
|
|
16
16
|
}
|