123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <template>
- <div>
- <el-row style="margin-top: 30px;">
- <span>请选择要导出的数据:</span>
- <el-select v-model="value" placeholder="请选择">
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
- </el-select>
- <el-button @click="handleClickDownload" type="primary" :loading="loading" style="margin-left: 15px;">导出Excel</el-button>
- </el-row>
- <div style="text-align:center;font-size:25px;margin-top:20%;">当前页面中的为临时功能,完整版正在设计中……</div>
- </div>
- </template>
- <script>
- import jsontoExcel from "@/utils/JOSNToExcel"
- import { State, Family } from "@/data/mapTable"
- import { queryEquip, queryProperty } from "@/api/scan/request"
- import { mapGetters, mapActions } from "vuex"
- export default {
- data() {
- return {
- loading: false,
- value: '',
- dataList: [],
- options: [{
- value: 'header1',
- label: '已建立关联的设备资产'
- }, {
- value: 'header2',
- label: '未关联资产的设备'
- }, {
- value: 'header3',
- label: '未关联设备的资产'
- }],
- header1: [{
- fieldName: "Building.BuildLocalName",
- headerName: "建筑"
- }, {
- fieldName: "Floor.FloorLocalName",
- headerName: "楼层"
- }, {
- fieldName: "EquipCategory.EquipName",
- headerName: "设备类"
- }, {
- fieldName: "EquipLocalName",
- headerName: "设备本地名称"
- }, {
- fieldName: "EquipLocalID",
- headerName: "设备本地编码"
- }, {
- fieldName: "EquipID",
- headerName: "设备id"
- }, {
- fieldName: "BIMID",
- headerName: "设备BIMID"
- }, {
- fieldName: "Property.EquipFamilyList.0.FamilyName",
- headerName: "资产设备族"
- }, {
- fieldName: "Property.EquipLocalName",
- headerName: "资产本地名称"
- }, {
- fieldName: "Property.EquipLocalID",
- headerName: "资产本地编码"
- }, {
- fieldName: "Property.EquipID",
- headerName: "资产id"
- }, {
- fieldName: "Property.CreateTime",
- headerName: "资产创建时间"
- }, {
- fieldName: "Property.CodeType",
- headerName: "资产现场验证状态"
- }, {
- fieldName: "LedgerParam.Siteinstall.InstallLocation",
- headerName: "安装位置"
- }],
- header2: [{
- fieldName: "Building.BuildLocalName",
- headerName: "建筑"
- }, {
- fieldName: "Floor.FloorLocalName",
- headerName: "楼层"
- }, {
- fieldName: "EquipCategory.EquipName",
- headerName: "设备类"
- }, {
- fieldName: "EquipLocalName",
- headerName: "设备本地名称"
- }, {
- fieldName: "EquipLocalID",
- headerName: "设备本地编码"
- }, {
- fieldName: "EquipID",
- headerName: "设备id"
- }, {
- fieldName: "BIMID",
- headerName: "设备BIMID"
- }, {
- fieldName: "Property.EquipFamilyList.0.FamilyName",
- headerName: "资产设备族"
- }, {
- fieldName: "Property.EquipLocalName",
- headerName: "资产本地名称"
- }, {
- fieldName: "Property.EquipLocalID",
- headerName: "资产本地编码"
- }, {
- fieldName: "Property.EquipID",
- headerName: "资产id"
- }, {
- fieldName: "Property.CreateTime",
- headerName: "资产创建时间"
- }, {
- fieldName: "Property.CodeType",
- headerName: "资产现场验证状态"
- }, {
- fieldName: "LedgerParam.Siteinstall.InstallLocation",
- headerName: "安装位置"
- }],
- header3: [{
- fieldName: "Building.BuildLocalName",
- headerName: "建筑"
- }, {
- fieldName: "Floor.FloorLocalName",
- headerName: "楼层"
- }, {
- fieldName: "Equipment.EquipCategory.EquipName",
- headerName: "设备类"
- }, {
- fieldName: "Equipment.EquipLocalName",
- headerName: "设备本地名称"
- }, {
- fieldName: "Equipment.EquipLocalID",
- headerName: "设备本地编码"
- }, {
- fieldName: "Equipment.EquipID",
- headerName: "设备id"
- }, {
- fieldName: "Equipment.BIMID",
- headerName: "设备BIMID"
- }, {
- fieldName: "EquipFamilyList.0.FamilyName",
- headerName: "资产设备族"
- }, {
- fieldName: "EquipLocalName",
- headerName: "资产本地名称"
- }, {
- fieldName: "EquipLocalID",
- headerName: "资产本地编码"
- }, {
- fieldName: "EquipID",
- headerName: "资产id"
- }, {
- fieldName: "CreateTime",
- headerName: "资产创建时间"
- }, {
- fieldName: "CodeType",
- headerName: "资产现场验证状态"
- }, {
- fieldName: "LedgerParam.Siteinstall.InstallLocation",
- headerName: "安装位置"
- }]
- }
- },
- methods: {
- handleClickDownload() {
- this.loading = true
- this.dataList = []
- if (this.value == 'header1') {
- this.getheader1Data()
- } else if (this.value == 'header2') {
- this.getheader2Data()
- } else if (this.value == 'header3') {
- this.getheader3Data()
- }
- },
- getheader1Data(pageNum) {
- pageNum = pageNum ? pageNum : 1
- let params = {
- Cascade: [
- {
- Name: "equipCategory",
- Projection: ["EquipCode", "EquipName"]
- },
- {
- Name: "property",
- Cascade: [
- {
- Name: "equipFamilyList",
- Projection: [ "Family", "FamilyName" ]
- }
- ],
- Projection: ["Family", "EquipLocalName", "EquipLocalID", "EquipID", "CodeType", "CreateTime"]
- },
- {
- Name: "building",
- Projection: ["BuildLocalName", "BuildName", "BuildID"]
- },
- {
- Name: "floor",
- Projection: ["FloorLocalName", "FloorName", "FloorID"]
- }
- ],
- Filters: " not propertyId isnull ",
- Orders: "CreateTime desc, EquipID asc",
- PageNumber: pageNum,
- PageSize: 1000,
- Projection: ["CreateTime", "BuildingId", "FloorId", "Category", "EquipLocalName", "EquipLocalID", "EquipID", "BIMID", "LedgerParam"]
- }
- queryEquip(params, res => {
- this.dataList = this.dataList.concat(res.Content.map((item) => {
- item.Property.CodeType = State[item.Property.CodeType]
- // item.Property.Family = Family[item.Property.Family]
- return item
- }))
- if (res.Total / (res.PageSize * res.PageNumber) > 1) {
- this.getheader1Data(res.PageNumber + 1)
- } else {
- let time = +new Date()
- this.loading = false
- jsontoExcel.downloadExl(this.header1, this.dataList, `已建立关联的资产设备-${time}`)
- }
- })
- },
- getheader2Data(pageNum) {
- pageNum = pageNum ? pageNum : 1
- let params = {
- Cascade: [
- {
- Name: "equipCategory",
- Projection: ["EquipCode", "EquipName"]
- },
- {
- Name: "building",
- Projection: ["BuildLocalName", "BuildName", "BuildID"]
- },
- {
- Name: "floor",
- Projection: ["FloorLocalName", "FloorName", "FloorID"]
- }
- ],
- Filters: " propertyId isnull ",
- Orders: "CreateTime desc, EquipID asc",
- PageNumber: pageNum,
- PageSize: 1000,
- Projection: ["CreateTime", "BuildingId", "FloorId", "Category", "EquipLocalName", "EquipLocalID", "EquipID", "BIMID", "LedgerParam"]
- }
- queryEquip(params, res => {
- this.dataList = this.dataList.concat(res.Content)
- if (res.Total / (res.PageSize * res.PageNumber) > 1) {
- this.getheader2Data(res.PageNumber + 1)
- } else {
- let time = +new Date()
- this.loading = false
- jsontoExcel.downloadExl(this.header2, this.dataList, `未关联资产的设备-${time}`)
- }
- })
- },
- getheader3Data(pageNum) {
- pageNum = pageNum ? pageNum : 1
- let params = {
- Cascade: [
- {
- Name: "equipFamilyList",
- Projection: [ "Family", "FamilyName" ]
- },
- {
- Name: "building",
- Projection: [ "BuildLocalName", "BuildName", "BuildID" ]
- },
- {
- Name: "floor",
- Projection: [ "FloorLocalName", "FloorName", "FloorID" ]
- }
- ],
- Filters: " EquipmentId isnull ",
- Orders: "CreateTime desc, EquipID asc",
- PageNumber: pageNum,
- PageSize: 1000,
- Projection: [ "BuildingId", "FloorId", "Family", "EquipLocalName", "EquipLocalID", "EquipID", "CreateTime", "CodeType", "LedgerParam"]
- }
- queryProperty(params, res => {
- this.dataList = this.dataList.concat(res.Content.map((item) => {
- item.CodeType = State[item.CodeType]
- return item
- }))
- if (res.Total / (res.PageSize * res.PageNumber) > 1) {
- this.getheader3Data(res.PageNumber + 1)
- } else {
- let time = +new Date()
- this.loading = false
- jsontoExcel.downloadExl(this.header3, this.dataList, `未关联设备的资产-${time}`)
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|