瀏覽代碼

fix(router): 外链接入

gemercheung 3 年之前
父節點
當前提交
d0df09a32c
共有 2 個文件被更改,包括 34 次插入62 次删除
  1. 19 46
      src/views/order/list.vue
  2. 15 16
      src/views/system/menu/menu.data.ts

+ 19 - 46
src/views/order/list.vue

@@ -1,45 +1,3 @@
-<!-- 
-actualPrice: 50
-addTime: 1631094304000
-address: "港湾一号港11"
-brandId: 1046508
-brandName: "一楼展厅-多点位"
-callbackStatus: null
-city: "珠海市"
-confirmTime: null
-consignee: "cy"
-country: null
-couponId: ""
-couponPrice: 0
-district: "香洲区"
-freightPrice: 0
-goodsList: null
-goodsPrice: 50
-id: 676
-integral: 0
-integralMoney: 0
-logistics: null
-mobile: "15975119071"
-newId: "6761046508"
-nickName: "sousya"
-orderPrice: 50
-orderSn: "20210908174503807397842"
-orderStatus: 0
-orderType: "4"
-parentId: null
-payId: "wx0817450412422539ab24fc31729b920000"
-payName: null
-payStatus: 0
-payTime: null
-postscript: null
-province: "广东省"
-shippingFee: 0
-shippingId: 0
-shippingName: null
-shippingNo: null
-shippingStatus: 0
-userId: 17
-userName: "微信用户q0zj95zuo4pv" -->
 <template>
   <div class="p-4">
     <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
@@ -92,9 +50,7 @@ userName: "微信用户q0zj95zuo4pv" -->
               icon: 'mdi:printer-outline',
               label: '打印',
               color: 'error',
-              onClick: () => {
-                createMessage.info(`暂未接入`);
-              },
+              onClick: printDetail.bind(null, record),
             },
           ]"
         />
@@ -122,7 +78,7 @@ userName: "微信用户q0zj95zuo4pv" -->
   import { useGo } from '/@/hooks/web/usePage';
   import { Time } from '/@/components/Time';
   import { PopConfirmButton } from '/@/components/Button';
-
+  import printJS from 'print-js';
   import { useModal } from '/@/components/Modal';
   import ConfirmModal from './confirmModal.vue';
   export default defineComponent({
@@ -381,6 +337,22 @@ userName: "微信用户q0zj95zuo4pv" -->
           return;
         }
       }
+      function printDetail(record: Recordable) {
+        console.log('record', record);
+        printJS({
+          printable: [
+            { name: '订单号', email: '20210908174503807397842', phone: '123' },
+            { name: 'qq', email: '456@gmail.com', phone: '456' },
+          ],
+          properties: ['name', 'email', 'phone'],
+          type: 'json',
+          gridHeaderStyle: 'color: red;  border: 2px solid #3971A5;',
+          gridStyle: 'border: 2px solid #3971A5;',
+          header: '<h3 class="custom-h3">订单详情</h3>',
+          documentTitle: '订单详情',
+          style: '.custom-h3 { color: red; }',
+        });
+      }
 
       return {
         registerTable,
@@ -396,6 +368,7 @@ userName: "微信用户q0zj95zuo4pv" -->
         handleConfirmReceive,
         registerConfirmModal,
         reload,
+        printDetail,
       };
     },
   });

+ 15 - 16
src/views/system/menu/menu.data.ts

@@ -92,7 +92,12 @@ export const columns: BasicColumn[] = [
     },
   },
   {
-    title: '菜单URL',
+    title: '菜单路径',
+    dataIndex: 'path',
+    width: 180,
+  },
+  {
+    title: '外链地址',
     dataIndex: 'url',
     width: 180,
   },
@@ -101,6 +106,7 @@ export const columns: BasicColumn[] = [
 const isDir = (type: number) => type === 0;
 const isMenu = (type: number) => type === 1;
 const isButton = (type: number) => type === 2;
+const idShowExt = (isExt: number) => isExt === 1;
 
 export const searchFormSchema: FormSchema[] = [
   {
@@ -176,7 +182,7 @@ export const formSchema: FormSchema[] = [
   },
 
   {
-    field: 'url',
+    field: 'path',
     label: '路由地址',
     component: 'Input',
     required: true,
@@ -211,28 +217,21 @@ export const formSchema: FormSchema[] = [
     field: 'isExt',
     label: '是否外链',
     component: 'RadioButtonGroup',
-    defaultValue: '0',
+    defaultValue: 0,
     componentProps: {
       options: [
-        { label: '否', value: '0' },
-        { label: '是', value: '1' },
+        { label: '是', value: 1 },
+        { label: '否', value: 0 },
       ],
     },
     ifShow: ({ values }) => !isButton(values.type),
   },
 
   {
-    field: 'keepalive',
-    label: '是否缓存',
-    component: 'RadioButtonGroup',
-    defaultValue: '0',
-    componentProps: {
-      options: [
-        { label: '否', value: '0' },
-        { label: '是', value: '1' },
-      ],
-    },
-    ifShow: ({ values }) => isMenu(values.type),
+    field: 'url',
+    label: '外链地址',
+    component: 'Input',
+    ifShow: ({ values }) => idShowExt(values.isExt),
   },
 
   {