situationsCenter.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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.setStorageSync('situaionID', id);
  107. uni.navigateTo({
  108. url: '/pages/situationDetail/situationDetail'
  109. });
  110. },
  111. searchByKeywords(event){
  112. console.log(event);
  113. this.$store.dispatch({
  114. type: 'situationsCenter/commActions',
  115. payload: {
  116. key: 'situationList',
  117. data:{
  118. pageNum:1,
  119. pageSize:10,
  120. keyword:event.target.value,
  121. }
  122. }
  123. }).then((data)=>{
  124. if (data) {
  125. this.situationList=data.list.map((item,index)=>{
  126. return{
  127. name:item.name,
  128. checkStatus:item.checkStatus,
  129. nextCheckTime:item.nextCheckTime,
  130. checkGroupName:item.checkGroupName,
  131. topic:item.topic==0?true:false,
  132. }
  133. });
  134. }
  135. });
  136. },
  137. toLower(){
  138. uni.showToast({
  139. title:'加载中....',
  140. icon:'loading',
  141. duration:2000
  142. });
  143. let count=this.situationList.length;
  144. if(this.totalCount!=count){
  145. this.page++;
  146. this.$store.dispatch({
  147. type: 'situationsCenter/commActions',
  148. payload: {
  149. key: 'situationList',
  150. data:{
  151. pageNum:this.page,
  152. pageSize:10
  153. }
  154. }
  155. }).then((data) => {
  156. if (data) {
  157. this.situationList=data.list.map((item,index)=>{
  158. return{
  159. name:item.name,
  160. checkStatus:item.checkStatus,
  161. nextCheckTime:item.nextCheckTime,
  162. checkGroupName:item.checkGroupName,
  163. topic:item.topic==0?true:false,
  164. situationID:item.id,
  165. }
  166. });
  167. }
  168. });
  169. }
  170. else{
  171. uni.showToast({
  172. title:'没有更多数据了',
  173. icon:'none',
  174. duration:1000
  175. });
  176. }
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="less">
  182. .situationsCenter-page{
  183. height: 100%;
  184. .situation-list{
  185. // display: flex;
  186. // flex-flow: row wrap;
  187. // margin-top: 12.5rpx;
  188. position: relative;
  189. .search-box{
  190. position: absolute;
  191. left: 25rpx;
  192. top: 0rpx;
  193. z-index: 2;
  194. .search-model{
  195. height: 62.5rpx;
  196. width: 62.5rpx;
  197. background-color: #FFFFFF;
  198. text-align: center;
  199. border-radius: 50%;
  200. box-shadow: 0px 10px 10px 0px rgba(217, 221, 228, 0.5);
  201. border: 1px solid #E6EAF2;
  202. opacity: 0.85;
  203. .search-pic{
  204. width: 27.5rpx;
  205. height: 27.5rpx;
  206. margin-top: 17.5rpx;
  207. }
  208. }
  209. .search-bar{
  210. background-color: #FFFFFF;
  211. width: 700rpx;
  212. height: 62.5rpx;
  213. top: 31.25rpx;
  214. position: absolute;
  215. z-index: 2;
  216. .search-item{
  217. background-color: #FFFFFF;
  218. width: 593.75rpx;
  219. height: 62.5rpx;
  220. float: left;
  221. border-radius: 6.25rpx;
  222. border: 1.25rpx solid #F0F2F7;
  223. .search-pic{
  224. width: 21.87rpx;
  225. height: 21.87rpx;
  226. margin-left:12.5rpx ;
  227. margin-top: 20.62rpx;
  228. float: left;
  229. }
  230. .searh-input{
  231. background-color: #FFFFFF;
  232. width: 525rpx;
  233. height: 55rpx;
  234. font-size: 22.5rpx;
  235. float: right;
  236. margin-top: 3.75rpx;
  237. margin-left: 3.12rpx;
  238. }
  239. .text-clear{
  240. width: 21.87rpx;
  241. height: 21.87rpx;
  242. float: right;
  243. margin-top: 20.62rpx;
  244. margin-right: 6.25rpx;
  245. }
  246. }
  247. .cancel-text{
  248. font-size: 22.5rpx;
  249. line-height: 62.5rpx;
  250. color: #A1A7B3;
  251. margin-right: 31.25rpx;
  252. float: right;
  253. }
  254. }
  255. }
  256. .scroll-box{
  257. height: 1072.5rpx;
  258. width: 750rpx;
  259. // margin-top: 25rpx;
  260. .content{
  261. display: flex;
  262. flex-flow: row wrap;
  263. .situation{
  264. height: 187.5rpx;
  265. width: 337.5rpx;
  266. background: #FFFFFF;
  267. box-shadow: 0px 6px 20px 0px rgba(0, 13, 51, 0.1);
  268. border-radius: 8px;
  269. margin-left: 25rpx;
  270. margin-top: 25rpx;
  271. .situation-topic{
  272. width: 62.5rpx;
  273. height: 25rpx;
  274. float: right;
  275. }
  276. .title{
  277. margin-left: 20rpx;
  278. // margin-top: 31.25rpx;
  279. padding-top: 25rpx;
  280. .title-name{
  281. font-size: 22.5rpx;
  282. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  283. font-weight: bold;
  284. color: #292C33;
  285. }
  286. }
  287. .check-group{
  288. margin-left: 20rpx;
  289. margin-top: 15rpx;
  290. margin-bottom: 7.5rpx;
  291. .group.text{
  292. font-size: 17.5rpx;
  293. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  294. font-weight: 400;
  295. color: #666E80;
  296. }
  297. }
  298. .row{
  299. margin-left: 20rpx;
  300. margin-top: 17.5rpx;
  301. .situation-check{
  302. width: 20rpx;
  303. height: 20rpx;
  304. }
  305. .situation-time{
  306. width: 20rpx;
  307. height: 20rpx;
  308. }
  309. .text{
  310. font-size: 20rpx;
  311. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  312. font-weight: 400;
  313. color: #292C33;
  314. margin-left: 11.25rpx;
  315. }
  316. }
  317. }
  318. }
  319. }
  320. }
  321. .situaions-add{
  322. position: absolute;
  323. right: 25rpx;
  324. bottom: 130rpx;
  325. .add-pic{
  326. width: 75rpx;
  327. height: 75rpx;
  328. }
  329. }
  330. }
  331. </style>