477 lines
13 KiB
Vue
477 lines
13 KiB
Vue
<template>
|
|
<div class="app-container iot-project">
|
|
<component :is="componectVal" :sourceId="sourceId" @linkToTable="toTableClick"></component>
|
|
|
|
<div v-show="componectVal === ''">
|
|
<el-form
|
|
v-show="showSearch"
|
|
ref="queryForm"
|
|
:inline="true"
|
|
:model="queryParams"
|
|
class="main-search-card"
|
|
label-width="68px"
|
|
>
|
|
<el-form-item label="项目名称" prop="projectName">
|
|
<el-input
|
|
v-model="queryParams.projectName"
|
|
clearable
|
|
placeholder="请输入项目名称"
|
|
size="small"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="项目类型" prop="industry">
|
|
<el-select v-model="queryParams.industry" clearable placeholder="请选择项目类型" size="small">
|
|
<el-option
|
|
v-for="dict in projectTypeOptions"
|
|
:key="dict.dictValue"
|
|
:label="dict.dictLabel"
|
|
:value="dict.dictValue"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div class="main-content-card">
|
|
<el-row :gutter="10" class="mb8">
|
|
<!-- <el-col :span="1.5">-->
|
|
<!-- <el-button-->
|
|
<!-- v-hasPermi="['iot:project:add']"-->
|
|
<!-- icon="el-icon-plus"-->
|
|
<!-- plain-->
|
|
<!-- size="mini"-->
|
|
<!-- type="primary"-->
|
|
<!-- @click="handleAdd"-->
|
|
<!-- >新增</el-button-->
|
|
<!-- >-->
|
|
<!-- </el-col>-->
|
|
<right-toolbar
|
|
:showSearch.sync="showSearch"
|
|
:view-type="viewType"
|
|
@changeViewType="changeViewType"
|
|
@queryTable="getList"
|
|
></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table
|
|
v-if="viewType!='card'"
|
|
v-loading="loading"
|
|
:data="projectList"
|
|
:default-sort="{prop: 'createTime', order: 'descending'}"
|
|
@sort-change="sortChange"
|
|
>
|
|
<el-table-column
|
|
:index="indexFormatter"
|
|
align="center"
|
|
label="序号"
|
|
type="index"
|
|
width="60px"
|
|
></el-table-column>
|
|
<el-table-column align="center" label="项目名称" prop="projectName" />
|
|
<el-table-column
|
|
:formatter="statusFormat"
|
|
align="center"
|
|
label="项目类型"
|
|
prop="industry"
|
|
width="80"
|
|
/>
|
|
<el-table-column align="center" label="行政区划" prop="regionalismFullName" width="160" />
|
|
<el-table-column align="center" label="项目地址" prop="projectAddress">
|
|
<template slot-scope="scope">
|
|
<el-tooltip :content="scope.row.projectAddress" effect="dark" placement="top">
|
|
<span class="lay-table-textarea">{{ scope.row.projectAddress }}</span>
|
|
</el-tooltip>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
label="创建时间"
|
|
prop="createTime"
|
|
sortable="custom"
|
|
width="160"
|
|
/>
|
|
<el-table-column
|
|
align="center"
|
|
class-name="small-padding fixed-width"
|
|
label="操作"
|
|
width="200"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
icon="el-icon-search"
|
|
size="mini"
|
|
type="text"
|
|
@click="handleDetails(scope.row)"
|
|
>详情</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<div v-else class="card-list-box">
|
|
<el-row :gutter="20">
|
|
<el-col v-for="(item, index) in projectList" :key="index" :lg="8" :md="12" :sm="12" :xs="24" class="card-item-col">
|
|
<div class="card-item">
|
|
<div class="card-header">
|
|
<div class="card-header-top">
|
|
<div class="device-img-box">
|
|
<el-image
|
|
:src="'http://static.drgyen.com/pc/smart-power-ui/device/device-number.png'"
|
|
style="width: 100%; height: 100%">
|
|
</el-image>
|
|
</div>
|
|
<div class="card-item-name">{{ item.projectName }}</div>
|
|
</div>
|
|
<div class="card-item-address">项目地址:{{ item.projectAddress }}</div>
|
|
</div>
|
|
<div class="card-content">
|
|
<div class="info-item">
|
|
<span class="label">类型:</span>
|
|
<span class="value">{{ statusFormat(item) }}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">创建时间:</span>
|
|
<el-tooltip :content="item.createTime" effect="dark" placement="top">
|
|
<span class="value">{{ item.createTime }}</span>
|
|
</el-tooltip>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer">
|
|
<el-button icon="el-icon-search" type="text" @click="handleDetails(item)">查看详情</el-button>
|
|
<el-divider direction="vertical"></el-divider>
|
|
<el-button v-hasPermi="['iot:project:edit']" icon="el-icon-edit" type="text" @click="handleUpdate(item)">修改</el-button>
|
|
<el-button v-hasPermi="['iot:project:remove']" type="text"><el-divider direction="vertical"></el-divider></el-button>
|
|
<el-button v-hasPermi="['iot:project:remove']" icon="el-icon-delete" type="text" @click="handleDelete(item)">删除</el-button>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
<el-empty v-if="total === 0"></el-empty>
|
|
</div>
|
|
|
|
<pagination
|
|
v-show="total > 0"
|
|
:limit.sync="queryParams.pageSize"
|
|
:page-sizes="[12, 24, 36, 60]"
|
|
:page.sync="queryParams.pageNum"
|
|
:total="total"
|
|
@pagination="getList"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- <div class="to-home-wrap2" @click="toTableClick" v-show="componectVal !== ''">
|
|
<el-button icon="el-icon-d-arrow-left" title="返回列表" circle>返回列表</el-button>
|
|
</div> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
listProject,
|
|
exportProject
|
|
} from "@/api/tenant/project";
|
|
// import DetailsWrap from "./profile/details";
|
|
import DetailsWrap from '@/views/iot/project/profileV2/details'
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
export default {
|
|
name: "Project",
|
|
components: {
|
|
Treeselect,
|
|
DetailsWrap
|
|
},
|
|
data() {
|
|
return {
|
|
//列表显示视图
|
|
viewType: "card",
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 项目表格数据
|
|
projectList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 12,
|
|
projectName: null,
|
|
industry: null,
|
|
regionalismId: null,
|
|
projectAddress: null,
|
|
projectStatus: null,
|
|
orderByColumn: "createTime",
|
|
isAsc: "desc"
|
|
},
|
|
projectTypeOptions: [],
|
|
// 行政划分树选项
|
|
regionalismOption: [],
|
|
componectVal: "",
|
|
sourceId: ""
|
|
};
|
|
},
|
|
created() {
|
|
if (this.$route.query['projectId']) {
|
|
this.handleDetails(this.$route.query)
|
|
}
|
|
this.getDicts("project_industry").then(response => {
|
|
this.projectTypeOptions = response.data;
|
|
});
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
sortChange(column) {
|
|
const sort = {
|
|
isAsc: column.order === "descending" ? "desc" : "asc",
|
|
orderByColumn: column.prop
|
|
};
|
|
this.queryParams = Object.assign(this.queryParams, sort);
|
|
this.handleQuery();
|
|
},
|
|
changeViewType(type) {
|
|
this.viewType=type;
|
|
},
|
|
indexFormatter(val) {
|
|
return (
|
|
val + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
|
|
);
|
|
},
|
|
handleDetails(row) {
|
|
this.sourceId = row.projectId;
|
|
this.componectVal = "DetailsWrap";
|
|
},
|
|
// 跳转详情页
|
|
toTableClick() {
|
|
if (this.$route.query['projectId']) {
|
|
this.$router.push('/project_tenant/project_tenant')
|
|
}
|
|
this.componectVal = "";
|
|
},
|
|
// 菜单状态字典翻译
|
|
statusFormat(row, column) {
|
|
return this.selectDictLabel(this.projectTypeOptions, row.industry);
|
|
},
|
|
/** 查询项目列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
listProject(this.queryParams).then(response => {
|
|
this.projectList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.projectId);
|
|
this.single = selection.length !== 1;
|
|
this.multiple = !selection.length;
|
|
},
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
const queryParams = this.queryParams;
|
|
this.$confirm("是否确认导出所有项目数据项?", "警告", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
})
|
|
.then(function() {
|
|
return exportProject(queryParams);
|
|
})
|
|
.then(response => {
|
|
this.download(response.msg);
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss">
|
|
.iot-project {
|
|
.eldialog-wrap {
|
|
.el-dialog__header {
|
|
border-bottom: 1px solid #747373;
|
|
}
|
|
.el-dialog__body {
|
|
padding: 0px;
|
|
}
|
|
.el-form {
|
|
padding: 20px;
|
|
padding-right: 40px;
|
|
}
|
|
.el-dialog__footer {
|
|
height: 60px;
|
|
border-top: 1px solid #747373;
|
|
text-align: right;
|
|
width: 100%;
|
|
padding: 0px;
|
|
padding-top: 15px;
|
|
.el-button + .el-button {
|
|
margin-right: 10px;
|
|
}
|
|
.el-button {
|
|
padding-top: 8px;
|
|
}
|
|
}
|
|
}
|
|
.to-home-wrap2 {
|
|
width: 100px;
|
|
height: 20px;
|
|
position: absolute;
|
|
right: 30px;
|
|
top: 30px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
z-index: 100;
|
|
color: #656363;
|
|
font-size: 20px;
|
|
cursor: default;
|
|
.el-button--medium.is-circle {
|
|
width: 25px;
|
|
height: 20px;
|
|
padding: 0;
|
|
background: #f26a6a;
|
|
color: #fff;
|
|
font-size: 16px;
|
|
border-radius: 5px;
|
|
height: 30px;
|
|
width: 100%;
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
.to-home-wrap2:hover {
|
|
color: #1890ff;
|
|
font-size: 30px;
|
|
}
|
|
}
|
|
// 卡片视图样式
|
|
.card-list-box {
|
|
.card-item-col {
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.card-item {
|
|
height: 100%;
|
|
border-radius: 10px;
|
|
border: 1px solid #ebeef5;
|
|
background-color: #fff;
|
|
overflow: hidden;
|
|
color: #303133;
|
|
transition: 0.3s;
|
|
cursor: pointer;
|
|
&:hover {
|
|
box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.2);
|
|
//border: 1px solid #409EFF;
|
|
}
|
|
|
|
.card-header {
|
|
padding: 10px 20px 0px 20px;
|
|
.card-header-top{
|
|
display: flex;
|
|
align-items: center;
|
|
.device-img-box{
|
|
width: 60px;
|
|
height: 60px;
|
|
img{
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
.card-item-name {
|
|
margin-left: 10px;
|
|
font-size: 18px;
|
|
line-height: 18px;
|
|
font-weight: bold;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: calc(100% - 110px);
|
|
}
|
|
}
|
|
|
|
.card-item-address{
|
|
height: 32px;
|
|
margin-top: 6px;
|
|
font-size: 12px;
|
|
color: #999;
|
|
line-height: 16px;
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 2; /* 限制显示的行数 */
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
}
|
|
.card-content {
|
|
padding: 10px 20px;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
.info-item {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 5px;
|
|
font-size: 11px;
|
|
width: 50%;
|
|
.label {
|
|
color: #909399;
|
|
width: 35px;
|
|
}
|
|
.value {
|
|
width: calc(100% - 35px);
|
|
color: #606266;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
&:nth-child(2n){
|
|
width: 50%;
|
|
.label {
|
|
width: 70px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.card-footer {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
padding: 10px 15px;
|
|
border-top: 1px solid #ebeef5;
|
|
|
|
.el-button {
|
|
padding: 5px 8px;
|
|
|
|
&:hover {
|
|
color: #409EFF;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|