人民医院前端

orderSelect.vue 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <uni-data-picker class="uni_item" placeholder="请选择工单类别" :showSearch= "showSearch" :readonly="readonly" :localdata="dataOrderType" v-model="WorkOrderCategory" @change="changeType" @nodeclick="nodeclick" @popupclosed="popupclosed" @searchTrue="searchTrue">
  3. </uni-data-picker>
  4. </template>
  5. <script>
  6. import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
  7. import {filterTreeDatas} from '@/utils/dataTreating.js'
  8. export default {
  9. data() {
  10. return {
  11. order: '',
  12. WorkOrderCategory: '',
  13. orderList: [],
  14. identification: '',
  15. dataOrderType: [],
  16. autoData:[],
  17. showSearch:true
  18. }
  19. },
  20. props: {
  21. orderType: {},
  22. typeid: {},
  23. readonly:false
  24. },
  25. created() {
  26. this.getDpartment()
  27. },
  28. methods: {
  29. getDpartment() {
  30. pageData.getGongDanType(this.typeid,(res, data) => {
  31. this.orderList = data
  32. this.dataOrderType = res
  33. if(this.orderType) {
  34. this.getOrder(res, data, this.orderType)
  35. }
  36. })
  37. },
  38. getOrder(data, tree, id) {
  39. let newtext = ''
  40. for (const i in tree) {
  41. if (tree[i].id == id) {
  42. this.getTree(data, tree[i].text)
  43. } else if (tree[i].children) {
  44. this.getOrder(data, tree[i].children, id)
  45. }
  46. }
  47. },
  48. getTree(tree, text) {
  49. for (const i in tree) {
  50. if (tree[i].text == text) {
  51. this.WorkOrderCategory = tree[i].value
  52. } else if (tree[i].children) {
  53. this.getTree(tree[i].children, text)
  54. }
  55. }
  56. },
  57. changeType(e,f,g){
  58. const valueData = e.detail.value
  59. console.log(valueData, 'valueData')
  60. this.WorkOrderCategory = valueData[valueData.length-1].value
  61. },
  62. searchTrue(e){
  63. this.WorkOrderCategory = e.value
  64. },
  65. nodeclick(data) {
  66. if (data.hasChild === 0) {
  67. this.order = data.value
  68. this.identification = this.$mHelper.getIdentification(this.orderList,data.value)
  69. this.$emit('post-select-data',data.value,data.id,data.orderType,this.identification, data.text)
  70. }
  71. },
  72. popupclosed(data) {
  73. // this.WorkOrderCategory = this.order
  74. }
  75. }
  76. }
  77. </script>
  78. <style>
  79. </style>