index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view>
  3. <uni-list >
  4. <!-- 垂直排列,无略缩图,主标题+副标题显示 -->
  5. <view @click="check(item)" v-for="(item, index) in dataList" :key="item.checklistId">
  6. <uni-list-item direction="column">
  7. <template v-slot:header>
  8. <view class="uni-title">{{item.checklistTitle}}</view>
  9. </template>
  10. </uni-list-item>
  11. </view>
  12. </uni-list>
  13. </view>
  14. </template>
  15. <script>
  16. import { getCheckList, getCheckTaskView } from '@/api/entRiskPoint.js'
  17. import { createCheckTask } from '@/api/checkRecord.js'
  18. export default {
  19. data() {
  20. return {
  21. dataList: [],
  22. queryConditions: {
  23. page: 1,
  24. limit: 10,
  25. total: 0,
  26. keywords: '',
  27. riskPointId: ''
  28. },
  29. formData: {
  30. taskId: '',
  31. taskTitle: '扫码巡检任务',
  32. riskPointId: '',
  33. taskCatId: '',
  34. taskPriority: 2,
  35. taskTypeId: 3, // 扫码巡检任务
  36. taskDesc: '扫码巡检任务',
  37. checklistId: ''
  38. }
  39. }
  40. },
  41. onLoad(options) {
  42. this.queryConditions.riskPointId = options.id
  43. this.getData();
  44. },
  45. methods: {
  46. getData() {
  47. getCheckList(this.queryConditions).then((resp) => {
  48. const { code, data, count } = resp
  49. if (code === 0) {
  50. this.queryConditions.total = count
  51. this.dataList = data
  52. }
  53. }).catch((error) => {
  54. console.log(error)
  55. })
  56. },
  57. check(item) {
  58. this.formData.riskPointId = item.riskPointId
  59. this.formData.checklistId = item.checklistId
  60. this.formData.checklistTypeId = item.checklistTypeId
  61. // //插入Task 表
  62. createCheckTask(this.formData).then((resp) => {
  63. console.log("创建新任务记录")
  64. const { code, msg, data } = resp
  65. if (code === 0) {
  66. let riskPointId=item.riskPointId;
  67. let taskId=data.taskId;
  68. console.log({
  69. "跳转到检查表":[{taskId,riskPointId}]
  70. })
  71. //跳转到检查表--
  72. uni.reLaunch({
  73. url: `/views/entRiskPointCheck/table?taskId=${taskId}&riskPointId=${riskPointId}`
  74. });
  75. }
  76. }).catch((error) => {
  77. console.log(error)
  78. })
  79. },
  80. }
  81. }
  82. </script>
  83. <style>
  84. </style>