SpecificationUpdateRecord.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <!-- 说明书更新记录 -->
  2. <template>
  3. <div class="specification-update-record">
  4. <div class="screening-condition">
  5. <Select
  6. style="margin-right: 12px;"
  7. width="200"
  8. :isReadOnly="true"
  9. tipPlace="top"
  10. caption="事件类型:"
  11. @change="changeTablePage(1)"
  12. v-model="incidentType"
  13. :selectdata="incidentList"
  14. :placeholder="'请选择'"
  15. hideClear
  16. />
  17. <el-date-picker
  18. v-model="timeVal"
  19. type="daterange"
  20. range-separator="至"
  21. start-placeholder="开始日期"
  22. end-placeholder="结束日期"
  23. @change="changeTime">
  24. </el-date-picker>
  25. </div>
  26. <el-table :data="tableData" style="margin-bottom: 19px" @row-click="changeToSystem">
  27. <el-table-column property="time" label="日期"></el-table-column>
  28. <el-table-column property="evenType" label="事项类型"></el-table-column>
  29. <el-table-column property="objid" label="编号"></el-table-column>
  30. <el-table-column property="content" label="更新内容"></el-table-column>
  31. </el-table>
  32. <div class="page">
  33. <el-pagination
  34. background
  35. layout="prev, pager, next"
  36. :current-page="curPage"
  37. :page-size="pageSize"
  38. :total="tatol"
  39. @current-change="changeTablePage">
  40. </el-pagination>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { getSpecificaltionData, queryEventypes } from '../../api/specificationUpdateRecord';
  46. import moment from 'moment';
  47. import _ from 'lodash';
  48. export default {
  49. data () {
  50. return {
  51. plazaId: 1000423, // 广场id
  52. incidentList: [], // 事件列表
  53. oraginIncidentList: [
  54. {id: 'all', name: '全部'},
  55. {id: 0, name: '专维'},
  56. {id: 1, name: '维保'},
  57. {id: 2, name: '第三方检测'},
  58. {id: 3, name: '重点关注'},
  59. ], // 事件列表字典表
  60. incidentType: 'all', // 事件类型
  61. timeVal: '', // 时间
  62. tableData: [], // 表数据
  63. curPage: 1, // 当前页码
  64. pageSize: 10, // 每页条数
  65. tatol: 0, // 数据总量
  66. startTime: null, // 开始时间
  67. endTime: null, // 结束事件
  68. }
  69. },
  70. components: {},
  71. computed: {},
  72. beforeMount() {
  73. let PLAZAID = localStorage.getItem('PLAZAID');
  74. this.plazaId = Number(PLAZAID) || 1000423;
  75. },
  76. mounted() {
  77. this.initTimePicker();
  78. this.getEvenType();
  79. },
  80. methods: {
  81. /**
  82. * 初始化时间
  83. */
  84. initTimePicker() {
  85. let endTime = new Date(),
  86. startTime = new Date(endTime.getTime() - 1000*60*60*24*30);
  87. this.timeVal = [startTime, endTime];
  88. this.startTime = moment.unix(new Date(startTime).getTime() / 1000).format('YYYYMMDDHHmmss');
  89. this.endTime = moment.unix(new Date(endTime).getTime() / 1000).format('YYYYMMDDHHmmss');
  90. },
  91. /**
  92. * 获取事件类型
  93. */
  94. getEvenType() {
  95. let query = {
  96. tableName: 'rpt_change_record',
  97. columnName: {
  98. objtype: 'objtype'
  99. }
  100. }
  101. queryEventypes(`/data/base/queryOptions?plazaId=${this.plazaId}`, [query]).then((res) => {
  102. const { result, data } = res;
  103. if (result === 'success') {
  104. let newData = [this.oraginIncidentList[0]];
  105. if (!_.isEmpty(data)) {
  106. _.forEach(data.rpt_change_record.objtype, (item) => {
  107. newData.push({
  108. id: item.key,
  109. name: _.find(this.oraginIncidentList, (o) => {return item.key === o.id}).name
  110. })
  111. })
  112. this.incidentList = newData;
  113. this.getTableData();
  114. }
  115. }
  116. })
  117. },
  118. /**
  119. * 获取表数据
  120. */
  121. getTableData() {
  122. let param = {
  123. page: this.curPage,
  124. size: this.pageSize,
  125. plazaId: this.plazaId,
  126. changeDateStartDate: this.startTime,
  127. changeDateEndDate: this.endTime,
  128. }
  129. if (this.incidentType !== 'all') {
  130. param.objtype = this.incidentType;
  131. }
  132. getSpecificaltionData('/data/rpt_change_record/query', param).then((res) => {
  133. const { result, data, count } = res;
  134. if (result === 'success') {
  135. this.tatol = count;
  136. _.map(data, (item) => {
  137. let text = _.find(this.incidentList, (o) => {return o.id === item.objtype}).name
  138. item.evenType = text;
  139. item.time = moment.unix(item.changedate / 1000).format('YYYY.MM.DD')
  140. return
  141. })
  142. this.tableData = data;
  143. }
  144. })
  145. },
  146. /**
  147. * 切换页码
  148. */
  149. changeTablePage(page) {
  150. this.curPage = page;
  151. this.getTableData();
  152. },
  153. /**
  154. * 切换时间
  155. */
  156. changeTime() {
  157. this.curPage = 1;
  158. if (this.timeVal) {
  159. this.startTime = moment.unix(new Date(this.timeVal[0]).getTime() / 1000).format('YYYYMMDDHHmmss');
  160. this.endTime = moment.unix(new Date(this.timeVal[1]).getTime() / 1000).format('YYYYMMDDHHmmss');
  161. } else {
  162. this.startTime = 20171027000000;
  163. this.endTime = 20171028000000;
  164. }
  165. this.getTableData();
  166. },
  167. /**
  168. * 跳转到工程信息化系统
  169. */
  170. changeToSystem(row) {
  171. const { objtype } = row;
  172. let url;
  173. switch (objtype) {
  174. case 0: // 专维
  175. url = `http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=GCZXWXLINE&uniqueid=${row.id}`;
  176. break
  177. case 1: // 维保
  178. let value;
  179. if (row.apptype === '外委' || row.apptype === '自维') {
  180. value = 'WB_GZGL';
  181. } else if (row.apptype === '安全维保') {
  182. value = 'AQ_WB_GZGL';
  183. } else {
  184. return
  185. }
  186. url = `http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=${value}&uniqueid=${row.id}`;
  187. break
  188. case 2: // 第三方视图
  189. url = `http://gcgl.wanda.cn/maximo/ui/?event=loadapp&value=DSF_GZGL&uniqueid=${row.id}`;
  190. break
  191. }
  192. window.open(url, '_blank');
  193. }
  194. },
  195. }
  196. </script>
  197. <style lang='less' scoped>
  198. .specification-update-record{
  199. padding-left: 16px;
  200. padding-right: 16px;
  201. padding-top: 12px;
  202. padding-bottom: 20px;
  203. background: #fff;
  204. height: 100%;
  205. width: 100%;
  206. .screening-condition{
  207. margin-bottom: 13px;
  208. display: flex;
  209. }
  210. .page{
  211. display: flex;
  212. justify-content: flex-end;
  213. }
  214. }
  215. </style>