evaluatePlan.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <!-- @rightClick 只有存在右边部分的情况下才使用,
  3. 右边默认为空,可以使用slot="right" 自定义右边内容
  4. @ok 是单选或多选最终返回的结果
  5. types 类型 radio或checkbox
  6. titleKeys 标题对应的字段名称key,默认是name
  7. listData 是数据
  8. showArrow 是否显示右边箭头
  9. backValue 设置返回的数据是[id,id,...] 或 [obj,obj,...]
  10. defValue 设置已选择的数据,格式和backValue 一致
  11. checkIconPositon 选择图标显示左边还是右边 left or right
  12. -->
  13. <uni-check-list :listData="list" :defValue="value" types="radio" @ok="chooseOk" @rightClick="viewDetail">
  14. <view slot="right">
  15. 详情
  16. </view>
  17. </uni-check-list>
  18. </template>
  19. <script>
  20. import {findScheme} from '@/api/assess'
  21. export default {
  22. data() {
  23. return {
  24. list: [],
  25. value: [],
  26. types: ''
  27. }
  28. },
  29. onLoad(opts) {
  30. this.value[0]=opts.id
  31. this.types = opts.types
  32. let t = {'video':'VIDEO_INSPECTION','scene':'SPOT_INSPECTION'}
  33. // 查询方案
  34. findScheme({status:1,scopeType:t[opts.types]}).then(res=>{
  35. console.log(res)
  36. if(res.status == 200){
  37. this.list = res.data
  38. }
  39. })
  40. },
  41. methods: {
  42. // 选中方案,item 返回的是数组
  43. chooseOk(item) {
  44. console.log(item)
  45. if(item.length==0){
  46. uni.showToast({
  47. icon:'none',
  48. title:'请选择考评方案'
  49. })
  50. }else{
  51. //关闭当前页面,这里处理数据逻辑
  52. let row = this.list.find(k=> k.id == item[0])
  53. uni.$emit("resetTaskKpItem",row)
  54. uni.navigateBack()
  55. }
  56. },
  57. // 查看详情
  58. viewDetail(item){
  59. uni.navigateTo({
  60. url:"/pages/evaluatePlan/planDetail?item="+encodeURIComponent(JSON.stringify(item))
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. page{
  68. height: 100%;
  69. }
  70. </style>