index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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" @click="getQueryList()">查询</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: false, //是否显示返回按钮
  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. console.log(2313);
  121. if (this.data.length >= this.total) {
  122. return
  123. }
  124. this.pageNo += 1
  125. this.getQueryList()
  126. },
  127. onShow(opt) {
  128. console.log(opt);
  129. this.pageNo = 1
  130. this.userInfo = JSON.parse(uni.getStorageSync('userInfo') || '{}');
  131. if (uni.getStorageSync('addresseeY') == 1) {
  132. this.yidu = 1
  133. this.getQueryList()
  134. } else {
  135. this.yidu = 0
  136. this.getQueryList()
  137. }
  138. setTimeout(() => {
  139. this.topNav = (this.$refs.uNavbar.navbarHeight) + (this.$refs.uNavbar.statusBarHeight)
  140. }, 10)
  141. // this.getMessageReceive()
  142. },
  143. methods:{
  144. selectedAll() {
  145. this.isSelected = !this.isSelected
  146. this.data.forEach(item => {
  147. item.checked = this.isSelected
  148. })
  149. },
  150. async getQueryList() {
  151. let res = await this.$u.post(`boman-web-core/p/cs/queryList`, {
  152. "table": "boman_message_receive",
  153. "pageNo": this.pageNo,
  154. "isUi": false,
  155. "pageSize": 10,
  156. "orderBy": "create_time desc",
  157. "fixedData": {
  158. "condition": {
  159. "visible": "Y",
  160. "message_title": this.searchVal,
  161. "receive_user_id": this.userInfo.id,
  162. "status": this.yidu == 0 ? "N" : 'Y',
  163. "create_time": this.message_time,
  164. "is_del":"N"
  165. }
  166. }
  167. })
  168. if (res.data && res.data.rows) {
  169. res.data.rows = res.data.rows.map(item => {
  170. return Object.assign({}, item, {
  171. checked: false
  172. })
  173. })
  174. if (this.pageNo == 1) {
  175. this.data = res.data.rows
  176. } else {
  177. this.data = this.data.concat(res.data.rows)
  178. }
  179. this.total = res.data.total
  180. }
  181. },
  182. // getTime(e) {
  183. // // console.log(e);
  184. // this.message_time = `${e.year}-${e.month}-${e.day}`
  185. // },
  186. click(index, index1) {
  187. if(index1 == 1) {
  188. this.list.splice(index, 1);
  189. this.$u.toast(`删除了第${index}个cell`);
  190. } else {
  191. this.list[index].show = false;
  192. this.$u.toast(`收藏成功`);
  193. }
  194. },
  195. // 如果打开一个的时候,不需要关闭其他,则无需实现本方法
  196. open(index) {
  197. // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
  198. // 原本为'false',再次设置为'false'会无效
  199. this.list[index].show = true;
  200. this.list.map((val, idx) => {
  201. if(index != idx) this.list[idx].show = false;
  202. })
  203. },
  204. onNav(val) {
  205. this.yidu = val
  206. this.pageNo = 1
  207. this.getQueryList()
  208. },
  209. onShowTime() {
  210. this.showTime = !this.showTime
  211. },
  212. getTime(e) {
  213. this.message_time = `${e.year}-${e.month}-${e.day}`
  214. this.pageNo = 1
  215. this.getQueryList()
  216. },
  217. allDu(val) {
  218. if (val == 1) {
  219. this.allduCk = !this.allduCk
  220. } else {
  221. this.allduDel = !this.allduDel
  222. }
  223. },
  224. async getMessageReceive () {
  225. let that = this
  226. let data = {
  227. "table": "boman_message_receive",
  228. "pageNo": that.pageNo,
  229. "isUi": false,
  230. "pageSize": 10,
  231. "orderBy": "create_time desc",
  232. "fixedData": {
  233. "condition": {
  234. "visible": "Y",
  235. "receive_user_id": '',
  236. "status":"N",
  237. "create_time":"2021-01-01",
  238. "is_del":"N"
  239. }
  240. },
  241. "finish_time": null,
  242. "id": ''
  243. }
  244. let res = await that.$u.post(`boman-web-core/p/cs/queryList`,data)
  245. that.csQueryListData = res.data.rows
  246. },
  247. async yiduUpdate () {
  248. let that = this
  249. let condition = []
  250. condition = this.data.filter(item => item.checked)
  251. if (!condition.length) {
  252. uni.showToast({
  253. title: '未选择已读文章',
  254. icon: 'none'
  255. })
  256. }
  257. let data = {
  258. "tableName": "boman_message_receive",
  259. "condition": {
  260. "id": condition.map(item => item.id)
  261. },
  262. "commitData": {
  263. "status":"Y"
  264. }
  265. }
  266. let res = await that.$u.post(`boman-web-core/p/cs/update`,data)
  267. // that.csQueryListData = res.data.tableHeadList
  268. if (res.code == 200) {
  269. uni.showToast({
  270. title:'已读成功'
  271. })
  272. this.allduDel = false
  273. this.getQueryList()
  274. } else {
  275. uni.showToast({
  276. title: res.msg,
  277. icon: 'none'
  278. })
  279. }
  280. },
  281. async allDel () {
  282. let that = this
  283. let condition = []
  284. condition = this.data.filter(item => item.checked)
  285. if (condition.length == 0) {
  286. uni.showToast({
  287. icon: 'none',
  288. title: '请至少选择一条数据'
  289. })
  290. return false
  291. }
  292. let data = {
  293. "tableName": "boman_message_receive",
  294. "condition": {
  295. "id": condition.map(item => item.id)
  296. },
  297. "commitData": {
  298. "is_del":"Y"
  299. }
  300. }
  301. let res = await that.$u.post(`boman-web-core/p/cs/update`,data)
  302. // that.csQueryListData = res.data.tableHeadList
  303. if (res.code == 200) {
  304. uni.showToast({
  305. title:'删除成功'
  306. })
  307. this.allduDel = false
  308. this.getQueryList()
  309. } else {
  310. uni.showToast({
  311. title: res.msg,
  312. icon: 'none'
  313. })
  314. }
  315. },
  316. async jump(item = {}) {
  317. if (this.allduCk || this.allduDel) {
  318. item.checked = !item.checked
  319. return
  320. }
  321. // if (this.yidu == 0) {
  322. // let data = {
  323. // "tableName": "boman_message_receive",
  324. // "condition": {
  325. // "id": item.id
  326. // },
  327. // "commitData": {
  328. // "status":"Y"
  329. // }
  330. // }
  331. // let res = await this.$u.post(`boman-web-core/p/cs/update`,data)
  332. // // that.csQueryListData = res.data.tableHeadList
  333. // uni.navigateTo({
  334. // url: '/pages/indexView/addressee/details?id=' + item.message_id
  335. // })
  336. // } else {
  337. // uni.navigateTo({
  338. // url: '/pages/indexView/addressee/details?id=' + item.message_id
  339. // })
  340. // }
  341. uni.navigateTo({
  342. url: '/pages/indexView/addressee/details?id=' + item.message_id + '&objId=' + item.id
  343. })
  344. }
  345. }
  346. }
  347. </script>
  348. <style>
  349. page{
  350. background: #FFFFFF;
  351. }
  352. </style>
  353. <style lang="scss" scoped>
  354. .topNav{
  355. display: flex;
  356. align-items: center;
  357. background: #FFFFFF;
  358. height: 90rpx;
  359. box-shadow: 0px 14rpx 10rpx 0px rgba(218, 218, 218, 0.35);
  360. position: sticky;
  361. width: 100%;
  362. left: 0;
  363. z-index: 9;
  364. .item{
  365. flex: 1;
  366. display: flex;
  367. align-items: center;
  368. justify-content: center;
  369. .text{
  370. font-size: 26rpx;
  371. color: #191919;
  372. font-weight: 600;
  373. }
  374. .active{
  375. position: relative;
  376. &::after{
  377. content: '';
  378. position: absolute;
  379. width: 28rpx;
  380. height: 6rpx;
  381. background: #009FE8;
  382. border-radius: 6rpx;
  383. bottom: -14rpx;
  384. left: 50%;
  385. transform: translate(-50%,0);
  386. }
  387. }
  388. }
  389. }
  390. .searchBox{
  391. padding: 30rpx;
  392. .inputBox{
  393. display: flex;
  394. align-items: center;
  395. .input{
  396. flex: 1;
  397. width: 100%;
  398. margin-right: 30rpx;
  399. background: #EDEDED;
  400. border-radius: 40rpx;
  401. padding: 0 30rpx !important;
  402. }
  403. .btn{
  404. background: #009FE8;
  405. color: #FFFFFF;
  406. font-size: 26rpx;
  407. height: 60rpx;
  408. line-height: 60rpx;
  409. padding: 0 30rpx;
  410. text-align: center;
  411. border-radius: 40rpx;
  412. }
  413. }
  414. }
  415. .timeBox{
  416. padding: 30rpx 0 20rpx 0;
  417. display: flex;
  418. align-items: center;
  419. .r{
  420. width: 30rpx;
  421. height: 33rpx;
  422. }
  423. .text{
  424. font-size: 26rpx;
  425. color: #343434;
  426. margin: 0 14rpx;
  427. }
  428. .d{
  429. width: 20rpx;
  430. height: 20rpx;
  431. }
  432. .yidu{
  433. margin-left: auto;
  434. display: flex;
  435. align-items: center;
  436. .yd{
  437. width: 26rpx;
  438. height: 26rpx;
  439. }
  440. .tt{
  441. font-size: 24rpx;
  442. color: #54BA10;
  443. margin-left: 10rpx;
  444. }
  445. }
  446. .shanchu{
  447. margin-left: auto;
  448. display: flex;
  449. align-items: center;
  450. .yd{
  451. width: 30rpx;
  452. height: 35rpx;
  453. }
  454. .tt{
  455. font-size: 24rpx;
  456. color: #FF3131;
  457. margin-left: 10rpx;
  458. }
  459. }
  460. }
  461. .contentMain{
  462. .u-swipe-action {
  463. margin-bottom: 30rpx;
  464. display: flex;
  465. align-items: center;
  466. .checkbox{
  467. flex: 0 0 40rpx;
  468. width: 40rpx;
  469. margin-left: 30rpx;
  470. .check{
  471. width: 40rpx;
  472. }
  473. }
  474. .check {
  475. margin-left: 20rpx;
  476. .normal,
  477. .selected {
  478. width: 30rpx;
  479. height: 30rpx;
  480. }
  481. }
  482. }
  483. .item{
  484. flex: 1;
  485. padding: 0 30rpx;
  486. border-bottom: 1px solid #DADADA;
  487. .title{
  488. font-size: 28rpx;
  489. font-weight: 700;
  490. color: #343434;
  491. white-space: break-word;
  492. word-break:break-all;
  493. }
  494. .userInfo{
  495. display: flex;
  496. align-items: flex-end;
  497. margin-top: 30rpx;
  498. padding-bottom: 30rpx;
  499. .user{
  500. flex: 1;
  501. color: #666;
  502. font-size: 24rpx;
  503. .name{
  504. margin-bottom: 10rpx;
  505. }
  506. }
  507. .status{
  508. color: #AAAAAA;
  509. font-size: 26rpx;
  510. margin-bottom: 4rpx;
  511. }
  512. }
  513. }
  514. }
  515. .bottomBtn{
  516. display: flex;
  517. align-items: center;
  518. height: 100rpx;
  519. width: 100%;
  520. left: 0;
  521. z-index: 9;
  522. bottom: var(--window-bottom);
  523. position: fixed;
  524. border-top: solid 1px #E5E5E5;
  525. .all{
  526. display: flex;
  527. align-items: center;
  528. flex: 0 0 200rpx;
  529. background: #FFFFFF;
  530. justify-content: center;
  531. line-height: 100rpx;
  532. .normal,
  533. .selected {
  534. width: 30rpx;
  535. height: 30rpx;
  536. }
  537. .check{
  538. width: 40rpx;
  539. height: 40rpx;
  540. }
  541. .text{
  542. font-size: 28rpx;
  543. color: #343434;
  544. margin-left: 20rpx;
  545. }
  546. }
  547. .btn{
  548. background: #009FE8;
  549. color: #FFFFFF;
  550. font-size: 28rpx;
  551. line-height: 100rpx;
  552. text-align: center;
  553. flex: 1;
  554. }
  555. }
  556. .allduDel{
  557. .btn{
  558. background: #FF3131;
  559. color: #FFFFFF;
  560. font-size: 28rpx;
  561. line-height: 100rpx;
  562. text-align: center;
  563. flex: 1;
  564. }
  565. }
  566. </style>