index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="container uni-container uni-container-bg">
  3. <view class=" ">
  4. <uni-row class="demo-uni-row" :gutter="20" width="100%">
  5. <uni-col :span="24">
  6. <!-- 搜索界面 -->
  7. <view class="u-page__tag-item">
  8. <u-search :showAction="true" actionText="搜索" ref="uToast" bgColor="#edf6f9"
  9. borderColor="#4cb2b6" shape="square" v-model="keyword" placeholder="请输入会议名称"
  10. @custom="search(keyword)"></u-search>
  11. </view>
  12. </uni-col>
  13. </uni-row>
  14. </view>
  15. <view class="padding-tb-sm">
  16. <uni-row class="demo-uni-row align-center flex " :gutter="20" width="100%">
  17. <!-- <uni-col :span="12">
  18. <view class="flex flex-direction-row">
  19. <text class="text-Width ">开始时间:</text>
  20. <u-button customStyle="background-color: #4cb2b6;" plain shape="circle" size="small"
  21. color="#fff" @click="showtimeStart = true" :text="formData.start"></u-button>
  22. <uni-datetime-picker :show="showtimeStart" :value="formData.start" mode="date" closeOnClickOverlay
  23. @confirm="confirmStarttime" @cancel="showtimeStart = false" @change="changetime"
  24. @close="showtimeStart = false"></uni-datetime-picker>
  25. </view>
  26. </uni-col> -->
  27. <uni-col :span="23">
  28. <view class="flex flex-direction-row">
  29. <!-- <text class="text-Width">结束时间:</text>
  30. <u-button customStyle="background-color: #4cb2b6;" plain shape="circle" size="small"
  31. color="#fff" @click="showtimeEnd = true" :text="formData.end"></u-button> -->
  32. <uni-datetime-picker :show="showtimeEnd" v-model="formData.choicotime" type="daterange"
  33. closeOnClickOverlay @confirm="confirmEndtime" @cancel="showtimeEnd = false"
  34. @change="changetime" @close="showtimeEnd = false"></uni-datetime-picker>
  35. <view class="search-icon">
  36. <u-icon name="search" color="#4CB2B6" size="40" @click="handleQuery"></u-icon>
  37. </view>
  38. </view>
  39. </uni-col>
  40. </uni-row>
  41. </view>
  42. <view class="">
  43. <u-list @scrolltolower="scrolltolower">
  44. <u-list-item v-for="(item, index) in tableData" :key="index" link>
  45. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  46. <!-- 会议名称 -->
  47. <uni-col :span="18" class="text-xl font-weight-700">{{ item.meetingName }}</uni-col>
  48. <uni-col :span="6" class="justify-end flex">
  49. <u-button shape="circle"
  50. :color="item.timeStuta == 0 ? '#4cb2b6' : item.timeStuta == 1 ? '#bbbbbb' : '#bbbbbb'"
  51. size="small" style="width: 160rpx;">
  52. {{ statusListTran(item.timeStuta) }}
  53. </u-button>
  54. </uni-col>
  55. </uni-row>
  56. <uni-row class="demo-uni-row padding-bottom-sm text-sm" :gutter="20" width="100%">
  57. <uni-col style="color: #728F90;" :span="24">
  58. 会议时间:{{ item.meetingStartTime }} -- {{ item.meetingEndTime }}
  59. </uni-col>
  60. </uni-row>
  61. <uni-row class="demo-uni-row padding-tb-sm text-sm" :gutter="20" width="100%">
  62. <uni-col :span="8">
  63. <view class="flex direction-column">
  64. <text class="padding-bottom"> 会议类型</text>
  65. <text style="font-weight: bold;"
  66. class="text-1cut">{{ item.meetingType=='1'?"工作会议":"培训会议" }}</text>
  67. </view>
  68. </uni-col>
  69. <uni-col :span="6">
  70. <view class="flex direction-column" v-if="item.meetingAtt">
  71. <text class="padding-bottom"> 会议附件:</text>
  72. <!-- #ifdef MP-WEIXIN -->
  73. <text style="color:#00a3f4;cursor: pointer;margin-left: 50rpx !important;"
  74. @click.native="viewSee(item.meetingAtt)">下载附件</text>
  75. <!-- #endif -->
  76. <!-- #ifdef H5 -->
  77. <a style="color:#00a3f4;cursor: pointer;margin-left: 50rpx !important;"
  78. @click="viewSee(item.meetingAtt)">下载附件</a>
  79. <!-- #endif -->
  80. </view>
  81. </uni-col>
  82. <uni-col :span="10">
  83. <view class="flex direction-column align-end ">
  84. <text class="padding-bottom">会议主题</text>
  85. <text style="font-weight: bold;" class="text-1cut">{{ item.meetingSubject }}</text>
  86. </view>
  87. </uni-col>
  88. </uni-row>
  89. <view>
  90. <view>
  91. <button class="regsiterBtn" @click="peopleReg(item)"
  92. v-if="statusListTran(item.timeStuta)=='进行中'||statusListTran(item.timeStuta)=='未开始'?true:false">报名</button>
  93. <!-- <button class="regsiterBtn" @click="onClick(item)">签到</button> -->
  94. <button class="regsiterBtn" v-if="statusListTran(item.timeStuta)=='已结束'?true:false"
  95. @click="searchMeet(item)">查看</button>
  96. </view>
  97. </view>
  98. </u-list-item>
  99. </u-list>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import {
  105. getMeeting // 查询会议列表
  106. } from '@/api/meeting';
  107. import {
  108. downSee
  109. } from '@/utils/common'
  110. import {
  111. parseTime // 时间戳转换
  112. } from '@/utils/ruoyi';
  113. export default {
  114. data() {
  115. return {
  116. statusList: {
  117. 0: '进行中',
  118. 1: '已结束',
  119. 2: '未开始'
  120. },
  121. // 人员数据
  122. tableData: [],
  123. Control: '',
  124. // 每页数据量
  125. pageSize: 20,
  126. // 当前页
  127. pageNo: 1,
  128. // 数据总量
  129. total: 0,
  130. // tableData数据加载中
  131. loading: false,
  132. // 初始化时搜索框的值
  133. keyword: '',
  134. // 开始时间与结束时间
  135. startTime: '',
  136. endTime: '',
  137. formData: {
  138. start: '请选择开始时间',
  139. end: '请选择结束时间',
  140. choicotime: []
  141. },
  142. showtimeStart: false,
  143. showtimeEnd: false,
  144. meetingStartTime: '',
  145. meetingEndTime: '',
  146. logReg: true,
  147. };
  148. },
  149. onLoad() {
  150. this.getData(1);
  151. },
  152. methods: {
  153. /** 搜索按钮操作 */
  154. handleQuery() {
  155. if (this.formData.choicotime.length && this.formData.choicotime[0].indexOf(":") === -1) {
  156. this.meetingStartTime = this.formData.choicotime[0] + ' 00:00:00'
  157. this.meetingEndTime = this.formData.choicotime[1] + ' 23:59:59'
  158. }
  159. this.pageNo = 1;
  160. this.tableData = []
  161. this.getData(1);
  162. },
  163. // =================数据转换==================
  164. statusListTran(val) {
  165. //status状态转换
  166. return this.statusList[val];
  167. },
  168. search(val) {
  169. this.tableData = []
  170. this.getData(1)
  171. },
  172. //查看已上传附件
  173. viewSee(val) {
  174. downSee(val)
  175. },
  176. // =============获取数据===================s
  177. // 获取数据
  178. getData(pageNo, value = '') {
  179. this.loading = true;
  180. this.pageNo = pageNo;
  181. // 向 getMeeting 接口请求数据所传递的参数
  182. getMeeting({
  183. pageNo: this.pageNo,
  184. pageSize: this.pageSize,
  185. userId: this.$store.state.user.id,
  186. meetingName: this.keyword,
  187. meetingStartTime: this.meetingStartTime,
  188. meetingEndTime: this.meetingEndTime
  189. }).then(response => {
  190. // 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
  191. this.tableData = [...this.tableData, ...response.data.list];
  192. // 签到流程判断
  193. // 数组时间戳转换
  194. this.tableData.map(i => {
  195. var meetingEndTime = new Date(i.meetingEndTime).getTime();
  196. var meetingStartTime = new Date(i.meetingStartTime).getTime();
  197. var currentTime = new Date().getTime();
  198. i.meetingStartTime = parseTime(i.meetingStartTime);
  199. i.meetingEndTime = parseTime(i.meetingEndTime);
  200. // 如果结束时间大于
  201. if (meetingStartTime < currentTime && meetingEndTime > currentTime) {
  202. i.timeStuta = 0;
  203. } else if (meetingEndTime < currentTime) {
  204. i.timeStuta = 1;
  205. } else {
  206. i.timeStuta = 2;
  207. }
  208. });
  209. this.total = response.data.total;
  210. this.meetingStartTime = '';
  211. this.meetingEndTime = '';
  212. this.loading = false;
  213. });
  214. },
  215. onClick(val) {
  216. uni.navigateTo({
  217. url: '/pagesA/fire/meeting_sign_in/meeting_details/meeting_details?id=' + val.id,
  218. events: {
  219. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  220. acceptDataFromOpenedPage: function(val) {
  221. }
  222. },
  223. success: function(res) {
  224. // 通过eventChannel向被打开页面传送数据
  225. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  226. }
  227. });
  228. },
  229. // 触底的事件
  230. scrolltolower() {
  231. // 判断是否还有下一页数据
  232. if (this.pageNo * this.pageSize >= this.total)
  233. return uni.showToast({
  234. title: `数据加载完毕`
  235. });
  236. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  237. if (this.loading) return;
  238. this.pageNo += 1;
  239. this.getData(this.pageNo);
  240. },
  241. // onReachBottom() {
  242. // // 判断是否还有下一页数据
  243. // if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  244. // title: `数据加载完毕`
  245. // })
  246. // // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  247. // if (this.loading) return
  248. // this.pageNo += 1
  249. // this.getData(this.pageNo)
  250. // },
  251. //日期范围
  252. // 开始日期
  253. confirmStarttime(e) {
  254. this.showtimeStart = false;
  255. let startTime = this.startTime = e.value;
  256. if (startTime <= 0) {
  257. }
  258. let value = new Date(e.value);
  259. this.formData.start = e.value ? uni.$u.timeFormat(e.value, 'yyyy/mm/dd') : '';
  260. },
  261. changetime(e) {
  262. },
  263. confirmEndtime(e) {
  264. const times = this.formData.start
  265. const timestamp = new Date(times).getTime();
  266. if (e.value < timestamp) {
  267. return this.$modal.msg('结束时间不能小于开始时间,请重新选择')
  268. } else {
  269. this.showtimeEnd = false;
  270. let value = new Date(e.value);
  271. this.formData.end = e.value ? uni.$u.timeFormat(e.value, 'yyyy/mm/dd') : '';
  272. }
  273. // this.meetingStartTime.push(this.formData.start,this.formData.end)
  274. this.meetingStartTime = this.formData.start
  275. this.meetingEndTime = this.formData.end
  276. this.tableData = []
  277. this.getData(1)
  278. },
  279. peopleReg(row) {
  280. // console.log(row, 'row');
  281. uni.navigateTo({
  282. url: `/pagesA/fire/metting_regsiter/metting_sigin?metId=${row.id}&metName=${row.meetingName}`
  283. })
  284. },
  285. searchMeet(row) {
  286. uni.navigateTo({
  287. url: `/pagesA/fire/metting_regsiter/metting_sigin?meetSearch=${row.id}`
  288. })
  289. }
  290. }
  291. };
  292. </script>
  293. <style lang="scss" scoped>
  294. .text-Width {
  295. width: 340rpx;
  296. text-align: center;
  297. align-items: center;
  298. justify-content: center;
  299. display: flex;
  300. }
  301. .regsiterBtn {
  302. width: 200rpx;
  303. height: 60rpx;
  304. text-align: center;
  305. line-height: 60rpx;
  306. background-color: #4DB1B5;
  307. font-size: 20rpx;
  308. color: white;
  309. float: right;
  310. border-radius: 30rpx;
  311. margin-left: 20rpx;
  312. }
  313. </style>