功能优化
This commit is contained in:
parent
02d20b4552
commit
8ced34fd44
|
|
@ -66,10 +66,10 @@
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select name="riskGrade" lay-verify="required">
|
<select name="riskGrade" lay-verify="required">
|
||||||
<option value="">请选择</option>
|
<option value="">请选择</option>
|
||||||
<option value="一级">一级</option>
|
|
||||||
<option value="二级">二级</option>
|
<option value="二级">二级</option>
|
||||||
<option value="三级">三级</option>
|
<option value="三级">三级</option>
|
||||||
<option value="四级">四级</option>
|
<option value="四级">四级</option>
|
||||||
|
<option value="五级">五级</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,13 @@ layui.use(['layer', 'form', 'element','upload'], function(){
|
||||||
|
|
||||||
files = obj.pushFile();
|
files = obj.pushFile();
|
||||||
obj.preview(function (index, file, result) {
|
obj.preview(function (index, file, result) {
|
||||||
|
// 检查文件大小是否大于5MB
|
||||||
|
if (file.size > 5 * 1024 * 1024) { // 文件大小单位为字节
|
||||||
|
// layer.msg('文件太大,无法预览', { icon: 2 });
|
||||||
|
delete files[index];
|
||||||
|
return; // 不预览大文件
|
||||||
|
}
|
||||||
|
|
||||||
var imgElem = $(`<img src="${result}" id="${index}" alt="${file.name}" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img">`);
|
var imgElem = $(`<img src="${result}" id="${index}" alt="${file.name}" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img">`);
|
||||||
// 绑定双击删除事件
|
// 绑定双击删除事件
|
||||||
imgElem.on('dblclick', function () {
|
imgElem.on('dblclick', function () {
|
||||||
|
|
@ -116,7 +123,15 @@ layui.use(['layer', 'form', 'element','upload'], function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
files = obj.pushFile();
|
files = obj.pushFile();
|
||||||
|
|
||||||
obj.preview(function (index, file, result) {
|
obj.preview(function (index, file, result) {
|
||||||
|
// 检查文件大小是否大于5MB
|
||||||
|
if (file.size > 5 * 1024 * 1024) { // 文件大小单位为字节
|
||||||
|
// layer.msg('文件太大,无法预览', { icon: 2 });
|
||||||
|
delete files[index];
|
||||||
|
return; // 不预览大文件
|
||||||
|
}
|
||||||
|
|
||||||
var imgElem = $(`<img src="${result}" id="${index}" alt="${file.name}" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img">`);
|
var imgElem = $(`<img src="${result}" id="${index}" alt="${file.name}" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img">`);
|
||||||
// 绑定双击删除事件
|
// 绑定双击删除事件
|
||||||
imgElem.on('dblclick', function () {
|
imgElem.on('dblclick', function () {
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,13 @@ layui.use(['layer', 'form', 'element','upload'], function(){
|
||||||
|
|
||||||
files = obj.pushFile();
|
files = obj.pushFile();
|
||||||
obj.preview(function (index, file, result) {
|
obj.preview(function (index, file, result) {
|
||||||
|
// 检查文件大小是否大于5MB
|
||||||
|
if (file.size > 5 * 1024 * 1024) { // 文件大小单位为字节
|
||||||
|
// layer.msg('文件太大,无法预览', { icon: 2 });
|
||||||
|
delete files[index];
|
||||||
|
return; // 不预览大文件
|
||||||
|
}
|
||||||
|
|
||||||
var imgElem = $(`<img src="${result}" id="${index}" alt="${file.name}" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img">`);
|
var imgElem = $(`<img src="${result}" id="${index}" alt="${file.name}" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img">`);
|
||||||
// 绑定双击删除事件
|
// 绑定双击删除事件
|
||||||
imgElem.on('dblclick', function () {
|
imgElem.on('dblclick', function () {
|
||||||
|
|
@ -107,6 +114,10 @@ layui.use(['layer', 'form', 'element','upload'], function(){
|
||||||
form.on('submit(updateBtn)', function(data){
|
form.on('submit(updateBtn)', function(data){
|
||||||
data.field.id=updateId;
|
data.field.id=updateId;
|
||||||
console.log(data.field);
|
console.log(data.field);
|
||||||
|
if (data.field.changeContent==='' || data.field.changeContent===null || data.field.path==='' || data.field.path===null){
|
||||||
|
layer.msg('必填项不能为空', { icon: 2 });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var formData = JSON.stringify(data.field);
|
var formData = JSON.stringify(data.field);
|
||||||
Ajax().post({
|
Ajax().post({
|
||||||
url: dataUrl + 'proteam/pot/riskWarningAndEarlyDisposal/updateData',
|
url: dataUrl + 'proteam/pot/riskWarningAndEarlyDisposal/updateData',
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ layui.use(['layer', 'form', 'element','laypage'], function(){
|
||||||
layer.open({
|
layer.open({
|
||||||
title: '新增',
|
title: '新增',
|
||||||
type: 2,
|
type: 2,
|
||||||
area: ['40%','70%'],
|
area: ['40%','80%'],
|
||||||
content: '../../html/supplement/child/rectification_punishment_add.html',
|
content: '../../html/supplement/child/rectification_punishment_add.html',
|
||||||
cancel: function(){
|
cancel: function(){
|
||||||
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
|
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
layer.open({
|
layer.open({
|
||||||
title: '详情',
|
title: '详情',
|
||||||
type: 2,
|
type: 2,
|
||||||
area: ['50%','90%'],
|
area: ['60%','90%'],
|
||||||
content: '../../html/supplement/child/riskWarningAndEarlyDisposalAdd.html',
|
content: '../../html/supplement/child/riskWarningAndEarlyDisposalAdd.html',
|
||||||
btn: ['取消'] //只是为了演示
|
btn: ['取消'] //只是为了演示
|
||||||
,success: function (layero, index) {
|
,success: function (layero, index) {
|
||||||
|
|
@ -33,7 +33,7 @@ layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
layer.open({
|
layer.open({
|
||||||
title: '整改',
|
title: '整改',
|
||||||
type: 2,
|
type: 2,
|
||||||
area: ['50%','90%'],
|
area: ['60%','90%'],
|
||||||
content: '../../html/supplement/child/riskWarningAndEarlyDisposalAdd.html',
|
content: '../../html/supplement/child/riskWarningAndEarlyDisposalAdd.html',
|
||||||
btn: ['确定', '取消']
|
btn: ['确定', '取消']
|
||||||
,success: function (layero, index) {
|
,success: function (layero, index) {
|
||||||
|
|
@ -66,7 +66,7 @@ layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
layer.open({
|
layer.open({
|
||||||
title: '新增',
|
title: '新增',
|
||||||
type: 2,
|
type: 2,
|
||||||
area: ['50%','90%'],
|
area: ['60%','90%'],
|
||||||
content: '../../html/supplement/child/riskWarningAndEarlyDisposalAdd.html',
|
content: '../../html/supplement/child/riskWarningAndEarlyDisposalAdd.html',
|
||||||
cancel: function(){
|
cancel: function(){
|
||||||
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
|
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue