list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view>
  3. <van-sticky>
  4. <view class="top-wrap" v-show="['活动申请','活动审批'].includes(activity_type)">
  5. <van-tabs swipeable id="tabs" :active="status" title-active-color="#3385FF" color="#3385FF"
  6. @change="typeChange">
  7. <van-tab title="待处理" name="1"></van-tab>
  8. <van-tab title="已处理" name="2"></van-tab>
  9. </van-tabs>
  10. </view>
  11. </van-sticky>
  12. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0" />
  13. <view class="list-wrap" v-else>
  14. <!-- 活动 -->
  15. <block v-if="activity_type !== '事项'">
  16. <view class="item white-wrap" v-for="item in list" :key="item.RsCalendarResearcherId" @click="goDetail(item)">
  17. <!-- 路演 公开会议 -->
  18. <block v-if="['活动申请','活动审批'].includes(activity_type)">
  19. <view class="title flex">
  20. <image src="../../static/man.png" mode="aspectFill" class="icon" v-if="item.ActivityType=='路演'">
  21. </image>
  22. <image style="width:16px;height:16px" src="../static/icon-1.png" mode="aspectFill" class="icon"
  23. v-else></image>
  24. <view>{{item.ActivityType=='路演'?item.CompanyName:item.Theme}}</view>
  25. </view>
  26. <view class="content">
  27. <view class="info">活动类型:{{item.RoadshowType}}{{item.ActivityType}}</view>
  28. <view class="info">{{activity_type === '活动申请' ? `研究员:${item.ResearcherName}` : `提交销售:${item.SysUserRealName}` }} </view>
  29. <view class="info">提交时间:{{item.CreateTime|formatTime}}</view>
  30. </view>
  31. <view class="status approve-list-status-wait" v-if="item.Status=='1'">待审批</view>
  32. <view class="status approve-list-status-success" v-if="item.Status=='2'">已接受</view>
  33. <view class="status approve-list-status-fail" v-if="item.Status=='3'">已拒绝</view>
  34. <view class="status approve-list-status-cancel" v-if="item.Status=='4'">已删除</view>
  35. <view class="status approve-list-status-cancel" v-if="item.Status=='5'">已撤回</view>
  36. <view class="status approve-list-status-cancel" v-if="item.Status=='6'">已结束</view>
  37. </block>
  38. <!-- 其他 -->
  39. <block v-else-if="['内部会议','报告电话会'].includes(activity_type)">
  40. <view class="content">
  41. <view class="info">{{activity_type==='内部会议' ? '会议' : '活动'}}时间:
  42. {{item.StartDate}}({{item.StartWeek}})
  43. {{item.StartTime.substr(0,5)}}~{{item.EndTime.substr(0,5)}}
  44. </view>
  45. <view class="info" v-if="item.ActivityCategory">活动类别:{{item.ActivityCategory}} </view>
  46. <view class="info" v-if="['内部会议','报告电话会'].includes(activity_type)">参会人员:{{ item.ResearcherName }} </view>
  47. <view class="info">添加时间:{{item.CreateTime|formatTime}}</view>
  48. <view class="bot-btns" v-if="haveActiyityStart(item)">
  49. <van-button type="primary" plain color="#3385FF" class="btn" size="small" block round @click.stop="handleAction(item,'del')">删除</van-button>
  50. <van-button type="primary" color="#3385FF" class="btn" size="small" block round @click.stop="handleAction(item,'edit')">修改</van-button>
  51. </view>
  52. </view>
  53. </block>
  54. </view>
  55. </block>
  56. <!-- 事项 -->
  57. <block v-else>
  58. <view class="item white-wrap" v-for="item in list" :key="item.RsMattersId">
  59. <view class="content">
  60. <view class="info">{{activity_type==='内部会议' ? '会议' : '活动'}}时间:
  61. <block v-if="item.StartDate === item.EndDate">
  62. {{item.StartDate}}({{item.StartWeek}})
  63. {{item.StartTime.substr(0,5)}}~{{item.EndTime.substr(0,5)}}
  64. </block>
  65. <block v-else>
  66. {{item.StartDate}}({{item.StartWeek}}){{item.StartTime.substr(0,5)}}~{{item.EndDate}}({{item.EndWeek}}){{item.EndTime.substr(0,5)}}
  67. </block>
  68. </view>
  69. <view class="info" v-if="item.MatterContent">事项内容:{{item.MatterContent}} </view>
  70. <view class="info">添加时间:{{item.CreateTime|formatTime}}</view>
  71. <!-- <view class="info" v-if="item.EditReason" style="display: flex;">
  72. <view>最近修改记录:</view>
  73. <view>
  74. <view>{{item.EditReason}}</view>
  75. <view style="color: #999;">{{item.ModifyTime|formatTime}}</view>
  76. </view>
  77. </view> -->
  78. <view class="bot-btns">
  79. <van-button type="primary" plain color="#3385FF" class="btn" size="small" block round
  80. v-if="!item.ButtonAuth.RemoveDisabled"
  81. @click.stop="handleAction(item,'del')">删除</van-button>
  82. <van-button type="primary" color="#3385FF" class="btn" size="small" block round
  83. v-if="!item.ButtonAuth.EditDisabled"
  84. @click.stop="handleAction(item,'edit')">修改</van-button>
  85. </view>
  86. </view>
  87. </view>
  88. </block>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. apiRoadShowList
  95. } from '@/api/approve/activity.js'
  96. import {
  97. calendarTypeList,
  98. matterList,
  99. delMatter,
  100. delActivity
  101. } from '@/api/roadshow/index.js';
  102. import { getRole,editInfoBack } from './checkRole.js';
  103. import moment from '@/pages-roadshow/utils/_moment.js';
  104. export default {
  105. data() {
  106. return {
  107. activity_type: '',//活动类型
  108. status: '1',
  109. list: [],
  110. page: 1,
  111. finished: false,
  112. }
  113. },
  114. onLoad(options) {
  115. this.activity_type = options.type;
  116. // this.getList()
  117. uni.$on('activityApproveListUpdate', (e) => {
  118. console.log('activityApproveListUpdate' + e);
  119. this.list = this.list.filter(item => {
  120. return item.RsCalendarId != e.RsCalendarId && item.RsCalendarResearcherId != e
  121. .RsCalendarResearcherId
  122. })
  123. if (this.list.length === 0) {
  124. this.finished = true
  125. }
  126. })
  127. },
  128. onUnload() {
  129. uni.$off('activityApproveListUpdate')
  130. },
  131. onShow(options) {
  132. this.initState(this.activity_type);
  133. this.$nextTick(() => {
  134. this.selectComponent('#tabs').resize(); // 解决初始渲染 vant tab 底部条
  135. })
  136. },
  137. onPullDownRefresh() {
  138. this.page = 1
  139. this.finished = false
  140. this.list = []
  141. this.getList()
  142. setTimeout(() => {
  143. uni.stopPullDownRefresh()
  144. }, 1500)
  145. },
  146. onReachBottom() {
  147. if (this.finished) return
  148. this.page++
  149. this.getList()
  150. },
  151. methods: {
  152. /* 默认tab 状态 */
  153. initState(title) {
  154. uni.setNavigationBarTitle({
  155. title
  156. })
  157. this.page = 1
  158. this.finished = false
  159. this.list = []
  160. this.getList()
  161. },
  162. typeChange(e) {
  163. this.status = e.detail.name
  164. this.page = 1
  165. this.finished = false
  166. this.list = []
  167. this.getList()
  168. },
  169. async getList() {
  170. const res = ['活动申请','活动审批'].includes(this.activity_type)
  171. ? await apiRoadShowList({
  172. PageSize: 20,
  173. CurrentIndex: this.page,
  174. Status: this.status
  175. })
  176. : ['内部会议','报告电话会'].includes(this.activity_type)
  177. ? await calendarTypeList({
  178. PageSize: 20,
  179. CurrentIndex: this.page,
  180. CalendarType: this.activity_type==='内部会议' ? 1 : 2
  181. })
  182. : this.activity_type === '事项'
  183. ? await matterList({
  184. PageSize: 20,
  185. CurrentIndex: this.page,
  186. })
  187. : null
  188. if (res.code === 200) {
  189. if (!res.data.List || res.data.List.length === 0) {
  190. this.finished = true
  191. } else {
  192. let arr = res.data.List || []
  193. this.list = [...this.list, ...arr]
  194. }
  195. }
  196. },
  197. goDetail(e) {
  198. if(!['活动申请','活动审批'].includes(this.activity_type)) return;
  199. uni.navigateTo({
  200. url: `/pages-approve/activity/detail?RsCalendarId=${e.RsCalendarId}&RsCalendarResearcherId=${e.RsCalendarResearcherId}`
  201. })
  202. },
  203. /* 操作 */
  204. handleAction(item,type) {
  205. console.log(item)
  206. type === 'del' ? this.delActivityHandle(item) : this.editActivityHandle(item);
  207. },
  208. /* 删除活动/事项 */
  209. delActivityHandle({RsCalendarId,RsCalendarResearcherId,RsMattersId}) {
  210. uni.showModal({
  211. content: '删除该活动后,将从日历中移除,确定继续吗?',
  212. showCancel: true,
  213. cancelColor: '#A9AFB8',
  214. confirmColor: '#3385FF',
  215. success: async ({
  216. confirm,
  217. cancel
  218. }) => {
  219. if (confirm) {
  220. console.log('用户点击确定');
  221. const { code } = RsMattersId ? await delMatter({ RsMattersId }) : await delActivity({
  222. RsCalendarId,
  223. RsCalendarResearcherId
  224. })
  225. if(code !==200) return
  226. this.page = 1;
  227. this.list = [];
  228. this.getList();
  229. }
  230. }
  231. })
  232. },
  233. /* 修改 */
  234. editActivityHandle(item) {
  235. // console.log(item)
  236. const { RsCalendarId,RsCalendarResearcherId,RsMattersId,MatterContent,StartDate,StartTime,EndTime,EndDate } = item;
  237. //编辑活动
  238. if(!RsMattersId) {
  239. let form = editInfoBack(item,2),
  240. edit_id = RsCalendarId,
  241. edit_rs_id = RsCalendarResearcherId;
  242. // uni.navigateTo({
  243. // url:`/pages-roadshow/addActivity/index?form=${JSON.stringify(form)}&edit_id=${edit_id}&edit_rs_id=${edit_rs_id}`
  244. // });
  245. uni.navigateTo({
  246. url:`/pages-roadshow/addActivity/index`,
  247. success: function(res) {
  248. // 通过eventChannel向被打开页面传送数据
  249. res.eventChannel.emit('emitBackData', {
  250. form: JSON.stringify(form),
  251. edit_id,
  252. edit_rs_id
  253. })
  254. }
  255. });
  256. } else {
  257. //编辑事项
  258. this.editMatter({ RsMattersId,StartDate,StartTime,EndDate,EndTime,MatterContent });
  259. }
  260. },
  261. /* 编辑事项 */
  262. editMatter({ RsMattersId,StartDate,StartTime,EndDate,EndTime,MatterContent }) {
  263. let matter_form = {
  264. startTime: new Date(`${StartDate.replace(/-/g,'/')} ${StartTime}`).getTime(),
  265. endTime: new Date(`${EndDate.replace(/-/g,'/')} ${EndTime}`).getTime(),
  266. matterContent: MatterContent,
  267. },
  268. edit_matter_id = RsMattersId;
  269. // uni.navigateTo({
  270. // url:`/pages-roadshow/addMatter/index?form=${JSON.stringify(matter_form)}&edit_matter_id=${edit_matter_id}`
  271. // });
  272. uni.navigateTo({
  273. url:`/pages-roadshow/addMatter/index`,
  274. success: function(res) {
  275. // 通过eventChannel向被打开页面传送数据
  276. res.eventChannel.emit('emitBackData', {
  277. form: JSON.stringify(matter_form),
  278. edit_matter_id
  279. })
  280. }
  281. });
  282. },
  283. /* 活动是否已开始 */
  284. haveActiyityStart({ StartDate,StartTime }) {
  285. return moment(`${StartDate} ${StartTime}`).valueOf() > new Date().getTime()
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang="scss" scoped>
  291. .list-wrap {
  292. padding: 20rpx;
  293. .item {
  294. padding: 30rpx;
  295. box-shadow: 0px 3px 12px rgba(175, 175, 175, 0.16);
  296. border-radius: 8px;
  297. margin-bottom: 20rpx;
  298. .title {
  299. font-size: 16px;
  300. font-weight: bold;
  301. margin-bottom: 30rpx;
  302. .icon {
  303. width: 31rpx;
  304. height: 34rpx;
  305. flex-shrink: 0;
  306. margin-right: 10rpx;
  307. position: relative;
  308. top: 4rpx;
  309. }
  310. }
  311. .content {
  312. font-size: 14px;
  313. color: #666;
  314. .info {
  315. margin-bottom: 16rpx;
  316. /* text-indent: -140rpx;
  317. margin-left: 140rpx; */
  318. }
  319. .info:last-child {
  320. margin-bottom: 0;
  321. }
  322. }
  323. .status {
  324. text-align: right;
  325. }
  326. .bot-btns {
  327. margin-top: 30rpx;
  328. display: flex;
  329. align-items: center;
  330. justify-content: flex-end;
  331. .btn {
  332. width: 180rpx;
  333. margin-left: 20rpx;
  334. }
  335. }
  336. }
  337. }
  338. </style>