6ddfa5d3bea2ea98670cfdaea79e9445d1626a2a.svn-base 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div id="main" :style="{'height':testHeight+'px'}">
  3. <el-tree
  4. :data="treeData"
  5. show-checkbox
  6. node-key="id"
  7. default-expand-all
  8. @check-change="handleCheckChange"
  9. @check="currentChecked"
  10. ref="tree_data"
  11. :default-checked-keys="['personGraphicLayer']"
  12. :props="defaultProps"
  13. @key=""
  14. >
  15. </el-tree>
  16. </div>
  17. </template>
  18. <script>
  19. import InspectionList from './components/InspectionList.vue'
  20. import request from "../../utils/gw_ajax_request.js"
  21. import { getPersPlanType} from "../../api/duChaPlan.js";
  22. import { hasPriv } from '../../utils/gw_hasPriv.js'
  23. export default {
  24. name: 'SidebarItem',
  25. components: {
  26. InspectionList,
  27. },
  28. data() {
  29. return {
  30. testHeight:Number(window.innerHeight) - 92,
  31. treeData:[],
  32. treeData_per:{
  33. id: 'personGraphicLayer',
  34. label: '督查人员',
  35. checked:true,
  36. },
  37. treeData_sk:{
  38. id: '',
  39. label: '水库',
  40. checked:false,
  41. children: [{
  42. id: 'allSkGraphicLayer',
  43. label: '水库',
  44. checked:false,
  45. }, {
  46. id: 'skGraphicLayer2018',
  47. label: '2018年水库督查',
  48. checked:false,
  49. }, {
  50. id: 'skGraphicLayer2019',
  51. label: '2019年水库督查',
  52. checked:false,
  53. }, {
  54. id: 'fcskGraphicLayer',
  55. label: '复查水库',
  56. checked:false,
  57. }, {
  58. id: 'jhwskGraphicLayer',
  59. label: '督查计划外水库',
  60. checked:false,
  61. }]
  62. },
  63. treeData_ry:{
  64. id: '',
  65. label: '人饮',
  66. checked:false,
  67. children: [{
  68. id: 'ncysgcGraphicLayer',
  69. label: '农村饮水工程',
  70. checked:false,
  71. }, {
  72. id: 'sydGraphicLayer',
  73. label: '水源地',
  74. checked:false,
  75. }, {
  76. id: 'country150Layer',
  77. label: '督查县',
  78. checked:false,
  79. }, {
  80. id: 'xzcGraphicLayer',
  81. label: '督查行政村',
  82. checked:false,
  83. }]
  84. },
  85. treeData_sh:{
  86. id: 'shgcGraphicLayer',
  87. label: '水毁工程',
  88. checked:false,
  89. },
  90. treeData_dxs: {
  91. id: 'dxsGraphicLayer',
  92. label: '地下水',
  93. checked:false,
  94. },
  95. treeData_172: {
  96. id: 'graphicLayer172',
  97. label: '172工程',
  98. checked:false,
  99. },
  100. treeData_sz:{
  101. id: '',
  102. label: '水闸',
  103. checked:false,
  104. children: [{
  105. id: 'szGraphicLayerAll',
  106. label: '水闸',
  107. checked:false,
  108. }, {
  109. id: 'szGraphicLayer',
  110. label: '督查水闸',
  111. checked:false,
  112. }]
  113. },
  114. treeData_qsk: {
  115. id: 'graphicLayerQsk',
  116. label: '取水口',
  117. checked:false,
  118. },
  119. treeData1: [
  120. // {
  121. // id: '',
  122. // label: '图层选择',
  123. // children: [
  124. {
  125. id: 'personGraphicLayer',
  126. label: '督查人员',
  127. checked:true,
  128. },
  129. {
  130. id: '',
  131. label: '水库',
  132. checked:false,
  133. children: [{
  134. id: 'allSkGraphicLayer',
  135. label: '全部',
  136. checked:false,
  137. }, {
  138. id: 'skGraphicLayer2018',
  139. label: '2018年水库督查',
  140. checked:false,
  141. }, {
  142. id: 'skGraphicLayer2019',
  143. label: '2019年水库督查',
  144. checked:false,
  145. }, {
  146. id: 'fcskGraphicLayer',
  147. label: '复查水库',
  148. checked:false,
  149. }, {
  150. id: 'jhwskGraphicLayer',
  151. label: '督查计划外水库',
  152. checked:false,
  153. }]
  154. },
  155. {
  156. id: '',
  157. label: '人饮',
  158. checked:false,
  159. children: [{
  160. id: 'ncysgcGraphicLayer',
  161. label: '农村饮水工程',
  162. checked:false,
  163. }, {
  164. id: 'sydGraphicLayer',
  165. label: '水源地',
  166. checked:false,
  167. }, {
  168. id: 'country150Layer',
  169. label: '督查县',
  170. checked:false,
  171. }, {
  172. id: 'xzcGraphicLayer',
  173. label: '督查行政村',
  174. checked:false,
  175. }]
  176. },
  177. {
  178. id: 'shgcGraphicLayer',
  179. label: '水毁工程',
  180. checked:false,
  181. },
  182. // {
  183. // id: 'graphicLayer172',
  184. // label: '172工程',
  185. // checked:false,
  186. // },
  187. // {
  188. // id: 'szGraphicLayer',
  189. // label: '水闸',
  190. // checked:false,
  191. // },
  192. {
  193. id: 'dxsGraphicLayer',
  194. label: '地下水',
  195. checked:false,
  196. },
  197. // {
  198. // id: 'swzGraphicLayer',
  199. // label: '水文站',
  200. // checked:false,
  201. // },
  202. // ]
  203. // },
  204. ],
  205. defaultProps: {
  206. children: 'children',
  207. label: 'label'
  208. },
  209. isCheckData:[],
  210. }
  211. },
  212. computed:{
  213. userId: function () {
  214. return localStorage.getItem("userid") ?localStorage.getItem("userid") : "1098101939614724096";
  215. },
  216. },
  217. mounted:function(){
  218. // this.getPersonType();
  219. this.authentication();//身份验证
  220. },
  221. methods: {
  222. authentication(){
  223. this.treeData = [];
  224. if(hasPriv('per_layer')){//督查人员
  225. this.treeData.push(this.treeData_per);
  226. }
  227. if(hasPriv('rsvr_layer')){//小水库
  228. this.treeData.push(this.treeData_sk);
  229. }
  230. if(hasPriv('vill_layer')){//人饮
  231. this.treeData.push(this.treeData_ry);
  232. }
  233. if(hasPriv('rect_layer')){//水毁
  234. this.treeData.push(this.treeData_sh);
  235. }
  236. if(hasPriv('gc_layer')){//172
  237. this.treeData.push(this.treeData_172);
  238. }
  239. if(hasPriv('grw_layer')){//地下水监测站
  240. this.treeData.push(this.treeData_dxs);
  241. }
  242. if(hasPriv('sz_layer')){//水闸
  243. this.treeData.push(this.treeData_sz);
  244. }
  245. if(hasPriv('wint_layer')){//取水口
  246. this.treeData.push(this.treeData_qsk);
  247. }
  248. },
  249. // getPersonType(){ //获取当前人员类型 控制权限
  250. // this.treeData = [];
  251. // this.treeData.push(this.treeData_per);
  252. // getPersPlanType(this.userId).then((res)=>{
  253. // if(res.success){
  254. // var data = res.data;
  255. // data.forEach((item)=>{
  256. // if(item.id =="001"){//水库督查
  257. // this.treeData.push(this.treeData_sk);
  258. // }else if(item.id =="002"){//人饮督查
  259. // this.treeData.push(this.treeData_ry);
  260. // }else if(item.id =="003"){//水毁督查
  261. // this.treeData.push(this.treeData_sh);
  262. // }else if(item.id =="004"){//172工程督查
  263. // this.treeData.push(this.treeData_172);
  264. // }else if(item.id =="005"){//地下水督查
  265. // this.treeData.push(this.treeData_dxs);
  266. // }else if(item.id =="006"){//水闸督查
  267. // this.treeData.push(this.treeData_sz);
  268. // }
  269. // })
  270. // }
  271. // });
  272. // },
  273. handleCheckChange(event) {
  274. console.log(event)
  275. event.checked = !event.checked;
  276. this.$emit('isCheck',event);
  277. let checkedData = [];
  278. },
  279. currentChecked(data, currentChecked) {
  280. const { checkedNodes, halfCheckedNodes } = currentChecked;
  281. // console.log(checkedNodes,halfCheckedNodes);
  282. this.$emit('isChecks',checkedNodes);
  283. }
  284. }
  285. }
  286. </script>
  287. <style>
  288. #main{
  289. width: 190px;
  290. background: aliceblue;
  291. }
  292. #main .el-tree {
  293. height: 100%;
  294. }
  295. </style>