移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

591 lines
20 KiB

  1. <template>
  2. <div class="app-container">
  3. <div style="width: 100%;color:#fff;padding:15px 0;background: linear-gradient(134deg,#7ac943 1%, #22b7f2);">
  4. <div style="width: 95%;margin: 0 auto;display: flex;align-items: center;">
  5. <van-image
  6. width="60"
  7. height="60"
  8. round
  9. src="https://img.yzcdn.cn/vant/leaf.jpg"
  10. />
  11. <div style="margin-left: 15px;">
  12. <p style="margin-top: 10px;font-size: 16px;">{{nickName}}
  13. <span style="font-size: 16px;" v-if="businessLevel=='1'">·调查员</span>
  14. <span style="font-size: 16px;" v-if="businessLevel=='2'">·审核员</span>
  15. </p>
  16. </div>
  17. <van-icon name="setting-o" style="margin-left: auto;" @click="gotoLink" size="25"/>
  18. </div>
  19. </div>
  20. <div style="background:#F5F5F5;width: 95%;margin: 20px auto 0;border-radius: 15px;overflow: hidden;">
  21. <van-grid :column-num="3" :border="false">
  22. <van-grid-item>
  23. <van-badge :content="total">
  24. <img
  25. width="50"
  26. height="50"
  27. :src="require('../../assets/images/housesteadSurvey/task1.png')"
  28. @click="active=1,checkBadge()"
  29. />
  30. </van-badge>
  31. <p id="basetext" :style="{color:(active==1?'#7AC943':'#000'),fontSize:'14px',marginTop:'5px'}">全部任务</p>
  32. </van-grid-item>
  33. <van-grid-item>
  34. <van-badge :content="done">
  35. <img
  36. width="50"
  37. height="50"
  38. :src="require('../../assets/images/housesteadSurvey/task2.png')"
  39. @click="active=2,checkBadge()"
  40. />
  41. </van-badge>
  42. <p :style="{color:(active==2?'#7AC943':'#000'),fontSize:'14px',marginTop:'5px'}">已完成</p>
  43. </van-grid-item>
  44. <van-grid-item>
  45. <van-badge :content="todo">
  46. <img
  47. width="50"
  48. height="50"
  49. :src="require('../../assets/images/housesteadSurvey/task3.png')"
  50. @click="active=3,checkBadge()"
  51. />
  52. </van-badge>
  53. <p :style="{color:(active==3?'#7AC943':'#000'),fontSize:'14px',marginTop:'5px'}">待调查</p>
  54. </van-grid-item>
  55. </van-grid>
  56. </div>
  57. <div style="margin:20px;">
  58. <div style="float:left;font-size: 16px;">任务列表</div>
  59. <div style="float:left;font-size: 16px;margin-left: 25%;">
  60. <span @click="queryAllxz()">{{deptName}}</span>
  61. <div id="dropList" v-if="showDropList" style="width: 28vw; position: absolute; z-index: 99; left: 55%; margin-left: -16vw; border: 1px solid #E2E0E0;" >
  62. <van-cell id="vanCell" v-for="(item, index) in xzList" :key="index" @click="xzChange(item)" style="position: relative; z-index: 999;">
  63. {{item.deptName}}
  64. </van-cell>
  65. </div>
  66. </div>
  67. <div style="float:right;font-size: 16px;">
  68. <van-checkbox v-model="checked" @change="checkChange">仅我</van-checkbox>
  69. </div>
  70. </div>
  71. <div style="margin-top: 50px;">
  72. <van-sticky style="margin-top: 20px;">
  73. <van-search v-model="rwmcValue" placeholder="请输入任务名称" @search="onSearch" ></van-search>
  74. </van-sticky>
  75. </div>
  76. <div v-if="active==1" style="height:calc( 100vh - 350px);margin-top: 5%;overflow-y:auto;">
  77. <van-list
  78. v-model:loading="loading"
  79. :finished="finished"
  80. finished-text="没有更多了"
  81. :immediate-check="false"
  82. @load="onRefreshtask"
  83. >
  84. <van-cell v-for="(item,index) in totalList" :key="item.id" size="small" @click.native="setCookies(item)" style="border-radius: 16px;
  85. box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.16); width:95%;margin:0px auto 20px;height: 110px;">
  86. <template #title>
  87. <div>{{item.rwmc}} <span :style="{'color':chooseColor(item),'background':chooseColor2(item),'display':'inline-block','padding':'4px 2px','line-height':'1','border-radius':'5px'}">{{item.zjdwcsl}}/{{item.zjdsl}}</span></div>
  88. </template>
  89. <template #default>
  90. <van-circle
  91. v-model="item.zjdslz"
  92. :rate="chooseNum(item)"
  93. :stroke-width="100"
  94. :speed="100"
  95. size="70%"
  96. layer-color="#ebedf0"
  97. :text="item.zjdwcsl!=0?(item.zjdwcsl == item.zjdsl?100+'%':( Math.round(((item.zjdwcsl/item.zjdsl)*100)))+'%'):0+'%'"
  98. />
  99. </template>
  100. <template #label>
  101. <p style="display: flex;align-items: center;margin-top: 5px;"><van-icon name="clock" color="#22b7f2" style="margin-right:5px;"/>{{item.jhkssj}}~{{item.jhjssj}}</p>
  102. <p style="display: flex;align-items: center;margin-top: 5px;"><van-icon name="manager" color="#22b7f2" style="margin-right:5px;"/>{{item.rwzxr}}</p>
  103. </template>
  104. </van-cell>
  105. </van-list>
  106. </div>
  107. <div v-if="active==2" style="height:calc( 100vh - 350px);margin-top: 14%;overflow-y:auto;">
  108. <van-list
  109. v-model:loading="loading"
  110. :finished="finished"
  111. finished-text="没有更多了"
  112. :immediate-check="false"
  113. @load="onRefreshtask"
  114. >
  115. <van-cell v-for="(item,index) in doneList" :key="item.id" size="small" @click.native="setCookies(item)" style="border-radius: 16px;
  116. box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.16); width:95%;margin:0px auto 20px;height: 110px;">
  117. <template #title>
  118. <div>{{item.rwmc}} <span :style="{'color':chooseColor(item),'background':chooseColor2(item),'display':'inline-block','padding':'4px 2px','line-height':'1','border-radius':'5px'}">{{item.zjdwcsl}}/{{item.zjdsl}}</span></div>
  119. </template>
  120. <template #default>
  121. <van-circle
  122. v-model="item.zjdslz"
  123. :rate="chooseNum(item)"
  124. :stroke-width="100"
  125. :speed="100"
  126. size="70%"
  127. layer-color="#ebedf0"
  128. :text="item.zjdwcsl!=0?(item.zjdwcsl == item.zjdsl?100+'%':( Math.round(((item.zjdwcsl/item.zjdsl)*100)))+'%'):0+'%'"
  129. />
  130. </template>
  131. <template #label>
  132. <p style="display: flex;align-items: center;margin-top: 5px;"><van-icon name="clock" color="#22b7f2" style="margin-right:5px;"/>{{item.jhkssj}}~{{item.jhjssj}}</p>
  133. <p style="display: flex;align-items: center;margin-top: 5px;"><van-icon name="manager" color="#22b7f2" style="margin-right:5px;"/>{{item.rwzxr}}</p>
  134. </template>
  135. </van-cell>
  136. </van-list>
  137. </div>
  138. <div v-if="active==3" style="height:calc( 100vh - 350px);margin-top: 14%;overflow-y:auto;">
  139. <van-list
  140. v-model:loading="loading"
  141. :finished="finished"
  142. finished-text="没有更多了"
  143. :immediate-check="false"
  144. @load="onRefreshtask"
  145. >
  146. <van-cell v-for="(item,index) in todoList" :key="item.id" size="small" @click.native="setCookies(item)" style="border-radius: 16px;
  147. box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.16); width:95%;margin:0px auto 20px;height: 110px;">
  148. <template #title>
  149. <div>{{item.rwmc}} <span :style="{'color':chooseColor(item),'background':chooseColor2(item),'display':'inline-block','padding':'4px 2px','line-height':'1','border-radius':'5px'}">{{item.zjdwcsl}}/{{item.zjdsl}}</span></div>
  150. </template>
  151. <template #default>
  152. <van-circle
  153. v-model="item.zjdslz"
  154. :rate="chooseNum(item)"
  155. :stroke-width="100"
  156. :speed="100"
  157. size="70%"
  158. layer-color="#ebedf0"
  159. :text="item.zjdwcsl!=0?(item.zjdwcsl == item.zjdsl?100+'%':( Math.round(((item.zjdwcsl/item.zjdsl)*100)))+'%'):0+'%'"
  160. />
  161. </template>
  162. <template #label>
  163. <p style="display: flex;align-items: center;margin-top: 5px;"><van-icon name="clock" color="#22b7f2" style="margin-right:5px;"/>{{item.jhkssj}}~{{item.jhjssj}}</p>
  164. <p style="display: flex;align-items: center;margin-top: 5px;"><van-icon name="manager" color="#22b7f2" style="margin-right:5px;"/>{{item.rwzxr}}</p>
  165. </template>
  166. </van-cell>
  167. </van-list>
  168. </div>
  169. </div>
  170. </template>
  171. <script>
  172. import {listTask,mobileList,getTownInfo, publish, updateTask, userList} from "@/api/homesteadSurvey/index";
  173. import {changeDept} from "@/api/homesteadSurvey/zjdzd";
  174. import {getInfo} from "../../api/login";
  175. import CircleProccess from "@/components/circleProccess.vue";
  176. import {updateUserPwd} from "../../api/onlineHome/my";
  177. import {Dialog} from "vant";
  178. import {sysConfig} from "../../api/homesteadSurvey";
  179. import axios from "axios";
  180. export default {
  181. name: "homesteadIndex",
  182. components: {
  183. CircleProccess
  184. },
  185. data() {
  186. return {
  187. currentRate1:0,
  188. currentRate2:0,
  189. currentRate3:0,
  190. active: 1,
  191. show: false,
  192. loading: false,
  193. finished: false,
  194. checked:true,
  195. rwmcValue:"",
  196. zjdsl:100,
  197. height:200,
  198. phone:null,
  199. activeKey:0,
  200. currentRate: 0,
  201. deptName:"全部乡镇",
  202. showDropList:false,
  203. total:0,
  204. totalList:[],
  205. xzList:[],
  206. done:0,
  207. doneList:[],
  208. todo:0,
  209. todoList:[],
  210. gradientColor:{
  211. },
  212. // 查询参数
  213. queryParams: {
  214. rwwczt: null,
  215. rwfbzt:"PUBLISHED",
  216. rwzxr:null
  217. },
  218. nickName:"",
  219. text:0,
  220. isLoadingtask:false,
  221. countqb:1,
  222. countyhc:1,
  223. countwhc:1,
  224. //当前用户级别
  225. businessLevel:1,
  226. // 字典列表json
  227. dictTypeList:null,
  228. };
  229. },
  230. created(){
  231. if(this.checked){
  232. setTimeout(() => {
  233. let userId = this.$store.state.user.userId;
  234. console.info(userId);
  235. this.nickName = this.$store.state.user.nickName;
  236. this.$set(this.queryParams, "rwzxr", userId);
  237. this.$set(this.queryParams, "params", {deptId:100});
  238. this.getList();
  239. },1000)
  240. }else{
  241. this.$set(this.queryParams, "rwzxr", null);
  242. this.getList();
  243. }
  244. getTownInfo(100).then(response => {
  245. this.xzList = response.data
  246. let qbxz = {deptId:100,deptName:"全部乡镇"}
  247. this.xzList.unshift(qbxz);
  248. })
  249. axios.get('../static/dictyType.json').then(res => {
  250. this.dictTypeList = res.data
  251. })
  252. },
  253. mounted(){
  254. // 监听屏幕方向
  255. let self = this;
  256. window.addEventListener(
  257. "onorientationchange" in window ? "orientationchange" : "resize",
  258. function() {
  259. if (window.orientation === 90 || window.orientation === -90) {
  260. // 横屏
  261. }
  262. },
  263. false
  264. );
  265. if(this.$cookies.get("url")==null||this.$cookies.get("url")==""){
  266. this.getBaseUrl()
  267. }
  268. },
  269. methods: {
  270. onSearch(){
  271. // this.finished = false;
  272. // this.loading = false;
  273. // this.totalList = []
  274. // this.doneList = [];
  275. // this.todoList = [];
  276. this.$set(this.queryParams, "rwmc", this.rwmcValue);
  277. this.checkBadge();
  278. },
  279. getBaseUrl(){
  280. let params={
  281. configKey: "system.attachment.url"}
  282. sysConfig(params).then(response => {
  283. this.$cookies.set("url",response.rows[0].configValue)
  284. })
  285. },
  286. qiehuan(deptId){
  287. changeDept(deptId).then(response => {
  288. this.$router.push({name:'homesteadList'})
  289. });
  290. },
  291. chooseNum(item){
  292. let a = ((item.zjdwcsl/item.zjdsl)*100);
  293. if(a === "NaN"){
  294. return a = 0
  295. }else{
  296. return a = Math.round(a);
  297. }
  298. },
  299. chooseColor(item){
  300. let a = ((item.zjdwcsl/item.zjdsl)*100).toFixed()
  301. if(a === "NaN" || a < 50){
  302. return '#FA5353'
  303. }else if(a < 100){
  304. return '#22B7F2'
  305. }else{
  306. return '#85d824'
  307. }
  308. return '#FA5353'
  309. },
  310. chooseColor2(item){
  311. let a = ((item.zjdwcsl/item.zjdsl)*100).toFixed()
  312. if(a === "NaN" || a < 50){
  313. return 'rgba(250,83,83,0.22)'
  314. }else if(a < 100){
  315. return 'rgba(34,183,242,0.22)'
  316. }else{
  317. return 'rgba(122,201,67,0.22)'
  318. }
  319. return '#FA5353'
  320. },
  321. onRefreshtask(){
  322. this.isLoadingtask = false;
  323. let _this = this
  324. if(this.active==1 && this.loading ){
  325. let params = {
  326. "rwfbzt":"PUBLISHED",
  327. "params":this.queryParams.params,
  328. "rwmc":this.rwmcValue,
  329. "parentId":this.queryParams.parentId,
  330. "pageNum": this.countyhc+1,
  331. "pageSize":4,
  332. }
  333. if(this.queryParams.rwzxr != null){
  334. params.rwzxr = this.queryParams.rwzxr;
  335. }
  336. listTask(params).then((response) => {
  337. if(response.rows.length>0&&this.totalList.length<response.total){
  338. response.rows.map(function(item) {
  339. if(item.zjdwcsl === 0){
  340. item.zjdslz = 0;
  341. }else{
  342. item.zjdslz = 100;
  343. }
  344. _this.totalList.push(item)
  345. })
  346. this.countyhc++
  347. this.loading = false;
  348. }else{
  349. this.finished = true;
  350. }
  351. });
  352. }else if(this.active==2 && this.loading){
  353. let params = {
  354. "rwwczt": "PUBLISHED",
  355. "rwfbzt":"PUBLISHED",
  356. "rwmc":this.rwmcValue,
  357. "params":this.queryParams.params,
  358. "parentId":this.queryParams.parentId,
  359. "pageNum": this.countwhc+1,
  360. "pageSize":4,
  361. }
  362. if(this.queryParams.rwzxr != null){
  363. params.rwzxr = this.queryParams.rwzxr;
  364. }
  365. listTask(params).then((response) => {
  366. if(response.rows.lenght>0&&this.doneList.length<response.total){
  367. response.rows.map(function(item){
  368. if(item.zjdwcsl === 0){
  369. item.zjdslz = 0;
  370. }else{
  371. item.zjdslz = 100;
  372. }
  373. _this.doneList.push(item)
  374. })
  375. this.countwhc++
  376. this.loading = false;
  377. }else{
  378. this.finished = true;
  379. }
  380. });
  381. }else if(this.active==3 && this.loading){
  382. let params = {
  383. "rwwczt": "UNFINISHED",
  384. "rwfbzt":"PUBLISHED",
  385. "rwmc":this.rwmcValue,
  386. "params":this.queryParams.params,
  387. "parentId":this.queryParams.parentId,
  388. "pageNum": this.countqb+1,
  389. "pageSize":4,
  390. }
  391. if(this.queryParams.rwzxr != null){
  392. params.rwzxr = this.queryParams.rwzxr;
  393. }
  394. listTask(params).then((response) => {
  395. if(response.rows.length>0&&this.todoList.length<response.total){
  396. response.rows.map(function(item){
  397. if(item.zjdwcsl === 0){
  398. item.zjdslz = 0;
  399. }else{
  400. item.zjdslz = 100;
  401. }
  402. _this.todoList.push(item);
  403. })
  404. this.countqb++
  405. this.loading = false;
  406. }else{
  407. this.finished = true
  408. }
  409. });
  410. }
  411. },
  412. checkChange(e){
  413. if(e){
  414. let userId = this.$store.state.user.userId;
  415. this.$set(this.queryParams, "rwzxr", userId);
  416. this.getList();
  417. }else{
  418. this.$set(this.queryParams, "rwzxr", null);
  419. this.getList();
  420. }
  421. },
  422. setCookies(item){
  423. /* if(this.$cookies.get("upload")==null||this.$cookies.get("upload")==0){
  424. Dialog.confirm({
  425. title: '提示',
  426. message: '当前未选择批量上传,可能会由于网络原因上传图片缓慢,是否继续?',
  427. })
  428. .then(() => {
  429. // on confirm
  430. this.$router.push({name:'homesteadList'})
  431. this.$cookies.set("item",JSON.stringify(item));
  432. })
  433. .catch(() => {
  434. // on cancel
  435. });
  436. }else{
  437. this.$router.push({name:'homesteadList'})
  438. this.$cookies.set("item",JSON.stringify(item));
  439. }*/
  440. let userId = this.$store.state.user.userId;
  441. // let businessLevel = this.$store.getters.businessLevel;
  442. let status = false;
  443. if(item.rwzxrIds != null && item.rwzxrIds !== ""){
  444. let ids = item.rwzxrIds.split(",");
  445. ids.forEach(function(id){
  446. if(userId === parseInt(id)){
  447. status = true;
  448. }
  449. });
  450. }
  451. if(status){
  452. localStorage.setItem("surveyItem",JSON.stringify(item));
  453. this.qiehuan(item.deptId);
  454. }else{
  455. this.$dialog.alert({
  456. message: "没有该任务的调查权限!",
  457. });
  458. }
  459. },
  460. queryAllxz(){
  461. if (this.showDropList) {
  462. this.showDropList = false; // div显示会阻挡下边的选择框和输入框,showDropList控制下拉框是否显示
  463. } else {
  464. this.showDropList = true;
  465. }
  466. },
  467. xzChange(val){
  468. this.deptName = val.deptName;
  469. this.showDropList = false;
  470. this.$set(this.queryParams, "deptId", null);
  471. if(val.deptId != 100){
  472. this.$set(this.queryParams, "parentId", val.deptId);
  473. this.$set(this.queryParams, "params", {deptId:null});
  474. }else{
  475. this.$set(this.queryParams, "parentId", null);
  476. this.$set(this.queryParams, "params", {deptId:val.deptId});
  477. }
  478. this.getList();
  479. },
  480. checkBadge(){
  481. // this.finished = false;
  482. // this.loading = false;
  483. // this.totalList = []
  484. // this.doneList = [];
  485. // this.todoList = [];
  486. this.getList();
  487. },
  488. getList() {
  489. this.totalList = []
  490. this.doneList = [];
  491. this.todoList = [];
  492. this.countqb = 1;
  493. this.countyhc = 1;
  494. this.countwhc = 1;
  495. this.finished = false;
  496. this.loading = false;
  497. if(this.active==1) {
  498. this.$set(this.queryParams, "rwfbzt", "PUBLISHED");
  499. this.$set(this.queryParams, "rwwczt", null);
  500. this.$set(this.queryParams, "pageNum", this.countyhc);
  501. this.$set(this.queryParams, "pageSize", 4);
  502. mobileList(this.queryParams).then(response => {
  503. this.done = response.wcs;
  504. this.todo = response.dcs;
  505. this.total = response.tableDataInfo.total;
  506. this.totalList = response.tableDataInfo.rows.map(function(item){
  507. if(item.zjdwcsl === 0){
  508. item.zjdslz = 0;
  509. }else{
  510. item.zjdslz = 100;
  511. }
  512. return item;
  513. });
  514. });
  515. }else if(this.active==2) {
  516. this.$set(this.queryParams, "rwwczt", "FINISHED");
  517. this.$set(this.queryParams, "rwfbzt", "PUBLISHED");
  518. this.$set(this.queryParams, "pageNum", this.countwhc);
  519. mobileList(this.queryParams).then(response => {
  520. this.total = response.wcs;
  521. this.todo = response.dcs;
  522. this.done = response.tableDataInfo.total;
  523. this.doneList = response.tableDataInfo.rows.map(function(item){
  524. if(item.zjdwcsl === 0){
  525. item.zjdslz = 0;
  526. }else{
  527. item.zjdslz = 100;
  528. }
  529. return item;
  530. })
  531. });
  532. }else{
  533. this.$set(this.queryParams, "rwwczt", "UNFINISHED");
  534. this.$set(this.queryParams, "rwfbzt", "PUBLISHED");
  535. this.$set(this.queryParams, "pageNum", this.countqb);
  536. mobileList(this.queryParams).then(response => {
  537. this.total = response.wcs;
  538. this.done = response.dcs;
  539. this.todo = response.tableDataInfo.total;
  540. this.todoList = response.tableDataInfo.rows.map(function(item){
  541. if(item.zjdwcsl === 0){
  542. item.zjdslz = 0;
  543. }else{
  544. item.zjdslz = 100;
  545. }
  546. return item;
  547. })
  548. });
  549. }
  550. },
  551. gotoLink(){
  552. this.$router.push('/homesteadSurvey/settle')
  553. },
  554. },
  555. }
  556. </script>
  557. <style scoped>
  558. >>> .van-cell__title{
  559. flex:3
  560. }
  561. >>> .sss {
  562. display: flex;
  563. }
  564. >>> .title:before
  565. {
  566. content:"";
  567. width: 6px;
  568. height: 20PX;
  569. background: #7ac943;
  570. border-radius: 3px;
  571. position:absolute;
  572. left:0;
  573. bottom:0;
  574. }
  575. </style>