提交 6818126e authored 作者: 陈志磊's avatar 陈志磊

update

上级 fd51d195
......@@ -115,7 +115,6 @@
"useArrayFilter": true,
"useArrayFind": true,
"useArrayFindIndex": true,
"useArrayFindLast": true,
"useArrayJoin": true,
"useArrayMap": true,
"useArrayReduce": true,
......
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
// Generated by 'unplugin-auto-import'
export {}
declare global {
const $$: typeof import('vue/macros')['$$']
......@@ -112,7 +109,6 @@ declare global {
const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter']
const useArrayFind: typeof import('@vueuse/core')['useArrayFind']
const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex']
const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast']
const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin']
const useArrayMap: typeof import('@vueuse/core')['useArrayMap']
const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce']
......@@ -280,5 +276,5 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
export type { Component,ComponentPublicInstance,ComputedRef,InjectionKey,PropType,Ref,VNode } from 'vue'
}
......@@ -127,7 +127,9 @@ const handlePreview: UploadProps['onPreview'] = uploadFile => {
:on-preview="handlePreview"
:on-success="handleSuccess"
:file-list="fileList"
class="uploader">
:limit="limit"
class="uploader"
>
<slot>
<template v-if="showFileList">
<template v-if="$attrs['list-type'] === 'picture-card'">
......
......@@ -139,7 +139,8 @@ function handleRule(row: Label) {
v-model="formVisible"
:data="currentRow"
@update="handleRefresh"
v-if="formVisible"></LabelFormDialog>
v-if="formVisible"
></LabelFormDialog>
<!-- 查看标签 -->
<LabelViewDialog v-model="viewVisible" :data="currentRow" v-if="viewVisible && currentRow"></LabelViewDialog>
<!-- 规则 -->
......
......@@ -61,20 +61,26 @@ export function getMemberImage(params: { id: string }) {
}
// 导入事件
export function importEvent(data: { event_id: string; file: any }) {
return httpRequest.post('/api/lab/v1/experiment/member/event-upload', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
export function importEvent(data: { event_id: string; url: string, name: string, size: string }) {
return httpRequest.post('/api/lab/v1/experiment/member/event-upload', data)
}
// 导入用户
export function importMember(data: { groups_id?: string; connection_id: string; file: any }) {
return httpRequest.post('/api/lab/v1/experiment/member/member-upload', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
// export function importMember(data: { groups_id?: string; connection_id: string; file: any }) {
// return httpRequest.post('/api/lab/v1/experiment/member/member-upload', data, {
// headers: { 'Content-Type': 'multipart/form-data' }
// })
// }
export function importMember(data: { groups_id?: string; connection_id: string; url: string, name: string, size: string }) {
return httpRequest.post('/api/lab/v1/experiment/member/member-upload', data)
}
// 用户画像
export function getMemberGroups() {
return httpRequest.get('/api/lab/v1/experiment/member/groups')
}
// 导入进度
export function getProgress() {
return httpRequest.get('/api/lab/v1/experiment/member/tasks')
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage } from 'element-plus'
import { getEventList, importEvent } from '../api'
import type { EventProp } from '../types'
import AppUpload from '@/components/base/AppUpload.vue'
const route = useRoute()
......@@ -41,15 +42,25 @@ const downloadTemplate = function () {
}
// 上传
const fetchFileUpload = (option: any) => {
return new Promise(() => {
importEvent({ event_id: form.event_id, file: option.file }).then(() => {
const fetchFileUpload = () => {
if (fileData[0]) {
const params = Object.assign(form, fileData[0])
importEvent(params).then(() => {
ElMessage.success('导入数据成功')
emit('update')
emit('update:modelValue', false)
})
})
}
// return new Promise(() => {
// importEvent({ event_id: form.event_id, file: option.file }).then(() => {
// ElMessage.success('导入数据成功')
// emit('update')
// emit('update:modelValue', false)
// })
// })
}
const fileData = $ref([])
</script>
<template>
......@@ -70,7 +81,10 @@ const fetchFileUpload = (option: any) => {
</el-form>
<div class="btn-box">
<el-button style="margin-right: 20px" type="primary" @click="downloadTemplate">下载事件数据模板</el-button>
<el-upload
<AppUpload v-model="fileData" :limit="1">
<el-button type="primary">上传事件数据</el-button>
</AppUpload>
<!-- <el-upload
class="upload-demo"
action="#"
multiple
......@@ -80,10 +94,10 @@ const fetchFileUpload = (option: any) => {
:http-request="fetchFileUpload"
>
<el-button type="primary">上传事件数据</el-button>
</el-upload>
</el-upload> -->
</div>
<div class="btn-box">
<el-button type="primary" @click="$emit('update:modelValue', false)">关闭</el-button>
<el-button type="primary" style="margin-top: 30px" @click="fetchFileUpload">导入</el-button>
</div>
</el-dialog>
</template>
......@@ -93,5 +107,13 @@ const fetchFileUpload = (option: any) => {
text-align: center;
margin-bottom: 20px;
justify-content: center;
.uploader {
flex: none !important;
}
.el-upload-list {
width: 90%;
position: absolute;
left: 0;
}
}
</style>
......@@ -3,6 +3,7 @@ import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage } from 'element-plus'
import { getMemberConnectionsList, getMemberGroups, importMember } from '../api'
import type { ConnectionsProp } from '../types'
import AppUpload from '@/components/base/AppUpload.vue'
const route = useRoute()
......@@ -10,7 +11,6 @@ const emit = defineEmits<{
(e: 'update'): void
(e: 'update:modelValue', visible: boolean): void
}>()
const formRef = $ref<FormInstance>()
const form = reactive({
connection_id: '',
......@@ -40,16 +40,18 @@ const downloadTemplate = function () {
}
// 上传
const fetchFileUpload = (option: any) => {
return new Promise(() => {
const params = Object.assign(form, { file: option.file })
const fetchFileUpload = () => {
if (fileData[0]) {
const params = Object.assign(form, fileData[0])
importMember(params).then(() => {
ElMessage.success('导入数据成功')
emit('update')
emit('update:modelValue', false)
})
})
}
}
const fileData = $ref([])
</script>
<template>
......@@ -73,8 +75,11 @@ const fetchFileUpload = (option: any) => {
</el-form-item>
</el-form>
<div class="btn-box">
<el-button style="margin-right: 20px" type="primary" @click="downloadTemplate">下载用户数据模板</el-button>
<el-upload
<el-button type="primary" style="margin-right: 20px" @click="downloadTemplate">下载用户数据模板</el-button>
<AppUpload v-model="fileData" :limit="1">
<el-button type="primary">上传用户数据</el-button>
</AppUpload>
<!-- <el-upload
class="upload-demo"
action="#"
multiple
......@@ -84,18 +89,27 @@ const fetchFileUpload = (option: any) => {
:http-request="fetchFileUpload"
>
<el-button type="primary">上传用户数据</el-button>
</el-upload>
</el-upload> -->
</div>
<div class="btn-box">
<el-button type="primary">关闭</el-button>
<el-button type="primary" style="margin-top: 30px" @click="fetchFileUpload">导入</el-button>
</div>
</el-dialog>
</template>
<style lang="scss">
.btn-box {
position: relative;
text-align: center;
margin-bottom: 20px;
display: flex;
justify-content: center;
.uploader {
flex: none !important;
}
.el-upload-list {
width: 90%;
position: absolute;
left: 0;
}
}
</style>
<script setup lang="ts">
import { getProgress } from '../api'
const route = useRoute()
const emit = defineEmits<{
(e: 'update'): void
(e: 'update:modelValue', visible: boolean): void
}>()
// 列表配置
const listOptions = computed(() => {
return {
remote: {
httpRequest: getProgress
},
columns: [
{ label: '文件名', prop: 'name' },
{ label: '大小', prop: 'size' },
{
label: '状态',
prop: 'status_name'
// computed: (row: any) => {
// return row.row.status === '0'
// ? `<span style="color: rgb(170, 2, 49)">${row.row.status_name}</span>`
// : `<span style="color: #00ac27">${row.row.status_name}</span>`
// }
},
{ label: '导入时间', prop: 'created_time' }
]
}
})
</script>
<template>
<el-dialog
class="connect-form"
title="导入用户数据"
:close-on-click-modal="false"
width="700px"
@update:modelValue="$emit('update:modelValue')"
>
<AppList v-bind="listOptions" ref="appList"></AppList>
</el-dialog>
</template>
<style lang="scss"></style>
......@@ -8,6 +8,7 @@ import type { MemberProp, ConnectionsProp } from '../types'
const UpdateDialog = defineAsyncComponent(() => import('../components/UpdateDialog.vue'))
const UploadEventsDialog = defineAsyncComponent(() => import('../components/UploadEventsDialog.vue'))
const UploadUserDialog = defineAsyncComponent(() => import('../components/UploadUserDialog.vue'))
const ViewProgressDialog = defineAsyncComponent(() => import('../components/ViewProgressDialog.vue'))
const router = useRouter()
......@@ -90,6 +91,9 @@ const userVisible = $ref(false)
// 新建、更新、查看
let updateVisible = $ref(false)
// 新建、更新、查看
let progressVisible = $ref(false)
let multipleSelection = $ref<MemberProp[]>([])
function handleSelectionChange(selection: MemberProp[]) {
multipleSelection = selection
......@@ -205,6 +209,7 @@ const downloadMember = function (isAll?: boolean) {
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button type="primary" @click="progressVisible = true">导入数据进度</el-button>
<el-button type="danger" plain :icon="Delete" :disabled="!multipleSelection.length" @click="handleRemoves()"
>删除</el-button
>
......@@ -225,4 +230,6 @@ const downloadMember = function (isAll?: boolean) {
<UploadUserDialog @update="handleRefresh" v-if="userVisible" v-model="userVisible"></UploadUserDialog>
<!-- 新建、更新、查看 -->
<UpdateDialog v-if="updateVisible" :data="currentRow" v-model="updateVisible" @update="handleRefresh"></UpdateDialog>
<!-- 查看上传 -->
<ViewProgressDialog v-if="progressVisible" v-model="progressVisible"></ViewProgressDialog>
</template>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论