<template>
	<web-view v-if="url" :src="url"></web-view>
</template>

<script>
	import webview from './webview'
	
	function isNull(data) {
	  let str = `${data}`
	  return str == 'null' || str == 'undefined' || str == '';
	}
	
	export default {
		mixins: [webview],
		data() {
			return {
				definitionId: '',
				processInstanceId: '',
				taskId: '',
				category: '',
				withDealTask: '',
				withManager: '',
				
				url: '',
			};
		},
		onLoad(options) {
			
			this.processInstanceId = options.instId
			this.definitionId = options.definitionId
			this.taskId = options.id
			this.category = options.category
			this.withDealTask = options.allowDeal
			this.withManager = options.withManager
			
			let url = `${this.webviewServer}/mobile/dealTask?definitionId=${this.definitionId}&category=${this.category}&taskId=${this.taskId}&withDealTask=${this.withDealTask}&processInstanceId=${this.processInstanceId}&fromMobile=true&authtoken=${this.authtoken}`
			if(!isNull(this.withManager)) {
				url+=`&withManager=${this.withManager}`
			}
			this.url = url
		}
	}
</script>

<style lang="scss">

</style>
