fix: 优化系统管理/用户管理的逻辑问题;修复了设备进行批量导出时,无法导出成功;

* fix: 优化部分文件对TOKEN_KEY的使用

* fix: 优化系统管理/用户管理的逻辑问题;修复了设备进行批量导出时,无法导出成功;系统管理/日志/详情的异常信息文本框可输入的问题(样式问题)

* fix:还原优化物联卡/物联卡管理/详细信息的更改

* fix:
NO1:系统管理/日志/详情的异常信息文本框可输入的问题(样式问题)
NO2:视频中心/国标级联/新增的SIP本地地址端口的逻辑问题
This commit is contained in:
XieYongHong 2024-04-28 19:37:59 +08:00 committed by GitHub
parent 2115c196df
commit cfc16a0559
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 83 additions and 84 deletions

View File

@ -5,7 +5,7 @@
name="file" name="file"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" }"
:maxCount="1" :maxCount="1"
:showUploadList="false" :showUploadList="false"

View File

@ -10,7 +10,7 @@
@change="handleChange" @change="handleChange"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" }"
v-bind="props" v-bind="props"
> >

View File

@ -6,7 +6,7 @@
<div class="import"> <div class="import">
<a-upload-dragger v-model:fileList="fileList" name="file" :action="`${FILE_UPLOAD}?options=tempFile`" <a-upload-dragger v-model:fileList="fileList" name="file" :action="`${FILE_UPLOAD}?options=tempFile`"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" :limit="1" :showUploadList="false" @change="uploadChange" :accept="['xlsx', 'xls', 'csv']" }" :limit="1" :showUploadList="false" @change="uploadChange" :accept="['xlsx', 'xls', 'csv']"
:before-upload="beforeUpload"> :before-upload="beforeUpload">
<div class="dragger-box"> <div class="dragger-box">

View File

@ -115,6 +115,7 @@
v-model:value="descriptionsData.exception" v-model:value="descriptionsData.exception"
placeholder="暂无数据" placeholder="暂无数据"
:auto-size="{ minRows: 3, maxRows: 20 }" :auto-size="{ minRows: 3, maxRows: 20 }"
readonly
/> />
</j-descriptions-item> </j-descriptions-item>
</j-descriptions> </j-descriptions>

View File

@ -10,7 +10,7 @@
@change="handleChange" @change="handleChange"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" }"
v-bind="props" v-bind="props"
> >

View File

@ -791,7 +791,7 @@ const Status = defineComponent({
{ {
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'loading', status: 'loading',
text: '正在诊断中...', text: '正在诊断中...',
info: null, info: null,
@ -805,7 +805,7 @@ const Status = defineComponent({
list.value = modifyArrayList(list.value, { list.value = modifyArrayList(list.value, {
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'success', status: 'success',
text: '正常', text: '正常',
info: null, info: null,
@ -822,7 +822,7 @@ const Status = defineComponent({
list.value = modifyArrayList(list.value, { list.value = modifyArrayList(list.value, {
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'error', status: 'error',
text: '异常', text: '异常',
info: ( info: (
@ -849,7 +849,7 @@ const Status = defineComponent({
{ {
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'success', status: 'success',
text: '正常', text: '正常',
info: null, info: null,
@ -873,7 +873,7 @@ const Status = defineComponent({
list.value = modifyArrayList(list.value, { list.value = modifyArrayList(list.value, {
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'warning', status: 'warning',
text: '可能存在异常', text: '可能存在异常',
info: ( info: (
@ -890,7 +890,7 @@ const Status = defineComponent({
type: 'product', type: 'product',
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
data: { ...item }, data: { ...item },
configuration: _configuration, configuration: _configuration,
productId: unref(device).productId, productId: unref(device).productId,
@ -909,7 +909,7 @@ const Status = defineComponent({
{ {
key: `product-auth${i}`, key: `product-auth${i}`,
name: `产品-${item?.name}`, name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断产品${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'success', status: 'success',
text: '正常', text: '正常',
info: null, info: null,
@ -952,7 +952,7 @@ const Status = defineComponent({
{ {
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'loading', status: 'loading',
text: '正在诊断中...', text: '正在诊断中...',
info: null, info: null,
@ -966,7 +966,7 @@ const Status = defineComponent({
list.value = modifyArrayList(list.value, { list.value = modifyArrayList(list.value, {
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'success', status: 'success',
text: '正常', text: '正常',
info: null, info: null,
@ -983,7 +983,7 @@ const Status = defineComponent({
list.value = modifyArrayList(list.value, { list.value = modifyArrayList(list.value, {
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'error', status: 'error',
text: '异常', text: '异常',
info: ( info: (
@ -1010,7 +1010,7 @@ const Status = defineComponent({
{ {
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'success', status: 'success',
text: '正常', text: '正常',
info: null, info: null,
@ -1034,7 +1034,7 @@ const Status = defineComponent({
list.value = modifyArrayList(list.value, { list.value = modifyArrayList(list.value, {
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'warning', status: 'warning',
text: '可能存在异常', text: '可能存在异常',
info: ( info: (
@ -1051,7 +1051,7 @@ const Status = defineComponent({
type: 'device', type: 'device',
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
data: { ...item }, data: { ...item },
configuration: _configuration, configuration: _configuration,
productId: unref(device).productId, productId: unref(device).productId,
@ -1070,7 +1070,7 @@ const Status = defineComponent({
{ {
key: `device-auth${i}`, key: `device-auth${i}`,
name: `设备-${item?.name}`, name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败', desc: `诊断设备${item?.name}认证配置是否正确,错误的配置将导致连接失败`,
status: 'success', status: 'success',
text: '正常', text: '正常',
info: null, info: null,

View File

@ -53,6 +53,8 @@ import { downloadFileByUrl } from '@/utils/utils';
import { paramsEncodeQuery } from '@/utils/encodeQuery'; import { paramsEncodeQuery } from '@/utils/encodeQuery';
import { deviceExport , deviceExportPath} from '@/api/device/instance'; import { deviceExport , deviceExportPath} from '@/api/device/instance';
import { getToken } from '@/utils/comm'; import { getToken } from '@/utils/comm';
import { TOKEN_KEY } from '@/utils/variable';
import { LocalStore, onlyMessage } from '@/utils/comm';
const emit = defineEmits(['close']); const emit = defineEmits(['close']);
const props = defineProps({ const props = defineProps({
@ -82,10 +84,17 @@ watch(
}); });
}, },
{ immediate: true, deep: true }, { immediate: true, deep: true },
); );
const productName = computed(() => { const productName = computed(() => {
console.log(modelRef.product);
return productList.value.find(item => item.id === modelRef.product)?.name || '' return productList.value.find(item => item.id === modelRef.product)?.name || ''
// console.log(item.id);
}) })
const handleOk = async () => { const handleOk = async () => {
@ -98,13 +107,17 @@ const handleOk = async () => {
modelRef.product || '', modelRef.product || '',
modelRef.fileType, modelRef.fileType,
params params
); );
if (res) { if (res) {
const blob = new Blob([res], { type: modelRef.fileType }); // const blob = new Blob([res], { type: modelRef.fileType });
const url = URL.createObjectURL(blob); // const url = URL.createObjectURL(blob);
downloadFileByUrl(url, `${productName.value ? (productName.value + '下设备') : '设备实例'}`, modelRef.fileType); // downloadFileByUrl(url, `${productName.value ? (productName.value + '') : ''}`, modelRef.fileType);
window.open(`${origin}/api/device-instance/${modelRef.product}/export.xlsx?:X_Access_Token=${LocalStore.get(TOKEN_KEY)}`)
emit('close'); emit('close');
} }
}; };
const handleCancel = () => { const handleCancel = () => {

View File

@ -14,7 +14,7 @@
name="file" name="file"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" }"
:maxCount="1" :maxCount="1"
:showUploadList="false" :showUploadList="false"

View File

@ -239,16 +239,17 @@ const pageChange = (page: number, pageSize: number) => {
const init = async () => { const init = async () => {
if (props.accessId) { if (props.accessId) {
const resp = await getCommandsByAccess(props.accessId); const resp = await getCommandsByAccess(props.accessId);
if (resp.success) { if (resp.success && resp.result?.length) {
const item = resp.result?.[0]; //
const item = resp.result.find(item => item.id === 'QueryDevicePage');
if (item) { if (item) {
showPage.value = item.id === 'QueryDevicePage'; // showPage.value = true
columns.value = item.expands?.terms?.map((t) => ({ columns.value = item.expands?.terms?.map((t) => ({
title: t.name, title: t.name,
dataIndex: t.id, dataIndex: t.id,
search: { search: {
type: t.valueType.type, type: t.valueType.type,
}, },
})); }));
} }
} }

View File

@ -139,7 +139,7 @@
:show-upload-list="false" :show-upload-list="false"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
@change="fileChange" @change="fileChange"
:headers="{ 'X-Access-Token': getToken() }" :headers="{ [TOKEN_KEY]: getToken() }"
> >
<j-button> <j-button>
<template #icon <template #icon

View File

@ -280,7 +280,7 @@ const backLoading = ref(false);
const iconLoading = ref(false); const iconLoading = ref(false);
const imageTypes = ref(['image/jpeg', 'image/png']); const imageTypes = ref(['image/jpeg', 'image/png']);
const iconTypes = ref(['image/x-icon']); const iconTypes = ref(['image/x-icon']);
const headers = ref({ 'X-Access-Token': LocalStore.get(TOKEN_KEY) }); const headers = ref({ [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) });
/** /**
* 表单数据 * 表单数据
*/ */

View File

@ -233,7 +233,7 @@ const saveChange = (val: any) => {
const getData = ( const getData = (
start: number, start: number,
end: number, end: number,
): Promise<{ sortArray: any[]; data: any[] }> => { ): Promise<{ sortArray: any[]}> => {
return new Promise((resolve) => { return new Promise((resolve) => {
queryFlow(start, end, { queryFlow(start, end, {
orderBy: 'date', orderBy: 'date',
@ -250,13 +250,11 @@ const getData = (
); );
resolve({ resolve({
sortArray, sortArray,
data: sortArray.map(
(item: any) => item.value && item.value.toFixed(2),
),
}); });
} }
}); });
}); });
}; };
/** /**
@ -276,37 +274,23 @@ const getDataTotal = () => {
moment().endOf('year').valueOf(), moment().endOf('year').valueOf(),
]; ];
getData(dTime[0], dTime[1]).then((resp) => { getData(dTime[0], dTime[1]).then((resp) => {
dayTotal.value = resp.data dayTotal.value = resp.sortArray
.reduce((r, n) => r + Number(n), 0) .reduce((r, n) => r + Number(n.value), 0)
.toFixed(2); .toFixed(2);
dayOptions.value = resp.sortArray; dayOptions.value = resp.sortArray;
}); });
getData(mTime[0], mTime[1]).then((resp) => { getData(mTime[0], mTime[1]).then((resp) => {
const monthData = resp.data; monthTotal.value = resp.sortArray
monthTotal.value = monthData .reduce((r, n) => r + Number(n.value), 0)
.reduce((r, n) => r + Number(n), 0) .toFixed(2);
.toFixed(2); monthOptions.value = resp.sortArray;
monthOptions.value = resp.sortArray; })
console.log('monthTotal.value:' + monthTotal.value); getData(yTime[0], yTime[1]).then((resp) => {
console.log('monthData.length:' + monthData.length); yearTotal.value = resp.sortArray
// .reduce((r, n) => r + Number(n.value), 0)
if (monthData.length <=31) { .toFixed(2);
yearTotal.value = monthTotal.value; yearOptions.value = monthOptions.value;
yearOptions.value = monthOptions.value; });
console.log('yearTotal.value:' + yearTotal.value);
} else {
getData(yTime[0], yTime[1]).then((resp) => {
yearTotal.value = resp.data
.reduce((r, n) => r + Number(n), 0)
.toFixed(2);
yearOptions.value = resp.sortArray;
console.log('yearTotal.value:' + yearTotal.value);
});
}
});
}; };
@ -317,7 +301,7 @@ const getDataTotal = () => {
const getEcharts = (data: any) => { const getEcharts = (data: any) => {
let startTime = data.start; let startTime = data.start;
let endTime = data.end; let endTime = data.end;
if (data.type === 'week' || data.type === 'month'||data.type === 'year') { if (data.type === 'week' || data.type === 'month') {
startTime = moment(data.start).startOf('days').valueOf(); startTime = moment(data.start).startOf('days').valueOf();
endTime = moment(data.end).startOf('days').valueOf(); endTime = moment(data.end).startOf('days').valueOf();
} }

View File

@ -5,7 +5,7 @@
name="file" name="file"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" }"
:maxCount="1" :maxCount="1"
:showUploadList="false" :showUploadList="false"

View File

@ -177,7 +177,7 @@ const quickBtnList = [
const getData = ( const getData = (
start: number, start: number,
end: number, end: number,
): Promise<{ sortArray: any[]; data: any[] }> => { ): Promise<{ sortArray: any[]}> => {
return new Promise((resolve) => { return new Promise((resolve) => {
queryFlow(start, end, { queryFlow(start, end, {
orderBy: 'date', orderBy: 'date',
@ -189,9 +189,6 @@ const getData = (
); );
resolve({ resolve({
sortArray, sortArray,
data: sortArray.map(
(item: any) => item.value && item.value.toFixed(2),
),
}); });
} }
}); });
@ -215,20 +212,20 @@ const getDataTotal = () => {
dayjs().endOf('year').valueOf(), dayjs().endOf('year').valueOf(),
]; ];
getData(dTime[0], dTime[1]).then((resp) => { getData(dTime[0], dTime[1]).then((resp) => {
dayTotal.value = resp.data dayTotal.value = resp.sortArray
.reduce((r, n) => r + Number(n), 0) .reduce((r, n) => r + Number(n.value), 0)
.toFixed(2); .toFixed(2);
dayOptions.value = resp.sortArray; dayOptions.value = resp.sortArray;
}); });
getData(mTime[0], mTime[1]).then((resp) => { getData(mTime[0], mTime[1]).then((resp) => {
monthTotal.value = resp.data monthTotal.value = resp.sortArray
.reduce((r, n) => r + Number(n), 0) .reduce((r, n) => r + Number(n.value), 0)
.toFixed(2); .toFixed(2);
monthOptions.value = resp.sortArray; monthOptions.value = resp.sortArray;
}); });
getData(yTime[0], yTime[1]).then((resp) => { getData(yTime[0], yTime[1]).then((resp) => {
yearTotal.value = resp.data yearTotal.value = resp.sortArray
.reduce((r, n) => r + Number(n), 0) .reduce((r, n) => r + Number(n.value), 0)
.toFixed(2); .toFixed(2);
yearOptions.value = resp.sortArray; yearOptions.value = resp.sortArray;
}); });

View File

@ -643,7 +643,10 @@ const handleTransportChange = () => {
*/ */
const allListPorts = ref([]); const allListPorts = ref([]);
const setPorts = () => { const setPorts = () => {
if (!formData.value.host) return; if (!formData.value.host) {
allListPorts.value = []
return
};
allListPorts.value = allList.value allListPorts.value = allList.value
.find((f: any) => f.host === formData.value.host) .find((f: any) => f.host === formData.value.host)
?.ports[formData.value.transport || '']?.map((m: string) => ({ ?.ports[formData.value.transport || '']?.map((m: string) => ({

View File

@ -9,7 +9,7 @@
:before-upload="beforeUpload" :before-upload="beforeUpload"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), [TOKEN_KEY]: LocalStore.get(TOKEN_KEY),
}" }"
v-bind="props" v-bind="props"
> >

View File

@ -267,11 +267,11 @@ const confirm = () => {
const formRef = ref<FormInstance>(); const formRef = ref<FormInstance>();
const form = reactive({ const form = reactive({
data: {} as formType, data: {} as formType,
rules: { rules: {
checkUserName: (_rule: Rule, value: string): Promise<any> => checkUserName: (_rule: Rule, value: string): Promise<any> =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
if (props.type === 'edit') return resolve(''); if(props.type==='edit') return resolve('')
else if(!value) return reject('请输入用户名');
else if (value.length > 64) return reject('最多可输入64个字符'); else if (value.length > 64) return reject('最多可输入64个字符');
validateField_api('username', value).then((resp: any): any => { validateField_api('username', value).then((resp: any): any => {
resp.result.passed resp.result.passed