<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # 在線增強JS和CSS > `version 1.3.79及以上版本` `date 20210820` > 功能說明:對查詢區域的條件控件作一些JS事件控制【**JS增強**】、CSS樣式修改【**CSS增強**】。 [TOC] ## CSS增強 ### 1.效果 >`查詢按鈕`的背景顏色改變 ![](https://img.kancloud.cn/2c/9a/2c9a926fea5b7e5db9dceabc0460e0e3_1466x126.png) ### 2.進入設計頁面,在其他設置中點擊增強配置 ![](https://img.kancloud.cn/4f/32/4f32ede3d8bd43abd15f511760cebaa0_286x629.png) ### 3.重點來了->為`查詢按鈕`設置樣式 > 在css欄下編寫樣式代碼,使`按鈕背景顏色變成紅色,邊框也變成白色` ![](https://img.kancloud.cn/94/b6/94b6b1c4b287d47275a23bcda3b574d6_996x449.png) ``` .jm-query-form .ivu-btn-primary{ background-color: red; border-color: red; } ``` ### 4.注意事項 >[danger] 需要先找到按鈕的原class即`.ivu-btn-primary`,然后加上表單頂層樣式類`.jm-query-form`即可 >如下圖演示,先F12打開調試工具找到`元素(ELements)`,再定位 ![](https://img.kancloud.cn/0f/81/0f814453c35adb5ce4370c7f560bc044_1910x709.gif) ## JS增強示例 ### 1、實現三級聯動 本例通過JS增強實現三級聯動效果,來講解JS增強用法。 #### 1.1 效果展示 ![](https://img.kancloud.cn/ef/14/ef14085438ef8635bdf9870cf030a05a_1910x278.gif) #### 1.2 設計步驟 >進入數據集配置頁面,控件類型設置為 `自定義下拉框`,編碼為`pca` ![](https://img.kancloud.cn/f4/19/f419cc4e6f4ed05742320a3d6a669166_1838x652.png) >回到設計頁面配置js增強 ![](https://img.kancloud.cn/52/3b/523b9a06d6a2965256d9ac09f43ac1f8_1462x638.png) JS增強示例代碼: 先定義一個init方法,在里面編寫JS腳本。 ``` function init(){ // 加載第1個下拉框數據 $http.metaGet('http://localhost:8080/jeecg-boot/ces/ai/customSelect').then(res=>{ let options = res.data; this.updateSelectOptions('pca', 'pro', options) }) // 監聽第1個下拉框改變事件 加載第2個下拉框數據 /* * pca為數據源的key,pro是數據源key為pca的字段 **/ this.onSearchFormChange('pca', 'pro', (value)=>{ let params = {params: {pid: value}} $http.metaGet('http://localhost:8080/jeecg-boot/ces/ai/customSelect', params ).then(res=>{ let options = res.data; this.updateSelectOptions('pca', 'city', options) }) }) // 監聽第2個下拉框改變事件 加載第3個下拉框數據 this.onSearchFormChange('pca', 'city', (value)=>{ let params = {params: {pid: value}} $http.metaGet('http://localhost:8080/jeecg-boot/ces/ai/customSelect', params ).then(res=>{ let options = res.data; this.updateSelectOptions('pca', 'area', options) }) }) } ``` #### 1.3 功能說明 - 只能定義一個function,名稱叫init - 發起請求使用 `$http.metaGet`,請求參數格式如:`let params = {params: {pid: value}}` - 監聽控件值改變,使用`this.onSearchFormChange` 參數依次為: 數據集編碼、字段名、回調事件,回調事件攜帶參數可獲取到控件的值。*(這里只是說可以獲取到控件的值,不一定是控件的值,也有可能是event對象)* - 修改下拉框的選項:`this.updateSelectOptions`參數依次為:數據集編碼、字段名、下拉選項數據 ``` 下拉選項數據格式為: [{ value: '001', text: '北京市' },{ value: '002', text: '天津市' }] ``` - 接口最后返回的數據格式同上述下拉選項數據格式 ----- ### 2、實現修改查詢表單初始值 #### 2.1 效果展示 >通過`js`增強設置`sex`為女 ![](https://img.kancloud.cn/ce/32/ce325b978604b01572c68425045577cc_940x342.png) #### 2.2 設計步驟 >進入數據集配置頁面,編碼為`de`,并設置`sex`的查詢默認值為`男` ![](https://img.kancloud.cn/2b/be/2bbe22fabc64f5212faa013a35734df8_1920x907.png) >進入預覽頁面,查看數據顯示效果 ![](https://img.kancloud.cn/36/9e/369e087f823a4c26fbf2ef9286b7b7d3_927x313.png) >進入設計頁面,配置js增強 ![](https://img.kancloud.cn/ec/b9/ecb99590e44733c888d810392dd1d842_1253x564.png) ``` // 增強代碼 function init(){ this.updateSearchFormValue('de', 'sex', '女') } ``` 進入預覽頁面,再次查看數據顯示效果 ![](https://img.kancloud.cn/8d/b8/8db85fdd6b0ba9bff5f147a10da3f205_927x351.png) #### 2.3 功能說明 - 調用方法: **updateSearchFormValue**,該方法三個參數,說明如下: | 參數 | 描述 | | --- | --- | | dbCode | 數據集編碼,如上例中的test | | fieldName| 數據集字段名稱,如上例中的id | | value| 查詢初始值,如上例中的2| - 如果是數值的范圍查詢可以通過|拼接開始結束值 ![](https://img.kancloud.cn/53/8c/538c6b62042d7b0eab467f027dd4e9f7_1106x122.png) ``` function init(){ this.updateSearchFormValue('dbCode', 'fieldName', '1|5') } ``` - 如果是日期的范圍查詢,同上,只不過有個格式化需要配置,保證默認值的格式和配置的日期格式一致 ![](https://img.kancloud.cn/e2/01/e201c3c71771b93e9d4a8b96f3c22f2a_1153x158.png) ``` function init(){ this.updateSearchFormValue('dbCode', 'fieldName', '2021-08-01|2021-08-23') } ``` * 日期范圍查詢條件配置當前月第一天及最后一天 ![](https://img.kancloud.cn/8e/90/8e90f6bdd5784faf8b2abb00c13e3d04_1782x148.png) ``` function init(){ var date=new Date(); //獲取當月第一天 date.setDate(1); var month = parseInt(date.getMonth() + 1); var day = date.getDate(); if (month < 10) { month = '0' + month } if (day < 10) { day = '0' + day } var start = date.getFullYear() + '-' + month + '-' + day; //獲取當月最后一天 var currentMonth=date.getMonth(); var nextMonth=++currentMonth; var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1); var oneDay=1000*60*60*24; var end = new Date(nextMonthFirstDay-oneDay) //賦值 this.updateSearchFormValue('dbCode', 'fieldName', start+'|'+end) } ``` ---- ### 3、設置下拉單選默認值的第一項 #### 3.1 演示效果 >`sex`下拉框選中第一個`男` ![](https://img.kancloud.cn/3d/e3/3de3682997491bfbae82314e173eb6a2_968x367.png) #### 3.2 設計步驟 >版本支持`version 1.4.0` `date 20211020` >進入數據集配置頁面,配置字段字典code、查詢模式。【必須配置】 ![](https://img.kancloud.cn/df/08/df0895a7bc8c655a7f96685622e4b4be_1920x900.png) > 進入設計頁面,配置js增強 ![](https://img.kancloud.cn/c1/40/c140cd4419b8c59c32e7dc31dd3ce0ba_1257x559.png) ``` function init(){ let ops = this.getSelectOptions('de', 'sex'); if(ops && ops.length>0){ this.updateSearchFormValue('de', 'sex', ops[0].value) } } ``` #### 3.3 功能說明 - 調用方法: **getSelectOptions**,該方法兩個參數,說明如下: | 參數 | 描述 | | --- | --- | | dbCode | 數據集編碼,如上例中的test | | fieldName| 數據集字段名稱,如上例中的name | - 調用方法: **updateSearchFormValue**,該方法三個參數,說明如下: | 參數 | 描述 | | --- | --- | | dbCode | 數據集編碼,如上例中的test | | fieldName| 數據集字段名稱,如上例中的name | | value| 查詢初始值,如上例中的ops[0].value|
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看