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

402 lines
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 transparent;background: #22B7F2;padding: 3px 0;border-radius: 50px;" @click="showPopupzrz(item)">
  78. <img src="../../assets/images/housesteadSurvey/add01.png" alt="">
  79. <span style="font-size: 14px;color: #fff;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-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>
  89. <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>
  90. </template>
  91. </van-swipe-cell>
  92. </van-list>
  93. <div v-if="permission == 'true'" style=" width:95%;margin:20px auto;display: flex;justify-content: center;">
  94. <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;">
  95. <p style="font-size: 16px;" @click="showPopupAddzrz()">+ 添加自然幢信息</p>
  96. </div>
  97. </div>
  98. <van-popup v-model:show="showImageList" position="bottom" style="height:40vh;padding:50px 10px 0" closeable
  99. close-icon="close">
  100. <p style="color:#000;position:absolute;top:0.426667rem;left:0.426667rem">图片上传</p>
  101. <div style="width:100%;height:calc( 40vh - 100px);overflow-y: scroll;">
  102. <van-uploader accept="image/*" v-model="uploadImgList" :after-read="beforeReadImageList" @delete="deleteFileImageList" multiple :max-count="50" />
  103. </div>
  104. <van-row justify="space-around" style=" position:fixed;bottom:0;left:0;width:100%;height:50px;text-align: center;">
  105. <van-col span="12"><van-button type="primary" style="width:100px;" round @click="qkClick">清空</van-button></van-col>
  106. <van-col span="12"><van-button type="primary" style="width:100px;" round @click="submitUploadList(zjdId)">上传</van-button></van-col>
  107. </van-row>
  108. </van-popup>
  109. </div>
  110. </template>
  111. <script>
  112. import MapGisDrawing from "@/components/Map/MapGisDrawing";
  113. import {uploadFile} from "@/api/homesteadSurvey/zjdzd";
  114. import {listZrz,delZrz} from "@/api/homesteadSurvey/zrz";
  115. import {attachmentFind} from "@/api/sunVillage_info/homestead/application";
  116. import {systemAttachment} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  117. import {base64Attach} from "@/api/user";
  118. import { Notify, Dialog, Toast } from 'vant';
  119. import axios from "axios";
  120. export default {
  121. name: "homesteadAdd",
  122. components: { MapGisDrawing,},
  123. data() {
  124. return {
  125. active:3,
  126. loading:false,
  127. finished:false,
  128. permission:false,
  129. showImageList:false,
  130. zjdId:null,
  131. uploadImgList:[],
  132. uploadImgList1:[],
  133. countyhc:1,
  134. zjdzdxx:{},
  135. zrzlist:[]
  136. };
  137. },
  138. created(){
  139. this.zjdzdxx = JSON.parse(localStorage.getItem("zjdzdxxItem"));
  140. this.permission = localStorage.getItem("executePermission");
  141. if(this.zjdzdxx.zjddm != null ){
  142. this.getList();
  143. }
  144. },
  145. mounted(){
  146. },
  147. methods: {
  148. getList(){
  149. let params = {
  150. zjddm:this.zjdzdxx.zjddm,
  151. pageNum: 1,
  152. pageSize:10,
  153. }
  154. listZrz(params).then(response => {
  155. this.zrzlist = response.rows;
  156. if(response.rows.length>0&&response.rows.length<response.total){
  157. this.countyhc++
  158. this.loading = false
  159. }else{
  160. this.loading = false
  161. this.finished = true
  162. }
  163. });
  164. },
  165. goBack(){
  166. if(this.ztMap && this.enterMap ==1){
  167. if(this.form.id == null){
  168. this.backMap.backMapZjdAData.theGeom= "";
  169. }else{
  170. this.backMap.backMapZjdAData = this.form;
  171. }
  172. this.$cookies.set("search",this.backMap);
  173. } else {
  174. this.$cookies.set("search","");
  175. }
  176. this.$router.push({name: this.$router.back(-1)});
  177. // }
  178. },
  179. onRefreshZrz(){
  180. if(this.loading){
  181. let params = {
  182. "zjddm":this.zjdzdxx.zjddm,
  183. "pageNum": this.countyhc+1,
  184. "pageSize":10,
  185. }
  186. listZrz(params).then(response => {
  187. if(response.rows.length>0&&this.zrzlist.length<response.total){
  188. response.rows.map(res => {
  189. this.zrzlist.push(res)
  190. })
  191. this.countyhc++
  192. this.loading = false
  193. }else{
  194. this.loading = false
  195. this.finished = true
  196. }
  197. });
  198. }
  199. },
  200. getAttachments(id) {
  201. console.info(id);
  202. this.uploadImgList = [];
  203. let cond = {
  204. tableId: id,
  205. tableName: 't_homespace_zrz',
  206. fileType: 0,
  207. };
  208. attachmentFind(cond).then(resp => {
  209. this.uploadImgList = resp.data.map(function(item){
  210. return {id:item.id,url:'/api'+item.fileUrl,isImage: true}
  211. });
  212. });
  213. },
  214. deleteFileImageList(file){
  215. if(file.id !== undefined ){
  216. systemAttachment(file.id);
  217. }
  218. },
  219. // 图片上传前
  220. beforeReadImageList(file){
  221. let _this = this;
  222. if(file.length!=undefined){
  223. file.map(res => {
  224. let zjddm = res.file.name
  225. //zjddm=zjddm.substring(0,zjddm.lastIndexOf("\("));
  226. // 创建Canvas对象(画布)
  227. let canvas = document.createElement('canvas')
  228. // 获取对应的CanvasRenderingContext2D对象(画笔)
  229. let context = canvas.getContext('2d')
  230. // 创建新的图片对象
  231. let img = new Image()
  232. // 指定图片的DataURL(图片的base64编码数据)
  233. img.src = res.content
  234. // 监听浏览器加载图片完成,然后进行进行绘制
  235. img.onload = () => {
  236. /*const h = img.height
  237. const w = img.width*/
  238. let ch = img.height/5
  239. let cw = img.width/5
  240. let canvas = document.createElement('canvas')
  241. let ctx = canvas.getContext('2d')
  242. canvas.height = ch
  243. canvas.width = cw
  244. ctx.clearRect(0,0,cw,ch)
  245. ctx.drawImage(img,0,0,cw,ch)
  246. let base_img = canvas.toDataURL('image/jpeg')
  247. let blobBin = atob(base_img.split(',')[1])
  248. let d = []
  249. for (let i=0;i<blobBin.length;i++){
  250. d.push(blobBin.charCodeAt(i))
  251. }
  252. let data2 = new FormData();
  253. data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
  254. uploadFile(data2);
  255. }
  256. })
  257. }else{
  258. let zjddm = file.file.name
  259. //zjddm=zjddm.substring(0,zjddm.lastIndexOf("\("));
  260. // 创建Canvas对象(画布)
  261. let canvas = document.createElement('canvas')
  262. // 获取对应的CanvasRenderingContext2D对象(画笔)
  263. let context = canvas.getContext('2d')
  264. // 创建新的图片对象
  265. let img = new Image()
  266. // 指定图片的DataURL(图片的base64编码数据)
  267. img.src = file.content
  268. // 监听浏览器加载图片完成,然后进行进行绘制
  269. img.onload = () => {
  270. /*const h = img.height
  271. const w = img.width*/
  272. let ch = img.height/5
  273. let cw = img.width/5
  274. let canvas = document.createElement('canvas')
  275. let ctx = canvas.getContext('2d')
  276. canvas.height = ch
  277. canvas.width = cw
  278. ctx.clearRect(0,0,cw,ch)
  279. ctx.drawImage(img,0,0,cw,ch)
  280. let base_img = canvas.toDataURL('image/jpeg')
  281. let blobBin = atob(base_img.split(',')[1])
  282. let d = []
  283. for (let i=0;i<blobBin.length;i++){
  284. d.push(blobBin.charCodeAt(i))
  285. }
  286. let data2 = new FormData();
  287. data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
  288. uploadFile(data2);
  289. }
  290. }
  291. },
  292. qkClick(){
  293. this.uploadImgList1 = this.uploadImgList;
  294. for(let i = 0; i < this.uploadImgList1.length; i++){
  295. if(this.uploadImgList[i].id !== undefined ){
  296. systemAttachment(this.uploadImgList[i].id);
  297. }
  298. }
  299. this.uploadImgList = [];
  300. },
  301. submitUploadList(val){
  302. let f = []
  303. for (let i of this.uploadImgList){
  304. if(i.content !== undefined){
  305. f.push(i.content)
  306. }
  307. }
  308. console.info(this.uploadImgList);
  309. let _this = this;
  310. let file = {
  311. tableId:val,
  312. tableName:"t_homespace_zrz",
  313. bizPath:"upload",
  314. fileType:"0",
  315. files: f
  316. };
  317. base64Attach(file).then((resp) => {
  318. this.$toast({
  319. icon: 'success', // 找到自己需要的图标
  320. message: '上传成功',
  321. duration:"1000",
  322. onClose:function(){
  323. _this.showImageList = false
  324. }
  325. })
  326. });
  327. },
  328. goRightBack(){
  329. this.$router.push({path:'/homesteadSurvey/list'});
  330. },
  331. showPopupzrz(val){
  332. this.$router.push({name:'zrzAdd',query:val});
  333. },
  334. showPopupAddzrz(){
  335. this.$router.push({name:'zrzAdd',query:{zjddm:this.zjdzdxx.zjddm,fwjg:"02",sjly:"04"}});
  336. },
  337. shownmfwlist(val){
  338. this.$router.push({name:'nmfwList',query:val});
  339. },
  340. showUploadList(id){
  341. this.getAttachments(id);
  342. this.showImageList = true;
  343. this.zjdId = id;
  344. },
  345. deletezrz(val){
  346. const ids = val.id || this.ids;
  347. Dialog.confirm({
  348. title: '系统提示',
  349. message: '是否确认删除自然幢号数据项?',
  350. confirmButtonText: '确定',
  351. cancelButtonText: '取消'
  352. })
  353. .then(function() {
  354. return delZrz(ids);
  355. }).then(() => {
  356. this.$notify({ type: 'success' , message: "删除成功" });
  357. location.reload(true);
  358. }).catch(() => {});
  359. },
  360. }
  361. }
  362. </script>
  363. <style scoped>
  364. >>> .bannerBg{
  365. width: 100%;
  366. color:#fff;
  367. padding:10px;
  368. background: linear-gradient(134deg,#7ac943 1%, #22b7f2);
  369. }
  370. >>> .van-hairline--bottom::after {
  371. border-bottom-width: 0;
  372. }
  373. >>> .title:before
  374. {
  375. content:"";
  376. width: 6px;
  377. height: 20PX;
  378. background: #7ac943;
  379. border-radius: 3px;
  380. position:absolute;
  381. left:0;
  382. bottom:0;
  383. }
  384. >>> .delete-button {
  385. height: 100%;
  386. }
  387. >>> .van-swipe-cell__wrapper{
  388. margin-right:-3px;
  389. }
  390. >>> .label-class .van-collapse-item__title--expanded{
  391. font-weight: bold;
  392. }
  393. /deep/ .van-nav-bar__text {
  394. color: #fff;
  395. }
  396. </style>