Commit 2f0a7883 authored by xinzhedeai's avatar xinzhedeai

隐患列表删除

parent eb1ba113
......@@ -47,8 +47,7 @@ var userInfo = {
}
}
var token =
"Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiI5OGI1OGIwYjRlYmY0Nzg4YjQyM2VmMjVmYzkwYWE4NCIsInVzZXIiOiJhZG1pbiIsInN1YiI6ImFkbWluIn0.c-gsRfSGfkQuaLr2BTVfJuAhE-i8imzawovC56O3UEUVYsZW8XJ9RYgIE65M8n77z6YNmrXGysqdP8vCgRVyag";
var token ="Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJjNTliYWZjYTdiOWQ0MzA2ODYzNDE4N2MwMGRlZGU1NCIsInVzZXIiOiJhZG1pbiIsInN1YiI6ImFkbWluIn0.U8gezo_te7BGJMUfLsa9dKxshyPAdDSkkYAkLHJ2xYQMxwMUlvMgpCkX6xRXJfzwJSscHaMqPgQinL445sq2lQ";
localStorage.setItem('Authorization', token)
localStorage.setItem('appCounty', userInfo.user.county)
......
......@@ -68,6 +68,27 @@ var http = {
})
})
},
delete: function(url, params) {
return new Promise((resolve, reject) => {
axios
.delete(url, {
// params: params
...params
})
.then(res => {
let response = res.data
console.log('res.statusCode', response)
if(response.statusCode >= 300){
// alert('系统发生错误')
return
}
resolve(res.data)
})
.catch(err => {
reject(err.data)
})
})
},
postFile: function(url, params) {
return new Promise((resolve, reject) => {
axios({
......
......@@ -22,7 +22,7 @@
</div>
<div class="content" v-cloak>
<van-list v-model:loading="loading" :offset="10" :finished="finished" finished-text="没有更多了" @load="getList">
<van-cell v-for="item in list" :key="item">
<van-cell v-for="(item, index) in list" :key="item">
<div class="list-item-wrapper" >
<p class="">
<span id="">
......@@ -44,7 +44,7 @@
<div class="list-function-btn-wrapper pd-01rem">
<van-button type="info" size="mini" @click="detail(item)">查看</van-button>
<van-button type="info" size="mini" @click="edit(item)">编辑</van-button>
<van-button type="info" size="mini">删除</van-button>
<van-button type="info" size="mini" @click="del(item, index)">删除</van-button>
<van-button type="info" size="mini">导出</van-button>
</div>
</div>
......
......@@ -20,6 +20,29 @@ window.addEventListener("load", function() {
this.getList()
},
methods: {
del(item, index){
console.log(item)
vant.Dialog.confirm({
title: '信息提示',
message: '此操作将删除所选项,确认删除?',
})
.then(() => {
// on confirm
http.post('/api/thHiddenDanger/delete',{
id: [item.hdId]
}).then((res)=>{
vant.Toast({
message: '操作成功',
})
this.list.splice(index, 1);
this.loading = false; // 加载状态结束
})
})
.catch(() => {
// on cancel
});
},
nav(item){
// location.href='./yh-list.html'
},
......
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