Skip to content

Commit

Permalink
新增 webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
hotoa committed Sep 22, 2020
1 parent 6c4d830 commit 3b04a16
Show file tree
Hide file tree
Showing 4 changed files with 4,300 additions and 0 deletions.
22 changes: 22 additions & 0 deletions webapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "steedos-contracts-webapp",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"build": "yarn webpack"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"babel-loader": "^8.0.6",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9"
},
"dependencies": {
"react": "^16.12.0",
"@steedos/react": "^1.21.1"
}
}
168 changes: 168 additions & 0 deletions webapp/src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import React from 'react';
import { Provider } from 'react-redux';
import { Bootstrap, Dashboard, entityStateSelector } from '@steedos/react';
import { getBetweenTimeBuiltinValueItem } from '@steedos/filters';

let config = {
"workflow": {
"label": "待审核文件",
"position": "CENTER_TOP",
"type": "object",
"objectName": "instances",
"filters": [
[
["inbox_users", "=", "{userId}"], "or", ["cc_users", "=", "{userId}"]
]
],
"sort": "modified desc",
"columns": [{
"label": "名称",
"field": "name",
"href": true
}, {
"label": "提交人",
"field": "submitter_name",
"width": "10rem"
}, {
"label": "修改时间",
"field": "modified",
"type": "datetime",
"width": "10rem"
}],
"noHeader": false,
"unborderedRow": true,
"showAllLink": false,
"illustration": {
"messageBody": "您没有待审核文件"
},
rowIcon: {
category: "standard",
name: "task",
size: "small"
}
},
"apps": {
"label": "应用程序",
"position": "CENTER_TOP",
"type": "apps",
"mobile": false,
"ignoreApps": ["oa"]
},
"announcements": {
"label": "本周公告",
"position": "CENTER_TOP",
"type": "object",
"objectName": "announcements",
"filters": [
["owner", "=", "{userId}"],
["members", "=", "{userId}"],
['created', 'between', 'last_7_days']
],
"sort": "created desc",
"columns": [{
"field": "name",
"label": "标题",
"href": true
},{
"field": "created",
"label": "发布时间",
"width": "10rem",
"type": "datetime"
}],
"noHeader": false,
"unborderedRow": true,
"showAllLink": true,
"illustration": {
"messageBody": "本周没有新公告"
},
rowIcon: {
category: "standard",
name: "announcement",
size: "small"
}
},
"tasks": {
"label": "今日任务",
"position": "RIGHT",
"type": "object",
"objectName": "tasks",
"filters": [
["assignees", "=", "{userId}"],
["state", "<>", "complete"],
['due_date', 'between', 'last_30_days']
],
"sort": "due_date",
"columns": [{
"field": "name",
"label": "主题",
"href": true
}],
"unborderedRow": true,
"showAllLink": true,
"illustration": {
"messageBody": "您今天没有待办任务"
},
"noHeader": true,
rowIcon: {
category: "standard",
name: "timesheet_entry",
size: "small"
}
},
"calendar": {
label: "今日日程",
position: "RIGHT",
type: "object",
objectName: "events",
filters: function(){
let utcOffset = Creator.USER_CONTEXT.user && Creator.USER_CONTEXT.user.utcOffset;
let today = getBetweenTimeBuiltinValueItem("today", utcOffset);
let start = today.values[0];
let end = today.values[1];
return [[
['owner', '=', '{userId}'],
'or',
['assignees', '=', '{userId}']
], [
['end', '>=', start],
['start', '<=', end]
]]
},
sort: "start desc, end",
columns: [{
field: "name",
label: "主题",
href: true
}],
unborderedRow: true,
showAllLink: true,
illustration:{
messageBody: "您今天没有日程"
},
"noHeader": true,
rowIcon: {
category: "standard",
name: "event",
size: "small"
}
}
};

class ContractsAppPlugin {
initialize(registry, store) {
const Home = () => (
<Provider store={store}>
<Bootstrap>
<Dashboard config={config} />
</Bootstrap>
</Provider>
)
registry.registerObjectHomeComponent(
'oa_home',
Home
);
// registry.registerDashboardComponent(["oa","payment"], Home);
}
}

window.registerPlugin('com.steedos.contracts-app', new ContractsAppPlugin());
52 changes: 52 additions & 0 deletions webapp/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
var path = require('path');

module.exports = {
entry: [
'./src/index.jsx',
],
resolve: {
modules: [
'src',
'node_modules',
],
extensions: ['*', '.js', '.jsx'],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-react',
[
"@babel/preset-env",
{
"modules": "commonjs",
"targets": {
"chrome": "58",
"ie": "11"
}
}
]
],
},
},
},
],
},
externals: {
"react": 'React',
"react-dom": 'ReactDom',
"redux": 'Redux',
"react-redux": 'ReactRedux',
"prop-types": 'PropTypes',
"@steedos/react": 'ReactSteedos'
},
output: {
path: path.join(__dirname, '..', '/src'),
publicPath: '/',
filename: 'webapp.client.js',
},
};
Loading

0 comments on commit 3b04a16

Please sign in to comment.