|
@@ -159,6 +159,10 @@ import { saveDepoly } from '@/static/js/api.js'
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
|
const urlConfig = ref('http://zhongyao.fscuc.cn')
|
|
const urlConfig = ref('http://zhongyao.fscuc.cn')
|
|
|
|
+
|
|
|
|
+const plug= uni.requireNativePlugin('Html5app-Gprinter');
|
|
|
|
+
|
|
|
|
+
|
|
// const preseId = ref(11220822134401)
|
|
// const preseId = ref(11220822134401)
|
|
const preseObj = ref({
|
|
const preseObj = ref({
|
|
code: '',
|
|
code: '',
|
|
@@ -217,6 +221,7 @@ const v=ref({
|
|
symName:'脾胃虚寒证',
|
|
symName:'脾胃虚寒证',
|
|
prescriptionTime:'2023-06-01 15:58',
|
|
prescriptionTime:'2023-06-01 15:58',
|
|
address:'浙江省某某事某某去某某事中医院门诊楼三楼302是',
|
|
address:'浙江省某某事某某去某某事中医院门诊楼三楼302是',
|
|
|
|
+ birth:'',
|
|
rp:[
|
|
rp:[
|
|
{matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
|
|
{matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
|
|
{matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
|
|
{matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
|
|
@@ -367,7 +372,7 @@ onLoad(async(options) => {
|
|
v.value.entrust = res.data.entrust,
|
|
v.value.entrust = res.data.entrust,
|
|
v.value.rp = res.data.detailList
|
|
v.value.rp = res.data.detailList
|
|
v.value.yljgName = res.data.yljgName || ''
|
|
v.value.yljgName = res.data.yljgName || ''
|
|
-
|
|
|
|
|
|
+ v.value.birth = res.data.birth || ''
|
|
v.value.status = res.data.status,
|
|
v.value.status = res.data.status,
|
|
console.log('res.data.status',res.data.status)
|
|
console.log('res.data.status',res.data.status)
|
|
switch (res.data.status) {
|
|
switch (res.data.status) {
|
|
@@ -456,9 +461,9 @@ const handleSubmit = async()=>{
|
|
}
|
|
}
|
|
if(isPrint.value){
|
|
if(isPrint.value){
|
|
// 直接调用接口,然后打印
|
|
// 直接调用接口,然后打印
|
|
- print("#printMe")
|
|
|
|
|
|
+ // print("#printMe")
|
|
// 打印成功后调用/userPrescription/sendToUser
|
|
// 打印成功后调用/userPrescription/sendToUser
|
|
-
|
|
|
|
|
|
+ const ret = printerTsc()
|
|
const res = await sendToUser({
|
|
const res = await sendToUser({
|
|
token: uni.getStorageSync('token'),
|
|
token: uni.getStorageSync('token'),
|
|
data: JSON.stringify({id:uni.getStorageSync('userId')})
|
|
data: JSON.stringify({id:uni.getStorageSync('userId')})
|
|
@@ -477,7 +482,7 @@ const handleSubmit = async()=>{
|
|
|
|
|
|
const dialogConfirm = async()=>{
|
|
const dialogConfirm = async()=>{
|
|
console.log('dialogConfirm直接调用接口,然后打印')
|
|
console.log('dialogConfirm直接调用接口,然后打印')
|
|
- print("#printMe")
|
|
|
|
|
|
+ const ret = printerTsc()
|
|
// 打印成功后调用/userPrescription/sendToUser
|
|
// 打印成功后调用/userPrescription/sendToUser
|
|
const res = await sendToUser({
|
|
const res = await sendToUser({
|
|
token: uni.getStorageSync('token'),
|
|
token: uni.getStorageSync('token'),
|
|
@@ -532,6 +537,101 @@ const selectUpload = (e)=>{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const printerTsc = ()=>{
|
|
|
|
+
|
|
|
|
+ //制作标签格式,
|
|
|
|
+ let data=[]; //定义一个数组
|
|
|
|
+ let line={}; //每添加一个,代表一行字
|
|
|
|
+
|
|
|
|
+ //设置标签纸大小
|
|
|
|
+ line={};
|
|
|
|
+ line.width=80; //mm
|
|
|
|
+ line.height=50; //mm
|
|
|
|
+ line.gap=2; //标签纸之间,间隙长度 mm
|
|
|
|
+ line.page=1; //打印几份
|
|
|
|
+ line.direction=0, //上下反面打印,0=>正方向,1=> 反方向
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
+
|
|
|
|
+ let filePath=plus.io.convertLocalFileSystemURL("static/OpenSans-Bold.ttf")
|
|
|
|
+ //添加文字
|
|
|
|
+ line={};
|
|
|
|
+ line.customText=v.value.yljgName;
|
|
|
|
+ line.x=100;
|
|
|
|
+ line.y=40;
|
|
|
|
+ line.fontSize=30;
|
|
|
|
+ line.fontPath=filePath;
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
+
|
|
|
|
+ //添加图片
|
|
|
|
+ // var imgage=plus.io.convertLocalFileSystemURL("static/gprinter.png");
|
|
|
|
+ // line={};
|
|
|
|
+ // line.image=imgage;
|
|
|
|
+ // line.x=20;
|
|
|
|
+ // line.y=65;
|
|
|
|
+ // line.width=80;
|
|
|
|
+ // data.push(line);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // //添加黑块
|
|
|
|
+ // line={};
|
|
|
|
+ // line.addBar={x:10,y:10,width:200,height:4};
|
|
|
|
+ // data.push(line);
|
|
|
|
+
|
|
|
|
+ // //添加方框
|
|
|
|
+ // line={};
|
|
|
|
+ // line.addBox={x:10,y:25,xend:180,yend:50,thickness:2};
|
|
|
|
+ // data.push(line);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // //添加二维码
|
|
|
|
+ // line={};
|
|
|
|
+ // line.qrcode="https://www.baidu.com/";
|
|
|
|
+ // line.x=205; //横坐标
|
|
|
|
+ // line.y=25; //纵坐标
|
|
|
|
+ // line.width=3; //二维码大小,1-10 之间
|
|
|
|
+ // line.rotation=0; // 角度:有四个值:0,90,180,270
|
|
|
|
+ // data.push(line);
|
|
|
|
+
|
|
|
|
+ //添加条型码
|
|
|
|
+ line={};
|
|
|
|
+ line.barcode=v.value.preNo;
|
|
|
|
+ line.x=50; //横坐标
|
|
|
|
+ line.y=150; //纵坐标
|
|
|
|
+ line.type="CODE128"; //条型码类型
|
|
|
|
+ line.height=160; //条型码高度
|
|
|
|
+ line.readable=true; //是否显示文字在条型下方
|
|
|
|
+ line.rotation=0; // 角度:有四个值:0,90,180,270
|
|
|
|
+ data.push(line)
|
|
|
|
+
|
|
|
|
+ //患者
|
|
|
|
+ line={};
|
|
|
|
+ line.text='患者:'+v.value.name+', '+v.value.sex+', '+v.value.age+'岁';
|
|
|
|
+ line.x=300;
|
|
|
|
+ line.y=180;
|
|
|
|
+ line.fontSize=14;
|
|
|
|
+ line.fontPath='';
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
+
|
|
|
|
+ //出生
|
|
|
|
+ line={};
|
|
|
|
+ line.customText='出生日期:'+v.value.birth;
|
|
|
|
+ line.x=300;
|
|
|
|
+ line.y=240;
|
|
|
|
+ line.fontSize=13;
|
|
|
|
+ line.fontPath='';
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
+
|
|
|
|
+ // let _this=this;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ plug.printer({TSC:data}, ret => {
|
|
|
|
+ // _this.tip = JSON.stringify(ret);
|
|
|
|
+ console.log('print data', data)
|
|
|
|
+ console.log(ret)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|