planList.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <view id="planList">
  3. <view class="top-picker-max-box">
  4. <view class="top-picker-box">
  5. <picker @change="facultyChange" :value="facultyIndex" :range="facultyArray">
  6. <view class="picker-view">
  7. <view>{{!facultyIndex?'学院':facultyArray[facultyIndex]}}</view>
  8. <img class="picker-img" src="@/images/basicsModules/icon_06.png" alt="">
  9. </view>
  10. </picker>
  11. </view>
  12. <view class="top-picker-box">
  13. <picker @change="subjectChange" :value="subjectIndex" :range="subjectArray">
  14. <view class="picker-view">
  15. <view>{{!subjectIndex?'分类':subjectArray[subjectIndex]}}</view>
  16. <img class="picker-img" src="@/images/basicsModules/icon_06.png" alt="">
  17. </view>
  18. </picker>
  19. </view>
  20. <view class="top-picker-box">
  21. <picker @change="levelChange" :value="levelIndex" :range="levelArray">
  22. <view class="picker-view">
  23. <view>{{!levelIndex?'分级':levelArray[levelIndex]}}</view>
  24. <img class="picker-img" src="@/images/basicsModules/icon_06.png" alt="">
  25. </view>
  26. </picker>
  27. </view>
  28. </view>
  29. <view class="time-max-box">
  30. <view class="title-box">风险时段选择:</view>
  31. <view class="left-time-box">
  32. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="startTimeChange">
  33. <view class="left-time-min-box">{{startTime}}</view>
  34. </picker>
  35. </view>
  36. <view class="center-box">~</view>
  37. <view class="right-time-box">
  38. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="endTimeChange">
  39. <view class="left-time-min-box">{{endTime}}</view>
  40. </picker>
  41. </view>
  42. </view>
  43. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  44. <view class="for-box" v-for="(item,index) in infoList" :key="index" @click="getSubByRiskPlanDetail(item)">
  45. <view class="title-box">
  46. <view :style="'background:'+item.subDiyVo.fiedColor+';'">{{item.subDiyVo.levelName}}</view>
  47. <view>{{item.subDiyVo.name}}</view>
  48. </view>
  49. <view class="address-box"><span>{{item.subDiyVo.typeName}}</span>{{item.subDiyVo.deptName}}</view>
  50. <view class="address-box-two">
  51. <img src="@/images/basicsModules/icon_14.png">
  52. <view>{{item.subDiyVo.subAddrrStr}}</view>
  53. </view>
  54. <view class="plan-name-box">
  55. <view class="plan-left-box">
  56. <view>{{item.riskPlanAbnormalLogVo.riskPlanName}}</view>
  57. <view>执行时间:{{item.riskPlanAbnormalLogVo.createTime}}</view>
  58. </view>
  59. <img src="@/images/basicsModules/icon_04.png">
  60. </view>
  61. </view>
  62. <img class="null-img" v-if="!infoList[0]" src="@/images/basicsModules/null-data-1.png">
  63. </scroll-view>
  64. </view>
  65. </template>
  66. <script>
  67. import { listDepartments,subject_class,getSubByRiskPlan,getSubByRiskPlanDetail,classifiedListAll } from '@/api/apiDemo/index.js'
  68. export default {
  69. name: "planList",
  70. computed: {
  71. startDate() {
  72. return this.getDate('start');
  73. },
  74. endDate() {
  75. return this.getDate('end');
  76. }
  77. },
  78. data() {
  79. const currentDate = this.getDate({
  80. format: true
  81. })
  82. return {
  83. infoList:[],
  84. //列表请求参数
  85. getData:{
  86. page:1,
  87. pageSize:20,
  88. getType:true,
  89. nullDataType:true,
  90. },
  91. //院系选择器数据
  92. facultyList:[],
  93. facultyArray:[],
  94. facultyIndex:0,
  95. //学科选择器数据
  96. subjectList:[],
  97. subjectArray:[],
  98. subjectIndex:0,
  99. //级别选择器数据
  100. levelList:[],
  101. levelArray:[],
  102. levelIndex:0,
  103. //时间选择器
  104. startTime: "开始时间",
  105. startTimestamp: 0,
  106. endTime: "结束时间",
  107. endTimestamp: 0,
  108. }
  109. },
  110. onLoad(){
  111. this.listDepartments();
  112. this.subject_class();
  113. },
  114. onShow(){
  115. this.classifiedListAll();
  116. this.clearData();
  117. this.getList();
  118. },
  119. methods:{
  120. async getSubByRiskPlanDetail(item){
  121. const {data} = await getSubByRiskPlanDetail(item.riskPlanAbnormalLogVo.id);
  122. if(data.code == 200){
  123. let obj = data.rows[0];
  124. obj.subClassVO = item.subDiyVo.subClassVO;
  125. obj.name = item.subDiyVo.name;
  126. obj.subTypeLable = item.subDiyVo.subTypeLable;
  127. obj.deptName = item.subDiyVo.deptName;
  128. obj.subAddrrStr = item.subDiyVo.subAddrrStr;
  129. uni.navigateTo({
  130. url: '/pages_manage/workbench/plan/planInfo?item='+encodeURIComponent(JSON.stringify(obj))
  131. });
  132. }
  133. },
  134. //去详情页
  135. goPlanInfo(item){
  136. uni.navigateTo({
  137. url: '/pages_manage/workbench/plan/planInfo',//预案执行记录
  138. });
  139. },
  140. //滚动选择器
  141. facultyChange: function(e) {
  142. if(this.facultyArray[0]){
  143. this.facultyIndex = parseInt(e.target.value);
  144. console.log("e.target.value",e.target.value)
  145. console.log("this.facultyIndex",this.facultyIndex)
  146. this.clearData();
  147. this.getList();
  148. }
  149. },
  150. subjectChange: function(e) {
  151. if(this.subjectArray[0]){
  152. this.subjectIndex = parseInt(e.target.value);
  153. this.clearData();
  154. this.getList();
  155. }
  156. },
  157. levelChange: function(e) {
  158. if(this.levelArray[0]){
  159. this.levelIndex = parseInt(e.target.value);
  160. this.clearData();
  161. this.getList();
  162. }
  163. },
  164. //时间选择器
  165. startTimeChange: function(e) {
  166. let timestamp = new Date(e.target.value).getTime();
  167. if(this.endTimestamp == 0){
  168. this.startTime = e.target.value
  169. this.startTimestamp = new Date(e.target.value).getTime();
  170. this.clearData();
  171. this.getList();
  172. }else{
  173. if(timestamp<=this.endTimestamp){
  174. this.startTime = e.target.value
  175. this.startTimestamp = new Date(e.target.value).getTime();
  176. this.clearData();
  177. this.getList();
  178. }else{
  179. uni.showToast({
  180. title: '开始时间不能大于结束时间',
  181. icon:"none",
  182. mask:true,
  183. duration: 2000
  184. });
  185. }
  186. }
  187. },
  188. endTimeChange: function(e) {
  189. let timestamp = new Date(e.target.value).getTime();
  190. if(this.startTimestamp == 0){
  191. this.endTime = e.target.value
  192. this.endTimestamp = new Date(e.target.value).getTime();
  193. this.clearData();
  194. this.getList();
  195. }else{
  196. if(timestamp>=this.startTimestamp){
  197. this.endTime = e.target.value
  198. this.endTimestamp = new Date(e.target.value).getTime();
  199. this.clearData();
  200. this.getList();
  201. }else{
  202. uni.showToast({
  203. title: '结束时间不能小于开始时间',
  204. icon:"none",
  205. mask:true,
  206. duration: 2000
  207. });
  208. }
  209. }
  210. },
  211. getDate(type) {
  212. const date = new Date();
  213. let year = date.getFullYear();
  214. let month = date.getMonth() + 1;
  215. let day = date.getDate();
  216. if (type === 'start') {
  217. year = year - 60;
  218. } else if (type === 'end') {
  219. year = year + 2;
  220. }
  221. month = month > 9 ? month : '0' + month;
  222. day = day > 9 ? day : '0' + day;
  223. return `${year}-${month}-${day}`;
  224. },
  225. //获取院系
  226. async listDepartments(){
  227. const {data} = await listDepartments();
  228. if(data.code == 200){
  229. let list = [];
  230. for(let i=0;i<data.data.length;i++){
  231. list.push(data.data[i].deptName)
  232. }
  233. this.facultyArray = list;
  234. list.unshift('全部院系');
  235. this.facultyList = data.data;
  236. this.facultyList.unshift({deptName:"全部院系", deptId:""})
  237. }
  238. },
  239. //获取级别
  240. async classifiedListAll(){
  241. const {data} = await classifiedListAll();
  242. if(data.code == 200){
  243. let list = [];
  244. let nameList = ['全部'];
  245. list.push({
  246. dictLabel:"全部",
  247. dictValue:""
  248. })
  249. for(let i=0;i<data.data.length;i++){
  250. let obj = {
  251. dictLabel:data.data[i].classifiedName,
  252. dictValue:data.data[i].id
  253. }
  254. list.push(obj);
  255. nameList.push(data.data[i].classifiedName);
  256. }
  257. this.levelList = list;
  258. this.levelArray = nameList;
  259. }
  260. },
  261. //获取学科字典
  262. async subject_class(){
  263. const {data} = await subject_class();
  264. if(data.code == 200){
  265. let list = [];
  266. for(let i=0;i<data.data.length;i++){
  267. list.push(data.data[i].dictLabel)
  268. }
  269. this.subjectArray = list;
  270. list.unshift('全部分类');
  271. this.subjectList = data.data;
  272. this.subjectList.unshift({dictLabel:"全部分类", dictValue:""})
  273. }
  274. },
  275. //清除
  276. clearData(){
  277. this.infoList = [];
  278. this.getData.page = 1;
  279. this.getData.getType = true;
  280. this.getData.nullDataType = true;
  281. },
  282. //滚动事件
  283. scrollGet(){
  284. if(this.getData.getType){
  285. this.getData.page += 1;
  286. this.getList();
  287. }
  288. },
  289. //获取列表数据
  290. async getList(){
  291. let self = this;
  292. let obj = {
  293. pageNum:this.getData.page,
  294. pageSize:this.getData.pageSize,
  295. deptId:"",
  296. subDept:"",
  297. typeId:"",
  298. startDate:"",
  299. endDate:""
  300. };
  301. if(this.facultyList[0]){
  302. obj.deptId = this.facultyList[this.facultyIndex].deptId;
  303. }
  304. if(this.subjectList[0]){
  305. obj.subDept = this.subjectList[this.subjectIndex].dictValue;
  306. }
  307. if(this.levelList[0]){
  308. obj.typeId = this.levelList[this.levelIndex].dictValue;
  309. }
  310. if(this.startTime != '开始时间'){
  311. obj.startDate = this.startTime;
  312. }
  313. if(this.endTime != '结束时间'){
  314. obj.endDate = this.endTime;
  315. }
  316. const {data} = await getSubByRiskPlan(obj);
  317. if(data.code==200){
  318. if(self.page==1){
  319. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  320. self.infoList = data.rows;
  321. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  322. self.infoList = data.rows;
  323. self.getData.getType = false;
  324. self.getData.nullDataType = true;
  325. }else{
  326. self.getData.getType = false;
  327. self.getData.nullDataType = true;
  328. }
  329. }else{
  330. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  331. self.infoList = self.infoList.concat(data.rows)
  332. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  333. self.infoList = self.infoList.concat(data.rows);
  334. self.getData.getType = false;
  335. self.getData.nullDataType = true;
  336. }else{
  337. self.getData.getType = false;
  338. self.getData.nullDataType = true;
  339. }
  340. }
  341. }
  342. },
  343. },
  344. }
  345. </script>
  346. <style lang="stylus" scoped>
  347. #planList{
  348. height:100%;
  349. flex:1;
  350. display flex
  351. flex-direction column
  352. overflow: hidden
  353. .top-picker-max-box{
  354. display:flex;
  355. padding:0 20rpx;
  356. background #fff
  357. border-bottom:1rpx solid #E0E0E0;
  358. .top-picker-box{
  359. line-height:80rpx;
  360. height:80rpx;
  361. .picker-view{
  362. display flex
  363. view{
  364. display:block;
  365. overflow:hidden;
  366. text-overflow:ellipsis;
  367. white-space:nowrap;
  368. font-size:28rpx;
  369. }
  370. .picker-img{
  371. width:24rpx;
  372. height:13rpx;
  373. margin-top:36rpx;
  374. margin-left:13rpx;
  375. }
  376. }
  377. }
  378. .top-picker-box:nth-child(1){
  379. text-align left
  380. width:320rpx;
  381. .picker-view{
  382. view{
  383. max-width:260rpx;
  384. }
  385. }
  386. }
  387. .top-picker-box:nth-child(2){
  388. text-align left
  389. width:215rpx;
  390. .picker-view{
  391. view{
  392. max-width:156rpx;
  393. }
  394. }
  395. }
  396. .top-picker-box:nth-child(3){
  397. text-align right
  398. width:195rpx;
  399. .picker-view{
  400. view{
  401. flex:1;
  402. }
  403. }
  404. }
  405. }
  406. .time-max-box{
  407. display flex;
  408. height:80rpx;
  409. .title-box{
  410. width: 200rpx;
  411. font-size: 28rpx;
  412. color: #333333;
  413. line-height: 80rpx;
  414. margin:0 0 0 20rpx;
  415. }
  416. .left-time-box{
  417. .left-time-min-box{
  418. padding:0 15rpx;
  419. width:170rpx;
  420. height:50rpx;
  421. border:1rpx solid #ccc;
  422. background #fff
  423. margin:15rpx 10rpx 0 0;
  424. /*text-align center*/
  425. line-height:50rpx;
  426. font-size:22rpx;
  427. color:#999;
  428. }
  429. }
  430. .center-box{
  431. line-height 80rpx
  432. color:#999;
  433. }
  434. .right-time-box{
  435. .left-time-min-box{
  436. padding:0 15rpx;
  437. width:170rpx;
  438. height:50rpx;
  439. border:1rpx solid #ccc;
  440. background #fff
  441. margin:15rpx 0 0 10rpx;
  442. /*text-align center*/
  443. line-height:50rpx;
  444. font-size:22rpx;
  445. color:#999;
  446. }
  447. }
  448. }
  449. .for-max-box{
  450. flex:1;
  451. overflow-y scroll
  452. .for-box{
  453. background #fff
  454. margin-bottom:20rpx;
  455. overflow: hidden
  456. .title-box{
  457. margin:20rpx 20rpx 0;
  458. display flex
  459. view:nth-child(1){
  460. height:42rpx;
  461. line-height:42rpx;
  462. font-size:20rpx;
  463. border-radius:10rpx;
  464. padding:0 10rpx;
  465. color:#fff;
  466. margin-right:20rpx;
  467. }
  468. view:nth-child(2){
  469. line-height:42rpx;
  470. font-size:30rpx;
  471. color:#333;
  472. max-width:600rpx;
  473. flex:1;
  474. }
  475. img{
  476. width:12rpx;
  477. height:20rpx;
  478. margin-top:11rpx;
  479. }
  480. .colorA{
  481. background:#aa2315;
  482. }
  483. .colorB{
  484. background:#ff9b09;
  485. }
  486. .colorC{
  487. background:#3ea3e9;
  488. }
  489. .colorD{
  490. background:#3ea34c;
  491. }
  492. }
  493. .address-box{
  494. margin:20rpx 20rpx;
  495. font-size:26rpx;
  496. color:#999999;
  497. span{
  498. margin-right:60rpx;
  499. }
  500. }
  501. .address-box-two{
  502. display flex
  503. margin:0 20rpx 20rpx 20rpx;
  504. img{
  505. width:28rpx;
  506. height:30rpx;
  507. margin-right:18rpx;
  508. }
  509. view{
  510. line-height:30rpx;
  511. font-size:24rpx;
  512. color:#999999;
  513. }
  514. }
  515. .plan-name-box{
  516. display flex
  517. border-top:1px solid #e0e0e0;
  518. margin:0 20rpx;
  519. .plan-left-box{
  520. flex:1;
  521. height:111rpx;
  522. view:nth-child(1){
  523. font-size:30rpx;
  524. line-height:30rpx;
  525. margin-top:21rpx;
  526. color:#333;
  527. }
  528. view:nth-child(2){
  529. font-size:24rpx;
  530. line-height:24rpx;
  531. margin-top:18rpx;
  532. color:#999;
  533. }
  534. }
  535. img{
  536. width:13rpx;
  537. height:24rpx;
  538. margin:45rpx 0 0 0;
  539. }
  540. }
  541. }
  542. .null-img{
  543. display block
  544. width:276rpx;
  545. height:321rpx;
  546. margin:100rpx 0 0 274rpx;
  547. }
  548. }
  549. }
  550. </style>