1028 lines
38 KiB
Vue
1028 lines
38 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||
<el-form-item prop="proName">
|
||
<el-input
|
||
v-model="queryParams.proName"
|
||
placeholder="请输入工程名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item prop="vlevel">
|
||
<el-select v-model="queryParams.vlevel" placeholder="选择电压等级" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_voltage_level"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item prop="orgName">
|
||
<el-select v-model="queryParams.orgName" placeholder="选择建管单位" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_org_name"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item prop="proType">
|
||
<el-select v-model="queryParams.proType" placeholder="选择工程类型" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_pro_type"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item prop="departName">
|
||
<el-input
|
||
v-model="queryParams.departName"
|
||
placeholder="请输入项目部名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
|
||
<el-form-item>
|
||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
plain
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="handleAdd"
|
||
v-hasPermi="['basic:device:add']"
|
||
>新增工程</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="handleExport"
|
||
v-hasPermi="['basic:device:export']"
|
||
>导出数据</el-button>
|
||
</el-col>
|
||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||
</el-row>
|
||
|
||
<el-table v-loading="loading" :data="tableData" ref="multipleTable" row-key="proId" @selection-change="handleSelectionChange" @select="handlerSelect" @select-all="handlerSelectAll">
|
||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
|
||
<el-table-column label="序号" align="center" width="80" type="index">
|
||
<template slot-scope="scope">
|
||
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="工程id" align="center" prop="proId" v-if="false" />
|
||
<el-table-column label="所属项目部" align="center" prop="departName" />
|
||
<el-table-column label="工程名称" align="center" prop="proName" />
|
||
<el-table-column label="电压等级" align="center" prop="vlevel" />
|
||
<el-table-column label="建管单位" align="center" prop="orgName" />
|
||
<el-table-column label="工程类型" align="center" prop="proType" />
|
||
<el-table-column label="工程状态" align="center" prop="proStatus" />
|
||
<el-table-column label="业主项目经理" align="center" prop="yzManage" />
|
||
<el-table-column label="施工项目经理" align="center" prop="sgManage" />
|
||
<el-table-column label="总监理项目经理" align="center" prop="jlManage" />
|
||
<el-table-column label="杆塔数量" align="center" prop="gtNum">
|
||
<template slot-scope="scope">
|
||
<div @click="openGt(scope.row)" style="color: #02a7f0; cursor: pointer">
|
||
{{ scope.row.gtNum}}
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||
<template slot-scope="scope">
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
icon="el-icon-edit"
|
||
@click="handleUpdate(scope.row)"
|
||
v-hasPermi="['basic:device:edit']"
|
||
>编辑</el-button>
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
icon="el-icon-delete"
|
||
@click="handleDelete(scope.row)"
|
||
v-hasPermi="['basic:device:del']"
|
||
>删除</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<pagination
|
||
v-show="total>0"
|
||
:total="total"
|
||
:page.sync="queryParams.pageNum"
|
||
:limit.sync="queryParams.pageSize"
|
||
@pagination="getList"
|
||
/>
|
||
|
||
<!-- 杆塔弹窗 -->
|
||
<el-dialog :title="title" :visible.sync="showGt" width="1000px" height="1000px" append-to-body>
|
||
<el-form :model="queryGt" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||
<el-form-item prop="gtCode">
|
||
<el-input
|
||
v-model="queryGt.gtCode"
|
||
placeholder="请输入杆塔编号"
|
||
clearable
|
||
@keyup.enter.native="handleQueryGt"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryGt">查询</el-button>
|
||
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryGt">重置</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
plain
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="handleAddGt"
|
||
v-hasPermi="['basic:person:add']"
|
||
>新增杆塔</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="handleExportGt"
|
||
v-hasPermi="['basic:person:export']"
|
||
>导出数据</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="info"
|
||
plain
|
||
icon="el-icon-upload"
|
||
size="mini"
|
||
@click="handleImport"
|
||
v-hasPermi="['basic:person:excelUpload']"
|
||
>导入数据</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="success"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="handleFile"
|
||
>数据模板下载</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-table v-loading="loadingTwo" :data="gtList" width="600px" height = "600px" ref="multipleTableGt" row-key="gtId" @selection-change="handleSelectionChangeGt" @select="handlerSelectGt" @select-all="handlerSelectAllGt">
|
||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
|
||
<el-table-column label="序号" align="center" width="80" type="index">
|
||
<template slot-scope="scope">
|
||
<span>{{ (queryGt.pageNum - 1) * queryGt.pageSize + scope.$index + 1 }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="杆塔id" align="center" prop="gtId" v-if="false" />
|
||
<el-table-column label="杆塔编号" align="center" prop="gtCode" />
|
||
<el-table-column label="杆塔经度" align="center" prop="lon" />
|
||
<el-table-column label="杆塔纬度" align="center" prop="lat" />
|
||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||
<template slot-scope="scope">
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
icon="el-icon-edit"
|
||
@click="handleUpdateGt(scope.row)"
|
||
v-hasPermi="['basic:device:edit']"
|
||
>编辑</el-button>
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
icon="el-icon-delete"
|
||
@click="handleDeleteGt(scope.row)"
|
||
v-hasPermi="['basic:device:del']"
|
||
>删除</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<pagination
|
||
v-show="totalTwo>0"
|
||
:total="totalTwo"
|
||
:page.sync="queryGt.pageNum"
|
||
:limit.sync="queryGt.pageSize"
|
||
@pagination="getListGt"
|
||
/>
|
||
|
||
</el-dialog>
|
||
|
||
<!-- 添加或修改杆塔对话框 -->
|
||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||
<el-form ref="form" :model="form" :rules="rules" label-width="100px" >
|
||
<el-form-item label="杆塔编号" prop="gtCode">
|
||
<el-input v-model="form.gtCode" placeholder="请输入杆塔编号" maxlength="20"/>
|
||
</el-form-item>
|
||
<el-form-item label="杆塔经度" prop="lon">
|
||
<el-input v-model="form.lon" placeholder="请输入杆塔经度" maxlength="20"/>
|
||
</el-form-item>
|
||
<el-form-item label="杆塔纬度" prop="lat">
|
||
<el-input v-model="form.lat" placeholder="请输入杆塔纬度" />
|
||
</el-form-item>
|
||
</el-form>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||
<el-button @click="cancel">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<!-- 添加或修改工程对话框 -->
|
||
<el-dialog :title="title" :visible.sync="openPro" width="900px" height="900px" append-to-body>
|
||
<el-form ref="formPro" :model="formPro" :rules="rulesPro" label-width="100px" >
|
||
<el-row :gutter="24">
|
||
<el-col :span="12">
|
||
<el-form-item label="工程名称" prop="proName">
|
||
<el-input v-model="formPro.proName" placeholder="请输入工程名称" maxlength="20"/>
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="12">
|
||
<el-form-item label="所属项目部" prop="departName">
|
||
<el-select v-model="formPro.departName" placeholder="请选择所属项目部" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in engineeringList"
|
||
:key="dict.id"
|
||
:label="dict.name"
|
||
:value="dict.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row :gutter="24">
|
||
<el-col :span="12">
|
||
<el-form-item label="电压等级" prop="vlevel">
|
||
<el-select v-model="formPro.vlevel" placeholder="请选择电压等级" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_voltage_level"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="12">
|
||
<el-form-item label="建管单位" prop="orgName">
|
||
<el-select v-model="formPro.orgName" placeholder="请选择建管单位" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_org_name"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row :gutter="24">
|
||
<el-col :span="12">
|
||
<el-form-item label="工程类型" prop="proType">
|
||
<el-select v-model="formPro.proType" placeholder="请选择工程类型" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_pro_type"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="12">
|
||
<el-form-item label="工程状态" prop="proStatus">
|
||
<el-select v-model="formPro.proStatus" placeholder="请选择工程状态" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_pro_status"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row :gutter="24">
|
||
<el-col :span="12">
|
||
<el-form-item label="业主项目经理" prop="yzManage">
|
||
<el-select v-model="formPro.yzManage" placeholder="请选择业主项目经理" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_yz_manage"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="12">
|
||
<el-form-item label="施工项目经理" prop="sgManage">
|
||
<el-select v-model="formPro.sgManage" placeholder="请选择施工项目经理" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_sg_manage"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="24">
|
||
<el-col :span="12">
|
||
<el-form-item label="总监理项目经理" prop="jlManage" label-width="110px">
|
||
<el-select v-model="formPro.jlManage" placeholder="请选择总监理项目经理" clearable style="width: 100%;">
|
||
<el-option
|
||
v-for="dict in dict.type.sys_jl_manage"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitFormPro">确 定</el-button>
|
||
<el-button @click="cancelPro">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<!-- 用户导入对话框 -->
|
||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" :data="{updateSupport:upload.updateSupport,proId:this.proId}" drag>
|
||
<i class="el-icon-upload"></i>
|
||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||
<div class="el-upload__tip text-center" slot="tip">
|
||
<!-- <div class="el-upload__tip" slot="tip">
|
||
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
|
||
</div> -->
|
||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||
<!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
||
@click="importTemplate">下载模板</el-link> -->
|
||
</div>
|
||
</el-upload>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||
<el-button @click="upload.open = false">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { listEngineering,getGtInfo,editGt,addGt,getGtId,delGt,exportGt,exportGtSome,gtFile, getEngineeringInfo, editPro,addPro, exportEngineering,exportEngineeringSome,delPro} from "@/api/base/engineering";
|
||
import { downloadFile } from '@/utils/download'
|
||
import { getEngineeringList } from "@/api/select";
|
||
import uploadFile from '../../components/uploadFile.vue'
|
||
import { getToken } from '@/utils/auth'
|
||
export default {
|
||
name: "Post",
|
||
dicts: ['sys_normal_disable','sys_voltage_level','sys_org_name','sys_pro_type','sys_pro_status',
|
||
'sys_yz_manage','sys_sg_manage','sys_jl_manage','sys_device_type'],
|
||
components: {
|
||
uploadFile
|
||
},
|
||
data() {
|
||
return {
|
||
showAttribute:false,
|
||
// 遮罩层
|
||
loading: true,
|
||
// 遮罩层
|
||
loadingTwo: true,
|
||
proId:undefined,
|
||
// 杆塔编号
|
||
gtCode:undefined,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
|
||
// 选中数组
|
||
idsGt: [],
|
||
// 非单个禁用
|
||
singleGt: true,
|
||
// 非多个禁用
|
||
multipleGt: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
showGt:false,
|
||
maxLength:100,//已选列表上限,防止数据过多请求报错
|
||
currentSelection:[],//工程已选列表
|
||
currentSelectionGt:[],//杆塔已选列表
|
||
// 总条数
|
||
total: 0,
|
||
//绑定设备总条数
|
||
totalTwo:0,
|
||
//未绑定设备总条数
|
||
totalThree:0,
|
||
// 设备表格数据
|
||
tableData: [],
|
||
// 弹出层标题
|
||
title: "",
|
||
// 是否显示弹出层
|
||
open: false,
|
||
openPro:false,
|
||
//所属工程
|
||
proList: [],
|
||
engineeringList:[],
|
||
//杆塔列表
|
||
gtList: [],
|
||
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
proName:undefined,
|
||
vlevel:undefined,
|
||
orgName: undefined,
|
||
proType: undefined,
|
||
departName:undefined,
|
||
},
|
||
|
||
queryGt: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
proId:undefined,
|
||
gtCode:undefined,
|
||
},
|
||
// 表单参数
|
||
form: {},
|
||
formPro: {},
|
||
formThree: {},
|
||
|
||
// 用户导入参数
|
||
upload: {
|
||
// 是否显示弹出层(用户导入)
|
||
open: false,
|
||
// 弹出层标题(用户导入)
|
||
title: "",
|
||
// 是否禁用上传
|
||
isUploading: false,
|
||
// 是否更新已经存在的用户数据
|
||
updateSupport: 0,
|
||
// 设置上传的请求头部
|
||
headers: { Authorization: "Bearer " + getToken() },
|
||
// 上传的地址
|
||
url: process.env.VUE_APP_BASE_API + "/bracelet/engineering/excelUpload"
|
||
},
|
||
|
||
|
||
//表单校验
|
||
rules: {
|
||
gtCode: [
|
||
{ required: true, message: "杆塔编号不能为空", trigger: "blur" }
|
||
],
|
||
lon: [
|
||
{ required: true, message: "杆塔经度不能为空", trigger: "blur" },
|
||
{
|
||
validator: (rule, value, callback) => {
|
||
if (value === '' || value === null) {
|
||
return callback(new Error('请必须输入-180 ~ 180内的数据'));
|
||
}
|
||
const longitude = parseFloat(value);
|
||
if (longitude <-180 || longitude > 180) {
|
||
callback(new Error('请必须输入-180 ~ 180内的数据'));
|
||
} else {
|
||
callback();
|
||
}
|
||
},
|
||
trigger: 'blur'
|
||
}
|
||
],
|
||
lat: [
|
||
{ required: true, message: "杆塔纬度不能为空", trigger: "blur" },
|
||
{
|
||
validator: (rule, value, callback) => {
|
||
if (value === '' || value === null) {
|
||
return callback(new Error('请必须输入-90 ~ 90内的数据'));
|
||
}
|
||
const latitude = parseFloat(value);
|
||
if (latitude <-90 || latitude > 90) {
|
||
callback(new Error('请必须输入-90 ~ 90内的数据'));
|
||
} else {
|
||
callback();
|
||
}
|
||
},
|
||
trigger: 'blur'
|
||
}
|
||
]
|
||
},
|
||
rulesPro: {
|
||
proName: [
|
||
{ required: true, message: "工程名称不能为空", trigger: "blur" }
|
||
],
|
||
departName: [
|
||
{ required: true, message: "所属项目部不能为空", trigger: "change" }
|
||
],
|
||
vlevel: [
|
||
{ required: true, message: "电压等级不能为空", trigger: "change" }
|
||
],
|
||
orgName: [
|
||
{ required: true,message: "建管单位不能为空", trigger: "change" }
|
||
],
|
||
proType: [
|
||
{ required: true,message: "工程类型不能为空", trigger: "change" }
|
||
],
|
||
proStatus: [
|
||
{ required: true,message: "工程状态不能为空", trigger: "change" }
|
||
],
|
||
yzManage: [
|
||
{ required: false, trigger: "change" }
|
||
],
|
||
sgManage: [
|
||
{ required: false, trigger: "change" }
|
||
],
|
||
jlManage: [
|
||
{ required: false, trigger: "change" }
|
||
],
|
||
}
|
||
};
|
||
},
|
||
computed: {
|
||
},
|
||
created() {
|
||
this.getList();
|
||
this.getEngineeringList();
|
||
},
|
||
mounted(){
|
||
},
|
||
methods: {
|
||
//工程页面单选操作-跨页
|
||
handlerSelect(val, row) {
|
||
this.currentSelection.indexOf(row.proId) === -1
|
||
? this.currentSelection.push(row.proId)
|
||
: this.currentSelection.splice(this.currentSelection.indexOf(row.proId), 1)
|
||
},
|
||
//工程页面全选操作-跨页
|
||
handlerSelectAll(val) {
|
||
if (val.length) {
|
||
// 进来此处说明:
|
||
// 1 当前页的全选 2 其他页有数据然后当前页的取消全选
|
||
// 比较全选或者取消全选与当前页的数据,得到差集
|
||
// 如果tableData中的数据在val中不存在,则说明是取消全选,需要从currentSelection中移除
|
||
// 如果tableData中所有的数据都在val中存在,则说明是全选,需要将差集添加到currentSelection中
|
||
const isAllSelect = this.tableData.every(item =>
|
||
val.some(valItem => valItem.proId === item.proId)
|
||
)
|
||
if (isAllSelect) {
|
||
// 全选中新增的差集
|
||
const diff = val.filter(
|
||
item => !this.currentSelection.some(proId => proId === item.proId)
|
||
)
|
||
if (this.currentSelection.length + diff.length > this.maxLength) {
|
||
this.currentSelection = this.currentSelection.concat(
|
||
diff.splice(0, this.maxLength - this.currentSelection.length)
|
||
.map(item => item.proId))
|
||
diff.forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
|
||
} else {
|
||
this.currentSelection = this.currentSelection.concat(diff.map(item => item.proId))
|
||
}
|
||
} else {
|
||
this.currentSelection = this.currentSelection.filter(
|
||
proId => !this.tableData.some(item => item.proId === proId)
|
||
)
|
||
}
|
||
} else {
|
||
// 进来此处说明:
|
||
// 其他页并无勾选数据,且当前页取消勾选
|
||
this.currentSelection = []
|
||
}
|
||
},
|
||
|
||
//杆塔页面单选操作-跨页
|
||
handlerSelectGt(val, row) {
|
||
this.currentSelectionGt.indexOf(row.gtId) === -1
|
||
? this.currentSelectionGt.push(row.gtId)
|
||
: this.currentSelectionGt.splice(this.currentSelectionGt.indexOf(row.gtId), 1)
|
||
},
|
||
//杆塔页面全选操作-跨页
|
||
handlerSelectAllGt(val) {
|
||
if (val.length) {
|
||
// 进来此处说明:
|
||
// 1 当前页的全选 2 其他页有数据然后当前页的取消全选
|
||
// 比较全选或者取消全选与当前页的数据,得到差集
|
||
// 如果tableData中的数据在val中不存在,则说明是取消全选,需要从currentSelection中移除
|
||
// 如果tableData中所有的数据都在val中存在,则说明是全选,需要将差集添加到currentSelection中
|
||
const isAllSelectGt = this.gtList.every(item =>
|
||
val.some(valItem => valItem.gtId === item.gtId)
|
||
)
|
||
if (isAllSelectGt) {
|
||
// 全选中新增的差集
|
||
const diff = val.filter(
|
||
item => !this.currentSelectionGt.some(gtId => gtId === item.gtId)
|
||
)
|
||
if (this.currentSelectionGt.length + diff.length > this.maxLength) {
|
||
this.currentSelectionGt = this.currentSelectionGt.concat(
|
||
diff.splice(0, this.maxLength - this.currentSelectionGt.length)
|
||
.map(item => item.gtId))
|
||
diff.forEach(item => this.$refs.multipleTableGt.toggleRowSelection(item, false))
|
||
} else {
|
||
this.currentSelectionGt = this.currentSelectionGt.concat(diff.map(item => item.gtId))
|
||
}
|
||
} else {
|
||
this.currentSelectionGt = this.currentSelectionGt.filter(
|
||
gtId => !this.gtList.some(item => item.gtId === gtId)
|
||
)
|
||
}
|
||
} else {
|
||
// 进来此处说明:
|
||
// 其他页并无勾选数据,且当前页取消勾选
|
||
this.currentSelectionGt = []
|
||
}
|
||
},
|
||
|
||
|
||
//获取所属工程
|
||
getEngineeringList(){
|
||
getEngineeringList().then(response => {
|
||
this.engineeringList = response.data;
|
||
});
|
||
},
|
||
/** 查询工程列表 */
|
||
getList() {
|
||
this.loading = true;
|
||
listEngineering(this.queryParams).then(response => {
|
||
this.tableData = response.rows;
|
||
this.total = response.total;
|
||
this.loading = false;
|
||
if (this.currentSelection.length) {
|
||
this.$nextTick(() => {
|
||
this.currentSelection.forEach(row => {
|
||
this.tableData.forEach(item => {
|
||
if (item.proId === row) {
|
||
this.$refs.multipleTable?.toggleRowSelection(item, true)
|
||
}
|
||
})
|
||
})
|
||
})
|
||
} else {
|
||
this.$refs.multipleTable?.clearSelection()
|
||
}
|
||
});
|
||
},
|
||
|
||
//打开杆塔页面
|
||
openGt(row){
|
||
this.proId = row.proId;
|
||
this.title = "杆塔"
|
||
this.showGt = true;
|
||
this.getListGt();
|
||
},
|
||
|
||
/** 查询工程下杆塔详情列表 */
|
||
getListGt() {
|
||
this.loadingTwo = true;
|
||
this.queryGt.proId = this.proId;
|
||
getGtInfo(this.queryGt).then(response => {
|
||
this.gtList = response.rows;
|
||
this.totalTwo = response.total;
|
||
this.loadingTwo = false;
|
||
if (this.currentSelectionGt.length) {
|
||
this.$nextTick(() => {
|
||
this.currentSelectionGt.forEach(row => {
|
||
this.gtList.forEach(item => {
|
||
if (item.gtId === row) {
|
||
this.$refs.multipleTableGt?.toggleRowSelection(item, true)
|
||
}
|
||
})
|
||
})
|
||
})
|
||
} else {
|
||
this.$refs.multipleTableGt?.clearSelection()
|
||
}
|
||
});
|
||
},
|
||
|
||
/** 杆塔页面搜索按钮操作 */
|
||
handleQueryGt() {
|
||
this.queryGt.pageNum = 1;
|
||
this.queryGt.proId = this.proId;
|
||
this.getListGt();
|
||
},
|
||
|
||
/** 新增杆塔按钮操作 */
|
||
handleAddGt() {
|
||
this.reset();
|
||
this.open = true;
|
||
this.title = "新增杆塔";
|
||
},
|
||
|
||
|
||
/** 修改杆塔按钮操作 */
|
||
handleUpdateGt(row) {
|
||
this.reset();
|
||
const gtId = row.gtId;
|
||
getGtId(gtId).then(response => {
|
||
this.form = response.data;
|
||
this.$set(this.form,'gtCode',response.data.gtCode+'')
|
||
this.$set(this.form,'lon',response.data.lon+'')
|
||
this.$set(this.form,'lat',response.data.lat+'')
|
||
setTimeout(()=>{
|
||
this.open = true;
|
||
this.title = "修改杆塔";
|
||
},100)
|
||
|
||
});
|
||
},
|
||
|
||
|
||
// 杆塔取消按钮
|
||
cancel() {
|
||
this.open = false;
|
||
this.reset();
|
||
},
|
||
// 工程取消按钮
|
||
cancelPro() {
|
||
this.openPro = false;
|
||
this.resetPro();
|
||
},
|
||
// 表单重置
|
||
reset() {
|
||
this.form = {};
|
||
this.resetForm("form");
|
||
},
|
||
// 表单重置
|
||
resetPro() {
|
||
this.formPro = {};
|
||
this.resetForm("formPro");
|
||
},
|
||
|
||
/** 搜索按钮操作 */
|
||
handleQuery() {
|
||
this.queryParams.pageNum = 1;
|
||
this.getList();
|
||
},
|
||
/** 工程重置按钮操作 */
|
||
resetQuery() {
|
||
this.resetForm("queryForm");
|
||
this.currentSelection = []//重置清除已选列表
|
||
this.handleQuery();
|
||
},
|
||
|
||
/** 杆塔重置按钮操作 */
|
||
resetQueryGt() {
|
||
this.resetForm("queryForm");
|
||
this.currentSelectionGt = []//重置清除已选列表
|
||
this.handleQueryGt();
|
||
},
|
||
|
||
// 工程多选框选中数据
|
||
handleSelectionChange(selection) {
|
||
this.ids = selection.map(item => item.proId)
|
||
this.single = selection.length!=1
|
||
this.multiple = !selection.length
|
||
},
|
||
|
||
// 杆塔多选框选中数据
|
||
handleSelectionChangeGt(selection) {
|
||
this.idsGt = selection.map(item => item.gtId)
|
||
this.singleGt = selection.length!=1
|
||
this.multipleGt = !selection.length
|
||
},
|
||
/** 新增按钮操作 */
|
||
handleAdd() {
|
||
this.resetPro();
|
||
this.proId = undefined;
|
||
this.openPro = true;
|
||
this.title = "新增工程";
|
||
},
|
||
|
||
|
||
/** 修改工程按钮操作 */
|
||
handleUpdate(row) {
|
||
this.resetPro();
|
||
this.proId = row.proId;
|
||
const proId = row.proId
|
||
getEngineeringInfo(proId).then(response => {
|
||
this.formPro = response.data;
|
||
this.$set(this.formPro,'proName',response.data.proName+'')
|
||
this.$set(this.formPro,'departName',response.data.departName+'')
|
||
this.$set(this.formPro,'vlevel',response.data.vlevel)
|
||
this.$set(this.formPro,'orgName',response.data.orgName)
|
||
this.$set(this.formPro,'proType',response.data.proType)
|
||
this.$set(this.formPro,'proStatus',response.data.proStatus)
|
||
this.$set(this.formPro,'yzManage',response.data.yzManage)
|
||
this.$set(this.formPro,'sgManage',response.data.sgManage)
|
||
this.$set(this.formPro,'jlManage',response.data.jlManage)
|
||
setTimeout(()=>{
|
||
this.openPro = true;
|
||
this.title = "修改工程";
|
||
},100)
|
||
|
||
});
|
||
},
|
||
|
||
/** 杆塔提交按钮 */
|
||
submitForm() {
|
||
this.$refs["form"].validate(valid => {
|
||
if (valid) {
|
||
this.form.proId = this.proId;
|
||
if (this.form.gtId != undefined) {
|
||
editGt(this.form).then(response => {
|
||
this.$modal.msgSuccess("修改成功");
|
||
this.open = false;
|
||
this.getList();
|
||
this.getListGt();
|
||
});
|
||
} else {
|
||
addGt(this.form).then(response => {
|
||
this.$modal.msgSuccess("新增成功");
|
||
this.open = false;
|
||
this.getList();
|
||
this.getListGt();
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
|
||
|
||
/** 工程提交按钮 */
|
||
submitFormPro() {
|
||
this.$refs["formPro"].validate(valid => {
|
||
if (valid) {
|
||
this.formPro.proId = this.proId;
|
||
console.log(this.formPro)
|
||
if (this.formPro.proId != undefined) {
|
||
editPro(this.formPro).then(response => {
|
||
this.$modal.msgSuccess("修改成功");
|
||
this.openPro = false;
|
||
this.getList();
|
||
// this.getListGt();
|
||
});
|
||
} else {
|
||
addPro(this.formPro).then(response => {
|
||
this.$modal.msgSuccess("新增成功");
|
||
this.openPro = false;
|
||
this.getList();
|
||
// this.getListGt();
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
/** 杆塔删除按钮操作 */
|
||
handleDeleteGt(row) {
|
||
console.log(row)
|
||
const param = {
|
||
gtId:row.gtId
|
||
}
|
||
this.$modal.confirm('是否确认删除杆塔编号为"' + row.gtCode + '"的数据项?').then(function() {
|
||
return delGt(param);
|
||
}).then(() => {
|
||
this.getList();
|
||
this.getListGt();
|
||
this.$modal.msgSuccess("删除成功");
|
||
}).catch(() => {});
|
||
},
|
||
|
||
/** 工程删除按钮操作 */
|
||
handleDelete(row) {
|
||
const proIdTemp = row.proId;
|
||
console.log(proIdTemp)
|
||
if(row.gtNum>0){
|
||
this.$alert('该工程存在杆塔,无法删除', '提示', {
|
||
type: 'warning',
|
||
confirmButtonText: '确定',
|
||
});
|
||
return;
|
||
}
|
||
this.$modal.confirm('是否确认删除工程名称为"' + row.proName + '"的数据项?').then(function() {
|
||
return delPro(proIdTemp);
|
||
}).then(() => {
|
||
this.getList();
|
||
this.$modal.msgSuccess("删除成功");
|
||
}).catch(() => {});
|
||
},
|
||
/** 工程导出按钮操作 */
|
||
handleExport() {
|
||
if(this.ids.length == 0){
|
||
exportEngineering(this.queryParams).then(res => {
|
||
downloadFile({ fileName: `工程_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||
})
|
||
}else{
|
||
const ids = this.ids.join(',')
|
||
exportEngineeringSome({ids:ids}).then(res => {
|
||
downloadFile({ fileName: `工程_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||
})
|
||
}
|
||
},
|
||
|
||
/** 杆塔导出按钮操作 */
|
||
handleExportGt() {
|
||
if(this.idsGt.length == 0){
|
||
exportGt(this.queryGt).then(res => {
|
||
downloadFile({ fileName: `杆塔_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||
})
|
||
}else{
|
||
const idsGt = this.idsGt.join(',')
|
||
console.log(idsGt)
|
||
exportGtSome({ids:idsGt,proId:this.queryGt.proId}).then(res => {
|
||
downloadFile({ fileName: `杆塔_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||
})
|
||
}
|
||
},
|
||
|
||
//模板下载
|
||
handleFile(){
|
||
gtFile().then(res => {
|
||
downloadFile({ fileName: `杆塔模板.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||
})
|
||
},
|
||
|
||
/** 导入按钮操作 */
|
||
handleImport() {
|
||
this.upload.title = "杆塔导入";
|
||
this.upload.open = true;
|
||
},
|
||
// 文件上传中处理
|
||
handleFileUploadProgress(event, file, fileList) {
|
||
this.upload.isUploading = true;
|
||
},
|
||
// 文件上传成功处理
|
||
handleFileSuccess(response, file, fileList) {
|
||
this.upload.open = false;
|
||
this.upload.isUploading = false;
|
||
this.$refs.upload.clearFiles();
|
||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||
this.getList();
|
||
this.getListGt();
|
||
},
|
||
// 提交上传文件
|
||
submitFileForm() {
|
||
this.$refs.upload.submit();
|
||
},
|
||
|
||
//打开设备页面
|
||
openDevice(row){
|
||
this.sidebandId = row.sidebandId;
|
||
this.title = "选择"
|
||
this.showDevice = true;
|
||
this.getListDevice();
|
||
},
|
||
|
||
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.uploadImg {
|
||
padding-top: 20px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.deviceCode {
|
||
margin-top: 10px;
|
||
padding-bottom: 20px;
|
||
font-size: 18px;
|
||
}
|
||
::v-deep.el-table .fixed-width .el-button--mini {
|
||
width: 60px !important;
|
||
margin-bottom: 10px;
|
||
}
|
||
//隐藏图片上传框的css
|
||
::v-deep.disabled {
|
||
.el-upload--picture-card {
|
||
display: none;
|
||
}
|
||
}
|
||
</style> |