indexEnvi.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div class="check-btns">
  3. <div class="type-check">
  4. <slot name="type-check">
  5. <el-button
  6. :type="btnState == '1' ? 'primary' : 'default'"
  7. size="mini"
  8. @click="checkType(1)"
  9. >{{ txt }}</el-button
  10. >
  11. <el-button
  12. :type="btnState == '2' ? 'primary' : 'default'"
  13. size="mini"
  14. @click="checkType(2)"
  15. >{{ txt1 }}</el-button
  16. >
  17. <el-button :type="btnState == '3' ? 'primary' : 'default'" size="mini" @click="checkType(3)"
  18. >设备分布</el-button
  19. >
  20. <!-- 刷新 -->
  21. <el-button @click="refreshData()" type="warning" size="mini">更新数据</el-button>
  22. <el-button v-if="userJurisdiction" @click="issueConsole()" type="info" size="mini"
  23. >调试控制台</el-button
  24. >
  25. <el-button
  26. class="pestAll"
  27. type="primary"
  28. v-if="$QueryPermission(242)"
  29. size="mini"
  30. @click="gowarning"
  31. >气象预警</el-button
  32. >
  33. <!-- <el-button class="pestAll" type="primary" v-if="loginId == 1" size="mini" @click="$router.push('/external-env-setting')"
  34. >气象站配置</el-button
  35. > -->
  36. </slot>
  37. </div>
  38. <div class="search-box" v-if="judge !== '1' && screenShow !== 3">
  39. <slot name="search-box"></slot>
  40. <slot name="search-common">
  41. <template v-if="user_tag == 5">
  42. <el-select
  43. class="select01"
  44. size="mini"
  45. v-model="sale_user_uid"
  46. filterable
  47. clearable
  48. placeholder="请选择客户"
  49. @change="isSaleUserSelect()"
  50. >
  51. <el-option
  52. v-for="item in userListOptions"
  53. :key="item.uid"
  54. :label="item.username"
  55. :value="item.uid"
  56. >
  57. </el-option>
  58. </el-select>
  59. </template>
  60. <el-select
  61. v-model="is_online"
  62. class="select01"
  63. clearable
  64. size="mini"
  65. placeholder="请选择在线状态"
  66. @change="isOnlineSelect()"
  67. >
  68. <el-option label="全部" value=""></el-option>
  69. <el-option label="在线" value="1"></el-option>
  70. <el-option label="离线" value="0"></el-option>
  71. </el-select>
  72. <el-input
  73. style="cursor: pointer"
  74. placeholder="请输入内容"
  75. size="mini"
  76. clearable
  77. v-model="searchVal"
  78. suffix-icon="el-icon-search"
  79. class="input-with-select"
  80. @change="searchEquipList()"
  81. >
  82. <template slot="prepend">设备ID或名称</template>
  83. </el-input>
  84. </slot>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. user_tag: null, //1超级管理员,2经销商,3农林政府单位,4普通用户,5销售用户ss
  93. loginId: localStorage.getItem('user_tag'),
  94. sale_user_uid: '', //销售用户uid
  95. userListOptions: [], //销售用户列表
  96. selectItem: '1', //1设备号,2用户名
  97. searchVal: '',
  98. f_id: '',
  99. ename: '',
  100. is_online: null,
  101. btnState: this.displayType,
  102. judge: this.isShow,
  103. txt: '图表',
  104. txt1: '列表',
  105. userJurisdiction: false, // 下发控制的权限判断
  106. screenShow: null,
  107. qxwarn: false
  108. }
  109. },
  110. props: {
  111. displayType: {
  112. type: String
  113. },
  114. isShow: {
  115. author: String
  116. }
  117. },
  118. created() {
  119. this.user_tag = localStorage.getItem('user_tag')
  120. },
  121. activated() {
  122. this.getSaleUserList()
  123. this.is_online = window.location.href.split('is_online=')
  124. ? window.location.href.split('is_online=')[1]
  125. : null
  126. // 当前从首页跳转
  127. if (this.$parent.$route.query.is_online) {
  128. this.$emit('fun3', this.is_online)
  129. }
  130. },
  131. methods: {
  132. // 销售用户列表
  133. getSaleUserList() {
  134. this.$axios({
  135. method: 'POST',
  136. url: '/api/api_gateway?method=user.login.get_sale_device_user_list'
  137. }).then((res) => {
  138. if (res.data.data.length !== 0) {
  139. this.userListOptions = res.data.data
  140. }
  141. })
  142. },
  143. checkType(i) {
  144. this.btnState = i
  145. this.screenShow = i
  146. //console.log(this.screenShow);
  147. this.$emit('fun', this.btnState)
  148. },
  149. refreshData() {
  150. this.$emit('refreshData', '')
  151. },
  152. // 搜索组合数据
  153. searchEquipList() {
  154. if (this.selectItem == 1) {
  155. this.f_id = this.searchVal
  156. } else if (this.selectItem == 2) {
  157. this.ename = this.searchVal
  158. }
  159. this.$emit('fun2', { f_id: this.f_id, ename: this.ename })
  160. },
  161. selClear() {
  162. if (this.searchVal) {
  163. this.searchVal = ''
  164. this.f_id = ''
  165. this.ename = ''
  166. this.$emit('fun2', { f_id: this.f_id, ename: this.ename })
  167. }
  168. },
  169. isOnlineSelect() {
  170. this.$emit('fun3', this.is_online)
  171. },
  172. say() {
  173. this.txt1 = '企鹏'
  174. this.txt = '合宙'
  175. },
  176. // 下发控制
  177. issueConsole() {
  178. this.$emit('fun4', true)
  179. },
  180. isSaleUserSelect() {
  181. this.$emit('fun5', this.sale_user_uid)
  182. },
  183. gowarning() {
  184. // this.
  185. this.$router.push({
  186. path: `/index/qxzearlywarning/qxzwarninglist`,
  187. query: {
  188. typeId: 5
  189. }
  190. })
  191. }
  192. },
  193. mounted() {
  194. this.screenShow = Number(this.displayType)
  195. // 判断当前账号是否为管理员
  196. if (localStorage.getItem('cUsername') == '管理员') {
  197. this.userJurisdiction = true
  198. } else {
  199. this.userJurisdiction = false
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="less" scoped>
  205. .check-btns {
  206. display: flex;
  207. justify-content: space-between;
  208. margin-bottom: 20px;
  209. align-items: center;
  210. .search-box {
  211. text-align: right;
  212. .el-input {
  213. width: 400px;
  214. vertical-align: middle;
  215. }
  216. .select01 {
  217. width: 200px;
  218. vertical-align: middle;
  219. }
  220. /deep/.select02 {
  221. width: 86px;
  222. }
  223. .input-with-select {
  224. width: 310px;
  225. margin: 0 4px 0 0;
  226. }
  227. /deep/.el-input-group__prepend {
  228. cursor: default;
  229. }
  230. }
  231. }
  232. </style>