2023年2月2日 星期四

網頁列印 - 紙張方向: 橫向(landscape) / 直向(portrait) 的設定說明

 https://ithelp.ithome.com.tw/articles/10232006


今天要來介紹一個比較不常用的東西,那就是 CSS 中的列印,在以前常常會將網頁列印出來,所以經常會使用到這個屬性,時到今日,使用的時機越來越少,只有一些報表有用到,因此今天就讓我們一起看看吧!

首先我們有一個畫面,裡面有三個區塊,如下:

<body>
  <div class="page">
    <div class="box red">red</div>
  </div>
  <div class="page">
    <div class="box blue">blue</div>
  </div>
  <div class="page">
    <div class="box green">green</div>
  </div>
</body>
* {
  padding: 0;
  margin: 0;
}
.box {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 100px;
  height: 600px;
}
.red {
  border: 10px solid #f66;
}
.blue {
  border: 10px solid #66f;
}
.green {
  border: 10px solid #6f6;
}

print-page

列印方法

  • 直接網頁上右鍵列印(Ctrl+P
  • 使用 javascript 的 window.print()

如果想列印指定元素可以使用 javascript 另開分頁後列印

// 例:這邊只想列印 red 區塊
const content = document.querySelector(".red").innerHTML;
const newPage = window.open("", "", "width=1000,height=500");
newPage.document.write(content);
newPage.print();

或是使用可以接下來要介紹的 CSS 來控制

CSS 列印樣式

首先我們先來看看目前列印出來的樣式
print-origin
是不是看到了一些問題呢?

  • 頁首頁尾有怪東西
  • 同一區塊被斷開

其實列印的時候預設會有日期網頁標題網址頁碼,不過看起來有點醜,那麼如何解決哩?這邊就用到 CSS 的語法囉!

換頁

首先處理換頁的部分,這邊介紹兩個屬性,可以在列印時達到換頁的效果

.page {
  page-break-inside: avoid; /* 若順著向下排列時會切開此元素,則直接換頁 */
  page-break-after: always; /* 碰到此元素會直接換頁 */
}

print-break

@page

再來則是頁首頁尾,在 CSS 內可以使用 @page 來設定基本的列印樣式

  • size:設定列印的尺寸與方向,可依照紙張調整
  • margin:設定每頁邊界與內容的距離,小於一定數值時,則會將預設的標題等蓋過
@page {
  size: portrait; /* 直向 */
  size: landscape; /* 橫向 */
  size: A4; /* 紙張大小 */
  size: A4 portrait; /* 混合使用 */
  
  margin: 0; /* 邊界與內容的距離 */
}

設定好之後頁首頁尾就乾淨多了,如果想要上方有距離可自行設定 padding 或是 @page 內的 margin
print-@page

頁碼

剛剛將預設的東西清掉後雖然乾淨多了,不過如果還想留下頁碼怎麼辦!?這邊提供一個製作頁碼的方法

CSS 中其實有預設可用的計數器,功能有三個,分別是初始化增加取用

body {
  counter-reset: page-number; /* 初始化,名字可自訂,數值為0 */
}
.page {
  page-break-inside: avoid;
  position: relative;
  min-height: 100vh;
}
.page::after {
  content: counter(page-number); /* 取用該名字的計數器 */
  counter-increment: page-number 1; /* 增加計數器數值 */
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  font-size: 30px;
  text-align: center;
}

完成之後如下圖
print-page-number
此方法是定位在 page 這個 class,若是 page 的高度太高的話就不適用了

@media print

我們完成頁碼之後發現,不是在列印時也有頁碼,而且因為剛剛加上了 height: 100vh,所以也不會正常的排列了
print-all
這時候就可以用到列印中最重要的東西了,也就是 @media print,他的概念跟 @media screen 一樣,一個是螢幕的樣式,而另一個則是列印的樣式,已經會 RWD 的應該很好上手,那就讓我們來修改一下剛剛的問題吧!

@media print {
  .page {
    page-break-inside: avoid;
    position: relative;
    min-height: 100vh;
  }
  .page::after {
    content: counter(page-number);
    counter-increment: page-number 1;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    font-size: 30px;
    text-align: center;
  }
}

修改完成後就大功告成了,網頁上的樣式還是本來的樣式,而列印時改成了三頁,而且顯示頁碼

結語

之前我也不是很認識列印的屬性,剛好最近工作上用到才知道,基本上都跟 RWD 的概念一樣,只是多了幾個屬性可以用,用起來還算容易,不過能看到自己做的東西照著想像的樣子印出來還是相當療癒阿!哈哈


2023年1月31日 星期二

GitLab 操作說明 - 1>下載[master]最新程式 2>建立[分支] 3>上傳修改程式,[認同 & 推送]

GitLab操作說明:
1>GitLab.首頁.同步 - 從 GitLab 下載 [master]最新的專案程式
2>由下載最新的 [master] Source , 產生分支 [V120502_列印標籤]
3>[分支V120502_列印標籤]修改後, 上傳修改程式至 master , 以便合併至 master



1>GitLab.首頁.同步  GitLab 下載 [master]最新的專案程式









2>由下載最新的 [master] Source , 產生分支 [V120502_列印標籤]





3>[分支V120502_列印標籤]修改後, 上傳修改程式至  master , 以便合併至 master






2023年1月18日 星期三

V80201 - store 重設 timeout & WebService 重設 timeout -T1C - ds2T1C

 目的: V80201 - store 重設 timeout  & WebService 重設 timeout - 顯示子件資料

處理說明: 呼叫WebService(WS_PDM02) 顯示子件資料 
                    1> 後端 Webservice.重設 timeout  - web.config  - 10分鐘
                        <binding name="ServiceSoap"  
                          receiveTimeout="00:10:00"   .. >

                    2> 前端 store.重設 timeout   - 10分鐘
                        Ext.getCmp('sub_Grid').store.proxy.timeout=600000;

                  3>Ext.Ajax 設定 timeout  - 10 分鐘
                      Ext.Ajax.timeout = 600000; //如果有ajax timeout問題可以加上去



1>web.config -  後端 Webservice.重設 timeout - 10分鐘
<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ILdapServiceHttpBinding" />
        <binding name="TLSWebServiceSoap" />
        <binding name="ID40AuthenticateSoap" />
        <binding name="AMMWebServiceSoap" />
        <binding name="zm179TlsSoap" />
        <binding name="ZRFC_ZM66Soap" maxBufferPoolSize="524288" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647" />
        <binding name="ws_als_wbshourSoap" receiveTimeout="00:15:00"     
                     sendTimeout="00:15:00"/>
        <binding name="ServiceSoap"  
                 receiveTimeout="00:10:00" 
                 sendTimeout="00:10:00"
                 maxBufferPoolSize="524288" 
                 maxBufferSize="2147483647"
                 maxReceivedMessageSize="2147483647" />
        <binding name="ws_als_jcnhourSoap" />
      </basicHttpBinding>
      <customBinding>
        <binding name="ID40AuthenticateSoap12">
          <textMessageEncoding messageVersion="Soap12" />
          <httpTransport />
        </binding>
        <binding name="zm179TlsSoap12">
          <textMessageEncoding messageVersion="Soap12" />
          <httpTransport />
        </binding>
        <binding name="ServiceSoap12">
          <textMessageEncoding messageVersion="Soap12" />
          <httpTransport />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="http://aidcldap/ldapService.do" binding="basicHttpBinding"
        bindingConfiguration="ILdapServiceHttpBinding" contract="aidcldap.ILdapServicePortType"
        name="ILdapServiceHttpPort" />
      <endpoint address="http://192.30.8.210:8503/TLSWebService.asmx"
        binding="basicHttpBinding" bindingConfiguration="TLSWebServiceSoap"
        contract="TLSWS.TLSWebServiceSoap" name="TLSWebServiceSoap" />
      <endpoint address="http://192.168.99.36/aeispj/aeis/webservice/id40Authenticate.asmx"
        binding="basicHttpBinding" bindingConfiguration="ID40AuthenticateSoap"
        contract="iAIDCWebservice.ID40AuthenticateSoap" name="ID40AuthenticateSoap" />
      <endpoint address="http://192.30.8.240:8100/AMMWebService.asmx"
        binding="basicHttpBinding" bindingConfiguration="AMMWebServiceSoap"
        contract="AMMWS_TEST.AMMWebServiceSoap" name="AMMWebServiceSoap" />
      <endpoint address="http://aesweb/SAP/Zm179tls.asmx" binding="basicHttpBinding"
        bindingConfiguration="zm179TlsSoap" contract="ZM179.zm179TlsSoap"
        name="zm179TlsSoap" />
      <endpoint address="http://194.1.5.106/SAPWS/ZRFC_ZM66.asmx" binding="basicHttpBinding"
        bindingConfiguration="ZRFC_ZM66Soap" contract="ZRFC_ZM66.ZRFC_ZM66Soap"
        name="ZRFC_ZM66Soap" />
      <endpoint address="http://194.1.5.106/sapws/ws_als_wbshour.asmx"
        binding="basicHttpBinding" bindingConfiguration="ws_als_wbshourSoap"
        contract="ws_als_wbshour.ws_als_wbshourSoap" name="ws_als_wbshourSoap" />
      <endpoint address="http://enovia/AMM/Service.asmx" binding="basicHttpBinding"
        bindingConfiguration="ServiceSoap" contract="PDM_WS.ServiceSoap"
        name="ServiceSoap" />
      <endpoint address="http://194.1.5.106/sapws/ws_als_jcnhour.asmx"
        binding="basicHttpBinding" bindingConfiguration="ws_als_jcnhourSoap"
        contract="ws_als_jcnhour.ws_als_jcnhourSoap" name="ws_als_jcnhourSoap" />
    </client>
  </system.serviceModel>
</configuration>

2> 前端 store.重設 timeout   - V80201A1.js
var win1 = getMyWindow("顯示子件明細資料", sub_ShowPNDetail_Flds, sub_ShowPNDetail_Btns, "A1");
    win1.x =400;
win1.setWidth(700);
    win1.setHeight(400);
    //顯示 sub Grid 資料        
    var np = {};
    np["PROJID"] = Ext.getCmp("sub_PROJID").getValue();
    np["PDM_CONFIG"] = Ext.getCmp("sub_PDM_CONFIG").getValue();    
    np["PDTP"] = Ext.getCmp("sub_PDTP").getValue();
    np["TYPE"] = Ext.getCmp("sub_TYPE").getValue();
    //目前所選件號(PN),ECNO,情況處理碼(CNDPROCCODE)
    np["PN"] = par_PN;
    np["ECNO"] = par_ECNO;
    np["CNDPROCCODE"] = par_CNDPROCCODE;
    np["ASN"] = par_ASN;    
    np["PROCWC"] = par_PROCWC;    

    Ext.getCmp('sub_Grid').store.getProxy().url = '../api/V80201A1API/getsubData';
    Ext.getCmp('sub_Grid').store.getProxy().extraParams = np; //分頁OK,篩選條件OK
   //Ext.getCmp('sub_Grid').store.clearOnPageLoad = true;
    //Ext.getCmp('sub_Grid').reloadGridData();    
//重新設定store.proxy 的timeout 時間(10分鐘), 以免store載入時間 timeuot , 出現 Error
    Ext.getCmp('sub_Grid').store.proxy.timeout=600000;    
    Ext.getCmp('sub_Grid').store.on("load", function (me, records, successful, eOpts) {
        console.log("STEP2 Ext.getCmp(sub_Grid).store.on(load ..");
        console.log("successful:", successful);
        console.log("records:", records);
        if (successful) {
            console.log("successful");
            console.log("Ext.getCmp('sub_Grid').store.data", Ext.getCmp('sub_Grid').store.data);
            win1.show();
            //若已載入完成,則            
            //Ext.getCmp('waitlbl').setVisible(false);         
            Ext.getCmp("myMask").hide();
            //myMask.unmask();                    
            //myMask.hide();                                
        }
    }
    );
    Ext.getCmp('sub_Grid').store.load();
    console.log(" STEP 1 Ext.getCmp('sub_Grid').store.load() ");
    Ext.getCmp('sub_Grid_ptb').hide();
    

};  // end of function ShowPNBtn_click() {

3>*.cs - V80201A1APIController.cs

//重新設定WebService 的timeout 時間(10分鐘), 以免呼叫 WebService  timeuot , 出現 Error
      DataSet ds = PDM02.AMM_PDM02(Tmp_PN, Tmp_ECNO,Tmp_CNDPROCCODE, Tmp_PDTP,                    
                                                                 Tmp_ASN,Tmp_PROJID, Tmp_PROCWC);

     //將  ds 轉成標準的  T1C 格式(TMGrid)
     ds = myfunc.ds2T1C(ds);

2023年1月16日 星期一

V80209 – checkboxGroup -按[v]全部,則其他checkbox均Disabled,且為清為[ ]

目的: V80209 checkboxGroup  -[V]全部

1>按[v]全部,則其他checkbox均Disabled,且為清為[ ] 
2>按[ ]全部,則允許其他checkbox均Enabled,且為清為[ ] -






1>*.js

{
                        xtype: 'panel',
                        id: 'panel16',
                        layout: { type: 'vbox', align: 'stretch' },
                        //layout: { type: 'vbox'},
                        flex: 55,
                        border: 1,
                        items: [
                            {
                                xtype: 'checkboxgroup', fieldLabel: '異動原因', labelWidth: 60,
                               // layout: 'vbox',
                                columns: [.35,.35,.35],
                                id: 's_VRCODE',
                                items: [
                                    {
                                        boxLabel: '拆挪',
                                        name: 's_VRCODE',
                                        inputValue: 'C',
                                    },
                                    {
                                        boxLabel: '修理',
                                        name: 's_VRCODE',
                                        inputValue: 'R',
                                    },
                                    {
                                        boxLabel: '安裝',
                                        name: 's_VRCODE',
                                        inputValue: 'D',
                                    },                                    
                                    {
                                        boxLabel: '測試',
                                        name: 's_VRCODE',
                                        inputValue: 'T',
                                    },
                                    {
                                        boxLabel: 'DELETE解繳',
                                        name: 's_VRCODE',
                                        inputValue: 'E',
                                    },
                                    {
                                        boxLabel: '品保阻留',
                                        name: 's_VRCODE',
                                        inputValue: 'Q',
                                    },
                                    {
                                        boxLabel: '原件報廢',
                                        name: 's_VRCODE',
                                        inputValue: 'F',
                                    },
                                    {
                                        boxLabel: '預配',
                                        name: 's_VRCODE',
                                        inputValue: 'P',
                                    },
                                    {
                                        boxLabel: '空軍借件',
                                        name: 's_VRCODE',
                                        inputValue: 'H',
                                    },
                                    {
                                        boxLabel: '專案裝備撥補',
                                        name: 's_VRCODE',
                                        inputValue: 'Z',
                                    },
                                    {
                                        boxLabel: '入庫',
                                        name: 's_VRCODE',
                                        inputValue: 'I',
                                    },
                                    {
                                        boxLabel: '舊件繳回',
                                        name: 's_VRCODE',
                                        inputValue: 'O',
                                    },
                                    {
                                        boxLabel: '借件歸還',
                                        name: 's_VRCODE',
                                        inputValue: 'J',
                                    },
                                    {
                                        boxLabel: '機敏庫房保存',
                                        name: 's_VRCODE',
                                        inputValue: 'S',
                                    },
                                    {
                                        boxLabel: 'REWORK',
                                        name: 's_VRCODE',
                                        inputValue: 'A',
                                    },
                                    {
                                        boxLabel: '空軍存放',
                                        name: 's_VRCODE',
                                        inputValue: 'V',
                                    },                                    
                                    {
                                        boxLabel: '故障待修',
                                        name: 's_VRCODE',
                                        inputValue: 'M',                                        
                                    },                                                                        
                                    {
                                        boxLabel: '全部',
                                        name: 's_VRCODE',
                                        inputValue: 'ALL',                                        
                                        //checked: true,
                                        listeners:
                                        {
                                            change: function (me, newValue, oldValue, eOpts) {
                                                console.log("change!!");
                                                var Tmp_checkboxGroup = Ext.getCmp("s_VRCODE");
                                                console.log("newValue: ", newValue);
                                                console.log("oldValue: ", oldValue);
                                                for (i = 0; i < Tmp_checkboxGroup.items.length - 1; i++) {
                                                    console.log("i: ", i);                                                
                                                   var Tmp_checkbox = Tmp_checkboxGroup.items.items[i];
                                                    console.log("Tmp_checkbox: ", Tmp_checkbox);
                                                    Tmp_checkbox.setValue(false);
                                                    Tmp_checkbox.setDisabled(newValue);
                                                }
                                            }
                                        }
                                    },
                                ]
                            }, // end of s_異動紀錄
                        ]
                    },  //  end of items of panel16, flex:10
                ]
            },  // end of panel1


2>*.cs

           string Tmp_VRCODE = nvc["s_VRCODE"];  //異動原因
            ////將 A,C,B,D,ALL 字串加入 ""  --> "A","B","C","D" , 不含 ALL 傳回
            Tmp_VRCODE = myfunc.AddQuoteStr(Tmp_VRCODE);


 OracleCommand cmd = new OracleCommand();
            string Tmp_Sql1 = "", Tmp_Sql2 = "";  //for 日期起迄
            string Tmp_Sql = "  SELECT  RNK,RVNO,ARPNO,DITM,NM,REPN,RESN,REDT,INPN,INSN,RMK,PLNC,
                                                              INSC,NOTE,STLCT,STAT,FACWC,EFF "
                                        + "  FROM   ( SELECT  dense_rank()  over(order by  RVNO) as RNK,"
                                                       + "    RVNO,ARPNO,DITM,NM,REPN,RESN,REDT,INPN,INSN,RMK,PLNC,
                                                                INSC,NOTE,STLCT,STAT,FACWC,EFF "
                                                        + "   FROM     AMM_FRO3F16 "
                                                       + "   WHERE  1=1 ";
            //panel11

           //異動碼
            if (!myfunc.checkisnull(Tmp_VRCODE))
            {
             Tmp_Sql = Tmp_Sql + "  AND   RVNO IN (SELECT DISTINCT RVNO FROM  AMM_FRO3F16D WHERE  1=1 "
                                                       +                             " AND   VRCODE IN ("+ Tmp_VRCODE+")  )" ;
         }

2023年1月4日 星期三

筆記型電腦簡要規格: 品牌型號,CPU,記憶體,硬體,螢幕,作業系統

 筆記型電腦簡要規格: 品牌型號,CPU,記憶體,硬體,螢幕,作業系統

Acer P215-53,i7,16GB,256GB/1TB,15.6",Win10





1>品牌型號: Acer TMP215-53

2>CPU : Intel CoreTM i7-1165G

3>記憶體: 16GB

4>硬體:  256GB SSD/1TB SATA

5>螢幕: 15.6"

6>作業系統:  Win10


網路卡: Wifi, Bluetooth, 乙太網路

IO Port: USB3*3  HDMI*1   VGA*1  RJ45*1 WebCam

電池: 11hr , 48 Wh 3cell

重量: 1.8kg

配件: 附筆電包,滑鼠


映像檔轉虛擬光碟機_操作說明

 目的: 將映像檔轉虛擬光碟機操作說明, 以便安裝軟體(Ex: Delphi)

操作說明: 1>將映像檔掛接成虛擬磁碟機

                  2>由虛擬光碟機安裝軟體(Ex: Delphi)

                  3>退出虛擬光碟機


1>將映像檔掛接成虛擬磁碟機



  2>由虛擬光碟機安裝軟體(Ex: Delphi)



  3>退出虛擬光碟機



2023年1月2日 星期一

PL/SQL Developer – 環境設定 - 自動 Selection Statement / 自動Commit

 目的: PL/SQL Developer – 環境設定 - 自動 Selection Statement / 自動 Commit

操作說明: 1>  Edit à PL/SQL Beautify Options à Windows àSQL Windows

                  2> 勾選    [v] AutoCommit

                                   [v] AutoSelect  Statement