From fdd57fe6f1fd445e779e8d00b92f3bfb2e003df8 Mon Sep 17 00:00:00 2001 From: pengda <10266652509@qq.com> Date: Mon, 14 Oct 2024 11:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A1=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/templates/admin/formula_add.html | 59 +++++++++++++++-- view/templates/admin/formula_list.html | 118 ++++++++++++++++++++++++++------- 2 files changed, 147 insertions(+), 30 deletions(-) diff --git a/view/templates/admin/formula_add.html b/view/templates/admin/formula_add.html index ed02f7a..39ba9b4 100644 --- a/view/templates/admin/formula_add.html +++ b/view/templates/admin/formula_add.html @@ -22,9 +22,11 @@ @@ -130,14 +132,17 @@ data: data, dataType: 'json', success: function (response) { - alert(response.info); if (response.status == true) { - window.location.href = "/admin/formula_list"; + showAlert('删除成功',"/admin/formula_list") + return true; } if(response.data.code == 40002){ - window.location.href = "/admin/login"; + showAlert(response.info,"/admin/login") + return true; } + + showAlert(response.info) }, error: function (xhr, status, error) { console.error('错误:', response); @@ -169,12 +174,33 @@ button.parentElement.parentElement.remove(); } + function showAlert(text,href = ""){ + // 创建提示框元素 + var $alertBox = $('
'+text+'
'); + + // 将提示框添加到页面中 + $("#page").append($alertBox); + + //2秒后自动隐藏并移除提示框 + setTimeout(function() { + $alertBox.css("opacity", "0"); + if(href){ + window.location.href = href; + } + setTimeout(function() { + $alertBox.remove(); + }, 500); // 给提示框一些时间淡出,然后再移除 + }, 500); + } + function submitForm(e) { e.preventDefault(); // 阻止默认表单提交 const form = document.getElementById('prescription-form'); const formData = new FormData(form); + const id = formData.get('id') + const data = { id: formData.get('id'), name: formData.get('name'), @@ -204,14 +230,21 @@ data: data, dataType: 'json', success: function (response) { - alert(response.info); if (response.status == true) { - window.location.href = "/admin/formula_list" + if(id){ + showAlert('保存成功',"/admin/formula_list") + }else{ + showAlert('添加成功',"/admin/formula_list") + } + return true; } if(response.data.code == 40002){ - window.location.href = "/admin/login"; + showAlert(response.info,"/admin/login") + return true; } + + showAlert(response.info) }, error: function (xhr, status, error) { console.error('错误:', response); @@ -230,6 +263,20 @@ border-radius: 50px; color: #fff; } + /* 提示框的样式 */ + .custom-alert { + position: fixed; + top: 30%; + right: 50%; + background-color: #787878; + color: white; + padding: 15px; + border-radius: 5px; + z-index: 1000; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + opacity: 1; + transition: opacity 0.5s ease; + } {/literal} diff --git a/view/templates/admin/formula_list.html b/view/templates/admin/formula_list.html index 9f9c742..6f11877 100644 --- a/view/templates/admin/formula_list.html +++ b/view/templates/admin/formula_list.html @@ -79,37 +79,42 @@ - - - - - - - + + + + + + {foreach from=$list key=key item=item} - + - - {/foreach} @@ -146,6 +151,25 @@ {literal} + {/literal}
ID录方者uid药方名称药方来源药方详情状态操作ID药方名称药方来源药方详情状态操作
{$item.id}{if $item.uid eq 0}-{else}{$item.uid}{/if} {$item.name} {$item.source} - {foreach from=$item.formula item=value} - {$value.name}{if $value.desc}({$value.desc}){/if} {$value.num_str} - {/foreach} + +
+ {foreach from=$item.formula item=value} + {$value.name}{if $value.desc}({$value.desc}){/if} {$value.num_str} + {/foreach} +
+

{$item.method}

- {if $item.is_delete == 0} 审核通过 {/if} - {if $item.is_delete == 2} 待审核 {/if} - {if $item.is_delete == 3} 审核不通过 {/if} + {if $item.uid==0} + {if $item.is_delete == 0} 审核通过 {/if} + {if $item.is_delete == 2} 待审核 {/if} + {if $item.is_delete == 3} 审核不通过 {/if} + {/if} {if $item.uid == 0} - 审核 + 审核 + {if $item.is_delete != 0} 编辑 {/if} + {/if}