人民医院前端

orderSelect.vue 2.1KB

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