|  |  |  | 
|---|
|  |  |  | cols.push.apply(cols, matCols); | 
|---|
|  |  |  | cols.push( | 
|---|
|  |  |  | {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return cols; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | url: baseUrl+"/mat/export/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: JSON.stringify(param), | 
|---|
|  |  |  | dataType:'json', | 
|---|
|  |  |  | // dataType:'json', | 
|---|
|  |  |  | contentType:'application/json;charset=UTF-8', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | xhrFields: { | 
|---|
|  |  |  | responseType: "blob" // 设置响应类型为二进制数据 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | // 创建一个临时的下载链接 | 
|---|
|  |  |  | const url = window.URL.createObjectURL(res); | 
|---|
|  |  |  | // 创建一个隐藏的 <a> 元素并设置下载链接 | 
|---|
|  |  |  | const a = document.createElement("a"); | 
|---|
|  |  |  | a.style.display = "none"; | 
|---|
|  |  |  | a.href = url; | 
|---|
|  |  |  | a.download = "export.xlsx"; // 指定下载的文件名 | 
|---|
|  |  |  | document.body.appendChild(a); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 触发点击事件以开始下载 | 
|---|
|  |  |  | a.click(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 清理临时资源 | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | window.URL.revokeObjectURL(url); | 
|---|
|  |  |  | document.body.removeChild(a); | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | }, 100); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | fail: function (){ | 
|---|
|  |  |  | layer.msg('导出失败', {icon: 2}) | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | table.exportFile(titles,res.data,'xls'); | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(editSubmit)', function (data) { | 
|---|
|  |  |  | console.log(data) | 
|---|
|  |  |  | data.field.tagId = insXmSel.getValue('valueStr'); | 
|---|
|  |  |  | if (isEmpty(data.field.tagId)) { | 
|---|
|  |  |  | layer.msg('分类不能为空', {icon: 2}); | 
|---|