situationsCenter.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="situationsCenter-page">
  3. <view class="situation-list">
  4. <view class="search-box">
  5. <view class="search-model" @click="openSearchBar" v-show="isSearchBoxShow">
  6. <image class="search-pic" src="/static/search.png"></image>
  7. </view>
  8. <view class="search-bar" v-show="isSearchBarShow">
  9. <view class="search-item">
  10. <image class="search-pic" src="/static/search.png"></image>
  11. <image class="text-clear" @click="valueEmpty" src="/static/text-clear.png"></image>
  12. <input class="searh-input" v-model="inputValue" @confirm="searchByKeywords($event)" placeholder="搜索项目" placeholder-style="font-weight: 400,color: #A1A7B3" />
  13. </view>
  14. <text class="cancel-text" @click="closeSearchBar">取消</text>
  15. </view>
  16. </view>
  17. <scroll-view class="scroll-box" scroll-y="true" @scrolltolower="toLower" lower-threshold="184">
  18. <view class="content">
  19. <view class="situation" v-for="(item,index) in situationList" :key="item.id" @click="gotoDetail(item.situationID)">
  20. <image class="situation-topic" :src="`/static/${item.topic ? 'situation-case' : 'situation-system'}.png`"></image>
  21. <view class="title">
  22. <text class="title-name">{{item.name}}</text>
  23. </view>
  24. <view class="check-group">
  25. <text class="group-text">{{item.checkGroupName}}</text>
  26. </view>
  27. <view class="row">
  28. <image class="situation-check" src="/static/situation-check.png"></image>
  29. <text class="text">{{item.checkStatus}}</text>
  30. </view>
  31. <view class="row">
  32. <image class="situation-time" src="/static/situation-time.png"></image>
  33. <text class="text">{{item.nextCheckTime}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. <view class="situaions-add" @click="gotoCreate">
  40. <image class="add-pic" src="/static/situation-add.png"></image>
  41. </view>
  42. <tm-tabbar :permission="nowPermission" />
  43. </view>
  44. </template>
  45. /**
  46. * 情境中心
  47. */
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. page:1,//页数
  53. inputValue:'',
  54. nowPermission:'',
  55. isSearchBarShow:false,//搜索栏是否可见
  56. isSearchBoxShow:true,//搜索图标是否可见
  57. situationList:[],//情境卡片列表
  58. totalCount:'',//返回数据的总条数
  59. }
  60. },
  61. created: function() {
  62. this.nowPermission=uni.getStorageSync('nowPermission');
  63. this.$store.dispatch({
  64. type: 'situationsCenter/commActions',
  65. payload: {
  66. key: 'situationList',
  67. data:{
  68. pageNum:1,
  69. pageSize:10
  70. }
  71. }
  72. }).then((data) => {
  73. if (data) {
  74. this.totalCount=data.totalCount;
  75. this.situationList=data.list.map((item,index)=>{
  76. return{
  77. name:item.name,
  78. checkStatus:item.checkStatus,
  79. nextCheckTime:item.nextCheckTime,
  80. checkGroupName:item.checkGroupName,
  81. topic:item.topic==0?true:false,
  82. situationID:item.id,
  83. }
  84. });
  85. }
  86. });
  87. },
  88. methods: {
  89. openSearchBar(){
  90. this.isSearchBarShow=true;
  91. this.isSearchBoxShow=false;
  92. },
  93. closeSearchBar(){
  94. this.isSearchBarShow=false;
  95. this.isSearchBoxShow=true;
  96. },
  97. valueEmpty(){
  98. this.inputValue='';
  99. },
  100. gotoCreate(){
  101. uni.navigateTo({
  102. url: '/pages/creatingSituations/creatingSituations'
  103. });
  104. },
  105. gotoDetail(id){
  106. uni.navigateTo({
  107. url: `/pages/situationDetail/situationDetail?situationId=${id}`
  108. });
  109. },
  110. searchByKeywords(event){
  111. console.log(event);
  112. this.$store.dispatch({
  113. type: 'situationsCenter/commActions',
  114. payload: {
  115. key: 'situationList',
  116. data:{
  117. pageNum:1,
  118. pageSize:10,
  119. keyword:event.target.value,
  120. }
  121. }
  122. }).then((data)=>{
  123. if (data) {
  124. this.situationList=data.list.map((item,index)=>{
  125. return{
  126. name:item.name,
  127. checkStatus:item.checkStatus,
  128. nextCheckTime:item.nextCheckTime,
  129. checkGroupName:item.checkGroupName,
  130. topic:item.topic==0?true:false,
  131. }
  132. });
  133. }
  134. });
  135. },
  136. toLower(){
  137. uni.showToast({
  138. title:'加载中....',
  139. icon:'loading',
  140. duration:2000
  141. });
  142. let count=this.situationList.length;
  143. if(this.totalCount!=count){
  144. this.page++;
  145. this.$store.dispatch({
  146. type: 'situationsCenter/commActions',
  147. payload: {
  148. key: 'situationList',
  149. data:{
  150. pageNum:this.page,
  151. pageSize:10
  152. }
  153. }
  154. }).then((data) => {
  155. if (data) {
  156. this.situationList=data.list.map((item,index)=>{
  157. return{
  158. name:item.name,
  159. checkStatus:item.checkStatus,
  160. nextCheckTime:item.nextCheckTime,
  161. checkGroupName:item.checkGroupName,
  162. topic:item.topic==0?true:false,
  163. situationID:item.id,
  164. }
  165. });
  166. }
  167. });
  168. }
  169. else{
  170. uni.showToast({
  171. title:'没有更多数据了',
  172. icon:'none',
  173. duration:1000
  174. });
  175. }
  176. },
  177. }
  178. }
  179. </script>
  180. <style lang="less">
  181. .situationsCenter-page{
  182. height: 100%;
  183. .situation-list{
  184. // display: flex;
  185. // flex-flow: row wrap;
  186. // margin-top: 12.5rpx;
  187. position: relative;
  188. .search-box{
  189. position: absolute;
  190. left: 25rpx;
  191. top: 0rpx;
  192. z-index: 2;
  193. .search-model{
  194. height: 62.5rpx;
  195. width: 62.5rpx;
  196. background-color: #FFFFFF;
  197. text-align: center;
  198. border-radius: 50%;
  199. box-shadow: 0px 10px 10px 0px rgba(217, 221, 228, 0.5);
  200. border: 1px solid #E6EAF2;
  201. opacity: 0.85;
  202. .search-pic{
  203. width: 27.5rpx;
  204. height: 27.5rpx;
  205. margin-top: 17.5rpx;
  206. }
  207. }
  208. .search-bar{
  209. background-color: #FFFFFF;
  210. width: 700rpx;
  211. height: 62.5rpx;
  212. top: 31.25rpx;
  213. position: absolute;
  214. z-index: 2;
  215. .search-item{
  216. background-color: #FFFFFF;
  217. width: 593.75rpx;
  218. height: 62.5rpx;
  219. float: left;
  220. border-radius: 6.25rpx;
  221. border: 1.25rpx solid #F0F2F7;
  222. .search-pic{
  223. width: 21.87rpx;
  224. height: 21.87rpx;
  225. margin-left:12.5rpx ;
  226. margin-top: 20.62rpx;
  227. float: left;
  228. }
  229. .searh-input{
  230. background-color: #FFFFFF;
  231. width: 525rpx;
  232. height: 55rpx;
  233. font-size: 22.5rpx;
  234. float: right;
  235. margin-top: 3.75rpx;
  236. margin-left: 3.12rpx;
  237. }
  238. .text-clear{
  239. width: 21.87rpx;
  240. height: 21.87rpx;
  241. float: right;
  242. margin-top: 20.62rpx;
  243. margin-right: 6.25rpx;
  244. }
  245. }
  246. .cancel-text{
  247. font-size: 22.5rpx;
  248. line-height: 62.5rpx;
  249. color: #A1A7B3;
  250. margin-right: 31.25rpx;
  251. float: right;
  252. }
  253. }
  254. }
  255. .scroll-box{
  256. height: 1072.5rpx;
  257. width: 750rpx;
  258. // margin-top: 25rpx;
  259. .content{
  260. display: flex;
  261. flex-flow: row wrap;
  262. .situation{
  263. height: 187.5rpx;
  264. width: 337.5rpx;
  265. background: #FFFFFF;
  266. box-shadow: 0px 6px 20px 0px rgba(0, 13, 51, 0.1);
  267. border-radius: 8px;
  268. margin-left: 25rpx;
  269. margin-top: 25rpx;
  270. .situation-topic{
  271. width: 62.5rpx;
  272. height: 25rpx;
  273. float: right;
  274. }
  275. .title{
  276. height: 22.5rpx;
  277. margin-left: 20rpx;
  278. margin-top: 25rpx;
  279. display: flex;
  280. align-items: center;
  281. .title-name{
  282. font-size: 22.5rpx;
  283. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  284. font-weight: bold;
  285. color: #292C33;
  286. }
  287. }
  288. .check-group{
  289. margin-left: 20rpx;
  290. margin-top: 15rpx;
  291. margin-bottom: 25rpx;
  292. height: 17.5rpx;
  293. display: flex;
  294. align-items: center;
  295. .group-text{
  296. font-size: 17.5rpx;
  297. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  298. font-weight: 400;
  299. color: #666E80;
  300. }
  301. }
  302. .row{
  303. margin-left: 20rpx;
  304. margin-bottom: 17.5rpx;
  305. display: flex;
  306. align-items: center;
  307. height: 20rpx;
  308. .situation-check{
  309. width: 20rpx;
  310. height: 20rpx;
  311. }
  312. .situation-time{
  313. width: 20rpx;
  314. height: 20rpx;
  315. }
  316. .text{
  317. font-size: 20rpx;
  318. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  319. font-weight: 400;
  320. color: #292C33;
  321. margin-left: 11.25rpx;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. }
  328. .situaions-add{
  329. position: absolute;
  330. right: 25rpx;
  331. bottom: 130rpx;
  332. .add-pic{
  333. width: 75rpx;
  334. height: 75rpx;
  335. }
  336. }
  337. }
  338. </style>