fmui-base 2.1.84 → 2.1.85

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,26 @@
1
+ import React, {PropTypes} from 'react';
2
+
3
+
4
+ class Care extends React.Component {
5
+ constructor(props) {
6
+ super(props)
7
+ let text=props.text
8
+ this.state = {
9
+ text: text,
10
+ }
11
+ }
12
+
13
+ handleClick(){
14
+ console.log('button click')
15
+ }
16
+
17
+ render () {
18
+ return (
19
+ <div>
20
+ care
21
+ </div>
22
+ );
23
+ }
24
+ }
25
+
26
+ export default Care
@@ -0,0 +1,344 @@
1
+ import React from 'react';
2
+ import ReactECharts from 'echarts-for-react';
3
+ import DB from '../db/db';
4
+
5
+ class NoData extends React.Component{
6
+ constructor(props) {
7
+ super(props);
8
+ var portalId = props.portalId;
9
+ var height = props.height;
10
+ var hasTitle = props.hasTitle?props.height:false;
11
+ if(!height){
12
+ height = 400;
13
+ }
14
+ if(hasTitle){
15
+ if((height+"").indexOf("%")>0){
16
+ height = "calc("+height+" - 50px)"
17
+ }else{
18
+ height = height - 50;
19
+ }
20
+ }
21
+ this.state = {
22
+ loadTrue:false,
23
+ portalId:portalId,
24
+ height : height,
25
+ options:{
26
+ id:portalId,
27
+ allBackData : {},// 存储后台返回的所有data数据
28
+ rowCheck : false,// 二维表三维表行列合计默认为false
29
+ colCheck : false,// 二维表三维表行列合计默认为false
30
+ rsId : "",
31
+ rsSql : "",
32
+ rsSource : "",
33
+ rptType : '',
34
+ filterArr : [],// 存储过滤条件name,type,content
35
+ title : {
36
+ text : '',
37
+ right : 'center',
38
+ top : '-4px'
39
+ },
40
+ textStyle : {
41
+ color : '#000'
42
+ },
43
+ grid:{top:'15%'},
44
+ // toolbox : {
45
+ // right:'5%',
46
+ // feature : {
47
+ // saveAsImage : {}
48
+ // }
49
+ // },
50
+ tooltip : {
51
+ trigger : 'item',
52
+ confine : true,
53
+ axisPointer : { // 坐标轴指示器,坐标轴触发有效
54
+ type : 'line', // 默认为直线,可选为:'line' | 'shadow'
55
+ lineStyle : { // 直线指示器样式设置
56
+ color : '#48b',
57
+ width : 2,
58
+ type : 'solid'
59
+ },
60
+ shadowStyle : { // 阴影指示器样式设置
61
+ width : 'auto', // 阴影大小
62
+ color : 'rgba(150,150,150,0.3)' // 阴影颜色
63
+ }
64
+ }
65
+ },
66
+ legend : {
67
+ data : [],
68
+ type : 'scroll',
69
+ bottom : '1%' ,
70
+ },
71
+ xAxisPageInfo : {// 存储页面x轴相关信息
72
+ xName : "",
73
+ unSelectItem : []
74
+ // select未选中项存储
75
+ },
76
+ yAxisPageInfo : {
77
+ yName : "",
78
+ },
79
+ xAxis : {
80
+ data : [],
81
+ axisLabel : {//坐标轴刻度标签的相关设置。
82
+ interval:0,
83
+ }
84
+ },
85
+ yAxis : {},
86
+ series : [],
87
+ ySeriesAxisName : "",
88
+ ySeries : {
89
+ unSelectItem : []
90
+ // select未选中项存储
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ //排序函数,排序系列时用到,只排序数字数组
97
+ sortNumber(a,b){
98
+ return a - b;
99
+ }
100
+
101
+ componentDidMount(){
102
+ let t = this;
103
+ DB.portal.getComponentInfoList({
104
+ ppId: t.state.portalId,
105
+ code:'tbgl'
106
+ }).then((content) => {
107
+ var options = t.state.options;
108
+
109
+ var chartData = content.chartData;
110
+ var chartSet = content.chartSet;
111
+ options.rsId = chartSet.rsId;
112
+
113
+ // 图表统计条件
114
+ if (chartSet.chartCountType == 1) {
115
+ options.rowCheck = true;
116
+ } else if (chartSet.chartCountType == 2) {
117
+ options.colCheck = true;
118
+ } else if (chartSet.chartCountType == 3) {
119
+ options.rowCheck = true;
120
+ options.colCheck = true;
121
+ }
122
+
123
+ var chartX = chartSet.chartX;
124
+ var chartY = chartSet.chartY;
125
+ var chartValue = chartSet.chartValue;
126
+
127
+ // 三个区域拖值处赋值
128
+ options.xAxisPageInfo.xName = chartX; // 分类字段
129
+ options.yAxisPageInfo.yName = chartValue; // 值域字段
130
+ options.ySeriesAxisName = chartY; // 系列字段
131
+
132
+ options.rptType = chartSet.chartType;
133
+
134
+ var xAxisArr = chartX ? chartX.split(",") : [];
135
+ if (xAxisArr.length > 0) {
136
+ var smallModuleKey = xAxisArr[0].substring(0, xAxisArr[0].indexOf("|"));
137
+ }
138
+
139
+ var inbyname = "";
140
+ // 1.查询当前所有的拖入的结果集字段作为inbyname传入后台的数据
141
+ if (chartX) {
142
+ var xAxisArr = chartX.split(",");
143
+ for (var i = 0; i < xAxisArr.length; i++) {
144
+ var oneXAxisArr = xAxisArr[i].split("|");
145
+ inbyname += oneXAxisArr[0] + ",";
146
+ }
147
+ }
148
+ if (chartY) {
149
+ var seriesArr = chartY.split(",");
150
+ for (var i = 0; i < seriesArr.length; i++) {
151
+ var oneSeriesArr = seriesArr[i].split("|");
152
+ inbyname += oneSeriesArr[0] + ",";
153
+ }
154
+ }
155
+ if (chartValue) {
156
+ var yAxisArr = chartValue.split(",");
157
+ for (var i = 0; i < yAxisArr.length; i++) {
158
+ var oneYAxisArr = yAxisArr[i].split("|");
159
+ inbyname += oneYAxisArr[0] + ",";
160
+ }
161
+ }
162
+ inbyname = inbyname.substring(0, inbyname.length - 1);
163
+
164
+ // 2.定位byname,axis,根据参数确定返回数据的处理格式
165
+ var fixByName = "";
166
+ var fixAxis = "";
167
+ if (chartX) {
168
+ fixByName = chartX;
169
+ fixAxis = "xAxis";
170
+ }
171
+ if (chartValue) {
172
+ fixByName = chartValue;
173
+ fixAxis = "yAxis";
174
+ }
175
+ if (chartY) {
176
+ fixByName = chartY;
177
+ fixAxis = "ySeriesAxis";
178
+ }
179
+
180
+ var chartType = chartSet.chartType;
181
+ if (chartType != 'line' && chartType != 'bar') {
182
+ // 只有当图形为折线图和柱形图时有x,y轴,其他删除
183
+ delete options.xAxis;
184
+ delete options.yAxis;
185
+ }
186
+
187
+ if (chartType == "二维表" || chartType == "三维表" || chartType == "单维表") {
188
+
189
+ } else {
190
+ if (fixAxis == "xAxis") {
191
+ if (options.xAxis) {
192
+ // 除了折线图和柱形图,其他图形是无x,y轴的,会在初始化时删掉这个
193
+ options.xAxis.data = chartData[inbyname];
194
+ }
195
+ options.series = []; // 清除操作
196
+ } else if (fixAxis == "yAxis") {
197
+ // 显示xAxis的新值
198
+ var bynameArr = inbyname.split(",");
199
+ if (options.xAxis) {
200
+ // 除了折线图和柱形图,其他图形是无x,y轴的,会在初始化时删掉这个
201
+ options.xAxis.data = chartData[bynameArr[0]];
202
+ }
203
+ options.legend.data = []; // 清除原来的值,置空
204
+ options.series = []; // 清除操作
205
+ // 别名显示
206
+ var yByname = options.yAxisPageInfo.yName.substring(options.yAxisPageInfo.yName.indexOf("|") + 1);
207
+ if (options.rptType != "gauge") {
208
+ options.legend.data.push(yByname);
209
+ }
210
+ var newparam;
211
+ if (options.rptType == "pie" || options.rptType == "funnel" || options.rptType == "gauge") {
212
+ // 如果是饼图,漏斗图,仪表盘
213
+ if (options.rptType == "pie") {
214
+ newparam = {
215
+ "name": yByname,
216
+ "type": options.rptType,
217
+ "radius": "50%",
218
+ "center": ["50%", "55%"],
219
+ "data": []
220
+ };
221
+ } else {
222
+ newparam = {
223
+ "name": yByname,
224
+ "type": options.rptType,
225
+ "center": ["50%", "55%"],
226
+ "data": [/*
227
+ * { "value" : data[key], "name" : key }
228
+ */]
229
+ };
230
+ }
231
+ /*
232
+ * if(previewOption.rptType == "funnel"){//仪表盘宽度限制下,不然太宽了,不协调
233
+ * newparam.width = "60%"; }
234
+ */
235
+ if (chartData[bynameArr[1]].length < 1) {
236
+ chartData[bynameArr[1]] = [0];
237
+ }
238
+ for (var i = 0; i < chartData[bynameArr[1]].length; i++) {
239
+ var dataItem = {};
240
+ dataItem.value = chartData[bynameArr[1]][i];
241
+ dataItem.name = chartData[bynameArr[0]][i];
242
+ newparam.data.push(dataItem);
243
+ if (options.rptType == "gauge") {
244
+ // 仪表盘默认只选第一个
245
+ newparam.detail = {
246
+ formatter: '{name|' + yByname + '}\n{value}',
247
+ rich: {
248
+ name: {
249
+ fontSize: 14
250
+ }
251
+ }
252
+ };
253
+ // 最大值为当前值升一位的最小整数,如:324的最大数为1000
254
+ var numLen = (parseInt(chartData[bynameArr[1]][i]) * 10).toString().length;
255
+ var maxNum = "1";
256
+ for (var m = 0; m < numLen - 1; m++) {
257
+ maxNum += "" + 0;
258
+ }
259
+ newparam.max = Number(maxNum);
260
+ break;
261
+ }
262
+ }
263
+ options.legend.data = chartData[bynameArr[0]].sort(t.sortNumber);
264
+ } else if (options.rptType == "radar") {
265
+ // 如果是雷达图,值加载形式有区别
266
+ var inMaxNum = 1;
267
+ if (chartData[bynameArr[1]].length == 0) {
268
+ chartData[bynameArr[1]] = new Array(chartData[bynameArr[0]].length);
269
+ } else {
270
+ inMaxNum = Math.max.apply(null, chartData[bynameArr[1]]); // 返回数组中的最大值
271
+ }
272
+ for (var i = 0; i < chartData[bynameArr[1]].length; i++) {
273
+ if (!chartData[bynameArr[1]][i]) {
274
+ chartData[bynameArr[1]][i] = 0;
275
+ }
276
+ }
277
+ newparam = {
278
+ "name": yByname,
279
+ "type": options.rptType,
280
+ "radius": "50%",
281
+ "data": [{
282
+ "value": chartData[bynameArr[1]],
283
+ "name": yByname
284
+ }]
285
+ };
286
+ options.radar = {
287
+ indicator: [],
288
+ radius: '60%',
289
+ center: ["50%", "55%"] // 雷达图设置偏下位置,与标题栏间隔一点距离
290
+ };
291
+ for (var i = 0; i < chartData[bynameArr[0]].length; i++) {
292
+ var indicatorItem = {};
293
+ indicatorItem.name = chartData[bynameArr[0]][i];
294
+ indicatorItem.max = inMaxNum; // 取统一的最大值
295
+ options.radar.indicator.push(indicatorItem);
296
+ }
297
+ } else {
298
+ newparam = {
299
+ "name": yByname,
300
+ "type": options.rptType,
301
+ "data": chartData[bynameArr[1]]
302
+ };
303
+ }
304
+ options.series.push(newparam);
305
+ }
306
+ }
307
+
308
+ t.setState({
309
+ options: options,
310
+ loadTrue:true
311
+ });
312
+
313
+ }).catch((error) => {
314
+ console.error(error);
315
+ });
316
+ }
317
+
318
+ render(){
319
+ return (
320
+ <div style={{height:this.state.height}}>
321
+ {
322
+ this.state.loadTrue?
323
+ this.state.options.rptType == "单维表" || this.state.options.rptType == "二维表" || this.state.options.rptType == "三维表"?
324
+ <div style={{textAlign: 'center'}}>移动端暂不支持{this.state.options.rptType}</div>:
325
+ <ReactECharts
326
+ option={this.state.options}
327
+ style={{height:'100%',width:'100%'}}
328
+ autoResize={true}
329
+ // notMerge={true}
330
+ // lazyUpdate={true}
331
+ // theme={"theme_name"}
332
+ // onChartReady={this.onChartReadyCallback}
333
+ // onEvents={EventsDict}
334
+ />
335
+ :""
336
+ }
337
+ </div>
338
+ );
339
+ }
340
+ }
341
+
342
+ export default NoData;
343
+
344
+
@@ -0,0 +1,285 @@
1
+ import React from 'react';
2
+ import Boxs from 'saltui/lib/Boxs';
3
+ const { VBox,Box,HBox } = Boxs;
4
+ import Variables from '../db/variables';
5
+ import DB from '../db/db';
6
+
7
+ import 'whatwg-fetch';
8
+ import 'es6-promise';
9
+ import './List.less';
10
+ export default class PageHome extends React.Component {
11
+ constructor(props) {
12
+ super(props);
13
+
14
+ var setting = getSysAttachSetting();
15
+
16
+ //预览类型,view:永中预览,download:下载
17
+ var viewType = 'view';
18
+
19
+ if(setting.sysAttachmentView == 0){//如果设置中预览关闭则默认下载
20
+ viewType = "download";
21
+ }
22
+
23
+ // let startUserName = decodeURI(this.props.params.startUserName);//创建人用户
24
+ // let startUserGroupName = decodeURI(this.props.params.startUserGroupName);//创建人组织
25
+ //let startUserId = this.props.params.startUserId;
26
+ const token = document.getElementById('token').value;
27
+ this.state={
28
+ // attachId:props.attachId,
29
+ loadImg:Variables.loadImg+"&fid=",
30
+ // imgUrl:getImagePreUrl()+'/attachment/download?token='+token+'&',
31
+ // queryUrl: context + '/api/m/plugin/attachment/mobile/getAttachmentByIds?token='+token+'&ids=',
32
+ commentList:[],
33
+ viewType:viewType
34
+ }
35
+
36
+ }
37
+
38
+ componentDidMount() {
39
+ let t = this;
40
+ var token = document.getElementById('token').value;
41
+ this.initData(token,function(commentList){
42
+ t.setState({
43
+ commentList:commentList
44
+ })
45
+ });
46
+
47
+ this.casigin();
48
+
49
+ }
50
+
51
+ //批示意见验签
52
+ casigin(){
53
+ var commentList = this.props.list;
54
+ if(commentList){
55
+ commentList.map(function(item){
56
+ var param = {};
57
+ param.bizSn = item.id;
58
+ param.relationId = getLoginUserInfo().mobile;
59
+ param.msg = item.fullMessage;
60
+ // setTimeout(function(){
61
+ // $("#"+item.id+"_sucess").show();
62
+ // },1000)
63
+ DB.FlowApproval.verifySign(param).then((content) => {
64
+ var result = content.verifySignRes;
65
+ if(result=='success'){
66
+ $("#commentSign-"+item.id).removeClass('t-PR16');
67
+ $("#"+item.id+"_sucess").show();
68
+ }
69
+ }).catch((error) => {
70
+ if(error.errorMsg == "签名值与原文不匹配"){
71
+ $("#commentSign-"+item.id).removeClass('t-PR16');
72
+ $("#"+item.id+"_fail").show();
73
+ }
74
+ // else{
75
+ // Toast.show({
76
+ // type: 'error',
77
+ // content: error.errorMsg,
78
+ // });
79
+ // }
80
+ });
81
+ })
82
+ }
83
+ }
84
+
85
+ //初始化ids
86
+ async initData(token,sucess){
87
+ let t = this;
88
+ var context = document.getElementById("context").value;
89
+ var url = context + '/api/m/plugin/attachment/mobile/getAttachmentByIds?token='+token+'&ids=';
90
+ var commentList = this.props.list;
91
+ var attachIds = "";
92
+ // var attachMap = {};
93
+ commentList.map(function(item){
94
+ // var commentId = item.id;
95
+ var attachId = item.attachId;
96
+ if(attachId){
97
+ attachId = attachId.replaceAll("|",",");
98
+ attachIds = attachIds+","+attachId;
99
+ // attachMap[commentId] = attachId;
100
+ }
101
+ })
102
+ if(attachIds){
103
+ attachIds = attachIds.substring(1);
104
+ await t.promises(url+attachIds).then(function(e){
105
+ commentList.map(function(item){
106
+ // var commentId = item.id;
107
+ var attachId = item.attachId;
108
+ if(attachId){
109
+ var fileList = [];
110
+ var attachArray = attachId.split("|");
111
+ attachArray.map(function(attachItem){
112
+ for(var i=0; i<e.length; i++){
113
+ if(attachItem == e[i].id){
114
+ fileList.push(e[i]);
115
+ }
116
+ }
117
+ });
118
+ item.fileList = fileList;
119
+ }
120
+ })
121
+ });
122
+ sucess(commentList);
123
+ }else{
124
+ sucess(commentList);
125
+ }
126
+ }
127
+
128
+ promises(url) {
129
+ return new Promise((resolve, reject)=> {
130
+ try{
131
+ fetch(url,{
132
+ method: "POST",
133
+ headers:{
134
+ 'Content-Type': 'application/x-www-form-urlencoded',
135
+ }
136
+ }).then(function(res){
137
+ if (res.ok) {
138
+ res.json().then(function(obj) {
139
+ var objList = obj.data;
140
+ resolve(objList);
141
+ })
142
+ } else if (res.status == 401) {
143
+ // To do with res
144
+ }
145
+
146
+ })
147
+ } catch(e){
148
+ console.log(e);
149
+ }
150
+ })
151
+ }
152
+
153
+ //预览
154
+ view(file){
155
+ var id = file.id;
156
+ if(this.state.viewType == 'view'){
157
+ // var isLoadWatermark = this.props.isLoadWatermark;
158
+ // var allowDownLoad = this.props.allowDownLoad;
159
+ var fileExt = file.fileExt;
160
+ downloadFile(id,'android',fileExt);
161
+ }else{
162
+ downloadFile(id);
163
+ }
164
+ }
165
+
166
+ getCommentSign(item){
167
+ let t = this;
168
+ var returnHtml;
169
+ if(item.inscriptionShow){
170
+
171
+ var userNameHtml = (
172
+ <span className='t-PR5'>{item.replacename&&item.replacename!=""?item.replacename:item.userName}</span>
173
+ )
174
+ var dateHtml = (
175
+ <span className='t-PR5'>{item.time.substring(0,10)}</span>
176
+ )
177
+ var timeHtml = (
178
+ <span className='t-PR5'>{item.time.substring(11)}</span>
179
+ )
180
+ var orgNameHtml = (
181
+ <span className='t-PR5'>{item.orgShowName}</span>
182
+ )
183
+ var signPicHtml = item.signPic?(
184
+ <img className="t-H64 t-PR5" src={t.state.loadImg+item.signPic}/>
185
+ ):"";
186
+ var taskNameHtml = (
187
+ <span className='t-PR5'>{item.taskName}</span>
188
+ )
189
+ var inscriptionShowArray = item.inscriptionShow.split(",");
190
+ const returnHtml = inscriptionShowArray.map(function(inscriptionItem){
191
+ if(inscriptionItem){
192
+ if(inscriptionItem == "userName" && ((item.inscriptionShow.indexOf("signImg")<0) || (item.inscriptionShow.indexOf("signImg")>=0 && (typeof(item.signPic) == 'undefined' || item.signPic == null || item.signPic == "" ) ) )){
193
+ return userNameHtml;
194
+ }else if(inscriptionItem == "date"){
195
+ return dateHtml;
196
+ }else if(inscriptionItem == "time"){
197
+ return timeHtml;
198
+ }else if(inscriptionItem == "org"){
199
+ return orgNameHtml;
200
+ }else if(inscriptionItem == "signImg"){
201
+ return signPicHtml;
202
+ }else if(inscriptionItem == "taskName"){
203
+ return taskNameHtml;
204
+ }
205
+ }
206
+ })
207
+ const replaceHtml = item.replacename && item.replacename!=""? "(代"+item.userName+"办理)" : "";
208
+ return (<Box style={{marginLeft:"auto","text-align": "right",width:'100%'}}>{returnHtml}{replaceHtml}</Box>);
209
+ }else{
210
+ return "";
211
+ }
212
+
213
+ }
214
+
215
+
216
+ render() {
217
+ const t = this;
218
+ return (
219
+ <div >
220
+ {t.state.commentList!=null && t.state.commentList.length>0?
221
+ t.state.commentList.map(function (item, key) {
222
+ return <VBox className="t-PB10 t-LH1_5 t-field t-FS14 t-PL10" >
223
+ {item.type.indexOf('image') < 0?
224
+ <Box className="t-FS16 t-PR16" dangerouslySetInnerHTML={{__html:item.fullMessage==null?"":item.fullMessage.replace(/\r\n/g,'<br/>').replace(/\n/g,'<br/>').replace(/ /g,'&nbsp;')}}></Box>
225
+ :
226
+ item.fullMessage==''? <Box>''</Box>
227
+ :
228
+ <HBox className="t-PR16">
229
+ <img width="100%" height="128" src={t.state.loadImg+item.fullMessage}/>
230
+ </HBox>
231
+ }
232
+
233
+ <div className="">
234
+ {item.fileList && item.fileList.length>0?item.fileList.map((item2, i) => {
235
+ function calculate(no){
236
+ let a = no/1024;
237
+ if(a<1){
238
+ return no+'B';
239
+ }
240
+ let b = a/1024;
241
+ if(b<1){
242
+ return Math.round(a*100)/100+'KB';
243
+ }
244
+ return Math.round(b*100)/100+'MB';
245
+ }
246
+ return (
247
+ <div className="t-FBH" key={i} >
248
+ <div className="dd-t-border t-P6 t-MB10 t-FB1" onClick={t.view.bind(t, item2)}>
249
+ <i className="iconfont icon-file t-FC9 t-FL t-MR6" ></i>
250
+ <div className="dd-t-list-text-content" >
251
+ <div className="t-list-title t-omit t-LH1_4" >
252
+ {typeof(item2.fileDisplayName)=='undefined'?item2.name:item2.fileDisplayName}
253
+ </div>
254
+ <div className="dd-t-list-time t-FBAC" >{calculate(typeof(item2.fileSize)=='undefined'?item2.size:item2.fileSize)}</div>
255
+ </div>
256
+ </div>
257
+ </div>
258
+ );
259
+ }):""}
260
+ </div>
261
+
262
+
263
+ {/* {item.signPic==''|| item.signPic==null?
264
+ ""
265
+ :
266
+ <HBox >
267
+ <Box flex={1}></Box>
268
+ <Box ><img className="t-H32 t-W64 " src={t.state.loadImg+item.signPic}/></Box>
269
+ </HBox>
270
+ } */}
271
+ {/* <Box vAlign="start" hAlign="end" className="t-FAR t-omit" > {item.inscriptionShow.indexOf('taskName')>=0?item.taskName:''}&nbsp;{item.inscriptionShow.indexOf('org')>=0?item.createdOrgName.substring(item.createdOrgName.lastIndexOf("/")+1):''}</Box> */}
272
+ <Box vAlign="start" hAlign="end" id={'commentSign-'+item.id} className="t-FBH t-PR16" > {item.inscriptionShow?t.getCommentSign(item):""}
273
+
274
+ <i id={item.id+"_sucess"} className='iconfont icon-checked t-PT10 t-PL3' style={{color:'green',display:'none'}}/>
275
+ <i id={item.id+"_fail"} className='iconfont icon-close t-PT10 t-PL3' style={{color:'red',display:'none'}}/>
276
+ </Box>
277
+ </VBox>
278
+
279
+ })
280
+ :''
281
+ }
282
+ </div>
283
+ )
284
+ }
285
+ }