index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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="deleteCenote">删除竖井</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>
  39. <!-- 竖井内的设备 -->
  40. <device-table v-if="activeTab=='device'" :params="params" :type="activeTab"></device-table>
  41. <!-- 连通的其他竖井 -->
  42. <cenote-table v-else-if="activeTab=='cenote'" :params="params" :type="activeTab"></cenote-table>
  43. <!-- 竖井内系统 -->
  44. <system-table v-else-if="activeTab=='system'" :params="params" :type="activeTab"></system-table>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import { mapGetters } from "vuex"
  50. import { deleteCenoteTableData, queryCenoteTableData } from '@/api/scan/request'
  51. import { getDataDictionary } from "@/api/dict";
  52. import cenoteTable from '@/components/ledger/cenote/table/cenoteTable'
  53. import deviceTable from '@/components/ledger/cenote/table/deviceTable'
  54. import systemTable from '@/components/ledger/cenote/table/systemTable'
  55. import exhibitionBaseInformation from "@/components/ledger/details/detail/exhibitionBaseInformation";
  56. import selectRadio from "@/components/ledger/details/detail/selectRadio";
  57. import tools from "@/utils/scan/tools"
  58. export default {
  59. data() {
  60. return {
  61. params: {},
  62. tabsList: [
  63. { Code: 'detail', Name: '竖井详情' },
  64. { Code: 'device', Name: '竖井内的设备' },
  65. { Code: 'cenote', Name: '连通的其它竖井' },
  66. { Code: 'system', Name: '竖井内系统' },
  67. ], //tab页
  68. activeTab: 'detail', //当前选中的tab
  69. pointData: [], //信息点数据
  70. currentRadio: '1',//当前选中的select
  71. exampleData: {}, //实例数据
  72. exhibitionBaseInformation: {
  73. information: {}
  74. },
  75. selectRadio: {
  76. information: '设备信息点',
  77. initRadio: '1',
  78. radioList: [
  79. {
  80. value: '显示需采集信息点',
  81. label: '1'
  82. },
  83. {
  84. value: '显示有值信息点',
  85. label: '2'
  86. },
  87. {
  88. value: '显示全部信息点',
  89. label: '3'
  90. }
  91. ]
  92. },
  93. }
  94. },
  95. computed: {
  96. ...mapGetters("layout", ["projectId", "userId", "secret"])
  97. },
  98. components: {
  99. cenoteTable,
  100. deviceTable,
  101. systemTable,
  102. exhibitionBaseInformation,
  103. selectRadio
  104. },
  105. created() {
  106. this.params = this.$route.query;
  107. this.getData();
  108. },
  109. mounted() {
  110. },
  111. watch: {
  112. projectId() {
  113. }
  114. },
  115. methods: {
  116. deepCopy(obj) {
  117. return JSON.parse(JSON.stringify(obj))
  118. },
  119. // 返回
  120. goBack() {
  121. this.$router.push({ name: "cenotelist" });
  122. },
  123. getData() {
  124. let params1 = {
  125. orders: "sort asc",
  126. pageNumber: 1,
  127. pageSize: 1000,
  128. type: 'shaft'
  129. }, params2 = {
  130. Filters: `ShaftID='${this.params.ShaftID}'`
  131. };
  132. let promise1 = new Promise((resolve, reject) => {
  133. getDataDictionary(params1, res => {
  134. resolve(res)
  135. })
  136. })
  137. let promise2 = new Promise((resolve, reject) => {
  138. queryCenoteTableData(params2, res => {
  139. resolve(res)
  140. })
  141. })
  142. Promise.all([promise1, promise2]).then(values => {
  143. this.pointData = values[0].content;
  144. this.exampleData = values[1].Content[0];
  145. let obj = this.deepCopy(values[1].Content[0]);
  146. obj = tools.flattenKeys(obj);
  147. for (let key in obj) {
  148. if (Array.isArray(obj[key]) && !obj[key].length) {
  149. delete obj[key]
  150. }
  151. }
  152. this.instance = obj;
  153. this.handleRadios(1)
  154. })
  155. },
  156. handleRadios(val) { //判断radio的值显示关键信息,基本信息,图片,文件
  157. let arr = []
  158. if (val == 1) { //需采集信息
  159. arr = this.pointData.filter(i => i.visible)
  160. } else if (val == 2) { //有值信息点
  161. let list = this.pointData
  162. list.map(j => {
  163. if (this.instance.hasOwnProperty(j.path)) {
  164. return {
  165. ...j,
  166. value: this.instance[j.path]
  167. }
  168. }
  169. arr = list.filter(k => k.value)
  170. })
  171. } else { //全部信息点
  172. arr = this.pointData
  173. }
  174. this.displayData(arr)
  175. },
  176. changeRadio(val) { //1,需采集,2,有值,3,全部
  177. this.handleRadios(val)
  178. this.currentRadio = val
  179. },
  180. formatDate(str) {
  181. if (str) {
  182. if (str.includes('-')) {
  183. return str
  184. } else {
  185. 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)
  186. }
  187. } else {
  188. return '--'
  189. }
  190. },
  191. displayData(arr) {//对数据进行处理传给组件展示
  192. const result = {}
  193. arr.forEach(i => {
  194. if (this.instance.hasOwnProperty(i.Path) && this.currentRadio != 2) {
  195. i.value = this.instance[i.Path]
  196. }
  197. if (i.InputMode == 'C5') {
  198. if (this.instance.hasOwnProperty(i.Path)) {
  199. let time = this.instance[i.Path]
  200. i.value = this.formatDate(time)
  201. }
  202. }
  203. if (i.DataSource && i.DataSource.length) {
  204. let source = JSON.parse(i.DataSource)
  205. //判断输入类型
  206. if (i.InputMode == 'D1L') {
  207. let d1l = tools.formatDataSource(i.DataSource)
  208. d1l.forEach(k => {
  209. if (k.Code == this.instance[i.Path]) {
  210. i.value = k.Name
  211. }
  212. })
  213. } else if (i.InputMode == 'D2' || i.InputMode == 'C6') {
  214. if (this.instance.hasOwnProperty(i.Path)) {
  215. if (!Array.isArray(this.instance[i.Path])) {
  216. let transArray = this.instance[i.Path].split(',')
  217. i.value = source.filter(item => transArray.includes(item.Code)).map(item => item.Name).join(',')
  218. }
  219. }
  220. }
  221. source.forEach(j => {
  222. if (j.Code == this.instance[i.Path]) {
  223. i.value = j.Name
  224. }
  225. })
  226. }
  227. switch (i.InputMode) {
  228. case "L":
  229. case "L1":
  230. case "L2":
  231. case "M":
  232. break;
  233. default:
  234. if (result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`]) {
  235. result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`].paths.push({
  236. Path: i.Path,
  237. InfoPointName: i.InfoPointName,
  238. InfoPointCode: i.InfoPointCode,
  239. Value: i.value,
  240. Visible: i.Visible,
  241. KeyWord: i.KeyWord,
  242. InputMode: i.InputMode
  243. })
  244. } else {
  245. result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`] = {
  246. paths: [{
  247. Path: i.Path,
  248. InfoPointName: i.InfoPointName,
  249. InfoPointCode: i.InfoPointCode,
  250. Value: i.value,
  251. Visible: i.Visible,
  252. KeyWord: i.KeyWord,
  253. InputMode: i.InputMode
  254. }]
  255. }
  256. }
  257. }
  258. })
  259. this.exhibitionBaseInformation.information = result
  260. },
  261. // 删除业务空间
  262. deleteCenote() {
  263. this.$confirm("此操作将删除竖井,是否继续?", "提示", {
  264. confirmButtonText: '确定',
  265. cancelButtonText: '取消',
  266. type: 'warning'
  267. }).then(() => {
  268. deleteCenoteTableData([{ ShaftID: this.params.ShaftID }], res => {
  269. this.$message.success('删除成功')
  270. this.goBack()
  271. })
  272. }).catch(() => {
  273. this.$message("取消删除")
  274. })
  275. }
  276. }
  277. };
  278. </script>
  279. <style scoped lang='less'>
  280. .box {
  281. .condition {
  282. padding: 10px;
  283. display: flex;
  284. height: 100%;
  285. flex-direction: column;
  286. border: 1px solid #dfe6ec;
  287. box-sizing: border-box;
  288. background: #fff;
  289. .header {
  290. padding-bottom: 10px;
  291. span {
  292. line-height: 33px;
  293. margin-left: 15px;
  294. }
  295. }
  296. .spaceTypes {
  297. .types {
  298. float: left;
  299. width: calc(100% - 200px);
  300. /deep/ .el-tabs__item.is-top {
  301. border-top: 2px solid transparent;
  302. &.is-active {
  303. border-top: 2px solid #409eff;
  304. }
  305. }
  306. }
  307. .deleBtn {
  308. float: left;
  309. width: 200px;
  310. text-align: right;
  311. height: 40px;
  312. border-bottom: 1px solid #e4e7ed;
  313. }
  314. }
  315. .content {
  316. display: flex;
  317. flex-direction: row;
  318. box-sizing: border-box;
  319. height: calc(100% - 99px);
  320. .content-left {
  321. display: flex;
  322. flex-direction: column;
  323. flex: 1;
  324. .content-showType {
  325. height: 50px;
  326. border: 1px solid #ccc;
  327. border-bottom: none;
  328. box-sizing: border-box;
  329. }
  330. .content-point {
  331. display: flex;
  332. flex-direction: row;
  333. height: calc(100% - 50px);
  334. border: 1px solid #ccc;
  335. box-sizing: border-box;
  336. .content-point-left {
  337. flex: 1;
  338. }
  339. }
  340. }
  341. }
  342. .main {
  343. margin-top: 10px;
  344. height: calc(100% - 96px);
  345. }
  346. .footer {
  347. margin-bottom: 10px;
  348. }
  349. /deep/ .el-scrollbar__wrap {
  350. overflow-x: hidden;
  351. }
  352. }
  353. }
  354. </style>
  355. <style lang="less">
  356. .el-table th {
  357. background-color: #d9d9d9;
  358. color: #000;
  359. }
  360. </style>