Accept Merge Request #75: (feature/zy -> develop)

Merge Request: feature: 面板

Created By: @zhuyu
Accepted By: @zhuyu
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/75?initial=true
This commit is contained in:
zhuyu 2025-05-28 10:59:32 +08:00 committed by Coding
commit f26559be6c
8 changed files with 24 additions and 24 deletions

View File

@ -26,7 +26,7 @@ class Doc extends Model
public function getUrlAttr($value, $data)
public function getFileUrlAttr($value, $data)
{
$value = cdnurl($data['path']);

View File

@ -65,7 +65,7 @@ class Task extends Model
return $this->belongsTo('app\admin\model\Admin', 'exec_admin_id', 'id', [], 'LEFT')->setEagerlyType(1);
}
public function getUrlAttr($value, $data)
public function getFileUrlAttr($value, $data)
{
$value = cdnurl($data['prove_file_path']);
return $value;

View File

@ -28,7 +28,7 @@
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-path" class="btn btn-danger plupload" data-input-id="c-prove_file_path" data-mimetype="*" data-multiple="false" data-preview-id="p-path"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
{if $row->prove_file_path}
<span><button class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}" data-url="{$row.url}">预览</button></span>
<span><button class="btn btn-primary btn-info btn-preview" data-filetype="{$row.filetype}" data-fileurl="{$row.fileurl}">预览</button></span>
{/if}
</div>
<span class="msg-box n-right" for="c-prove_file_path"></span>

View File

@ -26,7 +26,7 @@
<input id="c-path" data-rule="required" class="form-control" size="50" name="row[path]" type="text" value="{$row.path|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-path" class="btn btn-danger plupload" data-input-id="c-path" data-mimetype="*" data-multiple="false" data-preview-id="p-path"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><a href="{$row.url}" class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}">预览</a></span>
<span><button class="btn btn-primary btn-info btn-preview" data-fileurl="{$row.fileurl}" data-filetype="{$row.filetype}">预览</button></span>
</div>
<span class="msg-box n-right" for="c-path"></span>
</div>

View File

@ -49,7 +49,7 @@
<input id="c-prove_file_path" class="form-control" size="50" readonly="readonly" name="row[prove_file_path]" type="text" value="{$row.prove_file_path}">
<div class="input-group-addon no-border no-padding">
{if $row.prove_file_path}
<span><button class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}" data-url="{$row.url}">预览</button></span>
<span><button class="btn btn-primary btn-info btn-preview" data-filetype="{$row.filetype}" data-fileurl="{$row.fileurl}">预览</button></span>
{/if}
</div>
<span class="msg-box n-right" for="c-prove_file_path"></span>

View File

@ -100,21 +100,21 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
$(document).on('click', '.btn-preview', function (e) {
e.preventDefault();
var fileType = $(this).data('type'); // 自动从 data-type 获取,比如 pdf, jpg, doc
var url = $(this).data('url');
var fileType = $(this).data('filetype'); // 自动从 data-type 获取,比如 pdf, jpg, doc
var fileUrl = $(this).data('fileurl');
if (fileType === 'pdf') {
Layer.open({
type: 2,
title: '预览PDF文件',
area: ['80%', '80%'],
content: url
content: fileUrl
});
} else if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileType)) {
Layer.photos({
photos: {
"title": "图片预览",
"data": [{"src": url}]
"data": [{"src": fileUrl}]
},
anim: 5
});
@ -123,10 +123,10 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
type: 1,
title: '视频预览',
area: ['800px', '500px'],
content: `<video src="${url}" width="100%" height="100%" controls autoplay></video>`
content: `<video src="${fileUrl}" width="100%" height="100%" controls autoplay></video>`
});
} else {
window.open(url, '_blank');
window.open(fileUrl, '_blank');
}
});

View File

@ -38,7 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
classname: 'btn btn-xs btn-primary btn-preview',
icon: 'fa fa-list',
extend: function(row) {
return 'data-type="' + row.filetype + '" data-url="' + row.url + '"';
return 'data-filetype="' + row.filetype + '" data-fileurl="' + row.fileurl + '"';
}
}
]
@ -49,21 +49,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
$(document).on('click', '.btn-preview', function (e) {
e.preventDefault();
var fileType = $(this).data('type'); // 自动从 data-type 获取,比如 pdf, jpg, doc
var url = $(this).data('url');
var fileType = $(this).data('filetype'); // 自动从 data-type 获取,比如 pdf, jpg, doc
var fileUrl = $(this).data('fileurl');
if (fileType === 'pdf') {
Layer.open({
type: 2,
title: '预览PDF文件',
area: ['80%', '80%'],
content: url
content: fileUrl
});
} else if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileType)) {
Layer.photos({
photos: {
"title": "图片预览",
"data": [{"src": url}]
"data": [{"src": fileUrl}]
},
anim: 5
});
@ -72,10 +72,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
type: 1,
title: '视频预览',
area: ['800px', '500px'],
content: `<video src="${url}" width="100%" height="100%" controls autoplay></video>`
content: `<video src="${fileUrl}" width="100%" height="100%" controls autoplay></video>`
});
} else {
window.open(url, '_blank');
window.open(fileUrl, '_blank');
}
});

View File

@ -65,21 +65,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
$(document).on('click', '.btn-preview', function (e) {
e.preventDefault();
var fileType = $(this).data('type'); // 自动从 data-type 获取,比如 pdf, jpg, doc
var url = $(this).data('url');
var fileType = $(this).data('filetype'); // 自动从 data-type 获取,比如 pdf, jpg, doc
var fileUrl = $(this).data('fileurl');
if (fileType === 'pdf') {
Layer.open({
type: 2,
title: '预览PDF文件',
area: ['80%', '80%'],
content: url
content: fileUrl
});
} else if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileType)) {
Layer.photos({
photos: {
"title": "图片预览",
"data": [{"src": url}]
"data": [{"src": fileUrl}]
},
anim: 5
});
@ -88,10 +88,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
type: 1,
title: '视频预览',
area: ['800px', '500px'],
content: `<video src="${url}" width="100%" height="100%" controls autoplay></video>`
content: `<video src="${fileUrl}" width="100%" height="100%" controls autoplay></video>`
});
} else {
window.open(url, '_blank');
window.open(fileUrl, '_blank');
}
});