index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <div class="box">
  3. <div class="condition">
  4. <div class="header">
  5. <el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goBack"></el-button>
  6. <span>{{ params.Name }}</span>
  7. </div>
  8. <el-row class="spaceTypes">
  9. <div class="types">
  10. <el-tabs v-model="activeTab" type='card'>
  11. <template v-for="(item,index) in tabsList">
  12. <el-tab-pane :name="item.Code" :key="index" :label="item.Name"></el-tab-pane>
  13. </template>
  14. </el-tabs>
  15. </div>
  16. <div class="deleBtn">
  17. <el-button size="small" @click="deleteSystem">删除系统</el-button>
  18. </div>
  19. </el-row>
  20. <div v-if="activeTab=='detail'" class="content">
  21. <el-scrollbar style="height:100%;">
  22. <div class="content-scrollbar">
  23. <div class="content-left">
  24. <div class="content-showType">
  25. <selectRadio
  26. :selectRadio="selectRadio"
  27. @changeRadio="changeRadio"
  28. />
  29. </div>
  30. <div class="content-point">
  31. <div class="content-point-left">
  32. <exhibitionBaseInformation :exhibitionBaseInformation="exhibitionBaseInformation"/>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="content-right">
  37. <div class="content-repair">
  38. <exhibitionMaintain :exhibitionMaintain="exhibitionMaintain"/>
  39. </div>
  40. <div class="content-media">
  41. <exhibitionImage :exhibitionImage="exhibitionImage" v-show="isShowImage"/>
  42. <exhibitionVideo :exhibitionVideo="exhibitionVideo" v-show="isShowVideo"/>
  43. <exhibitionFile :exhibitionFile="exhibitionFile" v-show="isShowFile"/>
  44. </div>
  45. </div>
  46. </div>
  47. </el-scrollbar>
  48. </div>
  49. <!-- 系统内设备 -->
  50. <deviceTable v-if="activeTab=='Equipment'" :params="params" :type="activeTab"></deviceTable>
  51. <!-- 系统所在竖井 -->
  52. <cenoteTable v-else-if="activeTab=='cenote'" :params="params" :type="activeTab"></cenoteTable>
  53. <!-- 系统所在业务空间 -->
  54. <spaceTable v-else-if="activeTab=='space'" :params="params" :type="activeTab" :spaceType="spaceType"
  55. :floorType="floorType"></spaceTable>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { mapGetters } from "vuex";
  61. import {
  62. // buildingQuery,
  63. deleteGeneralSys,
  64. // getDataDictionary,
  65. queryDictionaryHead,
  66. queryLinkSys
  67. } from '@/api/scan/request';
  68. import { getDataDictionary, queryPhysicsAllType } from "@/api/dict";
  69. import { buildingQuery } from '@/api/object/build';
  70. import cenoteTable from '@/components/ledger/system/table/cenoteTable';
  71. import deviceTable from '@/components/ledger/system/table/deviceTable';
  72. import spaceTable from '@/components/ledger/system/table/spaceTable';
  73. import exhibitionBaseInformation from "@/components/ledger/details/detail/exhibitionBaseInformation";
  74. import exhibitionFile from "@/components/ledger/details/detail/exhibitionFile";
  75. import exhibitionImage from "@/components/ledger/details/detail/exhibitionImage";
  76. import selectRadio from "@/components/ledger/details/detail/selectRadio";
  77. import exhibitionMaintain from "@/components/ledger/details/detail/exhibitionMaintain";
  78. import exhibitionVideo from "@/components/ledger/details/detail/exhibitionVideo";
  79. import tools from "@/utils/scan/tools"
  80. export default {
  81. data() {
  82. return {
  83. params: {}, //参数-包含系统id 分区类型
  84. tabsList: [
  85. { Code: 'detail', Name: '系统详情' },
  86. { Code: 'Equipment', Name: '系统内设备' },
  87. { Code: 'cenote', Name: '系统所在竖井' },
  88. { Code: 'space', Name: '系统所在业务空间' },
  89. ], //tab页
  90. activeTab: 'detail', //当前选中的tab
  91. pointData: [], //信息点数据
  92. exampleData: {}, //实例数据
  93. spaceType: {},//空间种类
  94. floorType: {},
  95. currentRadio: '1',//当前选中的select
  96. selectRadio: {
  97. information: '设备信息点',
  98. initRadio: '1',
  99. radioList: [
  100. {
  101. value: '显示需采集信息点',
  102. label: '1'
  103. },
  104. {
  105. value: '显示有值信息点',
  106. label: '2'
  107. },
  108. {
  109. value: '显示全部信息点',
  110. label: '3'
  111. }
  112. ]
  113. },
  114. exhibitionBaseInformation: {
  115. information: {}
  116. },
  117. exhibitionEnergy: {
  118. title: '能耗信息',
  119. dynamic: [],
  120. },
  121. exhibitionMaintain: {
  122. title: '维修/维保记录'
  123. },
  124. exhibitionFile: {
  125. title: '文件',
  126. list: {}
  127. },
  128. exhibitionCrux: {
  129. title: '关键信息点:',
  130. cruxArray: [],
  131. allMessage: [],//全部信息点
  132. },
  133. exhibitionImage: {
  134. title: '图片',
  135. list: {},
  136. arr: []
  137. },
  138. exhibitionVideo: {
  139. title: '视频',
  140. list: {}
  141. },
  142. instance: {},//实例信息处理
  143. isShowImage: true,
  144. isShowVideo: true,
  145. isShowFile: true,
  146. }
  147. },
  148. computed: {
  149. ...mapGetters("layout", ["projectId", "userId", "secret"])
  150. },
  151. components: {
  152. cenoteTable,
  153. deviceTable,
  154. spaceTable,
  155. exhibitionBaseInformation,
  156. exhibitionFile,
  157. exhibitionImage,
  158. selectRadio,
  159. exhibitionMaintain,
  160. exhibitionVideo
  161. },
  162. created() {
  163. this.params = this.$route.query;
  164. this.getData();
  165. let pa = {
  166. type: `space`
  167. }
  168. // queryDictionaryHead(pa, res => {
  169. queryPhysicsAllType(pa, res => {
  170. res.content.map(t => {
  171. if (t.name != "元空间") {
  172. this.spaceType[t.code] = t.name;
  173. }
  174. })
  175. });
  176. let param = {
  177. cascade: [
  178. { name: "floor" }
  179. ]
  180. };
  181. buildingQuery(param, res => {
  182. res.content.map(item => {
  183. if (item.id && item.localName) {
  184. this.floorType[item.id] = item.localName;
  185. if (item.floor instanceof Array) {
  186. item.floor.map(f => {
  187. if (f.id && f.localName) {
  188. this.floorType[f.id] = f.localName;
  189. }
  190. })
  191. }
  192. }
  193. });
  194. });
  195. },
  196. mounted() {
  197. },
  198. watch: {
  199. projectId() {
  200. }
  201. },
  202. methods: {
  203. // 返回
  204. goBack() {
  205. this.$router.push({
  206. name: "systemlist",
  207. params: this.params
  208. })
  209. },
  210. // 获取表头和实例数据
  211. getData() {
  212. let params1 = {
  213. orders: "sort asc",
  214. pageNumber: 1,
  215. pageSize: 1000,
  216. type: this.params.SysType
  217. }, params2 = {
  218. filters: `id='${this.params.SysID}'`,
  219. };
  220. let promise1 = new Promise((resolve, reject) => {
  221. getDataDictionary(params1, res => {
  222. resolve(res)
  223. })
  224. })
  225. let promise2 = new Promise((resolve, reject) => {
  226. queryLinkSys(params2, res => {
  227. resolve(res)
  228. })
  229. })
  230. Promise.all([promise1, promise2]).then(values => {
  231. this.pointData = values[0].content;
  232. this.exampleData = values[1].content[0];
  233. let obj = this.deepCopy(values[1].content[0]);
  234. obj = tools.flattenKeys(obj);
  235. for (let key in obj) {
  236. if (Array.isArray(obj[key]) && !obj[key].length) {
  237. delete obj[key]
  238. }
  239. }
  240. this.instance = obj;
  241. this.handleRadios(this.currentRadio)
  242. this.handleEnclosure() //处理图片视频文件信息
  243. })
  244. },
  245. deepCopy(obj) {
  246. return JSON.parse(JSON.stringify(obj))
  247. },
  248. handleEnclosure() {
  249. //图片文件处理,脱离radio控制
  250. let isList = this.pointData
  251. let isArr = []
  252. isList.map(j => {
  253. if (this.instance.hasOwnProperty(j.path)) {
  254. j.value = this.instance[j.path]
  255. return j
  256. }
  257. })
  258. isArr = isList.filter(k => k.value)
  259. this.handlePicList(isArr)
  260. this.handleFileList(isArr)
  261. },
  262. handleRadios(val) { //判断radio的值显示关键信息,基本信息,图片,文件
  263. let arr = []
  264. if (val == 1) { //需采集信息
  265. arr = this.pointData.filter(i => i.visible)
  266. // 图片和的处理
  267. // this.handlePicList(arr)
  268. // // 文件处理
  269. // this.handleFileList(arr)
  270. } else if (val == 2) { //有值信息点
  271. let list = this.pointData
  272. list.map(j => {
  273. if (this.instance.hasOwnProperty(j.path)) {
  274. return {
  275. ...j,
  276. value: this.instance[j.path]
  277. }
  278. }
  279. arr = list.filter(k => k.value)
  280. // this.handlePicList(arr)
  281. // this.handleFileList(arr)
  282. })
  283. } else { //全部信息点
  284. arr = this.pointData
  285. // this.handlePicList(arr)
  286. // this.handleFileList(arr)
  287. }
  288. this.displayData(arr)
  289. },
  290. handlePicList(arr) {
  291. let picObject = {}
  292. //处理数据格式
  293. arr.map(i => {
  294. if (i.InputMode == 'F2') {
  295. switch (i.Path) {
  296. case 'infos.drawing':
  297. case 'infos.installPic':
  298. case 'infos.installDrawing':
  299. case 'infos.nameplate':
  300. case 'infos.pic':
  301. if (this.instance.hasOwnProperty(i.path)) {
  302. i.PicList = this.instance[i.path]
  303. }
  304. if (picObject[i.name]) {
  305. } else {
  306. picObject[i.name] = []
  307. }
  308. picObject[i.name].push({
  309. ...i,
  310. })
  311. break;
  312. }
  313. }
  314. })
  315. //展示图片
  316. this.exhibitionImage.list = picObject
  317. let isArray = [] //获取图片数组
  318. for (let i in picObject) {
  319. if (Array.isArray(picObject[i])) {
  320. let list = picObject[i]
  321. list.forEach(i => {
  322. if (i.PicList) {
  323. isArray.push(...i.PicList)
  324. }
  325. })
  326. }
  327. }
  328. this.exhibitionImage.arr = isArray
  329. let video = isArray.filter(i => i.Type != 'image' && i.type != 'image')
  330. this.exhibitionVideo.list = video
  331. //判断是否显示图片组件
  332. this.isShowImage = isArray.length ? true : false
  333. //判断是否显示video组件
  334. this.isShowVideo = video.length ? true : false
  335. },
  336. handleFileList(arr) {
  337. let picObject = {}
  338. //处理数据格式
  339. arr.map(i => {
  340. if (i.InputMode == 'F2') {
  341. switch (i.Path) {
  342. case 'infos.insuranceFile':
  343. case 'infos.archive':
  344. case 'infos.checkReport':
  345. if (this.instance.hasOwnProperty(i.path)) {
  346. i.fileList = this.instance[i.path]
  347. }
  348. if (picObject[i.name]) {
  349. } else {
  350. picObject[i.name] = []
  351. }
  352. picObject[i.name].push({
  353. ...i,
  354. })
  355. break
  356. }
  357. }
  358. })
  359. //展示文件
  360. this.exhibitionFile.list = picObject
  361. let isArray = [] //获取文件数组
  362. for (let i in picObject) {
  363. if (Array.isArray(picObject[i])) {
  364. let list = picObject[i]
  365. list.forEach(i => {
  366. if (i.fileList) {
  367. isArray.push(...i.fileList)
  368. }
  369. })
  370. }
  371. }
  372. //判断是否显示文件组件
  373. this.isShowFile = isArray.length ? true : false
  374. },
  375. changeRadio(val) { //1,需采集,2,有值,3,全部
  376. this.handleRadios(val)
  377. this.currentRadio = val
  378. },
  379. formatDate(str) {
  380. if (str) {
  381. if (str.includes('-')) {
  382. return str
  383. } else {
  384. return str.substr(0, 4) + "-" + str.substr(4, 2) + "-" + str.substr(6, 2) + " " + str.substr(8, 2) + ":" + str.substr(10, 2) + ":" + str.substr(12, 2)
  385. }
  386. } else {
  387. return '--'
  388. }
  389. },
  390. displayData(arr) {//对数据进行处理传给组件展示
  391. const result = {}
  392. arr.forEach(i => {
  393. if (this.instance.hasOwnProperty(i.path) && this.currentRadio != 2) {
  394. i.value = this.instance[i.path]
  395. }
  396. if (i.inputMode == 'C5') {
  397. if (this.instance.hasOwnProperty(i.path)) {
  398. let time = this.instance[i.path]
  399. i.value = this.formatDate(time)
  400. }
  401. }
  402. if (i.dataSource && i.dataSource.length) {
  403. // let source = JSON.parse(i.DataSource)
  404. let source = i.dataSource
  405. //判断输入类型
  406. if (i.inputMode == 'D1L') {
  407. let d1l = tools.formatDataSource(i.dataSource)
  408. d1l.forEach(k => {
  409. if (k.code == this.instance[i.path]) {
  410. i.value = k.name
  411. }
  412. })
  413. } else if (i.inputMode == 'D2' || i.inputMode == 'C6') {
  414. if (this.instance.hasOwnProperty(i.path)) {
  415. if (!Array.isArray(this.instance[i.path])) {
  416. let transArray = this.instance[i.path].split(',')
  417. i.value = source.filter(item => transArray.includes(item.code)).map(item => item.name).join(',')
  418. }
  419. }
  420. }
  421. source.forEach(j => {
  422. if (j.code == this.instance[i.path]) {
  423. i.value = j.name
  424. }
  425. })
  426. }
  427. switch (i.inputMode) {
  428. case "L":
  429. case "L1":
  430. case "L2":
  431. case "M":
  432. break;
  433. default:
  434. if (result[`${i.firstName}${i.secondName ? '/' + i.secondName : ''}`]) {
  435. result[`${i.firstName}${i.secondName ? '/' + i.secondName : ''}`].paths.push({
  436. Path: i.Path,
  437. InfoPointName: i.name,
  438. InfoPointCode: i.code,
  439. Value: i.value,
  440. Visible: i.visible,
  441. KeyWord: i.keyWord,
  442. InputMode: i.inputMode,
  443. data: i.data,
  444. receivetime: i.receivetime,
  445. error: i.error,
  446. Unit: i.unit,
  447. FirstName: i.firstName,
  448. classCode: i.classCode,
  449. id: i.id,
  450. groupCode: i.groupCode,
  451. type: i.type
  452. })
  453. } else {
  454. result[`${i.firstName}${i.secondName ? '/' + i.secondName : ''}`] = {
  455. paths: [{
  456. Path: i.path,
  457. InfoPointName: i.name,
  458. InfoPointCode: i.code,
  459. Value: i.value,
  460. Visible: i.visible,
  461. KeyWord: i.keyWord,
  462. InputMode: i.inputMode,
  463. data: i.data,
  464. receivetime: i.receivetime,
  465. error: i.error,
  466. Unit: i.unit,
  467. FirstName: i.firstName,
  468. classCode: i.classCode,
  469. id: i.id,
  470. groupCode: i.groupCode,
  471. type: i.type
  472. }]
  473. }
  474. }
  475. }
  476. })
  477. this.exhibitionBaseInformation.information = result
  478. this.exhibitionCrux.allMessage = result
  479. },
  480. // 删除系统
  481. deleteSystem() {
  482. this.$confirm("此操作将删除系统,是否继续?", "提示", {
  483. confirmButtonText: '确定',
  484. cancelButtonText: '取消',
  485. type: 'warning'
  486. }).then(() => {
  487. let pa = [{
  488. SysID: this.exampleData.SysID
  489. }]
  490. this.removeSys(pa)
  491. }).catch(() => {
  492. this.$message("取消删除")
  493. })
  494. },
  495. async removeSys(param) {
  496. await deleteGeneralSys(param, res => {
  497. this.$message.success("删除成功")
  498. this.goBack()
  499. })
  500. },
  501. }
  502. };
  503. </script>
  504. <style scoped lang='less'>
  505. @bgc: #fff;
  506. .box {
  507. .condition {
  508. padding: 10px;
  509. display: flex;
  510. height: 100%;
  511. flex-direction: column;
  512. border: 1px solid #dfe6ec;
  513. background: #fff;
  514. box-sizing: border-box;
  515. .header {
  516. padding-bottom: 10px;
  517. span {
  518. line-height: 33px;
  519. margin-left: 15px;
  520. }
  521. }
  522. .spaceTypes {
  523. .types {
  524. float: left;
  525. width: calc(100% - 200px);
  526. /deep/ .el-tabs__item.is-top {
  527. border-top: 2px solid transparent;
  528. &.is-active {
  529. border-top: 2px solid #409eff;
  530. }
  531. }
  532. }
  533. .deleBtn {
  534. float: left;
  535. width: 200px;
  536. text-align: right;
  537. height: 40px;
  538. border-bottom: 1px solid #e4e7ed;
  539. }
  540. }
  541. .content {
  542. height: calc(100% - 99px);
  543. .content-scrollbar {
  544. display: flex;
  545. height: 100%;
  546. flex-direction: row;
  547. box-sizing: border-box;
  548. background-color: @bgc;
  549. .content-left {
  550. display: flex;
  551. flex-direction: column;
  552. flex: 1;
  553. .content-showType {
  554. height: 50px;
  555. border: 1px solid #ccc;
  556. border-bottom: none;
  557. box-sizing: border-box;
  558. background: @bgc;
  559. }
  560. .content-point {
  561. display: flex;
  562. flex-direction: row;
  563. border: 1px solid #ccc;
  564. box-sizing: border-box;
  565. background: @bgc;
  566. .content-point-left {
  567. flex: 1;
  568. }
  569. }
  570. }
  571. .content-right {
  572. width: 400px;
  573. margin-left: 10px;
  574. box-sizing: border-box;
  575. .content-repair {
  576. height: 50px;
  577. line-height: 50px;
  578. margin-bottom: 10px;
  579. border: 1px solid #ccc;
  580. background: @bgc;
  581. box-sizing: border-box;
  582. }
  583. .content-media {
  584. box-sizing: border-box;
  585. }
  586. }
  587. }
  588. }
  589. .main {
  590. margin-top: 10px;
  591. height: calc(100% - 96px);
  592. }
  593. .footer {
  594. margin-bottom: 10px;
  595. }
  596. /deep/ .el-scrollbar__wrap {
  597. overflow-x: hidden;
  598. }
  599. }
  600. }
  601. </style>
  602. <style lang="less">
  603. .el-table th {
  604. background-color: #d9d9d9;
  605. color: #000;
  606. }
  607. </style>