移动端
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

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