index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. <template>
  2. <view class="content">
  3. <!-- 搜索框 -->
  4. <view class="sousuo">
  5. <view class="iconfont icon-sousuo" style="margin: 0 30rpx 0 30rpx;"></view>
  6. <input class="sou-text" placeholder="请输入查询内容" v-model="keyword" @blur="changeKey"></input>
  7. </view>
  8. <!-- 筛选 -->
  9. <view class="select2">
  10. <view class="wei-title1 title1" v-if="select==3">
  11. <view>我创建的</view>
  12. <view class="wei-line1"></view>
  13. </view>
  14. <view class="title1" style="rgba(0, 0, 0, 1)" v-else @click="selectChange(3)">
  15. 我创建的
  16. <view class="wei-line1" style="background: rgba(255, 255, 255, 1);"></view>
  17. </view>
  18. <!-- <view class="wei-title1 title1" v-if="select==1">
  19. <view>我收藏的</view>
  20. <view class="wei-line1"></view>
  21. </view>
  22. <view class="title1" style="rgba(0, 0, 0, 1)" v-else @click="selectChange(1)">
  23. 我收藏的
  24. <view class="wei-line1" style="background: rgba(255, 255, 255, 1);"></view>
  25. </view> -->
  26. <view class="wei-title1 title2" v-if="select==3">
  27. <view>我分管的</view>
  28. <view class="wei-line1"></view>
  29. </view>
  30. <view class="title2" style="rgba(0, 0, 0, 1)" v-else @click="selectChange(3)">
  31. 我分管的
  32. <view class="wei-line1" style="background: rgba(255, 255, 255, 1);"></view>
  33. </view>
  34. <view class="wei-title1 title3" v-if="select==3">
  35. <view>我负责的</view>
  36. <view class="wei-line1"></view>
  37. </view>
  38. <view class="title3" style="rgba(0, 0, 0, 1)" v-else @click="selectChange(3)">
  39. 我负责的
  40. <view class="wei-line1" style="background: rgba(255, 255, 255, 1);"></view>
  41. </view>
  42. <view class="wei-title1 title4" v-if="select==4">
  43. <view>我协办的</view>
  44. <view class="wei-line1"></view>
  45. </view>
  46. <view class="title4" style="rgba(0, 0, 0, 1)" v-else @click="selectChange(4)">
  47. 我协办的
  48. <view class="wei-line1" style="background: rgba(255, 255, 255, 1);"></view>
  49. </view>
  50. </view>
  51. <view class="search" style="margin: 20rpx 0 0 11px;width: 100%;background-color: rgba(255, 255, 255, 1);">
  52. <uni-data-select style="border: 1px solid; width: 100px;border-radius: 85px;"
  53. v-model="typeid"
  54. :localdata="zhuangtai"
  55. @change="changeType"
  56. ></uni-data-select>
  57. </view>
  58. <!-- 数据列表 -->
  59. <view class="kuang">
  60. <view class="all-select">
  61. <view class="all-list" style="margin-left: 15rpx;" v-if="change==3">超时在办</view>
  62. <view class="all-list2" style="margin-left: 15rpx;" v-else @click="changeTime(3)">超时在办</view>
  63. <view class="all-list" style="margin-left: 15rpx;" v-if="change==2">预警在办</view>
  64. <view class="all-list2" style="margin-left: 15rpx;" v-else @click="changeTime(2)">预警在办</view>
  65. <view class="all-list" style="margin-left: 15rpx;" v-if="change==1">正常在办</view>
  66. <view class="all-list2" style="margin-left: 15rpx;" v-else @click="changeTime(1)">正常在办</view>
  67. <view class="all-list" style="margin-left: 15rpx;" v-if="change==4">正常办结</view>
  68. <view class="all-list2" style="margin-left: 15rpx;" v-else @click="changeTime(4)">正常办结</view>
  69. </view>
  70. <!-- 数据列表循环 -->
  71. <view class="list" v-for="(item,index) in list" :key="index" @click="XiangPro(item)">
  72. <view class="list-proname">
  73. {{item.projectName}}
  74. <view class="list-kua">{{item.projectFrom}}</view>
  75. <view class="bu-shou yishou" v-if="item.collect==1" @click.stop="Qushoucang(item)">已收藏</view>
  76. <view class="bu-shou shou" v-else @click.stop="shoucang(item)">收藏</view>
  77. <view class="bu-shou norl" v-if="item.projectLevel=='正常'">正常</view>
  78. <view class="bu-shou jinji" v-else>紧急</view>
  79. <view class="bu-shou more">
  80. <view @click.stop="dianMore(item)">更多</view>
  81. <view class="xiala" v-if="item.isChecked">
  82. <view>复制</view>
  83. <view @click.stop="changePro(item)">编辑</view>
  84. <view @click.stop="deletePro(item)">删除</view>
  85. <view @click.stop="score(item)">评分</view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="list-dan">主办单位:{{item.organize}}</view>
  90. <view class="list-dan">主办人:{{item.leaderName}}</view>
  91. <view class="list-dan">项目周期:{{item.startTime}}-{{item.endTime}}</view>
  92. <view class="list-dan">任务:{{item.taskNum}}个</view>
  93. <view class="list-dan">预警次数:{{item.warnNum}}次</view>
  94. <view class="list-dan">提醒次数:{{item.remindNum}}次</view>
  95. <view class="list-dan" style="width: 620rpx;display: flex;">
  96. 项目进度:
  97. <progress v-if="item.score!='/'" style="width: 380rpx;" :percent="item.progress" activeColor="rgba(0, 97, 255, 1)" border-radius="50" stroke-width="9" show-info font-size='12' active='true' />
  98. <image src="../../static/project/warn.png" style="width: 43rpx;height: 43rpx;margin-top: 10rpx;" @click.stop="cuiban(item)" v-if="item.state==1||item.state==2||item.state==3"></image>
  99. </view>
  100. </view>
  101. <view style="width: 100%;height: 100rpx;"></view>
  102. </view>
  103. <!-- 添加项目 -->
  104. <view class="serviceBtn" @click.stop="addProject"></view>
  105. </view>
  106. </template>
  107. <script>
  108. export default {
  109. data() {
  110. return {
  111. keyword:'',//搜索框内容
  112. select:3,
  113. change:1,
  114. list:[],
  115. page:1,
  116. size:10,
  117. totalCount:0,
  118. }
  119. },
  120. onLoad() {
  121. },
  122. onShow() {
  123. this.getProject()
  124. },
  125. methods: {
  126. //最上层切换
  127. selectChange(a){
  128. this.select=a
  129. this.getProject()
  130. },
  131. //修改时间框
  132. changeTime(a){
  133. this.change=a
  134. this.getProject()
  135. },
  136. // 新建项目
  137. addProject(){
  138. uni.navigateTo({
  139. url:'/pages/project/addProject'
  140. })
  141. },
  142. //点击查看更多
  143. dianMore(item){
  144. item.isChecked=!item.isChecked
  145. },
  146. //编辑项目
  147. changePro(item){
  148. //传参对象,使用encodeURIComponent编码
  149. let str = JSON.stringify(item)
  150. //注意这里——————————————————————
  151. str = str.replace(/%/g, '%25')
  152. //这里———————————————————————————
  153. let query = encodeURIComponent(str)
  154. uni.navigateTo({
  155. url:'/pages/project/projectChange?data='+query
  156. })
  157. },
  158. //查看项目详情
  159. XiangPro(item){
  160. //传参对象,使用encodeURIComponent编码
  161. let str = JSON.stringify(item)
  162. //注意这里——————————————————————
  163. str = str.replace(/%/g, '%25')
  164. //这里———————————————————————————
  165. let query = encodeURIComponent(str)
  166. uni.navigateTo({
  167. url:'/pages/project/projectX?data='+query
  168. })
  169. },
  170. //收藏项目
  171. shoucang(item){
  172. let that = this
  173. uni.showModal({
  174. title: '提示',
  175. content: '确定收藏项目吗?',
  176. success: function(res) {
  177. if (res.confirm) {
  178. console.log('用户点击确定');
  179. uni.showLoading({
  180. title: '加载中',
  181. mask: true, // 是否显示透明蒙层,防止触摸穿透
  182. });
  183. let data={
  184. projectId:item.id,
  185. state:1//1收藏,0取消收藏
  186. }
  187. that.$Request.postT('/api/sysProject/collect',data).then(res => {
  188. if (res.code==200) {
  189. uni.showToast({
  190. title: '收藏成功',
  191. icon: 'none',
  192. duration:800
  193. });
  194. uni.hideLoading()
  195. setTimeout(function() {
  196. that.getProject()
  197. }, 1000)
  198. } else {
  199. uni.hideLoading();
  200. uni.showToast({
  201. title: res.message,
  202. icon: 'none',
  203. duration:800
  204. });
  205. }
  206. });
  207. } else if (res.cancel) {
  208. console.log('用户点击取消');
  209. }
  210. }
  211. })
  212. },
  213. //取消收藏项目
  214. Qushoucang(item){
  215. let that = this
  216. uni.showModal({
  217. title: '提示',
  218. content: '确定取消收藏吗?',
  219. success: function(res) {
  220. if (res.confirm) {
  221. console.log('用户点击确定');
  222. uni.showLoading({
  223. title: '加载中',
  224. mask: true, // 是否显示透明蒙层,防止触摸穿透
  225. });
  226. let data={
  227. projectId:item.id,
  228. state:0//1收藏,0取消收藏
  229. }
  230. that.$Request.postT('/api/sysProject/collect',data).then(res => {
  231. if (res.code==200) {
  232. uni.showToast({
  233. title: '取消收藏成功',
  234. icon: 'none',
  235. duration:800
  236. });
  237. uni.hideLoading()
  238. setTimeout(function() {
  239. that.getProject()
  240. }, 1000)
  241. } else {
  242. uni.hideLoading();
  243. uni.showToast({
  244. title: res.message,
  245. icon: 'none',
  246. duration:800
  247. });
  248. }
  249. });
  250. } else if (res.cancel) {
  251. console.log('用户点击取消');
  252. }
  253. }
  254. })
  255. },
  256. //评分
  257. score(item){
  258. uni.navigateTo({
  259. url:'/pages/project/sorce?proId='+item.id
  260. })
  261. },
  262. // 催办
  263. cuiban(item){
  264. let that = this
  265. uni.showModal({
  266. title: '提示',
  267. content: '确定催办项目吗?',
  268. success: function(res) {
  269. if (res.confirm) {
  270. console.log('用户点击确定');
  271. uni.showLoading({
  272. title: '加载中',
  273. mask: true, // 是否显示透明蒙层,防止触摸穿透
  274. });
  275. let data={
  276. projectIds:item.id,
  277. }
  278. that.$Request.postT('/api/sysProject/urge',data).then(res => {
  279. if (res.code==200) {
  280. uni.showToast({
  281. title: '催办成功',
  282. icon: 'none',
  283. duration:800
  284. });
  285. uni.hideLoading()
  286. setTimeout(function() {
  287. that.getProject()
  288. }, 1000)
  289. } else {
  290. uni.hideLoading();
  291. uni.showToast({
  292. title: res.message,
  293. icon: 'none',
  294. duration:800
  295. });
  296. }
  297. });
  298. } else if (res.cancel) {
  299. console.log('用户点击取消');
  300. }
  301. }
  302. })
  303. },
  304. //删除项目
  305. deletePro(item){
  306. let that = this
  307. uni.showModal({
  308. title: '提示',
  309. content: '确定删除项目吗?',
  310. success: function(res) {
  311. if (res.confirm) {
  312. console.log('用户点击确定');
  313. uni.showLoading({
  314. title: '加载中',
  315. mask: true, // 是否显示透明蒙层,防止触摸穿透
  316. });
  317. let data={
  318. id:item.id,
  319. }
  320. that.$Request.postT('/api/sysProject/del',data).then(res => {
  321. if (res.code==200) {
  322. uni.showToast({
  323. title: '删除成功',
  324. icon: 'none',
  325. duration:800
  326. });
  327. uni.hideLoading()
  328. setTimeout(function() {
  329. that.getProject()
  330. }, 1000)
  331. } else {
  332. uni.hideLoading();
  333. uni.showToast({
  334. title: res.message,
  335. icon: 'none',
  336. duration:800
  337. });
  338. }
  339. });
  340. } else if (res.cancel) {
  341. console.log('用户点击取消');
  342. }
  343. }
  344. })
  345. },
  346. //查询项目名
  347. changeKey(e){
  348. this.keyword=e.detail.value
  349. this.getProject()
  350. },
  351. //查询项目列表
  352. getProject(){
  353. let that = this
  354. that.list=[]
  355. uni.showLoading({
  356. title: '加载中',
  357. mask: true, // 是否显示透明蒙层,防止触摸穿透
  358. });
  359. var data={
  360. "type": that.select, // 1我关注的我收藏的、3我负责的、4我协办的、null
  361. "project": {
  362. "projectName": that.keyword, // 项目名称
  363. "projectFrom": null, // 项目来源
  364. "projectLevel":null, // 项目等级
  365. "state": that.change, // 1、正常在办,2、预警在办,3、超时在办,4、正常办结,5、超时办结
  366. "organize": null, // 主办单位-单选
  367. "coOrganize": null, // 协办单位-多选
  368. "sposonerName": null, // 主办人
  369. "coSposonerName": null, // 协办人
  370. },
  371. "t1": null, // 创建开始时间
  372. "t2": null, // 创建结束时间
  373. "t3": null, // 周期开始时间
  374. "t4": null, // 周期结束时间
  375. "t5": null, // 完成开始时间
  376. "t6": null // 完成结束时间
  377. }
  378. that.$Request.postJson('/api/sysProject/queryPage?page='+that.page+'&rows='+that.size,data).then(res => {
  379. if (res.code==200) {
  380. console.log(res,data,'项目')
  381. that.totalCount = res.data.project.total
  382. if (that.page == 1) {
  383. that.list = res.data.project.rows
  384. } else {
  385. that.list = that.list.concat(res.data.project.rows)
  386. }
  387. for (let i = 0; i < that.list.length; i++) {
  388. that.$set(that.list[i], "isChecked", false);
  389. }
  390. console.log(that.list,'数据')
  391. } else {
  392. uni.showToast({
  393. title: res.message,
  394. icon: 'none',
  395. duration:800
  396. });
  397. }
  398. uni.stopPullDownRefresh();
  399. uni.hideLoading();
  400. });
  401. },
  402. // 上拉加载
  403. onReachBottom: function() {
  404. if(this.list.length < this.totalCount){
  405. this.page = this.page + 1;
  406. this.getProject()
  407. } else {
  408. uni.showToast({
  409. title: '已经最后一页啦',
  410. icon: 'none'
  411. })
  412. }
  413. },
  414. onPullDownRefresh: function() {
  415. this.page = 1;
  416. this.getProject()
  417. },
  418. }
  419. }
  420. </script>
  421. <style lang="scss" scoped>
  422. .content {
  423. display: flex;
  424. flex-direction: column;
  425. align-items: center;
  426. justify-content: center;
  427. .serviceBtn{
  428. position: fixed;
  429. right: 50rpx;
  430. bottom: 300rpx;
  431. display: flex;
  432. flex-direction: column;
  433. align-items: center;
  434. justify-content: center;
  435. width: 97rpx;
  436. height: 97rpx;
  437. background-image: url('../../static/project/add.png');
  438. background-size: 100%;
  439. }
  440. }
  441. /* 搜索框 */
  442. .sousuo{
  443. display: flex;
  444. align-items: center;
  445. margin: 20rpx 0 0 20rpx;
  446. width: 710rpx;
  447. height: 90rpx;
  448. border-radius: 98rpx;
  449. background: rgba(255, 255, 255, 1);
  450. }
  451. .sou-text{
  452. font-size: 28rpx;
  453. line-height: 40rpx;
  454. color: rgba(166, 166, 166, 1);
  455. width: 100%;
  456. }
  457. .sou-text>>>.uni-input-input {
  458. position: relative;
  459. display: block;
  460. height: 100%;
  461. background: none;
  462. color: inherit;
  463. opacity: 1;
  464. font: inherit;
  465. line-height: inherit;
  466. letter-spacing: inherit;
  467. text-align: inherit;
  468. text-indent: inherit;
  469. text-transform: inherit;
  470. text-shadow: inherit;
  471. width: 185px;
  472. height: 35px;
  473. border-radius: 85px;
  474. /* background: rgba(242, 242, 242, 1); */
  475. }
  476. /* 筛选 */
  477. .select2{
  478. margin: 20rpx 0 0 0;
  479. width: 100%;
  480. height: 120rpx;
  481. background: rgba(255, 255, 255, 1);
  482. }
  483. .wei-title1{
  484. color: rgba(0, 97, 255, 1);
  485. }
  486. .title1{
  487. margin: 41rpx 0 0 55rpx;
  488. font-size: 28rpx;
  489. }
  490. .title2{
  491. margin: -41px 0 0 228rpx;
  492. font-size: 28rpx;
  493. }
  494. .title3{
  495. margin: -41px 0 0 408rpx;
  496. font-size: 28rpx;
  497. }
  498. .title4{
  499. margin: -41px 0 0 588rpx;
  500. font-size: 28rpx;
  501. }
  502. .wei-line1{
  503. margin: 31rpx 0 0 15rpx;
  504. width: 79rpx;
  505. height: 8rpx;
  506. border-radius: 75rpx;
  507. background: rgba(0, 97, 255, 1);
  508. }
  509. /* 数据列表 */
  510. .kuang{
  511. margin: 20rpx 0 0 0;
  512. width: 100%;
  513. background: rgba(255, 255, 255, 1);
  514. min-height: 100vh; /* 设置最小高度为视口高度 */
  515. }
  516. .all-select{
  517. display: flex;
  518. margin: 31rpx 0 0 19rpx;
  519. width: 712rpx;
  520. height: 90rpx;
  521. border-radius: 7rpx;
  522. background: rgba(242, 247, 255, 1);
  523. align-items: center;
  524. }
  525. .all-list{
  526. width: 159rpx;
  527. height: 71rpx;
  528. border-radius: 7rpx;
  529. background: rgba(0, 97, 255, 0.1);
  530. border: 1rpx solid rgba(0, 97, 255, 1);
  531. font-size: 28rpx;
  532. line-height: 71rpx;
  533. color: rgba(0, 97, 255, 1);
  534. text-align: center;
  535. }
  536. .all-list2{
  537. width: 159rpx;
  538. height: 71rpx;
  539. border-radius: 7rpx;
  540. font-size: 28rpx;
  541. line-height: 71rpx;
  542. color: rgba(56, 56, 56, 1);
  543. text-align: center;
  544. }
  545. /* 数据列表循环 */
  546. .list{
  547. display: flex;
  548. flex-direction: column;
  549. margin: 20rpx 0 0 20rpx;
  550. width: 709rpx;
  551. height: 422rpx;
  552. border-radius: 7rpx;
  553. background: rgba(245, 248, 255, 1);
  554. box-shadow: 0px 4rpx 6rpx rgba(0, 0, 0, 0.05);
  555. font-size: 24rpx;
  556. line-height: 35rpx;
  557. }
  558. .list-proname{
  559. margin: 13rpx 0 0 29rpx;
  560. font-size: 29rpx;
  561. font-weight: 500;
  562. display: flex;
  563. }
  564. .list-kua{
  565. margin-left: 5px;
  566. width: 60px;
  567. height: 29rpx;
  568. border-radius: 4rpx;
  569. border: 2rpx solid rgba(33, 107, 255, 1);
  570. font-size: 22rpx;
  571. line-height: 29rpx;
  572. color: rgba(33, 107, 255, 1);
  573. text-align: center;
  574. }
  575. .bu-shou{
  576. width: 73px;
  577. height: 44rpx;
  578. border-radius: 7rpx;
  579. font-size: 24rpx;
  580. line-height: 44rpx;
  581. text-align: center;
  582. color: rgba(255, 255, 255, 1);
  583. }
  584. .yishou{
  585. margin: 10rpx 0 0 222rpx;
  586. background: rgba(9, 101, 98, 1);
  587. }
  588. .shou{
  589. margin: 10rpx 0 0 222rpx;
  590. background: rgba(0, 97, 255, 1);
  591. }
  592. .jinji{
  593. margin: 10rpx 0 0 15rpx;
  594. background: rgba(254, 144, 51, 1);
  595. }
  596. .norl{
  597. margin: 10rpx 0 0 15rpx;
  598. background: rgba(166, 166, 166, 1);
  599. color: rgba(255, 255, 255, 1);
  600. }
  601. .more{
  602. margin: 10rpx 0 0 15rpx;
  603. background: rgba(0, 97, 255, 1);
  604. }
  605. .xiala{
  606. z-index: 4;
  607. position: relative;
  608. width: 87rpx;
  609. height: 174rpx;
  610. border-radius: 2rpx;
  611. background: rgba(255, 255, 255, 1);
  612. box-shadow: 0px 4rpx 4rpx rgba(0, 0, 0, 0.1);
  613. color: rgba(0, 0, 0, 1);
  614. }
  615. .list-dan{
  616. margin: 9rpx 0 0 29rpx;
  617. }
  618. >>>.uni-progress-bar {
  619. border-radius: 9rpx;
  620. }
  621. >>>.uni-progress-inner-bar {
  622. border-radius: 9rpx;
  623. }
  624. >>>.uni-progress-info {
  625. margin-top: 0;
  626. margin-bottom: 0;
  627. min-width: 2em;
  628. margin-left: 15px;
  629. font-size: 24rpx;
  630. color: rgba(0, 0, 0, 1);
  631. }
  632. >>>uni-progress {
  633. // width: 42%;
  634. // margin: 25rpx 0 0 144rpx;
  635. }
  636. </style>