|
@@ -0,0 +1,246 @@
|
|
|
+<template>
|
|
|
+ <m-dialog title="名片解析" :visible.sync="show" showDrawer :footer="false">
|
|
|
+ <div class="fullBox box-2">
|
|
|
+ <v-card class="upload-card d-flex flex-column align-center justify-center overflow-hidden" elevation="5">
|
|
|
+ <template v-if="file">
|
|
|
+ <div class="fullBox overflow-auto">
|
|
|
+ <div class="change d-flex align-center justify-end pr-3 pt-3">
|
|
|
+ <UploadBtn
|
|
|
+ :loading="loading"
|
|
|
+ :disabled="loading"
|
|
|
+ color="primary"
|
|
|
+ class="white--text"
|
|
|
+ @change="handleImport"
|
|
|
+ >
|
|
|
+ <v-icon
|
|
|
+ left
|
|
|
+ dark
|
|
|
+ >
|
|
|
+ mdi-cloud-upload
|
|
|
+ </v-icon>
|
|
|
+ 更换名片
|
|
|
+ </UploadBtn>
|
|
|
+ <v-btn color="primary" rounded class="buttons white--text ml-2" @click="handleAnalysis">
|
|
|
+ <v-icon
|
|
|
+ left
|
|
|
+ dark
|
|
|
+ >
|
|
|
+ mdi-file-arrow-left-right
|
|
|
+ </v-icon>
|
|
|
+ 解析
|
|
|
+ </v-btn>
|
|
|
+ </div>
|
|
|
+ <img width="100%" :src="previewUrl" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div>
|
|
|
+ <UploadBtn
|
|
|
+ :loading="loading"
|
|
|
+ :disabled="loading"
|
|
|
+ color="primary"
|
|
|
+ class="ma-2 white--text"
|
|
|
+ @change="handleImport"
|
|
|
+ >
|
|
|
+ <v-icon
|
|
|
+ left
|
|
|
+ dark
|
|
|
+ >
|
|
|
+ mdi-cloud-upload
|
|
|
+ </v-icon>
|
|
|
+ 点击上传
|
|
|
+ </UploadBtn>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <v-chip>请选择文件解析</v-chip>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </v-card>
|
|
|
+ <MCard class="show-card d-flex flex-column" title="名片解析" v-loading="loading">
|
|
|
+ <template #title>
|
|
|
+ <v-btn color="primary" class="buttons" rounded>
|
|
|
+ <v-icon left>mdi-send</v-icon>
|
|
|
+ 提交
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ <div class="fullBox overflow-auto">
|
|
|
+ <MForm class="mt-3" :items="formItems" v-model="formQuery">
|
|
|
+ <template #baseInfo>
|
|
|
+ <div>
|
|
|
+ <v-subheader>基础信息</v-subheader>
|
|
|
+ <v-menu
|
|
|
+ attach
|
|
|
+ :nudge-width="200"
|
|
|
+ offset-x
|
|
|
+ >
|
|
|
+ <template v-slot:activator="{ on, attrs }">
|
|
|
+ <v-avatar
|
|
|
+ class="ma-3"
|
|
|
+ v-bind="attrs"
|
|
|
+ v-on="on">
|
|
|
+ <img
|
|
|
+ src="https://cdn.vuetifyjs.com/images/john.jpg"
|
|
|
+ alt="John"
|
|
|
+ >
|
|
|
+ </v-avatar>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <v-card>
|
|
|
+ <img
|
|
|
+ style="display: block;"
|
|
|
+ src="https://cdn.vuetifyjs.com/images/john.jpg"
|
|
|
+ width="300"
|
|
|
+ alt="John"
|
|
|
+ >
|
|
|
+ </v-card>
|
|
|
+ </v-menu>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #companyInfo>
|
|
|
+ <v-subheader>公司/酒店信息</v-subheader>
|
|
|
+ </template>
|
|
|
+ <template #relationship>
|
|
|
+ <v-subheader>联系方式</v-subheader>
|
|
|
+ </template>
|
|
|
+ <template #addressInfo>
|
|
|
+ <v-subheader>地址信息</v-subheader>
|
|
|
+ </template>
|
|
|
+ <template #systemInfo>
|
|
|
+ <div class="pb-3">
|
|
|
+ <v-subheader>系统信息</v-subheader>
|
|
|
+ <div class="px-3 infoBox">
|
|
|
+ <div class="mb-3">
|
|
|
+ <span class="label">状态</span>
|
|
|
+ <v-chip small color="success">开启</v-chip>
|
|
|
+ </div>
|
|
|
+ <div class="mb-3">
|
|
|
+ <span class="label">创建时间</span>
|
|
|
+ <v-chip small color="info">2025/03/31 10:06</v-chip>
|
|
|
+ </div>
|
|
|
+ <div class="mb-3">
|
|
|
+ <span class="label">更新时间</span>
|
|
|
+ <v-chip small color="info">2025/03/31 11:48</v-chip>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </MForm>
|
|
|
+ </div>
|
|
|
+ </MCard>
|
|
|
+ </div>
|
|
|
+ <Linear text="解析中..." :visible.sync="linearLoading"></Linear>
|
|
|
+ </m-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Linear from '@/components/Progress/linear.vue'
|
|
|
+import UploadBtn from '@/components/UploadBtn'
|
|
|
+import MDialog from '@/components/Dialog'
|
|
|
+import MCard from '@/components/MCard'
|
|
|
+import MForm from '@/components/MForm'
|
|
|
+export default {
|
|
|
+ name: 'imageImportEdit',
|
|
|
+ components: {
|
|
|
+ MDialog,
|
|
|
+ MCard,
|
|
|
+ UploadBtn,
|
|
|
+ Linear,
|
|
|
+ MForm
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ linearLoading: false,
|
|
|
+ loading: false,
|
|
|
+ show: false,
|
|
|
+ file: null,
|
|
|
+ previewUrl: null,
|
|
|
+ formItems: [
|
|
|
+ { slotName: 'baseInfo' },
|
|
|
+ { label: '姓名(中)', key: 'name', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '姓名(英)', key: 'name', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '职位(中)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '职位(英)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { slotName: 'relationship' },
|
|
|
+ { label: '手机', key: 'post', type: 'text', outlined: true, dense: true, col: 4 },
|
|
|
+ { label: '电话', key: 'post', type: 'text', outlined: true, dense: true, col: 4 },
|
|
|
+ { label: '邮箱', key: 'post', type: 'text', outlined: true, dense: true, col: 4 },
|
|
|
+ { slotName: 'companyInfo' },
|
|
|
+ { label: '酒店名称(中)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '酒店名称(英)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '品牌名称(中)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '品牌名称(英)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { slotName: 'addressInfo' },
|
|
|
+ { label: '详细地址(中)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { label: '详细地址(英)', key: 'post', type: 'text', outlined: true, dense: true, col: 6 },
|
|
|
+ { slotName: 'systemInfo' }
|
|
|
+ ],
|
|
|
+ formQuery: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open (item) {
|
|
|
+ this.show = true
|
|
|
+ this.loading = false
|
|
|
+ if (!item) {
|
|
|
+ this.file = null
|
|
|
+ this.previewUrl = null
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 获取文件内容
|
|
|
+ this.file = null
|
|
|
+ this.handlePreview(this.file)
|
|
|
+ },
|
|
|
+ async handleImport (file) {
|
|
|
+ this.loading = true
|
|
|
+ this.file = file
|
|
|
+ this.handlePreview(file, () => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handlePreview (file, cb) {
|
|
|
+ // 创建预览
|
|
|
+ const reader = new FileReader()
|
|
|
+ reader.onload = (e) => {
|
|
|
+ this.previewUrl = e.target.result
|
|
|
+ cb()
|
|
|
+ }
|
|
|
+ reader.readAsDataURL(file)
|
|
|
+ },
|
|
|
+ handleAnalysis () {
|
|
|
+ this.linearLoading = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.linearLoading = false
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.fullBox {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+.upload-card {
|
|
|
+ // position: relative;
|
|
|
+ .change {
|
|
|
+ position: sticky;
|
|
|
+ top: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+.box-2 {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: 1fr 1fr;
|
|
|
+ grid-gap: 15px;
|
|
|
+}
|
|
|
+.infoBox {
|
|
|
+ .label {
|
|
|
+ width: 100px;
|
|
|
+ display: inline-block;
|
|
|
+ text-align: right;
|
|
|
+ margin-right: 10px;
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|