Browse Source

新增选择文件后回调

优化选择文件回调参数
Karson 9 months ago
parent
commit
3ee684875f

+ 1 - 1
public/assets/js/backend/general/attachment.js

@@ -167,7 +167,7 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
                         {
                             field: 'operate', title: __('Operate'), width: 85, events: {
                                 'click .btn-chooseone': function (e, value, row, index) {
-                                    Fast.api.close({url: row.url, multiple: multiple});
+                                    Fast.api.close($.extend({multiple: multiple}, row));
                                 },
                             }, formatter: function () {
                                 return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';

+ 3 - 0
public/assets/js/require-form.js

@@ -295,6 +295,9 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
                                     var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
                                     $("#" + input_id).val(url).trigger("change").trigger("validate");
                                 }
+
+                                // 触发选择文件自定义事件
+                                button.trigger("fa.event.selectedfile", data);
                             }
                         });
                         return false;

+ 3 - 3
public/assets/js/require-table.js

@@ -929,15 +929,15 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                                     buttons.push(tempButton[item.name]);
                                 }
                                 existBtn.push(item.name);
-                    }
+                            }
                         } else {
                             buttons.push(item);
-                    }
+                        }
                     });
                     defaultBtn.forEach(function (value, index) {
                         if (existBtn.indexOf(value) === -1) {
                             buttons.push(tempButton[value]);
-                    }
+                        }
                     });
                     return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
                 }