wxTable.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <!-- 维修-->
  2. <template>
  3. <div class='wx-list'>
  4. <div class='eq-list-top'>
  5. <el-input
  6. placeholder='搜索设备名称编号'
  7. size='small'
  8. @keyup.enter.native='getList'
  9. @blur='getList'
  10. clearable
  11. prefix-icon='el-icon-search'
  12. v-model='sbjc'
  13. style='width:192px;margin-right:12px'
  14. ></el-input>
  15. <el-input
  16. placeholder='搜索事项类型事项描述'
  17. size='small'
  18. clearable
  19. @keyup.enter.native='getList'
  20. @blur='getList'
  21. prefix-icon='el-icon-search'
  22. v-model='matters'
  23. style='width:192px;margin-right:12px'
  24. ></el-input>
  25. <Select
  26. @change='getList'
  27. style='margin-right:12px;'
  28. v-model='ischange'
  29. width='220'
  30. tipPlace='top'
  31. caption='是否更换:'
  32. :selectdata='changeOption'
  33. ></Select>
  34. <!-- placeholder='选择填报时间' -->
  35. <div class='picker-box'>
  36. <span class='picker-span'>填报日期:</span>
  37. <el-date-picker
  38. style='width:190px'
  39. v-model='reportdate'
  40. value-format='yyyyMMdd'
  41. type='daterange'
  42. @change='getList'
  43. size='mini'
  44. range-separator='-'
  45. start-placeholder
  46. end-placeholder
  47. ></el-date-picker>
  48. </div>
  49. <!-- placeholder='选择验收时间' -->
  50. <div class='picker-box'>
  51. <span class='picker-span'>验收日期:</span>
  52. <el-date-picker
  53. style='width:190px'
  54. v-model='sjjssj'
  55. value-format='yyyyMMdd'
  56. type='daterange'
  57. @change='getList'
  58. size='mini'
  59. range-separator='-'
  60. start-placeholder
  61. end-placeholder
  62. ></el-date-picker>
  63. </div>
  64. <input-dialog :type='3' @confirm='confirm'></input-dialog>
  65. </div>
  66. <div ref='tableBox' style='height: calc(100% - 115px);'>
  67. <el-table :data='tableData' :max-height='tableMaxHeight' :border='true' style='width: 100%' @row-click='innerTable'>
  68. <el-table-column type='index' label='序号' width='60' :index='indexMethod'></el-table-column>
  69. <el-table-column prop='sbmc' label='设备名称' show-overflow-tooltip resizable min-width='460'>
  70. <template slot-scope='{row}'>{{row.sbmc || '--'}}</template>
  71. </el-table-column>
  72. <el-table-column prop='assetnum' label='设备内码' show-overflow-tooltip resizable width='80'>
  73. <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
  74. </el-table-column>
  75. <el-table-column prop='matters' label='事项类型' width='180' show-overflow-tooltip resizable>
  76. <template slot-scope='{row}'>{{row.matters || '--'}}</template>
  77. </el-table-column>
  78. <el-table-column prop='description' label='事项描述' show-overflow-tooltip resizable min-width='340'>
  79. <template slot-scope='{row}'>{{row.description || '--'}}</template>
  80. </el-table-column>
  81. <el-table-column label='更换配件信息' align='center'>
  82. <el-table-column prop='ischangepj' label='是/否更换' width='80'>
  83. <template slot-scope='{row}'>{{row.ismodel==1?'是':(row.ismodel==0?"否" :'--')}}</template>
  84. </el-table-column>
  85. <el-table-column prop='model' label='配件名称型号' width='140' show-overflow-tooltip resizable>
  86. <template slot-scope='{row}'>{{row.model || '--'}}</template>
  87. </el-table-column>
  88. <el-table-column prop='sl' label='数量' width='80' show-overflow-tooltip resizable>
  89. <template slot-scope='{row}'>{{row.sl>=0?row.sl:'--'}}</template>
  90. </el-table-column>
  91. <el-table-column prop='cost' label='费用(万元)' width='80' align='right' show-overflow-tooltip resizable>
  92. <template slot-scope='{row}'>{{number_format(row.cost,2) || '--'}}</template>
  93. </el-table-column>
  94. <el-table-column prop='source' label='费用出处' show-overflow-tooltip resizable width='100'>
  95. <template slot-scope='{row}'>{{row.source || '--'}}</template>
  96. </el-table-column>
  97. </el-table-column>
  98. <el-table-column prop='brand' label='现场照片' width='80'>
  99. <template slot-scope='{row}'>
  100. <div
  101. v-if='row.glsmsImage'
  102. style='cursor:pointer;color: #0091ff;'
  103. @click.stop='clickPic(row.glsmsImage)'
  104. >{{row.glsmsImage.length+'张'}}</div>
  105. <div v-else>{{'--'}}</div>
  106. </template>
  107. </el-table-column>
  108. <el-table-column prop='reportdate' label='填报时间' width='140'>
  109. <template slot-scope='{row}'>{{row.reportdate?formatterTime(row.reportdate): '--'}}</template>
  110. </el-table-column>
  111. <el-table-column prop='sjjssj' label='验收时间' width='140'>
  112. <template slot-scope='{row}'>{{row.sjjssj?formatterTime(row.sjjssj): '--'}}</template>
  113. </el-table-column>
  114. <el-table-column prop='wonum' label='工单编号' show-overflow-tooltip resizable width='80'>
  115. <template slot-scope='{row}'>
  116. <div v-if='row.wonum' @click.stop='staff' style='cursor:pointer;color: #0091ff;'>{{row.wonum}}</div>
  117. <div v-else>{{'--'}}</div>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. </div>
  122. <div class='foot'>
  123. <el-pagination
  124. background
  125. layout='prev, pager, next'
  126. :total='total'
  127. :page-size='size'
  128. @prev-click='pageChanged'
  129. @next-click='pageChanged'
  130. @current-change='pageChanged'
  131. ></el-pagination>
  132. <pic-large :imgUrl='imgUrl' ref='picLargeOpen'></pic-large>
  133. </div>
  134. </div>
  135. </template>
  136. <script>
  137. import { queryWx } from '@/api/equipmentList.js'
  138. import { mapGetters } from 'vuex'
  139. import inputDialog from './inputDIalog'
  140. import { Select } from 'meri-design'
  141. import { formatterTime, number_format } from '@/utils/format.js'
  142. export default {
  143. components: { Select, inputDialog },
  144. data() {
  145. return {
  146. tableData: [],
  147. total: 0,
  148. currentPage: 1,
  149. size: 10,
  150. reportdate: '',
  151. sjjssj: '',
  152. ischange: '2',
  153. sbjc: '',
  154. matters: '',
  155. wonum: '',
  156. formatterTime,
  157. number_format,
  158. imgUrl: [],
  159. changeOption: [
  160. {
  161. id: '2',
  162. name: '全部'
  163. },
  164. {
  165. id: '1',
  166. name: '是'
  167. },
  168. {
  169. id: '0',
  170. name: '否'
  171. }
  172. ],
  173. keyword: '',
  174. tableMaxHeight: 0
  175. }
  176. },
  177. computed: {
  178. ...mapGetters(['floorSelect'])
  179. },
  180. props: ['smsxt', 'major', 'diff', 'tabLabel'],
  181. methods: {
  182. //序号的方法
  183. indexMethod(index) {
  184. return (this.currentPage - 1) * this.size + index + 1
  185. },
  186. innerTable(row) {
  187. if (row.workorderid) {
  188. window.open(`http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=JXWO&uniqueid=${row.workorderid}`)
  189. }
  190. },
  191. //跳转工单编号
  192. staff(row) {
  193. if (row.wonum) {
  194. window.open(`http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=JXWO&uniqueid=${row.wonum}`)
  195. }
  196. },
  197. //多余输入框监听
  198. confirm(wonum) {
  199. this.wonum = wonum
  200. this.getList()
  201. },
  202. pageChanged(page) {
  203. this.currentPage = page
  204. this.getList()
  205. },
  206. getList() {
  207. let getParams = {
  208. data: {
  209. smsxt: this.smsxt,
  210. diff: this.diff,
  211. plazaId: this.$store.state.plazaId,
  212. page: this.currentPage,
  213. size: this.size
  214. }
  215. }
  216. //下拉
  217. if (this.ischange && this.ischange != 2) {
  218. getParams.data.ismodel = this.ischange
  219. // getParams.data.ischangepj = this.ischange
  220. }
  221. if (this.sjjssj) {
  222. getParams.data.sjjssjStartDate = this.sjjssj[0] + '000000'
  223. getParams.data.sjjssjEndDate = this.sjjssj[1] + '000000'
  224. }
  225. if (this.reportdate) {
  226. getParams.data.reportdateStartDate = this.reportdate[0] + '000000'
  227. getParams.data.reportdateEndDate = this.reportdate[1] + '000000'
  228. }
  229. //输入框搜索
  230. getParams.data.keyword = ''
  231. if (this.sbjc) {
  232. getParams.data.keyword += `${this.sbjc}:sbmc,assetnum;`
  233. }
  234. if (this.matters) {
  235. getParams.data.keyword += `${this.matters}:description,matters;`
  236. }
  237. if (this.wonum) {
  238. getParams.data.keyword += `${this.wonum}:wonum`
  239. }
  240. if (getParams.data.keyword == '') {
  241. delete getParams.data.keyword
  242. }
  243. queryWx(getParams).then(res => {
  244. this.tableData = res.data || []
  245. this.total = res.count
  246. })
  247. },
  248. clickPic(row) {
  249. this.imgUrl = []
  250. if (row) {
  251. row.forEach(el => {
  252. let obj = {
  253. name: el.description,
  254. url: el.url
  255. }
  256. this.imgUrl.push(obj)
  257. })
  258. }
  259. this.$refs.picLargeOpen.open(this.imgUrl)
  260. }
  261. },
  262. watch: {
  263. diff(newV, oldV) {
  264. if (newV !== oldV) {
  265. this.getList()
  266. this.$nextTick(() => {
  267. // 页面渲染完成后的回调
  268. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  269. })
  270. }
  271. },
  272. tabLabel(newV, oldV) {
  273. if (newV !== oldV) {
  274. // this.tabFind()
  275. this.getList()
  276. this.$nextTick(() => {
  277. // 页面渲染完成后的回调
  278. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  279. })
  280. }
  281. },
  282. ischange() {
  283. this.getList()
  284. }
  285. },
  286. mounted() {
  287. this.getList()
  288. this.$nextTick(() => {
  289. // 页面渲染完成后的回调
  290. this.tableMaxHeight = this.$refs.tableBox.offsetHeight
  291. })
  292. }
  293. }
  294. </script>
  295. <style lang="less" scoped>
  296. .wx-list {
  297. .eq-list-top {
  298. display: flex;
  299. margin-bottom: 12px;
  300. .picker-box {
  301. display: flex;
  302. align-items: center;
  303. background: #fff;
  304. padding: 0 6px;
  305. border: 1px solid #dcdfe6;
  306. border-radius: 4px;
  307. height: 32px;
  308. box-sizing: border-box;
  309. margin-right: 12px;
  310. .picker-span {
  311. margin-right: 6px;
  312. color: rgba(0, 0, 0, 0.65);
  313. }
  314. }
  315. }
  316. td {
  317. overflow: hidden;
  318. text-overflow: ellipsis;
  319. white-space: nowrap;
  320. }
  321. .foot {
  322. height: 32px;
  323. display: flex;
  324. justify-content: flex-end;
  325. margin-top: 28px;
  326. }
  327. }
  328. </style>
  329. <style lang="less" >
  330. .wx-list {
  331. .picker-box {
  332. .el-input__inner {
  333. border: none;
  334. }
  335. .el-range-editor.el-input__inner {
  336. padding: 3px 0px;
  337. }
  338. .el-icon-date {
  339. display: none;
  340. }
  341. .el-range__close-icon {
  342. position: absolute;
  343. right: 0px;
  344. top: 2px;
  345. }
  346. .el-range-editor--mini .el-range-input {
  347. font-size: 14px;
  348. color: rgb(31, 36, 41);
  349. }
  350. }
  351. /deep/.el-table tr {
  352. cursor: pointer;
  353. }
  354. }
  355. </style>