|
@@ -0,0 +1,147 @@
|
|
|
+<template>
|
|
|
+ <CzrDialog
|
|
|
+ :show="show"
|
|
|
+ :title="titleCpt"
|
|
|
+ @onClose="$emit('update:show', false)"
|
|
|
+ @onSubmit="onSubmit"
|
|
|
+ width="42.5rem"
|
|
|
+ height="auto"
|
|
|
+ :loading="state.loading"
|
|
|
+ >
|
|
|
+ <div class="bm-form">
|
|
|
+ <CzrForm ref="ref_form" :form-view="isViewCpt" layout="y">
|
|
|
+ <CzrFormColumn
|
|
|
+ required
|
|
|
+ label="工作流名称"
|
|
|
+ :span="24"
|
|
|
+ v-model:param="state.form.name"
|
|
|
+ />
|
|
|
+ <CzrFormColumn
|
|
|
+ label="工作流简介"
|
|
|
+ :span="24"
|
|
|
+ v-model:param="state.form.name"
|
|
|
+ type="textarea"
|
|
|
+ :rows="4"
|
|
|
+ />
|
|
|
+ </CzrForm>
|
|
|
+ </div>
|
|
|
+ </CzrDialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import {
|
|
|
+ computed,
|
|
|
+ getCurrentInstance,
|
|
|
+ nextTick,
|
|
|
+ reactive,
|
|
|
+ ref,
|
|
|
+ watch,
|
|
|
+} from 'vue'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { useAppStore, useDialogStore, useDictionaryStore } from '@/stores'
|
|
|
+
|
|
|
+const AppStore = useAppStore()
|
|
|
+const DictionaryStore = useDictionaryStore()
|
|
|
+const DialogStore = useDialogStore()
|
|
|
+const emit = defineEmits(['update:show', 'refresh'])
|
|
|
+const { proxy } = getCurrentInstance()
|
|
|
+const props = defineProps({
|
|
|
+ show: { default: false },
|
|
|
+ transfer: <any>{},
|
|
|
+})
|
|
|
+const state: any = reactive({
|
|
|
+ loading: false,
|
|
|
+ form: {},
|
|
|
+})
|
|
|
+const ref_form = ref()
|
|
|
+const titleCpt = computed(() => {
|
|
|
+ let t = '工作流'
|
|
|
+ switch (props.transfer.mode) {
|
|
|
+ case 'add':
|
|
|
+ t = '创建' + t
|
|
|
+ break
|
|
|
+ case 'edit':
|
|
|
+ t = '编辑' + t
|
|
|
+ break
|
|
|
+ case 'view':
|
|
|
+ t = '查看' + t
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return t
|
|
|
+})
|
|
|
+const isViewCpt = computed(() => props.transfer?.mode === 'view')
|
|
|
+watch(
|
|
|
+ () => props.show,
|
|
|
+ (n) => {
|
|
|
+ if (n) {
|
|
|
+ initDictionary()
|
|
|
+ state.form = {}
|
|
|
+ if (props.transfer.mode !== 'add') {
|
|
|
+ initData()
|
|
|
+ }
|
|
|
+ nextTick(() => {
|
|
|
+ ref_form.value.reset()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+)
|
|
|
+const initData = () => {
|
|
|
+ // state.loading = true
|
|
|
+ // appDetail(props.transfer.id)
|
|
|
+ // .then(({ data }: any) => {
|
|
|
+ // state.form = data
|
|
|
+ // if (data.icon) {
|
|
|
+ // state.icon = [{ url: data.icon, name: data.icon }]
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .catch(() => {})
|
|
|
+ // .finally(() => {
|
|
|
+ // state.loading = false
|
|
|
+ // })
|
|
|
+}
|
|
|
+const onSubmit = () => {
|
|
|
+ ref_form.value
|
|
|
+ .submit()
|
|
|
+ .then(() => {
|
|
|
+ DialogStore.confirm({
|
|
|
+ content: `请确认是否提交?`,
|
|
|
+ onSubmit: () => {
|
|
|
+ state.loading = true
|
|
|
+ if (props.transfer.mode === 'add') {
|
|
|
+ // appAdd(state.form)
|
|
|
+ // .then(() => {
|
|
|
+ // ElMessage.success(`${titleCpt.value}成功!`)
|
|
|
+ // emit('update:show', false)
|
|
|
+ // emit('refresh')
|
|
|
+ // })
|
|
|
+ // .catch(() => {})
|
|
|
+ // .finally(() => {
|
|
|
+ // state.loading = false
|
|
|
+ // })
|
|
|
+ } else if (props.transfer.mode === 'edit') {
|
|
|
+ // appEdit(state.form)
|
|
|
+ // .then(() => {
|
|
|
+ // ElMessage.success(`${titleCpt.value}成功!`)
|
|
|
+ // emit('update:show', false)
|
|
|
+ // emit('refresh')
|
|
|
+ // })
|
|
|
+ // .catch(() => {})
|
|
|
+ // .finally(() => {
|
|
|
+ // state.loading = false
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ ElMessage({
|
|
|
+ message: e[0].message,
|
|
|
+ grouping: true,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+const initDictionary = () => {}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|