fmui-base 2.2.11 → 2.2.12

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.
@@ -1,285 +0,0 @@
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
- }