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

update

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