<template>
	<!-- 发起人 -->
	<promoter v-if="nodeConfig.type == 0" v-model="nodeConfig" :disabled="disabled"></promoter>

	<!-- 审批人 -->
	<approver v-if="nodeConfig.type == 1" v-model="nodeConfig" :disabled="disabled"></approver>

	<!-- 抄送人 -->
	<send v-if="nodeConfig.type == 2" v-model="nodeConfig" :disabled="disabled"></send>

	<!-- 分支 -->
	<branch v-if="nodeConfig.type == 4" v-model="nodeConfig" :disabled="disabled">
		<template #default="slot">
			<node-wrap v-if="slot.node" v-model="slot.node.childNode" :disabled="disabled"></node-wrap>
		</template>
	</branch>

	<!-- 延时处理 -->
	<delay-process v-if="nodeConfig.type == 6" v-model="nodeConfig" :disabled="disabled"></delay-process>

	<!-- 触发器 -->
	<trigger v-if="nodeConfig.type == 7" v-model="nodeConfig" :disabled="disabled"></trigger>

	<node-wrap v-if="nodeConfig.childNode" v-model="nodeConfig.childNode" :disabled="disabled"></node-wrap>
</template>

<script>
import approver from './nodes/approver'
import promoter from './nodes/promoter'
import branch from './nodes/branch'
import send from './nodes/send'
import delayProcess from './nodes/delayProcess'
import trigger from './nodes/trigger'

export default {
	components: {
		approver,
		promoter,
		branch,
		send,
		delayProcess,
		trigger
	},
	props: {
		modelValue: { type: Object, default: () => {} },
		disabled: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			nodeConfig: this.modelValue
		}
	},
	watch: {
		modelValue(val) {
			this.nodeConfig = val
		},
		nodeConfig(val) {
			this.$emit('update:modelValue', val)
		}
	},
	methods: {}
}
</script>

<style></style>
