|
@@ -44,10 +44,20 @@
|
|
|
<span>删除</span>
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ icon="Download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<div class="ruleItemTableData">
|
|
|
- <el-table :data="ruleDetailData" style="width: 100%"
|
|
|
+ <el-table :data="ruleDetailData" style="width: 100%" ref="ruleItemTableData"
|
|
|
@select="rowClick" @select-all="rowClick" @row-dblclick="handleEdit">
|
|
|
<el-table-column type="selection" label="操作" align="center"></el-table-column>
|
|
|
<el-table-column type="index" label="序号" align="center"></el-table-column>
|
|
@@ -115,6 +125,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import * as XLSX from 'xlsx'
|
|
|
+import { saveAs } from 'file-saver'
|
|
|
+import * as XLSXD from 'xlsx-js-style'
|
|
|
import addW from '../../assets/btnIcon/addW.png'
|
|
|
import editW from '../../assets/btnIcon/editW.png'
|
|
|
import deleteW from '../../assets/btnIcon/deleteW.png'
|
|
@@ -301,7 +314,25 @@ export default {
|
|
|
that.getruleDetailData(that.rowevalradio)
|
|
|
})
|
|
|
})
|
|
|
- },
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ let $e = this.$refs.ruleItemTableData.$el
|
|
|
+ try {
|
|
|
+ let $table = $e.querySelector('.el-table__fixed')
|
|
|
+ if(!$table) {
|
|
|
+ $table = $e
|
|
|
+ }
|
|
|
+ const wb = XLSX.utils.table_to_book($table, {raw:true})
|
|
|
+
|
|
|
+ const wbout = XLSXD.write(wb, {bookType: 'xlsx', bookSST:true, type: 'array'})
|
|
|
+ saveAs(
|
|
|
+ new Blob([wbout],{type: 'application/octet-stream'}),
|
|
|
+ `考评规则详情数据导出.xlsx`,
|
|
|
+ )
|
|
|
+ } catch (e) {
|
|
|
+ if (typeof console !== 'undefined') console.error(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
rowClick(selection, row) {
|
|
|
this.changeDateSelect = selection
|
|
|
},
|