移动端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

list_cbht.vue 17 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <div class="home_wrapper">
  3. <div
  4. class="header_main"
  5. :style="`background-image:url(${require(showBtn?'@/assets/images/sunVillage_info/list_head.png':'@/assets/images/sunVillage_info/list_head_red.png')})`"
  6. >
  7. 承包合同
  8. <div class="return_btn" @click="onClickLeft"></div>
  9. <!-- <div class="add_btn" @click="goAdd" v-show="showBtn"></div>-->
  10. </div>
  11. <div class="list_main">
  12. <van-list
  13. v-model="loading"
  14. :finished="finished"
  15. finished-text="没有更多了"
  16. @load="getList"
  17. >
  18. <van-swipe-cell v-for="item in applicationList" :key="item.id">
  19. <div class="item" @click="goDetail(item.id)">
  20. <div class="info">
  21. <div class="title">
  22. <i class="icon_box" v-if="item.firstSigning == null"></i>
  23. <i class="icon_box1" v-if="item.firstSigning != null"></i>
  24. <p class="news_title" :style="{'color': item.firstSigning != null ? '#2bc30c' : '#eb1616'}">{{item.cbhtbm}}</p>
  25. <p class="tips_mark"
  26. :style="{'color': item.firstSigning != null ? '#79bc29' : '#f8a83d','background': item.firstSigning != null ? '#e8ffcd' : '#ffedcd'}">
  27. {{item.signingMode}}</p>
  28. <p class="tips_mark2" v-if="item.signingMode === '线上'" :style="{'background': item.firstSigning != null ? '#2bc30c' : '#eb1616'}">{{item.signingStatus}}</p>
  29. </div>
  30. <div class="time">
  31. <p style="color:#eb1616;">{{item.cbfmc}}</p>
  32. <!-- <p>{{item.cbhtmc}}</p>-->
  33. <p style="color:#eb1616;font-weight: bold;">{{item.htzmjm.toFixed(2)}} 亩</p>
  34. </div>
  35. </div>
  36. </div>
  37. <template #right>
  38. <div class="operation">
  39. <div class="opera_btn" v-if="item.signingMode == '线上' && item.firstIsSign =='否'"
  40. @click="openPopup(item.id)">
  41. <img src="../../assets/images/sunVillage_info/signature_icon_02.png" alt="" width="35">
  42. <p>签名</p>
  43. </div>
  44. <!-- <div class="opera_btn" v-if="item.signingMode == '线上' && item.attachement != null " @click="$router.push({path:'/sunVillage_info/list_signature_pdf',query: {id:item.id,type:$route.query.type}})">
  45. <img src="../../assets/images/sunVillage_info/signature_icon_03.png" alt="" width="35">
  46. <p>预览</p>
  47. </div> -->
  48. <div class="opera_btn">
  49. <img src="../../assets/images/sunVillage_info/signature_icon_03.png" alt="" width="35">
  50. <p>预览</p>
  51. </div>
  52. <div class="opera_btn" @click="openPopupFile(item.id)">
  53. <img src="../../assets/images/sunVillage_info/signature_icon_04.png" alt="" width="35">
  54. <p>附件</p>
  55. </div>
  56. </div>
  57. </template>
  58. </van-swipe-cell>
  59. </van-list>
  60. </div>
  61. <!-- 签字弹出层 -->
  62. <van-popup v-model="show" closeable position="right" :style="{ height: '100%' }">
  63. <van-cell-group style="width: 100%;height:100%;overflow: hidden;padding-top: 10px;padding-bottom: 10px;">
  64. <div class="signature-box" @mousedown="canvasTTdown" @touchstart="canvasTTdown">
  65. <vue-esign
  66. ref="esign"
  67. class="mySign"
  68. :width="500"
  69. :height="height"
  70. :isCrop="signature.isCrop"
  71. :lineWidth="signature.lineWidth"
  72. :lineColor="signature.lineColor"
  73. :bgColor.sync="signature.bgColor"
  74. />
  75. </div>
  76. <img src="../../assets/images/sunVillage_info/signature_icon_10.png" id="canvasTT"
  77. style="position:absolute;top: 50%;left: 50%;transform: translate(-50%,-50%)" alt="">
  78. <div class="signature-footer">
  79. <van-button @click="handleGenerate" type="info" size="small">保存签字</van-button>
  80. <van-button @click="handleReset" class="clearBtn" type="info" plain size="small">清空画板</van-button>
  81. </div>
  82. </van-cell-group>
  83. </van-popup>
  84. <!-- 附件弹出层 -->
  85. <van-popup v-model="showFile" round closeable position="bottom" :style="{ height: '30%' }" >
  86. <div style="padding: 0 3%;">
  87. <van-divider>附件</van-divider>
  88. <van-uploader v-model="fileList" accept="" :after-read="afterRead" @delete="deleteFile" /> <!-- accept=".jpg, .gif, .png, .jpeg, .txt, .pdf, .doc, .docx, .xls, .xlsx" -->
  89. </div>
  90. </van-popup>
  91. </div>
  92. </template>
  93. <script>
  94. import { listCbht, cbhtFirstSign, attachmentList, commonAttach, systemAttachment } from "@/api/sunVillage_info/fixedAssets";
  95. import vueEsign from "vue-esign";
  96. import $ from "jquery";
  97. export default {
  98. name: "sunVillageInfoListCbht",
  99. components: { vueEsign },
  100. data() {
  101. return {
  102. applicationList: [],
  103. loading: false,
  104. finished: false,
  105. show: false,
  106. showFile: false,
  107. fileList: [],
  108. listLength: '0',
  109. queryParams: {
  110. pageNum: 1,
  111. pageSize: 10,
  112. translate_dict: 1,
  113. },
  114. showBtn: true,
  115. signatureImg: '',
  116. //电子签名
  117. signature: {
  118. lineWidth: 6, // 画笔的线条粗细
  119. lineColor: "#000000", // 画笔的颜色
  120. bgColor: "", // 画布的背景颜色
  121. resultImg: "", // 最终画布生成的base64图片
  122. isCrop: false, // 是否裁剪,在画布设定尺寸基础上裁掉四周空白部分
  123. },
  124. signaId: '',
  125. height: null
  126. };
  127. },
  128. created() {
  129. if (this.$route.query.type == 'code') {
  130. this.showBtn = false;
  131. }
  132. this.height = window.screen.height * 1.28 - 20;
  133. },
  134. methods: {
  135. canvasTTdown() {
  136. $('#canvasTT').css('display', 'none');
  137. },
  138. getList() {
  139. listCbht(this.queryParams).then(response => {
  140. response.rows.forEach(item => {
  141. this.applicationList.push(item);
  142. });
  143. if (this.applicationList.length >= response.total) {
  144. this.finished = true;
  145. return;
  146. } else {
  147. this.loading = false;
  148. this.queryParams.pageNum += 1;
  149. }
  150. });
  151. },
  152. goDetail(id) {
  153. this.$router.push({
  154. path: '/sunVillage_info/list_cbht_detail',
  155. query: { id: id }
  156. })
  157. },
  158. openPopup(id, url) {
  159. this.show = true;
  160. this.signaId = id;
  161. },
  162. openPopupFile(id){
  163. this.fileList = [];
  164. this.signaId = id;
  165. this.showFile = true;
  166. let queryParams = {
  167. tableId: id,
  168. tableName: 't_sys_cbht',
  169. };
  170. attachmentList(queryParams).then(response => {
  171. response.rows.map(res => {
  172. // let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  173. this.fileList.push({
  174. url: '/api'+res.fileUrl,
  175. file: new File([], res.fileName,{}),
  176. id: res.id
  177. });
  178. })
  179. });
  180. },
  181. afterRead(file) {
  182. // 此时可以自行将文件上传至服务器
  183. let params = new FormData();
  184. params.append("tableId", this.signaId);
  185. params.append("tableName", "t_sys_cbht");
  186. params.append("bizPath", "service");
  187. params.append("fileType", '0');
  188. params.append("file", file.file);
  189. commonAttach(params).then(response => {
  190. this.$notify({ type: 'success', message: '上传成功' });
  191. let newFile = this.fileList[this.fileList.length - 1];
  192. this.$set(newFile, 'id', response.id);
  193. });
  194. },
  195. deleteFile(file){
  196. systemAttachment(file.id).then(res => {
  197. this.$notify({ type: 'success', message: '删除成功' });
  198. });
  199. },
  200. signaImgFun(url) {
  201. this.signatureImg = url;
  202. },
  203. // 清空画板
  204. handleReset() {
  205. this.$refs.esign.reset();
  206. $('#canvasTT').css('display', 'block')
  207. },
  208. // 生成签字图
  209. handleGenerate() {
  210. this.$refs.esign
  211. .generate() // 使用生成器调用把签字的图片转换成为base64图片格式
  212. .then((res) => {
  213. this.signature.resultImg = res;
  214. let wj = this.dataURLtoBlob(res);
  215. let param = new FormData(); // 创建form对象
  216. param.append('file', wj); // 通过append向form对象添加数据
  217. param.append('date', this.format(new Date(), 'yyyy-MM-dd')); // 通过append向form对象添加数据
  218. cbhtFirstSign(param, this.signaId).then(response => {
  219. this.$notify({type: 'success', message: '签字成功'});
  220. this.show = false;
  221. location.reload();
  222. });
  223. })
  224. .catch((err) => {
  225. // 画布没有签字时会执行这里提示一下
  226. this.$toast.fail('请签名后再保存签字');
  227. });
  228. },
  229. dataURLtoBlob(dataurl, filename = 'file') {
  230. let arr = dataurl.split(',')
  231. let mime = arr[0].match(/:(.*?);/)[1]
  232. let suffix = mime.split('/')[1]
  233. let bstr = atob(arr[1])
  234. let n = bstr.length
  235. let u8arr = new Uint8Array(n)
  236. while (n--) {
  237. u8arr[n] = bstr.charCodeAt(n)
  238. }
  239. return new File([u8arr], `${filename}.${suffix}`, {
  240. type: mime
  241. })
  242. },
  243. },
  244. }
  245. </script>
  246. <style scoped lang="scss">
  247. .home_wrapper {
  248. background: #e9e9e9;
  249. min-height: 100vh;
  250. width: 100vw;
  251. .header_main {
  252. height: 116px;
  253. background: url('../../assets/images/sunVillage_info/list_head.png') no-repeat;
  254. background-size: 100% 100%;
  255. position: fixed;
  256. top: 0;
  257. left: 0;
  258. width: 100%;
  259. font-size: 36px;
  260. line-height: 116px;
  261. text-align: center;
  262. color: #fff;
  263. position: relative;
  264. .return_btn {
  265. width: 24px;
  266. height: 43.2px;
  267. background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  268. background-size: 20px 36px;
  269. position: absolute;
  270. left: 38px;
  271. top: 36px;
  272. }
  273. .add_btn {
  274. width: 56.4px;
  275. height: 40.8px;
  276. background: url('../../assets/images/sunVillage_info/list_icon_9.png') center center no-repeat;
  277. background-size: 47px 34px;
  278. position: absolute;
  279. right: 38px;
  280. top: 36px;
  281. }
  282. }
  283. .record_main {
  284. padding: 30px 22px;
  285. .record_det {
  286. height: 38px;
  287. line-height: 38px;
  288. display: flex;
  289. justify-content: space-between;
  290. .year_l {
  291. font-size: 30px;
  292. display: flex;
  293. align-items: center;
  294. color: #858585;
  295. .unit {
  296. padding-left: 5px;
  297. }
  298. .icon {
  299. width: 23px;
  300. height: 12px;
  301. display: block;
  302. background: url('../../assets/images/sunVillage_info/list_icon_1.png') no-repeat;
  303. background-size: 100% 100%;
  304. margin-bottom: 4px;
  305. margin-right: 8px;
  306. &.zk {
  307. transform: rotate(0deg)
  308. }
  309. &.ss {
  310. transform: rotate(180deg)
  311. }
  312. }
  313. }
  314. .total_r {
  315. font-size: 26px;
  316. letter-spacing: 2px;
  317. }
  318. }
  319. .record_list {
  320. display: flex;
  321. flex-flow: wrap;
  322. margin-top: 12PX;
  323. .flex_block {
  324. font-size: 30px;
  325. color: #878787;
  326. padding-right: 30px;
  327. &.current {
  328. color: #4199fe;
  329. font-weight: bold;
  330. }
  331. }
  332. }
  333. }
  334. .list_main {
  335. padding: 0 22px;
  336. margin-top: 15PX;
  337. .item {
  338. border-radius: 30px;
  339. background: #fff;
  340. box-shadow: 4px 6px 5px rgba(63, 68, 75, 0.1);
  341. padding: 25px 32px;
  342. margin-bottom: 20px;
  343. .info {
  344. .title {
  345. display: flex;
  346. font-size: 32px;
  347. align-items: center;
  348. height: 58px;
  349. .icon_box {
  350. width: 34px;
  351. display: block;
  352. height: 30px;
  353. background: url('../../assets/images/sunVillage_info/signature_icon_01.png') no-repeat;
  354. background-size: 100% 100%;
  355. margin-right: 10px;
  356. flex-shrink: 0;
  357. }
  358. .icon_box1 {
  359. width: 34px;
  360. display: block;
  361. height: 30px;
  362. background: url('../../assets/images/sunVillage_info/signature_icon_01g.png') no-repeat;
  363. background-size: 100% 100%;
  364. margin-right: 10px;
  365. flex-shrink: 0;
  366. }
  367. .news_title {
  368. display: -webkit-box;
  369. -webkit-box-orient: vertical;
  370. -webkit-line-clamp: 1;
  371. word-break: break-all;
  372. overflow: hidden;
  373. }
  374. .tips_mark {
  375. background: #ffedcd;
  376. border-radius: 8px;
  377. font-size: 24px;
  378. color: #f8a83d;
  379. text-align: center;
  380. line-height: 34px;
  381. flex-shrink: 0;
  382. padding: 0 5Px;
  383. margin-left: auto;
  384. }
  385. .tips_mark2 {
  386. background: #eb1616;
  387. border-radius: 8px;
  388. font-size: 24px;
  389. color: #ffffff;
  390. text-align: center;
  391. line-height: 34px;
  392. flex-shrink: 0;
  393. padding: 0 5Px;
  394. margin-left: 10PX;
  395. }
  396. }
  397. .time {
  398. font-size: 16PX;
  399. color: #333333;
  400. display: flex;
  401. align-items: center;
  402. margin-top: 5PX;
  403. justify-content: space-between;
  404. .icon_time {
  405. width: 25px;
  406. height: 25px;
  407. background: url('../../assets/images/sunVillage_info/list_icon_4.png') no-repeat;
  408. background-size: 100% 100%;
  409. margin-right: 10px;
  410. }
  411. }
  412. }
  413. }
  414. .operation {
  415. display: flex;
  416. align-items: center;
  417. justify-content: right;
  418. text-align: center;
  419. border-radius: 30px;
  420. background: #fff;
  421. box-shadow: 4px 6px 5px rgba(63, 68, 75, 0.1);
  422. height: 100%;
  423. padding: 0 15Px;
  424. margin-left: 10PX;
  425. .opera_btn {
  426. border-radius: 50%;
  427. padding: 0 10px;
  428. &.delete {
  429. background: #df0707;
  430. margin-left: 10PX;
  431. .icon {
  432. width: 22PX;
  433. height: 29PX;
  434. background: url('../../assets/images/sunVillage_info/signature_icon_03.png') no-repeat;
  435. background-size: 100% 100%;
  436. display: block;
  437. }
  438. }
  439. &.edit {
  440. background: #79cf13;
  441. margin-left: 10PX;
  442. .icon {
  443. width: 26PX;
  444. height: 25PX;
  445. background: url('../../assets/images/sunVillage_info/signature_icon_02.png') no-repeat;
  446. background-size: 100% 100%;
  447. display: block;
  448. }
  449. }
  450. &.view {
  451. background: #3494ff;
  452. margin-left: 10PX;
  453. .icon {
  454. width: 29PX;
  455. height: 21PX;
  456. background: url('../../assets/images/sunVillage_info/signature_icon_04.png') no-repeat;
  457. background-size: 100% 100%;
  458. display: block;
  459. }
  460. }
  461. &.list {
  462. background: #79cf13;
  463. margin-left: 10PX;
  464. .icon {
  465. width: 29px;
  466. height: 21px;
  467. background: url('../../assets/images/sunVillage_info/list_icon_10.png') no-repeat;
  468. background-size: 100% 100%;
  469. display: block;
  470. }
  471. }
  472. }
  473. }
  474. }
  475. .bottom_tips {
  476. font-size: 24px;
  477. color: #a7a6a6;
  478. text-align: center;
  479. margin-top: 32px;
  480. background: url('../../assets/images/sunVillage_info/list_icon_8.png') center center no-repeat;
  481. background-size: 260px 2px;
  482. .xs {
  483. padding: 0 8px;
  484. background: #e9e9e9;
  485. }
  486. }
  487. .signature-box {
  488. border: 1px dashed #666;
  489. margin: 2px 20px;
  490. height: 100%;
  491. /*canvas{*/
  492. /* height: 100%!important;*/
  493. /*}*/
  494. }
  495. .signature-footer {
  496. transform: rotate(90deg);
  497. width: auto;
  498. position: absolute;
  499. top: 50%;
  500. left: 0PX;
  501. .clearBtn {
  502. margin-left: 15px;
  503. }
  504. }
  505. .esigh-result {
  506. margin: 15px 20px;
  507. // height: 110px;
  508. border: 1px solid #666;
  509. font-size: 0;
  510. .imgs {
  511. width: 100%;
  512. }
  513. }
  514. }
  515. </style>