| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <script setup lang="ts">
- import router from "@r"
- const props = withDefaults(
- defineProps<{
- id?: string
- status?: string
- pageType?: string
- buttonLoading?: boolean
- }>(),
- {
- id: "",
- status: "",
- pageType: "",
- buttonLoading: false
- }
- )
- const emits = defineEmits<{
- (e: "submit", v: string): void
- (e: "approvalVerify"): void
- (e: "approvalRecord"): void
- }>()
- //校验提交按钮是否显示
- const submitButtonShow = computed(() => {
- return (
- props.pageType === "add" ||
- (props.pageType === "update" &&
- props.status &&
- (props.status === "draft" || props.status === "cancel" || props.status === "back"))
- )
- })
- //校验审批按钮是否显示
- const approvalButtonShow = computed(() => {
- return props.pageType === "approval" && props.status && props.status === "waiting"
- })
- function handleSubmit(type: string) {
- emits("submit", type)
- }
- //审批
- function handleApprovalVerifyOpen() {
- emits("approvalVerify")
- }
- //审批记录
- const handleApprovalRecord = () => {
- emits("approvalRecord")
- }
- //返回
- const goBack = () => {
- router.go(-1)
- }
- function init() {
- //
- }
- //暂存,提交
- onMounted(init)
- </script>
- <template>
- <div style="display: flex; justify-content: space-between">
- <div>
- <el-button
- v-if="submitButtonShow"
- :loading="props.buttonLoading"
- type="info"
- @click="handleSubmit('draft')">
- 暂存
- </el-button>
- <el-button
- v-if="submitButtonShow"
- :loading="props.buttonLoading"
- type="primary"
- @click="handleSubmit('submit')">
- 提 交
- </el-button>
- <el-button
- v-if="approvalButtonShow"
- :loading="props.buttonLoading"
- type="primary"
- @click="handleApprovalVerifyOpen">
- 审批
- </el-button>
- <el-button
- v-if="props.id && props.status !== 'draft'"
- type="primary"
- @click="handleApprovalRecord">
- 流程进度
- </el-button>
- <slot />
- </div>
- <div>
- <el-button style="float: right" @click="goBack()">返回</el-button>
- </div>
- </div>
- </template>
|