index2.vue 7.6 KB

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