/** * 按钮处理 业务类型审签 */ import {paramLow,callPreEvent, callPostEvent} from '../BaseAction'; import {validatenull} from "@/util/validate"; import Vue from "vue"; import func from "@/util/func"; import {download} from "@/api/base/file"; export const doAction = (options,callback) => { console.log(options) options.sourceData = options.sourceData || {}; options.dataStore = options.dataStore || []; if (!options.dataStore || options.dataStore.length < 1) { Vue.prototype.$message.error("请选择需要下载的数据"); return false; } if (!options.paramVOS.multi && options.dataStore.length > 1) { Vue.prototype.$message.error("仅能选择一条数据进行下载"); return false; } callPreEvent(options, doBefore, function (options) { showStartWindow(options, function () { callPostEvent(options, doAfter, callback,'downloadfile'); }); }); }; /** * 显示流程的窗口 * @param options 按钮的配置信息 * @param callback 回调 */ export const showStartWindow = (options,callback)=> { const paramVOS = options.paramVOS; const oids = options.dataStore.map(item => item.oid).join(','); let data = new FormData(); data.append('fileOid',oids); download(data).then(res => { if (res) { func.downloadFileByBlobHandler(res); Vue.prototype.$message.success("下载成功"); } }).catch(err => { console.log(err); }); // if (!paramVOS['form'] && !paramVOS['context']) { // Vue.prototype.$message.error("按钮配置不正确"); // return false; // } // func.downloadFileByBlobHandler(); } /** * 前置事件 * @param options 按钮的配置信息 * @param callback 回调 */ export const doBefore = (options,callback)=> { console.log("执行增加前置事件") if(callback){ callback(options); } } /** * 后置事件 * @param options 按钮的配置信息 * @param callback 回调 */ export const doAfter = (options,callback,actionType)=> { console.log('执行增加后置事件'); if(callback){ callback(actionType); } }