eqDetaileDialog.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <!-- 详情页面 -->
  3. <div class='gdqd-dialog'>
  4. <div class='top'></div>
  5. <div class='gdqd-top'>
  6. <div class='gdqd-dialog-top'>
  7. <el-input
  8. placeholder='搜索设备简称编号'
  9. style='width:192px;margin-right:12px'
  10. size='small'
  11. prefix-icon='el-icon-search'
  12. v-model='sbjc'
  13. clearable
  14. @keyup.enter.native='queryTableList'
  15. @blur='queryTableList'
  16. ></el-input>
  17. <Select v-model='sbglgs' width='180' tipPlace='top' caption='管理归属:' size='small' :selectdata='sbglgsOption' @change='queryTableList'></Select>
  18. <Select
  19. width='160'
  20. style='margin: 0 12px;'
  21. v-model='status'
  22. tipPlace='top'
  23. caption='设备状态:'
  24. size='small'
  25. :selectdata='statusOption'
  26. @change='queryTableList'
  27. ></Select>
  28. <el-input
  29. placeholder='搜索品牌、型号'
  30. style='width:180px;margin-right:12px'
  31. size='small'
  32. clearable
  33. prefix-icon='el-icon-search'
  34. v-model='brand'
  35. @keyup.enter.native='queryTableList'
  36. @blur='queryTableList'
  37. ></el-input>
  38. <Select
  39. width='150'
  40. style='margin-right:12px;'
  41. v-model='floor'
  42. tipPlace='top'
  43. caption='楼层:'
  44. size='small'
  45. :selectdata='floorAllSelect'
  46. @change='queryTableList'
  47. ></Select>
  48. <el-input
  49. placeholder='搜索安装位置'
  50. @keyup.enter.native='queryTableList'
  51. @blur='queryTableList'
  52. clearable
  53. style='width:180px;margin-right:12px'
  54. size='small'
  55. prefix-icon='el-icon-search'
  56. v-model='wzjc'
  57. ></el-input>
  58. <!-- 多余的筛选 -->
  59. <input-dialog :type='1' @confirm='confirm'></input-dialog>
  60. </div>
  61. <div class='gdqd-dialog-bottom'>
  62. <!-- TODO: 宽度修改 -->
  63. <el-table @row-click='innerTable' :data='tableData' :key='key' :border='true' style='width: 100%' :highlight-current-row='true'>
  64. <el-table-column type='index' label='序号' width='60'></el-table-column>
  65. <el-table-column prop='sbjc' label='设备名称' show-overflow-tooltip resizable min-width='338'>
  66. <template slot-scope='{row}'>{{row.sbjc || '--'}}</template>
  67. </el-table-column>
  68. <el-table-column prop='assetnum' label='设备内码' show-overflow-tooltip resizable width='80'>
  69. <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
  70. </el-table-column>
  71. <el-table-column prop='sbglgs' label='管理归属' show-overflow-tooltip resizable>
  72. <template slot-scope='{row}'>{{row.sbglgs || '--'}}</template>
  73. </el-table-column>
  74. <el-table-column prop='sb_status' label='设备状态' width='80' show-overflow-tooltip resizable>
  75. <template slot-scope='{row}'>{{row.sb_status || '--'}}</template>
  76. </el-table-column>
  77. <el-table-column prop='brand' label='品牌' show-overflow-tooltip resizable width='80'>
  78. <template slot-scope='{row}'>{{row.brand || '--'}}</template>
  79. </el-table-column>
  80. <el-table-column prop='sbxh' label='型号' show-overflow-tooltip resizable width='100'>
  81. <template slot-scope='{row}'>{{row.sbxh || '--'}}</template>
  82. </el-table-column>
  83. <el-table-column prop='floor' sortable label='楼层' width='70' show-overflow-tooltip resizable>
  84. <template slot-scope='{row}'>{{row.floorcode || '--'}}</template>
  85. </el-table-column>
  86. <el-table-column prop='wzjc' label='安装位置' show-overflow-tooltip resizable min-width='250'>
  87. <template slot-scope='{row}'>{{row.wzjc || '--'}}</template>
  88. </el-table-column>
  89. <el-table-column prop='manufacturer' label='生产厂商' show-overflow-tooltip resizable min-width='300'>
  90. <template slot-scope='{row}'>{{row.manufacturer || '--'}}</template>
  91. </el-table-column>
  92. <el-table-column prop='fws' label='服务商' show-overflow-tooltip resizable min-width='300'>
  93. <template slot-scope='{row}'>{{row.fws || '--'}}</template>
  94. </el-table-column>
  95. <el-table-column prop label='相关资料' show-overflow-tooltip resizable min-width='150'>
  96. <template slot-scope='{row}'>{{'--'}}</template>
  97. </el-table-column>
  98. </el-table>
  99. </div>
  100. </div>
  101. <!-- 底部表格 -->
  102. <div class='table-bottom'>
  103. <!-- 页签切换 -->
  104. <div class='title'>
  105. <div class='text'>维保:</div>
  106. <div class='d-tab d-tab-left' :class='{active:currentTab === 0}' @click='changeTab(0)'>重要维保</div>
  107. <div class='d-tab d-tab-right' :class='{active:currentTab === 1}' @click='changeTab(1)'>日常维保</div>
  108. <div class='text text-r'>维修:</div>
  109. <div class='d-tab d-tab-left' :class='{active:currentTab === 2}' @click='changeTab(2)'>重要维修</div>
  110. <div class='d-tab d-tab-right' :class='{active:currentTab === 3}' @click='changeTab(3)'>日常维修</div>
  111. </div>
  112. <!-- 动态显示各个表格组件 : 'wbTable', 'rcwbTable', 'wxTable', 'rcwxTable' -->
  113. <div class='table2-container'>
  114. <component
  115. v-if='Object.keys(this.row).length>0'
  116. :is='currentComponent'
  117. :ref='currentComponent'
  118. :smsxt='smsxt'
  119. :tabLabel='tabLabel[currentComponent]'
  120. :diff='diff'
  121. :assetnum='assetnum'
  122. :size='size'
  123. ></component>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. <script>
  129. import { Select } from 'meri-design'
  130. import { mapGetters } from 'vuex'
  131. import { queryAsset } from '@/api/equipmentList.js'
  132. import { querySelect } from '@/api/public.js'
  133. import inputDialog from './inputDIalog'
  134. import rcwbTable from './rcwbTable'
  135. import wbTable from './wbTable'
  136. import rcwxTable from './rcwxTable'
  137. import wxTable from './wxTable'
  138. export default {
  139. data() {
  140. return {
  141. tableData: [],
  142. sbjc: '',
  143. brand: '',
  144. wzjc: '',
  145. floor: '1',
  146. status: '1',
  147. manufacturer: '',
  148. fws: '',
  149. sbglgs: '1',
  150. sbglgsOption: [],
  151. statusOption: [],
  152. floorAllSelect: [],
  153. activeId: '1',
  154. activeName1: 'wb1',
  155. activeName2: '',
  156. visible: false,
  157. key: 0,
  158. assetnum: '', //区分设备的维修和维保关键
  159. currentTab: 0, //选中页签,默认重要维保
  160. currentComponent: 'wbTable', //选中的组件,默认 重要维保
  161. componentArr: ['wbTable', 'rcwbTable', 'wxTable', 'rcwxTable'], //下部表格组件列表
  162. tabLabel: {
  163. //下部表格组件列表使用label
  164. wbTable: '重要维保',
  165. rcwbTable: '日常维保',
  166. wxTable: '重要维修',
  167. rcwxTable: '日常维保',
  168. },
  169. size: 5, //分页条数
  170. }
  171. },
  172. components: {
  173. Select,
  174. inputDialog,
  175. rcwbTable,
  176. wbTable,
  177. rcwxTable,
  178. wxTable,
  179. },
  180. computed: {
  181. ...mapGetters(['floorSelect']),
  182. },
  183. mounted() {
  184. this.queryTableList()
  185. this.getFloorAllSelect()
  186. this.tabFind()
  187. if (document.body.clientWidth >= 1920) {
  188. this.size = 9
  189. }
  190. },
  191. props: ['row', 'major', 'sign', 'smsxt', 'diff'],
  192. methods: {
  193. innerTable(row) {
  194. this.assetnum = row.assetnum
  195. this.changeTab(0)
  196. // this.$refs.wbTable.startMethods()
  197. if (row.assetuid) {
  198. window.open(`http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=assetdevic&uniqueid=${row.assetuid}`)
  199. }
  200. },
  201. //多余输入框监听
  202. confirm(fws, manufacturer) {
  203. this.fws = fws
  204. this.manufacturer = manufacturer
  205. this.queryTableList()
  206. },
  207. //下拉框查询
  208. tabFind() {
  209. let postParams = [
  210. {
  211. columnName: { sbglgs: 'sbglgs', sb_status: 'sb_status' },
  212. params: {
  213. type_code: this.row.type_code,
  214. },
  215. tableName: 'sms_asset', //视图名称
  216. },
  217. ]
  218. let major
  219. if (this.major.slice(0, 2) == 'GD') {
  220. major = '供电'
  221. } else if (this.major.slice(0, 2) == 'XF') {
  222. major = '消防'
  223. } else if (this.major.slice(0, 2) == 'GPS') {
  224. major = '给排水'
  225. } else if (this.major.slice(0, 2) == 'DT') {
  226. major = '电梯'
  227. } else if (this.major.slice(0, 2) == 'RQ') {
  228. major = '燃气'
  229. } else {
  230. major = this.major
  231. }
  232. let data = {
  233. major: major,
  234. plazaId: this.$store.state.plazaId,
  235. }
  236. if (major != '土建') {
  237. data.onlyMainAsset = true
  238. }
  239. querySelect({ data, postParams }).then((res) => {
  240. let sb_status = res.data.data.sms_asset.sb_status
  241. let sbglgs = res.data.data.sms_asset.sbglgs
  242. this.sbglgsOption = []
  243. this.sbglgsOption.push({
  244. name: '全部',
  245. id: '1',
  246. })
  247. this.statusOption = []
  248. this.statusOption.push({
  249. name: '全部',
  250. id: '1',
  251. })
  252. sb_status.forEach((el) => {
  253. this.statusOption.push({
  254. name: el.value,
  255. id: el.key,
  256. })
  257. })
  258. sbglgs.forEach((el) => {
  259. this.sbglgsOption.push({
  260. name: el.value,
  261. id: el.key,
  262. })
  263. })
  264. })
  265. },
  266. queryTableList() {
  267. console.log('queryTableList')
  268. let major
  269. if (this.major.slice(0, 2) == 'GD') {
  270. major = '供电'
  271. } else if (this.major.slice(0, 2) == 'XF') {
  272. major = '消防'
  273. } else if (this.major.slice(0, 2) == 'GPS') {
  274. major = '给排水'
  275. } else if (this.major.slice(0, 2) == 'DT') {
  276. major = '电梯'
  277. } else if (this.major.slice(0, 2) == 'RQ') {
  278. major = '燃气'
  279. } else {
  280. major = this.major
  281. }
  282. let data = {
  283. major: major,
  284. plazaId: this.$store.state.plazaId,
  285. }
  286. //区分主要设备
  287. if (this.major != '土建') {
  288. data.onlyMainAsset = true
  289. }
  290. //输入框搜索
  291. data.keyword = ''
  292. if (this.sbjc) {
  293. data.keyword += `${this.sbjc}:sbjc,assetnum;`
  294. }
  295. if (this.brand) {
  296. data.keyword += `${this.brand}:brand,sbxh;`
  297. }
  298. if (this.wzjc) {
  299. data.keyword += `${this.wzjc}:wzjc;`
  300. }
  301. if (this.manufacturer) {
  302. data.keyword += `${this.manufacturer}:manufacturer;`
  303. }
  304. if (this.fws) {
  305. data.keyword += `${this.fws}:fws;`
  306. }
  307. if (data.keyword == '') {
  308. delete data.keyword
  309. }
  310. let postParams = {
  311. classstructureid: this.row.classstructureid,
  312. type_code: this.row.type_code,
  313. manufacturer: this.row.manufacturer || '--',
  314. sbxh: this.row.sbxh || '--',
  315. brand: this.row.brand || '--',
  316. }
  317. //下拉筛选
  318. if (this.floor && this.floor != 1) {
  319. postParams.gname = this.floor
  320. }
  321. if (this.sbglgs && this.sbglgs != 1) {
  322. postParams.sbglgs = this.sbglgs
  323. }
  324. if (this.status && this.status != 1) {
  325. postParams.status = this.status
  326. }
  327. queryAsset({ data, postParams }).then((res) => {
  328. this.tableData = res.data.data
  329. this.total = res.data.count
  330. this.key++
  331. if (this.tableData.length > 0) {
  332. this.assetnum = this.tableData[0].assetnum
  333. this.changeTab(0)
  334. }
  335. })
  336. },
  337. getFloorAllSelect() {
  338. this.floorAllSelect = []
  339. this.floorAllSelect.push({
  340. id: '1',
  341. name: '全部',
  342. })
  343. this.floorSelect.forEach((el) => {
  344. this.floorAllSelect.push(el)
  345. })
  346. },
  347. // 更改tab页签,切换组件
  348. changeTab(index) {
  349. this.currentTab = index
  350. this.currentComponent = this.componentArr[index]
  351. // --- 不需要执行,动态组件会自动执行
  352. //如果有组件,执行表格组件的内部方法
  353. // this.$nextTick(() => {
  354. // this.$refs[this.currentComponent] && this.$refs[this.currentComponent].startMethods()
  355. // })
  356. },
  357. },
  358. watch: {
  359. row: {
  360. handler(newV, oldV) {
  361. // console.log('handler', newV, oldV)
  362. // 数据改变,重置表格,tab数据
  363. if (JSON.stringify(newV) !== JSON.stringify(oldV)) {
  364. this.tableData = []
  365. this.currentTab = 0
  366. this.currentComponent = 'wbTable'
  367. }
  368. this.queryTableList()
  369. this.getFloorAllSelect()
  370. this.tabFind()
  371. },
  372. deep: true,
  373. },
  374. sbglgs() {
  375. this.queryTableList()
  376. },
  377. status() {
  378. this.queryTableList()
  379. },
  380. floor() {
  381. this.queryTableList()
  382. },
  383. },
  384. }
  385. </script>
  386. <style lang="less" scoped>
  387. .gdqd-dialog {
  388. display: flex;
  389. flex-direction: column;
  390. height: 90vh;
  391. .gdqd-top {
  392. .gdqd-dialog-bottom {
  393. margin-top: 20px;
  394. // 表格主体(数据列,不含表头),高度
  395. /deep/.el-table__body-wrapper {
  396. overflow: auto;
  397. max-height: 13.6vh;
  398. }
  399. }
  400. }
  401. // 底部表格
  402. .table-bottom {
  403. width: 100%;
  404. flex: 1;
  405. display: flex;
  406. flex-direction: column;
  407. // tab 样式
  408. .title {
  409. display: flex;
  410. height: 70px;
  411. line-height: 30px;
  412. align-items: center;
  413. padding: 15px 0;
  414. // 维修维保文本
  415. .text {
  416. width: 50px;
  417. }
  418. .text-r {
  419. margin-left: 100px;
  420. }
  421. // tab页签
  422. .d-tab {
  423. padding: 5px 16px;
  424. height: 30px;
  425. line-height: 22px;
  426. font-size: 14px;
  427. font-family: MicrosoftYaHei;
  428. font-weight: 500;
  429. color: #1f2429;
  430. text-align: center;
  431. border: 1px solid #c3c7cb;
  432. cursor: pointer;
  433. }
  434. .d-tab-left {
  435. border-radius: 4px 0 0 4px;
  436. }
  437. .d-tab-right {
  438. border-radius: 0 4px 4px 0;
  439. }
  440. // 当前选中页签
  441. .active {
  442. color: #025baa !important;
  443. border-color: #025baa !important;
  444. }
  445. }
  446. //筛选+表格
  447. .table2-container {
  448. width: 100%;
  449. flex: 1;
  450. position: relative;
  451. }
  452. }
  453. }
  454. @media screen and (max-width: 1600px) {
  455. .gdqd-dialog td {
  456. padding: 4px 0;
  457. }
  458. }
  459. @media screen and (max-width: 1366px) {
  460. .gdqd-dialog {
  461. padding: 12px 24px 24px;
  462. /deep/ .el-table td {
  463. padding: 1px 0 !important;
  464. }
  465. .gdqd-dialog-bottom {
  466. margin-top: 10px !important;
  467. }
  468. .table-bottom {
  469. .title {
  470. height: 60px !important;
  471. }
  472. }
  473. // 底部表格的分页位置修改
  474. /deep/ .rcwb-list .foot {
  475. margin-top: 10px !important;
  476. }
  477. }
  478. }
  479. </style>
  480. <style lang="less">
  481. .gdqd-dialog {
  482. /deep/.el-table__body-wrapper td {
  483. cursor: pointer;
  484. }
  485. .el-dialog__header {
  486. padding: 16px 24px;
  487. color: #fff;
  488. background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
  489. }
  490. .el-dialog__headerbtn .el-dialog__close {
  491. color: #fff;
  492. }
  493. .el-dialog__title {
  494. font-size: 16px;
  495. font-family: PingFangSC-Medium, PingFang SC;
  496. font-weight: 500;
  497. color: #fff;
  498. line-height: 24px;
  499. }
  500. }
  501. </style>