人民医院前端

orderSelect.vue 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. }
  16. },
  17. props: {
  18. orderType: {},
  19. typeid: {},
  20. readonly:false
  21. },
  22. created() {
  23. this.getDpartment()
  24. },
  25. methods: {
  26. getDpartment() {
  27. pageData.getGongDanType(this.typeid,(res, data) => {
  28. this.orderList = data
  29. this.dataOrderType = res
  30. if(this.orderType) {
  31. this.getOrder(res, data, this.orderType)
  32. }
  33. })
  34. },
  35. getOrder(data, tree, id) {
  36. let newtext = ''
  37. for (const i in tree) {
  38. if (tree[i].id == id) {
  39. this.getTree(data, tree[i].text)
  40. } else if (tree[i].children) {
  41. this.getOrder(data, tree[i].children, id)
  42. }
  43. }
  44. },
  45. getTree(tree, text) {
  46. for (const i in tree) {
  47. if (tree[i].text == text) {
  48. this.WorkOrderCategory = tree[i].value
  49. } else if (tree[i].children) {
  50. this.getTree(tree[i].children, text)
  51. }
  52. }
  53. },
  54. nodeclick(data) {
  55. this.order = data.value
  56. console.log(this.orderList)
  57. this.identification = this.$mHelper.getIdentification(this.orderList,data.value)
  58. console.log(this.identification )
  59. this.$emit('post-select-data',data.value,data.id,data.orderType,this.identification)
  60. },
  61. popupclosed() {
  62. this.WorkOrderCategory = this.order
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. </style>