sideBar.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="sideBar_box_low">
  3. <div class="sideBar_bg" v-if="sideBarType=='on'" @click="click3()"></div>
  4. <div class="sideBar">
  5. <div style="line-height:60px;cursor: pointer;" v-if="sideBarType=='on'">
  6. <el-input class="screen screenEN" v-model="screen" @change="screenChange" :placeholder="version
  7. ==0?'输入关键字按下回车键搜索':'Input key press return key search'" clearable>
  8. <i slot="prefix" class="scree-icon el-icon-search" @click="userCompanyList"></i>
  9. <el-select v-model="searchType" @change="searchTypeChange" slot="append" placeholder="请选择" class="search_type">
  10. <el-option :label="version == 0?'项目':'project'" value="1"></el-option>
  11. <el-option :label="version == 0?'公司':'company'" value="0"></el-option>
  12. </el-select>
  13. </el-input>
  14. </div>
  15. <div class="sideBar_box scroll_show">
  16. <div class="sideBar_list" v-if="projectAll">
  17. <p @click="click4()" style="padding-bottom: 0px;" :class="{'sideBar_project_select':projectId == 0}">{{version == 0?'全部项目':'All projects'}}</p>
  18. </div>
  19. <div class="sideBar_list" v-for="(obj) in sideBarList" :key="obj.id">
  20. <p @click="click1(obj)">
  21. <i class="dian"></i>
  22. <span class="company_name" :class="{'company_name_EN':version ==1}" :title="obj.name">{{obj.name}}</span>
  23. <!-- <i class="el-icon-caret-top" :style="{'transform':(obj.type == '收起' || obj.type == 'Collapse')?'rotate(180deg)':''}"></i> -->
  24. <span>{{obj.type}}</span>
  25. </p>
  26. <div v-if="obj.type == '收起' || obj.type == 'Collapse'">
  27. <div :class="{'sideBar_project_select':projectId==item.id&&projectId}" v-for="(item) in obj.project_list" :key="item.id" @click="click2(item)">
  28. <span :title="item.projectname" :id="'sideBar_projectId_'+item.id">- {{item.projectname}}</span>
  29. </div>
  30. </div>
  31. </div>
  32. <p v-if="sideBarList.length == 0 && version == 0" style="text-align: center;font-size: 16px;font-family: PingFangSC-Medium;color: #666666;margin-top: 20px;">无相关项目,请重新输入关键字</p>
  33. <p v-if="sideBarList.length == 0 && version == 1" style="text-align: center;font-size: 16px;font-family: PingFangSC-Medium;color: #666666;margin-top: 20px;">No related items, please re-enter keywords</p>
  34. </div>
  35. <div class="sideBar_button" @click="click3()" :class="{'is_disabled':reportType && reportType != 'table'&&sideBarType=='off'}">
  36. <img src="../img/projectManagement/sideBarButton.png" height="56" width="34">
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script type="text/javascript">
  42. import { mapGetters } from 'vuex'
  43. export default{
  44. data(){
  45. return{
  46. scroll_time:null,
  47. screen:'',
  48. searchType:'1',
  49. }
  50. },
  51. props:['sideBarList','projectId','sideBarListIsOpen','projectSelectFun','sideBarIsOn','sideBarType','reportType','sideBarCompanyList','projectAll'],
  52. computed:{
  53. ...mapGetters({
  54. version:'version',
  55. })
  56. },
  57. mounted(){
  58. },
  59. methods:{
  60. /*侧边栏打开关闭*/
  61. click1(data){
  62. this.sideBarListIsOpen(data)
  63. },
  64. /*侧边栏里展开收起*/
  65. click2(data){
  66. this.projectSelectFun(data)
  67. },
  68. click3(){
  69. this.sideBarIsOn()
  70. fun(this.version)
  71. function fun(version){
  72. if($(".screenEN").length != 0){
  73. if(version == 0){
  74. $(".screenEN input").attr('placeholder','输入关键字按下回车键搜索');
  75. }else{
  76. $(".screenEN input").attr('placeholder','Enter keywords Search by Enter');
  77. }
  78. }else{
  79. setTimeout(function(){
  80. fun(version)
  81. },100)
  82. }
  83. }
  84. },
  85. click4(){
  86. this.projectAll();
  87. },
  88. searchTypeChange(){
  89. // this.screen = '';
  90. this.sideBarCompanyList(this.screen,this.searchType);
  91. },
  92. screenChange(val){
  93. this.sideBarCompanyList(val,this.searchType);
  94. },
  95. userCompanyList(){
  96. this.sideBarCompanyList(this.screen,this.searchType);
  97. },
  98. },
  99. watch:{
  100. sideBarType(curVal){
  101. let this_ = this;
  102. if(curVal == 'on' && this.projectId != 0){
  103. $('.sideBar .sideBar_box').animate({scrollTop: $('#sideBar_projectId_'+this_.projectId).offset().top - 250 + $('.sideBar .sideBar_box').scrollTop()})
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style type="text/css" lang="less">
  110. .sideBar_box_low{
  111. .sideBar_bg{
  112. background: #000;
  113. opacity: 0.1;
  114. position: absolute;
  115. width: 100%;height: 100%;
  116. z-index: 100;
  117. }
  118. .sideBar {
  119. position: absolute;
  120. width:0px;
  121. // height:988px;
  122. height: 100%;
  123. background:#FFFFFF;
  124. z-index: 100;
  125. .screen{
  126. .el-input__inner{
  127. border-left: 0px;
  128. border-right: 0px;
  129. height: 60px;line-height:60px;border-radius: 0px;
  130. }
  131. }
  132. .el-input--prefix .el-input__inner{
  133. padding-left: 40px;
  134. }
  135. .scree-icon{
  136. position: relative;
  137. top: 13px;
  138. left: -6px;
  139. display: inline-block;
  140. width: 40px;height: 40px;
  141. font-size: 30px;
  142. // background:url(../img/userManagement/screen.png) no-repeat center;
  143. }
  144. .el-input-group__append{
  145. padding:0 19px;
  146. }
  147. .search_type{
  148. width: 70px;
  149. .el-input__inner{
  150. padding:0px 10px 0 10px;
  151. height: 58px;line-height:58px;
  152. }
  153. }
  154. .sideBar_box{
  155. width: 100%;
  156. height: calc(100% - 85px);
  157. padding-bottom: 20px;
  158. overflow: auto;
  159. .sideBar_list{
  160. width: 290px;
  161. p{
  162. position: relative;
  163. padding: 20px 0 20px 32px;
  164. height:25px;
  165. font-size:18px;
  166. font-family:PingFangSC-Medium;
  167. color:#444444;
  168. line-height:25px;
  169. cursor: pointer;
  170. .dian{
  171. position: absolute;
  172. top: 27px;
  173. left: 12px;
  174. display: inline-block;
  175. width:10px;
  176. height:10px;
  177. background:#FC8440;
  178. border-radius: 4px ;
  179. }
  180. .company_name{
  181. display: inline-block;
  182. width: calc(100% - 58px);
  183. white-space: nowrap;
  184. overflow: hidden;
  185. text-overflow: ellipsis;
  186. }
  187. .company_name_EN{
  188. width: calc(100% - 90px);
  189. }
  190. >:last-child{
  191. display: inline-block;
  192. float: right;
  193. margin-right: 24px;
  194. height: 22px;
  195. font-size: 16px;
  196. font-family: PingFangSC-Regular;
  197. color: #666;
  198. line-height: 22px;
  199. text-decoration: underline;
  200. }
  201. }
  202. .sideBar_project_select{
  203. color:#FC8440;
  204. }
  205. >div{
  206. margin: 0 22px 0 30px;
  207. padding: 0 25px;
  208. background:rgba(241,241,241,1);
  209. border-radius: 4px ;
  210. div{
  211. padding:18px 0 18px 30px;
  212. height:22px;
  213. font-size:16px;
  214. font-family:PingFangSC-Medium;
  215. color:rgba(68,68,68,1);
  216. line-height:22px;
  217. cursor: pointer;
  218. border-bottom: 1px solid #DBDBDB;
  219. white-space: nowrap;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. }
  223. div:last-child{
  224. border-bottom: 0px;
  225. }
  226. .sideBar_project_select{
  227. color:#FC8440;
  228. }
  229. }
  230. }
  231. }
  232. .sideBar_button{
  233. position: absolute;
  234. height: 56px;
  235. top: 30px;
  236. right: -34px;
  237. cursor: pointer;
  238. }
  239. }
  240. }
  241. </style>