diff --git a/src/utils/http/interface.js b/src/utils/http/interface.js
index a6dad28..004b3ec 100644
--- a/src/utils/http/interface.js
+++ b/src/utils/http/interface.js
@@ -279,6 +279,18 @@ export const insertMessage = data =>{
})
}
+
+export const exportExpertInfoToExcel = data =>{
+ return axios({
+ headers:{
+ "Authorization": localStorage.getItem("systemToken")
+ },
+ url: '/expert/exportExpertInfoToExcel',
+ method: 'post',
+ data
+ })
+}
+
// 默认全部倒出
// 根据需要进行
export default {
@@ -307,5 +319,6 @@ export default {
shareByCode,
getByCode,
getAllMessage,
- insertMessage
+ insertMessage,
+ exportExpertInfoToExcel
}
diff --git a/src/views/expertSystem/expertForm.vue b/src/views/expertSystem/expertForm.vue
index 97a09b7..5e61441 100644
--- a/src/views/expertSystem/expertForm.vue
+++ b/src/views/expertSystem/expertForm.vue
@@ -8,7 +8,7 @@
一键导入专家信息
- 生成专家咨询费发放表
+ 生成专家咨询费发放表
@@ -16,7 +16,7 @@
@@ -71,6 +71,7 @@
:before-close="handleClose">
+ 点击下载导入模板
import { Message } from 'element-ui'
-import { getExpertInfoByName } from '@/utils/http/interface'
-
+import { exportExpertInfoToExcel, getExpertInfoByName } from '@/utils/http/interface'
+import { saveAs } from 'file-saver'
export default {
name: 'expertForm',
data() {
@@ -119,14 +120,21 @@ export default {
//重复人员id数组
highlightedExpertIds: [],
+
+ //导出列表
+ exportList : []
}
},
methods:{
+
+ //下载导入模板
+ downloadImportTemplate(){
+ saveAs("http://"+ window.location.host +"/api/sys/专家信息导入模板.xls","专家信息导入模板.xls")
+ },
//标红重复人员
rowClassName({ row, rowIndex }){
- console.log('rowClassName called for row', row);
if (this.highlightedExpertIds.includes(row.expertId)) {
return 'red-row';
}
@@ -165,8 +173,42 @@ export default {
//多选
handleSelectionChange(val) {
- this.multipleSelection = val;
- console.log(val)
+ // 最大选择数量
+ const maxSelect = 9
+
+ if (val.length > maxSelect) {
+ this.$message({
+ type: 'warning',
+ message: `最多只能选择 ${maxSelect} 项`
+ })
+
+ // 由于 selection 是一个数组,我们需要创建一个新的数组,这样 Vue 才能检测到数组的变化。
+ // 我们取前 maxSelect 项作为新的选择
+ const newSelections = val.slice(0, maxSelect)
+
+ // 使用 nextTick 确保在 DOM 更新后再更改选择,防止出现无法预期的行为
+ this.$nextTick(() => {
+ this.$refs.table.clearSelection()
+ newSelections.forEach(row => {
+ this.$refs.table.toggleRowSelection(row, true)
+ })
+ })
+ }
+
+ this.exportList = val
+
+
+ },
+ exportFile(){
+
+ this.$api.exportExpertInfoToExcel(this.exportList).then((res) => {
+ if (res.status == 1){
+ Message.success(res.msg)
+ // console.log("http://"+ window.location.host +"/api/sys/"+ res.data)
+ saveAs("http://"+ window.location.host +"/api/sys/"+ res.data,res.data)
+ }
+ })
+
},
nameSearch(){