index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <view class="archive" v-if="roles.indexOf('user-admin') != -1">
  3. <u-navbar ref="uNavbar" :border-bottom="false" :back-icon-color="setNav.backColor" :is-back="setNav.isdisPlayNavTitle"
  4. :title-size="setNav.size" :title-bold="setNav.bold" :title="setNav.navTitle" :title-color="setNav.color" :background="setNav"></u-navbar>
  5. <view class="topNav" :style="{top: topNav + 'px'}">
  6. <view class="item">
  7. <view class="text" :class="yidu == 1?'active':''" @click="onNav('1')">未完成发文</view>
  8. </view>
  9. <view class="item">
  10. <view class="text" :class="yidu == 2?'active':''" @click="onNav('2')">已完成发文</view>
  11. </view>
  12. <view class="item">
  13. <view class="text" :class="yidu == 3?'active':''" @click="onNav('3')">已撤回发文</view>
  14. </view>
  15. </view>
  16. <view class="searchBox">
  17. <view class="inputBox">
  18. <u-input class="input" v-model="searchVal" type="text" height="70" placeholder="请输入标题" placeholderStyle="{'color:#AAAAAA'}" />
  19. <view class="btn">查询</view>
  20. </view>
  21. <view class="toolBox">
  22. <view class="timeBox" @click="showTime = true">
  23. <image class="r" src="/static/img/icon_xzrq.png" mode=""></image>
  24. <view class="text">{{message_time || '选择日期'}}</view>
  25. <image class="d" src="/static/img/icon_xzrq_xl.png" mode=""></image>
  26. </view>
  27. <view v-if="yidu != 1" class="batchDelete" @click="allduDel = !allduDel">
  28. <image src="../../../static/img/icon_plsc.png"></image>
  29. <view class="text">批量删除</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="contentMain" v-if="data.length">
  34. <u-swipe-action v-if="yidu == 1" :show="item.show" :index="index" v-for="(item, index) in data" :key="item.id"
  35. @click="click" @open="open" :options="options" class="u-swipe-action " style="width: 100%;">
  36. <view class="item">
  37. <view class="title" @click.stop="jump(item)">{{item.message_title}}</view>
  38. <view class="userInfo">
  39. <view class="user">
  40. <view class="name">拟稿人:{{item.send_user_name}}</view>
  41. <view class="name">发文日期:{{item.message_time}}</view>
  42. <!-- <view class="name">流程结束日期:2021-04-28</view> -->
  43. </view>
  44. <view v-if="item.status == '审核中'" class="status" @click="approvalProcess(item)">发文审核中</view>
  45. <view v-else class="statusBtn" @click="viewProgress(item)">查看进度</view>
  46. </view>
  47. </view>
  48. </u-swipe-action>
  49. <view v-if="yidu == 2" v-for="(item, index) in data" :key="item.id" class="u-swipe-action-1">
  50. <view class="check" v-if="allduDel">
  51. <image v-if="!item.show" @click="selected(item)" class="normal" src="../../../static/img/icon_qx_normal.png"></image>
  52. <image v-else class="selected" @click="selected(item)" src="../../../static/img/icon_qx_selected.png"></image>
  53. </view>
  54. <view class="item">
  55. <view class="title" @click.stop="jump(item)">{{item.message_title}}</view>
  56. <view class="userInfo">
  57. <view class="user">
  58. <view class="name">拟稿人:{{item.send_user_name}}</view>
  59. <view class="name">发文日期:{{item.message_time}}</view>
  60. <!-- <view class="name">流程结束日期:2021-04-28</view> -->
  61. </view>
  62. <view v-if="item.status == '已驳回'" class="rejected">已驳回</view>
  63. </view>
  64. </view>
  65. </view>
  66. <view v-if="yidu == 3" v-for="(item, index) in data" :key="item.id" class="u-swipe-action-1">
  67. <view class="check" v-if="allduDel">
  68. <image v-if="!item.show" @click="selected(item)" class="normal" src="../../../static/img/icon_qx_normal.png"></image>
  69. <image v-else class="selected" @click="selected(item)" src="../../../static/img/icon_qx_selected.png"></image>
  70. </view>
  71. <view class="item">
  72. <view class="title" @click.stop="jump(item)">{{item.message_title}}</view>
  73. <view class="userInfo">
  74. <view class="user">
  75. <view class="name">拟稿人:{{item.send_user_name}}</view>
  76. <view class="name">发文日期:{{item.message_time}}</view>
  77. <!-- <view class="name">流程结束日期:2021-04-28</view> -->
  78. </view>
  79. <view class="statusBtn" @click="addPost(item)">编辑</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="no-data" v-else>暂无数据</view>
  85. <view style="height: 210rpx;"></view>
  86. <view class="btns" @click="addPost">新增发文</view>
  87. <view class="bottomBtn allduDel" v-if="allduDel && yidu != 1">
  88. <view class="all" @click="selectedAll">
  89. <image v-if="!isSelected" class="normal" src="../../../static/img/icon_qx_normal.png"></image>
  90. <image v-else class="selected" src="../../../static/img/icon_qx_selected.png"></image>
  91. <view class="text">全选</view>
  92. </view>
  93. <view class="btn" @click="delt">确定删除</view>
  94. </view>
  95. <u-picker mode="time" v-model="showTime" :params="params" @confirm="getTime"></u-picker>
  96. </view>
  97. </template>
  98. <script>
  99. export default {
  100. data() {
  101. return {
  102. setNav: {
  103. backgroundColor: '#fff', //背景色
  104. color: '#333', //字体颜色
  105. bold: true,
  106. size: '36',
  107. backColor: '#333',
  108. isdisPlayNavTitle: false, //是否显示返回按钮
  109. navTitle: '发文' //导航标题
  110. },
  111. showTime: false,
  112. params: {
  113. year: true,
  114. month: true,
  115. day: true
  116. },
  117. message_time: '',
  118. allduDel: false,
  119. isSelected: false,
  120. searchVal: '',
  121. topNav: 0,
  122. yidu: '1',
  123. disabled: false,
  124. btnWidth: 180,
  125. show: false,
  126. data: [],
  127. options: [{
  128. text: '撤回',
  129. style: {
  130. backgroundColor: '#FF3131'
  131. }
  132. }],
  133. userInfo: {},
  134. pageNo: 1,
  135. total: 0,
  136. roles: []
  137. }
  138. },
  139. onShow () {
  140. this.userInfo = JSON.parse(uni.getStorageSync('userInfo') || '{}');
  141. this.roles = JSON.parse(uni.getStorageSync('roles'));
  142. if (this.roles.indexOf('user-admin') == -1) {
  143. return uni.showToast({
  144. title: '暂无权限',
  145. icon: 'none'
  146. })
  147. }
  148. this.getQueryList(this.yidu)
  149. setTimeout(() => {
  150. this.topNav = (this.$refs.uNavbar.navbarHeight) + (this.$refs.uNavbar.statusBarHeight)
  151. }, 10)
  152. },
  153. onReachBottom() {
  154. if (this.data.length >= this.total) {
  155. return
  156. }
  157. this.pageNo += 1
  158. this.getQueryList(this.yidu)
  159. },
  160. methods: {
  161. async getQueryList(message_situation) {
  162. let res = await this.$u.post(`boman-web-core/p/cs/queryList`, {
  163. "table": "boman_message",
  164. "pageNo": this.pageNo,
  165. "orderBy": "create_time desc",
  166. "isUi": false,
  167. "pageSize": 10,
  168. "fixedData": {
  169. "condition": {
  170. "message_situation": message_situation,
  171. "send_user_id": this.userInfo.id,
  172. "message_time": this.message_time,
  173. "is_del": "N"
  174. }
  175. }
  176. })
  177. if (res.data && res.data.rows) {
  178. res.data.rows = res.data.rows.map(item => {
  179. return Object.assign({}, item, {
  180. show: false
  181. })
  182. })
  183. if (this.pageNo == 1) {
  184. this.data = res.data.rows
  185. this.total = res.data.total
  186. } else {
  187. this.data = this.data.concat(res.data.rows)
  188. }
  189. }
  190. },
  191. getTime(e) {
  192. // console.log(e);
  193. this.message_time = `${e.year}-${e.month}-${e.day}`
  194. this.pageNo = 1
  195. this.getQueryList(this.yidu)
  196. },
  197. approvalProcess(item) {
  198. uni.navigateTo({
  199. url: '/pages/postView/approvalProcess/index?id=' + item.id + '&name=' + item.send_user_name
  200. })
  201. },
  202. viewProgress(item) {
  203. uni.navigateTo({
  204. url: '/pages/postView/viewProgress/index?id=' + item.id + '&name=' + item.send_user_name
  205. })
  206. },
  207. addPost(item) {
  208. if (item) {
  209. uni.navigateTo({
  210. url: '/pages/indexView/addPost/index?objId=' + item.id
  211. })
  212. } else {
  213. uni.navigateTo({
  214. url: '/pages/indexView/addPost/index'
  215. })
  216. }
  217. },
  218. jump(item = {}) {
  219. if (this.allduDel) {
  220. return
  221. }
  222. uni.navigateTo({
  223. url: '/pages/postView/postDetails/index?active=' + this.yidu + '&id=' + item.id
  224. })
  225. },
  226. onNav(val) {
  227. this.allduDel = false
  228. this.yidu = val
  229. this.pageNo = 1
  230. this.getQueryList(this.yidu)
  231. uni.pageScrollTo({
  232. scrollTop: 0,
  233. duration: 0,
  234. });
  235. },
  236. selectedAll() {
  237. this.isSelected = !this.isSelected
  238. this.data.forEach(item => {
  239. item.show = this.isSelected
  240. })
  241. },
  242. async delt () {
  243. let idList = []
  244. idList = this.data.filter(item => item.show)
  245. console.log(idList);
  246. if (idList.length == 0) {
  247. uni.showToast({
  248. icon: 'none',
  249. title: '请至少选择一条数据'
  250. })
  251. return false
  252. }
  253. let res = await this.$u.post('boman-web-core/p/cs/objectLogicDelete', {
  254. "table":"boman_message", // 固定值
  255. "logicDelName":"is_del", // 固定值
  256. "logicDelValue":"Y", // 固定值
  257. "idList": idList.map(item => item.id)
  258. })
  259. if (res.code == 200) {
  260. uni.showToast({
  261. title: '删除成功'
  262. })
  263. this.allduDel = false
  264. this.pageNo = 1
  265. this.getQueryList(this.yidu)
  266. } else {
  267. uni.showToast({
  268. title: res.msg,
  269. icon: 'none'
  270. })
  271. }
  272. },
  273. selected(item) {
  274. item.show = !item.show
  275. },
  276. async click(index, index1) {
  277. let res = await this.$u.get('boman-web-core/message/withdraw/' + this.data[index].id)
  278. if (res.code == 200) {
  279. uni.showToast({
  280. title: res.msg
  281. })
  282. this.pageNo = 1
  283. this.getQueryList(this.yidu)
  284. } else {
  285. uni.showToast({
  286. title: res.msg,
  287. icon: 'none'
  288. })
  289. }
  290. // console.log(index, index1)
  291. // if (index1 == 1) {
  292. // this.data.splice(index, 1);
  293. // this.$u.toast(`删除了第${index}个cell`);
  294. // } else {
  295. // this.data[index].show = false;
  296. // this.$u.toast(`收藏成功`);
  297. // }
  298. },
  299. // 如果打开一个的时候,不需要关闭其他,则无需实现本方法
  300. open(index) {
  301. // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
  302. // 原本为'false',再次设置为'false'会无效
  303. this.data[index].show = true;
  304. this.data.map((val, idx) => {
  305. if (index != idx) this.data[index].show = false;
  306. })
  307. }
  308. }
  309. }
  310. </script>
  311. <style>
  312. page {
  313. background: #FFFFFF;
  314. }
  315. </style>
  316. <style lang="scss" scoped>
  317. .topNav {
  318. display: flex;
  319. align-items: center;
  320. background: #FFFFFF;
  321. height: 90rpx;
  322. box-shadow: 0px 14rpx 10rpx 0px rgba(218, 218, 218, 0.35);
  323. position: sticky;
  324. width: 100%;
  325. left: 0;
  326. z-index: 9;
  327. .item {
  328. flex: 1;
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. .text {
  333. font-size: 26rpx;
  334. color: #191919;
  335. font-weight: 600;
  336. }
  337. .active {
  338. position: relative;
  339. &::after {
  340. content: '';
  341. position: absolute;
  342. width: 28rpx;
  343. height: 6rpx;
  344. background: #009FE8;
  345. border-radius: 6rpx;
  346. bottom: -14rpx;
  347. left: 50%;
  348. transform: translate(-50%, 0);
  349. }
  350. }
  351. }
  352. }
  353. .searchBox {
  354. padding: 30rpx;
  355. .inputBox {
  356. display: flex;
  357. align-items: center;
  358. .input {
  359. flex: 1;
  360. width: 100%;
  361. margin-right: 30rpx;
  362. background: #EDEDED;
  363. border-radius: 40rpx;
  364. padding: 0 30rpx !important;
  365. }
  366. .btn {
  367. background: #009FE8;
  368. color: #FFFFFF;
  369. font-size: 26rpx;
  370. height: 60rpx;
  371. line-height: 60rpx;
  372. padding: 0 30rpx;
  373. text-align: center;
  374. border-radius: 40rpx;
  375. }
  376. }
  377. }
  378. .toolBox {
  379. display: flex;
  380. justify-content: space-between;
  381. .batchDelete {
  382. display: flex;
  383. align-items: center;
  384. font-size: 24rpx;
  385. color: #FF3131;
  386. image {
  387. width: 20rpx;
  388. height: 24rpx;
  389. margin-right: 8rpx;
  390. }
  391. }
  392. }
  393. .timeBox {
  394. padding: 30rpx 0 20rpx 0;
  395. display: flex;
  396. align-items: center;
  397. .r {
  398. width: 30rpx;
  399. height: 33rpx;
  400. }
  401. .text {
  402. font-size: 26rpx;
  403. color: #343434;
  404. margin: 0 14rpx;
  405. }
  406. .d {
  407. width: 20rpx;
  408. height: 20rpx;
  409. }
  410. }
  411. .contentMain {
  412. padding: 0 20rpx;
  413. .u-swipe-action-1 {
  414. display: flex;
  415. align-items: center;
  416. border-bottom: solid 1rpx #DADADA;
  417. }
  418. .check {
  419. .normal,
  420. .selected {
  421. width: 30rpx;
  422. height: 30rpx;
  423. }
  424. }
  425. .item {
  426. width: 100%;
  427. border-bottom: 1px solid #dadada;
  428. .title {
  429. font-size: 28rpx;
  430. font-weight: 700;
  431. color: #343434;
  432. padding: 30rpx 30rpx 0 30rpx;
  433. white-space: break-word;
  434. word-break:break-all;
  435. }
  436. .userInfo {
  437. display: flex;
  438. align-items: flex-end;
  439. padding: 30rpx;
  440. .user {
  441. flex: 1;
  442. color: #666;
  443. font-size: 24rpx;
  444. .name {
  445. margin-bottom: 10rpx;
  446. }
  447. }
  448. .status {
  449. color: #009FE8;
  450. font-size: 26rpx;
  451. margin-bottom: 4rpx;
  452. }
  453. .rejected {
  454. color: #AAAAAA;
  455. font-size: 26rpx;
  456. margin-bottom: 4rpx;
  457. }
  458. .statusBtn {
  459. color: #fff;
  460. font-size: 22rpx;
  461. margin-bottom: 4rpx;
  462. background: #61C320;
  463. padding: 10rpx 20rpx;
  464. border-radius: 40rpx;
  465. }
  466. }
  467. }
  468. }
  469. .btns {
  470. position: fixed;
  471. bottom: var(--window-bottom);
  472. width: 100%;
  473. height: 84rpx;
  474. background: #009FE8;
  475. color: #fff;
  476. text-align: center;
  477. line-height: 84rpx;
  478. }
  479. .bottomBtn {
  480. display: flex;
  481. align-items: center;
  482. height: 100rpx;
  483. width: 100%;
  484. left: 0;
  485. z-index: 9;
  486. bottom: var(--window-bottom);
  487. position: fixed;
  488. border-top: solid 1px #E5E5E5;
  489. .all {
  490. display: flex;
  491. align-items: center;
  492. flex: 0 0 200rpx;
  493. background: #FFFFFF;
  494. justify-content: center;
  495. line-height: 100rpx;
  496. .normal,
  497. .selected {
  498. width: 30rpx;
  499. height: 30rpx;
  500. }
  501. .text {
  502. font-size: 28rpx;
  503. color: #343434;
  504. margin-left: 20rpx;
  505. }
  506. }
  507. .btn {
  508. background: #FF3131;
  509. color: #FFFFFF;
  510. font-size: 28rpx;
  511. line-height: 100rpx;
  512. text-align: center;
  513. flex: 1;
  514. }
  515. }
  516. </style>