Explorar el Código

绑定打印前端

orzMaster hace 2 años
padre
commit
cf3f310cd5
Se han modificado 1 ficheros con 33 adiciones y 1 borrados
  1. 33 1
      Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm

+ 33 - 1
Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm

@@ -162,6 +162,9 @@
         }
         <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('@(@Model.LowerClassName):edit') || auth('@(@Model.LowerClassName):delete')">
           <template #default="scope">
+            @if(@Model.PrintType != "off"){
+            @:<el-button icon="ele-Printer" size="small" text="" type="primary" @@click="openPrint@(@Model.ClassName)(scope.row)" v-auth="'@(@Model.LowerClassName):print'"> 打印 </el-button>
+            }
             <el-button icon="ele-Edit" size="small" text="" type="primary" @@click="openEdit@(@Model.ClassName)(scope.row)" v-auth="'@(@Model.LowerClassName):edit'"> 编辑 </el-button>
             <el-button icon="ele-Delete" size="small" text="" type="primary" @@click="del@(@Model.ClassName)(scope.row)" v-auth="'@(@Model.LowerClassName):delete'"> 删除 </el-button>
           </template>
@@ -178,6 +181,10 @@
 				@@current-change="handleCurrentChange"
 				layout="total, sizes, prev, pager, next, jumper"
 	/>
+      <printDialog
+        ref="printDialogRef"
+        :title="print@(@Model.ClassName)Title"
+        @@reloadTable="handleQuery" />
       <editDialog
         ref="editDialogRef"
         :title="edit@(@Model.ClassName)Title"
@@ -195,8 +202,14 @@
   @:import { codeToName, getConstType } from "/@@/utils/constHelper";
   } 
   import { getDictDataItem as di, getDictDataList as dl } from '/@@/utils/dict-utils';
-  //import { formatDate } from '/@@/utils/formatTime';
+  import { formatDate } from '/@@/utils/formatTime';
 
+  @if(@Model.PrintType != "off"){
+  @:import { SysPrintApi } from '/@@/api-services/api';
+  @:import { SysPrint } from '/@@/api-services/models';
+  }
+  
+  import printDialog from '/@@/views/system/print/component/hiprint/preview.vue'
   import editDialog from '/@@/views/main/@(@Model.LowerClassName)/component/editDialog.vue'
   import { page@(@Model.ClassName), delete@(@Model.ClassName) } from '/@@/api/main/@(@Model.LowerClassName)';
   @foreach (var column in Model.QueryWhetherList){
@@ -224,6 +237,7 @@
   }else {
   @:const showAdvanceQueryUI = ref(true);
   }
+  const printDialogRef = ref();
   const editDialogRef = ref();
   const loading = ref(false);
   const tableData = ref<any>([]);
@@ -233,6 +247,15 @@
     pageSize: 10,
     total: 0,
   });
+  const tooltipParams = ref({
+    @if(@Model.PrintType != "off"){
+    width: 140,
+    }else{
+    width: 200,
+    }
+  });
+
+  const print@(@Model.ClassName)Title = ref("");
   const edit@(@Model.ClassName)Title = ref("");
 
   // 改变高级查询的控件显示状态
@@ -261,6 +284,15 @@
     editDialogRef.value.openDialog({});
   };
 
+  // 打开打印页面
+  const openPrint@(@Model.ClassName) = (row: any) => {
+    print@(@Model.ClassName)Title.value = '打印@(@Model.BusName)';
+    var res = await getAPI(SysPrintApi).apiSysPrintPrintNameGet('@Model.PrintName');
+	  var printTemplate = res.data.result as SysPrint;
+    var template = JSON.parse(printTemplate.template);
+    printDialogRef.value.showDialog(new hiprint.PrintTemplate({template: template}), row, template.panels[0].width);
+  }
+  
   // 打开编辑页面
   const openEdit@(@Model.ClassName) = (row: any) => {
     edit@(@Model.ClassName)Title.value = '编辑@(@Model.BusName)';