Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
leiqiaochu 2023-03-02 10:16:04 +08:00
commit 569c430ca2
14 changed files with 346 additions and 298 deletions

View File

@ -85,6 +85,7 @@ export const batchDeleteDevice = (data: string[]) => server.put(`/device-instanc
*/ */
export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}` export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}`
export const templateDownload = (productId: string, type: string) => server.get(`/device-instance/${productId}/template.${type}`,{},{responseType: 'blob'})
/** /**
* *
* @param productId id * @param productId id

View File

@ -99,6 +99,12 @@ export const _import = (configId: any, params: any) => server.get(`/network/card
*/ */
export const _export = (format: string, data: any) => server.post(`/network/card/download.${format}/_query`, data, { responseType: 'blob' }); export const _export = (format: string, data: any) => server.post(`/network/card/download.${format}/_query`, data, { responseType: 'blob' });
/**
*
* @param format xlsxcsv
*/
export const exportCard = (format: string) => server.get(`/network/card/template.${format}`,{},{responseType: 'blob'});
/** /**
* iccid * iccid
* @param id * @param id

View File

@ -36,5 +36,7 @@ export default {
updateGbChannelId: (id: string, data: any): any => server.put(`/media/gb28181-cascade/binding/${id}`, data), updateGbChannelId: (id: string, data: any): any => server.put(`/media/gb28181-cascade/binding/${id}`, data),
// 查询通道分页列表 // 查询通道分页列表
queryChannelList: (data: any): any => server.post(`media/channel/_query`, data), queryChannelList: (data: any): any => server.post(`media/channel/_query`, data),
// 推送
publish: (id: string, params: any) => server.get(`/media/gb28181-cascade/${id}/bindings/publish`, params)
} }

View File

@ -36,8 +36,8 @@
import { FILE_UPLOAD } from '@/api/comm' import { FILE_UPLOAD } from '@/api/comm'
import { TOKEN_KEY } from '@/utils/variable'; import { TOKEN_KEY } from '@/utils/variable';
import { LocalStore } from '@/utils/comm'; import { LocalStore } from '@/utils/comm';
import { downloadFile } from '@/utils/utils'; import { downloadFile, downloadFileByUrl } from '@/utils/utils';
import { deviceImport, deviceTemplateDownload } from '@/api/device/instance' import { deviceImport, deviceTemplateDownload ,templateDownload} from '@/api/device/instance'
import { EventSourcePolyfill } from 'event-source-polyfill' import { EventSourcePolyfill } from 'event-source-polyfill'
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
@ -72,8 +72,20 @@ const flag = ref<boolean>(false)
const count = ref<number>(0) const count = ref<number>(0)
const errMessage = ref<string>('') const errMessage = ref<string>('')
const downFile = (type: string) => { const downFile =async (type: string) => {
downloadFile(deviceTemplateDownload(props.product, type)); // downloadFile(deviceTemplateDownload(props.product, type));
const res:any =await templateDownload(props.product, type)
if(res){
const blob = new Blob([res], { type: type });
const url = URL.createObjectURL(blob);
console.log(url);
downloadFileByUrl(
url,
`设备导入模版`,
type,
);
}
} }
const submitData = async (fileUrl: string) => { const submitData = async (fileUrl: string) => {

View File

@ -146,12 +146,6 @@ const rest = async () => {
getDeviceCode(); getDeviceCode();
message.success('操作成功') message.success('操作成功')
} }
// service.delDeviceCode(productId, deviceId).then((res) => {
// if (res.status === 200) {
// getDeviceCode(productId, deviceId);
// onlyMessage('');
// }
// });
}; };
//topic //topic
const getTopic = async () => { const getTopic = async () => {
@ -285,7 +279,7 @@ onMounted(() => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
background-color: '#f7f7f7'; background-color: #f7f7f7;
.bottom-title { .bottom-title {
display: flex; display: flex;

View File

@ -60,7 +60,7 @@
</a-card> </a-card>
</template> </template>
<script setup lang='ts' name="Parsing"> <script setup lang='ts' name="DataAnalysis">
import AIcon from '@/components/AIcon' import AIcon from '@/components/AIcon'
import PermissionButton from '@/components/PermissionButton/index.vue' import PermissionButton from '@/components/PermissionButton/index.vue'
import MonacoEditor from '@/components/MonacoEditor/index.vue'; import MonacoEditor from '@/components/MonacoEditor/index.vue';
@ -225,7 +225,7 @@ onMounted(() => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
background-color: '#f7f7f7'; background-color: #f7f7f7;
.bottom-title { .bottom-title {
display: flex; display: flex;

View File

@ -205,7 +205,9 @@ const getProtocol = async () => {
} }
} }
}; };
getProtocol(); onMounted(()=>{
getProtocol();
})
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.ant-switch-loading, .ant-switch-loading,

View File

@ -80,8 +80,8 @@
import { FILE_UPLOAD } from '@/api/comm'; import { FILE_UPLOAD } from '@/api/comm';
import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable'; import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
import { LocalStore } from '@/utils/comm'; import { LocalStore } from '@/utils/comm';
import { downloadFile } from '@/utils/utils'; import { downloadFile, downloadFileByUrl } from '@/utils/utils';
import { queryPlatformNoPage, _import } from '@/api/iot-card/cardManagement'; import { queryPlatformNoPage, _import ,exportCard} from '@/api/iot-card/cardManagement';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
const emit = defineEmits(['close']); const emit = defineEmits(['close']);
@ -136,9 +136,21 @@ const fileChange = (info: any) => {
} }
}; };
const downFileFn = (type: string) => { const downFileFn =async (type: string) => {
const url = `${BASE_API_PATH}/network/card/template.${type}`; // const url = `${BASE_API_PATH}/network/card/template.${type}`;
downloadFile(url); // downloadFile(url);
const res:any = await exportCard(type)
if(res){
const blob = new Blob([res], { type: type });
const url = URL.createObjectURL(blob);
console.log(url);
downloadFileByUrl(
url,
`物联卡导入模版`,
type,
);
}
}; };
const handleCancel = () => { const handleCancel = () => {

View File

@ -1,24 +1,12 @@
<!-- 物联卡管理 --> <!-- 物联卡管理 -->
<template> <template>
<page-container> <page-container>
<Search <Search :columns="columns" target="iot-card-management-search" @search="handleSearch" />
:columns="columns" <JTable ref="cardManageRef" :columns="columns" :request="query"
target="iot-card-management-search" :defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }" :rowSelection="{
@search="handleSearch"
/>
<JTable
ref="cardManageRef"
:columns="columns"
:request="query"
:defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }"
:rowSelection="{
selectedRowKeys: _selectedRowKeys, selectedRowKeys: _selectedRowKeys,
onChange: onSelectChange, onChange: onSelectChange,
}" }" @cancelSelect="cancelSelect" :params="params" :gridColumn="3">
@cancelSelect="cancelSelect"
:params="params"
:gridColumn="3"
>
<template #headerTitle> <template #headerTitle>
<a-space> <a-space>
<a-button type="primary" @click="handleAdd"> <a-button type="primary" @click="handleAdd">
@ -32,72 +20,62 @@
<template #overlay> <template #overlay>
<a-menu> <a-menu>
<a-menu-item> <a-menu-item>
<a-button @click="exportVisible = true"> <PermissionButton @click="exportVisible = true"
:hasPermission="'iot-card/CardManagement:export'">
<AIcon type="ExportOutlined" /> <AIcon type="ExportOutlined" />
批量导出 批量导出
</a-button> </PermissionButton>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a-button @click="importVisible = true" <PermissionButton @click="importVisible = true"
><AIcon :hasPermission="'iot-card/CardManagement:import'">
type="ImportOutlined" <AIcon type="ImportOutlined" />批量导入
/></a-button </PermissionButton>
>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a-popconfirm <PermissionButton :popConfirm="{
@confirm="handleActive" title: '确认激活吗?',
title="确认激活吗?" onConfirm: handleActive,
> }" :hasPermission="'iot-card/CardManagement:active'">
<a-button> <AIcon type="CheckCircleOutlined" />
<AIcon type="CheckCircleOutlined" /> 批量激活
批量激活 </PermissionButton>
</a-button>
</a-popconfirm>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a-popconfirm <PermissionButton :popConfirm="{
@confirm="handleStop" title: '确认停用吗?',
title="确认停用吗?" onConfirm: handleStop,
> }" ghost type="primary" :hasPermission="'iot-card/CardManagement:action'">
<a-button type="primary" ghost> <AIcon type="StopOutlined" />
<AIcon type="StopOutlined" />
批量停用 批量停用
</a-button> </PermissionButton>
</a-popconfirm>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a-popconfirm <PermissionButton :popConfirm="{
@confirm="handleResumption" title: '确认复机吗?',
title="确认复机吗?" onConfirm: handleResumption,
> }" ghost type="primary" :hasPermission="'iot-card/CardManagement:action'">
<a-button type="primary" ghost> <AIcon type="PoweroffOutlined" />
<AIcon type="PoweroffOutlined" />
批量复机 批量复机
</a-button> </PermissionButton>
</a-popconfirm>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a-popconfirm <PermissionButton :popConfirm="{
@confirm="handleSync" title: '确认同步状态吗?',
title="确认同步状态吗?" onConfirm: handleSync,
> }" ghost type="primary" :hasPermission="'iot-card/CardManagement:sync'">
<a-button type="primary" ghost> <AIcon type="SwapOutlined" />
<AIcon type="SwapOutlined" />
同步状态 同步状态
</a-button> </PermissionButton>
</a-popconfirm>
</a-menu-item> </a-menu-item>
<a-menu-item v-if="_selectedRowKeys.length > 0"> <a-menu-item v-if="_selectedRowKeys.length > 0">
<a-popconfirm <PermissionButton :popConfirm="{
@confirm="handelRemove" title: '确认删除吗?',
title="确认删除吗?" onConfirm: handelRemove,
> }" ghost type="primary" :hasPermission="'iot-card/CardManagement:delete'">
<a-button> <AIcon type="SwapOutlined" />
<AIcon type="DeleteOutlined" /> 批量删除
批量删除 </PermissionButton>
</a-button>
</a-popconfirm>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>
@ -105,20 +83,13 @@
</a-space> </a-space>
</template> </template>
<template #card="slotProps"> <template #card="slotProps">
<CardBox <CardBox :value="slotProps" @click="handleClick" :actions="getActions(slotProps, 'card')" v-bind="slotProps"
:value="slotProps" :active="_selectedRowKeys.includes(slotProps.id)" :status="slotProps.cardStateType.value"
@click="handleClick" :statusText="slotProps.cardStateType.text" :statusNames="{
:actions="getActions(slotProps, 'card')"
v-bind="slotProps"
:active="_selectedRowKeys.includes(slotProps.id)"
:status="slotProps.cardStateType.value"
:statusText="slotProps.cardStateType.text"
:statusNames="{
using: 'success', using: 'success',
toBeActivated: 'default', toBeActivated: 'default',
deactivate: 'error', deactivate: 'error',
}" }">
>
<template #img> <template #img>
<slot name="img"> <slot name="img">
<img :src="getImage('/iot-card/iot-card-bg.png')" /> <img :src="getImage('/iot-card/iot-card-bg.png')" />
@ -150,8 +121,7 @@
{{ slotProps.totalFlow }} {{ slotProps.totalFlow }}
</span> </span>
<span class="card-item-content-text"> <span class="card-item-content-text">
M 使用流量</span M 使用流量</span>
>
</div> </div>
<div v-else> <div v-else>
<div class="progress-text"> <div class="progress-text">
@ -165,17 +135,22 @@
总共 {{ slotProps.totalFlow }} M 总共 {{ slotProps.totalFlow }} M
</div> </div>
</div> </div>
<a-progress <a-progress :strokeColor="'#ADC6FF'" :showInfo="false" :percent="
:strokeColor="'#ADC6FF'" slotProps.totalFlow - slotProps.usedFlow
:showInfo="false" " />
:percent="
slotProps.totalFlow - slotProps.usedFlow
"
/>
</div> </div>
</template> </template>
<template #actions="item"> <template #actions="item">
<a-tooltip <PermissionButton :disabled="item.disabled" :popConfirm="item.popConfirm" :tooltip="{
...item.tooltip,
}" @click="item.onClick" :hasPermission="'iot-card/CardManagement:' + item.key">
<AIcon type="DeleteOutlined" v-if="item.key === 'delete'" />
<template v-else>
<AIcon :type="item.icon" />
<span>{{ item?.text }}</span>
</template>
</PermissionButton>
<!-- <a-tooltip
v-bind="item.tooltip" v-bind="item.tooltip"
:title="item.disabled && item.tooltip.title" :title="item.disabled && item.tooltip.title"
> >
@ -210,7 +185,7 @@
</template> </template>
</a-button> </a-button>
</template> </template>
</a-tooltip> </a-tooltip> -->
</template> </template>
</CardBox> </CardBox>
</template> </template>
@ -221,8 +196,8 @@
<div> <div>
{{ {{
slotProps.totalFlow slotProps.totalFlow
? slotProps.totalFlow.toFixed(2) + ' M' ? slotProps.totalFlow.toFixed(2) + ' M'
: '' : ''
}} }}
</div> </div>
</template> </template>
@ -230,8 +205,8 @@
<div> <div>
{{ {{
slotProps.usedFlow slotProps.usedFlow
? slotProps.usedFlow.toFixed(2) + ' M' ? slotProps.usedFlow.toFixed(2) + ' M'
: '' : ''
}} }}
</div> </div>
</template> </template>
@ -239,8 +214,8 @@
<div> <div>
{{ {{
slotProps.residualFlow slotProps.residualFlow
? slotProps.residualFlow.toFixed(2) + ' M' ? slotProps.residualFlow.toFixed(2) + ' M'
: '' : ''
}} }}
</div> </div>
</template> </template>
@ -253,74 +228,52 @@
<template #activationDate="slotProps"> <template #activationDate="slotProps">
{{ {{
slotProps.activationDate slotProps.activationDate
? moment(slotProps.activationDate).format( ? moment(slotProps.activationDate).format(
'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss',
) )
: '' : ''
}} }}
</template> </template>
<template #updateTime="slotProps"> <template #updateTime="slotProps">
{{ {{
slotProps.updateTime slotProps.updateTime
? moment(slotProps.updateTime).format( ? moment(slotProps.updateTime).format(
'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss',
) )
: '' : ''
}} }}
</template> </template>
<template #action="slotProps"> <template #action="slotProps">
<a-space :size="16"> <a-space :size="16">
<a-tooltip <template
v-for="i in getActions(slotProps, 'table')" v-for="i in getActions(slotProps,'table')"
:key="i.key" :key="i.key"
v-bind="i.tooltip"
> >
<a-popconfirm v-if="i.popConfirm" v-bind="i.popConfirm"> <PermissionButton
<a-button :disabled="i.disabled"
:disabled="i.disabled" :popConfirm="i.popConfirm"
style="padding: 0" :tooltip="{
type="link" ...i.tooltip,
><AIcon :type="i.icon" }"
/></a-button> @click="i.onClick"
</a-popconfirm>
<a-button
style="padding: 0"
type="link" type="link"
v-else style="padding: 0px"
@click="i.onClick && i.onClick(slotProps)" :hasPermission="'iot-card/CardManagement:' + i.key"
> >
<a-button <template #icon><AIcon :type="i.icon" /></template>
:disabled="i.disabled" </PermissionButton>
style="padding: 0" </template>
type="link"
><AIcon :type="i.icon"
/></a-button>
</a-button>
</a-tooltip>
</a-space> </a-space>
</template> </template>
</JTable> </JTable>
<!-- 批量导入 --> <!-- 批量导入 -->
<Import v-if="importVisible" @close="importVisible = false" /> <Import v-if="importVisible" @close="importVisible = false" />
<!-- 批量导出 --> <!-- 批量导出 -->
<Export <Export v-if="exportVisible" @close="exportVisible = false" :data="_selectedRowKeys" />
v-if="exportVisible"
@close="exportVisible = false"
:data="_selectedRowKeys"
/>
<!-- 绑定设备 --> <!-- 绑定设备 -->
<BindDevice <BindDevice v-if="bindDeviceVisible" :cardId="cardId" @change="bindDevice" />
v-if="bindDeviceVisible"
:cardId="cardId"
@change="bindDevice"
/>
<!-- 新增编辑 --> <!-- 新增编辑 -->
<Save <Save v-if="visible" :type="saveType" :data="current" @change="saveChange" />
v-if="visible"
:type="saveType"
:data="current"
@change="saveChange"
/>
</page-container> </page-container>
</template> </template>
@ -516,7 +469,21 @@ const getActions = (
if (!data) return []; if (!data) return [];
return [ return [
{ {
key: 'edit', key: 'view',
text: '查看',
tooltip: {
title: '查看',
},
icon: 'EyeOutlined',
onClick: () => {
// router.push({
// path: `/iot-card/CardManagement/detail/${data.id}`,
// });
menuStory.jumpPage('iot-card/CardManagement/Detail', { id: data.id })
},
},
{
key: 'update',
text: '编辑', text: '编辑',
tooltip: { tooltip: {
title: '编辑', title: '编辑',
@ -529,21 +496,7 @@ const getActions = (
}, },
}, },
{ {
key: 'view', key: 'bind',
text: '查看',
tooltip: {
title: '查看',
},
icon: 'EyeOutlined',
onClick: () => {
// router.push({
// path: `/iot-card/CardManagement/detail/${data.id}`,
// });
menuStory.jumpPage('iot-card/CardManagement/Detail',{id:data.id})
},
},
{
key: 'bindDevice',
text: data.deviceId ? '解绑设备' : '绑定设备', text: data.deviceId ? '解绑设备' : '绑定设备',
tooltip: { tooltip: {
title: data.deviceId ? '解绑设备' : '绑定设备', title: data.deviceId ? '解绑设备' : '绑定设备',
@ -551,18 +504,18 @@ const getActions = (
icon: data.deviceId ? 'DisconnectOutlined' : 'LinkOutlined', icon: data.deviceId ? 'DisconnectOutlined' : 'LinkOutlined',
popConfirm: data.deviceId popConfirm: data.deviceId
? { ? {
title: '确认解绑设备?', title: '确认解绑设备?',
okText: '确定', okText: '确定',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
unbind(data.id).then((resp: any) => { unbind(data.id).then((resp: any) => {
if (resp.status === 200) { if (resp.status === 200) {
message.success('操作成功'); message.success('操作成功');
cardManageRef.value?.reload(); cardManageRef.value?.reload();
} }
}); });
}, },
} }
: undefined, : undefined,
onClick: () => { onClick: () => {
if (!data.deviceId) { if (!data.deviceId) {
@ -572,34 +525,34 @@ const getActions = (
}, },
}, },
{ {
key: 'activation', key: data.cardStateType?.value === 'toBeActivated' ? 'active' : 'action',
text: text:
data.cardStateType?.value === 'toBeActivated' data.cardStateType?.value === 'toBeActivated'
? '激活' ? '激活'
: data.cardStateType?.value === 'deactivate' : data.cardStateType?.value === 'deactivate'
? '复机' ? '复机'
: '停用', : '停用',
tooltip: { tooltip: {
title: title:
data.cardStateType?.value === 'toBeActivated' data.cardStateType?.value === 'toBeActivated'
? '激活' ? '激活'
: data.cardStateType?.value === 'deactivate' : data.cardStateType?.value === 'deactivate'
? '复机' ? '复机'
: '停用', : '停用',
}, },
icon: icon:
data.cardStateType?.value === 'toBeActivated' data.cardStateType?.value === 'toBeActivated'
? 'CheckCircleOutlined' ? 'CheckCircleOutlined'
: data.cardStateType?.value === 'deactivate' : data.cardStateType?.value === 'deactivate'
? 'PoweroffOutlined' ? 'PoweroffOutlined'
: 'StopOutlined', : 'StopOutlined',
popConfirm: { popConfirm: {
title: title:
data.cardStateType?.value === 'toBeActivated' data.cardStateType?.value === 'toBeActivated'
? '确认激活?' ? '确认激活?'
: data.cardStateType?.value === 'deactivate' : data.cardStateType?.value === 'deactivate'
? '确认复机?' ? '确认复机?'
: '确认停用?', : '确认停用?',
okText: '确定', okText: '确定',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
@ -793,14 +746,17 @@ const handelRemove = async () => {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
} }
.progress-text { .progress-text {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
:deep(.ant-progress-inner) { :deep(.ant-progress-inner) {
border-radius: 0px; border-radius: 0px;
} }
:deep(.ant-progress-bg) { :deep(.ant-progress-bg) {
border-radius: 0px; border-radius: 0px;
} }

View File

@ -56,42 +56,15 @@
</a-row> </a-row>
</template> </template>
<template #actions="item"> <template #actions="item">
<a-tooltip <PermissionButton :disabled="item.disabled" :popConfirm="item.popConfirm" :tooltip="{
v-bind="item.tooltip" ...item.tooltip,
:title="item.disabled && item.tooltip.title" }" @click="item.onClick" :hasPermission="'iot-card/Platform:' + item.key">
> <AIcon type="DeleteOutlined" v-if="item.key === 'delete'" />
<a-popconfirm
v-if="item.popConfirm"
v-bind="item.popConfirm"
:disabled="item.disabled"
>
<a-button :disabled="item.disabled">
<AIcon
type="DeleteOutlined"
v-if="item.key === 'delete'"
/>
<template v-else>
<AIcon :type="item.icon" />
<span>{{ item.text }}</span>
</template>
</a-button>
</a-popconfirm>
<template v-else> <template v-else>
<a-button <AIcon :type="item.icon" />
:disabled="item.disabled" <span>{{ item?.text }}</span>
@click="item.onClick"
>
<AIcon
type="DeleteOutlined"
v-if="item.key === 'delete'"
/>
<template v-else>
<AIcon :type="item.icon" />
<span>{{ item.text }}</span>
</template>
</a-button>
</template> </template>
</a-tooltip> </PermissionButton>
</template> </template>
</CardBox> </CardBox>
</template> </template>
@ -107,33 +80,24 @@
</template> </template>
<template #action="slotProps"> <template #action="slotProps">
<a-space :size="16"> <a-space :size="16">
<a-tooltip <template
v-for="i in getActions(slotProps, 'table')" v-for="i in getActions(slotProps,'table')"
:key="i.key" :key="i.key"
v-bind="i.tooltip"
> >
<a-popconfirm v-if="i.popConfirm" v-bind="i.popConfirm"> <PermissionButton
<a-button :disabled="i.disabled"
:disabled="i.disabled" :popConfirm="i.popConfirm"
style="padding: 0" :tooltip="{
type="link" ...i.tooltip,
><AIcon :type="i.icon" }"
/></a-button> @click="i.onClick"
</a-popconfirm>
<a-button
style="padding: 0"
type="link" type="link"
v-else style="padding: 0px"
@click="i.onClick && i.onClick(slotProps)" :hasPermission="'iot-card/Platform:' + i.key"
> >
<a-button <template #icon><AIcon :type="i.icon" /></template>
:disabled="i.disabled" </PermissionButton>
style="padding: 0" </template>
type="link"
><AIcon :type="i.icon"
/></a-button>
</a-button>
</a-tooltip>
</a-space> </a-space>
</template> </template>
</JTable> </JTable>
@ -218,7 +182,7 @@ const getActions = (
if (!data) return []; if (!data) return [];
return [ return [
{ {
key: 'edit', key: 'update',
text: '编辑', text: '编辑',
tooltip: { tooltip: {
title: '编辑', title: '编辑',

View File

@ -1,24 +1,14 @@
<!-- 充值管理 --> <!-- 充值管理 -->
<template> <template>
<page-container> <page-container>
<Search <Search :columns="columns" target="recharge-search" @search="handleSearch" />
:columns="columns" <JTable ref="rechargeRef" :columns="columns" :request="queryRechargeList" model="TABLE"
target="recharge-search" :defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }" :params="params">
@search="handleSearch"
/>
<JTable
ref="rechargeRef"
:columns="columns"
:request="queryRechargeList"
model="TABLE"
:defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }"
:params="params"
>
<template #headerTitle> <template #headerTitle>
<a-space> <a-space>
<a-button type="primary" @click="visible = true"> <PermissionButton @click="visible = true" :hasPermission="'iot-card/Recharge:pay'" type="primary">
充值 充值
</a-button> </PermissionButton>
<div class="tips-text"> <div class="tips-text">
<span style="margin-right: 8px; font-size: 16px"> <span style="margin-right: 8px; font-size: 16px">
<AIcon type="ExclamationCircleOutlined"></AIcon> <AIcon type="ExclamationCircleOutlined"></AIcon>
@ -30,41 +20,32 @@
<template #createTime="slotProps"> <template #createTime="slotProps">
{{ {{
slotProps.createTime slotProps.createTime
? moment(slotProps.createTime).format( ? moment(slotProps.createTime).format(
'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss',
) )
: '' : ''
}} }}
</template> </template>
<template #action="slotProps"> <template #action="slotProps">
<a-space :size="16"> <a-space :size="16">
<a-tooltip <template
v-for="i in getActions(slotProps)" v-for="i in getActions(slotProps)"
:key="i.key" :key="i.key"
v-bind="i.tooltip"
> >
<a-popconfirm v-if="i.popConfirm" v-bind="i.popConfirm"> <PermissionButton
<a-button :disabled="i.disabled"
:disabled="i.disabled" :popConfirm="i.popConfirm"
style="padding: 0" :tooltip="{
type="link" ...i.tooltip,
><AIcon :type="i.icon" }"
/></a-button> @click="i.onClick"
</a-popconfirm>
<a-button
style="padding: 0"
type="link" type="link"
v-else style="padding: 0px"
@click="i.onClick && i.onClick(slotProps)" :hasPermission="'iot-card/Recharge:' + i.key"
> >
<a-button <template #icon><AIcon :type="i.icon" /></template>
:disabled="i.disabled" </PermissionButton>
style="padding: 0" </template>
type="link"
><AIcon :type="i.icon"
/></a-button>
</a-button>
</a-tooltip>
</a-space> </a-space>
</template> </template>
</JTable> </JTable>
@ -145,8 +126,8 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
}, },
icon: 'EyeOutlined', icon: 'EyeOutlined',
onClick: () => { onClick: () => {
detailVisible.value = true; detailVisible.value = true;
current.value = data; current.value = data;
}, },
}, },
]; ];

View File

@ -298,6 +298,10 @@ const getActions = (
* 批量解绑 * 批量解绑
*/ */
const handleMultipleUnbind = async () => { const handleMultipleUnbind = async () => {
if (!_selectedRowKeys.value.length) {
message.error('请先选择需要解绑的通道列表');
return;
}
const channelIds = listRef.value?._dataSource const channelIds = listRef.value?._dataSource
.filter((f: any) => _selectedRowKeys.value.includes(f.id)) .filter((f: any) => _selectedRowKeys.value.includes(f.id))
.map((m: any) => m.channelId); .map((m: any) => m.channelId);

View File

@ -0,0 +1,103 @@
<!-- 国标级联-推送 -->
<template>
<a-modal
v-model:visible="_vis"
title="推送"
cancelText="取消"
okText="确定"
width="900px"
@ok="_vis = false"
@cancel="_vis = false"
>
<a-row :gutter="20">
<a-col :span="8">
<p>成功{{ successCount }}</p>
<a-space>
<p>失败{{ failCount }}</p>
<a
v-if="errMessage.length"
@click="
downloadObject(
errMessage || '',
data.name + '-推送失败',
)
"
>下载</a
>
</a-space>
</a-col>
<a-col :span="8">
<p>推送通道数量{{ data.count }}</p>
</a-col>
<a-col :span="8">
<p>已推送通道数量{{ successCount + failCount }}</p>
</a-col>
</a-row>
<div v-if="flag">
<a-textarea :rows="10" v-model:value="errStr" />
</div>
</a-modal>
</template>
<script setup lang="ts">
import { LocalStore } from '@/utils/comm';
import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
import { EventSourcePolyfill } from 'event-source-polyfill';
import { PropType } from 'vue';
import { downloadObject } from '@/utils/utils';
type Emits = {
(e: 'update:visible', data: boolean): void;
};
const emit = defineEmits<Emits>();
const props = defineProps({
visible: { type: Boolean, default: false },
data: {
type: Object as PropType<Partial<Record<string, any>>>,
default: () => ({}),
},
});
const _vis = computed({
get: () => props.visible,
set: (val) => emit('update:visible', val),
});
watch(
() => _vis.value,
(val: boolean) => {
if (val) publish();
},
);
/**
* 推送
*/
const successCount = ref(0);
const failCount = ref(0);
const flag = ref(false);
const errMessage = ref<any[]>([]);
const errStr = computed(() => JSON.stringify(errMessage.value));
const publish = () => {
const activeAPI = `${BASE_API_PATH}/media/gb28181-cascade/${
props.data.id
}/bindings/publish?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}`;
const source = new EventSourcePolyfill(activeAPI);
source.onmessage = (e: any) => {
const res = JSON.parse(e.data);
if (res.successful) {
successCount.value += 1;
} else {
failCount.value += 1;
if (errMessage.value.length <= 5) {
errMessage.value.push({ ...res });
}
}
};
source.onerror = () => {
source.close();
};
source.onopen = () => {};
};
</script>

View File

@ -193,6 +193,8 @@
</a-space> </a-space>
</template> </template>
</JTable> </JTable>
<Publish v-model:visible="publishVis" :data="currentData" />
</page-container> </page-container>
</template> </template>
@ -201,6 +203,7 @@ import CascadeApi from '@/api/media/cascade';
import type { ActionsType } from '@/components/Table/index.vue'; import type { ActionsType } from '@/components/Table/index.vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { getImage } from '@/utils/comm'; import { getImage } from '@/utils/comm';
import Publish from './Publish/index.vue';
import { useMenuStore } from 'store/menu'; import { useMenuStore } from 'store/menu';
@ -314,6 +317,13 @@ const handleAdd = () => {
menuStory.jumpPage('media/Cascade/Save'); menuStory.jumpPage('media/Cascade/Save');
}; };
const publishVis = ref(false);
const currentData = ref();
/**
* 按钮
* @param data
* @param type
*/
const getActions = ( const getActions = (
data: Partial<Record<string, any>>, data: Partial<Record<string, any>>,
type: 'card' | 'table', type: 'card' | 'table',
@ -366,7 +376,8 @@ const getActions = (
disabled: data.status?.value === 'disabled', disabled: data.status?.value === 'disabled',
icon: 'ShareAltOutlined', icon: 'ShareAltOutlined',
onClick: () => { onClick: () => {
// updateChannel() publishVis.value = true;
currentData.value = data;
}, },
}, },
{ {