function time(field) { return { type: 'tpl', tpl: `\${IF(${field}, DATETOSTR(${field}, 'YYYY-MM-DD HH:mm:ss'), undefined)}` } } function cloudCrud(title, path) { return { type: 'crud', title: title, api: `\${base}${path}`, interval: 2000, syncLocation: false, silentPolling: true, headerToolbar: ['reload'], loadDataOnce: true, affixHeader: false, perPage: 100, columns: [ {name: 'name', label: '名称'}, { name: 'status', label: '状态', align: 'center', width: 60, }, { name: 'serviceUpTime', label: '启动时间', ...time('serviceUpTime'), align: 'center', width: 140, }, {name: 'url', label: '地址', width: 200}, {name: 'serviceId', label: '服务', width: 180, fixed: 'right'}, ] } } function cloudTab() { return { title: 'Cloud', tab: [ { type: 'wrapper', size: 'none', body: [ { type: 'action', label: 'Eureka', actionType: 'url', url: 'http://132.122.116.142:35670', blank: true, } ], }, {type: 'divider'}, /*{ type: 'service', silentPolling: true, schemaApi: 'get:${base}/cloud/deploy_plan', },*/ cloudCrud('服务列表', '/cloud/list'), cloudCrud('服务列表 (IP)', '/cloud/list_ip'), ], } }