From 7129da044e88992fdd5fb48314aeefed6f8e7439 Mon Sep 17 00:00:00 2001
From: cqf <2252655793@qq.com>
Date: Wed, 11 May 2022 18:15:30 +0800
Subject: [PATCH] 批量复查接口对接
---
src/views/hiddenDangerManagement/index.vue | 101 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 90 insertions(+), 11 deletions(-)
diff --git a/src/views/hiddenDangerManagement/index.vue b/src/views/hiddenDangerManagement/index.vue
index bff6334..7f2d1ca 100644
--- a/src/views/hiddenDangerManagement/index.vue
+++ b/src/views/hiddenDangerManagement/index.vue
@@ -99,7 +99,8 @@
<el-row class="title-center">
<el-col :span="7">
<el-radio-group v-model="listQuery.form.alter_status">
- <el-radio-button v-for="item in statusList" :label="item.value" :key="item.value"></el-radio-button>
+ <el-radio-button v-for="item in statusList" :label="item.value" :key="item.value"
+ @change.native="getPageList"></el-radio-button>
</el-radio-group>
</el-col>
<el-col :span="10">
@@ -121,6 +122,7 @@
type="primary"
class="btns"
size="small"
+ v-show="buttomShow"
icon="el-icon-bottom"
>导入
</el-button
@@ -131,6 +133,8 @@
type="primary"
class="btns"
size="small"
+ v-show="buttomShow"
+ @click="downTemplate"
icon="el-icon-download"
>下载模板
</el-button
@@ -143,6 +147,7 @@
class="btns"
type="primary"
size="small"
+ v-show="buttomShow"
@click="fillRectification()"
>填写整改
</el-button
@@ -155,11 +160,21 @@
>填写督查
</el-button
>
+ <el-button
+ class="btns"
+ type="primary"
+ size="small"
+ v-show="!buttomShow"
+ @click="revoke()"
+ >撤销
+ </el-button
+ >
<el-button class="btns" type="primary" icon="el-icon-plus" @click="jump" size="small"
+ v-show="buttomShow"
>添加
</el-button
>
- <el-button size="small" @click="deleteBath"
+ <el-button size="small" @click="deleteBath" v-show="buttomShow"
>批量删除
</el-button
>
@@ -226,12 +241,20 @@
</div>
</template>
<script>
-import {getPageList, self_export_do, self_import_do, self_del_do} from "@/api/sgyhpczl/hiddenDangerManagement";
+import {
+ getPageList,
+ self_export_do,
+ self_import_do,
+ self_del_do,
+ self_revoke,
+ self_template
+} from "@/api/sgyhpczl/hiddenDangerManagement";
import {initJCBM, initYHLX, initBC, initJCLB, initYHBM, initYHJB, initReformStatus} from "@/api/sgyhpczl/initSelect";
export default {
data() {
return {
+ buttomShow: true,
fileList: [],
statusList: [],
options: [],
@@ -266,6 +289,16 @@
this.initBC()
this.initJCLB()
this.initReformStatus()
+ },
+ watch: {
+ "listQuery.form.alter_status": function (newVal, oldVal) {
+ console.log(newVal)
+ if (newVal == "整改完成") {
+ this.buttomShow = false;
+ } else {
+ this.buttomShow = true;
+ }
+ }
},
methods: {
initReformStatus() {
@@ -405,24 +438,24 @@
},
fillRectification() {
var checkData = this.$refs.dataTable.selection;
- if(checkData.length < 1){
+ if (checkData.length < 1) {
this.$message({type: 'warn', message: "请选择勾选需要填写的数据!", duration: 3000})
return;
}
this.$router.push({
path: "/fillRectification",
- query:{"checkData":checkData}
+ query: {"checkData": checkData}
})
},
fillInspector() {
var checkData = this.$refs.dataTable.selection;
- if(checkData.length < 1){
+ if (checkData.length < 1) {
this.$message({type: 'warn', message: "请选择勾选需要填写的数据!", duration: 3000})
return;
}
this.$router.push({
path: "/fillInspector",
- query:{"checkData":checkData}
+ query: {"checkData": checkData}
})
window.open(href, '_blank');
},
@@ -445,6 +478,24 @@
console.log(err)
})
},
+ downTemplate() {
+ //删除分页参数
+ self_template().then(res => {
+ var blob = new Blob([res.data])
+ var downloadElement = document.createElement('a')
+ var href = window.URL.createObjectURL(blob) //创建下载的链接
+ downloadElement.href = href
+ downloadElement.download = '自查隐患导入模板.xlsx' //下载后文件名
+ document.body.appendChild(downloadElement)
+ downloadElement.click() //点击下载
+ document.body.removeChild(downloadElement) //下载完成移除元素
+ window.URL.revokeObjectURL(href) //释放掉blob对象
+ }).catch(err => {
+ console.log(err)
+ })
+ },
+
+
//文件发生改变就会触发的事件 导入
uploadByJsqd(file) {
//判断是否符合beforeAvatarUpload方法中的条件
@@ -477,10 +528,39 @@
}
return true
},
+
+ revoke() {
+ var checkData = this.$refs.dataTable.selection;
+ if (checkData.length < 1) {
+ this.$message({type: 'warn', message: "请勾选需要撤销的数据!", duration: 3000})
+ return;
+ }
+ var revokeIds = "";
+ checkData.forEach(n => {
+ revokeIds += n.id + ",";
+ })
+ revokeIds = revokeIds.substring(0, revokeIds.length - 1);
+ this.$confirm('确认要撤销吗', '提示', {
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then((res) => {
+ console.log(res);
+ self_revoke(revokeIds).then(res => {
+ if (res.data.ok) {
+ this.$message({type: 'success', message: res.data.msg, duration: 3000})
+ this.getPageList()//调用表格方法,刷新页面
+ } else {
+ this.$message({type: 'error', message: res.data.msg, duration: 3000})
+ }
+ })
+ })
+ },
+
deleteBath() {
var checkData = this.$refs.dataTable.selection;
if (checkData.length < 1) {
- this.$message({type: 'warn', message: "请选择勾选需要删除的数据!", duration: 3000})
+ this.$message({type: 'warn', message: "请勾选需要删除的数据!", duration: 3000})
return;
}
var deleteIds = "";
@@ -488,14 +568,13 @@
deleteIds += n.id + ",";
})
deleteIds = deleteIds.substring(0, deleteIds.length - 1);
- console.log(deleteIds)
- this.$confirm('确认删除吗', '提示', {
+ this.$confirm('确认要删除吗', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then((res) => {
console.log(res);
- self_del_do(deleteIds).then(res=>{
+ self_del_do(deleteIds).then(res => {
if (res.data.ok) {
this.$message({type: 'success', message: res.data.msg, duration: 3000})
this.getPageList()//调用表格方法,刷新页面
--
Gitblit v1.9.2