incidentList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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. assignee: that.loginUser.account,
  224. state: that.stateValue,
  225. idx: 0,
  226. sum: 10,
  227. })
  228. .then(function (res) {
  229. if (res.data.data.length > 0) {
  230. for (var i = 0; i < res.data.data.length; i++) {
  231. res.data.data[i].createTime = formatDate(
  232. new Date(res.data.data[i].createTime),
  233. "yyyy-MM-dd hh:mm"
  234. );
  235. }
  236. that.items = res.data.data;
  237. that.wushuju = false;
  238. } else {
  239. that.wushuju = true;
  240. }
  241. that.loadShow = false;
  242. });
  243. },
  244. toIncidentDetails(data) {
  245. this.$router.push({
  246. name: "IncidentDetails",
  247. params: {
  248. data: JSON.stringify(data),
  249. },
  250. });
  251. },
  252. onPullingDown() {
  253. // 模拟更新数据
  254. this.idx = 0;
  255. setTimeout(() => {
  256. var that = this;
  257. // that.items=[];
  258. this.$http
  259. .post("service/apply/bpm/fetchServiceTasks", {
  260. assignee: that.loginUser.account,
  261. state: that.stateValue,
  262. idx: 0,
  263. sum: 10,
  264. })
  265. .then(function (res) {
  266. if (res.data.data.length > 0) {
  267. that.wushuju = false;
  268. for (var i = 0; i < res.data.data.length; i++) {
  269. res.data.data[i].createTime = formatDate(
  270. new Date(res.data.data[i].createTime),
  271. "yyyy-MM-dd hh:mm"
  272. );
  273. }
  274. that.items = res.data.data;
  275. } else {
  276. that.wushuju = true;
  277. that.$refs.scroll.forceUpdate();
  278. }
  279. });
  280. }, 1000);
  281. },
  282. getData(idx, sum) {
  283. var that = this;
  284. this.$http
  285. .post("service/apply/bpm/fetchServiceTasks", {
  286. assignee: that.loginUser.account,
  287. state: that.stateValue,
  288. idx: idx,
  289. sum: sum,
  290. })
  291. .then(function (res) {
  292. if (res.data.data.length > 0) {
  293. that.wushuju = false;
  294. for (var i = 0; i < res.data.data.length; i++) {
  295. res.data.data[i].createTime = formatDate(
  296. new Date(res.data.data[i].createTime),
  297. "yyyy-MM-dd hh:mm"
  298. );
  299. }
  300. that.items = res.data.data;
  301. } else {
  302. that.wushuju = true;
  303. }
  304. that.loadShow = false;
  305. });
  306. },
  307. onPullingUp() {
  308. var that = this;
  309. that.idx = that.idx + 1;
  310. this.$http
  311. .post("service/apply/bpm/fetchServiceTasks", {
  312. assignee: that.loginUser.account,
  313. state: that.stateValue,
  314. idx: that.idx,
  315. sum: that.sum,
  316. })
  317. .then(function (res) {
  318. for (var i = 0; i < res.data.data.length; i++) {
  319. res.data.data[i].createTime = formatDate(
  320. new Date(res.data.data[i].createTime),
  321. "yyyy-MM-dd hh:mm"
  322. );
  323. }
  324. setTimeout(() => {
  325. if (res.data.data.length > 0) {
  326. that.items = that.items.concat(res.data.data);
  327. } else {
  328. that.$refs.scroll.forceUpdate();
  329. }
  330. }, 1000);
  331. });
  332. },
  333. updatePullDownRefresh(val) {
  334. this.pullDownRefresh = val;
  335. },
  336. updatePullDownRefreshThreshold(val) {
  337. this.pullDownRefreshThreshold = val;
  338. },
  339. updatePullDownRefreshTxt(val) {
  340. this.pullDownRefreshTxt = val;
  341. },
  342. updatePullUpLoad(val) {
  343. this.pullUpLoad = val;
  344. },
  345. updatePullUpLoadThreshold(val) {
  346. this.pullUpLoadThreshold = val;
  347. },
  348. updatePullUpLoadMoreTxt(val) {
  349. this.pullUpLoadMoreTxt = val;
  350. },
  351. updatePullUpLoadNoMoreTxt(val) {
  352. this.pullUpLoadNoMoreTxt = val;
  353. },
  354. updateCustomPullDown(val) {
  355. this.customPullDown = val;
  356. },
  357. rebuildScroll() {
  358. Vue.nextTick(() => {
  359. this.$refs.scroll.destroy();
  360. this.$refs.scroll.initScroll();
  361. });
  362. },
  363. },
  364. created() {
  365. this.getParamsState();
  366. this.getData(this.idx, this.sum);
  367. },
  368. };
  369. </script>
  370. <style lang="stylus" rel="stylesheet/stylus" scoped>
  371. .scroll-list-wrap {
  372. /* height: 350px */
  373. height: 95vh;
  374. /* border: 1px solid rgba(0, 0, 0, 0.1) */
  375. border-radius: 5px;
  376. transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
  377. overflow: hidden;
  378. }
  379. .foods-wrapper {
  380. .food-item {
  381. display: flex;
  382. /* padding: 18px */
  383. /* border-bottom: 1px solid rgba(7, 17, 27, 0.1) */
  384. /* border-top: 1px solid rgba(7, 17, 27, 0.1)!important */
  385. &:last-child {
  386. border-none();
  387. margin-bottom: 0;
  388. }
  389. .icon {
  390. flex: 0 0 57px;
  391. margin-right: 10px;
  392. }
  393. .food-content {
  394. flex: 1;
  395. .name {
  396. margin: 2px 0 8px 0;
  397. height: 14px;
  398. line-height: 14px;
  399. font-size: 14px;
  400. color: rgb(7, 17, 27);
  401. }
  402. .description, .extra {
  403. line-height: 10px;
  404. font-size: 10px;
  405. color: rgb(147, 153, 159);
  406. }
  407. .description {
  408. line-height: 12px;
  409. margin-bottom: 8px;
  410. }
  411. .extra {
  412. .count {
  413. margin-right: 12px;
  414. }
  415. }
  416. .price {
  417. font-weight: 700;
  418. line-height: 24px;
  419. .now {
  420. margin-right: 8px;
  421. font-size: 14px;
  422. color: rgb(240, 20, 20);
  423. }
  424. .old {
  425. text-decoration: line-through;
  426. font-size: 10px;
  427. color: rgb(147, 153, 159);
  428. }
  429. }
  430. .cartcontrol-wrapper {
  431. position: absolute;
  432. right: 0;
  433. bottom: 12px;
  434. .scroll-wrapper {
  435. .cube-pulldown-wrapper {
  436. .before-trigger {
  437. font-size: 30px;
  438. line-height: 30px;
  439. align-self: flex-end;
  440. span {
  441. display: inline-block;
  442. transition: all 0.3s;
  443. color: #666;
  444. &.rotate {
  445. transform: rotate(180deg);
  446. }
  447. }
  448. }
  449. .after-trigger {
  450. .refresh-text {
  451. color: grey;
  452. }
  453. }
  454. }
  455. }
  456. }
  457. }
  458. }
  459. }
  460. </style>
  461. <style scoped>
  462. .bgColor {
  463. background-color: white;
  464. }
  465. .food-item {
  466. border-top: 0.16rem rgb(238, 238, 238) solid;
  467. }
  468. .food-content {
  469. border-top: 0.01rem rgb(223, 222, 222) solid;
  470. border-bottom: 0.01rem rgb(223, 222, 222) solid;
  471. }
  472. .cube-select {
  473. height: 0.88rem;
  474. line-height: 0.88rem;
  475. padding: 0 0.24rem;
  476. font-size: 0.36rem;
  477. color: #333333;
  478. }
  479. .title {
  480. display: flex;
  481. justify-content: space-between;
  482. height: 0.7rem;
  483. line-height: 0.7rem;
  484. border-top: 0.01rem rgb(223, 222, 222) solid;
  485. padding: 0 0.24rem;
  486. border-bottom: 0.01rem rgb(223, 222, 222) solid;
  487. }
  488. .title i {
  489. font-size: 0.32rem;
  490. color: #005395;
  491. }
  492. .title div:nth-child(1) {
  493. font-size: 0.32rem;
  494. }
  495. .title div:nth-child(1) span {
  496. display: inline-block;
  497. margin-left: 0.08rem;
  498. }
  499. .title div:nth-child(2) {
  500. padding: 0.05rem 0.3rem;
  501. /* border: 0.01rem rgb(0,0,255) solid; */
  502. border-radius: 16px;
  503. /* color: rgb(0,0,255); */
  504. height: 0.25rem;
  505. line-height: 0.25rem;
  506. margin-top: 0.15rem;
  507. font-size: 0.24rem;
  508. }
  509. .weishouli {
  510. color: #991f00;
  511. border: 0.01rem #991f00 solid;
  512. background-color: #f4e8e5;
  513. }
  514. .bushouli {
  515. color: #666666;
  516. background-color: #eeeeee;
  517. border: 0.01rem #666666 solid;
  518. }
  519. .chulizhong {
  520. color: #003057;
  521. background-color: #e5eaee;
  522. border: 0.01rem #003057 solid;
  523. }
  524. .daipingjia {
  525. color: #825b00;
  526. background-color: #f2eee5;
  527. border: 0.01rem #825b00 solid;
  528. }
  529. .yijiejue {
  530. color: #40a19c;
  531. background-color: #ebf5f5;
  532. border: 0.01rem #40a19c solid;
  533. }
  534. .yichehui {
  535. color: #48a843;
  536. background-color: #ecf6ec;
  537. border: 0.01rem #48a843 solid;
  538. }
  539. .conent {
  540. font-size: 0.28rem;
  541. line-height: 0.39rem;
  542. overflow: hidden;
  543. display: -webkit-box;
  544. -webkit-line-clamp: 2;
  545. -webkit-box-orient: vertical;
  546. word-break: break-all;
  547. padding: 0 0.64rem;
  548. margin: 0.24rem 0;
  549. }
  550. .timeBox {
  551. display: flex;
  552. justify-content: space-between;
  553. font-size: 0.24rem;
  554. color: #999999;
  555. height: 0.7rem;
  556. line-height: 0.7rem;
  557. padding: 0 0.24rem 0 0.24rem;
  558. border-top: 0.01rem rgb(223, 222, 222) solid;
  559. }
  560. .timeBox.noneBorder {
  561. border-top: none;
  562. }
  563. .wushuju {
  564. margin-top: 2.4rem;
  565. text-align: center;
  566. }
  567. .wushuju img {
  568. width: 5.12rem;
  569. height: 2.84rem;
  570. }
  571. </style>