incidentList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <template>
  2. <div class="bgColor">
  3. <div slot="content" class="scroll-wrapper">
  4. <div class="demo">
  5. <div class="scroll-list-wrap">
  6. <cube-scroll
  7. ref="scroll"
  8. :data="items"
  9. :options="options"
  10. @pulling-down="onPullingDown"
  11. @pulling-up="onPullingUp"
  12. >
  13. <cube-select
  14. v-model="stateValue"
  15. :options="stateData"
  16. @change="stateChange()"
  17. >
  18. </cube-select>
  19. <ul class="foods-wrapper">
  20. <li
  21. v-for="data in items"
  22. class="food-item border-1px"
  23. @click="toIncidentDetails(data)"
  24. >
  25. <div class="food-content">
  26. <div class="title">
  27. <div>
  28. <i class="iconfont icon-baoxiuliebiao"></i
  29. ><span>申请编号:&nbsp;{{ data.bxcode || "暂无" }}</span>
  30. </div>
  31. <div :class="stateClassFn(data.state.name)">
  32. {{ data.state.name }}
  33. </div>
  34. </div>
  35. <div class="conent">
  36. {{ data.description }}
  37. </div>
  38. <div class="timeBox">
  39. <div>
  40. 维修人:&nbsp;{{
  41. data.incident.handlingPersonnelUser
  42. ? data.incident.handlingPersonnelUser.name
  43. : "暂无"
  44. }}
  45. </div>
  46. <div>申请时间:&nbsp;{{ data.createTime }}</div>
  47. </div>
  48. <div
  49. class="timeBox noneBorder"
  50. v-if="wxIncidentWithCmdb == 1"
  51. >
  52. <div>资产:&nbsp;{{ data.assetId || "无" }}</div>
  53. </div>
  54. </div>
  55. </li>
  56. <div class="wushuju" v-show="wushuju">
  57. <img src="./../../static/images/wushuju.svg" alt="" />
  58. <div class="noDataFont">暂无数据</div>
  59. </div>
  60. </ul>
  61. <template v-if="customPullDown" slot="pulldown" slot-scope="props">
  62. <div
  63. v-if="props.pullDownRefresh"
  64. class="cube-pulldown-wrapper"
  65. :style="props.pullDownStyle"
  66. >
  67. <div
  68. v-show="props.beforePullDown"
  69. class="before-trigger"
  70. :style="{ paddingTop: props.bubbleY + 'px' }"
  71. >
  72. <span
  73. :class="{
  74. rotate: props.bubbleY > pullDownRefreshThreshold - 40,
  75. }"
  76. >↓</span
  77. >
  78. </div>
  79. <div class="after-trigger" v-show="!props.beforePullDown">
  80. <div v-show="props.isPullingDown" class="loading">
  81. <cube-loading></cube-loading>
  82. </div>
  83. <div v-show="!props.isPullingDown" class="text">
  84. <span class="refresh-text">更新成功</span>
  85. </div>
  86. </div>
  87. </div>
  88. </template>
  89. </cube-scroll>
  90. </div>
  91. </div>
  92. </div>
  93. <load-ing v-show="loadShow"></load-ing>
  94. </div>
  95. </template>
  96. <script>
  97. import Vue from "vue";
  98. import CubePage from "../components/cube-page.vue";
  99. import SwitchOption from "../components/switch-option";
  100. import InputOption from "../components/input-option";
  101. import SelectOption from "../components/select-option";
  102. import { formatDate } from "./../components/js/date.js";
  103. import LoadIng from "./../views/loading.vue";
  104. export default {
  105. data() {
  106. return {
  107. // items: _foods,
  108. incidentWithConsumable: localStorage.getItem("incidentWithConsumable"), //是否绑定耗材
  109. wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"), //是否绑定资产
  110. loginUser: JSON.parse(localStorage.getItem("loginUser")),
  111. items: [],
  112. pullDownRefresh: true,
  113. pullDownRefreshThreshold: 60,
  114. pullDownRefreshStop: 40,
  115. pullDownRefreshTxt: "Refresh success",
  116. pullUpLoad: true,
  117. pullUpLoadThreshold: 0,
  118. pullUpLoadMoreTxt: "Load more",
  119. pullUpLoadNoMoreTxt: "没有更多数据",
  120. customPullDown: true,
  121. wushuju: false,
  122. stateData: [
  123. {
  124. text: "全部",
  125. value: 0,
  126. },
  127. {
  128. text: "未受理",
  129. value: 1592,
  130. },
  131. {
  132. text: "不受理",
  133. value: 1593,
  134. },
  135. {
  136. text: "处理中",
  137. value: 1594,
  138. },
  139. {
  140. text: "待评价",
  141. value: 1595,
  142. },
  143. {
  144. text: "已解决",
  145. value: 1596,
  146. },
  147. {
  148. text: "已撤回",
  149. value: 1597,
  150. },
  151. ],
  152. stateValue: 0,
  153. sum: 10,
  154. idx: 0,
  155. stateClass: "",
  156. loadShow: true,
  157. };
  158. },
  159. components: {
  160. CubePage,
  161. SwitchOption,
  162. InputOption,
  163. SelectOption,
  164. LoadIng,
  165. },
  166. computed: {
  167. options() {
  168. return {
  169. pullDownRefresh: this.pullDownRefreshObj,
  170. pullUpLoad: this.pullUpLoadObj,
  171. scrollbar: true,
  172. };
  173. },
  174. pullDownRefreshObj: function () {
  175. return this.pullDownRefresh
  176. ? {
  177. threshold: parseInt(this.pullDownRefreshThreshold),
  178. txt: this.pullDownRefreshTxt,
  179. }
  180. : false;
  181. },
  182. pullUpLoadObj: function () {
  183. return this.pullUpLoad
  184. ? {
  185. threshold: parseInt(this.pullUpLoadThreshold),
  186. txt: {
  187. more: this.pullUpLoadMoreTxt,
  188. noMore: this.pullUpLoadNoMoreTxt,
  189. },
  190. }
  191. : false;
  192. },
  193. },
  194. methods: {
  195. getParamsState() {
  196. if (this.$route.params.state) {
  197. this.stateValue = this.$route.params.state;
  198. }
  199. },
  200. stateClassFn(data) {
  201. if (data == "未受理") {
  202. return "weishouli";
  203. } else if (data == "不受理") {
  204. return "bushouli";
  205. } else if (data == "处理中") {
  206. return "chulizhong";
  207. } else if (data == "待评价") {
  208. return "daipingjia";
  209. } else if (data == "已解决") {
  210. return "yijiejue";
  211. } else if (data == "已撤回") {
  212. return "yichehui";
  213. } else {
  214. return "yichehui";
  215. }
  216. },
  217. stateChange() {
  218. var that = this;
  219. this.loadShow = true;
  220. that.items = [];
  221. this.$http
  222. .post("service/apply/bpm/fetchServiceTasks", {
  223. state: that.stateValue,
  224. idx: 0,
  225. sum: 10,
  226. })
  227. .then(function (res) {
  228. if (res.data.data.length > 0) {
  229. for (var i = 0; i < res.data.data.length; i++) {
  230. res.data.data[i].createTime = formatDate(
  231. new Date(res.data.data[i].createTime),
  232. "yyyy-MM-dd hh:mm"
  233. );
  234. }
  235. that.items = res.data.data;
  236. that.wushuju = false;
  237. } else {
  238. that.wushuju = true;
  239. }
  240. that.loadShow = false;
  241. });
  242. },
  243. toIncidentDetails(data) {
  244. this.$router.push({
  245. name: "IncidentDetails",
  246. params: {
  247. data: JSON.stringify(data),
  248. },
  249. });
  250. },
  251. onPullingDown() {
  252. // 模拟更新数据
  253. this.idx = 0;
  254. setTimeout(() => {
  255. var that = this;
  256. // that.items=[];
  257. this.$http
  258. .post("service/apply/bpm/fetchServiceTasks", {
  259. state: that.stateValue,
  260. idx: 0,
  261. sum: 10,
  262. })
  263. .then(function (res) {
  264. if (res.data.data.length > 0) {
  265. that.wushuju = false;
  266. for (var i = 0; i < res.data.data.length; i++) {
  267. res.data.data[i].createTime = formatDate(
  268. new Date(res.data.data[i].createTime),
  269. "yyyy-MM-dd hh:mm"
  270. );
  271. }
  272. that.items = res.data.data;
  273. } else {
  274. that.wushuju = true;
  275. that.$refs.scroll.forceUpdate();
  276. }
  277. });
  278. }, 1000);
  279. },
  280. getData(idx, sum) {
  281. var that = this;
  282. this.$http
  283. .post("service/apply/bpm/fetchServiceTasks", {
  284. state: that.stateValue,
  285. idx: idx,
  286. sum: sum,
  287. })
  288. .then(function (res) {
  289. if (res.data.data.length > 0) {
  290. that.wushuju = false;
  291. for (var i = 0; i < res.data.data.length; i++) {
  292. res.data.data[i].createTime = formatDate(
  293. new Date(res.data.data[i].createTime),
  294. "yyyy-MM-dd hh:mm"
  295. );
  296. }
  297. that.items = res.data.data;
  298. } else {
  299. that.wushuju = true;
  300. }
  301. that.loadShow = false;
  302. });
  303. },
  304. onPullingUp() {
  305. var that = this;
  306. that.idx = that.idx + 1;
  307. this.$http
  308. .post("service/apply/bpm/fetchServiceTasks", {
  309. state: that.stateValue,
  310. idx: that.idx,
  311. sum: that.sum,
  312. })
  313. .then(function (res) {
  314. for (var i = 0; i < res.data.data.length; i++) {
  315. res.data.data[i].createTime = formatDate(
  316. new Date(res.data.data[i].createTime),
  317. "yyyy-MM-dd hh:mm"
  318. );
  319. }
  320. setTimeout(() => {
  321. if (res.data.data.length > 0) {
  322. that.items = that.items.concat(res.data.data);
  323. } else {
  324. that.$refs.scroll.forceUpdate();
  325. }
  326. }, 1000);
  327. });
  328. },
  329. updatePullDownRefresh(val) {
  330. this.pullDownRefresh = val;
  331. },
  332. updatePullDownRefreshThreshold(val) {
  333. this.pullDownRefreshThreshold = val;
  334. },
  335. updatePullDownRefreshTxt(val) {
  336. this.pullDownRefreshTxt = val;
  337. },
  338. updatePullUpLoad(val) {
  339. this.pullUpLoad = val;
  340. },
  341. updatePullUpLoadThreshold(val) {
  342. this.pullUpLoadThreshold = val;
  343. },
  344. updatePullUpLoadMoreTxt(val) {
  345. this.pullUpLoadMoreTxt = val;
  346. },
  347. updatePullUpLoadNoMoreTxt(val) {
  348. this.pullUpLoadNoMoreTxt = val;
  349. },
  350. updateCustomPullDown(val) {
  351. this.customPullDown = val;
  352. },
  353. rebuildScroll() {
  354. Vue.nextTick(() => {
  355. this.$refs.scroll.destroy();
  356. this.$refs.scroll.initScroll();
  357. });
  358. },
  359. },
  360. created() {
  361. this.getParamsState();
  362. this.getData(this.idx, this.sum);
  363. },
  364. };
  365. </script>
  366. <style lang="stylus" rel="stylesheet/stylus" scoped>
  367. .scroll-list-wrap {
  368. /* height: 350px */
  369. height: 95vh;
  370. /* border: 1px solid rgba(0, 0, 0, 0.1) */
  371. border-radius: 5px;
  372. transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
  373. overflow: hidden;
  374. }
  375. .foods-wrapper {
  376. .food-item {
  377. display: flex;
  378. /* padding: 18px */
  379. /* border-bottom: 1px solid rgba(7, 17, 27, 0.1) */
  380. /* border-top: 1px solid rgba(7, 17, 27, 0.1)!important */
  381. &:last-child {
  382. border-none();
  383. margin-bottom: 0;
  384. }
  385. .icon {
  386. flex: 0 0 57px;
  387. margin-right: 10px;
  388. }
  389. .food-content {
  390. flex: 1;
  391. .name {
  392. margin: 2px 0 8px 0;
  393. height: 14px;
  394. line-height: 14px;
  395. font-size: 14px;
  396. color: rgb(7, 17, 27);
  397. }
  398. .description, .extra {
  399. line-height: 10px;
  400. font-size: 10px;
  401. color: rgb(147, 153, 159);
  402. }
  403. .description {
  404. line-height: 12px;
  405. margin-bottom: 8px;
  406. }
  407. .extra {
  408. .count {
  409. margin-right: 12px;
  410. }
  411. }
  412. .price {
  413. font-weight: 700;
  414. line-height: 24px;
  415. .now {
  416. margin-right: 8px;
  417. font-size: 14px;
  418. color: rgb(240, 20, 20);
  419. }
  420. .old {
  421. text-decoration: line-through;
  422. font-size: 10px;
  423. color: rgb(147, 153, 159);
  424. }
  425. }
  426. .cartcontrol-wrapper {
  427. position: absolute;
  428. right: 0;
  429. bottom: 12px;
  430. .scroll-wrapper {
  431. .cube-pulldown-wrapper {
  432. .before-trigger {
  433. font-size: 30px;
  434. line-height: 30px;
  435. align-self: flex-end;
  436. span {
  437. display: inline-block;
  438. transition: all 0.3s;
  439. color: #666;
  440. &.rotate {
  441. transform: rotate(180deg);
  442. }
  443. }
  444. }
  445. .after-trigger {
  446. .refresh-text {
  447. color: grey;
  448. }
  449. }
  450. }
  451. }
  452. }
  453. }
  454. }
  455. }
  456. </style>
  457. <style scoped>
  458. .bgColor {
  459. background-color: white;
  460. }
  461. .food-item {
  462. border-top: 0.16rem rgb(238, 238, 238) solid;
  463. }
  464. .food-content {
  465. border-top: 0.01rem rgb(223, 222, 222) solid;
  466. border-bottom: 0.01rem rgb(223, 222, 222) solid;
  467. }
  468. .cube-select {
  469. height: 0.88rem;
  470. line-height: 0.88rem;
  471. padding: 0 0.24rem;
  472. font-size: 0.36rem;
  473. color: #333333;
  474. }
  475. .title {
  476. display: flex;
  477. justify-content: space-between;
  478. height: 0.7rem;
  479. line-height: 0.7rem;
  480. border-top: 0.01rem rgb(223, 222, 222) solid;
  481. padding: 0 0.24rem;
  482. border-bottom: 0.01rem rgb(223, 222, 222) solid;
  483. }
  484. .title i {
  485. font-size: 0.32rem;
  486. color: #005395;
  487. }
  488. .title div:nth-child(1) {
  489. font-size: 0.32rem;
  490. }
  491. .title div:nth-child(1) span {
  492. display: inline-block;
  493. margin-left: 0.08rem;
  494. }
  495. .title div:nth-child(2) {
  496. padding: 0.05rem 0.3rem;
  497. /* border: 0.01rem rgb(0,0,255) solid; */
  498. border-radius: 16px;
  499. /* color: rgb(0,0,255); */
  500. height: 0.25rem;
  501. line-height: 0.25rem;
  502. margin-top: 0.15rem;
  503. font-size: 0.24rem;
  504. }
  505. .weishouli {
  506. color: #991f00;
  507. border: 0.01rem #991f00 solid;
  508. background-color: #f4e8e5;
  509. }
  510. .bushouli {
  511. color: #666666;
  512. background-color: #eeeeee;
  513. border: 0.01rem #666666 solid;
  514. }
  515. .chulizhong {
  516. color: #003057;
  517. background-color: #e5eaee;
  518. border: 0.01rem #003057 solid;
  519. }
  520. .daipingjia {
  521. color: #825b00;
  522. background-color: #f2eee5;
  523. border: 0.01rem #825b00 solid;
  524. }
  525. .yijiejue {
  526. color: #40a19c;
  527. background-color: #ebf5f5;
  528. border: 0.01rem #40a19c solid;
  529. }
  530. .yichehui {
  531. color: #48a843;
  532. background-color: #ecf6ec;
  533. border: 0.01rem #48a843 solid;
  534. }
  535. .conent {
  536. font-size: 0.28rem;
  537. line-height: 0.39rem;
  538. overflow: hidden;
  539. display: -webkit-box;
  540. -webkit-line-clamp: 2;
  541. -webkit-box-orient: vertical;
  542. word-break: break-all;
  543. padding: 0 0.64rem;
  544. margin: 0.24rem 0;
  545. }
  546. .timeBox {
  547. display: flex;
  548. justify-content: space-between;
  549. font-size: 0.24rem;
  550. color: #999999;
  551. height: 0.7rem;
  552. line-height: 0.7rem;
  553. padding: 0 0.24rem 0 0.24rem;
  554. border-top: 0.01rem rgb(223, 222, 222) solid;
  555. }
  556. .timeBox.noneBorder {
  557. border-top: none;
  558. }
  559. .wushuju {
  560. margin-top: 2.4rem;
  561. text-align: center;
  562. }
  563. .wushuju img {
  564. width: 5.12rem;
  565. height: 2.84rem;
  566. }
  567. </style>