index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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. <div class="content-left">
  22. <div class="content-showType">
  23. <selectRadio
  24. :selectRadio="selectRadio"
  25. @changeRadio="changeRadio"
  26. />
  27. </div>
  28. <div class="content-point">
  29. <div class="content-point-left">
  30. <el-scrollbar style="height:100%;">
  31. <div>
  32. <exhibitionBaseInformation :exhibitionBaseInformation="exhibitionBaseInformation"/>
  33. </div>
  34. </el-scrollbar>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="content-right">
  39. <div class="content-repair">
  40. <exhibitionMaintain :exhibitionMaintain="exhibitionMaintain"/>
  41. </div>
  42. <div class="content-media">
  43. <el-scrollbar style="height:100%;">
  44. <div>
  45. <exhibitionImage :exhibitionImage="exhibitionImage"/>
  46. <exhibitionVideo :exhibitionVideo="exhibitionVideo"/>
  47. <exhibitionFile :exhibitionFile="exhibitionFile"/>
  48. </div>
  49. </el-scrollbar>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 系统内设备 -->
  54. <deviceTable v-if="activeTab=='Equipment'" :params="params" :type="activeTab"></deviceTable>
  55. <!-- 系统所在竖井 -->
  56. <cenoteTable v-else-if="activeTab=='cenote'" :params="params" :type="activeTab"></cenoteTable>
  57. <!-- 系统所在业务空间 -->
  58. <spaceTable v-else-if="activeTab=='space'" :params="params" :type="activeTab" :spaceType="spaceType" :floorType="floorType"></spaceTable>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import {mapGetters} from "vuex";
  64. import {
  65. buildingQuery,
  66. deleteGeneralSys,
  67. getDataDictionary,
  68. queryDictionaryHead,
  69. queryLinkSys
  70. } from '@/api/scan/request';
  71. import cenoteTable from '@/components/ledger/system/table/cenoteTable';
  72. import deviceTable from '@/components/ledger/system/table/deviceTable';
  73. import spaceTable from '@/components/ledger/system/table/spaceTable';
  74. import exhibitionBaseInformation from "@/components/ledger/details/detail/exhibitionBaseInformation";
  75. import exhibitionFile from "@/components/ledger/details/detail/exhibitionFile";
  76. import exhibitionImage from "@/components/ledger/details/detail/exhibitionImage";
  77. import selectRadio from "@/components/ledger/details/detail/selectRadio";
  78. import exhibitionMaintain from "@/components/ledger/details/detail/exhibitionMaintain";
  79. import exhibitionVideo from "@/components/ledger/details/detail/exhibitionVideo";
  80. import tools from "@/utils/scan/tools"
  81. export default {
  82. data() {
  83. return {
  84. params: {}, //参数-包含系统id 分区类型
  85. tabsList: [
  86. {Code: 'detail', Name: '系统详情'},
  87. {Code: 'Equipment', Name: '系统内设备'},
  88. {Code: 'cenote', Name: '系统所在竖井'},
  89. {Code: 'space', Name: '系统所在业务空间'},
  90. ], //tab页
  91. activeTab: 'detail', //当前选中的tab
  92. pointData: [], //信息点数据
  93. exampleData: {}, //实例数据
  94. spaceType: {},//空间种类
  95. floorType: {},
  96. currentRadio: '',//当前选中的select
  97. selectRadio: {
  98. information: '设备信息点',
  99. initRadio: '1',
  100. radioList: [
  101. {
  102. value: '显示需采集信息点',
  103. label: '1'
  104. },
  105. {
  106. value: '显示有值信息点',
  107. label: '2'
  108. },
  109. {
  110. value: '显示全部信息点',
  111. label: '3'
  112. }
  113. ]
  114. },
  115. exhibitionBaseInformation: {
  116. information: {},
  117. style: 3
  118. },
  119. exhibitionEnergy: {
  120. title: '能耗信息',
  121. dynamic: [],
  122. },
  123. exhibitionMaintain: {
  124. title: '维修/维保记录'
  125. },
  126. exhibitionFile: {
  127. title: '文件',
  128. list: {}
  129. },
  130. exhibitionCrux: {
  131. title: '关键信息点:',
  132. cruxArray: [],
  133. allMessage: [],//全部信息点
  134. },
  135. exhibitionImage: {
  136. title: '图片',
  137. list: {}
  138. },
  139. exhibitionVideo: {
  140. title: '视频',
  141. list: {}
  142. },
  143. instance: {},//实例信息处理
  144. }
  145. },
  146. computed: {
  147. ...mapGetters("layout", ["projectId", "userId", "secret"])
  148. },
  149. components: {
  150. cenoteTable,
  151. deviceTable,
  152. spaceTable,
  153. exhibitionBaseInformation,
  154. exhibitionFile,
  155. exhibitionImage,
  156. selectRadio,
  157. exhibitionMaintain,
  158. exhibitionVideo
  159. },
  160. created() {
  161. this.params = this.$route.query;
  162. this.getData();
  163. let pa = {
  164. Filters: `parentId='Space'`
  165. }
  166. queryDictionaryHead(pa, res => {
  167. res.Content.map(t => {
  168. if (t.Name != "元空间") {
  169. this.spaceType[t.Code] = t.Name;
  170. }
  171. })
  172. });
  173. let param = {
  174. Cascade: [
  175. { Name: "floor" }
  176. ]
  177. };
  178. buildingQuery(param, res => {
  179. res.Content.map(item => {
  180. if (item.BuildID && item.BuildLocalName) {
  181. this.floorType[item.BuildID] = item.BuildLocalName;
  182. if (item.Floor instanceof Array) {
  183. item.Floor.map(f => {
  184. if (f.FloorID && f.FloorLocalName) {
  185. this.floorType[f.FloorID] = f.FloorLocalName;
  186. }
  187. })
  188. }
  189. }
  190. });
  191. });
  192. },
  193. mounted() { },
  194. watch: {
  195. projectId() { }
  196. },
  197. methods: {
  198. // 返回
  199. goBack() {
  200. this.$router.push({
  201. name: "systemlist",
  202. params: this.params
  203. })
  204. },
  205. // 获取表头和实例数据
  206. getData () {
  207. let params1 = {
  208. data: {
  209. Orders: "sort asc",
  210. PageNumber: 1,
  211. PageSize: 1000
  212. },
  213. type: this.params.SysType
  214. }, params2 = {
  215. Filters: `SysID='${this.params.SysID}'`,
  216. };
  217. let promise1 = new Promise((resolve, reject) => {
  218. getDataDictionary(params1, res => {
  219. resolve(res)
  220. })
  221. })
  222. let promise2 = new Promise((resolve, reject) => {
  223. queryLinkSys(params2, res => {
  224. resolve(res)
  225. })
  226. })
  227. Promise.all([promise1, promise2]).then(values => {
  228. this.pointData = values[0].Content;
  229. this.exampleData = values[1].Content[0];
  230. let obj = this.deepCopy(values[1].Content[0]);
  231. obj = tools.flattenKeys(obj);
  232. this.instance = obj;
  233. this.handleRadios(1)
  234. })
  235. },
  236. deepCopy(obj) {
  237. return JSON.parse(JSON.stringify(obj))
  238. },
  239. handleRadios(val) { //判断radio的值显示关键信息,基本信息,图片,文件
  240. let arr = []
  241. if (val == 1) { //需采集信息
  242. arr = this.pointData.filter(i => i.Visible)
  243. // 图片和的处理
  244. this.handlePicList(arr)
  245. // 文件处理
  246. this.handleFileList(arr)
  247. } else if (val == 2) { //有值信息点
  248. let list = this.pointData
  249. list.map(j => {
  250. if (this.exampleData.hasOwnProperty(j.Path)) {
  251. return {
  252. ...j,
  253. value: this.exampleData[j.Path]
  254. }
  255. }
  256. arr = list.filter(k => k.value)
  257. this.handlePicList(arr)
  258. this.handleFileList(arr)
  259. })
  260. } else { //全部信息点
  261. arr = this.pointData
  262. this.handlePicList(arr)
  263. this.handleFileList(arr)
  264. }
  265. this.displayData(arr)
  266. },
  267. handlePicList(arr) {
  268. let picObject = {}
  269. //处理数据格式
  270. arr.map(i => {
  271. if(i.InputMode == 'F2') {
  272. switch (i.Path) {
  273. case 'LedgerParam.PhotoDoc.Drawing':
  274. case 'LedgerParam.Siteinstall.InstallPic':
  275. case 'LedgerParam.Siteinstall.InstallDrawing':
  276. case 'LedgerParam.PhotoDoc.Nameplate':
  277. if (this.instance.hasOwnProperty(i.Path)) {
  278. i.PicList = this.instance[i.Path]
  279. }
  280. if (picObject[i.InfoPointName]) {
  281. } else {
  282. picObject[i.InfoPointName] = []
  283. }
  284. picObject[i.InfoPointName].push({
  285. ...i,
  286. })
  287. break;
  288. }
  289. }
  290. })
  291. //展示图片
  292. this.exhibitionImage.list = picObject
  293. },
  294. handleFileList(arr) {
  295. let picObject = {}
  296. //处理数据格式
  297. arr.map(i => {
  298. if (i.InputMode == 'F2') {
  299. switch (i.Path) {
  300. case 'LedgerParam.InsuranceDoc.InsuranceFile':
  301. case 'LedgerParam.PhotoDoc.Archive':
  302. case 'LedgerParam.Siteinstall.CheckReport':
  303. if (this.instance.hasOwnProperty(i.Path)) {
  304. i.fileList = this.instance[i.Path]
  305. }
  306. if (picObject[i.InfoPointName]) {
  307. } else {
  308. picObject[i.InfoPointName] = []
  309. }
  310. picObject[i.InfoPointName].push({
  311. ...i,
  312. })
  313. break
  314. }
  315. }
  316. })
  317. //展示文件
  318. this.exhibitionFile.list = picObject
  319. },
  320. changeRadio(val) { //1,需采集,2,有值,3,全部
  321. this.handleRadios(val)
  322. this.currentRadio = val
  323. },
  324. displayData(arr) {//对数据进行处理传给组件展示
  325. const result = {}
  326. arr.forEach(i => {
  327. if (this.exampleData.hasOwnProperty(i.Path) && this.currentRadio != 2) {
  328. i.value = this.exampleData[i.Path]
  329. }
  330. switch (i.InputMode) {
  331. case "L":
  332. case "L1":
  333. case "L2":
  334. case "M":
  335. break;
  336. default:
  337. if (result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`]) {
  338. result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`].paths.push({
  339. Path: i.Path,
  340. InfoPointName: i.InfoPointName,
  341. InfoPointCode: i.InfoPointCode,
  342. Value: i.value,
  343. Visible: i.Visible,
  344. KeyWord: i.KeyWord
  345. })
  346. } else {
  347. result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`] = {
  348. paths: [{
  349. Path: i.Path,
  350. InfoPointName: i.InfoPointName,
  351. InfoPointCode: i.InfoPointCode,
  352. Value: i.value,
  353. Visible: i.Visible,
  354. KeyWord: i.KeyWord
  355. }]
  356. }
  357. }
  358. }
  359. })
  360. this.exhibitionBaseInformation.information = result
  361. this.exhibitionCrux.allMessage = result
  362. },
  363. // 删除系统
  364. deleteSystem() {
  365. this.$confirm("此操作将删除系统,是否继续?", "提示", {
  366. confirmButtonText: '确定',
  367. cancelButtonText: '取消',
  368. type: 'warning'
  369. }).then(() => {
  370. let pa = [{
  371. SysID: this.exampleData.SysID
  372. }]
  373. this.removeSys(pa)
  374. }).catch(() => {
  375. this.$message("取消删除")
  376. })
  377. },
  378. async removeSys(param) {
  379. await deleteGeneralSys(param, res => {
  380. this.$message.success("删除成功")
  381. this.goBack()
  382. })
  383. },
  384. }
  385. };
  386. </script>
  387. <style scoped lang='less'>
  388. .box {
  389. .condition {
  390. padding: 10px;
  391. display: flex;
  392. height: 100%;
  393. flex-direction: column;
  394. border: 1px solid #dfe6ec;
  395. background: #fff;
  396. box-sizing: border-box;
  397. .header {
  398. padding-bottom: 10px;
  399. span {
  400. line-height: 33px;
  401. margin-left: 15px;
  402. }
  403. }
  404. .spaceTypes {
  405. .types {
  406. float: left;
  407. width: calc(100% - 200px);
  408. /deep/ .el-tabs__item.is-top {
  409. border-top: 2px solid transparent;
  410. &.is-active {
  411. border-top: 2px solid #409eff;
  412. }
  413. }
  414. }
  415. .deleBtn {
  416. float: left;
  417. width: 200px;
  418. text-align: right;
  419. height: 40px;
  420. border-bottom: 1px solid #e4e7ed;
  421. }
  422. }
  423. .content {
  424. display: flex;
  425. flex-direction: row;
  426. box-sizing: border-box;
  427. height: calc(100% - 99px);
  428. .content-left {
  429. display: flex;
  430. flex-direction: column;
  431. flex: 1;
  432. .content-showType {
  433. height: 50px;
  434. border: 1px solid #ccc;
  435. border-bottom: none;
  436. box-sizing: border-box;
  437. }
  438. .content-point {
  439. display: flex;
  440. flex-direction: row;
  441. height: calc(100% - 50px);
  442. border: 1px solid #ccc;
  443. box-sizing: border-box;
  444. .content-point-left {
  445. flex: 1;
  446. }
  447. }
  448. }
  449. .content-right {
  450. width: 400px;
  451. margin-left: 10px;
  452. .content-repair {
  453. height: 50px;
  454. line-height: 50px;
  455. margin-bottom: 10px;
  456. border: 1px solid #ccc;
  457. box-sizing: border-box;
  458. }
  459. .content-media {
  460. height: calc(100% - 60px);
  461. border: 1px solid #ccc;
  462. box-sizing: border-box;
  463. }
  464. }
  465. }
  466. .main {
  467. margin-top: 10px;
  468. height: calc(100% - 96px);
  469. }
  470. .footer {
  471. margin-bottom: 10px;
  472. }
  473. /deep/ .el-scrollbar__wrap {
  474. overflow-x: hidden;
  475. }
  476. }
  477. }
  478. </style>
  479. <style lang="less">
  480. .el-table th {
  481. background-color: #d9d9d9;
  482. color: #000;
  483. }
  484. </style>