index.vue 13 KB

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