提交 45cec009 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 统计增加刷新

上级 9e90f06d
<script setup lang="ts"> <script setup lang="ts">
import type { Group, GroupMember } from '../types' import type { Group, GroupMember } from '../types'
import { UserFilled, Plus, Delete } from '@element-plus/icons-vue' import { UserFilled, Plus, Delete, Refresh } from '@element-plus/icons-vue'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getNameByValue, groupTypeList, updateStatusRuleList, updateStatusList } from '@/utils/dictionary' import { getNameByValue, groupTypeList, updateStatusRuleList, updateStatusList } from '@/utils/dictionary'
...@@ -23,7 +23,7 @@ const connectionTypeList = useMapStore().getMapValuesByKey('experiment_connectio ...@@ -23,7 +23,7 @@ const connectionTypeList = useMapStore().getMapValuesByKey('experiment_connectio
const detail = reactive({ count: 0, status: '1', updated_time: '-' }) const detail = reactive({ count: 0, status: '1', updated_time: '-' })
function fetchInfo() { function fetchInfo() {
getGroupStatistics({ group_id: props.data.id }).then(res => { getGroupStatistics({ group_id: props.data.id }).then((res) => {
Object.assign(detail, res.data.detail) Object.assign(detail, res.data.detail)
}) })
} }
...@@ -58,7 +58,7 @@ const listOptions = computed(() => { ...@@ -58,7 +58,7 @@ const listOptions = computed(() => {
return { return {
remote: { remote: {
httpRequest: getGroupMembers, httpRequest: getGroupMembers,
params: { group_id: props.data.id } params: { group_id: props.data.id },
}, },
columns: [ columns: [
{ label: '序号', type: 'index', width: 60 }, { label: '序号', type: 'index', width: 60 },
...@@ -69,7 +69,7 @@ const listOptions = computed(() => { ...@@ -69,7 +69,7 @@ const listOptions = computed(() => {
prop: 'gender', prop: 'gender',
computed({ row }: { row: GroupMember }) { computed({ row }: { row: GroupMember }) {
return getNameByValue(row.gender, genderList) return getNameByValue(row.gender, genderList)
} },
}, },
{ label: '手机号码', prop: 'mobile' }, { label: '手机号码', prop: 'mobile' },
{ {
...@@ -77,19 +77,19 @@ const listOptions = computed(() => { ...@@ -77,19 +77,19 @@ const listOptions = computed(() => {
prop: 'experiment_connection_id', prop: 'experiment_connection_id',
computed({ row }: { row: GroupMember }) { computed({ row }: { row: GroupMember }) {
return getNameByValue(row.connection.type.toString(), connectionTypeList) return getNameByValue(row.connection.type.toString(), connectionTypeList)
} },
}, },
{ {
label: '状态', label: '状态',
prop: 'status', prop: 'status',
computed({ row }: { row: GroupMember }) { computed({ row }: { row: GroupMember }) {
return getNameByValue(row.status, statusList) return getNameByValue(row.status, statusList)
} },
}, },
{ label: '更新人', prop: 'updated_operator.real_name' }, { label: '更新人', prop: 'updated_operator.real_name' },
{ label: '更新时间', prop: 'updated_time' }, { label: '更新时间', prop: 'updated_time' },
{ label: '操作', slots: 'table-x' } { label: '操作', slots: 'table-x' },
] ],
} }
}) })
// 刷新 // 刷新
...@@ -158,6 +158,7 @@ function handleRefresh() { ...@@ -158,6 +158,7 @@ function handleRefresh() {
:disabled="['2', '4'].includes(detail.status.toString())" :disabled="['2', '4'].includes(detail.status.toString())"
>立即更新</el-button >立即更新</el-button
> >
<el-button size="small" :icon="Refresh" @click="handleRefresh"></el-button>
</dd> </dd>
</dl> </dl>
</template> </template>
......
<script setup lang="ts"> <script setup lang="ts">
import type { Label } from '../types' import type { Label } from '../types'
import { UserFilled } from '@element-plus/icons-vue' import { UserFilled, Refresh } from '@element-plus/icons-vue'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
import { getNameByValue, updateStatusRuleList, updateStatusList, labelList } from '@/utils/dictionary' import { getNameByValue, updateStatusRuleList, updateStatusList, labelList } from '@/utils/dictionary'
import { getLabelStatistics, updateLabelStatistics, getLabelMembers } from '../api' import { getLabelStatistics, updateLabelStatistics, getLabelMembers } from '../api'
...@@ -17,7 +17,7 @@ const connectionTypeList = useMapStore().getMapValuesByKey('experiment_connectio ...@@ -17,7 +17,7 @@ const connectionTypeList = useMapStore().getMapValuesByKey('experiment_connectio
const detail = reactive({ count: 0, status: '1', updated_time: '-' }) const detail = reactive({ count: 0, status: '1', updated_time: '-' })
function fetchInfo() { function fetchInfo() {
getLabelStatistics({ id: props.data.id }).then(res => { getLabelStatistics({ id: props.data.id }).then((res) => {
Object.assign(detail, res.data.detail) Object.assign(detail, res.data.detail)
}) })
} }
...@@ -36,7 +36,7 @@ const listOptions = computed(() => { ...@@ -36,7 +36,7 @@ const listOptions = computed(() => {
return { return {
remote: { remote: {
httpRequest: getLabelMembers, httpRequest: getLabelMembers,
params: { tag_id: props.data.id } params: { tag_id: props.data.id },
}, },
columns: [ columns: [
{ label: '序号', type: 'index', width: 60 }, { label: '序号', type: 'index', width: 60 },
...@@ -47,7 +47,7 @@ const listOptions = computed(() => { ...@@ -47,7 +47,7 @@ const listOptions = computed(() => {
prop: 'gender', prop: 'gender',
computed({ row }: { row: any }) { computed({ row }: { row: any }) {
return getNameByValue(row.gender, genderList) return getNameByValue(row.gender, genderList)
} },
}, },
{ label: '手机号码', prop: 'mobile' }, { label: '手机号码', prop: 'mobile' },
{ {
...@@ -55,21 +55,26 @@ const listOptions = computed(() => { ...@@ -55,21 +55,26 @@ const listOptions = computed(() => {
prop: 'experiment_connection_id', prop: 'experiment_connection_id',
computed({ row }: { row: any }) { computed({ row }: { row: any }) {
return getNameByValue(row.connection.type.toString(), connectionTypeList) return getNameByValue(row.connection.type.toString(), connectionTypeList)
} },
}, },
{ {
label: '状态', label: '状态',
prop: 'status', prop: 'status',
computed({ row }: { row: any }) { computed({ row }: { row: any }) {
return getNameByValue(row.status, statusList) return getNameByValue(row.status, statusList)
} },
}, },
{ label: '更新人', prop: 'updated_operator.real_name' }, { label: '更新人', prop: 'updated_operator.real_name' },
{ label: '更新时间', prop: 'updated_time' }, { label: '更新时间', prop: 'updated_time' },
{ label: '操作', slots: 'table-x' } { label: '操作', slots: 'table-x' },
] ],
} }
}) })
// 刷新
function handleRefresh() {
fetchInfo()
appList.value?.refetch()
}
</script> </script>
<template> <template>
...@@ -113,7 +118,15 @@ const listOptions = computed(() => { ...@@ -113,7 +118,15 @@ const listOptions = computed(() => {
<dt>更新状态</dt> <dt>更新状态</dt>
<dd> <dd>
<span style="margin-right: 10px">{{ getNameByValue(detail.status, updateStatusList) }}</span> <span style="margin-right: 10px">{{ getNameByValue(detail.status, updateStatusList) }}</span>
<el-button type="primary" plain @click="handleUpdate" size="small" :disabled="['2', '4'].includes(detail.status)">立即更新</el-button> <el-button
type="primary"
plain
@click="handleUpdate"
size="small"
:disabled="['2', '4'].includes(detail.status)"
>立即更新</el-button
>
<el-button size="small" :icon="Refresh" @click="handleRefresh"></el-button>
</dd> </dd>
</dl> </dl>
</div> </div>
...@@ -123,7 +136,11 @@ const listOptions = computed(() => { ...@@ -123,7 +136,11 @@ const listOptions = computed(() => {
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #table-x="{ row }"> <template #table-x="{ row }">
<el-button type="primary" plain> <el-button type="primary" plain>
<router-link target="_blank" :to="{ path: '/user/image', query: { user_id: row.id, experiment_id: row.experiment_id } }">查看</router-link> <router-link
target="_blank"
:to="{ path: '/user/image', query: { user_id: row.id, experiment_id: row.experiment_id } }"
>查看</router-link
>
</el-button> </el-button>
</template> </template>
</AppList> </AppList>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论