Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
705cd88b
authored
Nov 27, 2024
by
纪相明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加select2组件
parent
1a7f5324
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
resources/views/admin/prescription-print.blade.php
+14
-11
No files found.
resources/views/admin/prescription-print.blade.php
View file @
705cd88b
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<button
class=
"btn btn-success"
id=
"download-btn"
>
<button
class=
"btn btn-success"
id=
"download-btn"
>
<i
class=
"fa fa-download"
></i>
下载处方
<i
class=
"fa fa-download"
></i>
下载处方
</button>
</button>
<button
class=
"btn btn-primary"
id=
"print-btn"
>
<button
class=
"btn btn-primary"
id=
"print-btn"
>
<i
class=
"fa fa-print"
></i>
打印处方
<i
class=
"fa fa-print"
></i>
打印处方
</button>
</button>
...
@@ -28,10 +28,12 @@
...
@@ -28,10 +28,12 @@
</div>
</div>
</div>
</div>
<link
href=
"https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/select2/4.0.13/css/select2.min.css"
type=
"text/css"
rel=
"stylesheet"
/>
<script
src=
"https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/select2/4.0.13/js/select2.min.js"
type=
"application/javascript"
></script>
<script>
<script>
Dcat
.
ready
(
function
()
{
Dcat
.
ready
(
function
()
{
console
.
log
(
'文档加载完成'
);
console
.
log
(
'文档加载完成'
);
// 初始化处方打印页面
// 初始化处方打印页面
const
prescriptionHandler
=
new
class
{
const
prescriptionHandler
=
new
class
{
constructor
()
{
constructor
()
{
...
@@ -48,15 +50,15 @@
...
@@ -48,15 +50,15 @@
this
.
search
();
this
.
search
();
}
}
});
});
$
(
'#search-btn'
).
on
(
'click'
,
()
=>
{
$
(
'#search-btn'
).
on
(
'click'
,
()
=>
{
console
.
log
(
'点击搜索按钮'
);
console
.
log
(
'点击搜索按钮'
);
this
.
search
();
this
.
search
();
});
});
$
(
'#download-btn'
).
on
(
'click'
,
()
=>
this
.
download
());
$
(
'#download-btn'
).
on
(
'click'
,
()
=>
this
.
download
());
$
(
'#print-btn'
).
on
(
'click'
,
()
=>
this
.
print
());
$
(
'#print-btn'
).
on
(
'click'
,
()
=>
this
.
print
());
console
.
log
(
'事件绑定完成'
);
console
.
log
(
'事件绑定完成'
);
}
}
...
@@ -71,7 +73,7 @@
...
@@ -71,7 +73,7 @@
console
.
log
(
'开始发送请求,处方编号:'
,
prescriptionNo
,
'电子印章:'
,
isEseal
);
console
.
log
(
'开始发送请求,处方编号:'
,
prescriptionNo
,
'电子印章:'
,
isEseal
);
Dcat
.
loading
();
Dcat
.
loading
();
$
.
ajax
({
$
.
ajax
({
url
:
"{{ admin_url('prescription-search') }}"
,
url
:
"{{ admin_url('prescription-search') }}"
,
type
:
'POST'
,
type
:
'POST'
,
...
@@ -85,12 +87,12 @@
...
@@ -85,12 +87,12 @@
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
'请求成功:'
,
response
);
console
.
log
(
'请求成功:'
,
response
);
Dcat
.
loading
(
false
);
Dcat
.
loading
(
false
);
if
(
response
.
status
)
{
if
(
response
.
status
)
{
$
(
'#prescription-image'
).
attr
(
'src'
,
response
.
data
.
img_url
+
'?t='
+
new
Date
().
getTime
());
$
(
'#prescription-image'
).
attr
(
'src'
,
response
.
data
.
img_url
+
'?t='
+
new
Date
().
getTime
());
$
(
'#download-btn'
).
data
(
'url'
,
response
.
data
.
img_url
);
$
(
'#download-btn'
).
data
(
'url'
,
response
.
data
.
img_url
);
$
(
'#prescription-container'
).
show
();
$
(
'#prescription-container'
).
show
();
this
.
showEditableForm
(
response
.
data
.
drug_info
,
response
.
data
.
dosage_list
);
this
.
showEditableForm
(
response
.
data
.
drug_info
,
response
.
data
.
dosage_list
);
}
else
{
}
else
{
Dcat
.
error
(
response
.
message
||
'获取处方失败'
);
Dcat
.
error
(
response
.
message
||
'获取处方失败'
);
...
@@ -131,7 +133,7 @@
...
@@ -131,7 +133,7 @@
showEditableForm
(
drugs
,
dosage_list
)
{
showEditableForm
(
drugs
,
dosage_list
)
{
console
.
log
(
'drugs:'
,
drugs
);
// 调试信息
console
.
log
(
'drugs:'
,
drugs
);
// 调试信息
console
.
log
(
'dosage_list:'
,
dosage_list
);
// 调试信息
console
.
log
(
'dosage_list:'
,
dosage_list
);
// 调试信息
// 仅在 drugs 有值时生成表单
// 仅在 drugs 有值时生成表单
// 清空现有的药品信息表单
// 清空现有的药品信息表单
$
(
'#editable-drug-list'
).
remove
();
$
(
'#editable-drug-list'
).
remove
();
...
@@ -143,14 +145,14 @@
...
@@ -143,14 +145,14 @@
<input type="hidden" name="pharmacy_drug_id[]" value="
${
drug
.
pharmacy_drug_id
}
">
<input type="hidden" name="pharmacy_drug_id[]" value="
${
drug
.
pharmacy_drug_id
}
">
<label class="input-group-text">
${
drug
.
drug_name
}
||
${
drug
.
spec
}
||
${
drug
.
num
}${
drug
.
unit
}
</label>
<label class="input-group-text">
${
drug
.
drug_name
}
||
${
drug
.
spec
}
||
${
drug
.
num
}${
drug
.
unit
}
</label>
<select class="form-control" name="dosage_id[]">
<select class="form-control" name="dosage_id[]">
${
Array
.
isArray
(
dosage_list
)
&&
dosage_list
.
length
>
0
?
${
Array
.
isArray
(
dosage_list
)
&&
dosage_list
.
length
>
0
?
(()
=>
{
(()
=>
{
let
options
=
''
;
let
options
=
''
;
dosage_list
.
forEach
(
dose
=>
{
dosage_list
.
forEach
(
dose
=>
{
options
+=
`<option value="
${
dose
.
id
}
"
${
drug
.
dosage_id
===
dose
.
id
?
'selected'
:
''
}
>
${
dose
.
dosage_desc
}
</option>`
;
// 判断是否选中
options
+=
`<option value="
${
dose
.
id
}
"
${
drug
.
dosage_id
===
dose
.
id
?
'selected'
:
''
}
>
${
dose
.
dosage_desc
}
</option>`
;
// 判断是否选中
});
});
return
options
;
return
options
;
})()
:
})()
:
'
<
option
value
=
""
>
无可用剂量
<
/option>'
}
'
<
option
value
=
""
>
无可用剂量
<
/option>'
}
<
/select
>
<
/select
>
<
/div
>
<
/div
>
...
@@ -159,6 +161,7 @@
...
@@ -159,6 +161,7 @@
formHtml += '</div>';
formHtml += '</div>';
// 将表单添加到搜索表单下方
// 将表单添加到搜索表单下方
$('.search-form').after(formHtml);
$('.search-form').after(formHtml);
$(document).find('#editable-drug-list select').select2();
}
}
// 新增:获取剂量数据的方法
// 新增:获取剂量数据的方法
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment