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

667 lines
25 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="onRefreshFsss"
  61. >
  62. <van-swipe-cell v-for="(item,index) in fssslist" :key="'fsss'+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;">{{ formatDict(fssslxList, item.fssslx) }}</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.jzmj}}</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;">{{ formatDict(jzwqkList, item.jzwqk) }} </p>
  75. </div>
  76. <div style="text-align:center;overflow:auto;display: flex;justify-content: center;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. </div>
  82. </div>
  83. <template #right>
  84. <van-row style="height: 100%">
  85. <van-col style="height: 100%">
  86. <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>
  87. </van-col>
  88. <van-col style="height: 100%">
  89. <van-button v-show="permission == 'true'" square type="danger" class="delete-button" @click="deletefsss(item)"><img width="10px" src="../../assets/images/sunVillage_info/list_icon_7.png" alt="">删除</van-button>
  90. </van-col>
  91. </van-row>
  92. </template>
  93. </van-swipe-cell>
  94. </van-list>
  95. <div v-if="permission == 'true' " style=" width:95%;margin:20px auto;display: flex;justify-content: center;">
  96. <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;">
  97. <p style="font-size: 16px;" @click="showPopupAddzrz()">+ 添加附属设施信息</p>
  98. </div>
  99. </div>
  100. <div style="width:95%;margin:20px auto;text-align:center;overflow:auto;display: flex;justify-content: space-around;">
  101. <p v-if="permission == 'true' && zjdzdxx.surveyStatus != '3' && zjdzdxx.surveyStatus != '5'" style="width:32%;border: 1px solid transparent;background: #FA5353;padding: 5px 0;border-radius: 50px;">
  102. <span style="font-size: 14px;color: #fff;margin-left: 5px;" @click="ycbj()">异常标记</span>
  103. </p>
  104. <p v-if="zjdzdxx.surveyStatus == '4'" style="width:32%;border: 1px solid transparent;background: #FFA500;padding: 5px 0;border-radius: 50px;">
  105. <span style="font-size: 14px;color: #fff;margin-left: 5px;" @click="bhyyLook()">驳回原因</span>
  106. </p>
  107. <p v-if="showSh" style="width:32%;border: 1px solid transparent;background: #22B7F2;padding: 5px 0;border-radius: 50px;">
  108. <span style="font-size: 14px;color: #fff;margin-left: 5px;" @click="qmqr()">{{qzqr}}</span>
  109. </p>
  110. <p v-if = "showDcsh" style="width:32%;border: 1px solid #22B7F2;background: #ffffff;padding: 5px 0;border-radius: 50px;">
  111. <span style="font-size: 14px;color: #22B7F2;margin-left: 5px;" @click="dcsh()">调查审核</span>
  112. </p>
  113. </div>
  114. <van-popup v-model="showesign" closeable position="right" :style="{ height: '100%' }"
  115. close-icon="close">
  116. <van-row style="margin:0 10%">
  117. <p class="title" style="margin:20px 0;position:relative;padding-left:20px;font-size:0.5rem">电子签名</p>
  118. </van-row>
  119. <div class="signature-box" @mousedown="canvasTTdown" @touchstart="canvasTTdown">
  120. <vue-esign
  121. ref="esign"
  122. class="mySign"
  123. :width="500"
  124. :height="height"
  125. :isCrop="signature.isCrop"
  126. :lineWidth="signature.lineWidth"
  127. :lineColor="signature.lineColor"
  128. :bgColor.sync="signature.bgColor"
  129. v-if="zjdzdxx.surveyStatus == '4' || zjdzdxx.surveyStatus == '2' || !signature.resultImg"
  130. />
  131. </div>
  132. <img src="../../assets/images/sunVillage_info/signature_icon_10.png" id="canvasTT" v-if="zjdzdxx.surveyStatus == '4' || zjdzdxx.surveyStatus == '2' ||!signature.resultImg"
  133. style="position:absolute;top: 50%;left: 50%;transform: translate(-50%,-50%)" alt="">
  134. <img :src="signature.resultImg" alt="" width="100%" v-if="signature.resultImg && zjdzdxx.surveyStatus != '4' && zjdzdxx.surveyStatus != '2'"/>
  135. <div class="signature-footer" v-if="zjdzdxx.surveyStatus == '4' || zjdzdxx.surveyStatus == '2' || !signature.resultImg && permission == 'true'">
  136. <van-button type="primary" round size="small" @click="handleReset">清空画板</van-button>
  137. <van-button type="primary" round size="small" @click="handleGenerate">保存提交</van-button>
  138. </div>
  139. </van-popup>
  140. <van-dialog v-model="ycbzShow" title="异常标记" show-cancel-button confirmButtonText="保存" cancelButtonText="关闭" confirmButtonColor="#323233" :before-close="onBeforeClose" >
  141. <van-form ref="ycbzForm">
  142. <van-row>
  143. <van-col span="24">
  144. <van-field v-model="zjdzdxx.surveyBz" label="异常备注" placeholder="异常备注" input-align="right" :rules="[{ required: true }]" required />
  145. </van-col>
  146. <van-col span="12">
  147. <p style="margin-left: 10%;color: #646566; font-size: 0.373333rem;">备注图片</p>
  148. </van-col>
  149. <van-col span="12">
  150. <MultiImageUploadComp :value="zjdzdxx.surveyBztp" :uploadDisabled="false" @fileUpdate="fileUpdate"/>
  151. </van-col>
  152. </van-row>
  153. </van-form>
  154. </van-dialog>
  155. <van-dialog v-model="dcshShow" title="调查审核" show-cancel-button confirmButtonText="保存" cancelButtonText="关闭" confirmButtonColor="#323233" :before-close="onBeforeCloseSh" >
  156. <van-form ref="dcshForm">
  157. <van-row>
  158. <van-col span="24">
  159. <van-field v-model="zjddcsh.auditRemark" label="备注" placeholder="审核备注" input-align="right" />
  160. </van-col>
  161. <van-col span="8">
  162. <p style="margin-left: 10%;color: #646566; font-size: 0.373333rem;">审核</p>
  163. </van-col>
  164. <van-col span="16">
  165. <van-radio-group v-model="zjddcsh.surveyStatus" direction="horizontal">
  166. <van-radio name="5">通过</van-radio>
  167. <van-radio name="4">驳回</van-radio>
  168. </van-radio-group>
  169. </van-col>
  170. </van-row>
  171. </van-form>
  172. </van-dialog>
  173. <van-popup v-model:show="showImageList" position="bottom" style="height:40vh;padding:50px 10px 0" closeable
  174. close-icon="close">
  175. <p style="color:#000;position:absolute;top:0.426667rem;left:0.426667rem">图片上传</p>
  176. <div style="width:100%;height:calc( 40vh - 100px);overflow-y: scroll;">
  177. <van-uploader accept="image/*" v-model="uploadImgList" :after-read="beforeReadImageList" @delete="deleteFileImageList" multiple :max-count="50" />
  178. </div>
  179. <van-row justify="space-around" style=" position:fixed;bottom:0;left:0;width:100%;height:50px;text-align: center;">
  180. <van-col span="12"><van-button type="primary" style="width:100px;" round @click="qkClick">清空</van-button></van-col>
  181. <van-col span="12"><van-button type="primary" style="width:100px;" round @click="submitUploadList(zjdId)">上传</van-button></van-col>
  182. </van-row>
  183. </van-popup>
  184. </div>
  185. </template>
  186. <script>
  187. import {attach} from "@/api/onlineHome/homestead/application";
  188. import {getZjdzd,updateZjdzd,zjddcSign} from "@/api/homesteadSurvey/zjdzd";
  189. import MapGisDrawing from "@/components/Map/MapGisDrawing";
  190. import {listFsss,addFsss,updateFsss,delFsss,getFsssZjdDmList,updateFsssStatus} from "@/api/homesteadSurvey/fsss";
  191. import MultiImageUploadComp from "@/components/house/MultiImageUploadComp"
  192. import {uploadFile} from "@/api/homesteadSurvey/zjdzd";
  193. import {attachmentFind} from "@/api/sunVillage_info/homestead/application";
  194. import {systemAttachment} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  195. import {base64Attach} from "@/api/user";
  196. import {Dialog} from "vant";
  197. import $ from "jquery";
  198. export default {
  199. name: "homesteadAdd",
  200. components: { MapGisDrawing,MultiImageUploadComp},
  201. data() {
  202. return {
  203. active:4,
  204. dcshShow:false,
  205. showesign:false,
  206. showDcsh:false,
  207. qzqr:"签名确认",
  208. showSh:false,
  209. loading:false,
  210. finished:false,
  211. countyhc:1,
  212. ycbzShow:false,
  213. permission:false,
  214. showImageList:false,
  215. zjdId:null,
  216. uploadImgList:[],
  217. uploadImgList1:[],
  218. bztp:"",
  219. ycbz:"",
  220. jzwqkList:[],
  221. fssslxList:[],
  222. zjdzdxx:{surveyStatus:"5"},
  223. zjddcsh:{surveyStatus:"5",auditRemark:""},
  224. fssslist:[],
  225. //电子签名
  226. signature: {
  227. lineWidth: 6, // 画笔的线条粗细
  228. lineColor: "#000000", // 画笔的颜色
  229. bgColor: "", // 画布的背景颜色
  230. resultImg: "", // 最终画布生成的base64图片
  231. isCrop: false, // 是否裁剪,在画布设定尺寸基础上裁掉四周空白部分
  232. },
  233. };
  234. },
  235. created(){
  236. this.houseGetDicts("jzwqk").then((response) => {
  237. this.jzwqkList = response.data;
  238. });
  239. this.houseGetDicts("fsss_type").then((response) => {
  240. this.fssslxList = response.data;
  241. });
  242. this.zjdzdxx = JSON.parse(localStorage.getItem("zjdzdxxItem"));
  243. this.permission = localStorage.getItem("executePermission");
  244. let businessLevel = this.$store.state.user.businessLevel;
  245. if(this.zjdzdxx.surveySign != null){
  246. this.signature.resultImg = this.$store.getters.baseRoutingUrl+this.zjdzdxx.surveySign;
  247. }
  248. if(this.zjdzdxx.id !== undefined){
  249. getZjdzd(this.zjdzdxx.id).then((response) => {
  250. if(response.data.surveyStatus === "3" && businessLevel === "2"){
  251. this.showDcsh = true;
  252. }
  253. if(response.data.surveyStatus === '5' || response.data.surveyStatus === '3'){
  254. this.qzqr = "签名图片";
  255. }else{
  256. this.qzqr = "签名确认";
  257. }
  258. this.showSh = true;
  259. });
  260. this.getList();
  261. }
  262. this.height = window.screen.height * 1.28 - 20;
  263. },
  264. mounted(){
  265. },
  266. methods: {
  267. getList(){
  268. let params = {
  269. zjddm:this.zjdzdxx.zjddm,
  270. pageNum: this.countyhc+1,
  271. pageSize:10,
  272. }
  273. listFsss(params).then(response => {
  274. this.fssslist = response.rows;
  275. if(response.rows.length>0&&response.rows.length<response.total){
  276. this.countyhc++
  277. this.loading = false
  278. }else{
  279. this.loading = false
  280. this.finished = true
  281. }
  282. });
  283. },
  284. fileUpdate(val){
  285. this.$set(this.zjdzdxx, 'surveyBztp',val.path);
  286. },
  287. canvasTTdown() {
  288. $('#canvasTT').css('display', 'none');
  289. },
  290. bhyyLook(){
  291. if(this.zjdzdxx.auditRemark !== null && this.zjdzdxx.auditRemark !== ''){
  292. Dialog({ type: 'success', message: this.zjdzdxx.auditRemark });
  293. }else{
  294. Dialog({ type: 'success', message: "无"});
  295. }
  296. },
  297. onBeforeCloseSh(action, done){
  298. if (action === 'confirm') {
  299. if(this.zjddcsh.surveyStatus === '4') {
  300. let surveyItem = JSON.parse(localStorage.getItem("surveyItem"));
  301. this.$set(this.zjddcsh, 'surveyId', surveyItem.id);
  302. }
  303. this.$set(this.zjddcsh, 'id', this.zjdzdxx.id);
  304. updateZjdzd(this.zjddcsh).then(response => {
  305. if(response.code === 200){
  306. let _this =this
  307. _this.$toast({
  308. icon: 'success', // 找到自己需要的图标
  309. message: '保存成功',
  310. duration:"1000",
  311. onClose:function(){
  312. _this.dcshShow = false;
  313. _this.goRightBack();
  314. }
  315. })
  316. }
  317. });
  318. } else {
  319. return done();
  320. }
  321. },
  322. onRefreshFsss(){
  323. if(this.loading){
  324. let params = {
  325. zjddm:this.zjdzdxx.zjddm,
  326. pageNum: this.countyhc+1,
  327. pageSize:10,
  328. }
  329. listFsss(params).then(response => {
  330. if(response.rows.length>0&&response.rows.length<response.total){
  331. response.rows.map(res => {
  332. this.fssslist.push(res)
  333. })
  334. this.countyhc++
  335. this.loading = false
  336. }else{
  337. this.loading = false
  338. this.finished = true
  339. }
  340. });
  341. }
  342. },
  343. goRightBack(){
  344. this.$router.push({path:'/homesteadSurvey/list'});
  345. },
  346. // 清空画板
  347. handleReset() {
  348. this.resultImg = null
  349. if(this.$refs.esign){
  350. this.$refs.esign.reset();
  351. }
  352. $('#canvasTT').css('display', 'block')
  353. },
  354. // 生成签字图
  355. handleGenerate() {
  356. console.info( this.$refs.esign
  357. .generate() );
  358. this.$refs.esign
  359. .generate() // 使用生成器调用把签字的图片转换成为base64图片格式
  360. .then((res) => {
  361. this.signature.resultImg = res;
  362. let wj = this.dataURLtoBlob(res);
  363. let surveyItem = JSON.parse(localStorage.getItem("surveyItem"));
  364. let param = new FormData() // 创建form对象
  365. param.append('file', wj) // 通过append向form对象添加数据
  366. param.append('id', surveyItem.id)
  367. param.append('date', this.format(new Date(), 'yyyy-MM-dd')) // 通过append向form对象添加数据
  368. zjddcSign(param, this.zjdzdxx.zjddm,surveyItem.id).then(response => {
  369. this.$notify({type: 'success', message: '签字成功'});
  370. getZjdzd(this.zjdzdxx.id).then((response) => {
  371. localStorage.setItem("zjdzdxxItem",JSON.stringify(response.data))
  372. location.reload();
  373. });
  374. });
  375. })
  376. .catch((err) => {
  377. // 画布没有签字时会执行这里提示一下
  378. this.$toast.fail('请签名后再保存签字');
  379. });
  380. },
  381. formatDict(dict, value) {
  382. return this.selectDictLabel(dict, value);
  383. },
  384. dataURLtoBlob (dataurl, filename = 'file') {
  385. let arr = dataurl.split(',')
  386. let mime = arr[0].match(/:(.*?);/)[1]
  387. let suffix = mime.split('/')[1]
  388. let bstr = atob(arr[1])
  389. let n = bstr.length
  390. let u8arr = new Uint8Array(n)
  391. while (n--) {
  392. u8arr[n] = bstr.charCodeAt(n)
  393. }
  394. return new File([u8arr], `${filename}.${suffix}`, {
  395. type: mime
  396. })
  397. },
  398. goBack(){
  399. if(this.ztMap && this.enterMap ==1){
  400. if(this.form.id == null){
  401. this.backMap.backMapZjdAData.theGeom= "";
  402. }else{
  403. this.backMap.backMapZjdAData = this.form;
  404. }
  405. this.$cookies.set("search",this.backMap);
  406. } else {
  407. this.$cookies.set("search","");
  408. }
  409. this.$router.push({name: this.$router.back(-1)});
  410. // }
  411. },
  412. showPopupzrz(item){ this.$router.push({name:'fsssAdd',query:item});},
  413. showPopupAddzrz(){
  414. this.$router.push({name:'fsssAdd',query:{zjddm:this.zjdzdxx.zjddm}});
  415. },
  416. deletefsss(val){
  417. const ids = val.id || this.ids;
  418. Dialog.confirm({
  419. title: '系统提示',
  420. message: '是否确认删除附属物的数据项?',
  421. confirmButtonText: '确定',
  422. cancelButtonText: '取消'
  423. })
  424. .then(function() {
  425. return delFsss(ids);
  426. }).then(() => {
  427. this.$notify({ type: 'success' , message: "删除成功" });
  428. location.reload(true);
  429. }).catch(() => {});
  430. },
  431. qmqr(){
  432. if(this.zjdzdxx.surveySign != null){
  433. this.signature.resultImg = this.$store.getters.baseRoutingUrl+this.zjdzdxx.surveySign;
  434. }
  435. this.showesign = true;
  436. },
  437. ycbj(){
  438. this.ycbzShow = true;
  439. },
  440. // van-dialog 点击confirm事件不自动关闭
  441. onBeforeClose(action, done) {
  442. if (action === 'confirm') {
  443. this.$refs.ycbzForm.validate().then(() => {
  444. this.$set(this.zjdzdxx, 'surveyStatus', "2");
  445. updateZjdzd(this.zjdzdxx).then(response => {
  446. localStorage.setItem("zjdzdxxItem",JSON.stringify(this.zjdzdxx));
  447. let _this =this
  448. this.$toast({
  449. icon: 'success', // 找到自己需要的图标
  450. message: '保存成功',
  451. duration:"1000",
  452. onClose:function(){
  453. _this.getList();
  454. }
  455. })
  456. return done(true);
  457. });
  458. }).catch(() => {
  459. return done(false);
  460. });
  461. } else {
  462. return done();
  463. }
  464. },
  465. dcsh(){
  466. this.$set(this.zjdzdxx, 'surveyStatus', "5");
  467. this.dcshShow = true;
  468. },
  469. showUploadList(id){
  470. this.getAttachments(id);
  471. this.showImageList = true;
  472. this.zjdId = id;
  473. },
  474. getAttachments(id) {
  475. this.uploadImgList = [];
  476. let cond = {
  477. tableId: id,
  478. tableName: 't_homestead_fsss',
  479. fileType: 0,
  480. };
  481. attachmentFind(cond).then(resp => {
  482. this.uploadImgList = resp.data.map(function(item){
  483. return {id:item.id,url:'/api'+item.fileUrl,isImage: true}
  484. });
  485. });
  486. },
  487. deleteFileImageList(file){
  488. if(file.id !== undefined ){
  489. systemAttachment(file.id);
  490. }
  491. },
  492. // 图片上传前
  493. beforeReadImageList(file){
  494. let _this = this;
  495. if(file.length!=undefined){
  496. file.map(res => {
  497. let zjddm = res.file.name
  498. //zjddm=zjddm.substring(0,zjddm.lastIndexOf("\("));
  499. // 创建Canvas对象(画布)
  500. let canvas = document.createElement('canvas')
  501. // 获取对应的CanvasRenderingContext2D对象(画笔)
  502. let context = canvas.getContext('2d')
  503. // 创建新的图片对象
  504. let img = new Image()
  505. // 指定图片的DataURL(图片的base64编码数据)
  506. img.src = res.content
  507. // 监听浏览器加载图片完成,然后进行进行绘制
  508. img.onload = () => {
  509. /*const h = img.height
  510. const w = img.width*/
  511. let ch = img.height/5
  512. let cw = img.width/5
  513. let canvas = document.createElement('canvas')
  514. let ctx = canvas.getContext('2d')
  515. canvas.height = ch
  516. canvas.width = cw
  517. ctx.clearRect(0,0,cw,ch)
  518. ctx.drawImage(img,0,0,cw,ch)
  519. let base_img = canvas.toDataURL('image/jpeg')
  520. let blobBin = atob(base_img.split(',')[1])
  521. let d = []
  522. for (let i=0;i<blobBin.length;i++){
  523. d.push(blobBin.charCodeAt(i))
  524. }
  525. let data2 = new FormData();
  526. data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
  527. uploadFile(data2);
  528. }
  529. })
  530. }else{
  531. let zjddm = file.file.name
  532. //zjddm=zjddm.substring(0,zjddm.lastIndexOf("\("));
  533. // 创建Canvas对象(画布)
  534. let canvas = document.createElement('canvas')
  535. // 获取对应的CanvasRenderingContext2D对象(画笔)
  536. let context = canvas.getContext('2d')
  537. // 创建新的图片对象
  538. let img = new Image()
  539. // 指定图片的DataURL(图片的base64编码数据)
  540. img.src = file.content
  541. // 监听浏览器加载图片完成,然后进行进行绘制
  542. img.onload = () => {
  543. /*const h = img.height
  544. const w = img.width*/
  545. let ch = img.height/5
  546. let cw = img.width/5
  547. let canvas = document.createElement('canvas')
  548. let ctx = canvas.getContext('2d')
  549. canvas.height = ch
  550. canvas.width = cw
  551. ctx.clearRect(0,0,cw,ch)
  552. ctx.drawImage(img,0,0,cw,ch)
  553. let base_img = canvas.toDataURL('image/jpeg')
  554. let blobBin = atob(base_img.split(',')[1])
  555. let d = []
  556. for (let i=0;i<blobBin.length;i++){
  557. d.push(blobBin.charCodeAt(i))
  558. }
  559. let data2 = new FormData();
  560. data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
  561. uploadFile(data2);
  562. }
  563. }
  564. },
  565. qkClick(){
  566. this.uploadImgList1 = this.uploadImgList;
  567. for(let i = 0; i < this.uploadImgList1.length; i++){
  568. if(this.uploadImgList[i].id !== undefined ){
  569. systemAttachment(this.uploadImgList[i].id);
  570. }
  571. }
  572. this.uploadImgList = [];
  573. },
  574. submitUploadList(val){
  575. let f = []
  576. for (let i of this.uploadImgList){
  577. if(i.content !== undefined){
  578. f.push(i.content)
  579. }
  580. }
  581. if(f.length === 0){
  582. return this.$toast.fail("请上传照片");
  583. }
  584. this.$toast.loading({
  585. message: "数据处理中",
  586. forbidClick: true,
  587. duration: 10000000000,
  588. });
  589. let _this = this;
  590. let file = {
  591. tableId:val,
  592. tableName:"t_homestead_fsss",
  593. bizPath:"upload",
  594. fileType:"0",
  595. files: f
  596. };
  597. base64Attach(file).then((resp) => {
  598. this.$toast({
  599. icon: 'success', // 找到自己需要的图标
  600. message: '上传成功',
  601. duration:"1000",
  602. onClose:function(){
  603. _this.showImageList = false
  604. }
  605. })
  606. });
  607. },
  608. }
  609. }
  610. </script>
  611. <style scoped>
  612. >>> .bannerBg{
  613. width: 100%;
  614. color:#fff;
  615. padding:10px;
  616. background: linear-gradient(134deg,#7ac943 1%, #22b7f2);
  617. }
  618. >>> .van-hairline--bottom::after {
  619. border-bottom-width: 0;
  620. }
  621. >>> .title:before
  622. {
  623. content:"";
  624. width: 6px;
  625. height: 20PX;
  626. background: #7ac943;
  627. border-radius: 3px;
  628. position:absolute;
  629. left:0;
  630. bottom:0;
  631. }
  632. >>> .delete-button {
  633. height: 100%;
  634. }
  635. >>> .van-swipe-cell__wrapper{
  636. margin-right:-3px;
  637. }
  638. >>> .label-class .van-collapse-item__title--expanded{
  639. font-weight: bold;
  640. }
  641. /deep/ .van-nav-bar__text {
  642. color: #fff;
  643. }
  644. .signature-footer {
  645. transform: rotate(90deg);
  646. width: auto;
  647. position: absolute;
  648. top: 50%;
  649. left: 0px;
  650. }
  651. .clearBtn {
  652. margin-left: 15px;
  653. }
  654. </style>