|
@@ -904,6 +904,37 @@ $(document).ready(function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ // 上传图片
|
|
|
+ $('body').on('click', '.upload-img', function () {
|
|
|
+ $(this).siblings('input').trigger('click');
|
|
|
+ // $('.upload-img-file').trigger('click');
|
|
|
+ });
|
|
|
+ $('body').on('change', '.upload-img-file', function () {
|
|
|
+ const file = this.files[0];
|
|
|
+ const ext = file.name.toLowerCase().split('.').splice(-1)[0];
|
|
|
+ const imgStr = /(png|PNG)$/;
|
|
|
+ if (!imgStr.test(ext)) {
|
|
|
+ toastr.error('请上传签名大小为600x300,格式PNG透明背景。');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if ($(this).val()) {
|
|
|
+ var _self = $(this);
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('id', $(this).data('id'));
|
|
|
+ formData.append('file', this.files[0]);
|
|
|
+ postDataWithFile(window.location.pathname + '/save-sign', formData, function (result) {
|
|
|
+ _self.siblings('img').attr('src', '/' + result);
|
|
|
+ _self.siblings('img').show();
|
|
|
+ _self.siblings('a').removeClass('btn btn-outline-primary btn-sm').addClass('d-inline-flex').text('更改');
|
|
|
+ _self.val('');
|
|
|
+ const lcindex = _.findIndex(ledger_cooperation_list, { id: _self.data('id') });
|
|
|
+ ledger_cooperation_list[lcindex].sign_path = result;
|
|
|
+ ledger_cooperation_list.splice(lcindex, 1, ledger_cooperation_list[lcindex]);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
$.subMenu({
|
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
@@ -963,7 +994,8 @@ function setLeftTable(ledgerList, coolist, uid, title) {
|
|
|
|
|
|
let html = '';
|
|
|
for (const sc of showCooList) {
|
|
|
- const pichtml = sc.sign_path ? `<img src="${sc.sign_path}" width="60"><a href="javascript:void(0);" class="d-inline-flex">更改</a>` : '<input type="file">';
|
|
|
+ const pichtml = sc.sign_path ? `<img src="/${sc.sign_path}" width="60"><input type="file" data-id="${sc.id}" class="upload-img-file" style="display: none;"><a href="javascript: void(0);" class="d-inline-flex upload-img">更改</a>`
|
|
|
+ : `<img src="" style="display: none" width="60"><input type="file" data-id="${sc.id}" class="upload-img-file" style="display: none;"><a href="javascript: void(0);" class="btn btn-outline-primary btn-sm upload-img">上传签名</a>`;
|
|
|
html += `<tr>` +
|
|
|
`<td>${sc.code} ${sc.name}</td>` +
|
|
|
`<td><p class="mb-0">${sc.pwd}</p><a href="javascript:void(0);" data-lid="${sc.ledger_id}" data-uid="${sc.user_id}" data-pwd="${sc.pwd}" class="edit-pwd">修改</a> <a href="javascript:void(0)" data-lid="${sc.ledger_id}" data-uid="${sc.user_id}" class="del-pwd text-danger">移除</a></td>` +
|