eqDetaileDialog.vue 19 KB

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