|
@@ -3,23 +3,27 @@
|
|
|
<head>
|
|
|
<th:block th:include="include :: header('门店积分商品列表新增')" />
|
|
|
<th:block th:include="include :: ztree-css" />
|
|
|
+ <th:block th:include="include :: select2-css" />
|
|
|
+ <th:block th:include="include :: bootstrap-select-css" />
|
|
|
</head>
|
|
|
<body class="white-bg">
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
|
<form id="form-SSpglJfspProductinfo-add" class="customize-search-form">
|
|
|
<div class="customize-form-group-container">
|
|
|
+
|
|
|
<div class="customize-form-group">
|
|
|
- <label class="is-required">药品编码:</label>
|
|
|
- <input name="mdmCode" placeholder="请输入药品编码" id="mdmCode" class="styled-input" type="text" required>
|
|
|
- </div>
|
|
|
- <div class="customize-form-group">
|
|
|
- <label>D值品编码:</label>
|
|
|
- <input name="dValueCode" placeholder="请输入D值品编码" id="dValueCode" class="styled-input" type="text">
|
|
|
- </div>
|
|
|
- <div class="customize-form-group">
|
|
|
- <label>D值品名称:</label>
|
|
|
- <input name="dValueName" placeholder="请输入D值品名称" id="dValueName" class="styled-input" type="text">
|
|
|
+ <label>药品编码</label>
|
|
|
+ <select class="styled-input" id="mdmCode" name="mdmCode">
|
|
|
+ <option value="">--药品编码或药品名--</option>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
+
|
|
|
+<!-- <div class="customize-form-group">-->
|
|
|
+<!-- <label class="is-required">药品编码:</label>-->
|
|
|
+<!-- <input name="mdmCode" placeholder="请输入药品编码或药品名称" id="mdmCode" class="styled-input" type="text" required>-->
|
|
|
+<!-- <div id="suggestions" class="dropdown-list"></div>-->
|
|
|
+<!-- </div>-->
|
|
|
+
|
|
|
<div class="customize-form-group">
|
|
|
<label>规格:</label>
|
|
|
<input name="specification" placeholder="请输入规格" id="specification" class="styled-input" type="text">
|
|
@@ -42,21 +46,33 @@
|
|
|
<label>厂家简称:</label>
|
|
|
<input name="manufacturerShortName" placeholder="请输入厂家简称" id="manufacturerShortName" class="styled-input" type="text">
|
|
|
</div>
|
|
|
+ <div class=" panel panel-warning" style="width: 720px">
|
|
|
+ <div class="panel-heading">
|
|
|
+ <i class="fa fa-info-circle"></i> 以下是选择项的说明
|
|
|
+ </div>
|
|
|
+ <div class="panel-body">
|
|
|
+ <p>是否随访管品说明</p>
|
|
|
+ <p>分是否冷链管理品说明</p>
|
|
|
+ <p>是否登记管理品说明</p>
|
|
|
+ <p>是否慈善援助管理品说明</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
<div class="customize-form-group">
|
|
|
- <label>是否随访管理品:</label>
|
|
|
- <select name="isFollowUpManaged" id="isFollowUpManaged" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yes_no')}">
|
|
|
+ <label class="is-required">是否随访管理品:</label>
|
|
|
+ <select name="isFollowUpManaged" id="isFollowUpManaged" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
|
</select>
|
|
|
</div>
|
|
|
- <div class="customize-form-group">
|
|
|
- <label>是否冷链管理品:</label>
|
|
|
- <select name="isColdChainManaged" id="isColdChainManaged" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yes_no')}">
|
|
|
+ <div class="customize-form-group" id="isColdChainManagedDiv">
|
|
|
+ <label class="is-required">是否冷链管理品:</label>
|
|
|
+ <select name="isColdChainManaged" id="isColdChainManaged" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
|
</select>
|
|
|
</div>
|
|
|
- <div class="customize-form-group">
|
|
|
+ <div class="customize-form-group" id="isRegisteredManagedDiv">
|
|
|
<label>是否登记管理品:</label>
|
|
|
<select name="isRegisteredManaged" id="isRegisteredManaged" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yes_no')}">
|
|
|
<option value="">请选择</option>
|
|
@@ -71,8 +87,8 @@
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="customize-form-group">
|
|
|
- <label>给药方式:</label>
|
|
|
- <select name="administrationMethod" id="administrationMethod" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_yyff')}">
|
|
|
+ <label class="is-required">给药方式:</label>
|
|
|
+ <select name="administrationMethod" id="administrationMethod" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_yyff')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
|
</select>
|
|
@@ -87,7 +103,6 @@
|
|
|
<div class="customize-form-group">
|
|
|
<label>状态:</label>
|
|
|
<select name="status" id="status" class="styled-input" th:with="type=${@dict.getType('sys_hzgl_qyty_status')}">
|
|
|
- <option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
|
</select>
|
|
|
</div>
|
|
@@ -96,8 +111,12 @@
|
|
|
</div>
|
|
|
<th:block th:include="include :: footer" />
|
|
|
<th:block th:include="include :: ztree-js" />
|
|
|
+<th:block th:include="include :: select2-js" />
|
|
|
+<th:block th:include="include :: bootstrap-select-js" />
|
|
|
<script type="text/javascript">
|
|
|
-
|
|
|
+ var prefix = ctx + "yppz/drugConfig";
|
|
|
+ var isRegisteredManaged;
|
|
|
+ var dtp_flag;
|
|
|
function submitHandler() {
|
|
|
if ($.validate.form()) {
|
|
|
add();
|
|
@@ -120,6 +139,242 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ // $(document).ready(function() {
|
|
|
+ // let timeout;
|
|
|
+ //
|
|
|
+ // // 监听 dValueKey 输入框的 input 事件
|
|
|
+ // $('#mdmCode').on('input', function() {
|
|
|
+ //
|
|
|
+ // clearTimeout(timeout);
|
|
|
+ // var query = $('#mdmCode').val().trim();
|
|
|
+ // console.log("query===="+query);
|
|
|
+ // // 如果输入为空,清空 dValueId 输入框并停止进一步操作
|
|
|
+ // if (!query) {
|
|
|
+ // $('#mdmCode').val('');
|
|
|
+ // $('#genericName').val('');
|
|
|
+ // $('#productName').val('');
|
|
|
+ // $('#manufacturerShortName').val('');
|
|
|
+ // $('#packaging').val('');
|
|
|
+ // $('#specification').val('');
|
|
|
+ //
|
|
|
+ // $('#isFollowUpManaged').val('');
|
|
|
+ // $('#isColdChainManaged').val('');
|
|
|
+ // $('#isRegisteredManaged').val('');
|
|
|
+ // $('#isCharityAidManaged').val('');
|
|
|
+ //
|
|
|
+ // updateButtonVisibility1(); // 更新按钮可见性
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // // 使用防抖机制延迟发送请求
|
|
|
+ // timeout = setTimeout(() => {
|
|
|
+ // // 发送 AJAX 请求到服务器查询数据
|
|
|
+ // hzparam={query:query};//模拟微信扫码获取微信openId
|
|
|
+ // console.log("hzparam===="+hzparam);
|
|
|
+ // // 清空表格中的所有数据行
|
|
|
+ // // $('#drugInfoTable tbody').empty();
|
|
|
+ // $.ajax({
|
|
|
+ // cache: true,
|
|
|
+ // type: "POST",
|
|
|
+ // url: prefix+'/searchDrugs', // 替换为实际的搜索 URL
|
|
|
+ // data: hzparam,
|
|
|
+ // async: false,
|
|
|
+ // success: function (data) {
|
|
|
+ // console.log("data===="+data);
|
|
|
+ // if(data.code==0){
|
|
|
+ // $('#mdmCode').val(data.data.product_code);
|
|
|
+ // $('#genericName').val(data.data.generic_name);
|
|
|
+ // $('#productName').val(data.data.product_name);
|
|
|
+ // $('#manufacturerShortName').val(data.data.manufacturer_abbreviation);
|
|
|
+ // $('#packaging').val(data.data.packaging);
|
|
|
+ // $('#specification').val(data.data.specification);
|
|
|
+ //
|
|
|
+ // $('#isFollowUpManaged').val(data.data.follow_up_item);
|
|
|
+ // $('#isColdChainManaged').val(data.data.cold_chain_item);
|
|
|
+ // $('#isRegisteredManaged').val(data.data.registered_item);
|
|
|
+ // $('#isCharityAidManaged').val(data.data.charity_aid_item);
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // //$('#dtp_flag').val(data.data.dtp_flag);
|
|
|
+ // dtp_flag=data.data.dtp_flag;
|
|
|
+ // updateButtonVisibility1(); // 更新按钮可见性
|
|
|
+ // if(dtp_flag==="D"){
|
|
|
+ // isRegisteredManaged =1;
|
|
|
+ // $('#isRegisteredManaged').val(isRegisteredManaged);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // }else{
|
|
|
+ // // 清空表格中的所有数据行
|
|
|
+ // // $('#drugInfoTable tbody').empty();
|
|
|
+ // // 如果没有找到匹配的数据,清空 dValueId 输入框
|
|
|
+ // $('#mdmCode').val('');
|
|
|
+ // $('#genericName').val('');
|
|
|
+ // $('#productName').val('');
|
|
|
+ // $('#manufacturerShortName').val('');
|
|
|
+ // $('#packaging').val('');
|
|
|
+ // $('#specification').val('');
|
|
|
+ //
|
|
|
+ // $('#isFollowUpManaged').val('');
|
|
|
+ // $('#isColdChainManaged').val('');
|
|
|
+ // $('#isRegisteredManaged').val('');
|
|
|
+ // $('#isCharityAidManaged').val('');
|
|
|
+ //
|
|
|
+ // updateButtonVisibility1(); // 更新按钮可见性
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error: function(error) {
|
|
|
+ // // 清空 dValueId 输入框
|
|
|
+ // $('#mdmCode').val('');
|
|
|
+ // $('#genericName').val('');
|
|
|
+ // $('#productName').val('');
|
|
|
+ // $('#manufacturerShortName').val('');
|
|
|
+ // $('#packaging').val('');
|
|
|
+ // $('#specification').val('');
|
|
|
+ //
|
|
|
+ // $('#isFollowUpManaged').val('');
|
|
|
+ // $('#isColdChainManaged').val('');
|
|
|
+ // $('#isRegisteredManaged').val('');
|
|
|
+ // $('#isCharityAidManaged').val('');
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // }, 1300); // 300ms 的延迟
|
|
|
+ // });
|
|
|
+ // // 页面加载时检查 dValueIdInput 的初始状态
|
|
|
+ // updateButtonVisibility1();
|
|
|
+ // });
|
|
|
+ $(document).ready(function() {
|
|
|
+ // 初始化 Select2
|
|
|
+ $('#mdmCode').select2({
|
|
|
+ placeholder: '--药品编码或药品名--',
|
|
|
+ allowClear: true,
|
|
|
+ ajax: {
|
|
|
+ url: prefix + '/searchDrugs', // 替换为实际的搜索 URL
|
|
|
+ dataType: 'json',
|
|
|
+ delay: 300,
|
|
|
+ method: 'POST', // 使用 POST 方法
|
|
|
+ data: function (params) {
|
|
|
+ return {
|
|
|
+ query: params.term // search term
|
|
|
+ };
|
|
|
+ },
|
|
|
+ processResults: function (data) {
|
|
|
+ if (data.code == 0) {
|
|
|
+ return {
|
|
|
+ results: data.data.map(function(item) {
|
|
|
+ return { id: item.product_code, text: item.product_code + ' - ' + item.product_name, product_code: item.product_code };
|
|
|
+ })
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return { results: [] };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cache: true
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 处理选择事件
|
|
|
+ $('#mdmCode').on('select2:select', function (e) {
|
|
|
+ var selectedData = e.params.data;
|
|
|
+ var selectedProductCode = selectedData.product_code;
|
|
|
+ console.log("Selected Product Code:", selectedProductCode);
|
|
|
+
|
|
|
+ // 再次发送 AJAX 请求以获取详细信息
|
|
|
+ hzparam = { query: selectedProductCode };
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ url: prefix + '/searchDrugsObject', // 替换为实际的获取详情 URL
|
|
|
+ data: hzparam,
|
|
|
+ async: false,
|
|
|
+ success: function(data) {
|
|
|
+ console.log("details====" + JSON.stringify(data));
|
|
|
+ if (data.code == 0) {
|
|
|
+ populateFormFields(data.data);
|
|
|
+ } else {
|
|
|
+ clearFormFields();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(error) {
|
|
|
+ clearFormFields();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 清空表单字段
|
|
|
+ function clearFormFields() {
|
|
|
+ $('#mdmCode').val('').trigger('change');
|
|
|
+ $('#genericName').val('');
|
|
|
+ $('#productName').val('');
|
|
|
+ $('#manufacturerShortName').val('');
|
|
|
+ $('#packaging').val('');
|
|
|
+ $('#specification').val('');
|
|
|
+
|
|
|
+ $('#isFollowUpManaged').val('');
|
|
|
+ $('#isColdChainManaged').val('');
|
|
|
+ $('#isRegisteredManaged').val('');
|
|
|
+ $('#isCharityAidManaged').val('');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填充表单字段
|
|
|
+ function populateFormFields(data) {
|
|
|
+ $('#mdmCode').val(data.product_code);//.trigger('change')
|
|
|
+ $('#genericName').val(data.generic_name);
|
|
|
+ $('#productName').val(data.product_name);
|
|
|
+ $('#manufacturerShortName').val(data.manufacturer_abbreviation);
|
|
|
+ $('#packaging').val(data.packaging);
|
|
|
+ $('#specification').val(data.specification);
|
|
|
+
|
|
|
+ $('#isFollowUpManaged').val(data.follow_up_item);
|
|
|
+ $('#isColdChainManaged').val(data.cold_chain_item);
|
|
|
+ $('#isRegisteredManaged').val(data.registered_item);
|
|
|
+ $('#isCharityAidManaged').val(data.charity_aid_item);
|
|
|
+
|
|
|
+ dtp_flag = data.dtp_flag;
|
|
|
+ // updateButtonVisibility1(); // 更新按钮可见性
|
|
|
+ if (dtp_flag === "D") {
|
|
|
+ isRegisteredManaged = 1;
|
|
|
+ $('#isRegisteredManaged').val(isRegisteredManaged);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 页面加载时检查初始状态
|
|
|
+ updateButtonVisibility1();
|
|
|
+ });
|
|
|
+ function updateButtonVisibility1() {
|
|
|
+ var dValueId = $('#mdmCode').val().trim();
|
|
|
+ if (dtp_flag==="D") {
|
|
|
+ $('#isRegisteredManagedDiv').hide();
|
|
|
+ } else {
|
|
|
+ $('#isRegisteredManagedDiv').show();
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
+<style>
|
|
|
+ .styled-input {
|
|
|
+ padding: 5px;
|
|
|
+ width: 200px;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+ .dropdown-list {
|
|
|
+ position: absolute;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ background-color: white;
|
|
|
+ z-index: 1000;
|
|
|
+ max-height: 150px;
|
|
|
+ overflow-y: auto;
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .dropdown-item {
|
|
|
+ padding: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .dropdown-item:hover {
|
|
|
+ background-color: #f0f0f0;
|
|
|
+ }
|
|
|
+</style>
|
|
|
</body>
|
|
|
</html>
|