19 changed files with 750 additions and 106 deletions
After Width: | Height: | Size: 7.1 KiB |
@ -0,0 +1,18 @@ |
|||||
|
function showAlert(text,href = ""){ |
||||
|
// 创建提示框元素
|
||||
|
var $alertBox = $('<div class="custom-alert">'+text+'</div>'); |
||||
|
|
||||
|
// 将提示框添加到页面中
|
||||
|
$("#page").append($alertBox); |
||||
|
|
||||
|
//2秒后自动隐藏并移除提示框
|
||||
|
setTimeout(function() { |
||||
|
$alertBox.css("opacity", "0"); |
||||
|
if(href){ |
||||
|
window.location.href = href; |
||||
|
} |
||||
|
setTimeout(function() { |
||||
|
$alertBox.remove(); |
||||
|
}, 500); // 给提示框一些时间淡出,然后再移除
|
||||
|
}, 500); |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
<nav class="topbar"> |
||||
|
<div class="topbar-inner"> |
||||
|
<div class="container"> |
||||
|
<a class="brand" href="/admin/formula_list">医案小助手</a> |
||||
|
|
||||
|
<div class="topbar-infomation"> |
||||
|
<ul> |
||||
|
<li class="email_drop"> |
||||
|
<a class='account' href="/admin/logout"> |
||||
|
<span class="name">退出</span> |
||||
|
</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</nav> |
||||
|
|
@ -0,0 +1,25 @@ |
|||||
|
<b>菜单栏</b> |
||||
|
<div class="input-search"> |
||||
|
<a href_flag='/admin/formula_list' href="/admin/formula_list">药方列表</a> |
||||
|
</div> |
||||
|
<div class="input-search"> |
||||
|
<a href_flag='/admin/unit_conv' href="/admin/unit_conv">计量单位转换</a> |
||||
|
</div> |
||||
|
{if $_uinfo.is_super} |
||||
|
<div class="input-search"> |
||||
|
<a href_flag='/admin/user_list' href="/admin/user_list">管理员列表</a> |
||||
|
</div> |
||||
|
{/if} |
||||
|
<div class="input-search"> |
||||
|
<a href_flag='/admin/save_pass' href="/admin/save_pass/username/{$_uinfo.username}">修改密码</a> |
||||
|
</div> |
||||
|
{literal} |
||||
|
<script> |
||||
|
$('.input-search').find('a').each(function(){ |
||||
|
if(window.location.pathname == $(this).attr('href_flag')) { |
||||
|
$(this).css('color', 'white'); |
||||
|
$(this).css('background', '#44b549'); |
||||
|
} |
||||
|
}); |
||||
|
</script> |
||||
|
{/literal} |
@ -0,0 +1,155 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html class="no-js" lang="zh-CN"> |
||||
|
<head> |
||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
|
<script type="text/javascript" src="{$smarty.const.CSS_URL}/js/jquery-1.8.1.min.js"></script> |
||||
|
<script type="text/javascript" src="{$smarty.const.CSS_URL}/js/jquery.form.js"></script> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<title>计量单位转换列表</title> |
||||
|
<meta name="viewport" content="width=device-width,initial-scale=1"> |
||||
|
<link href="{$smarty.const.CSS_URL}/css/global.css?v={$smarty.const.CSS_JS_VERSION}" media="screen" rel="stylesheet" type="text/css"> |
||||
|
<script src="{$smarty.const.CSS_URL}/js/common.js?v={$smarty.const.CSS_JS_VERSION}"></script> |
||||
|
</head> |
||||
|
<body> |
||||
|
|
||||
|
<div id="page"> |
||||
|
{include file="admin/include/header.html"} |
||||
|
<div class="container"> |
||||
|
<aside id="sidebar" class="sidebar"> |
||||
|
<div id="search" class="domain-search module"> |
||||
|
{include file="admin/include/leftmenu.html"} |
||||
|
</div> |
||||
|
</aside> |
||||
|
<section id="main"> |
||||
|
<div class="entry"> |
||||
|
<div class="modal-body"> |
||||
|
<table class="table table-striped table-bordered table-condensed"> |
||||
|
<tbody class='js-bundle-record-list'> |
||||
|
<tr> |
||||
|
<td> |
||||
|
计量单位: |
||||
|
<select id="unit_type" style="width: 100px;"> |
||||
|
<option value="0" {if $smarty.get.unit_type==0}selected{/if}>请选择</option> |
||||
|
{foreach from=$unit_list key=key item=item} |
||||
|
<option value="{$key}" {if $smarty.get.unit_type==$key}selected{/if}>1{$item}</option> |
||||
|
{/foreach} |
||||
|
</select> |
||||
|
|
||||
|
<button onclick="searchList();" class="button primary next" id="btnVer">搜索</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div id="main-content"> |
||||
|
<div class="record-control"> |
||||
|
<ul class="tabs"> |
||||
|
<li class="active"><a href="javascript:;">计量单位转换列表</a></li> |
||||
|
<div style="display:inline-block;float: right;"> |
||||
|
<button class="button primary next" onclick="to_add()">添加准换</button> |
||||
|
</div> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="entry"> |
||||
|
<div class="modal-body"> |
||||
|
<table class="table table-striped table-bordered table-condensed"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style="width: 5%">ID</th> |
||||
|
<th style="width: 10%">计量单位</th> |
||||
|
<th style="width: 10%">转换克重</th> |
||||
|
<th style="width: 60%">转换根据</th> |
||||
|
<th style="width: 15%">操作</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
{foreach from=$list key=key item=item} |
||||
|
<tr> |
||||
|
<td>{$item.id}</td> |
||||
|
<td>1{$unit_list[$item.unit_type]}</td> |
||||
|
<td>{$item.num}g</td> |
||||
|
<td>{$item.from}</td> |
||||
|
<td> |
||||
|
{if $item.is_super == 0} |
||||
|
{if $item.status == 0} |
||||
|
<a href="javascript:;" onclick="to_disabled({$item.id},1)">禁用</a> |
||||
|
{else} |
||||
|
<a href="javascript:;" onclick="to_disabled({$item.id},0)">启用</a> |
||||
|
{/if} |
||||
|
{/if} |
||||
|
<a href="/admin/unit_conv_add/id/{$item.id}">编辑</a> |
||||
|
</td> |
||||
|
</tr> |
||||
|
{/foreach} |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</section><!--end of main section--> |
||||
|
|
||||
|
</div><!--end of container--> |
||||
|
|
||||
|
</div><!--end of #page--> |
||||
|
|
||||
|
{literal} |
||||
|
<script type="text/javascript"> |
||||
|
function to_add() { |
||||
|
location.href = '/admin/unit_conv_add'; |
||||
|
} |
||||
|
|
||||
|
function searchList() { |
||||
|
var unit_type = $('#unit_type').val(); |
||||
|
|
||||
|
var url = '/admin/unit_conv'; |
||||
|
|
||||
|
if(unit_type > 0) url += '/unit_type/' + unit_type; |
||||
|
|
||||
|
location.href = url; |
||||
|
} |
||||
|
|
||||
|
function to_disabled(id, status) { |
||||
|
if (!confirm("确定要禁用吗?")) { |
||||
|
console.log("用户选择了确认"); |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
const data = { |
||||
|
id: id, |
||||
|
status: status, |
||||
|
}; |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: '/admin/ajax_change_unit_conv', // 替换为你的服务器端处理文件 |
||||
|
type: 'POST', |
||||
|
data: data, |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
if (response.status == true) { |
||||
|
showAlert('操作成功', window.location.href) |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
if(response.data.code == 40002){ |
||||
|
showAlert('请登录','/admin/login') |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
showAlert(response.info) |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error('错误:', response); |
||||
|
alert('提交失败,请重试。'); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
</script> |
||||
|
{/literal} |
||||
|
|
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,155 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
|
<script type="text/javascript" src="{$smarty.const.CSS_URL}/js/jquery-1.8.1.min.js"></script> |
||||
|
<script type="text/javascript" src="{$smarty.const.CSS_URL}/js/jquery.form.js"></script> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<title>添加用户</title> |
||||
|
<meta name="viewport" content="width=device-width,initial-scale=1"> |
||||
|
<link href="{$smarty.const.CSS_URL}/css/global.css?v={$smarty.const.CSS_JS_VERSION}" media="screen" rel="stylesheet" type="text/css"> |
||||
|
<script src="{$smarty.const.CSS_URL}/js/common.js?v={$smarty.const.CSS_JS_VERSION}"></script> |
||||
|
</head> |
||||
|
<body> |
||||
|
|
||||
|
<div id="page"> |
||||
|
{include file="admin/include/header.html"} |
||||
|
<div class="container"> |
||||
|
<aside id="sidebar" class="sidebar"> |
||||
|
<div id="search" class="domain-search module"> |
||||
|
{include file="admin/include/leftmenu.html"} |
||||
|
</div> |
||||
|
</aside> |
||||
|
<section id="main"> |
||||
|
<div id="main-content"> |
||||
|
<div class="record-control"> |
||||
|
<div class="header"> |
||||
|
<span style="font-size:14px;padding:5px">添加转换</span> |
||||
|
<div class="row"> </div> |
||||
|
<ul class="tabs"><li></li></ul> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div id="domain-list"> |
||||
|
<div class="entry"> |
||||
|
<div class="modal-body"> |
||||
|
<div class="wizard-container"><div> |
||||
|
<div class="inputs"> |
||||
|
<div id="form_area"> |
||||
|
<form id="conv-form" onsubmit="submitForm(event)"> |
||||
|
<input id="id" name="id" type="hidden" value="{$data.id}"> |
||||
|
|
||||
|
<div class="row"> </div> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<label for="unit_type">计量单位<font color='red'>*</font>:</label> |
||||
|
<select id="unit_type" name="unit_type" style="width: 100px;"> |
||||
|
{foreach from=$unit_list key=key item=item} |
||||
|
<option value="{$key}" {if $data.unit_type==$key}selected{/if}>1{$item}</option> |
||||
|
{/foreach} |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="row"> </div> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<label for="num">转换克重<font color='red'>*</font>:</label> |
||||
|
<input type="text" id="num" name="num" maxlength="" style="width:100px" value="{$data.num}"> g |
||||
|
</div> |
||||
|
|
||||
|
<div class="row"> </div> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<label for="from">转换根据<font color='red'>*</font>:</label> |
||||
|
<textarea rows="3" cols="80" id="from" name="from">{$data.from}</textarea> |
||||
|
</div> |
||||
|
|
||||
|
<div class="row"> </div> |
||||
|
|
||||
|
<div class="row" id="" style="position:relative;"> |
||||
|
<label> </label> |
||||
|
|
||||
|
<button class="button primary next submitlock" id="submitbtn" onclick="submitForm()"><span class="tdesc_text" style="color:white;">提交</span></button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="row"> </div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div></div> |
||||
|
<div style="display: none;" id="formtips"> |
||||
|
<div class="alert-message block-message info" style="color:red;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!--end of a domain entry--> |
||||
|
</div> |
||||
|
<!-- 批量上传 <div id="onetickupload"></div> --> |
||||
|
</div> |
||||
|
</section> |
||||
|
<!--end of main section--> |
||||
|
</div><!--end of container--> |
||||
|
</div><!--end of #page--> |
||||
|
|
||||
|
{literal} |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
function submitForm(e) { |
||||
|
e.preventDefault(); // 阻止默认表单提交 |
||||
|
|
||||
|
const form = document.getElementById('conv-form'); |
||||
|
const formData = new FormData(form); |
||||
|
|
||||
|
const id = formData.get('id') |
||||
|
|
||||
|
const data = { |
||||
|
id: formData.get('id'), |
||||
|
unit_type: formData.get('unit_type'), |
||||
|
num: formData.get('num'), |
||||
|
from: formData.get('from'), |
||||
|
}; |
||||
|
$.ajax({ |
||||
|
url: '/admin/ajax_save_unit_conv', // 替换为你的服务器端处理文件 |
||||
|
type: 'POST', |
||||
|
data: data, |
||||
|
dataType: 'json', |
||||
|
success: function (response) { |
||||
|
if (response.status == true) { |
||||
|
if(id){ |
||||
|
showAlert('保存成功', document.referrer) |
||||
|
}else{ |
||||
|
showAlert('添加成功', document.referrer) |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
if(response.data.code == 40002){ |
||||
|
showAlert(response.info,"/admin/login") |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
showAlert(response.info) |
||||
|
}, |
||||
|
error: function (xhr, status, error) { |
||||
|
console.error('错误:', response); |
||||
|
alert('提交失败,请重试。'); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
<style> |
||||
|
.add-button { |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
background-color: #DD4B38; |
||||
|
border: none; |
||||
|
border-radius: 50px; |
||||
|
color: #fff; |
||||
|
} |
||||
|
</style> |
||||
|
{/literal} |
||||
|
|
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue