9c6b162dd90c4606295bfd8c8ed6a294b6fa119c.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div>
  3. <el-select
  4. v-model="value"
  5. placeholder="请选择"
  6. filterable
  7. autoComplete = "off"
  8. :filter-method="filterMethod"
  9. @change='chooseChange'
  10. size="mini"
  11. >
  12. <el-option
  13. v-for="item in searchDataList"
  14. :key="item.id"
  15. :value="item.id"
  16. :label="item.pnm"
  17. >
  18. <span style="float: left">{{ item.pnm }}</span>
  19. <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.id.length==6">督查机构</span>
  20. <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.id.length==9">督查批次</span>
  21. <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.id.length==12">督查组</span>
  22. </el-option>
  23. </el-select>
  24. </div>
  25. </template>
  26. <script>
  27. import request from '../utils/gw_ajax_request.js';
  28. import { getVillageList_ny ,submitInsertCun} from "../api/duChaTianBao.js";
  29. import inuptWithXiang from './inuptWithXiang.vue'
  30. export default {
  31. props: ['rootCode','initalValue','orgType'],
  32. components:{
  33. 'inuptWithXiang':inuptWithXiang
  34. },
  35. data() {
  36. return {
  37. dataList: [],
  38. value: '',
  39. dialogVisible:false,
  40. searchDataList:[],
  41. timeout: null,
  42. xianlistData:[],
  43. newCunForm:{
  44. "adAbbrName": "",
  45. "adFcode": "",
  46. "adFullName": "",
  47. "adName": "",
  48. },
  49. }
  50. },
  51. computed:{
  52. userId:function(){
  53. return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
  54. },
  55. },
  56. mounted(){
  57. this.value = this.initalValue;
  58. console.log(this.value);
  59. this.getLeftTreeData();
  60. },
  61. watch: {
  62. rootCode:function(){
  63. this.querySearchAsync();
  64. },
  65. initalValue:function(){
  66. this.value = this.initalValue;
  67. console.log(this.value);
  68. this.querySearchAsync();
  69. }
  70. },
  71. methods:{
  72. getLeftTreeData(){
  73. var _self = this;
  74. request.get('/dc/organization/base/getAllNode',{params:{'userId':this.userId,'orgType':this.orgType}}).then((res)=>{
  75. let data = res.data
  76. console.log(data);
  77. this.searchDataList = data;
  78. // _self.duChaType = _self.treeData[0].id.substring(2,3);
  79. })
  80. },
  81. provTreeSelectChangeHandler:function(params){
  82. console.log(params)
  83. this.newCunForm.adFcode = params.code;
  84. },
  85. chooseChange:function(p){
  86. console.log(p);
  87. this.searchDataList.forEach((element) => {
  88. if(element.id == p){
  89. console.log(element);
  90. this.$emit("selectDuChaTreeNode", { 'code':element.id, 'name': element.pnm});
  91. }
  92. });
  93. },
  94. filterMethod:function(text){
  95. console.log(text);
  96. this.value = text;
  97. var _self = this;
  98. request.get('/dc/organization/base/getAllNode',{params:{'userId':this.userId,'orgType':'001'}}).then((res)=>{
  99. let data = res.data
  100. console.log(data);
  101. let filterResult = [];
  102. data.forEach((element) =>{
  103. if(element.pnm.indexOf(text)>=0){
  104. filterResult.push(element);
  105. }
  106. });
  107. this.searchDataList = filterResult;
  108. // _self.duChaType = _self.treeData[0].id.substring(2,3);
  109. })
  110. },
  111. },
  112. }
  113. </script>
  114. <style>
  115. </style>