导出功能

This commit is contained in:
jjLv 2024-08-16 16:26:19 +08:00
parent a547d8c35f
commit 313464bc14
11 changed files with 511 additions and 91 deletions

View File

@ -218,3 +218,14 @@ export function exportSh(query) {
params: query
})
}
// 批量导出
export function exportShSome(query) {
return request({
url: '/bracelet/bracelet/exportShSome',
method: 'get',
responseType: 'blob',
params: query
})
}

View File

@ -117,6 +117,16 @@ export function exportDevice(query) {
})
}
// 批量导出
export function exportDeviceSome(query) {
return request({
url: '/bracelet/device/exportDeviceSome',
method: 'get',
responseType: 'blob',
params: query
})
}
// 查询班组成员列表
export function getWorkPersonList(query) {
return request({

View File

@ -103,6 +103,16 @@ export function exportEngineering(query) {
})
}
// 批量导出工程
export function exportEngineeringSome(query) {
return request({
url: '/bracelet/engineering/exportEngineeringSome',
method: 'get',
responseType: 'blob',
params: query
})
}
// 导出杆塔
export function exportGt(query) {
return request({
@ -113,6 +123,17 @@ export function exportGt(query) {
})
}
// 批量导出工程
export function exportGtSome(query) {
return request({
url: '/bracelet/engineering/exportGtSome',
method: 'get',
responseType: 'blob',
params: query
})
}
// 模板下载
export function gtFile(query) {
return request({

View File

@ -60,3 +60,13 @@ export function exportProject(query) {
params: query
})
}
// 批量导出
export function exportProjectSome(query) {
return request({
url: '/bracelet/project/exportProjectSome',
method: 'get',
responseType: 'blob',
params: query
})
}

View File

@ -46,3 +46,13 @@ export function exportConstructionRecord(query) {
})
}
// 导出
export function exportConstructionRecordSome(query) {
return request({
url: '/bracelet/construction/exportConstructionRecordSome',
method: 'get',
responseType: 'blob',
params: query
})
}

View File

@ -79,7 +79,8 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="braceletList">
<el-table v-loading="loading" :data="braceletList" ref="multipleTableSh" row-key="shId" @selection-change="handleSelectionChangeSh" @select="handlerSelectSh" @select-all="handlerSelectAllSh">
<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>
@ -319,7 +320,7 @@
<el-table-column label="设备值单位" align="center" prop="dataUnit" />
<el-table-column label="级联编码" align="center" prop="dataCode" />
<el-table-column label="数据类型" align="center" prop="dataType" />
<el-table-column label="数据采集时间" align="center" prop="dataTime" />
<el-table-column label="数据采集时间" align="center" prop="dataTime" width="160px"/>
<el-table-column label="设备属性图片" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -371,13 +372,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<!-- <el-row :gutter="24">
<el-col :span="20">
<el-form-item label="设备采集值" prop="dataVal">
<el-input v-model="formThree.dataVal" placeholder="请输入设备采集值" maxlength="20"/>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="24">
<el-col :span="20">
@ -403,7 +404,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<!-- <el-row :gutter="24">
<el-col :span="20">
<el-form-item label="数据采集时间" prop="dataTime">
<el-date-picker
@ -415,7 +416,7 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="图标 " label-width="120px">
@ -744,7 +745,7 @@
</template>
<script>
import { listBracelet, listShboxall,delShById, exportSh,listShbox,addSh,listShboxBind,addShBind,delSh,editSh,delDeviceAttribute,
import { listBracelet, listShboxall,delShById, exportSh,listShbox,addSh,listShboxBind,addShBind,delSh,editSh,delDeviceAttribute,exportShSome,
getBoxInfo,editBox,addBox,delShboxById,listShBind,listShNoBind,bindSh,getBoxNewInfo,addAttribute,listDeviceAttribute,getAttributeInfo,editAttribute} from "@/api/base/bracelet";
import { downloadFile } from '@/utils/download'
@ -788,13 +789,21 @@
loadingSeven:true,
//
ids: [],
idsSh: [],
idsbox: [],
//
single: true,
//
multiple: true,
//
singleSh: true,
//
multipleSh: true,
//
showSearch: true,
maxLength:100,//
currentSelection:[],//
currentSelectionSh:[],//
//
total: 0,
//
@ -997,9 +1006,9 @@
dataName: [
{ required: true, message: "设备属性名称不能为空", trigger: "blur" }
],
dataVal: [
{ required: true, message: "设备采集值不能为空", trigger: "blur" }
],
// dataVal: [
// { required: true, message: "", trigger: "blur" }
// ],
dataUnit: [
{ required: true, message: "设备值单位不能为空", trigger: "blur" }
],
@ -1009,9 +1018,9 @@
dataType: [
{ required: true, message: "数据类型不能为空", trigger: "blur" },
],
dataTime: [
{ required: true, message: "数据采集日期不能为空", trigger: "blur" }
],
// dataTime: [
// { required: true, message: "", trigger: "blur" }
// ],
},
};
@ -1027,6 +1036,53 @@
this.getboxList();
},
methods: {
//-
handlerSelectSh(val, row) {
this.currentSelectionSh.indexOf(row.shId) === -1
? this.currentSelectionSh.push(row.shId)
: this.currentSelectionSh.splice(this.currentSelectionSh.indexOf(row.shId), 1)
},
//-
handlerSelectAllSh(val) {
if (val.length) {
// :
// 1 2
//
// braceletListvalcurrentSelectionSh
// braceletListvalcurrentSelectionSh
const isAllSelectSh = this.braceletList.every(item =>
val.some(valItem => valItem.shId === item.shId)
)
if (isAllSelectSh) {
//
const diff = val.filter(
item => !this.currentSelectionSh.some(shId => shId === item.shId)
)
if (this.currentSelectionSh.length + diff.length > this.maxLength) {
this.currentSelectionSh = this.currentSelectionSh.concat(
diff.splice(0, this.maxLength - this.currentSelectionSh.length)
.map(item => item.shId))
diff.forEach(item => this.$refs.multipleTableSh.toggleRowSelection(item, false))
} else {
this.currentSelectionSh = this.currentSelectionSh.concat(diff.map(item => item.shId))
}
} else {
this.currentSelectionSh = this.currentSelectionSh.filter(
shId => !this.braceletList.some(item => item.shId === shId)
)
}
} else {
// :
//
this.currentSelectionSh = []
}
},
//
handleSelectionChangeSh(selection) {
this.idsSh = selection.map(item => item.shId)
this.singleSh = selection.length!=1
this.multipleSh = !selection.length
},
//-
openImg(url) {
@ -1073,6 +1129,19 @@
this.braceletList = response.rows;
this.total = response.total;
this.loading = false;
if (this.currentSelectionSh.length) {
this.$nextTick(() => {
this.currentSelectionSh.forEach(row => {
this.braceletList.forEach(item => {
if (item.shId === row) {
this.$refs.multipleTableSh?.toggleRowSelection(item, true)
}
})
})
})
} else {
this.$refs.multipleTableSh?.clearSelection()
}
});
},
@ -1173,6 +1242,7 @@
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.currentSelectionSh = [];//
this.handleQuery();
},
/** 重置按钮操作 */
@ -1688,9 +1758,16 @@
/** 导出按钮操作 */
handleExport() {
exportSh(this.queryParams).then(res => {
if(this.ids.length == 0){
exportSh(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(',')
exportShSome({ids:ids}).then(res => {
downloadFile({ fileName: `手环_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
}
},
/** 导入按钮操作 */

View File

@ -209,7 +209,7 @@
<el-table-column label="设备值单位" align="center" prop="dataUnit" />
<el-table-column label="级联编码" align="center" prop="dataCode" />
<el-table-column label="数据类型" align="center" prop="dataType" />
<el-table-column label="数据采集时间" align="center" prop="dataTime" />
<el-table-column label="数据采集时间" align="center" prop="dataTime" width="160px"/>
<el-table-column label="设备属性图片" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -261,13 +261,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<!-- <el-row :gutter="24">
<el-col :span="20">
<el-form-item label="设备采集值" prop="dataVal">
<el-input v-model="formThree.dataVal" placeholder="请输入设备采集值" maxlength="20"/>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="24">
<el-col :span="20">
@ -293,7 +293,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<!-- <el-row :gutter="24">
<el-col :span="20">
<el-form-item label="数据采集时间" prop="dataTime">
<el-date-picker
@ -305,7 +305,7 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="图标 " label-width="120px">
@ -364,7 +364,7 @@
</template>
<script>
import { listDevcie, addDevice, editDevice, getDeviceInfo,delDevice, exportDevice,addAttribute,listDeviceAttribute,getAttributeInfo,editAttribute,delDeviceAttribute} from "@/api/base/device";
import { listDevcie, addDevice, editDevice, getDeviceInfo,delDevice, exportDevice,exportDeviceSome,addAttribute,listDeviceAttribute,getAttributeInfo,editAttribute,delDeviceAttribute} from "@/api/base/device";
import { downloadFile } from '@/utils/download'
import { getToken } from '@/utils/auth'
import uploadFile from '../../components/uploadFile.vue'
@ -471,9 +471,9 @@
dataName: [
{ required: true, message: "设备属性名称不能为空", trigger: "blur" }
],
dataVal: [
{ required: true, message: "设备采集值不能为空", trigger: "blur" }
],
// dataVal: [
// { required: true, message: "", trigger: "blur" }
// ],
dataUnit: [
{ required: true, message: "设备值单位不能为空", trigger: "blur" }
],
@ -483,9 +483,9 @@
dataType: [
{ required: true, message: "数据类型不能为空", trigger: "blur" }
],
dataTime: [
{ required: true, message: "数据采集日期不能为空", trigger: "blur" }
],
// dataTime: [
// { required: true, message: "", trigger: "blur" }
// ],
},
//
rowObj:{},
@ -887,9 +887,16 @@
},
/** 导出按钮操作 */
handleExport() {
exportDevice(this.queryParams).then(res => {
if(this.ids.length == 0){
exportDevice(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(',')
exportDeviceSome({ids:ids}).then(res => {
downloadFile({ fileName: `设备_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
}
},
//
openDevice(row){

View File

@ -78,14 +78,15 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableData" >
<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="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" />
@ -142,6 +143,7 @@
</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>
@ -187,8 +189,8 @@
</el-col>
</el-row>
<el-table v-loading="loadingTwo" :data="gtList" width="600px" height = "600px" >
<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>
@ -253,7 +255,7 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="工程名称" prop="proName">
<el-input v-model="formPro.proName" placeholder="请输入工程名称" />
<el-input v-model="formPro.proName" placeholder="请输入工程名称" maxlength="20"/>
</el-form-item>
</el-col>
@ -402,7 +404,7 @@
</template>
<script>
import { listEngineering,getGtInfo,editGt,addGt,getGtId,delGt,exportGt,gtFile, getEngineeringInfo, editPro,addPro, exportEngineering,delPro} from "@/api/base/engineering";
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'
@ -430,9 +432,19 @@
single: true,
//
multiple: true,
//
idsGt: [],
//
singleGt: true,
//
multipleGt: true,
//
showSearch: true,
showGt:false,
maxLength:100,//
currentSelection:[],//
currentSelectionGt:[],//
//
total: 0,
//
@ -570,6 +582,90 @@
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
//
// tableDatavalcurrentSelection
// tableDatavalcurrentSelection
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
//
// tableDatavalcurrentSelection
// tableDatavalcurrentSelection
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(){
@ -577,13 +673,26 @@
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()
}
});
},
@ -603,6 +712,19 @@
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()
}
});
},
@ -665,19 +787,33 @@
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.deviceCode)
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();
@ -782,7 +918,10 @@
const proIdTemp = row.proId;
console.log(proIdTemp)
if(row.gtNum>0){
this.$modal.msgWarning("该工程存在杆塔,无法删除");
this.$alert('该工程存在杆塔,无法删除', '提示', {
type: 'warning',
confirmButtonText: '确定',
});
return;
}
this.$modal.confirm('是否确认删除工程名称为"' + row.proName + '"的数据项?').then(function() {
@ -794,16 +933,31 @@
},
/** 工程导出按钮操作 */
handleExport() {
exportEngineering(this.queryParams).then(res => {
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() {
exportGt(this.queryGt).then(res => {
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' })
})
}
},
//

View File

@ -33,18 +33,7 @@
size="mini"
@click="handleAdd"
v-hasPermi="['bracelet:project:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['bracelet:project:remove']"
>删除</el-button>
>新增项目部</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -59,7 +48,7 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="projectList" ref="multipleTable" row-key="projectId" @selection-change="handleSelectionChange" @select="handlerSelect" @select-all="handlerSelectAll">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
@ -170,7 +159,7 @@
</template>
<script>
import { listProject, getProject, delProject, addProject, updateProject,exportProject } from "@/api/base/project";
import { listProject, getProject, delProject, addProject, updateProject,exportProject,exportProjectSome } from "@/api/base/project";
import { downloadFile } from '@/utils/download'
export default {
name: "Project",
@ -188,7 +177,8 @@ export default {
// Id
showName: false,
maxLength:100,//
currentSelection:[],//
//
showSearch: true,
//
@ -251,15 +241,69 @@ export default {
},
},
methods: {
/** 查询岗位列表 */
getList() {
this.loading = true;
listProject(this.queryParams).then(response => {
this.projectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//-
handlerSelect(val, row) {
this.currentSelection.indexOf(row.projectId) === -1
? this.currentSelection.push(row.projectId)
: this.currentSelection.splice(this.currentSelection.indexOf(row.projectId), 1)
},
//-
handlerSelectAll(val) {
if (val.length) {
// :
// 1 2
//
// projectListvalcurrentSelection
// projectListvalcurrentSelection
const isAllSelect = this.projectList.every(item =>
val.some(valItem => valItem.projectId === item.projectId)
)
if (isAllSelect) {
//
const diff = val.filter(
item => !this.currentSelection.some(projectId => projectId === item.projectId)
)
if (this.currentSelection.length + diff.length > this.maxLength) {
this.currentSelection = this.currentSelection.concat(
diff.splice(0, this.maxLength - this.currentSelection.length)
.map(item => item.projectId))
diff.forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
} else {
this.currentSelection = this.currentSelection.concat(diff.map(item => item.projectId))
}
} else {
this.currentSelection = this.currentSelection.filter(
projectId => !this.projectList.some(item => item.projectId === projectId)
)
}
} else {
// :
//
this.currentSelection = []
}
},
/** 查询岗位列表 */
getList() {
this.loading = true;
listProject(this.queryParams).then(response => {
this.projectList = response.rows;
this.total = response.total;
this.loading = false;
if (this.currentSelection.length) {
this.$nextTick(() => {
this.currentSelection.forEach(row => {
this.projectList.forEach(item => {
if (item.projectId === row) {
this.$refs.multipleTable?.toggleRowSelection(item, true)
}
})
})
})
} else {
this.$refs.multipleTable?.clearSelection()
}
});
},
//
cancel() {
this.open = false;
@ -286,6 +330,7 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.currentSelection = []//
this.handleQuery();
},
//
@ -319,8 +364,6 @@ export default {
this.title = "修改项目";
});
},
//
handleChange(file, fileList) {
@ -409,6 +452,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const projectId = row.projectId || this.ids;
if(row.appnum>0){
this.$alert('该项目部存在APP轮播图无法删除', '提示', {
type: 'warning',
confirmButtonText: '确定',
});
return;
}
this.$modal.confirm('是否确认删除项目名称为"' + projectId + '"的数据项?').then(function() {
return delProject(projectId);
}).then(() => {
@ -418,12 +468,17 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
exportProject(this.queryParams).then(res => {
if(this.ids.length == 0){
exportProject(this.queryParams).then(res => {
downloadFile({ fileName: `项目部管理表_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
// this.download('bracelet/project/export', {
// ...this.queryParams
// }, `_${new Date().getTime()}.xlsx`)
}else{
const ids = this.ids.join(',')
exportProjectSome({ids:ids}).then(res => {
downloadFile({ fileName: `项目部管理表_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
}
}
}
};

View File

@ -57,7 +57,8 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="constructionList" >
<el-table v-loading="loading" :data="constructionList" ref="multipleTable" row-key="teamId" @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>
@ -268,7 +269,7 @@
</template>
<script>
import { listConstruction,listTeam,listTeamTemp,listWarn,exportConstructionRecord } from "@/api/comprehensive/constructionRecord";
import { listConstruction,listTeam,listTeamTemp,listWarn,exportConstructionRecord,exportConstructionRecordSome } from "@/api/comprehensive/constructionRecord";
import { downloadFile } from '@/utils/download'
export default {
name: "Post",
@ -288,6 +289,13 @@ export default {
//
showWarn: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
dialogImageUrl: '',
dialogVisible: false,
@ -301,7 +309,8 @@ export default {
totalTwo : 0,
//
constructionList: [],
maxLength:100,//
currentSelection:[],//
//
teamList: [],
teamTempList: [],
@ -348,7 +357,47 @@ export default {
this.getList();
},
methods: {
//-
handlerSelect(val, row) {
this.currentSelection.indexOf(row.teamId) === -1
? this.currentSelection.push(row.teamId)
: this.currentSelection.splice(this.currentSelection.indexOf(row.teamId), 1)
},
//-
handlerSelectAll(val) {
if (val.length) {
// :
// 1 2
//
// constructionListvalcurrentSelection
// constructionListvalcurrentSelection
const isAllSelect = this.constructionList.every(item =>
val.some(valItem => valItem.teamId === item.teamId)
)
if (isAllSelect) {
//
const diff = val.filter(
item => !this.currentSelection.some(teamId => teamId === item.teamId)
)
if (this.currentSelection.length + diff.length > this.maxLength) {
this.currentSelection = this.currentSelection.concat(
diff.splice(0, this.maxLength - this.currentSelection.length)
.map(item => item.teamId))
diff.forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
} else {
this.currentSelection = this.currentSelection.concat(diff.map(item => item.teamId))
}
} else {
this.currentSelection = this.currentSelection.filter(
teamId => !this.constructionList.some(item => item.teamId === teamId)
)
}
} else {
// :
//
this.currentSelection = []
}
},
//-
openImg(url) {
this.dialogImageUrl = url
@ -362,6 +411,19 @@ export default {
this.constructionList = response.rows;
this.total = response.total;
this.loading = false;
if (this.currentSelection.length) {
this.$nextTick(() => {
this.currentSelection.forEach(row => {
this.constructionList.forEach(item => {
if (item.teamId === row) {
this.$refs.multipleTable?.toggleRowSelection(item, true)
}
})
})
})
} else {
this.$refs.multipleTable?.clearSelection()
}
});
},
@ -435,6 +497,13 @@ export default {
this.showWarn = true;
this.getListWarn();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.teamId)
this.single = selection.length!=1
this.multiple = !selection.length
},
//
// cancel() {
// this.open = false;
@ -460,6 +529,7 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.currentSelection = [];
this.handleQuery();
},
@ -477,9 +547,16 @@ export default {
/** 导出按钮操作 */
handleExport() {
exportConstructionRecord(this.queryParams).then(res => {
if(this.ids.length == 0){
exportConstructionRecord(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(',')
exportConstructionRecordSome({ids:ids}).then(res => {
downloadFile({ fileName: `施工记录_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
}
}
}
};

View File

@ -95,7 +95,8 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableData">
<el-table v-loading="loading" :data="tableData" >
<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>
@ -152,14 +153,9 @@ export default {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
@ -169,7 +165,7 @@ export default {
shxName:"shx",
//
open: false,
idLists: [],
//
queryParams: {
pageNum: 1,
@ -188,7 +184,6 @@ export default {
};
},
computed: {
},
created() {
this.getList();
@ -230,14 +225,7 @@ export default {
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.deviceCode)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 导出按钮操作 */
handleExport() {
exportDeviceLyRecord(this.queryParams).then(res => {