移动端
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.
 
 

421 rivejä
15 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-sticky style="position:relative;">
  4. <div class="bannerBg">
  5. <van-nav-bar
  6. style="background:transparent;border-bottom-width:0;margin-bottom:.5rem;"
  7. @click-left="goBack()"
  8. right-text ="首页"
  9. @click-right="goRightBack()"
  10. >
  11. <template #left>
  12. <van-icon name="arrow-left" size="18" color="#fff" />
  13. </template>
  14. <!-- <template #right>
  15. <van-icon name="map-marked" size="18" color="#fff" />
  16. </template>-->
  17. <template #title>
  18. <p style="color:#fff">入户调查</p>
  19. </template>
  20. </van-nav-bar>
  21. </div>
  22. <div style="width:95%;left:2.5%;position:absolute;background:#fff;border-radius:15px;box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.16);padding: .3rem;top:1.2rem">
  23. <van-row>
  24. <van-col span="4" :offset="1" style="text-align:center;" @click="$router.push({path:'/homesteadSurvey/add'})">
  25. <van-icon :name="require('../../assets/images/housesteadSurvey/zjd'+(active==1?'A':'D')+'.png')" size="1rem" style="margin-top:0px;"/>
  26. <p :style="{color:(active==1?'rgb(34, 183, 242)':'#000')}">宅基地</p>
  27. </van-col>
  28. <van-col span="2">
  29. <div style="border-top: 2px dashed #b5b4b4;margin-top: 20px;"></div>
  30. </van-col>
  31. <van-col span="4" style="text-align:center;" @click="$router.push({path:'/homesteadSurvey/add2'})" >
  32. <van-icon :name="require('../../assets/images/housesteadSurvey/nhxx'+(active==2?'A':'D')+'.png')" size="1rem" style="margin-top:0px;"/>
  33. <p :style="{color:(active==2?'rgb(34, 183, 242)':'#000')}">使用权人</p>
  34. </van-col>
  35. <van-col span="2">
  36. <div style="border-top: 2px dashed #b5b4b4;margin-top: 20px;"></div>
  37. </van-col>
  38. <van-col span="4" style="text-align:center;" @click="$router.push({path:'/homesteadSurvey/add3'})" >
  39. <van-icon :name="require('../../assets/images/housesteadSurvey/fwxx'+(active==3?'A':'D')+'.png')" size="1rem" style="margin-top:0px;"/>
  40. <p :style="{color:(active==3?'rgb(34, 183, 242)':'#000')}">房屋</p>
  41. </van-col>
  42. <van-col span="2">
  43. <div style="border-top: 2px dashed #b5b4b4;margin-top: 20px;"></div>
  44. </van-col>
  45. <van-col span="4" style="text-align:center;" @click="$router.push({path:'/homesteadSurvey/add4'})">
  46. <van-icon :name="require('../../assets/images/housesteadSurvey/fsss'+(active==4?'A':'D')+'.png')" size="1rem" style="margin-top:0px;"/>
  47. <p :style="{color:(active==4?'rgb(34, 183, 242)':'#000')}">附属物</p>
  48. </van-col>
  49. </van-row>
  50. </div>
  51. </van-sticky>
  52. <div style="margin:1.6rem auto 0;width: 95%;">
  53. <p class="title" style="position:relative;padding-left:10px;line-height:20px;font-size: 16px;margin-bottom: 5px;">自然幢</p>
  54. </div>
  55. <van-list
  56. v-model:loading="loading"
  57. :finished="finished"
  58. finished-text="没有更多了"
  59. :immediate-check="false"
  60. @load="onRefreshZrz"
  61. >
  62. <van-swipe-cell v-for="(item,index) in zrzlist" :key="'zrz'+index" style="border-radius: 16px;box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.16); width:95%;margin:15px auto 0;background:#fff;">
  63. <div style="padding:15px;">
  64. <p style="display: flex;align-items: center;">
  65. <img src="../../assets/images/housesteadSurvey/add03.png" alt="" style="margin-right: 5px;">
  66. <span style="line-height: 1;font-size: 16px;">第{{index+1}}号</span>
  67. </p>
  68. <div style="display:flex;line-height:20px;margin-top: 15px;font-size: 14px;color: #999999;">
  69. <p style="flex:1;text-align:left;">自然幢号:</p>
  70. <p style="flex:1;text-align:right;">{{item.zrzh}}</p>
  71. </div>
  72. <div style="display:flex;line-height:20px;margin-top: 5px;font-size: 14px;color: #999999;">
  73. <p style="flex:1;text-align:left;">总层数:</p>
  74. <p style="flex:1;text-align:right;">{{item.zcs}}</p>
  75. </div>
  76. <div style="text-align:center;overflow:auto;display: flex;justify-content: space-between;margin-top: 10px;">
  77. <p style="width:49%;display: flex;align-items: center;justify-content:center;border: 1px solid #22B7F2;padding: 3px 0;border-radius: 50px;" @click="showPopupzrz(item)">
  78. <img src="../../assets/images/housesteadSurvey/add02.png" alt="">
  79. <span style="font-size: 14px;color: #22B7F2;margin-left: 5px;">自然幢信息</span>
  80. </p>
  81. <p style="width:49%;display: flex;align-items: center;justify-content:center;border: 1px solid #22B7F2;padding: 3px 0;border-radius: 50px;" @click="shownmfwlist(item)">
  82. <img src="../../assets/images/housesteadSurvey/add02.png" alt="">
  83. <span style="font-size: 14px;color: #22B7F2;margin-left: 5px;">房屋列表</span>
  84. </p>
  85. </div>
  86. </div>
  87. <template #right>
  88. <van-row>
  89. <van-col>
  90. <van-button square type="info" class="delete-button" style="position: relative;" @click="showUploadList(item.id)"><van-icon style="bottom: -3px;" name="photo-o" size=".4rem" color="#FFFFFF"/>附件</van-button>
  91. </van-col>
  92. <van-col>
  93. <van-button v-if="permission == 'true'" square type="danger" class="delete-button" @click="deletezrz(item)"><img width="10px" src="../../assets/images/sunVillage_info/list_icon_7.png" alt="">删除</van-button>
  94. </van-col>
  95. </van-row>
  96. </template>
  97. </van-swipe-cell>
  98. </van-list>
  99. <div v-if="permission == 'true'" style=" width:95%;margin:20px auto;display: flex;justify-content: center;">
  100. <div style="width:100%;text-align:center;overflow:auto;border-radius: 16px;box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.16);padding: 15px 0px;background: #ffffff;color: #22B7F2;">
  101. <p style="font-size: 16px;" @click="showPopupAddzrz()">+ 添加自然幢信息</p>
  102. </div>
  103. </div>
  104. <van-popup v-model:show="showImageList" position="bottom" style="height:40vh;padding:50px 10px 0" closeable
  105. close-icon="close">
  106. <p style="color:#000;position:absolute;top:0.426667rem;left:0.426667rem">图片上传</p>
  107. <div style="width:100%;height:calc( 40vh - 100px);overflow-y: scroll;">
  108. <van-uploader accept="image/*" v-model="uploadImgList" :after-read="beforeReadImageList" @delete="deleteFileImageList" multiple :max-count="50" />
  109. </div>
  110. <van-row justify="space-around" style=" position:fixed;bottom:0;left:0;width:100%;height:50px;text-align: center;">
  111. <van-col span="12"><van-button type="primary" style="width:100px;" round @click="qkClick">清空</van-button></van-col>
  112. <van-col span="12"><van-button type="primary" style="width:100px;" round @click="submitUploadList(zjdId)">上传</van-button></van-col>
  113. </van-row>
  114. </van-popup>
  115. </div>
  116. </template>
  117. <script>
  118. import MapGisDrawing from "@/components/Map/MapGisDrawing";
  119. import {uploadFile} from "@/api/homesteadSurvey/zjdzd";
  120. import {listZrz,delZrz} from "@/api/homesteadSurvey/zrz";
  121. import {attachmentFind} from "@/api/sunVillage_info/homestead/application";
  122. import {systemAttachment} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  123. import {base64Attach} from "@/api/user";
  124. import { Notify, Dialog, Toast } from 'vant';
  125. import axios from "axios";
  126. export default {
  127. name: "homesteadAdd",
  128. components: { MapGisDrawing,},
  129. data() {
  130. return {
  131. active:3,
  132. loading:false,
  133. finished:false,
  134. permission:false,
  135. showImageList:false,
  136. zjdId:null,
  137. uploadImgList:[],
  138. uploadImgList1:[],
  139. countyhc:1,
  140. zjdzdxx:{},
  141. zrzlist:[]
  142. };
  143. },
  144. created(){
  145. this.zjdzdxx = JSON.parse(localStorage.getItem("zjdzdxxItem"));
  146. this.permission = localStorage.getItem("executePermission");
  147. if(this.zjdzdxx.zjddm != null ){
  148. this.getList();
  149. }
  150. },
  151. mounted(){
  152. },
  153. methods: {
  154. getList(){
  155. let params = {
  156. zjddm:this.zjdzdxx.zjddm,
  157. pageNum: 1,
  158. pageSize:10,
  159. }
  160. listZrz(params).then(response => {
  161. this.zrzlist = response.rows;
  162. if(response.rows.length>0&&response.rows.length<response.total){
  163. this.countyhc++
  164. this.loading = false
  165. }else{
  166. this.loading = false
  167. this.finished = true
  168. }
  169. });
  170. },
  171. goBack(){
  172. if(this.ztMap && this.enterMap ==1){
  173. if(this.form.id == null){
  174. this.backMap.backMapZjdAData.theGeom= "";
  175. }else{
  176. this.backMap.backMapZjdAData = this.form;
  177. }
  178. this.$cookies.set("search",this.backMap);
  179. } else {
  180. this.$cookies.set("search","");
  181. }
  182. this.$router.push({name: this.$router.back(-1)});
  183. // }
  184. },
  185. onRefreshZrz(){
  186. if(this.loading){
  187. let params = {
  188. "zjddm":this.zjdzdxx.zjddm,
  189. "pageNum": this.countyhc+1,
  190. "pageSize":10,
  191. }
  192. listZrz(params).then(response => {
  193. if(response.rows.length>0&&this.zrzlist.length<response.total){
  194. response.rows.map(res => {
  195. this.zrzlist.push(res)
  196. })
  197. this.countyhc++
  198. this.loading = false
  199. }else{
  200. this.loading = false
  201. this.finished = true
  202. }
  203. });
  204. }
  205. },
  206. getAttachments(id) {
  207. console.info(id);
  208. this.uploadImgList = [];
  209. let cond = {
  210. tableId: id,
  211. tableName: 't_homespace_zrz',
  212. fileType: 0,
  213. };
  214. attachmentFind(cond).then(resp => {
  215. this.uploadImgList = resp.data.map(function(item){
  216. return {id:item.id,url:'/api'+item.fileUrl,isImage: true}
  217. });
  218. });
  219. },
  220. deleteFileImageList(file){
  221. if(file.id !== undefined ){
  222. systemAttachment(file.id);
  223. }
  224. },
  225. // 图片上传前
  226. beforeReadImageList(file){
  227. let _this = this;
  228. if(file.length!=undefined){
  229. file.map(res => {
  230. let zjddm = res.file.name
  231. //zjddm=zjddm.substring(0,zjddm.lastIndexOf("\("));
  232. // 创建Canvas对象(画布)
  233. let canvas = document.createElement('canvas')
  234. // 获取对应的CanvasRenderingContext2D对象(画笔)
  235. let context = canvas.getContext('2d')
  236. // 创建新的图片对象
  237. let img = new Image()
  238. // 指定图片的DataURL(图片的base64编码数据)
  239. img.src = res.content
  240. // 监听浏览器加载图片完成,然后进行进行绘制
  241. img.onload = () => {
  242. /*const h = img.height
  243. const w = img.width*/
  244. let ch = img.height/5
  245. let cw = img.width/5
  246. let canvas = document.createElement('canvas')
  247. let ctx = canvas.getContext('2d')
  248. canvas.height = ch
  249. canvas.width = cw
  250. ctx.clearRect(0,0,cw,ch)
  251. ctx.drawImage(img,0,0,cw,ch)
  252. let base_img = canvas.toDataURL('image/jpeg')
  253. let blobBin = atob(base_img.split(',')[1])
  254. let d = []
  255. for (let i=0;i<blobBin.length;i++){
  256. d.push(blobBin.charCodeAt(i))
  257. }
  258. let data2 = new FormData();
  259. data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
  260. uploadFile(data2);
  261. }
  262. })
  263. }else{
  264. let zjddm = file.file.name
  265. //zjddm=zjddm.substring(0,zjddm.lastIndexOf("\("));
  266. // 创建Canvas对象(画布)
  267. let canvas = document.createElement('canvas')
  268. // 获取对应的CanvasRenderingContext2D对象(画笔)
  269. let context = canvas.getContext('2d')
  270. // 创建新的图片对象
  271. let img = new Image()
  272. // 指定图片的DataURL(图片的base64编码数据)
  273. img.src = file.content
  274. // 监听浏览器加载图片完成,然后进行进行绘制
  275. img.onload = () => {
  276. /*const h = img.height
  277. const w = img.width*/
  278. let ch = img.height/5
  279. let cw = img.width/5
  280. let canvas = document.createElement('canvas')
  281. let ctx = canvas.getContext('2d')
  282. canvas.height = ch
  283. canvas.width = cw
  284. ctx.clearRect(0,0,cw,ch)
  285. ctx.drawImage(img,0,0,cw,ch)
  286. let base_img = canvas.toDataURL('image/jpeg')
  287. let blobBin = atob(base_img.split(',')[1])
  288. let d = []
  289. for (let i=0;i<blobBin.length;i++){
  290. d.push(blobBin.charCodeAt(i))
  291. }
  292. let data2 = new FormData();
  293. data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
  294. uploadFile(data2);
  295. }
  296. }
  297. },
  298. qkClick(){
  299. this.uploadImgList1 = this.uploadImgList;
  300. for(let i = 0; i < this.uploadImgList1.length; i++){
  301. if(this.uploadImgList[i].id !== undefined ){
  302. systemAttachment(this.uploadImgList[i].id);
  303. }
  304. }
  305. this.uploadImgList = [];
  306. },
  307. submitUploadList(val){
  308. let f = []
  309. for (let i of this.uploadImgList){
  310. if(i.content !== undefined){
  311. f.push(i.content)
  312. }
  313. }
  314. if(f.length === 0){
  315. return this.$toast.fail("请上传照片");
  316. }
  317. this.$toast.loading({
  318. message: "数据处理中",
  319. forbidClick: true,
  320. duration: 10000000000,
  321. });
  322. let _this = this;
  323. let file = {
  324. tableId:val,
  325. tableName:"t_homespace_zrz",
  326. bizPath:"upload",
  327. fileType:"0",
  328. files: f
  329. };
  330. base64Attach(file).then((resp) => {
  331. this.$toast({
  332. icon: 'success', // 找到自己需要的图标
  333. message: '上传成功',
  334. duration:"1000",
  335. onClose:function(){
  336. _this.showImageList = false
  337. }
  338. })
  339. });
  340. },
  341. goRightBack(){
  342. this.$router.push({path:'/homesteadSurvey/list'});
  343. },
  344. showPopupzrz(val){
  345. this.$router.push({name:'zrzAdd',query:val});
  346. },
  347. showPopupAddzrz(){
  348. this.$router.push({name:'zrzAdd',query:{zjddm:this.zjdzdxx.zjddm,fwjg:"02",sjly:"04"}});
  349. },
  350. shownmfwlist(val){
  351. this.$router.push({name:'nmfwList',query:val});
  352. },
  353. showUploadList(id){
  354. this.getAttachments(id);
  355. this.showImageList = true;
  356. this.zjdId = id;
  357. },
  358. deletezrz(val){
  359. const ids = val.id || this.ids;
  360. Dialog.confirm({
  361. title: '系统提示',
  362. message: '是否确认删除自然幢号数据项?',
  363. confirmButtonText: '确定',
  364. cancelButtonText: '取消'
  365. })
  366. .then(function() {
  367. return delZrz(ids);
  368. }).then(() => {
  369. this.$notify({ type: 'success' , message: "删除成功" });
  370. location.reload(true);
  371. }).catch(() => {});
  372. },
  373. }
  374. }
  375. </script>
  376. <style scoped>
  377. >>> .bannerBg{
  378. width: 100%;
  379. color:#fff;
  380. padding:10px;
  381. background: linear-gradient(134deg,#7ac943 1%, #22b7f2);
  382. }
  383. >>> .van-hairline--bottom::after {
  384. border-bottom-width: 0;
  385. }
  386. >>> .title:before
  387. {
  388. content:"";
  389. width: 6px;
  390. height: 20PX;
  391. background: #7ac943;
  392. border-radius: 3px;
  393. position:absolute;
  394. left:0;
  395. bottom:0;
  396. }
  397. >>> .delete-button {
  398. height: 100%;
  399. }
  400. >>> .van-row{
  401. height: 100%;
  402. }
  403. >>> .van-col{
  404. height: 100%;
  405. }
  406. >>> .van-swipe-cell__wrapper{
  407. margin-right:-3px;
  408. }
  409. >>> .label-class .van-collapse-item__title--expanded{
  410. font-weight: bold;
  411. }
  412. /deep/ .van-nav-bar__text {
  413. color: #fff;
  414. }
  415. </style>