lyfO_o
2022-07-12 c562fa2e66f4972ae23fa57ef7412da6e18991ed
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>
@@ -100,7 +100,7 @@
                    <el-option
                        v-for="item in reList"
                        :key="item.value"
                        :label="item.label"
                        :label="item.value"
                        :value="item.value">
                    </el-option>
                </el-select>
@@ -136,34 +136,58 @@
            <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">
            <el-col :span="14" style="text-align:right;">
                <el-button class="btns" type="primary" size="small" @click="specialFocus()">{{focusDesc}}</el-button>
                <el-button class="btns" type="primary" size="small" @click="sendBath()">管理关注</el-button>
<!--                <el-button class="btns" type="primary" size="small" @click="sendBath()">管理关注</el-button>-->
            </el-col>
            </div>
        </el-row>
       <el-table :data="tableData" style="width: 100%"  @selection-change="handleSelectionChange">
       <el-table :data="tableData" style="width: 100%"  @selection-change="handleSelectionChange" v-loading="listLoading">
            <el-table-column type="selection" width="55" align="center"></el-table-column>
            <el-table-column prop="number" label="编号" align="center" width="120"></el-table-column>
            <el-table-column prop="number" label="编号" align="center" width="120">
                <template slot-scope="scope">
                    <div class="blue-font-color" @click="showDetails(scope.row)">{{ scope.row.number }}</div>
                </template>
            </el-table-column>
            <el-table-column prop="check_branch" label="检查部门" align="center" width="120"></el-table-column>
            <el-table-column prop="check_man" label="检查人" align="center" width="120"></el-table-column>
            <el-table-column prop="checktype" label="检查类别" align="center"></el-table-column>
            <el-table-column label="隐患项目" align="center">
                <el-table-column prop="check_date" label="检查时间" :formatter="formatColumnDate" width="120" align="center"></el-table-column>
                <el-table-column prop="check_date" label="检查时间" :formatter="formatColumnDate" width="120" align="center">
                    <template slot-scope="scope">
                        <label>{{ formatDate(scope.row.check_date) }}</label><br/>
                        <label>{{ scope.row.check_class }}</label>
                    </template>
                </el-table-column>
                <el-table-column prop="address" label="地点" align="center"> </el-table-column>
                <el-table-column prop="ht_content" label="内容" align="center"> </el-table-column>
                <el-table-column prop="ht_content" label="内容" align="center">
                    <template slot-scope="scope">
                        <el-popover trigger="hover" placement="top">
                            <p>{{ scope.row.ht_content }}</p>
                            <div slot="reference" class="name-wrapper">{{
                                    scope.row.ht_content != null && scope.row.ht_content.length > 10 ? scope.row.ht_content.substring(0, 8) + "...." : scope.row.ht_content
                                }}
                            </div>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column prop="ht_typesub" label="类别" align="center"> </el-table-column>
                <el-table-column prop="ht_level" label="级别" align="center"> </el-table-column>
            </el-table-column>
@@ -226,8 +250,8 @@
    </div>
</template>
<script>
import { getPageList, analogy_export_do, focus_do} from "@/api/sgyhpczl/careabout"
import {initJCBM ,initYHLX, initBC ,initJCLB ,initYHBM ,initYHJB,initLlr} from "@/api/sgyhpczl/initSelect";
import { getPageList, danger_focus_tag, analogy_export_do, focus_do} from "@/api/sgyhpczl/careabout"
import {initJCBM ,initYHLX, initBC ,initJCLB ,initYHBM ,initYHJB,initLlr,initSrxcqk} from "@/api/sgyhpczl/initSelect";
    export default{
        data(){
@@ -235,7 +259,7 @@
                listQuery:{
                    page:1,
                    limit:10,
                    type: 0,
                    tag: '全部',
                    form:{
                        ht_community:'众泰煤焦化'
                    },
@@ -252,10 +276,11 @@
                JCBMList:[],
                YHLXList:[],
                BCList:[],
                reList:[{label:"值班",value:"值班"},{label:"带班",value:"带班"}],
                reList:[],
                JCLBList:[],
                YHBMList:[],
                YHJBList:[],
                tagList:[],
                tableData:[],
                selectedList:[],
                listLoading: false,
@@ -274,13 +299,15 @@
            }
        },
        mounted() {
            this.getPageList();
            this.initYHLX();
            this.initYHJB();
            this.initBC();
            this.initJCLB();
            this.initLlr();
            this.initYHBM();
            this.initSrxcqk();
            this.initTags();
            this.getPageList();
        },
        methods:{
            sendBath(){
@@ -293,18 +320,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(){
@@ -352,6 +367,24 @@
                    }
                })
            },
            initSrxcqk(){
                initSrxcqk().then(res=>{
                    if (res.data.ok==1){
                        this.reList=res.data.data
                    } else{
                        this.$message({type:'error', message:res.data.msg, duration:3000})
                    }
                })
            },
            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){
@@ -390,8 +423,11 @@
            //搜索
            getPageList(){
                this.listQuery.page=1
                // this.listQuery.limit=10
                this.checkTime()
                this.listLoading = true
                getPageList(this.listQuery).then(res=>{
                    this.listLoading = false
                    if (res.data.ok==1) {
                        this.tableData = res.data.data.items
                        this.recordTotal=res.data.data.total
@@ -424,9 +460,15 @@
                    }
                })
            },
            showDetails(row){
                this.$router.push({
                    path: "/dangerDetails",
                    query:{"id":row.id}
                })
            },
            typeChange(val){
                this.listQuery.type = val;
                if (val == 1){
                this.listQuery.tag = val;
                if (val == '特别关注'){
                    this.focusDesc = '取消关注'
                }else {
                    this.focusDesc = '特别关注'
@@ -440,16 +482,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) //下载完成移除元素
@@ -464,22 +509,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 => {
                });
            },
            //日期格式转换
@@ -492,6 +545,15 @@
                let dt = new Date(data)
                return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate() + ' '
            },
            //方法区
            formatDate(data) {
                // 获取单元格数据
                if (data == null) {
                    return null
                }
                let dt = new Date(data)
                return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate()
            },
        }
    }
</script>