支持多图片上传

This commit is contained in:
wuxw 2025-03-30 18:00:23 +08:00
parent 0f68bec2ff
commit da64db403d
7 changed files with 50 additions and 25 deletions

View File

@ -56,20 +56,19 @@
{{event.staffName}} {{event.staffName}}
</td> </td>
<td class="text-center" v-if="event.fileType != 'S'"> <td class="text-center" v-if="event.fileType != 'S'">
<div v-if="event.pathUrl.endsWith('jpg') || event.pathUrl.endsWith('png')">
<img style="width: 60px; height: 60px;" class="border-radius" v-bind:src="event.pathUrl"
v-on:click="_viewTaskFileImg(event.pathUrl)" />
</div>
<div v-else>
<a :href="event.pathUrl" target="_blank">下载</a> <a :href="event.pathUrl" target="_blank">下载</a>
</div>
</td> </td>
<td class="text-center" v-else> <td class="text-center" v-else>
-- --
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tfoot>
<tr>
<td colspan="2">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table> </table>
<!-- 分页 --> <!-- 分页 -->
<div class="text-right"> <div class="text-right">

View File

@ -70,8 +70,14 @@
{{item.remark}} {{item.remark}}
</td> </td>
<td class="text-center"> <td class="text-center">
<div v-if="item.pathUrl"> <div v-if="item.pathUrls" v-for="(url,index) in item.pathUrls">
<a :href="item.pathUrl" target="_blank">下载</a> <div v-if="url.endsWith('jpg') || url.endsWith('png')">
<img style="width: 60px; height: 60px;" class="border-radius" v-bind:src="url"
v-on:click="_viewTaskFileImg(url)" />
</div>
<div v-else>
<a :href="url" target="_blank">下载</a>
</div>
</div> </div>
<div v-else> - </div> <div v-else> - </div>
</td> </td>

View File

@ -75,6 +75,11 @@
$that.workDetailTaskItemInfo.taskId = _task.taskId; $that.workDetailTaskItemInfo.taskId = _task.taskId;
$that._loadWorkDetailTaskItemData(); $that._loadWorkDetailTaskItemData();
}, },
_viewTaskFileImg: function (_url) {
vc.emit('viewImage', 'showImage', {
url: _url
});
},
} }
}); });
})(window.vc); })(window.vc);

View File

@ -10,7 +10,7 @@
endTime:'', endTime:'',
staffs:[], staffs:[],
copyStaffs:[], copyStaffs:[],
pathUrl:'', pathUrls:[],
contents:[], contents:[],
period:'', period:'',
months: [], months: [],
@ -40,8 +40,9 @@
vc.emit('textarea','init',$that.addWorkInfo); vc.emit('textarea','init',$that.addWorkInfo);
}, },
_initEvent: function () { _initEvent: function () {
vc.on('addWorkInfo', 'notifyFile', function (_param) { vc.on('addWork', 'notifyFile', function (_param) {
$that.addWorkInfo.pathUrl = _param.realFileName; $that.addWorkInfo.pathUrls = [];
$that.addWorkInfo.pathUrls.push(_param.realFileName);
}) })
}, },
methods: { methods: {

View File

@ -11,7 +11,7 @@
endTime: '', endTime: '',
staffs: [], staffs: [],
copyStaffs: [], copyStaffs: [],
pathUrl: '', pathUrls: [],
contents:[], contents:[],
period: '', period: '',
months: [], months: [],
@ -38,8 +38,9 @@
vc.emit('textarea', 'init', $that.editWorkInfo); vc.emit('textarea', 'init', $that.editWorkInfo);
}, },
_initEvent: function () { _initEvent: function () {
vc.on('editWorkInfo', 'notifyFile', function (_param) { vc.on('editWork', 'notifyFile', function (_param) {
$that.editWorkInfo.pathUrl = _param.realFileName; $that.editWorkInfo.pathUrls = [];
$that.editWorkInfo.pathUrls.push(_param.realFileName);
}) })
}, },
methods: { methods: {
@ -179,8 +180,8 @@
function (json, res) { function (json, res) {
let _json = JSON.parse(json); let _json = JSON.parse(json);
vc.copyObject(_json.data[0], $that.editWorkInfo); vc.copyObject(_json.data[0], $that.editWorkInfo);
if(_json.data[0].pathUrl){ if(_json.data[0].pathUrls){
vc.emit('uploadFile', 'notifyVedio',_json.data[0].pathUrl); vc.emit('uploadFile', 'notifyVedio',_json.data[0].pathUrls[0]);
} }
$that.editWorkInfo.contents.forEach(_c=>{ $that.editWorkInfo.contents.forEach(_c=>{
_c.id = vc.uuid(); _c.id = vc.uuid();

View File

@ -103,13 +103,21 @@
</div> </div>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<div class="form-group"> <div class="form-group flex justify-start">
<label class="col-form-label"> <label class="col-form-label">
<vc:i18n name="附件:" namespace="workDetailInfo"></vc:i18n> <vc:i18n name="附件:" namespace="workDetailInfo"></vc:i18n>
</label> </label>
<label class=""> <div class="flex justify-start">
<a :href="workDetailInfo.pathUrl" v-if="workDetailInfo.pathUrl">下载</a> <div class="" v-if="workDetailInfo.pathUrls" v-for="(url,index) in workDetailInfo.pathUrls">
</label> <div v-if="url.endsWith('jpg') || url.endsWith('png')">
<img style="width: 60px; height: 60px;" class="border-radius" v-bind:src="url"
v-on:click="_viewTaskFileImg(url)" />
</div>
<div v-else>
<a :href="url" target="_blank">下载</a>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -19,7 +19,7 @@
stateName: "", stateName: "",
createTime: '', createTime: '',
content: '', content: '',
pathUrl: '', pathUrls: [],
_currentTab: 'workDetailContent', _currentTab: 'workDetailContent',
contents:[] contents:[]
} }
@ -72,6 +72,11 @@
contents:$that.workDetailInfo.contents contents:$that.workDetailInfo.contents
}) })
}, },
_viewTaskFileImg: function (_url) {
vc.emit('viewImage', 'showImage', {
url: _url
});
},
} }
}); });
})(window.vc); })(window.vc);