evaluateStore.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <!-- @rightClick 只有存在右边部分的情况下才使用,
  3. 右边默认为空,可以使用slot="right" 自定义右边内容
  4. @ok 是单选或多选最终返回的结果
  5. types 类型 radio或checkbox
  6. titleKeys 标题对应的字段名称key,默认是name
  7. listData 是数据
  8. showArrow 是否显示右边箭头
  9. backValue 设置返回的数据是idArr [id,id,...] 或 objArr [obj,obj,...]
  10. defValue 设置已选择的数据,格式和backValue 一致
  11. checkIconPositon 选择图标显示左边还是右边 left or right
  12. -->
  13. <uni-check-list
  14. :listData="list"
  15. checkIconPositon="right"
  16. :showArrow="false"
  17. :defValue="value"
  18. :types="type"
  19. :noDataText="noDataText"
  20. backValue="objArr"
  21. @ok="chooseOk">
  22. </uni-check-list>
  23. </template>
  24. <script>
  25. import {findStoreList} from '@/api/store'
  26. export default {
  27. data() {
  28. return {
  29. list: [],
  30. value: [],
  31. noDataText: '暂无考评门店',
  32. type: '' // 单选或多选
  33. }
  34. },
  35. onLoad(opts) {
  36. this.value = opts.item&&JSON.parse(opts.item)||[]
  37. this.value.map(item=>{
  38. item.id = item.storeId || item.id
  39. })
  40. this.type = opts.type && opts.type || 'checkbox'
  41. console.log(this.value)
  42. // 查询门店
  43. findStoreList({}).then(res=>{
  44. if(res.status == 200){
  45. this.list = res.data || []
  46. } else {
  47. this.noDataText = res.message
  48. }
  49. })
  50. },
  51. methods: {
  52. // 选中门店,item 返回的是数组
  53. chooseOk(item) {
  54. console.log(item)
  55. //关闭当前页面,这里处理数据逻辑
  56. uni.$emit("selKpStores",item)
  57. uni.navigateBack()
  58. },
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. page{
  64. height: 100%;
  65. }
  66. </style>