list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <template>
  2. <div class="page">
  3. <nav1 :title="`质量问题列表(${unFinish})`" @backClick="backClick">
  4. <img @click="$router.push('/qualityProblemCount')" slot="right" src="../../assets/images/tongji.png" alt="">
  5. </nav1>
  6. <!-- 顶部搜索 -->
  7. <div class="top">
  8. <div style="overflow: hidden">
  9. <input type="text" v-model="search" placeholder="请输入搜索条件" class="search">
  10. <button class="searchButton" @click="onRefresh">
  11. <img :src="searchicon" alt="">
  12. </button>
  13. <div class="right" @click="filterShow = true">
  14. 筛选
  15. <img :src="filtericon" alt="">
  16. </div>
  17. </div>
  18. </div>
  19. <!-- 列表 -->
  20. <div class="list" ref="listMain">
  21. <van-pull-refresh v-model="isRefresh" @refresh="onRefresh">
  22. <van-list v-model="loading" :finished="finished" @load="loadMore" :immediate-check="false"
  23. :finished-text="list.length ? '没有更多了':'无数据'">
  24. <div slot="loading">加载中...</div>
  25. <div class="listItems" v-for="item in list" @click="toDetail(item.id)" style=" overflow: hidden">
  26. <van-swipe-cell>
  27. <div style="width: 100%;" class="listContent">
  28. <div class="listLeft">
  29. <div style="overflow: hidden;margin-bottom: 8px;font-size: 13px">
  30. <span>No.{{ item.id }}</span>
  31. <span class="rightStatus" style="background: #2196F3" v-if="item.status == 0">OPEN</span>
  32. <span class="rightStatus" style="background: #E1E1E1" v-else-if="item.status == 1">CLOSED</span>
  33. <span class="rightStatus" style="background: #FE0000" v-else>TIMEOUT</span>
  34. </div>
  35. <div class="line">
  36. <span style="margin-right:30px">
  37. <span style="color:#ff7c2d" v-if="item.shortDepartmentStatus == 0">
  38. 短期部门:{{ zrbmList[0].filter(a => a.id == item.shortDepartment).length ? zrbmList[0].filter(a => a.id == item.shortDepartment)[0].name : "" }}
  39. <span style="background:#ff7c2d" class="bgspan">待指派</span>
  40. </span>
  41. <span style="color:#FFB403" v-else-if="item.shortDepartmentStatus == 1">
  42. 短期部门:{{ zrbmList[0].filter(a => a.id == item.shortDepartment).length ? zrbmList[0].filter(a => a.id == item.shortDepartment)[0].name : "" }}
  43. <span style="background:#FFB403" class="bgspan">待处理</span>
  44. </span>
  45. <span style="color:#4674C1" v-else-if="item.shortDepartmentStatus == 2">
  46. 短期部门:{{ zrbmList[0].filter(a => a.id == item.shortDepartment).length ? zrbmList[0].filter(a => a.id == item.shortDepartment)[0].name : "" }}
  47. <span style="background: #4674C1" class="bgspan">处理中</span>
  48. </span>
  49. <span style="color:#2196F3" v-else>
  50. 短期部门:{{ zrbmList[0].filter(a => a.id == item.shortDepartment).length ? zrbmList[0].filter(a => a.id == item.shortDepartment)[0].name : "" }}
  51. <span style="background: #2196F3" class="bgspan">已完成</span>
  52. </span>
  53. </span>
  54. <span>
  55. <span style="color:#ff7c2d" v-if="item.longDepartmentStatus == 0">
  56. 长期部门:{{ zrbmList[0].filter(a => a.id == item.longDepartment).length ? zrbmList[0].filter(a => a.id == item.longDepartment)[0].name : "" }}
  57. <span style="background:#ff7c2d" class="bgspan">待指派</span>
  58. </span>
  59. <span style="color:#FFB403" v-else-if="item.longDepartmentStatus == 1">
  60. 长期部门:{{ zrbmList[0].filter(a => a.id == item.longDepartment).length ? zrbmList[0].filter(a => a.id == item.longDepartment)[0].name : "" }}
  61. <span style="background:#FFB403" class="bgspan">待处理</span>
  62. </span>
  63. <span style="color:#4674C1" v-else-if="item.longDepartmentStatus == 2">
  64. 长期部门:{{ zrbmList[0].filter(a => a.id == item.longDepartment).length ? zrbmList[0].filter(a => a.id == item.longDepartment)[0].name : "" }}
  65. <span style="background: #4674C1" class="bgspan">处理中</span>
  66. </span>
  67. <span style="color:#2196F3" v-else>
  68. 长期部门:{{ zrbmList[0].filter(a => a.id == item.longDepartment).length ? zrbmList[0].filter(a => a.id == item.longDepartment)[0].name : "" }}
  69. <span style="background: #2196F3" class="bgspan">已完成</span>
  70. </span>
  71. </span>
  72. </div>
  73. <div class="line">
  74. 描述:{{ item.detail }}
  75. </div>
  76. <div class="line">
  77. <!-- <span style="margin-right:30px">责任部门:质量部门</span> -->
  78. <span>发生时间: {{ item.startTime }}</span>
  79. </div>
  80. </div>
  81. <div class="listRight">
  82. <van-icon name="arrow" />
  83. </div>
  84. </div>
  85. <template #right>
  86. <van-button style="width: 10px;padding: 5px;visibility: hidden" />
  87. <van-button @click="deleteIssue(item.id)" square text="删除" type="danger" class="listButton" />
  88. </template>
  89. </van-swipe-cell>
  90. </div>
  91. </van-list>
  92. </van-pull-refresh>
  93. </div>
  94. <!-- 筛选弹窗 -->
  95. <van-popup v-model="filterShow" position="right" style="width: 75%;height: 100%;overflow-y: auto">
  96. <div style="padding: 10px">
  97. <p class="popTitle">筛选</p>
  98. <div class="selectGroup">
  99. <div class="select" @click="myChange"
  100. :style="{background: filter.my ? '#2196F3':'#F5F5F5', color: filter.my ? '#fff':'#333333'}">
  101. 我的任务
  102. </div>
  103. </div>
  104. <p class="popTitle2">LSSUE状态</p>
  105. <div class="selectGroup">
  106. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  107. <popup-picker show-name title="" placeholder="请选择" :data="statusList" v-model="filter.status"
  108. value-text-align="left">
  109. </popup-picker>
  110. </group>
  111. </div>
  112. <!-- <p class="popTitle2">责任部门</p>
  113. <div class="selectGroup">
  114. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  115. <popup-picker show-name title="" placeholder="请选择" :data="zrbmList" v-model="filter.zrbm"
  116. value-text-align="left">
  117. </popup-picker>
  118. </group>
  119. </div> -->
  120. <!-- from zzp-->
  121. <p class="popTitle2">长期责任部门</p>
  122. <div class="selectGroup">
  123. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  124. <popup-picker show-name title="" placeholder="请选择" :data="zrbmList" v-model="filter.cqzrbm"
  125. value-text-align="left">
  126. </popup-picker>
  127. </group>
  128. </div>
  129. <p class="popTitle2">短期责任部门</p>
  130. <div class="selectGroup">
  131. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  132. <popup-picker show-name title="" placeholder="请选择" :data="zrbmList" v-model="filter.dqzrbm"
  133. value-text-align="left">
  134. </popup-picker>
  135. </group>
  136. </div>
  137. <!---->
  138. <p class="popTitle2">区域</p>
  139. <div class="selectGroup">
  140. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  141. <popup-picker show-name title="" placeholder="请选择" :data="qyList" v-model="filter.qy"
  142. value-text-align="left">
  143. </popup-picker>
  144. </group>
  145. </div>
  146. <!-- <p class="popTitle2">措施状态</p>
  147. <div class="selectGroup">
  148. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  149. <popup-picker show-name title="" placeholder="请选择" :data="csztList" v-model="filter.cszt"
  150. value-text-align="left">
  151. </popup-picker>
  152. </group>
  153. </div> -->
  154. <!-- from zzp-->
  155. <p class="popTitle2">长期措施状态</p>
  156. <div class="selectGroup">
  157. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  158. <popup-picker show-name title="" placeholder="请选择" :data="csztList" v-model="filter.cqcszt"
  159. value-text-align="left">
  160. </popup-picker>
  161. </group>
  162. </div>
  163. <p class="popTitle2">短期措施状态</p>
  164. <div class="selectGroup">
  165. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  166. <popup-picker show-name title="" placeholder="请选择" :data="csztList" v-model="filter.dqcszt"
  167. value-text-align="left">
  168. </popup-picker>
  169. </group>
  170. </div>
  171. <!---->
  172. <p class="popTitle2">缺陷分类</p>
  173. <div class="selectGroup">
  174. <group gutter="0" style="margin-bottom: 10px; width: 100%">
  175. <popup-picker show-name title="" placeholder="请选择" :data="qxflList" v-model="filter.qxfl"
  176. value-text-align="left">
  177. </popup-picker>
  178. </group>
  179. </div>
  180. <div class="buttonBox">
  181. <div @click="reset">重置</div>
  182. <div @click="filterShow = false ; onRefresh()">确认</div>
  183. </div>
  184. </div>
  185. </van-popup>
  186. <!-- 新增跳转按钮 -->
  187. <div class=" footer" @click="go" v-show="canAdd">新增问题</div>
  188. </div>
  189. </template>
  190. <script>
  191. import searchicon from "@/assets/images/sousuo.png"
  192. import filtericon from "@/assets/images/shaixuan.png"
  193. import nav1 from "@/components/nav"
  194. import {
  195. PopupPicker,
  196. Group
  197. } from 'vux'
  198. export default {
  199. components: {
  200. PopupPicker,
  201. Group,
  202. nav1
  203. },
  204. data() {
  205. return {
  206. unFinish: 0,
  207. search: "",
  208. filterShow: false,
  209. canAdd: false,
  210. searchicon: searchicon,
  211. filtericon: filtericon,
  212. loading: false,
  213. isNoData: false,
  214. finished: false,
  215. isRefresh: false,
  216. pageIndex: 1,
  217. totalPage: -10,
  218. filter: {
  219. my: false,
  220. status: [],
  221. zrbm: [],
  222. cqzrbm: [],
  223. dqzrbm: [],
  224. qy: [],
  225. cszt: [],
  226. cqcszt: [],
  227. dqcszt: [],
  228. qxfl: []
  229. },
  230. statusList: [
  231. [{
  232. name: '开启中',
  233. value: '0'
  234. }, {
  235. name: '已关闭',
  236. value: '1'
  237. }, {
  238. name: '已超时',
  239. value: '2'
  240. }]
  241. ],
  242. zrbmList: [
  243. [{
  244. name: '无内容',
  245. value: '0'
  246. }]
  247. ],
  248. qyList: [
  249. [{
  250. name: '无内容',
  251. value: '0'
  252. }]
  253. ],
  254. csztList: [
  255. [{
  256. name: '待指派',
  257. value: '0'
  258. }, {
  259. name: '待处理',
  260. value: '1'
  261. }, {
  262. name: '处理中',
  263. value: '2'
  264. }, {
  265. name: '已完成',
  266. value: '3'
  267. }]
  268. ],
  269. qxflList: [
  270. [{
  271. name: '无内容',
  272. value: '0'
  273. }]
  274. ],
  275. list: [],
  276. }
  277. },
  278. created() {
  279. if (this.$route.query.token) {
  280. sessionStorage.setItem("token", this.$route.query.token)
  281. }
  282. if (this.$route.query.id) {
  283. sessionStorage.setItem("id", this.$route.query.id)
  284. }
  285. this.api.getIssueUnFinished({
  286. id: 1
  287. }).then(res => {
  288. if (res.status == 20000) {
  289. this.unFinish = res.data
  290. }
  291. })
  292. // 责任部门下拉列
  293. this.api.getDept().then(res => {
  294. if (res.status == 20000) {
  295. for (let i in res.data) {
  296. res.data[i].value = String(res.data[i].id)
  297. }
  298. this.$set(this.zrbmList, 0, res.data)
  299. }
  300. })
  301. // 区域下拉列
  302. this.api.getRegion().then(res => {
  303. if (res.status == 20000) {
  304. for (let i in res.data) {
  305. res.data[i].value = String(res.data[i].id)
  306. }
  307. this.$set(this.qyList, 0, res.data)
  308. }
  309. })
  310. // 缺陷分类下拉列
  311. this.api.getFlawClassify().then(res => {
  312. if (res.status == 20000) {
  313. for (let i in res.data) {
  314. res.data[i].value = String(res.data[i].id)
  315. res.data[i].name = res.data[i].type
  316. }
  317. this.$set(this.qxflList, 0, res.data)
  318. }
  319. })
  320. this.onRefresh();
  321. },
  322. methods: {
  323. backClick() {
  324. console.log("back")
  325. try {
  326. YifengPlugins.onBackKeyDown();
  327. } catch (error) {}
  328. },
  329. go() {
  330. this.$router.push("qualityProblemAdd")
  331. },
  332. onRefresh() {
  333. this.list = [];
  334. this.isNoData = false;
  335. this.pageIndex = 1;
  336. this.totalPage = -10;
  337. // this.$refs.listMain.scrollTop = 0;
  338. this.finished = false;
  339. // this.finished = true;
  340. this.getData();
  341. },
  342. loadMore() {
  343. // console.log('asd')
  344. // this.finished = true;
  345. if (this.finished) return;
  346. this.pageIndex += 1;
  347. this.getData()
  348. },
  349. //筛选 我的任务选择
  350. myChange() {
  351. if (this.filter.my) {
  352. this.filter.my = false
  353. } else {
  354. this.filter.my = true
  355. }
  356. },
  357. //删除问题
  358. deleteIssue(id) {
  359. let _this = this
  360. let postData = {
  361. id: id,
  362. issueType: 1
  363. }
  364. this.$dialog.confirm({
  365. title: '确认',
  366. message: '请确认是否删除该问题',
  367. }).then(() => {
  368. _this.api.removeIssue(postData).then(res => {
  369. if (res.status == 20000) {
  370. _this.$toast('删除成功');
  371. _this.onRefresh();
  372. } else {
  373. _this.$toast(res.message);
  374. }
  375. })
  376. }).catch(() => {
  377. })
  378. },
  379. //筛选 重置筛选
  380. reset() {
  381. this.$set(this.filter, 'cszt', [])
  382. this.$set(this.filter, 'cqcszt', [])
  383. this.$set(this.filter, 'dqcszt', [])
  384. this.$set(this.filter, 'qxfl', [])
  385. this.$set(this.filter, 'qy', [])
  386. this.$set(this.filter, 'status', [])
  387. this.$set(this.filter, 'zrbm', [])
  388. this.$set(this.filter, 'cqzrbm', [])
  389. this.$set(this.filter, 'dqzrbm', [])
  390. this.filter.my = false
  391. this.filterShow = false
  392. this.onRefresh()
  393. },
  394. // 详情跳转
  395. toDetail(id) {
  396. this.$router.push({
  397. path: "/qualityProblemEdit",
  398. query: {
  399. id: id
  400. }
  401. })
  402. },
  403. getData() {
  404. let postData = {
  405. page: this.pageIndex,
  406. size: 10,
  407. issueStatus: this.filter.status[0],
  408. longtimeDepartmentId: this.filter.cqzrbm[0],
  409. shorttimeDepartmentId: this.filter.dqzrbm[0],
  410. areaId: this.filter.qy[0],
  411. id: this.search,
  412. defecttype: this.filter.qxfl[0],
  413. issueStatusLong: this.filter.cqcszt[0],
  414. issueStatusShort: this.filter.dqcszt[0]
  415. }
  416. if (this.filter.my) {
  417. postData.myJob = 1
  418. }
  419. if (this.pageIndex == this.totalPage + 1) {
  420. this.finished = true;
  421. this.loading = false;
  422. return false;
  423. }
  424. this.loading = true;
  425. this.api.pageQualityIssue(postData).then(res => {
  426. this.loading = false;
  427. if (res.status == 20000) {
  428. if (res.message == "true") {
  429. this.canAdd = true
  430. } else {
  431. this.canAdd = false
  432. }
  433. if (this.pageIndex == 1 && res.data.row.length == 0) {
  434. this.finished = true;
  435. }
  436. for (let i in res.data.row) {
  437. this.list.push(res.data.row[i])
  438. }
  439. this.totalPage = res.data.page
  440. } else {
  441. this.$toast(res.messgae)
  442. this.finished = true
  443. }
  444. })
  445. this.isRefresh = false;
  446. }
  447. }
  448. }
  449. </script>
  450. <style lang="scss" scoped>
  451. .page {
  452. width: 100%;
  453. height: 100%;
  454. background: #F1F2F6;
  455. overflow-y: auto;
  456. }
  457. .top {
  458. background: #fff;
  459. padding: 8px 14px;
  460. margin-bottom: 10px;
  461. .right {
  462. float: right;
  463. line-height: 32px;
  464. color: #2196F3;
  465. img {
  466. width: 16px;
  467. height: 16px;
  468. vertical-align: middle;
  469. }
  470. }
  471. }
  472. .list {
  473. padding: 0 10px 60px 10px;
  474. height: calc(100% - 58px - 45px);
  475. overflow-y: auto;
  476. .listItems {
  477. font-size: 12px;
  478. margin-bottom: 10px;
  479. .listContent {
  480. display: flex;
  481. width: 100%;
  482. padding: 10px;
  483. background: #fff;
  484. overflow: hidden;
  485. .listLeft {
  486. width: calc(100% - 30px);
  487. .bgspan {
  488. color: #fff;
  489. padding: 3px 6px
  490. }
  491. }
  492. .listRight {
  493. width: 20px;
  494. margin-left: 10px;
  495. font-size: 20px;
  496. display: flex;
  497. justify-content: center;
  498. align-items: center;
  499. }
  500. }
  501. .line {
  502. margin-bottom: 3px;
  503. }
  504. .listButton {
  505. width: 111px;
  506. height: 100%;
  507. // border-radius: 5px;
  508. }
  509. .rightStatus {
  510. width: 70px;
  511. height: 20px;
  512. line-height: 20px;
  513. text-align: center;
  514. background: red;
  515. color: #fff;
  516. // border-radius: 20px;
  517. float: right;
  518. }
  519. }
  520. }
  521. .popTitle,
  522. .popTitle2 {
  523. font-size: 16px;
  524. font-family: SimHei;
  525. font-weight: 400;
  526. color: #ADADAD;
  527. margin-bottom: 10px;
  528. }
  529. .popTitle2 {
  530. color: #676767;
  531. }
  532. .selectGroup {
  533. display: flex;
  534. flex-wrap: wrap;
  535. /deep/ .weui-cells {
  536. font-size: 14px;
  537. }
  538. .select {
  539. display: flex;
  540. justify-content: center;
  541. align-items: center;
  542. width: 85px;
  543. margin-right: 10px;
  544. margin-bottom: 10px;
  545. height: 54px;
  546. background: #F5F5F5;
  547. // border-radius: 10px;
  548. font-size: 13px;
  549. font-family: SimHei;
  550. font-weight: 500;
  551. color: #333333;
  552. }
  553. }
  554. .buttonBox {
  555. margin-top: 50px;
  556. display: flex;
  557. justify-content: flex-end;
  558. div {
  559. width: 35%;
  560. height: 45px;
  561. text-align: center;
  562. font-size: 17px;
  563. border: 1px solid #2196F3;
  564. line-height: 45px;
  565. }
  566. div:nth-child(1) {
  567. display: inline-block;
  568. // border-radius: 35px 0px 0px 35px;
  569. background: #F5F5F5;
  570. color: #2196F3;
  571. }
  572. div:nth-child(2) {
  573. display: inline-block;
  574. background: #2196F3;
  575. // border-radius: 0px 35px 35px 0px;
  576. color: #fff;
  577. }
  578. }
  579. .footer {
  580. position: fixed;
  581. bottom: 0;
  582. left: 0;
  583. width: 100%;
  584. height: 50px;
  585. line-height: 50px;
  586. text-align: center;
  587. background: #FFFFFF;
  588. font-size: 16px;
  589. font-family: SimHei;
  590. font-weight: 400;
  591. color: #2196F3;
  592. }
  593. .search {
  594. width: 70%;
  595. height: 32px;
  596. padding: 0 10px;
  597. background: #F1F2F6;
  598. font-size: 15px;
  599. font-family: SimHei;
  600. font-weight: 400;
  601. color: #333333;
  602. float: left;
  603. }
  604. .searchButton {
  605. width: 32px;
  606. height: 32px;
  607. background: #2196F3;
  608. border: none;
  609. float: left;
  610. img {
  611. width: 16px;
  612. height: 16px;
  613. vertical-align: middle;
  614. }
  615. }
  616. /deep/ .van-overlay {
  617. z-index: 100 !important
  618. }
  619. .van-popup {
  620. z-index: 101 !important
  621. }
  622. </style>