f1d0443b by renchao@pashanhoo.com

电子签名

1 parent d4edf572
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-09-15 09:32:40 4 * @LastEditTime: 2024-05-16 09:23:43
5 */ 5 */
6 import request from '@/utils/request' 6 import request from '@/utils/request'
7 import { log } from 'bpmn-js-token-simulation'
8 let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl')) 7 let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl'))
9 /** 8 /**
10 * @description: 添加补录记录 9 * @description: 添加补录记录
......
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-05-16 13:36:44 4 * @LastEditTime: 2024-05-16 09:23:47
5 */ 5 */
6 6 import request from '@/utils/request'
7 let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl')) 7 let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl'))
8 export function uploadUrl () {
9 return process.env.VUE_APP_BASE_API + SERVER.SERVERAPI + '/system/dzqm/upload'
10 }
11
12
13 /** 8 /**
14 * @description: 上传电子签名 9 * @description: 上传电子签名
15 * @param {*} data 10 * @param {*} data
16 * @author: renchao 11 * @author: renchao
17 */ 12 */
18 export function uploaddzqm (data) { 13 export function dzqmUpload (data) {
19 return request({ 14 return request({
20 url: SERVER.SERVERAPI + '/rest/system/dzqm', 15 url: SERVER.SERVERAPI + '/rest/system/dzqm/upload',
21 method: 'post', 16 method: 'post',
22 data 17 data
23 }) 18 })
24 } 19 }
...\ No newline at end of file ...\ No newline at end of file
25
26 /**
27 * @description: 电子签名信息
28 * @param {*} data
29 * @author: renchao
30 */
31
32 /**
33 * @description: 删除电子签名
34 * @param {*} data
35 * @author: renchao
36 */
37
38
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 <el-row> 6 <el-row>
7 <el-col :span="5"> 7 <el-col :span="5">
8 <el-form-item label="电子签名"> 8 <el-form-item label="电子签名">
9 <el-input></el-input> 9 <el-input v-model="ruleForm.dzqm"></el-input>
10 </el-form-item> 10 </el-form-item>
11 </el-col> 11 </el-col>
12 <el-col :span="19" class="btnColRight"> 12 <el-col :span="19" class="btnColRight">
...@@ -17,85 +17,63 @@ ...@@ -17,85 +17,63 @@
17 </el-row> 17 </el-row>
18 </el-form> 18 </el-form>
19 </div> 19 </div>
20
21 <di>
22 <el-upload 20 <el-upload
23 class="upload-demo" 21 class="upload-demo"
24 :action="requestUrl" 22 action=""
25 :on-success="handleSuccess" 23 :limit="1"
26 :on-error="handleError" 24 multiple
25 :auto-upload="false"
26 accept=".jpg, .png"
27 :on-change="handleChange"
27 :before-upload="beforeUpload" 28 :before-upload="beforeUpload"
28 :file-list="fileList" 29 :file-list="fileList"
29 :limit="limitCount"
30 :on-exceed="handleExceed"
31 list-type="picture" 30 list-type="picture"
32 drag 31 drag>
33 >
34 <i class="el-icon-upload"></i> 32 <i class="el-icon-upload"></i>
35 <div class="el-upload__text">将图片拖到此处,或<em>点击上传</em></div> 33 <div class="el-upload__text">将图片拖到此处,或<em>点击上传</em></div>
36 <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过2MB</div> 34 <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过5MB</div>
37 </el-upload> 35 </el-upload>
38
39 </di>
40 <!-- 表格 --> 36 <!-- 表格 -->
41 </div> 37 </div>
42 </template> 38 </template>
43 <script> 39 <script>
44 import { uploadUrl } from '@/api/dzqm' 40 import { dzqmUpload } from '@/api/dzqm'
45
46 export default { 41 export default {
47 name: "dzqm", 42 name: "dzqm",
48 components: {},
49 mounted () {
50 },
51 data () { 43 data () {
52 return { 44 return {
53 dialogImageUrl: '', 45 ruleForm: {
54 dialogVisible: false, 46 dzqm: ""
55 disabled: false, 47 },
56
57 yourHeaders: { /* 你的请求头信息 */ },
58 fileList: [], // 已上传文件列表 48 fileList: [], // 已上传文件列表
59 limitCount: 3, // 限制上传文件的个数
60
61
62 requestUrl: uploadUrl(),
63
64 } 49 }
65 }, 50 },
66 methods: { 51 methods: {
67 handleSuccess(response, file, fileList) { 52 beforeUpload (file) {
68 // 文件上传成功后的回调
69 console.log('上传成功:', response);
70 this.fileList = fileList; // 更新已上传文件列表
71 },
72 handleError(error, file, fileList) {
73 // 文件上传失败后的回调
74 console.error('上传失败:', error);
75 },
76 beforeUpload(file) {
77 // 上传文件之前的钩子,返回false则停止上传 53 // 上传文件之前的钩子,返回false则停止上传
78 const isJPGorPNG = file.type === 'image/jpeg' || file.type === 'image/png'; 54 const isJPGorPNG = file.type === 'image/jpeg' || file.type === 'image/png';
79 const isLt2M = file.size / 1024 / 1024 < 2; 55 const isLt2M = file.size / 1024 / 1024 < 5;
80 if (!isJPGorPNG) { 56 if (!isJPGorPNG) {
81 this.$message.error('上传图片只能是 JPG/PNG 格式!'); 57 this.$message.error('上传图片只能是 JPG/PNG 格式!');
82 return false; 58 return false;
83 } 59 }
84 if (!isLt2M) { 60 if (!isLt2M) {
85 this.$message.error('上传图片大小不能超过 2MB!'); 61 this.$message.error('上传图片大小不能超过 5MB!');
86 return false; 62 return false;
87 } 63 }
88 return true; 64 return true;
89 }, 65 },
90 handleExceed(files, fileList) { 66 async handleChange (file) {
91 // 文件超出个数限制时的回调 67 var formdata = new FormData();
92 this.$message.warning(`当前限制选择 ${this.limitCount} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); 68 formdata.append("file", file.raw);
93 }, 69 dzqmUpload(formdata).then(res => {
94 70 console.log(res);
95 }, 71 })
72 }
73 }
96 }; 74 };
97 </script> 75 </script>
98 <style scoped lang="scss"> 76 <style scoped lang="scss">
99 @import "~@/styles/public.scss"; 77 @import "~@/styles/public.scss";
100 </style> 78 </style>
101 79
...\ No newline at end of file ...\ No newline at end of file
......