index6.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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.xcdd }}</view>
  9. <!-- 简要内容 -->
  10. <view class="duanluo">
  11. <text class="name-align-taizhang">参加人员及人数 :</text>
  12. <text class="conts">{{ item.cjryrs }}</text>
  13. </view>
  14. <view class="duanluo">
  15. <text class="name-align-taizhang">方式 :</text>
  16. <text class="conts">{{ item.xcfs }}</text>
  17. </view>
  18. <view class="duanluo">
  19. <text class="name-align-taizhang">时间:</text>
  20. <text class="conts max-width">{{ item.xcsj }}</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/index6.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. // 在 vue页面,向起始页通过事件传递数据
  88. onLoad: function(option) {},
  89. onShow() {
  90. this.tableData = []
  91. this.getData();
  92. },
  93. watch: {
  94. loading: {
  95. handler(newLength, oldLength) {
  96. this.$modal.isLoadingModel(this.loading)
  97. },
  98. immediate: true
  99. }
  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. });
  119. },
  120. close() {
  121. this.show = false;
  122. },
  123. cancel() {
  124. this.show = false;
  125. },
  126. // 获取数据
  127. getData() {
  128. this.loading = true;
  129. const value = uni.getStorageSync('getUserInfo_key');
  130. // 获取培训演练信息详细信息
  131. getArchive({
  132. pageNo: this.pageNo,
  133. pageSize: this.pageSize,
  134. streetId: value.streetInfo ? value.streetInfo.id : ''
  135. }).then(response => {
  136. this.isLoaded = true
  137. this.tableData = [...this.tableData, ...response.data.list]
  138. this.loading = false
  139. // this.tableData = response.data.list;
  140. });
  141. },
  142. // 传递数据
  143. onClick(val) {
  144. this.isLoaded = false
  145. uni.navigateTo({
  146. url: '/pagesA/fire/archive/archive_details/archive_details6?id=' + val.id,
  147. events: {
  148. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  149. acceptDataFromOpenedPage: function(val) {
  150. }
  151. },
  152. success: function(res) {
  153. // 通过eventChannel向被打开页面传送数据
  154. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  155. }
  156. });
  157. },
  158. addClick() {
  159. this.isLoaded = false
  160. uni.navigateTo({
  161. url: '/pagesA/fire/archive/add_archive/add_archive6'
  162. });
  163. },
  164. // 触底的事件
  165. onReachBottom() {
  166. // 判断是否还有下一页数据
  167. if (this.pageNo * this.pageSize >= this.total)
  168. return uni.showToast({
  169. title: `数据加载完毕`
  170. });
  171. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  172. if (this.loading) return;
  173. this.pageNo += 1;
  174. this.getData(this.pageNo);
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. body {
  181. background-color: #f5f7f9;
  182. }
  183. page {
  184. background-color: #f5f7f9;
  185. }
  186. /deep/ .u-tabs__wrapper[data-v-0de61367],
  187. /deep/ .u-tabs__wrapper.data-v-0de61367 {
  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: 15rpx;
  309. color: #728f90;
  310. }
  311. </style>