index1.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <!-- 卡片栏 -->
  4. <view v-if="tableData.length>0 && isLoaded">
  5. <view v-for="(item, index) in tableData" :key="index">
  6. <uni-card>
  7. <!-- 标题 -->
  8. <view class="titles">{{ item.jmzzqmc }}</view>
  9. <!-- 简要内容 -->
  10. <view class="duanluo">
  11. <text class="name-align-files">消防安全管理人:</text>
  12. <text class="conts">{{ item.xfaqglr }}</text>
  13. </view>
  14. <view class="duanluo">
  15. <text class="name-align-files">联系电话:</text>
  16. <text class="conts">{{ item.lxdh }}</text>
  17. </view>
  18. <view class="duanluo">
  19. <text class="name-align-files">居民人数:</text>
  20. <text class="conts">{{ item.jmrs }}</text>
  21. </view>
  22. <view style="margin-top: 60rpx;">
  23. <view class="an-niu" @click.native="showModal(item)">
  24. <view class="detailDel">删除</view>
  25. </view>
  26. <view class="an-niu" @click.native="onClick(item)" link><text class="detail">查看详情</text></view>
  27. </view>
  28. </uni-card>
  29. </view>
  30. </view>
  31. <!-- tableData为空时显示 -->
  32. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  33. <view class="text-gray" style="padding-top: 20px;" v-if="tableData == 0">
  34. <img :src="tan90" alt="暂无数据" />
  35. </view>
  36. </view>
  37. <view>
  38. <image :src="Group" @click="addClick" class="tiantupian"></image>
  39. </view>
  40. <u-modal :show="show" @confirm="confirm" @cancel="cancel" @close="close" asyncClose closeOnClickOverlay
  41. showCancelButton confirmColor="red" :title="title" :content="content" ref="uModal"></u-modal>
  42. <!-- 加载中 -->
  43. <isLodingModel></isLodingModel>
  44. </view>
  45. </template>
  46. <script>
  47. var that = '';
  48. import {
  49. getArchive, //获取培训演练信息列表
  50. delArchive, //删除培训演练信息
  51. } from '@/api/archive/index1.js';
  52. import config from '@/config'
  53. const baseUrlImg = config.baseUrlImg
  54. export default {
  55. data() {
  56. return {
  57. isLoaded: false,
  58. Group: `${baseUrlImg}/checkActive/Group.png`,
  59. showOrg: false,
  60. actions: [],
  61. // 数据
  62. tableData: {},
  63. title: '是否删除该数据项?',
  64. content: '确认删除?',
  65. id: '',
  66. tan90: `${baseUrlImg}/tan90.png`,
  67. // 每页数据量
  68. pageSize: 5,
  69. // 当前页
  70. pageNo: 1,
  71. // 数据总量
  72. total: 0,
  73. // tableData数据加载中
  74. loading: false,
  75. // 初始化时搜索框的值
  76. keyword: '',
  77. // 存放orgid,orgname
  78. formData: {
  79. orgName: ''
  80. },
  81. show: false,
  82. showtimeStart: false,
  83. showtimeEnd: false
  84. };
  85. },
  86. // 在 vue页面,向起始页通过事件传递数据
  87. watch: {
  88. loading: {
  89. handler(newLength, oldLength) {
  90. this.$modal.isLoadingModel(this.loading)
  91. },
  92. immediate: true
  93. }
  94. },
  95. onLoad: function(option) {},
  96. onShow() {
  97. this.tableData = []
  98. this.getData();
  99. },
  100. onReady() {},
  101. mixins: [uni.$u.mixin],
  102. methods: {
  103. // 模态框内容
  104. showModal(val) {
  105. this.show = true;
  106. this.id = val.id;
  107. },
  108. confirm() {
  109. this.show = false;
  110. delArchive({
  111. id: this.id
  112. }).then(response => {
  113. this.loading = true;
  114. this.isLoaded = false
  115. this.tableData = []
  116. this.getData();
  117. });
  118. },
  119. close() {
  120. this.show = false;
  121. },
  122. cancel() {
  123. this.show = false;
  124. },
  125. // 获取数据
  126. getData() {
  127. this.loading = true;
  128. const value = uni.getStorageSync('getUserInfo_key');
  129. // 获取培训演练信息详细信息
  130. getArchive({
  131. pageNo: this.pageNo,
  132. pageSize: this.pageSize,
  133. streetId: value.streetInfo ? value.streetInfo.id : ''
  134. }).then(response => {
  135. this.isLoaded = true
  136. this.tableData = [...this.tableData, ...response.data.list]
  137. this.loading = false
  138. // this.tableData = response.data.list;
  139. });
  140. },
  141. // 传递数据
  142. onClick(val) {
  143. this.isLoaded = false
  144. uni.navigateTo({
  145. url: '/pagesA/fire/archive/archive_details/archive_details1?id=' + val.id,
  146. events: {
  147. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  148. acceptDataFromOpenedPage: function(val) {
  149. }
  150. },
  151. success: function(res) {
  152. // 通过eventChannel向被打开页面传送数据
  153. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  154. }
  155. });
  156. },
  157. addClick() {
  158. this.isLoaded = false
  159. uni.navigateTo({
  160. url: '/pagesA/fire/archive/add_archive/add_archive1'
  161. });
  162. },
  163. // 触底的事件
  164. onReachBottom() {
  165. // 判断是否还有下一页数据
  166. if (this.pageNo * this.pageSize >= this.total)
  167. return uni.showToast({
  168. title: `数据加载完毕`
  169. });
  170. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  171. if (this.loading) return;
  172. this.pageNo += 1;
  173. this.getData(this.pageNo);
  174. }
  175. }
  176. };
  177. </script>
  178. <style lang="scss" scoped>
  179. body {
  180. background-color: #f5f7f9;
  181. }
  182. page {
  183. background-color: #f5f7f9;
  184. }
  185. /deep/ .u-tabs__wrapper[data-v-0de61367],
  186. /deep/.u-tabs__wrapper.data-v-0de61367,
  187. /deep/.u-tabs__wrapper {
  188. width: 99%;
  189. }
  190. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  191. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  192. /deep/.u-tabs__wrapper__nav__item {
  193. padding: 0 60rpx;
  194. }
  195. .uni-container {
  196. height: 100vh;
  197. padding-right: 20upx;
  198. }
  199. .addInsp {
  200. width: 40px;
  201. position: fixed;
  202. right: 4px;
  203. z-index: 99999;
  204. }
  205. ::v-deep .u-icon__icon {
  206. margin-right: 0px !important;
  207. }
  208. .an-niu {
  209. float: right;
  210. font-size: 10px;
  211. text-align: center;
  212. display: flex;
  213. margin-top: -64upx;
  214. padding-bottom: 30rpx;
  215. // margin-top: 50rpx;
  216. color: #fff;
  217. .detail {
  218. width: 60px;
  219. height: 60rpx;
  220. padding: 0 20rpx;
  221. border-radius: 30px;
  222. background-color: #f7c41e;
  223. margin-right: 20rpx;
  224. text-align: center;
  225. line-height: 60rpx;
  226. font-size: 27upx;
  227. }
  228. .detailDel {
  229. width: 60px;
  230. height: 60rpx;
  231. padding: 0 20rpx;
  232. border-radius: 30px;
  233. background-color: #ff2e31;
  234. color: white;
  235. margin-right: 20rpx;
  236. text-align: center;
  237. line-height: 60rpx;
  238. font-size: 30upx;
  239. }
  240. .solve {
  241. width: 62px;
  242. height: 60rpx;
  243. margin-right: 20rpx;
  244. border-radius: 30px;
  245. background-color: #4cb2b6;
  246. line-height: 60rpx;
  247. }
  248. /deep/ .padding-tb-sm {
  249. padding-top: 0px;
  250. padding-bottom: 10px;
  251. }
  252. .deletes {
  253. width: 62px;
  254. height: 60rpx;
  255. border-radius: 60rpx;
  256. background-color: red;
  257. color: #fff;
  258. line-height: 60rpx;
  259. }
  260. }
  261. /deep/.segmented-control__item--button {
  262. background-color: rgb(76, 178, 182) !important;
  263. }
  264. /deep/.segmented-control__item--button--active {
  265. background-color: #ffffff !important;
  266. }
  267. /deep/.uni-card {
  268. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  269. border-radius: 30rpx;
  270. }
  271. .tiantupian {
  272. width: 110rpx;
  273. height: 110rpx;
  274. position: fixed;
  275. right: 15px;
  276. bottom: 80rpx;
  277. }
  278. //列表样式
  279. .titles {
  280. font-weight: 600;
  281. margin-bottom: 10rpx;
  282. color: #1E293B;
  283. font-size: 30rpx;
  284. }
  285. .conts {
  286. max-width: 470rpx;
  287. display: -webkit-box;
  288. /*弹性伸缩盒子模型显示*/
  289. -webkit-box-orient: vertical;
  290. /*排列方式*/
  291. -webkit-line-clamp: 1;
  292. /*显示文本行数*/
  293. overflow: hidden;
  294. /*溢出隐藏*/
  295. color: #274647;
  296. text-overflow: ellipsis;
  297. /*不知道干嘛的*/
  298. .conts-title {
  299. margin-right: 10rpx;
  300. color: #728f90;
  301. }
  302. }
  303. .max-width {
  304. max-width: 180upx;
  305. }
  306. .duanluo {
  307. display: flex;
  308. margin-bottom: 20rpx;
  309. color: #728f90;
  310. }
  311. </style>