|
|
|
<!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">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="page">
|
|
|
|
<div class="container">
|
|
|
|
<section id="main">
|
|
|
|
<div id="main-content">
|
|
|
|
<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="is_all">
|
|
|
|
<option value="0" {if $smarty.get.is_all==0}selected{/if}>否</option>
|
|
|
|
<option value="1" {if $smarty.get.is_all==1}selected{/if}>是</option>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
药方名称:
|
|
|
|
<input type="text" id='name' value="{$smarty.get.name}">
|
|
|
|
|
|
|
|
<button onclick="searchList();" class="button primary next" id="btnVer">搜索</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="record-control">
|
|
|
|
<div class="flash-message"></div>
|
|
|
|
<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">
|
|
|
|
{if count($page_list) > 1}
|
|
|
|
<div class="modal-body">
|
|
|
|
|
|
|
|
{if isset($prev_page)}
|
|
|
|
<a href="{$prev_page}">上一页</a>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{foreach from=$page_list key=key item=item}
|
|
|
|
<a href="{$item.url}">{if $key+1 eq $curpage}<b>{/if}{$item.page}{if $key+1 eq $curpage}</b>{/if}</a>
|
|
|
|
{/foreach}
|
|
|
|
|
|
|
|
{if isset($post_page)}
|
|
|
|
<a href="{$post_page}">下一页</a>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
<table class="table table-striped table-bordered table-condensed">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="50">ID</th>
|
|
|
|
<th width="50">录方者uid</th>
|
|
|
|
<th width="200">药方名称</th>
|
|
|
|
<th width="200">药方来源</th>
|
|
|
|
<th width="50">使用次数</th>
|
|
|
|
<th width="200">药方详情</th>
|
|
|
|
<th width="50">操作</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{foreach from=$list key=key item=item}
|
|
|
|
<tr>
|
|
|
|
<td>{$item.id}</td>
|
|
|
|
<td>{if $item.uid eq 0}-{else}{$item.uid}{/if}</td>
|
|
|
|
<td>{$item.name}</td>
|
|
|
|
<td>{$item.source}</td>
|
|
|
|
<td>{$item.use_num}</td>
|
|
|
|
<td style="display: flex;flex-wrap: wrap">
|
|
|
|
{foreach from=$item.formula item=value}
|
|
|
|
<span style="margin-right: 20px">{$value.name} {$value.num_str}</span>
|
|
|
|
{/foreach}
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
{if $item.uid == 0}
|
|
|
|
<a href="/index/formula_add/id/{$item.id}">编辑</a>
|
|
|
|
<a href="javascript:;" onclick="to_delete({$item.id})">删除</a>
|
|
|
|
{/if}
|
|
|
|
</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 searchList() {
|
|
|
|
var is_all = $('#is_all').val();
|
|
|
|
var name = $.trim($('#name').val());
|
|
|
|
|
|
|
|
var url = '/index/home';
|
|
|
|
|
|
|
|
if(is_all > 0) url += '/is_all/' + is_all;
|
|
|
|
if(name) url += '/name/' + name;
|
|
|
|
|
|
|
|
location.href = url;
|
|
|
|
}
|
|
|
|
function to_add(){
|
|
|
|
location.href = '/index/formula_add';
|
|
|
|
}
|
|
|
|
function to_delete(id) {
|
|
|
|
if (!confirm("确定要删除吗?")) {
|
|
|
|
console.log("用户选择了确认");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const uid = {/literal}{$uid}{literal};
|
|
|
|
const token = {/literal}'{$token}'{literal};
|
|
|
|
|
|
|
|
const data = {
|
|
|
|
id: id,
|
|
|
|
uid: uid,
|
|
|
|
token: token,
|
|
|
|
};
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: '/ajax_delete_formula', // 替换为你的服务器端处理文件
|
|
|
|
type: 'POST',
|
|
|
|
data: data,
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (response) {
|
|
|
|
alert(response.info);
|
|
|
|
if (response.status == true) {
|
|
|
|
// window.location.reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(response.data.code == 40002){
|
|
|
|
window.location.href = "/index/login";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function (xhr, status, error) {
|
|
|
|
console.error('错误:', response);
|
|
|
|
alert('提交失败,请重试。');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{/literal}
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|