Преглед на файлове

点击批量上传后建议有一个弹窗,提醒下载批量上传的模板

lifanagju_citu преди 7 месеца
родител
ревизия
dd0c809064
променени са 4 файла, в които са добавени 46 реда и са изтрити 18 реда
  1. 1 1
      components.d.ts
  2. 17 12
      src/plugins/confirm/confirm.vue
  3. 6 0
      src/plugins/confirm/index.js
  4. 22 5
      src/views/recruit/enterprise/positionManagement/index.vue

+ 1 - 1
components.d.ts

@@ -30,9 +30,9 @@ declare module 'vue' {
     DatePicker: typeof import('./src/components/DatePicker/index.vue')['default']
     DatePicker: typeof import('./src/components/DatePicker/index.vue')['default']
     Details: typeof import('./src/components/Enterprise/details.vue')['default']
     Details: typeof import('./src/components/Enterprise/details.vue')['default']
     Echarts: typeof import('./src/components/Echarts/index.vue')['default']
     Echarts: typeof import('./src/components/Echarts/index.vue')['default']
-    ElCascader: typeof import('element-plus/es')['ElCascader']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
+    ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     File: typeof import('./src/components/Upload/file.vue')['default']
     File: typeof import('./src/components/Upload/file.vue')['default']
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']

+ 17 - 12
src/plugins/confirm/confirm.vue

@@ -1,24 +1,25 @@
 <script setup>
 <script setup>
 import { ref } from 'vue'
 import { ref } from 'vue'
 
 
-defineProps({
+const props = defineProps({
   title: String,
   title: String,
   text: String,
   text: String,
   cancel: Function,
   cancel: Function,
   sure: Function,
   sure: Function,
+  other: Function,
   option: {
   option: {
     type: Object,
     type: Object,
-    default: () => {
-      return {
-        hideCancelBtn: false
-      }
-    }
+    default: () => {}
   }
   }
 })
 })
 
 
 defineOptions({ name: 'ct-confirm' })
 defineOptions({ name: 'ct-confirm' })
 
 
 const dialog = ref(true)
 const dialog = ref(true)
+const hideCancelBtn = props.option.hideCancelBtn || false
+const cancelText = props.option.cancelText || '取消'
+const sureText = props.option.sureText || '确认'
+const otherBtnText = props.option.otherBtnText || ''
 // const show = () => {
 // const show = () => {
 //   dialog.value = true
 //   dialog.value = true
 // }
 // }
@@ -34,8 +35,8 @@ const dialog = ref(true)
     >
     >
 
 
       <v-card
       <v-card
-        :text="text"
-        :title="title"
+        :text="props.text"
+        :title="props.title"
       >
       >
         <template #prepend>
         <template #prepend>
           <v-icon color="warning">mdi-alert-circle-outline</v-icon>
           <v-icon color="warning">mdi-alert-circle-outline</v-icon>
@@ -43,12 +44,16 @@ const dialog = ref(true)
         <template v-slot:actions>
         <template v-slot:actions>
           <v-spacer></v-spacer>
           <v-spacer></v-spacer>
 
 
-          <v-btn v-if="hideCancelBtn" @click="cancel">
-            取消
+          <v-btn v-if="!hideCancelBtn" @click="props.cancel">
+            {{ cancelText }}
           </v-btn>
           </v-btn>
 
 
-          <v-btn color="success" @click="sure">
-            确认
+          <v-btn v-if="otherBtnText" color="warning" @click="props.other">
+            {{ otherBtnText }}
+          </v-btn>
+
+          <v-btn color="success" @click="props.sure">
+            {{ sureText }}
           </v-btn>
           </v-btn>
         </template>
         </template>
       </v-card>
       </v-card>

+ 6 - 0
src/plugins/confirm/index.js

@@ -10,6 +10,7 @@ const toastMessage  = (title, text, option = {})  => {
       const app = createApp(confirm, {
       const app = createApp(confirm, {
         title,
         title,
         text,
         text,
+        option,
         cancel () {
         cancel () {
           app.unmount()
           app.unmount()
           rootNode.remove()
           rootNode.remove()
@@ -21,6 +22,11 @@ const toastMessage  = (title, text, option = {})  => {
           app.unmount()
           app.unmount()
           rootNode.remove()
           rootNode.remove()
           resolve()
           resolve()
+        },
+        other () {
+          app.unmount()
+          rootNode.remove()
+          resolve({ otherClick: true })
         }
         }
       })
       })
       app.use(vuetify)
       app.use(vuetify)

+ 22 - 5
src/views/recruit/enterprise/positionManagement/index.vue

@@ -6,10 +6,12 @@
       </div>
       </div>
       <div class="text-end">
       <div class="text-end">
         <v-btn prepend-icon="mdi-plus" color="primary" @click="handleAdd">{{ $t('position.newPositionsAdded') }}</v-btn>
         <v-btn prepend-icon="mdi-plus" color="primary" @click="handleAdd">{{ $t('position.newPositionsAdded') }}</v-btn>
-        <v-btn :loading="uploadLoading" prepend-icon="mdi-download-box-outline" color="primary" variant="tonal" class="ml-3" @click="handleUpload">
-          批量上传职位
+        <span>
+          <v-btn :loading="uploadLoading" prepend-icon="mdi-download-box-outline" color="primary" variant="tonal" class="ml-3" @click="handleUploadBefore">
+            批量上传职位
+          </v-btn>
           <File ref="uploadFile" :custom="true" customName="multipartFile" accept=".xlsx, .xls" @success="handleUploadPosition"></File>
           <File ref="uploadFile" :custom="true" customName="multipartFile" accept=".xlsx, .xls" @success="handleUploadPosition"></File>
-        </v-btn>
+        </span>
         <v-btn :loading="templateLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleDownloadTemplate">批量上传模版下载</v-btn>
         <v-btn :loading="templateLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleDownloadTemplate">批量上传模版下载</v-btn>
         <v-btn :loading="exportLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleExport">职位列表下载</v-btn>
         <v-btn :loading="exportLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleExport">职位列表下载</v-btn>
       </div>
       </div>
@@ -48,6 +50,7 @@ import { useI18n } from '@/hooks/web/useI18n'
 import { useUserStore } from '@/store/user'
 import { useUserStore } from '@/store/user'
 import download from '@/utils/download'
 import download from '@/utils/download'
 import Snackbar from '@/plugins/snackbar'
 import Snackbar from '@/plugins/snackbar'
+import Confirm from '@/plugins/confirm'
 
 
 const store = useUserStore()
 const store = useUserStore()
 
 
@@ -136,9 +139,23 @@ const handleDownloadTemplate = async () => {
 }
 }
 
 
 // 批量上传
 // 批量上传
-const handleUpload = () => {
-  uploadFile.value.trigger()
+const handleUploadBefore = () => {
+  const option = {
+    otherBtnText: '去下载模板',
+    sureText: '继续上传',
+  }
+  // debugger
+  Confirm(t('common.confirmTitle'), '如还未下载过批量上传的模板,请先下载,并且使用模板格式上传职位', option).then((obj) => {
+    // debugger
+    if (obj?.otherClick) {
+      Snackbar.info('开始下载!')
+      handleDownloadTemplate()
+    } else {
+      uploadFile.value.trigger()
+    }
+  })
 }
 }
+
 const handleUploadPosition = async (formData) => {
 const handleUploadPosition = async (formData) => {
   uploadLoading.value = true
   uploadLoading.value = true
   try {
   try {