index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <div class="report-index">
  3. <div class="statistics">
  4. <div class="building">
  5. <p>建筑模型文件夹:<b>{{ModelFileCount}}</b></p>
  6. </div>
  7. <div class="includefloor">
  8. <p>包含楼层模型文件:<b>{{modelFloorCount}}</b></p>
  9. </div>
  10. <div class="problematic">
  11. <p>检查出问题的楼层模型文件:<b>{{problemCount}}</b></p>
  12. </div>
  13. </div>
  14. <div class="main-content">
  15. <div class="tab-box">
  16. <el-tabs v-model="activeTab" type='card' @tab-click="getData">
  17. <template v-for="(item,index) in tableList">
  18. <el-tab-pane :name="item.Code" :key="index" :label="item.Name">
  19. <span slot="label">
  20. <i :class="item.flag?'msg-icon el-icon-success success-color':'msg-icon el-icon-error error-color'" style="font-size:14px;"></i>
  21. <span>{{ item.Name }}</span>
  22. </span>
  23. </el-tab-pane>
  24. </template>
  25. </el-tabs>
  26. </div>
  27. <div class="content-box">
  28. <div class="button">
  29. <el-button @click="del" :plain="toBeDelCount?false:true" :disabled="toBeDelCount?false:true">需从模型中删除的设备</el-button>
  30. <el-button @click="supplement" :plain="toBeSuppCount?false:true" :disabled="toBeSuppCount?false:true">模型待补充的设备</el-button>
  31. <el-button type="info" :loading="load" @click='getExportReport'>导出模型问题报告</el-button>
  32. </div>
  33. <div class="table"
  34. :style="tableList&&tableList.length?'width: 100%;height: calc(100% - 47px)':'width: 100%;height: calc(100% - 10px)'">
  35. <el-table
  36. ref="multipleTable"
  37. :data="tableData"
  38. stripe
  39. height="100%"
  40. :header-cell-style="headerStyle"
  41. v-loading='loading'
  42. :row-class-name="tableRowClassName"
  43. :cell-style="cellStyle"
  44. >
  45. <el-table-column prop="FloorName" label="模型楼层" fixed width="150"></el-table-column>
  46. <el-table-column prop="functionNo" label="待删除设备数量" fixed width="150">
  47. <template slot-scope="scope">
  48. <el-badge :value="scope.row.toBeDel" class="item" :type='scope.row.toBeDel?"danger":"success"'>
  49. </el-badge>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="toBeSupplement" label="待补充设备数量" fixed width="150">
  53. <template slot-scope="scope">
  54. <el-badge :value="scope.row.toBeSupplement" class="item"
  55. :type='scope.row.toBeSupplement?"danger":"success"'>
  56. </el-badge>
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="questionItem" label="有问题的检查项" fixed width="150" style="border-right:1px solid red">
  60. <template slot-scope="scope">
  61. <el-badge :value="scope.row.questionItem" class="item" :type='scope.row.questionItem?"warning":"success"'>
  62. </el-badge>
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="ElementRangeCheck" label='构件范围检查' width="200">
  66. <template slot-scope="scope">
  67. <el-badge :value="scope.row.ElementRangeCheck" class="item" type='danger'
  68. v-if="scope.row.ElementRangeCheck"/>
  69. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  70. v-if="scope.row.ElementRangeCheck<=0"></i>
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="FamilyNameCheck" label='设备族编码检查' width="200">
  74. <template slot-scope="scope">
  75. <el-badge :value="scope.row.FamilyNameCheck" class="item" type='danger'
  76. v-if="scope.row.FamilyNameCheck"/>
  77. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  78. v-if="scope.row.FamilyNameCheck<=0"></i>
  79. </template>
  80. </el-table-column>
  81. <el-table-column prop="EquipPartLocationCheck" label='部件所在位置检查' width="200">
  82. <template slot-scope="scope">
  83. <el-badge :value="scope.row.EquipPartLocationCheck" class="item" type='danger'
  84. v-if="scope.row.EquipPartLocationCheck"/>
  85. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  86. v-if="scope.row.EquipPartLocationCheck<=0"></i>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="ColumnCheck" label='柱边界检查' width="200">
  90. <template slot-scope="scope">
  91. <el-badge :value="scope.row.ColumnCheck" class="item" type='danger' v-if="scope.row.ColumnCheck"/>
  92. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  93. v-if="scope.row.ColumnCheck<=0"></i>
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="ConnectorCheck" label='连接件检查' width="200">
  97. <template slot-scope="scope">
  98. <el-badge :value="scope.row.ConnectorCheck" class="item" type='danger' v-if="scope.row.ConnectorCheck"/>
  99. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  100. v-if="scope.row.ConnectorCheck<=0"></i>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="SystemNameCheck" label='系统类型名称检查' width="200">
  104. <template slot-scope="scope">
  105. <el-badge :value="scope.row.SystemNameCheck" class="item" type='danger'
  106. v-if="scope.row.SystemNameCheck"/>
  107. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  108. v-if="scope.row.SystemNameCheck<=0"></i>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="EquipInSpaceCheck" label='未在空间中的设备' width="200">
  112. <template slot-scope="scope">
  113. <el-badge :value="scope.row.EquipInSpaceCheck" class="item" type='danger'
  114. v-if="scope.row.EquipInSpaceCheck"/>
  115. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  116. v-if="scope.row.EquipInSpaceCheck<=0"></i>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="PipeCheck" label='管段检查' width="200">
  120. <template slot-scope="scope">
  121. <el-badge :value="scope.row.PipeCheck" class="item" type='danger' v-if="scope.row.PipeCheck"/>
  122. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  123. v-if="scope.row.PipeCheck<=0"></i>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="SystemReferEquipCheck" label='管网及相关设备检查' width="200">
  127. <template slot-scope="scope">
  128. <el-badge :type='scope.row.SystemReferEquipCheck?"danger":"success"' :value="scope.row.SystemReferEquipCheck"
  129. class="item"
  130. v-if="scope.row.SystemReferEquipCheck"/>
  131. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  132. v-if="scope.row.SystemReferEquipCheck<=0"></i>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="ParameterIntegrityCheck" label='Revit族参数完整性检查' width="200">
  136. <template slot-scope="scope">
  137. <el-badge :value="scope.row.ParameterIntegrityCheck" class="item" type='danger'
  138. v-if="scope.row.ParameterIntegrityCheck"/>
  139. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  140. v-if="scope.row.ParameterIntegrityCheck<=0"></i>
  141. </template>
  142. </el-table-column>
  143. <el-table-column prop="XyzOverlapCheck" label='xyz坐标重叠检查' width="200">
  144. <template slot-scope="scope">
  145. <el-badge :value="scope.row.XyzOverlapCheck" class="item" type='danger'
  146. v-if="scope.row.XyzOverlapCheck"/>
  147. <i class="msg-icon el-icon-success success-color1" style="font-size:20px;"
  148. v-if="scope.row.XyzOverlapCheck<=0"></i>
  149. </template>
  150. </el-table-column>
  151. <template slot="empty">
  152. <div style="height: 60%;transform: translate(-40%,50%);">
  153. <i class="icon-wushuju iconfont"></i>
  154. 数据暂无
  155. </div>
  156. </template>
  157. </el-table>
  158. <el-pagination class="right" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNumber"
  159. :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total">
  160. </el-pagination>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. </template>
  166. <script>
  167. import {mapGetters} from "vuex";
  168. import dasBoard from "@/views/dasboard/index";
  169. import {queryFloorList, queryLostReportList, queryModel, queryReportList} from "@/api/model/report.js";
  170. import {getSupplement, getToBeDelEquip} from "@/api/scan/request.js";
  171. import axios from 'axios'
  172. export default {
  173. components: {
  174. dasBoard
  175. },
  176. data() {
  177. return {
  178. params: null,
  179. ModelFileCount: null,// 模型文件夹数量
  180. modelFloorCount: null,// 包含楼层模型文件数量
  181. problemCount: 0,// 检查出问题的楼层模型文件数量
  182. tableList: [], // tab数据
  183. tableData: [],// 列表数据
  184. activeTab: '', // tab当前选中项
  185. headerStyle: { // 列表样式
  186. backgroundColor: '#e1e4e5',
  187. color: '#2b2b2b',
  188. lineHeight: '30px'
  189. },
  190. page: {
  191. pageSize: 50,
  192. pageSizes: [10, 20, 50, 100],
  193. pageNumber: 1,
  194. total: 0
  195. },
  196. loading: false,
  197. load: false,
  198. floorIconType: null,
  199. toBeSuppCount: 0,
  200. toBeDelCount: 0
  201. }
  202. },
  203. mounted() { },
  204. created() {
  205. this.params = {
  206. Orders: "Name asc"
  207. }
  208. this.getModelFileCount();
  209. this.getModelFloorCount();
  210. },
  211. computed: {
  212. ...mapGetters('layout', ['projectId'])
  213. },
  214. methods: {
  215. cellStyle({row, column, rowIndex, columnIndex}) {
  216. console.log(row, column.label, '=====')
  217. if (column.label !== '模型楼层' && column.label !== '待删除设备数量' && column.label !== '待补充设备数量' && column.label !== '有问题的检查项') {
  218. return {
  219. background: '#f3f3f3',
  220. lineHeight: '30px'
  221. }
  222. }
  223. },
  224. getModelFloorCount() {// 获取楼层模型文件数量,计算出检查出问题的模型文件
  225. let promise1 = new Promise(resolve => {
  226. queryFloorList({Filters:"Status=4"}, res => {
  227. resolve(res);
  228. })
  229. })
  230. Promise.all([promise1]).then(response => {
  231. this.problemCount = 0;
  232. let res = response[0];
  233. this.modelFloorCount = res.Total;
  234. this.modelFloor = res.Content;
  235. this.getModelFileIcon();
  236. this.modelFloor.forEach(item => {
  237. if (!item.DataCheckResult) {
  238. this.problemCount++;
  239. }
  240. })
  241. })
  242. },
  243. getModelFileIcon() {// 计算文件夹的图标
  244. this.tableList.forEach(item => {
  245. this.modelFloor.forEach(it => {
  246. if (item.Code === it.FolderId) {
  247. if (!item.DataCheckResult) {
  248. item.flag = false;
  249. }
  250. }
  251. })
  252. })
  253. },
  254. getData(tab) {// 切换tab时执行
  255. this.getModelFloor();
  256. },
  257. getModelFileCount() {// 获取项目下所有模型文件夹
  258. queryModel(this.params, res => {
  259. this.ModelFileCount = res.Content.length;
  260. this.tableList = res.Content;
  261. if (this.tableList && this.tableList.length) {
  262. this.tableList.forEach((item, index) => {
  263. item.Code = item.Id;
  264. })
  265. this.activeTab = this.tableList[0].Code;// 默认选中第一个模型文件夹
  266. }
  267. this.getModelFloor();
  268. });
  269. },
  270. getModelFloor() {// 获取当前楼层下的模型楼层和各个检查项的数据
  271. let params = {
  272. ProjectId: this.projectId,
  273. Id: `${this.activeTab}`,
  274. PageNumber: this.page.pageNumber,
  275. PageSize: this.page.pageSize
  276. }
  277. queryReportList(params, res => {
  278. this.FloorName = res.Content;
  279. this.tableData = [];
  280. if (this.FloorName && this.FloorName.length) {
  281. this.loading = true;
  282. let i = 0;
  283. this.FloorName.forEach(item => {
  284. item.questionItem = 0;
  285. for (let key in item) {
  286. if (item[key] > 0 && key !== "FloorName" && key !== "questionItem") {
  287. i += 1;
  288. item.questionItem += 1;
  289. }
  290. }
  291. })
  292. this.floorIconType = i;
  293. }
  294. this.getLostModelFloor();
  295. })
  296. },
  297. getLostModelFloor() {// 获取缺失楼层
  298. let params = {
  299. ProjectId: this.projectId,
  300. Filters: `FolderId='${this.activeTab}';Status=4`
  301. }
  302. queryLostReportList(params, res => {
  303. this.LostFloorName = res.Content;
  304. this.getToBeCount();
  305. })
  306. },
  307. getToBeCount() {// 根据模型ID获取待删除数量和待补充数量
  308. let equipComDelList = [];
  309. this.equipComDelList = [];
  310. this.LostFloorName.forEach(item => {
  311. if (item.CurrentModelId) {
  312. equipComDelList.push({
  313. ModelId: item.CurrentModelId
  314. });
  315. this.equipComDelList.push(item.CurrentModelId)
  316. } else {
  317. item.flag = 'lost';
  318. item.FloorName = `${item.Note + item.FloorName}`
  319. }
  320. })
  321. let params = {
  322. ProjectId: this.projectId,
  323. data: equipComDelList
  324. }
  325. let promise1 = new Promise(resolve => {
  326. getToBeDelEquip(params, res => {
  327. resolve(res);
  328. })
  329. })
  330. let promise2 = new Promise(resolve => {
  331. getSupplement(params, res => {
  332. resolve(res);
  333. })
  334. })
  335. Promise.all([promise1, promise2]).then(response => {
  336. let res = response[0];
  337. let res1 = response[1];
  338. this.toBeDelCount = 0;
  339. this.toBeSuppCount = 0;
  340. res.Content.forEach(item => {
  341. if (item.Count > 0) {
  342. this.toBeDelCount += 1;
  343. }
  344. this.LostFloorName.forEach(it => {
  345. if (item.ModelId === it.CurrentModelId) {
  346. it.toBeDel = item.Count;
  347. }
  348. })
  349. })
  350. res1.Content.forEach(item => {
  351. if (item.Count > 0) {
  352. this.toBeSuppCount += 1;
  353. }
  354. this.LostFloorName.forEach(it => {
  355. if (item.ModelId === it.CurrentModelId) {
  356. it.toBeSupplement = item.Count;
  357. }
  358. })
  359. })
  360. if (this.LostFloorName && this.LostFloorName.length) {
  361. this.LostFloorName.forEach(item => {
  362. this.FloorName.forEach(it => {
  363. if (item.FloorName === it.FloorName) {
  364. for (let key in it) {
  365. item[key] = it[key];
  366. }
  367. }
  368. })
  369. })
  370. this.tableData = this.LostFloorName;
  371. } else {
  372. this.tableData = [];
  373. }
  374. this.page.total = this.tableData.length;
  375. this.loading = false;
  376. })
  377. },
  378. del() {// 点击需从模型中删除的设备
  379. let equipComDelList = encodeURIComponent(JSON.stringify(this.equipComDelList));
  380. let jumpRouter = this.$router.resolve({ path: '/model/report/deleted', query: { equipComDelList: equipComDelList } })
  381. window.open(jumpRouter.href, '_blank')
  382. },
  383. supplement() {// 点击模型待补充的设备
  384. let equipComDelList = encodeURIComponent(JSON.stringify(this.equipComDelList));
  385. let jumpRouter = this.$router.resolve({ path: '/model/report/supplement', query: { equipComDelList: equipComDelList } })
  386. window.open(jumpRouter.href, '_blank')
  387. },
  388. getExportReport() {// 导出模型问题报告
  389. let that = this;
  390. this.load = true;
  391. axios({
  392. method: 'post',
  393. url: `/modelapi/report/non-blocking`,
  394. data: {
  395. Id: this.activeTab,
  396. ProjectId: this.projectId
  397. },
  398. headers: {
  399. ProjectId: this.projectId
  400. },
  401. responseType: 'blob'
  402. }).then(function (res) {
  403. if (res.data.type == 'application/vnd.ms-excel') {
  404. let blob = new Blob([res.data], { type: 'application/vnd.ms-excel;charset=utf-8' });
  405. let fileName = decodeURI(res.headers['content-disposition']);
  406. if (fileName)
  407. fileName = fileName.substring(fileName.indexOf('=') + 1);
  408. if ('download' in document.createElement('a')) { // 非IE下载
  409. const elink = document.createElement('a')
  410. elink.download = fileName
  411. elink.style.display = 'none'
  412. elink.href = URL.createObjectURL(blob)
  413. document.body.appendChild(elink)
  414. elink.click()
  415. URL.revokeObjectURL(elink.href) // 释放URL 对象
  416. document.body.removeChild(elink)
  417. that.load = false;
  418. } else { // IE10+下载
  419. navigator.msSaveBlob(blob, fileName)
  420. that.load = false;
  421. }
  422. } else {
  423. let reader = new FileReader()
  424. reader.onload = e => {
  425. if (e.target.readyState === 2) {
  426. let res = {}
  427. that.load = false;
  428. res = JSON.parse(e.target.result)
  429. that.$message.error(res.Message);
  430. }
  431. }
  432. reader.readAsText(res.data)
  433. }
  434. })
  435. },
  436. tableRowClassName({ row, rowIndex, column }) {// 设置缺失楼层所在行的背景色
  437. if (row.flag && row.flag === 'lost') {
  438. return 'warning-row';
  439. }
  440. },
  441. handleSizeChange(val) {// 切换每页显示数量
  442. this.page.pageSize = val;
  443. this.getModelFloor();
  444. },
  445. handleCurrentChange(val) {// 切换页码
  446. this.page.pageNumber = val;
  447. this.getModelFloor();
  448. }
  449. },
  450. watch: {
  451. projectId() {
  452. this.getModelFileCount();
  453. this.getModelFloorCount();
  454. }
  455. }
  456. }
  457. </script>
  458. <style lang="less" scoped>
  459. .report-index {
  460. .statistics {
  461. display: flex;
  462. width: 100%;
  463. padding: 20px 0;
  464. background: white;
  465. margin-bottom: 10px;
  466. div {
  467. flex: 1;
  468. text-align: center;
  469. p {
  470. b {
  471. font-size: 20px;
  472. margin-left: 20px;
  473. }
  474. }
  475. }
  476. }
  477. .main-content {
  478. width: 100%;
  479. height: calc(100% - 90px);
  480. background: white;
  481. .content-box {
  482. height: calc(100% - 105px);
  483. .table {
  484. margin-top: 15px;
  485. }
  486. }
  487. }
  488. .button {
  489. padding-left: 10px;
  490. button {
  491. border: 1px solid #dcdfe6;
  492. color: #606266;
  493. background: white;
  494. }
  495. }
  496. .success-color {
  497. color: #67c23a;
  498. }
  499. .error-color {
  500. color: #f56c6c;
  501. }
  502. .success-color1 {
  503. color: #67c23a60;
  504. }
  505. .error-color1 {
  506. color: #f56c6c60;
  507. }
  508. /deep/ .el-table_1_column_4 {
  509. border-right: 1px solid #e2e2e2 !important;
  510. }
  511. /deep/ .el-table {
  512. .el-table__fixed {
  513. height: auto !important;
  514. bottom: 17px;
  515. }
  516. }
  517. /deep/ .el-table__row.warning-row {
  518. td {
  519. background: #f9f9f9 !important;
  520. }
  521. }
  522. /deep/ .el-badge__content--danger {
  523. background-color: #F56C6C60;
  524. }
  525. }
  526. </style>