<template>
	<div>

		<el-card :body-style="cardBodyStyle">
			公共调用方法
			<el-button type="primary" @click="handlePackage">包</el-button>
			<el-button type="primary" @click="handlePackageException">包错误</el-button>
			自定义调用方法
			<el-button type="primary" @click="handlePackageCustomer">包</el-button>
			<el-button type="primary" @click="handlePackageExceptionCustomer">包错误</el-button>


			<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea">
			</el-input>
		</el-card>


	</div>
</template>


<script setup>
	import {
		ref,
		reactive,
		onMounted,
		getCurrentInstance
	} from 'vue'

	const {
		proxy
	} = getCurrentInstance()

	import tools from '@/tools'
	const cardBodyStyle = ref(tools.style.card)

	const textarea = ref('')


	const handlePackage = () => {
		textarea.value = ''
		var url = 'framework/Common/doProc'
		var param = {
			procName: 'PKG_EXP.P_EXP_COMMIT',
			param: JSON.stringify(['1', '2', '4']),
		}
		proxy.$axios.post(url, param).then(response => {
			if (response.data.code == '0') {
				textarea.value = response.data.data
			} else {
				ElMessage({
					type: 'error',
					message: '操作失败！' + response.data.msg,
				});
			}
		});
	}
	
	const handlePackageException = () => {
		textarea.value = ''
		var url = 'framework/Common/doProc'
		var param = {
			procName: 'PKG_EXP.P_EXP_EXCEPTION',
			param: JSON.stringify(['1', '2', '4']),
		}
		proxy.$axios.post(url, param).then(response => {
			if (response.data.code == '0') {
				textarea.value = response.data.data
			} else {
				ElMessage({
					type: 'error',
					message: '操作失败！' + response.data.msg,
				});
			}
		});
	}
	
	
	
	
	
	const handlePackageCustomer = () => {
		textarea.value = ''
		var url = 'exp/Package/doProc'
		var param = {
			procName: 'PKG_EXP.P_EXP_COMMIT',
			param: JSON.stringify(['1', '2', '4']),
		}
		proxy.$axios.post(url, param).then(response => {
			if (response.data.code == '0') {
				textarea.value = response.data.data
			} else {
				ElMessage({
					type: 'error',
					message: '操作失败！' + response.data.msg,
				});
			}
		});
	}
	
	const handlePackageExceptionCustomer = () => {
		textarea.value = ''
		var url = 'exp/Package/doProc'
		var param = {
			procName: 'PKG_EXP.P_EXP_EXCEPTION',
			param: JSON.stringify(['1', '2', '4']),
		}
		proxy.$axios.post(url, param).then(response => {
			if (response.data.code == '0') {
				textarea.value = response.data.data
			} else {
				ElMessage({
					type: 'error',
					message: '操作失败！' + response.data.msg,
				});
			}
		});
	}
</script>

<style>
</style>