移动端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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