From a6bb6c451c163570fba1a6c20e84facf03a9db36 Mon Sep 17 00:00:00 2001
From: cqf
Date: 星期三, 25 五月 2022 13:51:50 +0800
Subject: [PATCH] 修改导出分页问题+隐患部门value问题

---
 src/views/careabout/index.vue |   96 ++++++++++++++++++++++++++++--------------------
 1 files changed, 56 insertions(+), 40 deletions(-)

diff --git a/src/views/careabout/index.vue b/src/views/careabout/index.vue
index 416f99c..55b1262 100644
--- a/src/views/careabout/index.vue
+++ b/src/views/careabout/index.vue
@@ -45,7 +45,7 @@
                         v-for="item in YHBMList"
                         :key="item.branch_id"
                         :label="item.branch_name"
-                        :value="item.branch_id">
+                        :value="item.branch_name">
                     </el-option>
                 </el-select>
             </el-form-item>
@@ -136,15 +136,20 @@
             <el-form-item style="text-align:center;padding:0 50px">
                 <el-button type="primary" class="btns" size="small" icon="el-icon-search" @click="getPageList()">查询</el-button>
                 <el-button type="primary" class="btns" size="small" icon="el-icon-refresh-right" @click="reset()">重置</el-button>
-                <el-button type="primary" class="btns" size="small" icon="el-icon-upload2" @click="exportData()">导出excel</el-button>
+                <el-button type="primary" class="btns" size="small" icon="el-icon-upload2" @click="exportData">导出excel</el-button>
             </el-form-item>
         </el-form>
      <el-row class="title-center">
             <el-col :span="10">
-                <el-radio-group  v-model="listQuery.type" @change="typeChange">
-                    <el-radio-button label="0">督查督办</el-radio-button>
-                    <el-radio-button label="1">特别关注</el-radio-button>
-                    <el-radio-button label="2">全部</el-radio-button>
+                <el-radio-group  v-model="listQuery.tag" @change="typeChange">
+                    <el-radio-button label="0"
+                                     v-for="item in tagList"
+                                     :label="item.value"
+                                     :key="item.value">
+                        {{item.value}}
+                    </el-radio-button>
+<!--                    <el-radio-button label="1">特别关注</el-radio-button>-->
+<!--                    <el-radio-button label="2">全部</el-radio-button>-->
                 </el-radio-group>
             </el-col>
             <div v-if="table1">
@@ -230,7 +235,7 @@
     </div>
 </template>
 <script>
-import { getPageList, analogy_export_do, focus_do} from "@/api/sgyhpczl/careabout"
+import { getPageList, danger_focus_tag, analogy_export_do, focus_do} from "@/api/sgyhpczl/careabout"
 import {initJCBM ,initYHLX, initBC ,initJCLB ,initYHBM ,initYHJB,initLlr} from "@/api/sgyhpczl/initSelect";
 
     export default{
@@ -239,7 +244,7 @@
                 listQuery:{
                     page:1,
                     limit:10,
-                    type: 0,
+                    tag: '全部',
                     form:{
                         ht_community:'众泰煤焦化'
                     },
@@ -260,6 +265,7 @@
                 JCLBList:[],
                 YHBMList:[],
                 YHJBList:[],
+                tagList:[],
                 tableData:[],
                 selectedList:[],
                 listLoading: false,
@@ -278,13 +284,14 @@
             }
         },
         mounted() {
-            this.getPageList();
             this.initYHLX();
             this.initYHJB();
             this.initBC();
             this.initJCLB();
             this.initLlr();
             this.initYHBM();
+            this.initTags();
+            this.getPageList();
         },
         methods:{
             sendBath(){
@@ -297,18 +304,6 @@
                     this.$router.push({
                         path:'/exist'
                     })
-                }
-            },
-            handoff(index){
-                if(index==1){
-                    this.table1=false
-                    this.table2=true
-                    this.listQuery.type = 2
-                    console.log(this.listQuery.type)
-                    this.getPageList()
-                }else{
-                    this.table1=true
-                    this.table2=false
                 }
             },
             initYHLX(){
@@ -356,6 +351,15 @@
                     }
                 })
             },
+            initTags(){
+                danger_focus_tag().then(res=>{
+                    if (res.data.ok==1){
+                        this.tagList=res.data.data
+                    } else{
+                        this.$message({type:'error', message:res.data.msg, duration:3000})
+                    }
+                })
+            },
             initLlr(){
                 initLlr().then(res=>{
                     if (res.data.ok==1){
@@ -394,6 +398,7 @@
             //搜索
             getPageList(){
                 this.listQuery.page=1
+                // this.listQuery.limit=10
                 this.checkTime()
                 this.listLoading = true
                 getPageList(this.listQuery).then(res=>{
@@ -437,8 +442,8 @@
                 })
             },
             typeChange(val){
-                this.listQuery.type = val;
-                if (val == 1){
+                this.listQuery.tag = val;
+                if (val == '特别关注'){
                     this.focusDesc = '取消关注'
                 }else {
                     this.focusDesc = '特别关注'
@@ -452,16 +457,19 @@
                 })
             },
             exportData() {
-                var requestData = this.listQuery;
+                this.listLoading = true
+                var requestData = JSON.parse(JSON.stringify(this.listQuery));
+                requestData.export_type = 7;
                 //删除分页参数
                 this.$delete(requestData, 'page')
                 this.$delete(requestData, 'limit')
                 analogy_export_do(requestData).then(res => {
+                    this.listLoading = false
                     var blob = new Blob([res.data])
                     var downloadElement = document.createElement('a')
                     var href = window.URL.createObjectURL(blob) //创建下载的链接
                     downloadElement.href = href
-                    downloadElement.download = '关注的隐患.xlsx' //下载后文件名
+                    downloadElement.download = '隐患信息一览.xlsx' //下载后文件名
                     document.body.appendChild(downloadElement)
                     downloadElement.click() //点击下载
                     document.body.removeChild(downloadElement) //下载完成移除元素
@@ -476,22 +484,30 @@
                     this.$message({type: 'warning', message: '至少选中一条数据', duration: 3000})
                     return
                 }
-                var ids = this.selectedList.map((obj) => {
-                    return obj.id
-                }).join(",")
-                var type = this.listQuery.type == '1' ? 'del' : 'add'
-                let data = {
-                    type: type,
-                    ids: ids,
-                }
-                focus_do(data).then(() => {
-                    this.getPageList()
-                    this.$notify({
-                        title: "成功",
-                        message: "操作成功",
-                        type: "success",
-                        duration: 2000,
+                var type = this.listQuery.tag == '特别关注' ? 'del' : 'add'
+                var desc = this.listQuery.tag == '特别关注' ? '确认取消吗' : '确认关注吗'
+                this.$confirm(desc, '提示', {
+                    confirmButtonText: '确认',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    var ids = this.selectedList.map((obj) => {
+                        return obj.id
+                    }).join(",")
+                    let data = {
+                        type: type,
+                        ids: ids,
+                    }
+                    focus_do(data).then(() => {
+                        this.getPageList()
+                        this.$notify({
+                            title: "成功",
+                            message: "操作成功",
+                            type: "success",
+                            duration: 2000,
+                        });
                     });
+                }).catch(error => {
                 });
             },
             //日期格式转换

--
Gitblit v1.9.2