<div class="dialog_BG">
<el-card class="card-bg">
<div class="right-bg">
<div class="search-bg">
<div class="item-bg">
<p class="label-bg">组织:
slot="middle"
style="display:block;"
>
:class="['company-info', 'f-l', 'center']"
:list="companyList"
:data="companyTree"
:node-map="nodeMap"
:props="props"
:default-title="title"
:default-expand="defaultExpand"
:current-node-key="orgId"
@node-click="handleNodeClick"
>
<!-- <p class="label-bg">类型:-->
<!-- placeholder="请选择">-->
<!-- <el-checkbox v-model="isTunnelType" @change="handleChangeVal()">只显示瓦斯隧道-->
<!-- <p class="label-bg">状态:-->
<!-- placeholder="请选择">-->
<!-- <p @click="download">导出-->
<el-table :data="tableData" height="100%" class="form-bg selfTable" :header-cell-style="{
background:'rgba(0, 85, 255, 0.2)',
color:'rgba(255, 255, 255, 1)',
}">
<el-table-column label="序号" align="center" min-width="80" :show-overflow-tooltip="true">
<template slot-scope="scopt">
{{ pageSize * currentPage - pageSize + (scopt.$index + 1) }}
property="workPointName"
label="项目名称"
align="center"
>
property="projectName"
label="公司名称"
align="center"
min-width="100"
>
label="所属标段"
align="center"
min-width="100"
>
align="center"
property="bdName"
label="作业人数"
width="120">
align="center"
property="bdName"
label="管理人数"
width="120">
align="center"
property="bdName"
label="总人数"
width="120">
label="隧道类型"
align="center"
>
align="center"
property="tunnelType"
label="作业人数"
width="120">
align="center"
property="tunnelType"
label="管理人数"
width="120">
align="center"
property="tunnelType"
label="总人数"
width="120">
property="safeStatus"
label="出勤率"
align="center"
min-width="90"
>
<template slot-scope="scope">
<div :class="
scope.row.safeStatus =='正常' ?'Coregreen' :'Corered'
">
<span v-if="scope.row.safeStatus" class="backGre">
<span class="ColorFon">{{ scope.row.safeStatus }}
<el-pagination background class="page-bg" layout="prev, pager, next" :current-page.sync="currentPage"
:page-size="pageSize" :total="totalCount" :page-sizes="[20]" @size-change="handleSizeChange"
@current-change="handleCurrentChange">
<img class="shadowImg" src="/static/front/crcckl/img/shadow.png" alt="" />
import apifrom "table/api/crcckl/index";
import commonMixinfrom "table/views/mixins";
import { downloadFile }from "utils/file";
import { Cascader }from "element-ui";
import { getStorageItem }from "utils";
import crccklTableSelect from "../components/crccklTableSelect";
import { getNodeMap, initLazyTree }from "@/utils";
import {notClickableNodeRemove }from "../components/util";
import { $get }from "@/utils/request";
export default {
name:"CustomCrccklProjectSupervisionInformation",
mixins: [commonMixin],
components: {
[Cascader.name]: Cascader,
crccklTableSelect,
},
data() {
return {
status:"",
value:"",
VAstatus:"",
VAtype:"",
tableData: [],
orgIdValue:"",
Params: {
label:"name",
value:"idPath",
children:"children",
},
currentPage:1, //当前页数
pageSize:20, //每页条数
totalCount:0, //总条数
companyList: [],
defaultExpand: [],
companyTree: [],
nodeMap: {},
props: {
children:"children",
label:"shortName",
// 设置 expand arrow 显隐
isLeaf(data, node) {
return node.data.leaf ===1;
},
},
title:"",
orgId:"",
isTunnelType:true,
typeOption: [],//类型下拉框
selectOption: [],//状态下拉框
};
},
created() {
this.orgId = getStorageItem("organiz_id");
},
mounted() {
this.VAtype =this.deviceType ?this.deviceType :this.VAtype;
this.init();
},
computed: {
deviceType() {
return this.$route.query.deviceType;
},
},
methods: {
init() {
this.getOptionList()
this.getData();
this.fetchOrgListForProduct();
},
getOptionList() {
this.$post(
`${api.getTunnelType}?tenantId=${this.rootId}&companyId=${this.companyId}`
).then((res) => {
this.typeOption = res.data
this.VAtype=res.data[0].code
})
this.$post(
`${api.getTunnelStatus}?tenantId=${this.rootId}&companyId=${this.companyId}`
).then((res) => {
this.selectOption = res.data
this.VAstatus=res.data[0].code
})
},
handleChangeVal() {
this.currentPage =1
this.getData();
},
handleNodeClick(item) {
this.orgIdValue = item.idPath.replace(/\//g, "_");
this.handleChangeVal();
},
fetchOrgListForProduct() {
let tenantId =this.rootId;
let requests = [
$get(api.fetchListOrgsLite(tenantId, this.companyId), {
groupCode:"EW",
}),
];
Promise.all(requests).then((res) => {
let orgList = res[0].data;
if (orgList.length) {
const fullDataMap = getNodeMap(orgList, "parentId");
let filterList =notClickableNodeRemove(fullDataMap);
const expandLevel =1;
let { nodeMap, treeData, allLevelIds } = initLazyTree(
filterList,
{
label:"shortName",
parent:"parentId",
rootId:null,
sortFn: (a, b) => a["orderNo"] - b["orderNo"],
},
expandLevel
);
if (treeData.length) {
this.companyList = filterList;
this.companyTree = treeData;
this.nodeMap = nodeMap;
this.title ="请选择";
this.defaultExpand = allLevelIds;
}
}
});
},
// 格式化数据,递归将空的children置为undefined
formatData(data) {
for (var i =0; i < data.length; i++) {
if (data[i].children.length <1) {
// children若为空数组,则将children设为undefined
data[i].children =undefined;
}else {
// children若不为空数组,则继续 递归调用 本方法
this.formatData(data[i].children);
}
}
return data;
},
download() {
downloadFile({
url: api.getTunnelList,
query: {
tenantId:this.rootId,
companyId:this.companyId,
exportExcel:true,
idPath:this.orgIdValue,
status:this.VAstatus,
type:this.VAtype,
isTunnelType:this.isTunnelType ?'1' :'0',
},
data: {},
filename:this._title,
type:"excel",
});
},
getData() {
//
this.$post(
`${api.getTunnelList}?tenantId=${this.rootId}&companyId=${this.companyId}&status=${this.VAstatus}&idPath=${this.orgIdValue}&type=${this.VAtype}¤tPage=${this.currentPage}&pageSize=${this.pageSize}&isTunnelType=${this.isTunnelType ?'1' :'0'}`
).then((res) => {
this.tableData = res.data.records;
this.totalCount = res.data.totalCount;
});
},
handleClick(row) {
this.$get(
`${api.NewJumpLink}?tenantId=${this.rootId}&orgId=${row.orgId
}&accessToken=${getStorageItem("access_token")}`
).then((res) => {
window.open(res.data);
});
},
// 分页=分页大小切换=========================
handleSizeChange(val) {
this.pageSize = val;
this.getData();
},
// 分页=分页切换=============================
handleCurrentChange(val) {
this.currentPage = val;
this.getData();
},
},
};
<style lang="less" scoped>
.checkboxSize /deep/ .el-checkbox__label {
font-size:13px;
padding-left:7px;
}
.Coregreen {
.backGre {
display:inline-block;
width:8px;
height:8px;
background:#31bf78;
margin-right:1px;
border-radius:80%;
}
.ColorFon {
font-size:0.875em;
color:#31bf78;
}
}
.Corered {
.backGre {
display:inline-block;
width:8px;
height:8px;
background:#ff0000;
margin-right:1px;
border-radius:80%;
}
.ColorFon {
font-size:0.875em;
color:#ff0000;
}
}
.fontC {
color:#31bf78;
cursor:pointer;
}
// 表格定制化简单法 优化建议函数处理
/deep/ .selfTable {
border:none;
}
/deep/.el-table__body-wrapper tr td:nth-child(1){
border-right:none;
}
/deep/.el-table__body-wrapper tr td:nth-child(2){
border-right:none;
}
/deep/.el-table__body-wrapper tr td:nth-child(4){
border-right:none;
}
/deep/.el-table__body-wrapper tr td:nth-child(5){
border-right:none;
}
/deep/.el-table__body-wrapper tr td:nth-child(7){
border-right:none;
}
/deep/.el-table__body-wrapper tr td:nth-child(8){
border-right:none;
}
/deep/.el-table__body-wrapper tr td:last-child{
border-right:none;
}
/deep/.el-table td{
border-right:1px solid rgba(0, 85, 255, .2);
}
/deep/.el-table--border th.el-table__cell, .el-table__fixed-right-patch{
border-bottom:1px solid rgba(0, 85, 255, .2);
border-right:1px solid rgba(0, 85, 255, .2);
}
/deep/.el-table__header tr th:nth-child(1){
border-right:none;
}
/deep/.el-table__header tr th:nth-child(2){
border-right:none;
}
/deep/.el-table__header tr:nth-child(2)th:nth-child(4){
border-right:none;
}
/deep/.el-table__header tr:nth-child(2)th:nth-child(5){
border-right:none;
}
/deep/.el-table--border::after {
width:0px;
}
// 留白关键代码
/deep/.el-table th.gutter{
opacity:0;
}