Merge branch 'master-v32-xwx' into 'master'
文档管理上传代码迁移 See merge request !520
Showing
3 changed files
with
25 additions
and
4 deletions
1 | <cm-dialog v-if="!isInset" title="文件上传" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="uploadFile" okText="上传"> | 1 | <cm-dialog v-if="!isInset" title="文件上传" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="uploadFile" okText="上传"> |
2 | <template v-slot> | 2 | <template v-slot> |
3 | - | 3 | + <!-- //start lsq 文件上传更换为单文件通过multiple值判断,:on-change="handleChange",:file-list="fileListNow" 2022-03-30--> |
4 | <el-upload | 4 | <el-upload |
5 | :accept="accept" | 5 | :accept="accept" |
6 | ref="upload" | 6 | ref="upload" |
7 | :http-request="getFile" | 7 | :http-request="getFile" |
8 | - :multiple="true" | 8 | + :multiple="multiple" |
9 | :before-upload="beforeUpload" | 9 | :before-upload="beforeUpload" |
10 | + :on-change="handleChange" | ||
11 | + :file-list="fileListNow" | ||
10 | :auto-upload="false"> | 12 | :auto-upload="false"> |
11 | <template #trigger> | 13 | <template #trigger> |
12 | <el-button size="small" type="primary">{{btnText}}</el-button> | 14 | <el-button size="small" type="primary">{{btnText}}</el-button> |
@@ -25,6 +27,7 @@ | @@ -25,6 +27,7 @@ | ||
25 | </template> | 27 | </template> |
26 | </el-upload> | 28 | </el-upload> |
27 | <div class="text-tip" style="position: absolute;bottom:30px;left: 20px;color:#f78989"> | 29 | <div class="text-tip" style="position: absolute;bottom:30px;left: 20px;color:#f78989"> |
30 | + <span v-if="!multiple">单文件上传,</span> | ||
28 | 文件上传大小限制200M | 31 | 文件上传大小限制200M |
29 | </div> | 32 | </div> |
30 | </template> | 33 | </template> |
@@ -46,6 +46,11 @@ export default { | @@ -46,6 +46,11 @@ export default { | ||
46 | type: String, | 46 | type: String, |
47 | default: '' | 47 | default: '' |
48 | }, | 48 | }, |
49 | + //lsq 是否为多文件上传 2022-03-30 | ||
50 | + multiple:{ | ||
51 | + type: Boolean, | ||
52 | + default: false | ||
53 | + }, | ||
49 | accept: { | 54 | accept: { |
50 | type: String, | 55 | type: String, |
51 | default: [".3gpp", | 56 | default: [".3gpp", |
@@ -140,6 +145,17 @@ export default { | @@ -140,6 +145,17 @@ export default { | ||
140 | } | 145 | } |
141 | 146 | ||
142 | } | 147 | } |
148 | + //start lsq 单文件上传时 新文件覆盖旧文件 2022-03-30 | ||
149 | + let fileListNow=props.fileList?Vue.ref(props.fileList):Vue.ref([]); | ||
150 | + let handleChange=(file, fileList)=> { | ||
151 | + if(!props.multiple){ | ||
152 | + if (fileList.length > 0) { | ||
153 | + fileListNow.value= [fileList[fileList.length - 1]] // 这一步,是 展示最后一次选择的文件 | ||
154 | + } | ||
155 | + } | ||
156 | + | ||
157 | + } | ||
158 | + //end lsq 2022-03-30 | ||
143 | 159 | ||
144 | let fileChange = (file, fileList) =>{ | 160 | let fileChange = (file, fileList) =>{ |
145 | console.log(file, fileList); | 161 | console.log(file, fileList); |
@@ -182,7 +198,9 @@ export default { | @@ -182,7 +198,9 @@ export default { | ||
182 | uploadFile, | 198 | uploadFile, |
183 | hidedialog, | 199 | hidedialog, |
184 | beforeUpload, | 200 | beforeUpload, |
185 | - fileChange | 201 | + fileChange, |
202 | + handleChange, | ||
203 | + fileListNow | ||
186 | } | 204 | } |
187 | } | 205 | } |
188 | } | 206 | } |
-
Please register or login to post a comment