@@ -48086,21 +48086,61 @@
4808648086
4808748087
4808848088 methods: {
48089+ exportData: function exportData(config) {
48090+ var dataTable = this.$refs.table1;
48091+ var table = dataTable.$children.filter(function (t) {
48092+ return t.$el._prevClass.indexOf('el-table') !== -1;
48093+ })[0];
48094+ var data = dataTable.data;
48095+ var columns = this.getColumns(table);
48096+ var fields = columns.map(function (t) {
48097+ return t.prop;
48098+ });
48099+ var fieldNames = columns.map(function (t) {
48100+ return t.label;
48101+ });
48102+ if (config.filtered) {
48103+ data = dataTable.tableData;
48104+ }
48105+ (0, _CsvExport2.default)(data, fields, fieldNames, config.fileName);
48106+ },
48107+ getColumns: function getColumns(tableEl) {
48108+ var _this = this;
48109+
48110+ var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
48111+
48112+ if (!tableEl.$children.length) {
48113+ return;
48114+ }
48115+ tableEl.$children.forEach(function (data) {
48116+ if (!data.$children.length && data.prop) {
48117+ arr.push(data);
48118+ } else {
48119+ _this.getColumns(data, arr);
48120+ }
48121+ });
48122+ return arr;
48123+ },
4808948124 getActionsDef: function getActionsDef() {
4809048125 var self = this;
4809148126 return {
4809248127 width: 5,
4809348128 def: [{
48094- name: 'new ',
48129+ name: '导出原始数据 ',
4809548130 handler: function handler() {
48096- self.$message('new clicked');
48131+ self.exportData({
48132+ fileName: '原始数据'
48133+ });
4809748134 },
4809848135
48099- icon: 'plus '
48136+ icon: 'upload '
4810048137 }, {
48101- name: 'import ',
48138+ name: '导出排序和过滤后的数据 ',
4810248139 handler: function handler() {
48103- self.$message('import clicked');
48140+ self.exportData({
48141+ fileName: '排序和过滤后的数据',
48142+ filtered: true
48143+ });
4810448144 },
4810548145
4810648146 icon: 'upload'
4815048190 }];
4815148191 },
4815248192 getExportActionsDef: function getExportActionsDef() {
48153- var _this = this;
48193+ var _this2 = this;
4815448194
4815548195 var columns = ['room_no', 'cellphone', 'flow_no', 'state'];
4815648196 var columnNames = ['房号', '电话号码', '订单号', '状态'];
@@ -48160,13 +48200,13 @@
4816048200 def: [{
4816148201 name: 'export all',
4816248202 handler: function handler() {
48163- (0, _CsvExport2.default)(_this .tableData1, columns, columnNames, '所有数据');
48203+ (0, _CsvExport2.default)(_this2 .tableData1, columns, columnNames, '所有数据');
4816448204 },
4816548205 icon: 'plus'
4816648206 }, {
4816748207 name: 'export filtered',
4816848208 handler: function handler() {
48169- (0, _CsvExport2.default)(_this .filteredData, columns, columnNames, '过滤后的数据');
48209+ (0, _CsvExport2.default)(_this2 .filteredData, columns, columnNames, '过滤后的数据');
4817048210 },
4817148211 icon: 'upload'
4817248212 }]
4833948379 return [];
4834048380 }
4834148381 },
48382+ border: {
48383+ type: Boolean,
48384+ default: function _default() {
48385+ return true;
48386+ }
48387+ },
48388+ stripe: {
48389+ type: Boolean,
48390+ default: function _default() {
48391+ return true;
48392+ }
48393+ },
4834248394 actionsDef: {
4834348395 type: Object,
4834448396 default: function _default() {
4934949401 },
4935049402 attrs: {
4935149403 "data": _vm.curTableData,
49352- "border": " border" ,
49404+ "border": _vm. border,
4935349405 "fit": "fit",
49354- "stripe": " stripe"
49406+ "stripe": _vm. stripe
4935549407 },
4935649408 on: {
4935749409 "sort-change": _vm.handleSort,
5563155683 /* script */
5563255684 __webpack_require__(156),
5563355685 /* template */
55634- __webpack_require__(157 ),
55686+ __webpack_require__(158 ),
5563555687 /* scopeId */
5563655688 null,
5563755689 /* cssModules */
5570155753
5570255754 var _CsvExport2 = _interopRequireDefault(_CsvExport);
5570355755
55756+ var _en = __webpack_require__(157);
55757+
55758+ var _en2 = _interopRequireDefault(_en);
55759+
55760+ var _locale = __webpack_require__(25);
55761+
55762+ var _locale2 = _interopRequireDefault(_locale);
55763+
5570455764 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5570555765
55766+ _locale2.default.use(_en2.default);
55767+
5570655768 exports.default = {
5570755769 name: 'app',
5570855770 components: {
@@ -55855,6 +55917,108 @@
5585555917
5585655918/***/ },
5585755919/* 157 */
55920+ /***/ function(module, exports) {
55921+
55922+ 'use strict';
55923+
55924+ exports.__esModule = true;
55925+ exports.default = {
55926+ el: {
55927+ colorpicker: {
55928+ confirm: 'OK',
55929+ clear: 'Clear'
55930+ },
55931+ datepicker: {
55932+ now: 'Now',
55933+ today: 'Today',
55934+ cancel: 'Cancel',
55935+ clear: 'Clear',
55936+ confirm: 'OK',
55937+ selectDate: 'Select date',
55938+ selectTime: 'Select time',
55939+ startDate: 'Start Date',
55940+ startTime: 'Start Time',
55941+ endDate: 'End Date',
55942+ endTime: 'End Time',
55943+ year: '',
55944+ month1: 'Jan',
55945+ month2: 'Feb',
55946+ month3: 'Mar',
55947+ month4: 'Apr',
55948+ month5: 'May',
55949+ month6: 'Jun',
55950+ month7: 'Jul',
55951+ month8: 'Aug',
55952+ month9: 'Sep',
55953+ month10: 'Oct',
55954+ month11: 'Nov',
55955+ month12: 'Dec',
55956+ // week: 'week',
55957+ weeks: {
55958+ sun: 'Sun',
55959+ mon: 'Mon',
55960+ tue: 'Tue',
55961+ wed: 'Wed',
55962+ thu: 'Thu',
55963+ fri: 'Fri',
55964+ sat: 'Sat'
55965+ },
55966+ months: {
55967+ jan: 'Jan',
55968+ feb: 'Feb',
55969+ mar: 'Mar',
55970+ apr: 'Apr',
55971+ may: 'May',
55972+ jun: 'Jun',
55973+ jul: 'Jul',
55974+ aug: 'Aug',
55975+ sep: 'Sep',
55976+ oct: 'Oct',
55977+ nov: 'Nov',
55978+ dec: 'Dec'
55979+ }
55980+ },
55981+ select: {
55982+ loading: 'Loading',
55983+ noMatch: 'No matching data',
55984+ noData: 'No data',
55985+ placeholder: 'Select'
55986+ },
55987+ cascader: {
55988+ noMatch: 'No matching data',
55989+ placeholder: 'Select'
55990+ },
55991+ pagination: {
55992+ goto: 'Go to',
55993+ pagesize: '/page',
55994+ total: 'Total {total}',
55995+ pageClassifier: ''
55996+ },
55997+ messagebox: {
55998+ title: 'Message',
55999+ confirm: 'OK',
56000+ cancel: 'Cancel',
56001+ error: 'Illegal input'
56002+ },
56003+ upload: {
56004+ delete: 'Delete',
56005+ preview: 'Preview',
56006+ continue: 'Continue'
56007+ },
56008+ table: {
56009+ emptyText: 'No Data',
56010+ confirmFilter: 'Confirm',
56011+ resetFilter: 'Reset',
56012+ clearFilter: 'All'
56013+ },
56014+ tree: {
56015+ emptyText: 'No Data'
56016+ }
56017+ }
56018+ };
56019+
56020+ /***/ },
56021+ /* 158 */
5585856022/***/ function(module, exports) {
5585956023
5586056024 module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
0 commit comments