feat: 终端目录部分调整,添加udm-voip/volte功能页面
This commit is contained in:
958
src/views/neData/base-station/list.vue
Normal file
958
src/views/neData/base-station/list.vue
Normal file
@@ -0,0 +1,958 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
onMounted,
|
||||
toRaw,
|
||||
computed,
|
||||
defineAsyncComponent,
|
||||
} from 'vue';
|
||||
import { Form, message, Modal } from 'ant-design-vue';
|
||||
import { SizeType } from 'ant-design-vue/es/config-provider';
|
||||
import { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import { ProModal } from 'antdv-pro-modal';
|
||||
import UploadModal from '@/components/UploadModal/index.vue';
|
||||
import useNeInfoStore from '@/store/modules/neinfo';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t, currentLocale } = useI18n();
|
||||
import {
|
||||
addAMFNbState,
|
||||
delAMFNbState,
|
||||
editAMFNbState,
|
||||
listAMFNbStatelist,
|
||||
} from '@/api/neData/amf';
|
||||
import {
|
||||
addMMENbState,
|
||||
delMMENbState,
|
||||
editMMENbState,
|
||||
listMMENbStatelist,
|
||||
} from '@/api/neData/mme';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import saveAs from 'file-saver';
|
||||
import { readSheet, writeSheet } from '@/utils/execl-utils';
|
||||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
// 异步加载组件
|
||||
const HistoryModal = defineAsyncComponent(
|
||||
() => import('./components/history.vue')
|
||||
);
|
||||
|
||||
const nbState = ref<DictType[]>([
|
||||
{
|
||||
value: 'ON',
|
||||
label: t('views.neData.baseStation.online'),
|
||||
tagType: 'green',
|
||||
tagClass: '',
|
||||
},
|
||||
{
|
||||
value: 'OFF',
|
||||
label: t('views.neData.baseStation.offline'),
|
||||
tagType: 'red',
|
||||
tagClass: '',
|
||||
},
|
||||
]);
|
||||
|
||||
/**网元参数 */
|
||||
let neCascaderOptions = ref<Record<string, any>[]>([]);
|
||||
/**网元数据 */
|
||||
let neTypeAndId = ref<string[]>([]);
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
/**网元ID */
|
||||
neId: '',
|
||||
/**IMSI */
|
||||
state: undefined,
|
||||
});
|
||||
|
||||
/**查询参数重置 */
|
||||
function fnQueryReset() {
|
||||
queryParams = Object.assign(queryParams, {
|
||||
state: undefined,
|
||||
});
|
||||
fnGetList();
|
||||
}
|
||||
|
||||
/**表格状态类型 */
|
||||
type TabeStateType = {
|
||||
/**加载等待 */
|
||||
loading: boolean;
|
||||
/**紧凑型 */
|
||||
size: SizeType;
|
||||
/**记录数据 */
|
||||
data: Record<string, any>[];
|
||||
/**勾选记录 */
|
||||
selectedRowKeys: (string | number)[];
|
||||
};
|
||||
|
||||
/**表格状态 */
|
||||
let tableState: TabeStateType = reactive({
|
||||
loading: false,
|
||||
size: 'small',
|
||||
data: [],
|
||||
selectedRowKeys: [],
|
||||
});
|
||||
|
||||
/**表格字段列 */
|
||||
let tableColumns = ref<ColumnsType>([
|
||||
// {
|
||||
// title: t('common.rowId'),
|
||||
// dataIndex: 'index',
|
||||
// align: 'left',
|
||||
// width: 80,
|
||||
// },
|
||||
{
|
||||
title: t('views.neData.baseStation.name'),
|
||||
dataIndex: 'name',
|
||||
align: 'left',
|
||||
resizable: true,
|
||||
width: 120,
|
||||
minWidth: 100,
|
||||
maxWidth: 250,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: t('views.neData.baseStation.position'),
|
||||
dataIndex: 'position',
|
||||
align: 'left',
|
||||
resizable: true,
|
||||
width: 150,
|
||||
minWidth: 100,
|
||||
maxWidth: 400,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: t('views.neData.baseStation.address'),
|
||||
dataIndex: 'address',
|
||||
align: 'left',
|
||||
resizable: true,
|
||||
width: 100,
|
||||
minWidth: 100,
|
||||
maxWidth: 200,
|
||||
},
|
||||
{
|
||||
title: t('views.neData.baseStation.nbName'),
|
||||
dataIndex: 'nbName',
|
||||
align: 'left',
|
||||
resizable: true,
|
||||
width: 100,
|
||||
minWidth: 100,
|
||||
maxWidth: 200,
|
||||
},
|
||||
{
|
||||
title: t('views.neData.baseStation.ueNum'),
|
||||
dataIndex: 'ueNum',
|
||||
align: 'left',
|
||||
resizable: true,
|
||||
width: 80,
|
||||
minWidth: 80,
|
||||
maxWidth: 120,
|
||||
},
|
||||
{
|
||||
title: t('views.neData.baseStation.state'),
|
||||
dataIndex: 'state',
|
||||
key: 'state',
|
||||
align: 'left',
|
||||
resizable: true,
|
||||
width: 80,
|
||||
minWidth: 80,
|
||||
maxWidth: 120,
|
||||
},
|
||||
{
|
||||
title: t('views.neData.baseStation.time'),
|
||||
align: 'left',
|
||||
width: 150,
|
||||
customRender(opt) {
|
||||
const record = opt.value;
|
||||
if (record.state === 'OFF') {
|
||||
return record.offTime || '-';
|
||||
}
|
||||
return record.onTime || '-';
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
/**表格分页器参数 */
|
||||
let tablePagination = {
|
||||
/**当前页数 */
|
||||
current: 1,
|
||||
/**每页条数 */
|
||||
pageSize: 20,
|
||||
/**默认的每页条数 */
|
||||
defaultPageSize: 20,
|
||||
/**指定每页可以显示多少条 */
|
||||
pageSizeOptions: ['10', '20', '50', '100'],
|
||||
/**只有一页时是否隐藏分页器 */
|
||||
hideOnSinglePage: true,
|
||||
/**是否可以快速跳转至某页 */
|
||||
showQuickJumper: true,
|
||||
/**是否可以改变 pageSize */
|
||||
showSizeChanger: true,
|
||||
/**数据总数 */
|
||||
total: 0,
|
||||
showTotal: (total: number) => t('common.tablePaginationTotal', { total }),
|
||||
onChange: (page: number, pageSize: number) => {
|
||||
tablePagination.current = page;
|
||||
tablePagination.pageSize = pageSize;
|
||||
},
|
||||
};
|
||||
|
||||
/**表格多选 */
|
||||
function fnTableSelectedRowKeys(keys: (string | number)[]) {
|
||||
tableState.selectedRowKeys = keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录删除
|
||||
* @param index ID
|
||||
*/
|
||||
function fnRecordDelete(index: string) {
|
||||
const [neType, neId] = neTypeAndId.value;
|
||||
if (!neId) return;
|
||||
let msg = `Delete index as:${index}`;
|
||||
if (index === '0') {
|
||||
msg = `Remove the index checkbox:${tableState.selectedRowKeys.length}`;
|
||||
}
|
||||
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: msg,
|
||||
onOk() {
|
||||
const reqArr = [];
|
||||
if (index === '0') {
|
||||
if (tableState.selectedRowKeys.length <= 0) {
|
||||
return;
|
||||
}
|
||||
for (const v of tableState.selectedRowKeys) {
|
||||
if (neType === 'MME') {
|
||||
reqArr.push(delMMENbState(neId, v));
|
||||
}
|
||||
if (neType === 'AMF') {
|
||||
reqArr.push(delAMFNbState(neId, v));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (neType === 'MME') {
|
||||
reqArr.push(delMMENbState(neId, index));
|
||||
}
|
||||
if (neType === 'AMF') {
|
||||
reqArr.push(delAMFNbState(neId, index));
|
||||
}
|
||||
}
|
||||
if (reqArr.length <= 0) return;
|
||||
Promise.all(reqArr).then(res => {
|
||||
const resArr = res.filter(
|
||||
(item: any) => item.code !== RESULT_CODE_SUCCESS
|
||||
);
|
||||
if (resArr.length <= 0) {
|
||||
message.success({
|
||||
content: `${t('common.operateOk')}`,
|
||||
duration: 3,
|
||||
});
|
||||
fnGetList();
|
||||
} else {
|
||||
message.error({
|
||||
content: `${t('common.operateErr')}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**查询列表 */
|
||||
function fnGetList() {
|
||||
if (tableState.loading) return;
|
||||
tableState.loading = true;
|
||||
const [neType, neId] = neTypeAndId.value;
|
||||
queryParams.neId = neId;
|
||||
let req = null;
|
||||
if (neType === 'MME') {
|
||||
req = listMMENbStatelist(toRaw(queryParams));
|
||||
}
|
||||
if (neType === 'AMF') {
|
||||
req = listAMFNbStatelist(toRaw(queryParams));
|
||||
}
|
||||
if (req === null) {
|
||||
tableState.data = [];
|
||||
tableState.loading = false;
|
||||
return;
|
||||
}
|
||||
req.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
// 取消勾选
|
||||
if (tableState.selectedRowKeys.length > 0) {
|
||||
tableState.selectedRowKeys = [];
|
||||
}
|
||||
tableState.data = res.data.filter((item: any) => {
|
||||
// 状态过滤
|
||||
if (queryParams.state) {
|
||||
return item.state === queryParams.state;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
tableState.data = [];
|
||||
}
|
||||
tableState.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
const stateNum = computed(() => {
|
||||
let onNum = 0;
|
||||
let offNum = 0;
|
||||
tableState.data.forEach((item: any) => {
|
||||
if (item.state === 'ON') {
|
||||
onNum += 1;
|
||||
}
|
||||
if (item.state === 'OFF') {
|
||||
offNum += 1;
|
||||
}
|
||||
});
|
||||
return [onNum, offNum];
|
||||
});
|
||||
|
||||
/**对话框对象信息状态类型 */
|
||||
type ModalStateType = {
|
||||
/**新增框或修改框是否显示 */
|
||||
openByEdit: boolean;
|
||||
/**标题 */
|
||||
title: string;
|
||||
/**表单数据 */
|
||||
from: Record<string, any>;
|
||||
/**确定按钮 loading */
|
||||
confirmLoading: boolean;
|
||||
/**历史框 */
|
||||
openByHistory: boolean;
|
||||
/**导入框 */
|
||||
openByImport: boolean;
|
||||
importMsgArr: string[];
|
||||
};
|
||||
|
||||
/**对话框对象信息状态 */
|
||||
let modalState: ModalStateType = reactive({
|
||||
openByEdit: false,
|
||||
title: 'NB Config List',
|
||||
from: {
|
||||
address: '',
|
||||
index: undefined,
|
||||
name: '',
|
||||
nbName: undefined,
|
||||
offTime: undefined,
|
||||
onTime: undefined,
|
||||
position: '',
|
||||
state: undefined,
|
||||
ueNum: undefined,
|
||||
},
|
||||
confirmLoading: false,
|
||||
openByHistory: false,
|
||||
openByImport: false,
|
||||
importMsgArr: [],
|
||||
});
|
||||
|
||||
/**对话框内表单属性和校验规则 */
|
||||
const modalStateFrom = Form.useForm(
|
||||
modalState.from,
|
||||
reactive({
|
||||
address: [
|
||||
{ required: true, message: t('views.neData.baseStation.addressPlease') },
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: t('views.neData.baseStation.namePlease') },
|
||||
],
|
||||
position: [
|
||||
{ required: true, message: t('views.neData.baseStation.positionPlease') },
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* 对话框弹出显示为 新增或者修改
|
||||
* @param noticeId 网元id, 不传为新增
|
||||
*/
|
||||
function fnModalVisibleByEdit(edit?: string | number) {
|
||||
if (!edit) {
|
||||
modalStateFrom.resetFields(); //重置表单
|
||||
modalState.title = t('views.neData.baseStation.addRadio');
|
||||
modalState.openByEdit = true;
|
||||
// 获取最大index
|
||||
if (tableState.data.length <= 0) {
|
||||
modalState.from.index = 1;
|
||||
} else {
|
||||
const last = tableState.data[tableState.data.length - 1];
|
||||
modalState.from.index = last.index + 1;
|
||||
}
|
||||
}
|
||||
// 编辑
|
||||
if (edit === '0') {
|
||||
const row = tableState.data.find((row: any) => {
|
||||
return row.index === tableState.selectedRowKeys[0];
|
||||
});
|
||||
modalStateFrom.resetFields(); //重置表单
|
||||
Object.assign(modalState.from, row);
|
||||
modalState.title = t('views.neData.baseStation.editRadio');
|
||||
modalState.openByEdit = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出确认执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnModalOk() {
|
||||
const [neType, neId] = neTypeAndId.value;
|
||||
if (!neId) return;
|
||||
const from = JSON.parse(JSON.stringify(modalState.from));
|
||||
modalStateFrom
|
||||
.validate()
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
let result: any = null;
|
||||
if (neType === 'MME') {
|
||||
result = from.state
|
||||
? editMMENbState(neId, from)
|
||||
: addMMENbState(neId, from);
|
||||
}
|
||||
if (neType === 'AMF') {
|
||||
result = from.state
|
||||
? editAMFNbState(neId, from)
|
||||
: addAMFNbState(neId, from);
|
||||
}
|
||||
if (result === null) {
|
||||
return;
|
||||
}
|
||||
result
|
||||
.then((res: any) => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
fnModalCancel();
|
||||
fnGetList();
|
||||
} else {
|
||||
message.error({
|
||||
content: t('common.operateErr'),
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出关闭执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnModalCancel() {
|
||||
modalState.openByEdit = false;
|
||||
modalState.openByHistory = false;
|
||||
modalStateFrom.resetFields();
|
||||
}
|
||||
|
||||
/**导出当前列表 */
|
||||
function fnExportList() {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.neData.baseStation.exportTip'),
|
||||
onOk: async () => {
|
||||
if (modalState.confirmLoading) return;
|
||||
modalState.confirmLoading = true;
|
||||
|
||||
let rows: Record<string, any>[] = [];
|
||||
// 勾选的网元数据
|
||||
if (tableState.selectedRowKeys.length > 0) {
|
||||
rows = tableState.data.filter(item =>
|
||||
tableState.selectedRowKeys.includes(item.index)
|
||||
);
|
||||
} else {
|
||||
rows = tableState.data;
|
||||
}
|
||||
|
||||
const dataArr: Record<string, any>[] = [];
|
||||
for (const row of rows) {
|
||||
let data: any = {};
|
||||
data[t('views.neData.baseStation.name')] = row.name;
|
||||
data[t('views.neData.baseStation.position')] = row.position;
|
||||
data[t('views.neData.baseStation.address')] = row.address;
|
||||
data[t('views.neData.baseStation.nbName')] = row.nbName;
|
||||
data[t('views.neData.baseStation.ueNum')] = row.ueNum;
|
||||
nbState.value.find(item => {
|
||||
if (item.value === row.state) {
|
||||
data[t('views.neData.baseStation.state')] = item.label;
|
||||
}
|
||||
});
|
||||
data[t('views.neData.baseStation.time')] = row.time || '-';
|
||||
dataArr.push(data);
|
||||
}
|
||||
|
||||
// 导出
|
||||
writeSheet(dataArr, 'Sheet1', {
|
||||
header: [
|
||||
t('views.neData.baseStation.name'),
|
||||
t('views.neData.baseStation.position'),
|
||||
t('views.neData.baseStation.address'),
|
||||
t('views.neData.baseStation.nbName'),
|
||||
t('views.neData.baseStation.ueNum'),
|
||||
t('views.neData.baseStation.state'),
|
||||
t('views.neData.baseStation.time'),
|
||||
],
|
||||
}).then(fileBlob =>
|
||||
saveAs(fileBlob, `nb_state_records_export_${Date.now()}.xlsx`)
|
||||
);
|
||||
|
||||
modalState.confirmLoading = false;
|
||||
tableState.selectedRowKeys = [];
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**对话框弹出历史窗口 */
|
||||
function fnHistoryView() {
|
||||
modalState.openByHistory = true;
|
||||
}
|
||||
|
||||
/**对话框表格信息导入弹出窗口 */
|
||||
function fnModalImportOpen() {
|
||||
modalState.openByImport = true;
|
||||
}
|
||||
function fnModalImportClose() {
|
||||
modalState.openByImport = false;
|
||||
fnQueryReset();
|
||||
}
|
||||
|
||||
/**对话框表格信息导入上传 */
|
||||
function fnModalImportUpload(file: File) {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
const [neType, neId] = neTypeAndId.value;
|
||||
modalState.importMsgArr = [];
|
||||
|
||||
// 获取最大index
|
||||
let index = 0;
|
||||
if (tableState.data.length <= 0) {
|
||||
index = 1;
|
||||
} else {
|
||||
const last = tableState.data[tableState.data.length - 1];
|
||||
index = last.index + 1;
|
||||
}
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (e: any) {
|
||||
const arrayBuffer = e.target.result;
|
||||
readSheet(arrayBuffer).then(async rows => {
|
||||
console.log(rows);
|
||||
if (rows.length <= 0) {
|
||||
hide();
|
||||
message.error({
|
||||
content: t('views.neData.baseStation.importDataEmpty'),
|
||||
duration: 3,
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 开始导入
|
||||
modalState.confirmLoading = true;
|
||||
for (const row of rows) {
|
||||
const rowId = row[t('common.rowId')];
|
||||
const name = row[t('views.neData.baseStation.name')];
|
||||
const position = row[t('views.neData.baseStation.position')];
|
||||
const address = row[t('views.neData.baseStation.address')];
|
||||
let result: any = null;
|
||||
// 检查IP地址是否定义
|
||||
const hasAddress = tableState.data.find(
|
||||
item => item.address === address
|
||||
);
|
||||
if (hasAddress) {
|
||||
// 定义则更新名称位置
|
||||
if (neType === 'MME') {
|
||||
result = await editMMENbState(
|
||||
neId,
|
||||
Object.assign({}, hasAddress, {
|
||||
name,
|
||||
position,
|
||||
})
|
||||
);
|
||||
}
|
||||
if (neType === 'AMF') {
|
||||
result = await editAMFNbState(
|
||||
neId,
|
||||
Object.assign({}, hasAddress, {
|
||||
name,
|
||||
position,
|
||||
})
|
||||
);
|
||||
}
|
||||
let msg = `${t('common.rowId')}: ${rowId} ${t(
|
||||
'views.neData.baseStation.editRadio'
|
||||
)}${t('common.operateErr')}`;
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
msg = `${t('common.rowId')}: ${rowId} ${t(
|
||||
'views.neData.baseStation.editRadio'
|
||||
)}${t('common.operateOk')}`;
|
||||
}
|
||||
modalState.importMsgArr.push(msg);
|
||||
} else {
|
||||
// 未定义则新增
|
||||
const form = {
|
||||
index,
|
||||
name: `${name}`,
|
||||
position: `${position}`,
|
||||
address: `${address}`,
|
||||
};
|
||||
if (neType === 'MME') {
|
||||
result = await addMMENbState(neId, form);
|
||||
}
|
||||
if (neType === 'AMF') {
|
||||
result = await addAMFNbState(neId, form);
|
||||
}
|
||||
let msg = `${t('common.rowId')}: ${rowId} ${t(
|
||||
'views.neData.baseStation.addRadio'
|
||||
)}${t('common.operateErr')}`;
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
index += 1;
|
||||
msg = `${t('common.rowId')}: ${rowId} ${t(
|
||||
'views.neData.baseStation.addRadio'
|
||||
)}${t('common.operateOk')}`;
|
||||
}
|
||||
modalState.importMsgArr.push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
};
|
||||
reader.onerror = function (e) {
|
||||
hide();
|
||||
console.error('reader file error:', e);
|
||||
};
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
|
||||
/**对话框表格信息导入模板 */
|
||||
async function fnModalImportTemplate() {
|
||||
const baseUrl = import.meta.env.VITE_HISTORY_BASE_URL;
|
||||
const xlsxUrl = `${
|
||||
baseUrl.length === 1 && baseUrl.indexOf('/') === 0
|
||||
? ''
|
||||
: baseUrl.indexOf('/') === -1
|
||||
? '/' + baseUrl
|
||||
: baseUrl
|
||||
}/nbStateImput`;
|
||||
const lang = currentLocale.value.split('_')[0];
|
||||
saveAs(
|
||||
`${xlsxUrl}/${lang}.xlsx`,
|
||||
`nb_state_records_import_template_${Date.now()}.xlsx`
|
||||
);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 获取网元网元列表
|
||||
useNeInfoStore()
|
||||
.fnNelist()
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
if (res.data.length > 0) {
|
||||
let arr: Record<string, any>[] = [];
|
||||
useNeInfoStore().neCascaderOptions.forEach(item => {
|
||||
if (['AMF', 'MME'].includes(item.value)) {
|
||||
arr.push(JSON.parse(JSON.stringify(item)));
|
||||
}
|
||||
});
|
||||
neCascaderOptions.value = arr;
|
||||
// 无查询参数neType时 默认选择AMF
|
||||
const queryNeType = (route.query.neType as string) || 'AMF';
|
||||
const item = arr.find(s => s.value === queryNeType);
|
||||
if (item && item.children) {
|
||||
const info = item.children[0];
|
||||
neTypeAndId.value = [info.neType, info.neId];
|
||||
} else {
|
||||
const info = neCascaderOptions.value[0].children[0];
|
||||
neTypeAndId.value = [info.neType, info.neId];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message.warning({
|
||||
content: t('common.noData'),
|
||||
duration: 2,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
// 获取列表数据
|
||||
fnGetList();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ marginBottom: '24px', paddingBottom: 0 }"
|
||||
>
|
||||
<!-- 表格搜索栏 -->
|
||||
<a-form :model="queryParams" name="queryParams" layout="horizontal">
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item :label="t('views.ne.common.neType')" name="neType ">
|
||||
<a-cascader
|
||||
v-model:value="neTypeAndId"
|
||||
:options="neCascaderOptions"
|
||||
:allow-clear="false"
|
||||
:placeholder="t('common.selectPlease')"
|
||||
@change="fnGetList"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="4" :md="6" :xs="24">
|
||||
<a-form-item
|
||||
:label="t('views.neData.baseStation.state')"
|
||||
name="state"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="queryParams.state"
|
||||
:options="nbState"
|
||||
:placeholder="t('common.selectPlease')"
|
||||
@change="fnGetList"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item>
|
||||
<a-space :size="8">
|
||||
<a-button type="primary" @click.prevent="fnGetList()">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
{{ t('common.search') }}
|
||||
</a-button>
|
||||
<a-button type="default" @click.prevent="fnQueryReset">
|
||||
<template #icon><ClearOutlined /></template>
|
||||
{{ t('common.reset') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" :body-style="{ padding: '0px' }">
|
||||
<!-- 插槽-卡片左侧侧 -->
|
||||
<template #title>
|
||||
<a-space :size="8" align="center">
|
||||
<a-button type="primary" @click.prevent="fnModalVisibleByEdit()">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
{{ t('common.addText') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="default"
|
||||
:disabled="tableState.selectedRowKeys.length != 1"
|
||||
:loading="modalState.confirmLoading"
|
||||
@click.prevent="fnModalVisibleByEdit('0')"
|
||||
>
|
||||
<template #icon><FormOutlined /></template>
|
||||
{{ t('common.editText') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="default"
|
||||
danger
|
||||
:disabled="tableState.selectedRowKeys.length <= 0"
|
||||
:loading="modalState.confirmLoading"
|
||||
@click.prevent="fnRecordDelete('0')"
|
||||
>
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
{{ t('common.deleteText') }}
|
||||
</a-button>
|
||||
<a-button type="dashed" @click.prevent="fnModalImportOpen()">
|
||||
<template #icon><ImportOutlined /></template>
|
||||
{{ t('common.import') }}
|
||||
</a-button>
|
||||
<a-button type="dashed" @click.prevent="fnExportList()">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
{{ t('common.export') }}
|
||||
</a-button>
|
||||
<a-button type="default" @click.prevent="fnHistoryView()">
|
||||
<template #icon><ContainerOutlined /></template>
|
||||
{{ t('views.neData.baseStation.history') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<!-- 插槽-卡片右侧 -->
|
||||
<template #extra>
|
||||
<a-space :size="8" align="center">
|
||||
<div>
|
||||
<template
|
||||
v-if="
|
||||
queryParams.state === undefined || queryParams.state === 'ON'
|
||||
"
|
||||
>
|
||||
{{ t('views.neData.baseStation.online') }}:
|
||||
<strong style="color: green">{{ stateNum[0] }} </strong>
|
||||
</template>
|
||||
<template
|
||||
v-if="
|
||||
queryParams.state === undefined || queryParams.state === 'OFF'
|
||||
"
|
||||
>
|
||||
|
||||
{{ t('views.neData.baseStation.offline') }}:
|
||||
<strong style="color: red">
|
||||
{{ stateNum[1] }}
|
||||
</strong>
|
||||
</template>
|
||||
</div>
|
||||
<a-tooltip>
|
||||
<template #title>{{ t('common.reloadText') }}</template>
|
||||
<a-button type="text" @click.prevent="fnGetList()">
|
||||
<template #icon><ReloadOutlined /></template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<!-- 表格列表 -->
|
||||
<a-table
|
||||
class="table"
|
||||
row-key="index"
|
||||
:columns="tableColumns"
|
||||
:loading="tableState.loading"
|
||||
:data-source="tableState.data"
|
||||
:size="tableState.size"
|
||||
:pagination="tablePagination"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
selectedRowKeys: tableState.selectedRowKeys,
|
||||
onChange: fnTableSelectedRowKeys,
|
||||
}"
|
||||
:scroll="{ x: tableColumns.length * 120, y: 'calc(100vh - 480px)' }"
|
||||
@resizeColumn="(w:number, col:any) => (col.width = w)"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'state'">
|
||||
<DictTag
|
||||
:options="nbState"
|
||||
:value="record.state"
|
||||
value-default="OFF"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 新增框或修改框 -->
|
||||
<ProModal
|
||||
:drag="true"
|
||||
:width="500"
|
||||
:destroyOnClose="true"
|
||||
:keyboard="false"
|
||||
:mask-closable="false"
|
||||
:open="modalState.openByEdit"
|
||||
:title="modalState.title"
|
||||
:confirm-loading="modalState.confirmLoading"
|
||||
@ok="fnModalOk"
|
||||
@cancel="fnModalCancel"
|
||||
>
|
||||
<a-form
|
||||
name="modalStateFrom"
|
||||
layout="horizontal"
|
||||
:label-col="{ span: 6 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-form-item
|
||||
:label="t('views.neData.baseStation.name')"
|
||||
name="name"
|
||||
v-bind="modalStateFrom.validateInfos.name"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.from.name"
|
||||
allow-clear
|
||||
:maxlength="64"
|
||||
>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:label="t('views.neData.baseStation.position')"
|
||||
name="position"
|
||||
v-bind="modalStateFrom.validateInfos.position"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.from.position"
|
||||
allow-clear
|
||||
:maxlength="64"
|
||||
>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-if="!modalState.from.state"
|
||||
:label="t('views.neData.baseStation.address')"
|
||||
name="address"
|
||||
v-bind="modalStateFrom.validateInfos.address"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.from.address"
|
||||
allow-clear
|
||||
:maxlength="64"
|
||||
>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ProModal>
|
||||
|
||||
<!-- 状态历史框 -->
|
||||
<HistoryModal
|
||||
v-model:open="modalState.openByHistory"
|
||||
:title="t('views.neData.baseStation.history')"
|
||||
:ne-type="neTypeAndId[0]"
|
||||
:ne-id="neTypeAndId[1]"
|
||||
@cancel="fnModalCancel"
|
||||
></HistoryModal>
|
||||
|
||||
<!-- 上传导入表格数据文件框 -->
|
||||
<UploadModal
|
||||
:title="t('common.import')"
|
||||
@upload="fnModalImportUpload"
|
||||
@close="fnModalImportClose"
|
||||
v-model:open="modalState.openByImport"
|
||||
:ext="['.xls', '.xlsx']"
|
||||
:size="10"
|
||||
>
|
||||
<template #default>
|
||||
<a-row justify="space-between" align="middle">
|
||||
<a-col :span="12"> </a-col>
|
||||
<a-col :span="6">
|
||||
<a-button
|
||||
type="link"
|
||||
:title="t('views.system.user.downloadObj')"
|
||||
@click.prevent="fnModalImportTemplate"
|
||||
>
|
||||
{{ t('views.system.user.downloadObj') }}
|
||||
</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-textarea
|
||||
:disabled="true"
|
||||
:hidden="modalState.importMsgArr.length <= 0"
|
||||
:value="modalState.importMsgArr.join('\r\n')"
|
||||
:auto-size="{ minRows: 2, maxRows: 8 }"
|
||||
style="background-color: transparent; color: rgba(0, 0, 0, 0.85)"
|
||||
/>
|
||||
</template>
|
||||
</UploadModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.table :deep(.ant-pagination) {
|
||||
padding: 0 24px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user