|
@@ -0,0 +1,83 @@
|
|
|
+<template>
|
|
|
+ <CzrDialog
|
|
|
+ :show="show"
|
|
|
+ title="重命名"
|
|
|
+ @onClose="$emit('update:show', false)"
|
|
|
+ @onSubmit="onSubmit"
|
|
|
+ width="33rem"
|
|
|
+ :loading="state.loading"
|
|
|
+ >
|
|
|
+ <div class="bm-form">
|
|
|
+ <CzrForm ref="ref_form" layout="y">
|
|
|
+ <CzrFormColumn
|
|
|
+ required
|
|
|
+ :span="24"
|
|
|
+ label="文件名称"
|
|
|
+ v-model:param="state.form.p1"
|
|
|
+ />
|
|
|
+ </CzrForm>
|
|
|
+ </div>
|
|
|
+ </CzrDialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import {computed, getCurrentInstance, nextTick, reactive, ref, watch} from "vue";
|
|
|
+import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
+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({
|
|
|
+ show: {default: false},
|
|
|
+ transfer: <any>{}
|
|
|
+})
|
|
|
+const state: any = reactive({
|
|
|
+ loading: false,
|
|
|
+ form: {}
|
|
|
+})
|
|
|
+const ref_form = ref()
|
|
|
+watch(() => props.show, (n) => {
|
|
|
+ if (n) {
|
|
|
+ initDictionary()
|
|
|
+ state.form = {}
|
|
|
+ if (props.transfer.mode !== 'add') {
|
|
|
+ initData()
|
|
|
+ }
|
|
|
+ nextTick(() => {
|
|
|
+ ref_form.value.reset()
|
|
|
+ })
|
|
|
+ }
|
|
|
+})
|
|
|
+const initDictionary = () => {
|
|
|
+}
|
|
|
+const initData = () => {
|
|
|
+ state.form = props.transfer.row
|
|
|
+}
|
|
|
+const onSubmit = (isImport) => {
|
|
|
+ ref_form.value.submit().then(() => {
|
|
|
+ DialogStore.confirm({
|
|
|
+ content: `请确认是否重命名文件?`,
|
|
|
+ onSubmit: () => {
|
|
|
+ state.loading = true
|
|
|
+ ElMessage.success(`重命名成功!`)
|
|
|
+ emit('update:show', false)
|
|
|
+ emit('refresh')
|
|
|
+ state.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch((e) => {
|
|
|
+ ElMessage({
|
|
|
+ message: e[0].message,
|
|
|
+ grouping: true,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|