Merge pull request '邓洁 : 站点管理修改细节' (#141) from dengjie into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/141
This commit is contained in:
odjbin
2023-12-15 17:12:31 +00:00
6 changed files with 124 additions and 37 deletions

View File

@@ -1,9 +1,10 @@
import request from '@/utils/request.js' import request from '@/utils/request.js'
export const getSiteList = () => { export const getSiteList = (params) => {
return request({ return request({
url: '/tunnel/site', url: '/tunnel/site/screenlist',
method: 'get' method: 'get',
params
}) })
} }
export const getSiteDetail = (siteId) => { export const getSiteDetail = (siteId) => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -378,3 +378,44 @@ html, body, #app, .el-container, .el-aside, .el-main {
} }
} }
} }
.el-overlay-message-box{
.el-message-box{
width: 500px;
height: 230px;
background: rgba(7,35,72,0.79);
border-radius: 20px;
border: 2px solid #0F82AF;
.el-message-box__title{
display: none;
}
.el-message-box__content{
.el-icon{
display: none;
}
.el-message-box__message{
//width: 315px;
height: 80px;
font-size: 32px;
font-weight: bold;
color: #08B7B8;
letter-spacing: 3px;
}
}
.el-message-box__btns{
display: flex;
justify-content: space-around;
.el-button{
width: 130px;
height: 50px;
border: 2px solid #0F82AF;
font-size: 28px;
background-color: #072348;
color: #08B7B8;
}
.el-button--primary{
background: #08B7B8;
color: #FFFFFF;
}
}
}
}

View File

@@ -42,7 +42,7 @@ const routes = [
} }
}, },
{ {
path: '/tunnel', path: '/tunnel/:siteId(\\d+)',
name: 'tunnel', name: 'tunnel',
component: () => import('@/views/tunnel-manage/index.vue'), component: () => import('@/views/tunnel-manage/index.vue'),
meta: { meta: {

View File

@@ -7,6 +7,9 @@
</div> </div>
<div class="tunnel-title"></div> <div class="tunnel-title"></div>
<div class="all-del-btn"> <div class="all-del-btn">
<div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon">
添加
</div>
<div class="all-btn"> <div class="all-btn">
全选 全选
</div> </div>
@@ -16,7 +19,7 @@
</div> </div>
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="site-box" v-for="item in siteList"> <div class="site-box" v-for="item in siteList" :key="item.siteId">
<div class="top"> <div class="top">
<span>站点名称{{ item.siteName }}</span> <span>站点名称{{ item.siteName }}</span>
<el-checkbox v-model="item.checked" size="large" @change="handleClickSite(item)"/> <el-checkbox v-model="item.checked" size="large" @change="handleClickSite(item)"/>
@@ -24,19 +27,21 @@
<div class="box-center"> <div class="box-center">
<div class="left-img"></div> <div class="left-img"></div>
<div class="right-tunnel"> <div class="right-tunnel">
<div>隧道数量{{ item.num }}</div> <div>隧道数量{{ item.info.tunnelNum }}
</div>
<div> <div>
<div class="tunnel"> <div class="tunnel" v-if="showFirstTunnel">
<div>{{ item.sortTunnel }}</div> <div>{{ item.info.tunnelName }}</div>
<div class="tunnel-icon"></div> <div class="tunnel-icon"></div>
<div>施工长度{{ item.constructionLength }}</div> <div>施工长度{{ item.info.constructionLength }}</div>
<div>实现长度{{ item.implementationLength }}公里</div> <div>实现长度{{ item.info.implementationLength }}公里
</div>
</div> </div>
<div class="tunnel-add" @click="goToAddTunnel"> <div class="tunnel-add" @click="goToAddTunnel(item.siteId)">
<div class="add-icon"></div> <div class="add-icon"></div>
</div> </div>
</div> </div>
<div class="more" @click="router.push('/tunnel')"> <div class="more" @click="router.push('/tunnel')" v-if="showFirstTunnel">
更多 更多
<div class="icon"></div> <div class="icon"></div>
</div> </div>
@@ -47,7 +52,7 @@
<div>站点编辑</div> <div>站点编辑</div>
</div> </div>
</div> </div>
<div class="site-box add-box" @click="handleAdd"> <div class="site-box add-box" v-if="showAddIcon" @click="handleAdd">
<div class="add-icon"></div> <div class="add-icon"></div>
<div style="cursor: pointer">添加站点</div> <div style="cursor: pointer">添加站点</div>
</div> </div>
@@ -82,7 +87,9 @@
</el-dialog> </el-dialog>
<div class="pagination"> <div class="pagination">
<span>首页</span> <span>首页</span>
<el-pagination background :page-size="6" :total="50" prev-text="上一页" next-text="下一页" layout="prev, pager, next"/> <el-pagination background v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize"
:total="total" prev-text="上一页" next-text="下一页" layout="prev, pager, next"
@current-change="handleCurrentChange"/>
<span>尾页</span> <span>尾页</span>
</div> </div>
</div> </div>
@@ -91,14 +98,28 @@
<script setup> <script setup>
import {editSite, getSiteDetail, getSiteList, addSite, deleteSite} from "@/api/site"; import {editSite, getSiteDetail, getSiteList, addSite, deleteSite} from "@/api/site";
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
const router = useRouter() const router = useRouter()
const siteList = ref([]) const siteList = ref([])
const siteIds = ref([]) const siteIds = ref([])
const siteNameList = ref([]) const siteNameList = ref([])
const info = ref({
tunnelNum: 0,
tunnelName: '隧道',
constructionLength: 0,
implementationLength: 0
})
const title = ref('新增站点') const title = ref('新增站点')
const isClick = ref(false); const isClick = ref(false);
const isVisited = ref(false); const isVisited = ref(false);
const total = ref();
const showAddIcon = ref(false)
const showFirstTunnel = ref(true)
const pageInfo = reactive({
pageNum: 1,
pageSize: 6
});
const form = ref({ const form = ref({
address: '', address: '',
siteName: '', siteName: '',
@@ -109,8 +130,16 @@ const formRules = ref({
}) })
const formInstance = ref() const formInstance = ref()
const getList = () => { const getList = () => {
getSiteList().then((res) => { getSiteList({
...pageInfo
}).then((res) => {
total.value = res.data.total;
showAddIcon.value = total.value !== 6;
res.data.rows.map(item => { res.data.rows.map(item => {
if (item.tunnelList === null || item.tunnelList === []) {
showFirstTunnel.value = false
}
item.info = info.value
item.checked = false item.checked = false
}) })
siteList.value = res.data.rows; siteList.value = res.data.rows;
@@ -134,8 +163,8 @@ const handleClickSite = (type) => {
}) })
} }
} }
const goToAddTunnel = () => { const goToAddTunnel = (siteId) => {
router.push('/tunnel') router.push('/tunnel/' + siteId)
} }
//重置from表单 //重置from表单
const restFrom = () => { const restFrom = () => {
@@ -177,20 +206,33 @@ const handleSubmit = (instance) => {
}) })
} }
const handleMoreDelete = () => { const handleMoreDelete = () => {
ElMessageBox.confirm(`确认删除名称为${siteNameList.value}的站点吗?`, '系统提示', { if (siteIds.value.length === 0) {
confirmButtonText: '确定', ElMessage.warning('请先选择站点进行删除')
cancelButtonText: '取消', } else {
type: 'warning' ElMessageBox.confirm(`是否确定删除该站点`, '系统提示', {
}).then(() => { confirmButtonText: '确定',
deleteSite(siteIds.value).then(res => { cancelButtonText: '取消',
if (res.code === 1000) { type: 'warning',
ElMessage.success(res.msg) customClass: 'delBox'
getList() }).then(() => {
} else { deleteSite(siteIds.value).then(res => {
ElMessage.error(res.msg) if (res.code === 1000) {
} ElMessage.success(res.msg)
getList()
siteIds.value = []
siteNameList.value = []
} else {
ElMessage.error(res.msg)
}
})
}) })
}) }
}
//点击页码进行分页功能
const handleCurrentChange = async (val) => {
pageInfo.pageNum = val
await getList()
} }
</script> </script>
@@ -376,9 +418,9 @@ const handleMoreDelete = () => {
.box-content { .box-content {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding-left: 100px; padding-left: 70px;
padding-right: 100px; padding-right: 70px;
justify-content: space-between; //justify-content: space-between;
.add-box { .add-box {
cursor: pointer; cursor: pointer;
@@ -400,7 +442,7 @@ const handleMoreDelete = () => {
.site-box { .site-box {
margin-top: 122px; margin-top: 122px;
//margin-right: 122px; margin-right: 60px;
padding: 40px 50px; padding: 40px 50px;
width: 1250px; width: 1250px;
height: 750px; height: 750px;
@@ -408,7 +450,7 @@ const handleMoreDelete = () => {
//box-sizing: border-box; //box-sizing: border-box;
position: relative; position: relative;
&:nth-child(3) { &:nth-child(3n) {
margin-right: 0; margin-right: 0;
} }
@@ -456,6 +498,7 @@ const handleMoreDelete = () => {
margin-top: 29px; margin-top: 29px;
.tunnel { .tunnel {
margin-right: 20px;
width: 280px; width: 280px;
height: 350px; height: 350px;
background: #3FBED1; background: #3FBED1;
@@ -488,7 +531,6 @@ const handleMoreDelete = () => {
} }
.tunnel-add { .tunnel-add {
margin-left: 20px;
width: 280px; width: 280px;
height: 350px; height: 350px;
background: #1891A3; background: #1891A3;
@@ -559,10 +601,12 @@ const handleMoreDelete = () => {
font-weight: bold; font-weight: bold;
> span:first-child { > span:first-child {
cursor: pointer;
margin-right: 60px; margin-right: 60px;
} }
> span:last-child { > span:last-child {
cursor: pointer;
margin-left: 71px; margin-left: 71px;
} }

View File

@@ -83,6 +83,7 @@
<script setup> <script setup>
const router = useRouter() const router = useRouter()
const siteId = reactive(router.currentRoute.value.params.siteId)
const siteList = ref([ const siteList = ref([
{ {
tunnelName: '一号隧道', tunnelName: '一号隧道',