邓洁 : 站点静态数据

This commit is contained in:
邓洁
2023-12-17 21:56:29 +08:00
parent 1c3243bf7b
commit f4d2eaeaa0
3 changed files with 102 additions and 43 deletions

View File

@@ -10,7 +10,7 @@
<div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon" @click="handleAdd">
添加
</div>
<div class="all-btn">
<div class="all-btn" @click="handleChooseAll">
全选
</div>
<div class="all-btn del-btn" @click="handleMoreDelete">
@@ -47,7 +47,7 @@
</div>
</div>
</div>
<div class="edit-btn" @click="handleEdit(item.siteId)">
<div class="edit-btn" @click="handleEdit(item)">
<div class="edit-icon"></div>
<div>站点编辑</div>
</div>
@@ -100,7 +100,35 @@ import {editSite, getSiteDetail, getSiteList, addSite, deleteSite} from "@/api/s
import {ElMessage, ElMessageBox} from "element-plus";
const router = useRouter()
const siteList = ref([])
const siteList = ref([
{
siteName: '松江站',
info:{
tunnelNum: 1,
tunnelName: '一号隧道',
constructionLength: 500,
implementationLength: 10
}
},
{
siteName: '松江站',
info:{
tunnelNum: 1,
tunnelName: '二号隧道',
constructionLength: 500,
implementationLength: 10
}
},
{
siteName: '松江站',
info:{
tunnelNum: 1,
tunnelName: '三号隧道',
constructionLength: 500,
implementationLength: 10
}
}
])
const siteIds = ref([])
const siteNameList = ref([])
const info = ref({
@@ -112,8 +140,8 @@ const info = ref({
const title = ref('新增站点')
const isClick = ref(false);
const isVisited = ref(false);
const total = ref();
const showAddIcon = ref(false)
const total = ref(10);
const showAddIcon = ref(true)
const pageInfo = reactive({
pageNum: 1,
pageSize: 6
@@ -141,7 +169,7 @@ const getList = () => {
}
item.checked = false
})
siteList.value = res.data.rows;
// siteList.value = res.data.rows;
});
}
getList()
@@ -163,7 +191,8 @@ const handleClickSite = (type) => {
}
}
const goToAddTunnel = (siteId) => {
router.push('/tunnel/' + siteId)
// router.push('/tunnel/' + siteId)
router.push('/tunnel/1')
}
//重置from表单
const restFrom = () => {
@@ -173,13 +202,14 @@ const restFrom = () => {
describe: ''
}
}
const handleEdit = (siteId) => {
const handleEdit = (item) => {
title.value = '编辑站点'
restFrom()
getSiteDetail(siteId).then((res) => {
form.value = res.data;
// getSiteDetail(item.siteId).then((res) => {
// form.value = res.data;
form.value = item;
isVisited.value = true
});
// });
}
const handleAdd = () => {
@@ -188,21 +218,24 @@ const handleAdd = () => {
isVisited.value = true
}
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
if (title.value === '编辑站点') {
editSite(form.value).then(() => {
// if (!instance) return
// instance.validate(async (valid) => {
// if (!valid) return
// if (title.value === '编辑站点') {
// editSite(form.value).then(() => {
// isVisited.value = false
// getList()
// });
// } else {
// addSite(form.value).then(() => {
isVisited.value = false
getList()
});
} else {
addSite(form.value).then(() => {
isVisited.value = false
getList()
});
}
})
// getList()
// });
// }
// })
}
const handleChooseAll=()=>{
console.log('全选')
}
const handleMoreDelete = () => {
if (siteIds.value.length === 0) {
@@ -214,16 +247,16 @@ const handleMoreDelete = () => {
type: 'warning',
customClass: 'delBox'
}).then(() => {
deleteSite(siteIds.value).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg)
getList()
siteIds.value = []
siteNameList.value = []
} else {
ElMessage.error(res.msg)
}
})
// deleteSite(siteIds.value).then(res => {
// if (res.code === 1000) {
// ElMessage.success(res.msg)
// getList()
// siteIds.value = []
// siteNameList.value = []
// } else {
// ElMessage.error(res.msg)
// }
// })
})
}
}