seimin 11 ヶ月 前
コミット
39c212f11d

+ 29 - 21
assets/js/controllers/incident/incidentCtrl.js

@@ -1110,30 +1110,11 @@ app.controller('incidentListCtrl', ["$scope", "$http", "i18nService", "$rootScop
1110 1110
                 uploader.filters.push({
1111 1111
                     name: "customFilter",
1112 1112
                     fn: function (item /*{File|FileLikeObject}*/, options) {
1113
-                    return this.queue.length < 10;
1113
+                        return this.queue.length < 10;
1114 1114
                     },
1115 1115
                 });
1116 1116
 
1117
-                $scope.dropfile = function (
1118
-                    APIService,
1119
-                    processInstanceId,
1120
-                    taskId,
1121
-                    userId
1122
-                ) {
1123
-                    uploader.onBeforeUploadItem = function (item) {
1124
-                    angular.extend(item.headers, $rootScope.getSession());
1125
-                    item.url = APIService.addFile(
1126
-                        processInstanceId,
1127
-                        taskId,
1128
-                        userId
1129
-                    ).getRequestedUrl();
1130
-                    item.formData.push({
1131
-                        fileName: item.file.name,
1132
-                    });
1133
-                    console.info("onBeforeUploadItem", item);
1134
-                    };
1135
-                    uploader.uploadAll();
1136
-                };
1117
+
1137 1118
 
1138 1119
                 // CALLBACKS
1139 1120
                 uploader.onWhenAddingFileFailed = function (
@@ -1144,7 +1125,26 @@ app.controller('incidentListCtrl', ["$scope", "$http", "i18nService", "$rootScop
1144 1125
                     console.info("onWhenAddingFileFailed", item, filter, options);
1145 1126
                 };
1146 1127
                 uploader.onAfterAddingFile = function (fileItem) {
1128
+                    console.log(fileItem.file)
1147 1129
                     console.info("onAfterAddingFile", fileItem);
1130
+                    if (fileItem.file.size >= 1024 * 1024 * 10) {
1131
+                        alert("文件不能大于10MB");
1132
+                        fileItem.uploader.queue.pop();
1133
+                        console.log($scope);
1134
+                    }
1135
+
1136
+                    if (
1137
+                        fileItem.file.type !== 'text/plain'
1138
+                        && fileItem.file.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
1139
+                        && fileItem.file.type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
1140
+                        && fileItem.file.type !== 'application/pdf'
1141
+                        && fileItem.file.type !== 'application/vnd.ms-excel'
1142
+                        && fileItem.file.type !== 'application/msword'
1143
+                    ) {
1144
+                        alert("只能上传word,excel,pdf,txt");
1145
+                        fileItem.uploader.queue.pop();
1146
+                        console.log($scope);
1147
+                    }
1148 1148
                 };
1149 1149
                 uploader.onAfterAddingAll = function (addedFileItems) {
1150 1150
                     console.info("onAfterAddingAll", addedFileItems);
@@ -1271,6 +1271,14 @@ app.controller('incidentListCtrl', ["$scope", "$http", "i18nService", "$rootScop
1271 1271
                         console.log(response)
1272 1272
                         $rootScope.isMask = false;
1273 1273
                         if (response.state == 200) {
1274
+                            uploader.onBeforeUploadItem = function (item) {
1275
+                                angular.extend(item.headers, $rootScope.getSession());
1276
+                                item.url = api_bpm_domain.uploadAttachmentJryModel("handleAttachment", response.data.id).getRequestedUrl();
1277
+                                item.formData.push({ 'fileName': item.file.name });
1278
+                                console.info('onBeforeUploadItem', item);
1279
+                            };
1280
+                            uploader.uploadAll();
1281
+
1274 1282
                             Alert.swal({
1275 1283
                                 title: "操作成功!",
1276 1284
                                 confirmButtonColor: "#007AFF",

File diff suppressed because it is too large
+ 20 - 1
assets/js/controllers/incident/incidentDetailCtrl.js


+ 34 - 0
assets/views/incident/incidentDetail.html

@@ -265,6 +265,40 @@
265 265
                             </div>
266 266
                         </div>
267 267
                     </div>
268
+                    <div class="col-xs-12 ui-repair-photos">
269
+                        <div class="row  fontcolor-two margin-top-15">
270
+                            <div class="col-md-12 formheard_pad worknumber">
271
+                                <div class="pull-left  fontsizes-16 font-weight-500">
272
+                                    附件下载
273
+                                </div>
274
+                            </div>
275
+                            <div class="col-md-12" style="padding:0;">
276
+                                <table class="table table-striped table-hover" style="table-layout: fixed;">
277
+                                    <thead>
278
+                                        <tr>
279
+                                            <th class="center" style="width:40%;">名称</th>
280
+                                            <th class="hidden-xs" ng-show="uploader.isHTML5" style="width:20%;">大小</th>
281
+                                            <th class="hidden-xs" style="width:20%;">附件下载</th>
282
+                                        </tr>
283
+                                    </thead>
284
+                                    <tbody>
285
+                                        <!-- 已上传附件 -->
286
+                                        <tr ng-repeat="attachment in attachments">
287
+                                            <td title="{{attachment.name}}"><strong>{{ attachment.name }}</strong></td>
288
+                                            <td ng-show="uploader.isHTML5" nowrap>{{ attachment.size/1024/1024|number:2 }} MB</td>
289
+                                            <td class="center">
290
+                                                <div class="visible-md visible-lg hidden-sm hidden-xs">
291
+                                                    <a ng-click="download(attachment.id,attachment.name,attachment.token)"
292
+                                                        class="btn btn-transparent btn-xs" tooltip-placement="top" tooltip="下载"><i
293
+                                                            class="fa fa-download"></i></a>
294
+                                                </div>
295
+                                            </td>
296
+                                        </tr>
297
+                                    </tbody>
298
+                                </table>
299
+                            </div>
300
+                        </div>
301
+                    </div>
268 302
                 </div>
269 303
             </div>
270 304
         </div>

+ 1 - 5
assets/views/incident/tpl/doing.tpl.html

@@ -65,7 +65,7 @@
65 65
     <div class="form-group incidentsearch" style="margin:0 auto;width: 300px;">
66 66
         <div class="panel panel-white">
67 67
             <div class="panel-heading">
68
-                <div style="width: 120px;" class="btn btn-blue btn-o btn-file col-md-2"><i class="fa fa-plus"></i><span translate="form.button.SELECTFILE"></span><input name="uploadedFile" type="file" nv-file-select="" uploader="uploader" />
68
+                <div style="width: 120px;" class="btn btn-blue btn-o btn-file col-md-2"><i class="fa fa-plus"></i><span translate="form.button.SELECTFILE"></span><input name="uploadedFile" accept=".pdf,.xlsx,.xls,.doc,.docx,.txt" type="file" nv-file-select="" uploader="uploader" />
69 69
                 </div>
70 70
             </div>
71 71
             <div class="panel-body">
@@ -89,10 +89,6 @@
89 89
                         </tr>
90 90
                     </tbody>
91 91
                 </table>
92
-
93
-                <button type="button" ng-if="to.isupdata" class="btn btn-success btn-s" ng-click="dropfile(to.ApiService,to.processInstanceId, to.taskId, to.userId)" ng-disabled="!uploader.getNotUploadedItems().length">
94
-                    <span class="glyphicon glyphicon-upload"></span> 上传
95
-                </button>
96 92
             </div>
97 93
         </div>
98 94
     </div>