Ecology9 ecode 批量转办

search.js(自定义查询代码块)

var ecustom_api = {
	clickEvent_zhuanban: function() {	// 转办
		var ids = ModeList.getCheckedID()
		if (ids === '') {
			weaJs.alert('未选择行!')
			return 
		}
		
		var options = {
			title: '批量转办',
			moduleName: 'workflow',
			style: { width: 800, height: 420 },
			callback: function() {},
			onCancel: function() {},
		};
		weaJs.showDialog('/spa/custom/static/index.html#/main/cs/app/b1d3c61db6724e859dfc612c682b14c5_index', options);
		
		ids = ids.indexOf(',') < 0 ? [ids] : ids.split(',')
	}
}

window.clickEvent_zhuanban = ecustom_api.clickEvent_zhuanban	// 转办

register.js

ecodeSDK.rewriteRouteQueue.push({
	fn: (params) => {
		const {Com, Route, nextState} = params;
		const cpParams = {
			path: 'main/cs/app', // 路由地址,不可变更
			appId: '${appId}',
			name: 'index', // 具体页面应用模块名称
			node: 'app', // 渲染的路由节点,这里渲染的是 app 这个节点
			Route,
			nextState
		}
		
		if (ecodeSDK.checkPath(cpParams)) { // 判断地址是否是要注入的地址
			// 异步加载应用 ${cpParams.appId} 下的模块 ${cpParams.name}
			return ecodeSDK.getAsyncCom({
				appId: cpParams.appId,
				name: cpParams.name,	// 模块名称
				props: params,	// 参数
				isPage: true,	// 是否是路由页面
				noCss: true	// 是否禁止单独加载css,通常为了减少css数量,css默认前置加载
			});
		}
			
		return null; // 这里一定要返回空,不然会干扰到其它新页面
	},
	order: 10,
	desc: '会计审批通用台账-转发'
});

index.js

/**
 * 门户主页访问:/wui/index.html#/main/cs/app/b1d3c61db6724e859dfc612c682b14c5_index
 * 单独访问:/spa/custom/static/index.html#/main/cs/app/b1d3c61db6724e859dfc612c682b14c5_index
 * 转办查询:/spa/cube/index.html#/main/cube/search?customid=81&_key=wy5yhd
 */
const { WeaBrowser, WeaRichText } = ecCom
const { Button, message } = antd

class Index extends React.Component {

	constructor(props) {
		super(props)
		this.state = {
			remark: '',	// 签字意见
			jsr: ''	// 转办接收人
		}
		
		this.browserParams = {
			isSingle: false	// 是否单选
		}
		
		this.basicToolBar = {
			toolbar: [{
				name: 'document',
				items: [
					'Source',	// 源码
					'Docprops',	// 
					'-',
					'Save',	// 保存
					'NewPage',	// 新建
					'Preview',	// 预览
					'Print',	// 打印
					'-',
					'Templates'	// 模板
				]
			}]
		}
	}
	
	callApi_zhuanban = function(reqids) {	// 调用服务端执行转办
		if (reqids.length === 0) {	// 如果没有要协办的请求ID(或者已经全部执行完了)
			this.callback_zhuanban_finish()	// 执行批量转办结束的方法
			return
		}
		let reqid = reqids.shift()	// 获取第1个RequestId后从数组中删除
		
		let params = {	// 转办(最少)请求参数
			operate: 'save',
			field5: this.state.jsr,	// 转发接收人,支持多人
			forwardflag: 3,	// 3:转办
			requestid: reqid,	// 需要转办的 requestId
			remark: this.refs.richtext.getEditor().getData()	// 签字意见
		}
		
		let options = {
			url: '/api/workflow/reqform/remarkOperate',
			method: 'POST',
			params : params
		}
		
		let that = this	// 保存 this 引用
		
		weaJs.callApi(options).then(function(){	// 在服务端执行转办
			that.callApi_zhuanban(reqids)
		})
	}
	
	callback_zhuanban_finish = function() {	// 批量转办执行完成后需要执行的函数
		message.info('转办完成!')
		parent.location.reload()
	} 
	
	changeEvent_jsr = function(ids, names, objs) {	// 保存转办接收人
		this.setState({jsr: ids})
	}
	
	clickEvent_submit = function() {	// 转办提交按钮事件
		if (this.state.jsr === '') {
			message.info('请选择转办接收人')
			return
		}
		reqids = parent.ModeList.getCheckedID()	// 获取父查询页面中勾选的请求ID
		reqids = reqids.indexOf(',') > 0 ? reqids.split(',') : [reqids],
		this.callApi_zhuanban(reqids)	// 执行转办
	}

	render() {
		return (
			<div style={{marginTop: '10px', marginRight: '10px', marginBottom: '10px', marginLeft: '10px'}}>
				<div style={{height: '30px'}}>
					<div style={{float: 'left', lineHeight: '30px'}}>转办接收人:</div>
					<div style={{float: 'left', width: '50%'}}>
						<WeaBrowser
							fieldName="jsr"
							type={17}
							title="请选择"
							isShowGroup
							linkUrl="/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/"
							onChange={this.changeEvent_jsr.bind(this)}
							{...this.browserParams}
						/>
					</div>
				</div>
				
				<div style={{marginTop: '15px'}}>
					<WeaRichText	// 富文本编辑器
						placeholder=''
						ref='richtext'
						value={this.state.remark}
						ckConfig={this.basicToolBar}
					/>
				</div>
				
				<div style={{textAlign: 'center', marginTop: '15px'}}>
					<Button type="primary" onClick={this.clickEvent_submit.bind(this)}>提交</Button>
				</div>
			</div>
		)
	}
}

ecodeSDK.setCom('${appId}', 'index', Index)
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值