Merge pull request '邓洁: 修复bug' (#197) from dengjie into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/197
This commit is contained in:
odjbin
2023-12-29 02:33:57 +00:00
5 changed files with 69 additions and 21 deletions

View File

@@ -484,6 +484,8 @@ const handleEditFan = () => {
if (res.code === 1000) { if (res.code === 1000) {
ElMessage.success('修改成功') ElMessage.success('修改成功')
router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId) router.push('/tunnel/' + siteId.value + '/' + type + '/' + userId)
}else {
ElMessage.error(res.msg)
} }
}) })
} }

View File

@@ -90,12 +90,14 @@ const handleSave = async () => {
constructionLength: 500, constructionLength: 500,
tunnelLength: form.value.totalLength, tunnelLength: form.value.totalLength,
isDefault: form.value.isDefault, isDefault: form.value.isDefault,
tunnelThreeConfig: JSON.stringify(await store.getEquipmentList()) modelEquipmentList:await store.getEquipmentList()
} }
editTunnel(data).then((res) => { editTunnel(data).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
ElMessage.success(res.msg) ElMessage.success(res.msg)
router.push('/tunnel/' + form.value.siteId+'/'+type+'/'+userId) router.push('/tunnel/' + form.value.siteId+'/'+type+'/'+userId)
}else {
ElMessage.error(res.msg)
} }
}); });
} }

View File

@@ -93,11 +93,11 @@
</template> </template>
</el-dialog> </el-dialog>
<div class="pagination"> <div class="pagination">
<span>首页</span> <span @click="firstPage" v-if="showFirst">首页</span>
<el-pagination background v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize" <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" :total="total" prev-text="上一页" next-text="下一页" layout="prev, pager, next"
@current-change="handleCurrentChange"/> @current-change="handleCurrentChange" :hide-on-single-page="true"/>
<span>尾页</span> <span @click="lastPage" v-if="showFirst">尾页</span>
</div> </div>
</div> </div>
</template> </template>
@@ -146,6 +146,7 @@ const info = ref({
}) })
const title = ref('新增站点') const title = ref('新增站点')
const isVisited = ref(false); const isVisited = ref(false);
const showFirst = ref(true)
const total = ref(10); const total = ref(10);
const showAddIcon = ref(true) const showAddIcon = ref(true)
const pageInfo = reactive({ const pageInfo = reactive({
@@ -164,11 +165,12 @@ const formRules = ref({
const formInstance = ref() const formInstance = ref()
const getList = () => { const getList = () => {
getSiteList({ getSiteList({
userId:userId, // userId:userId,
...pageInfo ...pageInfo
}).then((res) => { }).then((res) => {
total.value = res.data.total; total.value = res.data.total;
showAddIcon.value = total.value % 6!==0; showAddIcon.value = total.value % 6!==0;
showFirst.value = total.value / pageInfo.pageSize >= 1;
res.data.rows.map(item => { res.data.rows.map(item => {
if (item.tunnelList === null || item.tunnelList.length === 0) { if (item.tunnelList === null || item.tunnelList.length === 0) {
item.info = info.value item.info = info.value
@@ -234,15 +236,23 @@ const handleSubmit = (instance) => {
if (!valid) return if (!valid) return
if (title.value === '编辑站点') { if (title.value === '编辑站点') {
editSite(form.value).then((res) => { editSite(form.value).then((res) => {
if(res.code===1000){
isVisited.value = false isVisited.value = false
getList() getList()
ElMessage.success(res.msg) ElMessage.success(res.msg)
}else {
ElMessage.warning(res.msg)
}
}); });
} else { } else {
addSite(form.value).then((res) => { addSite(form.value).then((res) => {
if(res.code===1000){
isVisited.value = false isVisited.value = false
getList() getList()
ElMessage.success(res.msg) ElMessage.success(res.msg)
}else {
ElMessage.warning(res.msg)
}
}); });
} }
}) })
@@ -290,7 +300,14 @@ const handleMoreDelete = () => {
} }
} }
} }
const firstPage=()=>{
pageInfo.pageNum = 1
getList()
}
const lastPage=()=>{
pageInfo.pageNum = total.value/pageInfo.pageSize
getList()
}
//点击页码进行分页功能 //点击页码进行分页功能
const handleCurrentChange = (val) => { const handleCurrentChange = (val) => {
pageInfo.pageNum = val pageInfo.pageNum = val

View File

@@ -96,11 +96,11 @@
</div> </div>
</el-dialog> </el-dialog>
<div class="pagination"> <div class="pagination">
<span>首页</span> <span @click="firstPage" v-if="showFirst">首页</span>
<el-pagination background v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize" <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" :total="total" prev-text="上一页" next-text="下一页" layout="prev, pager, next"
@current-change="handleCurrentChange"/> @current-change="handleCurrentChange" :hide-on-single-page="true"/>
<span>尾页</span> <span @click="lastPage" v-if="showFirst">尾页</span>
</div> </div>
</div> </div>
</template> </template>
@@ -120,6 +120,7 @@ const formRules = ref({
tunnelName: [{required: true, message: '请输入隧道名称', trigger: 'blur'}], tunnelName: [{required: true, message: '请输入隧道名称', trigger: 'blur'}],
serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}] serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}]
}) })
const showFirst = ref(true)
const formInstance = ref() const formInstance = ref()
const tunnelList = ref([ const tunnelList = ref([
{ {
@@ -278,10 +279,19 @@ const getList = () => {
if (res.code === 1000) { if (res.code === 1000) {
total.value = res.data.total total.value = res.data.total
tunnelList.value = res.data.rows tunnelList.value = res.data.rows
showFirst.value = total.value / pageInfo.pageSize >= 1;
} }
}) })
} }
getList() getList()
const firstPage=()=>{
pageInfo.pageNum = 1
getList()
}
const lastPage=()=>{
pageInfo.pageNum = total.value/pageInfo.pageSize
getList()
}
//点击页码进行分页功能 //点击页码进行分页功能
const handleCurrentChange = (val) => { const handleCurrentChange = (val) => {
pageInfo.pageNum = val pageInfo.pageNum = val
@@ -303,6 +313,8 @@ const handleSubmit = (instance) => {
ElMessage.success('新增成功') ElMessage.success('新增成功')
getList() getList()
isVisited.value = false isVisited.value = false
}else {
ElMessage.warning(res.msg)
} }
}) })
} else { } else {

View File

@@ -112,11 +112,11 @@
</template> </template>
</el-dialog> </el-dialog>
<div class="pagination"> <div class="pagination">
<span>首页</span> <span @click="firstPage" v-if="showFirst">首页</span>
<el-pagination background v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize" <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" :total="total" prev-text="上一页" next-text="下一页" layout="prev, pager, next"
@current-change="handleCurrentChange"/> @current-change="handleCurrentChange" :hide-on-single-page="true"/>
<span>尾页</span> <span @click="lastPage" v-if="showFirst">尾页</span>
</div> </div>
</div> </div>
</template> </template>
@@ -135,12 +135,13 @@ const siteId = reactive(router.currentRoute.value.params.siteId)
const tunnelIndex = ref() const tunnelIndex = ref()
const username = ref() const username = ref()
const userIds = ref() const userIds = ref()
const showFirst = ref(true)
const currentSite = ref() const currentSite = ref()
const formInstance = ref() const formInstance = ref()
const userData = ref([]) const userData = ref([])
const pageInfo = reactive({ const pageInfo = reactive({
pageNum: 1, pageNum: 1,
pageSize: 6 pageSize: 10
}); });
const total = ref(10); const total = ref(10);
const isVisited = ref(false); const isVisited = ref(false);
@@ -224,16 +225,30 @@ getRoleOptionInfo()
const getInfo = () => { const getInfo = () => {
getUser({ getUser({
siteId: siteId, siteId: siteId,
userName: username.value userName: username.value,
...pageInfo
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
console.log('res', res)
userData.value = res.data.rows userData.value = res.data.rows
total.value = res.data.total total.value = res.data.total
showFirst.value = total.value / pageInfo.pageSize >= 1;
} }
}) })
} }
getInfo() getInfo()
const firstPage=()=>{
pageInfo.pageNum = 1
getInfo()
}
const lastPage=()=>{
pageInfo.pageNum = total.value/pageInfo.pageSize
getInfo()
}
//点击页码进行分页功能
const handleCurrentChange = (val) => {
pageInfo.pageNum = val
getInfo()
}
const handleSubmit = async (formInstance) => { const handleSubmit = async (formInstance) => {
if (!formInstance) return; if (!formInstance) return;
formInstance.validate(async (valid) => { formInstance.validate(async (valid) => {