index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view id="warningLog">
  3. <view class="query-max-big-box">
  4. <view class="query-input-box">
  5. <input class="query-input" v-model="queryParams.searchValue"
  6. style="width:180rpx;" :maxlength="10"
  7. type="text" placeholder="输入名称" placeholder-style="color:#999;">
  8. </view>
  9. <view class="query-input-box">
  10. <picker @change="typeListChange" :value="typeListIndex" :range="typeList">
  11. <view style="width:160rpx;" class="query-input"
  12. :class="!typeName?'query-input-placeholder':''">
  13. {{typeName?typeName:'选择类型'}}
  14. </view>
  15. </picker>
  16. </view>
  17. <view class="query-button-one" @click="handleQuery">查询</view>
  18. <view class="query-button-two" @click="resetQuery">重置</view>
  19. </view>
  20. <view class="list-max-big-box">
  21. <view class="list-max-big-null" v-if="!dataList[0]">暂无数据</view>
  22. <view class="for-list-max-big-box" @click="shadeOpen(item)"
  23. v-for="(item,index) in dataList" :key="index">
  24. <view class="for-item-text-box">
  25. <view class="name-box">{{item.title}}</view>
  26. <view class="num-box">
  27. {{item.alarmType==1?'钉钉':
  28. (item.alarmType==2?'微信':
  29. (item.alarmType==3?'邮件':
  30. (item.alarmType==4?'电话':
  31. (item.alarmType==5?'短信':''))))}}
  32. </view>
  33. <view class="type-box" :class="item.state?'colorA':'colorB'">
  34. {{item.state?'成功':'失败'}}
  35. </view>
  36. </view>
  37. <view class="for-item-num">消息内容:{{item.content}}</view>
  38. <view class="for-item-address">发送时间:{{ parseTime(item.createTime,"{y}-{m}-{d} {h}:{i}") }}</view>
  39. </view>
  40. </view>
  41. <view class="pagination-max-big-box">
  42. <view class="pagination-button" @click="paginationButton(1)"
  43. :class="queryParams.page == 1 ? 'pagination-color':''">上一页</view>
  44. <view class="pagination-num">{{queryParams.page}}/{{pages}}</view>
  45. <view class="pagination-button" @click="paginationButton(2)"
  46. :class="queryParams.page == pages || queryParams.page > pages ? 'pagination-color':''">下一页</view>
  47. </view>
  48. <view class="info-positon-max-big-box" v-if="shadeType">
  49. <view class="info-positon-big-box">
  50. <view class="info-positon-box">
  51. <view class="info-positon-title">详情</view>
  52. <view class="info-positon-text-box">
  53. <view>标题:</view>
  54. <view>{{shadeData.title}}</view>
  55. </view>
  56. <view class="info-positon-text-box">
  57. <view>方式:</view>
  58. <view>
  59. {{shadeData.alarmType==1?'钉钉':
  60. (shadeData.alarmType==2?'微信':
  61. (shadeData.alarmType==3?'邮件':
  62. (shadeData.alarmType==4?'电话':
  63. (shadeData.alarmType==5?'短信':''))))}}
  64. </view>
  65. </view>
  66. <view class="info-positon-text-box">
  67. <view>状态:</view>
  68. <view>{{shadeData.state?'成功':'失败'}}</view>
  69. </view>
  70. <view class="info-positon-text-box">
  71. <view>消息内容:</view>
  72. <view>{{shadeData.content}}</view>
  73. </view>
  74. <view class="info-positon-text-box">
  75. <view>接收人:</view>
  76. <view>{{shadeData.receiver}}</view>
  77. </view>
  78. <view class="info-positon-text-box">
  79. <view>发送时间:</view>
  80. <view>{{ parseTime(shadeData.createTime,"{y}-{m}-{d} {h}:{i}") }}</view>
  81. </view>
  82. <view class="info-positon-text-box" v-if="!shadeData.state">
  83. <view>失败原因:</view>
  84. <view>{{ shadeData.failDesc }}</view>
  85. </view>
  86. </view>
  87. <view class="info-positon-button-box">
  88. <view @click="shadeOff">关闭</view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import { itoAlarmLogList } from '@/api/index.js'
  96. export default {
  97. data() {
  98. return {
  99. //分类下拉列表
  100. typeDataList:[
  101. {name:"钉钉",id:1,},
  102. {name:"微信",id:2,},
  103. {name:"邮件",id:3,},
  104. {name:"电话",id:4,},
  105. {name:"短信",id:5,},
  106. ],
  107. typeList:['钉钉','微信','邮件','电话','短信',],
  108. typeListIndex:0,
  109. typeName:'',
  110. //列表数据
  111. dataList:[],
  112. pages:0,
  113. queryParams:{
  114. page:1,
  115. pageSize:10,
  116. searchValue:'',
  117. alarmType:'',
  118. },
  119. //弹窗相关
  120. shadeType:false,
  121. shadeData:{},
  122. }
  123. },
  124. onLoad(option) {
  125. },
  126. onShow(){
  127. this.getList();
  128. },
  129. methods: {
  130. //开启弹窗
  131. shadeOpen(item){
  132. this.$set(this,'shadeData',item);
  133. this.$set(this,'shadeType',true);
  134. },
  135. //关闭弹窗
  136. shadeOff(){
  137. this.$set(this,'shadeType',false);
  138. this.$set(this,'shadeData',{});
  139. },
  140. //选中分类
  141. typeListChange(event){
  142. this.$set(this,'typeListIndex',event.target.value);
  143. this.$set(this,'typeName',this.typeDataList[event.target.value].name);
  144. this.$set(this.queryParams,'alarmType',this.typeDataList[event.target.value].id);
  145. },
  146. //查询按钮
  147. handleQuery(){
  148. this.$set(this.queryParams,'page',1);
  149. this.getList();
  150. },
  151. //重置按钮
  152. resetQuery(){
  153. this.$set(this,'typeListIndex',0);
  154. this.$set(this,'typeName','');
  155. this.$set(this,'queryParams',{
  156. page:1,
  157. pageSize:10,
  158. searchValue:'',
  159. alarmType:'',
  160. });
  161. this.getList();
  162. },
  163. //翻页
  164. paginationButton(type){
  165. if(type == 1){
  166. if(this.queryParams.page != 1){
  167. this.queryParams.page--
  168. this.getList();
  169. }
  170. }else if(type == 2){
  171. if(this.queryParams.page != this.pages && this.queryParams.page < this.pages){
  172. this.queryParams.page++
  173. this.getList();
  174. }
  175. }
  176. },
  177. //消息列表
  178. async getList(){
  179. const {data} = await itoAlarmLogList(this.queryParams);
  180. if(data.code==200){
  181. this.$set(this,'pages',data.data.pages);
  182. this.$set(this,'dataList',data.data.records);
  183. }
  184. },
  185. },
  186. }
  187. </script>
  188. <style lang="stylus" scoped>
  189. #warningLog{
  190. flex:1;
  191. display: flex;
  192. flex-direction: column;
  193. overflow: hidden;
  194. .query-max-big-box{
  195. height:80rpx;
  196. background-color: #fff;
  197. display: flex;
  198. font-size:28rpx;
  199. .query-input-box{
  200. display: flex;
  201. margin:10rpx 0 0 10rpx;
  202. .query-input{
  203. padding:0 20rpx;
  204. height:60rpx;
  205. line-height:60rpx;
  206. font-size:26rpx;
  207. border-radius:8rpx;
  208. border:1px solid #dedede;
  209. }
  210. .query-input-placeholder{
  211. color: #999 !important;
  212. }
  213. }
  214. .query-button-one{
  215. margin:10rpx 0 0 10rpx;
  216. background-color: #0183FA;
  217. color:#fff;
  218. border-radius:8rpx;
  219. width:140rpx;
  220. height:62rpx;
  221. line-height:62rpx;
  222. text-align: center;
  223. font-size:28rpx;
  224. }
  225. .query-button-two{
  226. margin:10rpx;
  227. background-color: #999;
  228. color:#fff;
  229. border-radius:8rpx;
  230. width:140rpx;
  231. height:62rpx;
  232. line-height:62rpx;
  233. text-align: center;
  234. font-size:28rpx;
  235. }
  236. .query-button-three{
  237. margin:10rpx 10rpx 0 0;
  238. background-color: #409EFF;
  239. color:#fff;
  240. border-radius:8rpx;
  241. width:100rpx;
  242. height:62rpx;
  243. line-height:62rpx;
  244. text-align: center;
  245. font-size:28rpx;
  246. }
  247. }
  248. .list-max-big-box{
  249. flex:1;
  250. overflow-x: hidden;
  251. overflow-y: scroll;
  252. margin:20rpx;
  253. .list-max-big-null{
  254. font-size:28rpx;
  255. text-align:center;
  256. line-height:100rpx;
  257. color:#999;
  258. }
  259. .for-list-max-big-box{
  260. background-color: #fff;
  261. color:#333;
  262. font-size:28rpx;
  263. margin-bottom:20rpx;
  264. padding:20rpx;
  265. border-radius:16rpx;
  266. .for-item-text-box{
  267. display: flex;
  268. .name-box{
  269. flex:1;
  270. line-height:50rpx;
  271. }
  272. .num-box{
  273. text-align: center;
  274. width:140rpx;
  275. line-height:50rpx;
  276. }
  277. .type-box{
  278. text-align: center;
  279. width:140rpx;
  280. line-height:50rpx;
  281. }
  282. .colorA{
  283. color:#14AE10;
  284. }
  285. .colorB{
  286. color:#FF6666;
  287. }
  288. }
  289. .for-item-num{
  290. line-height:50rpx;
  291. /*单行省略号*/
  292. display:block;
  293. overflow:hidden;
  294. text-overflow:ellipsis;
  295. white-space:nowrap;
  296. }
  297. .for-item-address{
  298. line-height:50rpx;
  299. }
  300. }
  301. }
  302. .pagination-max-big-box{
  303. height:80rpx;
  304. background-color: #fff;
  305. display: flex;
  306. .pagination-button{
  307. margin:10rpx;
  308. border-radius:8rpx;
  309. width:140rpx;
  310. height:60rpx;
  311. line-height:60rpx;
  312. text-align: center;
  313. font-size:28rpx;
  314. background-color:#0183FA;
  315. color:#fff;
  316. }
  317. .pagination-num{
  318. flex:1;
  319. text-align: center;
  320. line-height:80rpx;
  321. }
  322. .pagination-color{
  323. background-color: #dedede;
  324. }
  325. }
  326. .info-positon-max-big-box{
  327. z-index:100;
  328. position: absolute;
  329. bottom:0;
  330. left:0;
  331. width:100%;
  332. height:100%;
  333. background-color: rgba(0,0,0,0.6);
  334. .info-positon-big-box{
  335. width:80%;
  336. height:80%;
  337. margin-left:10%;
  338. margin-top:10%;
  339. border-radius:16rpx;
  340. display: flex;
  341. flex-direction:column;
  342. overflow: hidden;
  343. background-color: #fff;
  344. .info-positon-box{
  345. flex:1;
  346. overflow-x: hidden;
  347. overflow-y: scroll;
  348. .info-positon-title{
  349. height:80rpx;
  350. line-height:80rpx;
  351. text-align: center;
  352. border-bottom:1px solid #dedede;
  353. margin-bottom:20rpx;
  354. font-size:32rpx;
  355. }
  356. .info-positon-text-box{
  357. display: flex;
  358. padding:10rpx 40rpx;
  359. view:nth-child(1){
  360. width:140rpx;
  361. font-size:28rpx;
  362. }
  363. view:nth-child(2){
  364. width:380rpx;
  365. word-wrap: break-word;
  366. font-size:28rpx;
  367. }
  368. }
  369. }
  370. .info-positon-button-box{
  371. border-top:1px solid #dedede;
  372. view{
  373. background-color: #999;
  374. color:#fff;
  375. text-align: center;
  376. line-height:60rpx;
  377. height:60rpx;
  378. font-size:28rpx;
  379. width:160rpx;
  380. margin:10rpx auto;
  381. border-radius:12rpx;
  382. }
  383. }
  384. }
  385. }
  386. }
  387. </style>