|
@@ -3,7 +3,6 @@
|
|
|
:show="show"
|
|
|
:title="titleCpt"
|
|
|
@onClose="$emit('update:show', false)"
|
|
|
- @onSubmit="onSubmit"
|
|
|
width="62.5rem"
|
|
|
height="auto"
|
|
|
max-height="36rem"
|
|
@@ -12,10 +11,10 @@
|
|
|
:show-close="false"
|
|
|
>
|
|
|
<template #foot>
|
|
|
- <div class="__czr-dialog-foot_submit __hover" v-if="transfer.mode === 'add'" @click="onCreate(true)">创建并导入</div>
|
|
|
- <div class="__czr-dialog-foot_cancel __hover" v-if="transfer.mode === 'add'" @click="onCreate(false)">完成创建</div>
|
|
|
- <div class="__czr-dialog-foot_cancel __hover" v-if="transfer.mode === 'edit'" @click="onSubmit">保存</div>
|
|
|
- <div class="__czr-dialog-foot_cancel __hover">取消</div>
|
|
|
+ <div class="__czr-dialog-foot_submit __hover" v-if="transfer.mode === 'add'" @click="onSubmit(true)">创建并导入</div>
|
|
|
+ <div class="__czr-dialog-foot_cancel __hover" v-if="transfer.mode === 'add'" @click="onSubmit(false)">完成创建</div>
|
|
|
+ <div class="__czr-dialog-foot_submit __hover" v-if="transfer.mode === 'edit'" @click="onSubmit(false)">保存</div>
|
|
|
+ <div class="__czr-dialog-foot_cancel __hover" @click="$emit('update:show', false)">取消</div>
|
|
|
</template>
|
|
|
<div class="bm-form">
|
|
|
<div class="__czr-title_1">基本信息</div>
|
|
@@ -51,9 +50,12 @@
|
|
|
<script setup lang="ts">
|
|
|
import {computed, getCurrentInstance, nextTick, reactive, ref, watch} from "vue";
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
-import {useDictionaryStore} from "@/stores";
|
|
|
+import {useDialogStore, useDictionaryStore} from "@/stores";
|
|
|
+import {useRouter} from "vue-router";
|
|
|
|
|
|
+const router = useRouter()
|
|
|
const DictionaryStore = useDictionaryStore();
|
|
|
+const DialogStore = useDialogStore();
|
|
|
const emit = defineEmits(['update:show', 'refresh'])
|
|
|
const {proxy} = getCurrentInstance()
|
|
|
const props = defineProps({
|
|
@@ -70,7 +72,7 @@ const titleCpt = computed(() => {
|
|
|
switch (props.transfer.mode) {
|
|
|
case 'add': t = '创建' + t
|
|
|
break
|
|
|
- case 'edit': t = t + '编辑'
|
|
|
+ case 'edit': t = '编辑' + t
|
|
|
break
|
|
|
case 'view': t = '查看' + t
|
|
|
break
|
|
@@ -94,19 +96,27 @@ const initDictionary = () => {
|
|
|
}
|
|
|
const initData = () => {
|
|
|
}
|
|
|
-const onSubmit = () => {
|
|
|
+const onSubmit = (isImport) => {
|
|
|
ref_form.value.submit().then(() => {
|
|
|
- ElMessageBox.confirm("是否提交?", "提示", {
|
|
|
- confirmButtonText: "是",
|
|
|
- cancelButtonText: "否",
|
|
|
- type: "warning",
|
|
|
- } as any).then(() => {
|
|
|
- state.loading = true
|
|
|
- ElMessage.success('新增成功!')
|
|
|
- emit('update:show', false)
|
|
|
- emit('refresh')
|
|
|
- state.loading = false
|
|
|
- }).catch(() => {})
|
|
|
+ DialogStore.confirm({
|
|
|
+ content: `请确认是否${titleCpt.value}?${isImport ? '创建成功后将自动跳转至文档上传页面!' : ''}`,
|
|
|
+ onSubmit: () => {
|
|
|
+ state.loading = true
|
|
|
+ ElMessage.success(`${titleCpt.value}成功!`)
|
|
|
+ if (isImport) {
|
|
|
+ router.push({
|
|
|
+ name: '18e6009c-a72c-4359-864b-e7725fccca69',
|
|
|
+ params: {
|
|
|
+ id: '知识库ID'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ emit('update:show', false)
|
|
|
+ emit('refresh')
|
|
|
+ }
|
|
|
+ state.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
}).catch((e) => {
|
|
|
ElMessage({
|
|
|
message: e[0].message,
|
|
@@ -115,9 +125,6 @@ const onSubmit = () => {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
-const onCreate = (isImport) => {
|
|
|
-
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|