Commit 2267a216 by 周田

Merge branch 'liucan' into 'main'

fix:调整数据展示页面搜索栏NoradCatID字段搜索条件位置

See merge request !30
parents 3b63ab86 2be07211
......@@ -8,6 +8,10 @@
<el-input placeholder="请输入目标名称" v-model="searchTargetName" style="width: 180px" />
</div>
<div>
<span style="color: white">站点名称:</span>
<el-input placeholder="请输入" v-model="searchStation" style="width: 170.5px" />
</div>
<div>
<span style="color: white">采集时间:</span>
<el-config-provider :locale="zhCn">
<el-date-picker
......@@ -23,12 +27,7 @@
/>
</el-config-provider>
</div>
<div>
<span style="color: white">站点名称:</span>
<el-input placeholder="请输入" v-model="searchStation" style="width: 170.5px" />
</div>
</div>
<div class="btns">
<el-button plain type="primary" @click="getData">查询</el-button>
<el-button plain @click="resetForm">重置</el-button>
......
......@@ -4,6 +4,10 @@
<div class="form-content">
<div class="left">
<div>
<span style="color: white">SNS Notice ID:</span>
<el-input placeholder="请输入ID" v-model="searchTargetId" style="width: 170.5px" />
</div>
<div>
<span style="color: white">目标名称:</span>
<el-input placeholder="请输入目标名称" v-model="searchTargetName" style="width: 180px" />
</div>
......@@ -23,10 +27,6 @@
/>
</el-config-provider>
</div>
<div>
<span style="color: white">SNS Notice ID:</span>
<el-input placeholder="请输入ID" v-model="searchTargetId" style="width: 170.5px" />
</div>
</div>
<div class="btns">
<el-button plain type="primary" @click="getData">查询</el-button>
......@@ -56,29 +56,29 @@
<el-table-column property="item.plan_txt" label="计划/非计划类型" show-overflow-tooltip />
<el-table-column property="identity.ntc_type" label="是否为同步" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.identity.ntc_type === "G" ? "是" : "否" }}
{{ scope.row.identity.ntc_type === 'G' ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column property="identity.long_nom" label="同步位置" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.identity.long_nom === null ? "-" : scope.row.identity.long_nom }}
{{ scope.row.identity.long_nom === null ? '-' : scope.row.identity.long_nom }}
</template>
</el-table-column>
<el-table-column property="item.freq_min" label="最低频率" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.item.freq_min === null ? "-" : scope.row.item.freq_min }}
{{ scope.row.item.freq_min === null ? '-' : scope.row.item.freq_min }}
</template>
</el-table-column>
<el-table-column property="item.freq_max" label="最高频率" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.item.freq_max === null ? "-" : scope.row.item.freq_max }}
{{ scope.row.item.freq_max === null ? '-' : scope.row.item.freq_max }}
</template>
</el-table-column>
<el-table-column property="regulatory_status.active_status" label="状态" show-overflow-tooltip />
<el-table-column property="regulatory_status.prd_valid" label="有效期" show-overflow-tooltip />
<el-table-column property="regulatory_status.d_reg_limit" label="最早使用日期" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.regulatory_status.d_reg_limit === null ? "-" : scope.row.regulatory_status.d_reg_limit }}
{{ scope.row.regulatory_status.d_reg_limit === null ? '-' : scope.row.regulatory_status.d_reg_limit }}
</template>
</el-table-column>
<el-table-column
......@@ -130,7 +130,7 @@
</div>
<div class="info-item">
<span class="item-title">网络组织:</span>
<span class="item">{{ ntwkOrg ?? "--" }}</span>
<span class="item">{{ ntwkOrg ?? '--' }}</span>
</div>
<div class="info-item">
<span class="item-title">计划/非计划类型:</span>
......@@ -200,7 +200,7 @@
<el-divider style="margin: 0"></el-divider>
<div class="info-item">
<span class="item-title">是否为同步:</span>
<span class="item">{{ isNtcType === "G" ? "是" : "否" }}</span>
<span class="item">{{ isNtcType === 'G' ? '是' : '否' }}</span>
</div>
<div class="info-item">
<span class="item-title">同步位置:</span>
......@@ -227,151 +227,151 @@
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import Pagination from "@/components/pagination/index.vue";
import exportDialog from "@/components/Export/index.vue";
import { getItuList, getItuDetail } from "@/api/spiderData";
import { ElMessage } from "element-plus";
import TableSearch from "@/components/TableSearch.vue";
import { onMounted, ref } from 'vue'
import Pagination from '@/components/pagination/index.vue'
import exportDialog from '@/components/Export/index.vue'
import { getItuList, getItuDetail } from '@/api/spiderData'
import { ElMessage } from 'element-plus'
import TableSearch from '@/components/TableSearch.vue'
// ElConfigProvider 组件
import { ElConfigProvider } from "element-plus";
import { ElConfigProvider } from 'element-plus'
// 引入中文包
import zhCn from "element-plus/es/locale/lang/zh-cn";
defineOptions({ name: "Pagination" });
import zhCn from 'element-plus/es/locale/lang/zh-cn'
defineOptions({ name: 'Pagination' })
// 更改分页文字
zhCn.el.pagination.total = "共 `{total} 条`";
zhCn.el.pagination.goto = "跳至";
zhCn.el.pagination.pagesize = "条/页";
zhCn.el.pagination.pageClassifier = "页";
const searchTargetName = ref("");
const searchTimeValue = ref("");
const searchTargetId = ref("");
const showDeleteDialog = ref(false);
const detailVisibleValue = ref(false);
zhCn.el.pagination.total = '共 `{total} 条`'
zhCn.el.pagination.goto = '跳至'
zhCn.el.pagination.pagesize = '条/页'
zhCn.el.pagination.pageClassifier = '页'
const searchTargetName = ref('')
const searchTimeValue = ref('')
const searchTargetId = ref('')
const showDeleteDialog = ref(false)
const detailVisibleValue = ref(false)
// SNS Notice ID
const snsId = ref("");
const snsId = ref('')
// 主管部门
const department = ref("");
const department = ref('')
//详细主管部门
const departmentDetail = ref("");
const departmentDetail = ref('')
//网络组织
const ntwkOrg = ref("");
const ntwkOrg = ref('')
//卫星网络类型
const ntwkType = ref("");
const ntwkType = ref('')
// 目标名称
const targetName = ref("");
const targetName = ref('')
// 计划/非计划类型
const planType = ref("");
const planType = ref('')
// 是否为同步
const syncType = ref("");
const syncType = ref('')
// 同步位置
const syncPosition = ref("");
const syncPosition = ref('')
// 近地点
const perigee = ref("");
const perigee = ref('')
// 远地点
const apogee = ref("");
const apogee = ref('')
// 最低海拔
const lowestAltitude = ref("");
const lowestAltitude = ref('')
// 参考主体
const referenceSubject = ref("");
const referenceSubject = ref('')
// 最低频率
const lowestFrequency = ref("");
const lowestFrequency = ref('')
// 最高频率
const highestFrequency = ref("");
const highestFrequency = ref('')
// 状态
const status = ref("");
const status = ref('')
//是否为同步
const isNtcType = ref("");
const isNtcType = ref('')
// 有效期
const validityPeriod = ref("");
const validityPeriod = ref('')
// 最早使用日期
const earliestUsageDate = ref("");
const earliestUsageDate = ref('')
// 是否确认使用
const isUsed = ref("");
const isUsed = ref('')
// 是否暂停使用
const isPauseUsed = ref("");
const isPauseUsed = ref('')
// 记录时间
const recordTime = ref("");
const recordTime = ref('')
// 是否纳入国际频率总表
const IsInTheInternationalFrequencyList = ref("");
const IsInTheInternationalFrequencyList = ref('')
// 最早监管日期
const earliestRegulatoryDate = ref("");
const earliestRegulatoryDate = ref('')
// 是否恢复使用
const isRestoreUsed = ref("");
const isRestoreUsed = ref('')
// 有效期卫星网络旧名称
const validityPeriodSatelliteNetworkOldName = ref("");
const validityPeriodSatelliteNetworkOldName = ref('')
// 最新相关 BR IFIC 发布日期
const BFIFICdate = ref("");
const tableData = ref([]);
const BFIFICdate = ref('')
const tableData = ref([])
const pageObj = ref({
total: 0,
pageSize: 10,
pageNo: 1,
});
pageNo: 1
})
// 查看数据详情的方法
const handleDetails = async (id: any) => {
const res = await getItuDetail({ id: id._id });
snsId.value = res.data.item.ntc_id;
department.value = res.data.item.adm;
departmentDetail.value = res.data.item.notifying_adm_tooltip;
ntwkOrg.value = res.data.item.ntwk_org;
ntwkType.value = res.data.item.notice_type_tooltip;
targetName.value = res.data.identity.sat_name;
planType.value = res.data.identity.plan_type;
syncType.value = res.data.identity.ntc_type;
isNtcType.value = res.data.item.ntc_type;
syncPosition.value = res.data.identity.long_nom === null ? "--" : res.data.identity.long_nom;
perigee.value = res.data.item.minPerigee === null ? "--" : res.data.item.minPerigee;
apogee.value = res.data.item.maxApog === null ? "--" : res.data.item.maxApog;
lowestAltitude.value = res.data.item.minAltitude === null ? "--" : res.data.item.minAltitude;
referenceSubject.value = res.data.item.ref_body === null ? "--" : res.data.item.ref_body;
lowestFrequency.value = res.data.item.freq_min === null ? "--" : res.data.item.freq_min;
highestFrequency.value = res.data.item.freq_max === null ? "--" : res.data.item.freq_max;
status.value = res.data.regulatory_status.active_status;
validityPeriod.value = res.data.regulatory_status.prd_valid;
const res = await getItuDetail({ id: id._id })
snsId.value = res.data.item.ntc_id
department.value = res.data.item.adm
departmentDetail.value = res.data.item.notifying_adm_tooltip
ntwkOrg.value = res.data.item.ntwk_org
ntwkType.value = res.data.item.notice_type_tooltip
targetName.value = res.data.identity.sat_name
planType.value = res.data.identity.plan_type
syncType.value = res.data.identity.ntc_type
isNtcType.value = res.data.item.ntc_type
syncPosition.value = res.data.identity.long_nom === null ? '--' : res.data.identity.long_nom
perigee.value = res.data.item.minPerigee === null ? '--' : res.data.item.minPerigee
apogee.value = res.data.item.maxApog === null ? '--' : res.data.item.maxApog
lowestAltitude.value = res.data.item.minAltitude === null ? '--' : res.data.item.minAltitude
referenceSubject.value = res.data.item.ref_body === null ? '--' : res.data.item.ref_body
lowestFrequency.value = res.data.item.freq_min === null ? '--' : res.data.item.freq_min
highestFrequency.value = res.data.item.freq_max === null ? '--' : res.data.item.freq_max
status.value = res.data.regulatory_status.active_status
validityPeriod.value = res.data.regulatory_status.prd_valid
earliestUsageDate.value =
res.data.regulatory_status.d_reg_limit === null ? "--" : res.data.regulatory_status.d_reg_limit;
isUsed.value = res.data.regulatory_status.f_biu_grps;
isPauseUsed.value = res.data.regulatory_status.resumption_list;
recordTime.value = res.data.crawl_time;
IsInTheInternationalFrequencyList.value = res.data.regulatory_status.mifr;
earliestRegulatoryDate.value = res.data.regulatory_status.d_inuse_list;
isRestoreUsed.value = res.data.regulatory_status.resumption_list;
validityPeriodSatelliteNetworkOldName.value = res.data.regulatory_status.old_satellite_network_name;
BFIFICdate.value = res.data.regulatory_status.d_wic === null ? "--" : res.data.regulatory_status.d_wic;
detailVisibleValue.value = true;
};
res.data.regulatory_status.d_reg_limit === null ? '--' : res.data.regulatory_status.d_reg_limit
isUsed.value = res.data.regulatory_status.f_biu_grps
isPauseUsed.value = res.data.regulatory_status.resumption_list
recordTime.value = res.data.crawl_time
IsInTheInternationalFrequencyList.value = res.data.regulatory_status.mifr
earliestRegulatoryDate.value = res.data.regulatory_status.d_inuse_list
isRestoreUsed.value = res.data.regulatory_status.resumption_list
validityPeriodSatelliteNetworkOldName.value = res.data.regulatory_status.old_satellite_network_name
BFIFICdate.value = res.data.regulatory_status.d_wic === null ? '--' : res.data.regulatory_status.d_wic
detailVisibleValue.value = true
}
//表单loading标记
const tableLoading = ref(false);
const tableLoading = ref(false)
// 获取itu数据列表的方法
//重置搜索条件
const resetForm = () => {
searchTargetName.value = "";
searchTargetId.value = "";
searchTimeValue.value = "";
getData();
};
searchTargetName.value = ''
searchTargetId.value = ''
searchTimeValue.value = ''
getData()
}
const getData = async () => {
tableLoading.value = true;
tableLoading.value = true
const res = await await getItuList({
sat_name: searchTargetName.value,
ntc_id: searchTargetId.value,
times: searchTimeValue.value,
page: pageObj.value.pageNo,
size: pageObj.value.pageSize,
});
pageObj.value.total = res.data.total;
tableData.value = res.data.list;
tableLoading.value = false;
};
size: pageObj.value.pageSize
})
pageObj.value.total = res.data.total
tableData.value = res.data.list
tableLoading.value = false
}
const handleClose = () => {
detailVisibleValue.value = false;
};
detailVisibleValue.value = false
}
onMounted(() => {
getData();
});
getData()
})
</script>
<style scoped lang="scss">
......@@ -391,7 +391,7 @@ onMounted(() => {
/* 工具栏样式 */
.toolbarStyle {
background-image: url("@/assets/picture/box3.png");
background-image: url('@/assets/picture/box3.png');
background-size: 100% 100%;
background-repeat: no-repeat;
}
......
......@@ -4,6 +4,10 @@
<div class="form-content">
<div class="left">
<div>
<span style="color: white">Norad Cat ID:</span>
<el-input placeholder="请输入ID" style="width: 170.5px" v-model="noradCatId" />
</div>
<div>
<span style="color: white">目标名称:</span>
<el-input placeholder="请输入目标名称" style="width: 180px" v-model="searchTargetName" />
</div>
......@@ -23,10 +27,6 @@
/>
</el-config-provider>
</div>
<div>
<span style="color: white">Norad Cat ID:</span>
<el-input placeholder="请输入ID" style="width: 170.5px" v-model="noradCatId" />
</div>
</div>
<div class="btns">
<el-button plain type="primary" @click="getData">查询</el-button>
......@@ -214,159 +214,159 @@
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import Pagination from "@/components/pagination/index.vue";
import exportDialog from "@/components/Export/index.vue";
import { getStList, getStDetail } from "@/api/spiderData";
import { ElMessage } from "element-plus";
import { onMounted, ref } from 'vue'
import Pagination from '@/components/pagination/index.vue'
import exportDialog from '@/components/Export/index.vue'
import { getStList, getStDetail } from '@/api/spiderData'
import { ElMessage } from 'element-plus'
// ElConfigProvider 组件
import { ElConfigProvider } from "element-plus";
import TableSearch from "@/components/TableSearch.vue";
import { ElConfigProvider } from 'element-plus'
import TableSearch from '@/components/TableSearch.vue'
// 引入中文包
import zhCn from "element-plus/es/locale/lang/zh-cn";
defineOptions({ name: "Pagination" });
import zhCn from 'element-plus/es/locale/lang/zh-cn'
defineOptions({ name: 'Pagination' })
// 更改分页文字
zhCn.el.pagination.total = "共 `{total} 条`";
zhCn.el.pagination.goto = "跳至";
zhCn.el.pagination.pagesize = "条/页";
zhCn.el.pagination.pageClassifier = "页";
const searchTargetName = ref("");
const noradCatId = ref("");
const showDeleteDialog = ref(false);
const timeValue = ref("");
const detailVisibleValue = ref(false);
zhCn.el.pagination.total = '共 `{total} 条`'
zhCn.el.pagination.goto = '跳至'
zhCn.el.pagination.pagesize = '条/页'
zhCn.el.pagination.pageClassifier = '页'
const searchTargetName = ref('')
const noradCatId = ref('')
const showDeleteDialog = ref(false)
const timeValue = ref('')
const detailVisibleValue = ref(false)
// NoradCatID
const NoradCatID = ref("");
const NoradCatID = ref('')
// 目标名称
const targetName = ref("");
const objectType = ref("");
const targetName = ref('')
const objectType = ref('')
// INTLDES
const intleds = ref("");
const intleds = ref('')
// 类型
const type = ref("");
const type = ref('')
// 记录时间
const recordTime = ref("");
const recordTime = ref('')
// 所属国家
const belongCountry = ref("");
const belongCountry = ref('')
// 近地点
const perigee = ref("");
const perigee = ref('')
// 远地点
const apogee = ref("");
const apogee = ref('')
// 周期
const period = ref("");
const period = ref('')
// RCS
const rcs = ref("");
const rcs = ref('')
// SITE
const site = ref("");
const site = ref('')
// TLE
const tle = ref("");
const tle = ref('')
//近地点幅角
const argOfPericenter = ref("");
const argOfPericenter = ref('')
//弹道系数
const bStar = ref("");
const bStar = ref('')
//备注
const comment = ref("");
const comment = ref('')
//偏心率 ECCENTRICITY
const eccentricity = ref("");
const eccentricity = ref('')
//倾斜角 INCLINATION
const inclination = ref("");
const inclination = ref('')
//升交点赤经 RA_OF_ASC_NODE
const raOfAscNode = ref("");
const raOfAscNode = ref('')
//平近点角 MEAN_ANOMALY
const meanAnomaly = ref("");
const meanAnomaly = ref('')
//RCS_SIZE
const rcsSize = ref("");
const rcsSize = ref('')
//LAUNCH_DATE
const launchDate = ref("");
const countryCode = ref("");
const meanMotionDot = ref("");
const meanMotionDdot = ref("");
const revAtEpoch = ref("");
const launchDate = ref('')
const countryCode = ref('')
const meanMotionDot = ref('')
const meanMotionDdot = ref('')
const revAtEpoch = ref('')
//半长轴SEMIMAJOR_AXIS
const semimajorAxis = ref("");
const semimajorAxis = ref('')
//第一行数据 TLE_LINE0
const tleLine0 = ref("");
const tleLine0 = ref('')
//第二行数据 TLE_LINE0
const tleLine1 = ref("");
const tleLine1 = ref('')
//第三行数据 TLE_LINE0
const tleLine2 = ref("");
const tleLine2 = ref('')
const tableData = ref([]);
const tableData = ref([])
const pageObj = ref({
total: 10,
pageSize: 10,
pageNo: 1,
});
pageNo: 1
})
// 查看数据详情的方法
const handleDetails = async (row: any) => {
const res = await getStDetail({ id: row._id });
console.log(res);
const res = await getStDetail({ id: row._id })
console.log(res)
NoradCatID.value = res.data.NORAD_CAT_ID;
rcsSize.value = res.data.RCS_SIZE;
launchDate.value = res.data.LAUNCH_DATE;
semimajorAxis.value = res.data.SEMIMAJOR_AXIS;
targetName.value = res.data.OBJECT_NAME;
tleLine0.value = res.data.TLE_LINE0;
tleLine1.value = res.data.TLE_LINE1;
tleLine2.value = res.data.TLE_LINE2;
inclination.value = res.data.INCLINATION;
meanAnomaly.value = res.data.MEAN_ANOMALY;
eccentricity.value = res.data.ECCENTRICITY;
raOfAscNode.value = res.data.RA_OF_ASC_NODE;
comment.value = res.data.COMMENT;
type.value = res.data.OBJECT_TYPE;
argOfPericenter.value = res.data.ARG_OF_PERICENTER;
bStar.value = res.data.BSTAR;
period.value = res.data.PERIOD;
intleds.value = res.data.INTLDES;
recordTime.value = res.data.CREATION_DATE;
belongCountry.value = res.data.COUNTRY_CODE;
perigee.value = res.data.PERIAPSIS;
apogee.value = res.data.APOAPSIS;
rcs.value = res.data.RCS_SIZE;
site.value = res.data.SITE;
NoradCatID.value = res.data.NORAD_CAT_ID
rcsSize.value = res.data.RCS_SIZE
launchDate.value = res.data.LAUNCH_DATE
semimajorAxis.value = res.data.SEMIMAJOR_AXIS
targetName.value = res.data.OBJECT_NAME
tleLine0.value = res.data.TLE_LINE0
tleLine1.value = res.data.TLE_LINE1
tleLine2.value = res.data.TLE_LINE2
inclination.value = res.data.INCLINATION
meanAnomaly.value = res.data.MEAN_ANOMALY
eccentricity.value = res.data.ECCENTRICITY
raOfAscNode.value = res.data.RA_OF_ASC_NODE
comment.value = res.data.COMMENT
type.value = res.data.OBJECT_TYPE
argOfPericenter.value = res.data.ARG_OF_PERICENTER
bStar.value = res.data.BSTAR
period.value = res.data.PERIOD
intleds.value = res.data.INTLDES
recordTime.value = res.data.CREATION_DATE
belongCountry.value = res.data.COUNTRY_CODE
perigee.value = res.data.PERIAPSIS
apogee.value = res.data.APOAPSIS
rcs.value = res.data.RCS_SIZE
site.value = res.data.SITE
tle.value = `${res.data.TLE_LINE0}
${res.data.TLE_LINE1}
${res.data.TLE_LINE2}`;
detailVisibleValue.value = true;
countryCode.value = res.data.COUNTRY_CODE;
meanMotionDot.value = res.data.MEAN_MOTION_DOT;
meanMotionDdot.value = res.data.MEAN_MOTION_DDOT;
revAtEpoch.value = res.data.REV_AT_EPOCH;
objectType.value = res.data.OBJECT_TYPE;
};
${res.data.TLE_LINE2}`
detailVisibleValue.value = true
countryCode.value = res.data.COUNTRY_CODE
meanMotionDot.value = res.data.MEAN_MOTION_DOT
meanMotionDdot.value = res.data.MEAN_MOTION_DDOT
revAtEpoch.value = res.data.REV_AT_EPOCH
objectType.value = res.data.OBJECT_TYPE
}
//表单loading标记
const tableLoading = ref(false);
const tableLoading = ref(false)
//重置搜索条件
const resetForm = () => {
noradCatId.value = "";
searchTargetName.value = "";
timeValue.value = "";
getData();
};
noradCatId.value = ''
searchTargetName.value = ''
timeValue.value = ''
getData()
}
// 获取st数据列表的方法
const getData = async () => {
tableLoading.value = true;
tableLoading.value = true
const res = await getStList({
norad_cat_id: noradCatId.value,
object_name: searchTargetName.value,
times: timeValue.value,
page: pageObj.value.pageNo,
size: pageObj.value.pageSize,
});
pageObj.value.total = res.data.total;
tableData.value = res.data.list;
tableLoading.value = false;
};
size: pageObj.value.pageSize
})
pageObj.value.total = res.data.total
tableData.value = res.data.list
tableLoading.value = false
}
const handleClose = () => {
detailVisibleValue.value = false;
};
detailVisibleValue.value = false
}
onMounted(() => {
getData();
});
getData()
})
</script>
<style scoped lang="scss">
......@@ -386,7 +386,7 @@ onMounted(() => {
/* 工具栏样式 */
.toolbarStyle {
background-image: url("@/assets/picture/box3.png");
background-image: url('@/assets/picture/box3.png');
background-size: 100% 100%;
background-repeat: no-repeat;
}
......
......@@ -63,14 +63,8 @@
</div>
<div class="footer">
<div class="No">
<span style="color: white; font-weight: 500">NORAD编号:</span>
<el-input
@input="handleNumInput"
maxlength="6"
placeholder="请输入编号"
v-model="curSateNo"
style="width: 100px"
></el-input>
<span class="text-white font-bold text-nowrap">NORAD编号:</span>
<el-input @input="handleNumInput" maxlength="6" placeholder="请输入编号" v-model="curSateNo"></el-input>
</div>
<div class="btns">
<el-button :disabled="curSateNo == ''" plain type="primary" @click="addNoToList">添加</el-button>
......@@ -84,9 +78,9 @@
type="danger"
size="small"
@click="
(e:MouseEvent) => {
confirm(e);
delNoList();
(e: MouseEvent) => {
confirm(e)
delNoList()
}
"
>
......@@ -101,252 +95,252 @@
</template>
<script setup lang="ts">
import { ref, onMounted, nextTick, watch } from "vue";
import Pagination from "@/components/pagination/index.vue";
import { useRouter } from "vue-router";
import { getSpiderList, addSateNo, getSateIdList, deleteSateNoList, addSateNoList } from "@/api/system.ts";
import NoItem from "./components/NoItem.vue";
import { ElMessage, type UploadProps, type UploadRawFile } from "element-plus";
import MenuTitle from "@/components/MenuTitle.vue";
const router = useRouter();
const tableData = ref([]);
import { ref, onMounted, nextTick, watch } from 'vue'
import Pagination from '@/components/pagination/index.vue'
import { useRouter } from 'vue-router'
import { getSpiderList, addSateNo, getSateIdList, deleteSateNoList, addSateNoList } from '@/api/system.ts'
import NoItem from './components/NoItem.vue'
import { ElMessage, type UploadProps, type UploadRawFile } from 'element-plus'
import MenuTitle from '@/components/MenuTitle.vue'
const router = useRouter()
const tableData = ref([])
const pageObj = ref({
total: 10,
pageSize: 10,
pageNo: 1,
});
pageNo: 1
})
const handleDetails = (row: any) => {
router.push({
path: "/osTaskInformation/list",
path: '/osTaskInformation/list',
query: {
jump: "yes",
jump: 'yes',
spiderType: row.spider,
page: "spiderManager",
},
});
};
page: 'spiderManager'
}
})
}
// 获取爬虫数据的方法
const getData = async () => {
const res = await getSpiderList({ scrapydServerId: "1", project: "spiders" });
tableData.value = res.data;
};
const res = await getSpiderList({ scrapydServerId: '1', project: 'spiders' })
tableData.value = res.data
}
const editDialogVisible = ref(false);
const editDialogVisible = ref(false)
//编号item类型定义
interface noradItem {
id: number;
norad_cat_id: string;
create_time: string;
id: number
norad_cat_id: string
create_time: string
}
const sateNoList = ref<noradItem[]>([]);
const sateNoList = ref<noradItem[]>([])
const curSateNo = ref("");
const curSateNo = ref('')
const curSelSateNo = ref<string[]>([]);
const curSelSateNo = ref<string[]>([])
const resetSelected = ref(false);
const resetSelected = ref(false)
const handleDialogClose = () => {
// 清空已选中的编号
curSelSateNo.value = [];
curSelSateNo.value = []
// 通知子组件全部取消选中
resetSelected.value = true;
resetSelected.value = true
nextTick(() => {
resetSelected.value = false;
});
};
resetSelected.value = false
})
}
//添加选中项到当前列表
const handleSateAdd = (no: string) => {
if (checkNoLeSix(no)) {
curSelSateNo.value.push(no);
curSelSateNo.value.push(no)
}
};
}
//从当前列表删除选中项
const handleSateDel = (no: string | number) => {
curSelSateNo.value = curSelSateNo.value.filter((item) => item != no);
};
curSelSateNo.value = curSelSateNo.value.filter((item) => item != no)
}
//添加编号发到后端
const addNoToList = async () => {
const res = await addSateNo({ norad_id: curSateNo.value });
const res = await addSateNo({ norad_id: curSateNo.value })
if (res.code === 0) {
ElMessage.success("添加编号成功");
getSateNoList();
ElMessage.success('添加编号成功')
getSateNoList()
}
curSateNo.value = "";
};
curSateNo.value = ''
}
//编号文件导入后发送到后端
const fileImptAddNoList = async () => {
try {
const res = await addSateNoList({ norad_id: textFileNumbers.value });
const res = await addSateNoList({ norad_id: textFileNumbers.value })
if (res.code === 0) {
ElMessage.success("导入编号成功");
ElMessage.success('导入编号成功')
}
getSateNoList();
getSateNoList()
} catch (error: any) {
ElMessage.error(error.message);
ElMessage.error(error.message)
}
};
}
//删除选中编号
const delNoList = async () => {
try {
const res = await deleteSateNoList({ norad_id: curSelSateNo.value });
const res = await deleteSateNoList({ norad_id: curSelSateNo.value })
if (res.code === 0) {
ElMessage.success("删除编号成功");
ElMessage.success('删除编号成功')
}
resetSelected.value = true;
curSelSateNo.value = [];
resetSelected.value = true
curSelSateNo.value = []
nextTick(() => {
resetSelected.value = false;
});
getSateNoList();
resetSelected.value = false
})
getSateNoList()
} catch (error: any) {
ElMessage.error(error.message);
ElMessage.error(error.message)
}
};
}
const noContentRef = ref<HTMLDivElement | null>(null);
const noContentRef = ref<HTMLDivElement | null>(null)
//新添加滚动到底部
const scrollToBottom = () => {
nextTick(() => {
const container = noContentRef.value;
const container = noContentRef.value
if (container) {
container.scrollTop = container.scrollHeight - container.clientHeight;
container.scrollTop = container.scrollHeight - container.clientHeight
}
});
};
})
}
//检查输入的编号个数不大于6
const checkNoLeSix = (no: number | string): boolean => {
if (String(no).length > 6) {
ElMessage.error("编号位数错误,长度不能大于6位");
return false;
ElMessage.error('编号位数错误,长度不能大于6位')
return false
}
return true;
};
return true
}
const handleNumInput = (value: string) => {
const filtered = value.replace(/\D/g, "");
curSateNo.value = filtered.slice(0, 6);
};
const filtered = value.replace(/\D/g, '')
curSateNo.value = filtered.slice(0, 6)
}
const handleEditSateId = async () => {
editDialogVisible.value = true;
getSateNoList();
};
editDialogVisible.value = true
getSateNoList()
}
//获取编号列表
const getSateNoList = async () => {
try {
const res = await getSateIdList();
const res = await getSateIdList()
if (res.code === 0) {
sateNoList.value = res.data.list || [];
sateNoList.value = res.data.list || []
}
} catch (error: any) {
ElMessage.error(error.message);
ElMessage.error(error.message)
}
};
}
//读取文本文件后存储读取的编号
const textFileNumbers = ref<string[]>([]);
const textFileNumbers = ref<string[]>([])
//监听导入文件的数组变化
watch(textFileNumbers, (newVal) => {
if (newVal.length > 0) {
newVal.forEach((num) => {});
fileImptAddNoList();
newVal.forEach((num) => {})
fileImptAddNoList()
}
});
})
//判断上传文件类型
const beforeUpload: UploadProps["beforeUpload"] = (rawFile: UploadRawFile) => {
const beforeUpload: UploadProps['beforeUpload'] = (rawFile: UploadRawFile) => {
// 检查文件是否存在
if (!rawFile) {
ElMessage.error("请选择文件");
return Promise.reject();
ElMessage.error('请选择文件')
return Promise.reject()
}
// 检查文件类型
const isTxtType = rawFile.type === "text/plain";
const isTxtType = rawFile.type === 'text/plain'
// 检查文件后缀名
const fileName = rawFile.name;
const isTxtExt = fileName.lastIndexOf(".") > 0 && fileName.slice(fileName.lastIndexOf(".")).toLowerCase() === ".txt";
const fileName = rawFile.name
const isTxtExt = fileName.lastIndexOf('.') > 0 && fileName.slice(fileName.lastIndexOf('.')).toLowerCase() === '.txt'
// 如果两种检查都不通过
if (!isTxtType && !isTxtExt) {
ElMessage.error("只能上传 .txt 格式的文件!");
ElMessage.error('只能上传 .txt 格式的文件!')
//阻止上传
return Promise.reject();
return Promise.reject()
}
// 校验通过
return true;
};
return true
}
//处理文件上传
const handleFileChange: UploadProps["onChange"] = (uploadFile) => {
const handleFileChange: UploadProps['onChange'] = (uploadFile) => {
//清空之前的值
textFileNumbers.value = [];
textFileNumbers.value = []
//获取原生file对象
const file = uploadFile.raw;
const file = uploadFile.raw
if (!file || !(file instanceof File)) {
ElMessage.error("未获取到有效文件");
return;
ElMessage.error('未获取到有效文件')
return
}
//验证文件类型
if (file.type !== "text/plain" && !file.name.endsWith(".txt")) {
ElMessage.error("请上传.txt文件");
if (file.type !== 'text/plain' && !file.name.endsWith('.txt')) {
ElMessage.error('请上传.txt文件')
}
//使用FileReader读取文件内容
const reader = new FileReader();
const reader = new FileReader()
//成功的回调
reader.onload = (event: ProgressEvent<FileReader>) => {
const textContent = event.target?.result as string;
const textContent = event.target?.result as string
if (!textContent) {
throw new Error("文件内容为空");
throw new Error('文件内容为空')
}
textFileNumbers.value = parseTextToNumbers(textContent).map((item) => String(item));
};
textFileNumbers.value = parseTextToNumbers(textContent).map((item) => String(item))
}
//失败的回调
reader.onerror = () => {
ElMessage.error("文件导入失败,请检查文件是否损坏或重试");
};
ElMessage.error('文件导入失败,请检查文件是否损坏或重试')
}
//读取文件
reader.readAsText(file, "utf-8");
};
reader.readAsText(file, 'utf-8')
}
//解析文件内容
const parseTextToNumbers = (text: string): number[] => {
if (!text) return [];
if (!text) return []
//换行符分割
const lines = text.split(/\r?\n/);
const lines = text.split(/\r?\n/)
//遍历处理
const numbers = lines
.map((line) => {
//去除首尾空格
const trimmedLine = line.trim();
if (trimmedLine === "") return null;
const number = Number(trimmedLine);
const trimmedLine = line.trim()
if (trimmedLine === '') return null
const number = Number(trimmedLine)
if (isNaN(number)) {
return null;
return null
}
return number;
return number
})
.filter((num): num is number => num !== null);
.filter((num): num is number => num !== null)
return numbers;
};
return numbers
}
onMounted(() => {
getData();
});
getData()
})
</script>
<style scoped>
......@@ -452,4 +446,8 @@ onMounted(() => {
.btn-group .el-button {
flex-shrink: 0;
}
:deep .el-input__inner {
color: white;
}
</style>
......@@ -192,11 +192,9 @@ const getTaskList = async () => {
jobNameOptions.value = taskList.value
.filter((task: any) => task.id)
.map((task: any) => ({
label: task.kwargs.spider,
label: JSON.parse(task.kwargs.options).jobName,
value: task.id
}))
console.log(taskList.value)
}
// 获取任务执行记录列表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment