pecockwatch項目問題集

1.Caused by: java.sql.SQLException: Field 'supc_code' doesn't have a default valuejavascript

    答:前端沒有加css

<div class="form-group">
<label class="col-sm-3 control-label">供應商分類編碼:</label>
</dive>
2.如何以登陸人作爲默認的值存儲到數據庫
  前端:
<input id="createBy" name="createBy" class="form-control" type="text" readonly="true" th:value="${createBy}"/>
  後臺:
mmap.put("createBy", ShiroUtils.getLoginName() );
3.修改父類供應商分類parentcode時,彈出供應商分類樹
500
內部服務器錯誤!
4.樹形目目錄沒法顯示:
http://localhost:8013/basicsetting/supplierCategory/selectSupplierCategoryTree/02
image
經過調試對比departController.java,departserviceImpl.java發現
  * 
* @param supplierCategory 供應商分類信息
* @return 供應商分類集合
*/
@Override
@DataScope(tableAlias = "d")-----少這行
  @return 全部供應商分類信息
*/
@Override
public List<Map<String, Object>> selectSupplierCategoryTree() {

List<Map<String, Object>> trees = new ArrayList<~>();------不知爲何變化??
--------小孔指導是
image
5.樹形目錄選擇完後,沒法獲得當前選擇結點:孔
<select id="selectSupplierCategoryById" parameterType="String" resultMap="SupplierCategoryResult">
select c.supc_code,c.supc_name, c.parent_code, c.ancestors, c.sort, c.status, c.del_flag, c.create_by, c.create_time, c.update_by, c.update_time,
IFNULL(p.supc_name,"供應商分類") as parent_name
from basic_supplier_category c
left join basic_supplier_category p on c.parent_code = p.supc_code
where c.supc_code = #{supcCode}
</select>
6.父結點祖級列表輸出語句
  自:
    update SupplierCategory set ancestors =
<foreach collection="SupplierCategorys" item="item" index="index"
separator=" " open="case supc_code" close="end">
when #{item.supc_code} then #{item.ancestors}
</foreach>
where supc_code in
<foreach collection="SupplierCategorys" item="item" index="index"
separator="," open="(" close=")">
#{item.supc_code}
</foreach>
</update>
7.沒法刪除供應商分類編碼del_flag=2-隨然提示保存成功
image
自:suppliercategoryMapper<if test="delFlag = '0' "> and del_flag = #{delFlag}</if>
8.沒法點開父供應商份類增長父供應商Code界面
 
9 如何集成jqgrid編輯插件
  1.在index.html文件中
<!--jqgrid注:ruoyi\前端框架\Hplus-master\Hplus-master\web\js\plugins-->
<script th:src="@{/libs/jqgrid/jquery.jqGrid.minffe4.js}"></script>
 
  2.
 
10.二維數組表示
var arrEle1 = new Array("1","0","1","0");
var arrEle2 = new Array("1","1","0","1");
var arrEle3 = new Array("1","0","1","1");
//建立二維數組
var myArr = new Array();
myArr[0]=arrEle1;
myArr[1]=arrEle2;
myArr[2]=arrEle3;
document.write("myArr[0][0]=",myArr[0,0],"<br>");
document.write("myArr[1][1]=",myArr[1,1],"<br>");
document.write("myArr[2][1]=",myArr[2,2],"<br>");
另外一種表示方法
document.writeln(str);
function num(arr){
for (var i = 0; i < a.length; i++) {
for (var j = 0; j< 4; j++) {
alert(a[i][j]);
}
}
}
var a=[[1,0,1,0],[1,1,0,1],[1,0,1,1]];
num(a);
11. 調試
image
12.不顯示刪除恢復按鈕
- del_flag != 2
+ <if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
13. themleaf拼接字符串
   <td th:text="${info}+'str'"></td>
   Checked 回顯賦給數組

Thymeleaf下拉框回顯:html

<div class="form-group draggable">
    <label class="col-sm-3 control-label">bizMch:</label>
    <div class="col-sm-8">
        <select class="form-control" name="bizMchId" id="bizMchId">
            <option  th:each="bizMch:${list}" th:selected="${bizMch.bizMchId==homeMap.bizMchId}"
                     th:value="${bizMch.bizMchId}" th:text="${bizMch.name}"
                     ></option>
        </select>
    </div>
</div>

下拉框(session版):前端

<div class="form-group draggable">
   <label class="col-sm-3 control-label">bizMch:</label>
   <div class="col-sm-8">
      <select class="form-control" name="bizMchId" id="bizMchId">
            <option  th:each="list:${session.list}" th:value="${list.bizMchId}" th:text="${list.name }"></option>
      </select>
   </div>
</div>

1.thymeleaf 標籤獲取 contextPath:java

<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    contextPath = /*[[@{/}]]*/ '';
    /*]]>*/
</script>

二、thymeleaf 循環標籤jquery

 
<tr th:each="info:${list}">

info 爲循環變量,在循環中使用info點屬性便可git

三、thymeleaf  使用 href標籤帶參數:github

<a class="acicon" th:href="@{/attendanceRecord/userAttendanceRecordListPage(userInfoId=${attendanceRecordDTO.userInfoId})}">

四、thymeleaf  中將值傳給 事件函數:web

<a class="acicon" ><img  th:src="@{/img/common/listedit.png}" th:name="${userInfo.userInfoId}" onclick="editUserInfoPage(this)"/></a>

而後 $(this).attr('name');獲取name的值 這個方法有點臃腫 不過能實現ajax

五、循環給select 賦值:

<select  name="areaInfoId" class="selectpicker" onchange="setCity(this)">
    <option>請選擇省</option>
    <option th:each="areaInfo : ${areaInfos}" th:value="${areaInfo.areaInfoId}" th:text="${areaInfo.areaName}"></option>
</select>

六、給select動態選中:

<select name="enableFlag" class="selectpicker" onchange="setAreaName()">
    <option value="true" th:if="${userInfo.enableFlag ==true}" th:selected="selected">是</option>
    <option value="false" th:if="${userInfo.enableFlag ==false}" th:selected="selected">否</option>
    <option value="true" th:if="${userInfo.enableFlag ==false}">是</option>
    <option value="false" th:if="${userInfo.enableFlag ==true}">否</option>
</select>

七、路徑信息:

<script type="text/javascript" th:src="@{/js/basis/jquery/jquery-1.10.2.min.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/style/basis/bootstrap/bootstrap3.min.css}"/>

八、字符串拼接:

<td th:text="${info}+'str'"></td>

注意雙引號是必需要有的

九、使用thymeleaf控制 單選框

<ul>
    <li class="fl">
        <input type="radio" name="enableFlag"   th:checked="${userInfo.enableFlag== true}" value="true" style="margin: 10px;"/>
        <label class="iRadioLable" style="width:auto; max-width:auto;margin: 0">是</label>
    </li>
    <li class="fl">
        <input type="radio" name="enableFlag" th:checked="${userInfo.enableFlag==false}" value="false" style="margin: 10px"/>
        <label class="iRadioLable" style="width:auto; max-width:auto;margin: 0">否</label>
    </li>
</ul>

十、thymeleaf中使用三目運算

<td th:text="${imposeOccupyInfo.certificateCode== null} ? '-':${imposeOccupyInfo.certificateCode}"></td>

十一、thymeleaf中動態控制class 樣式

<li  th:class="${enterpriseInfo.creditGrade gt iterStat.index}?'start':''"></li>

十二、thymeleaf中使用時間格式化

<td th:text="${#dates.format(enterpriseInfo.insertTime,'yyyy-MM-dd')}"></td>

13.radio回顯

<div class="form-group">    
    <label class="col-sm-3 control-label">settleType:</label>
    <div class="col-sm-8">
        <label class="radio-inline">
            <input th:field="*{merchant.settleType}" type="radio" name="settleType" value="1" checked> open
        </label>
        <label class="radio-inline">
            <input th:field="*{merchant.settleType}" type="radio" name="settleType"  value="2"> close
        </label>
    </div>
</div>

切割

<div class="form-group col-md-6">
                                        <label for="name">FIRST NAME</label>
                                        <input type="text" class="form-control" id="name" name="firstName"
                                               th:value="${#strings.arraySplit(adminUser.name,' ')[1]}" readonly>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="name">FAMILY NAME</label>
                                        <input  type="text" class="form-control" id="nickname" name="familyName"
                                               th:value="${#strings.arraySplit(adminUser.name,' ')[0]}" readonly>
                                    </div>
 
13. 如何循環獲得themleaf value中的值 
<tr  

class="whauthtr"

 align="center"  style="word-break: break-all; border-width: 1px; border-style: solid;" th:each="wh : ${warehouse}">
<td style="word-break: break-all; border-width: 1px; border-style: solid;" class="whid" th:text="*{wh.whId}"></td>
14 前臺獲取themleaf 的二維數組值 
function submitHandler() {
var array = new Array();
$('#whauthtable tr.whauthtr').each(function () {
var whid = $(this).children('td.whid').text();
var arrayAuth = [];
arrayAuth.push($(this).find('input[name="authView"]').is(':checked') == true ? 1 : 0);
arrayAuth.push($(this).find('input[name="authAdd"]').is(':checked') == true ? 1 : 0);
arrayAuth.push($(this).find('input[name="authEdit"]').is(':checked') == true ? 1 : 0);
arrayAuth.push($(this).find('input[name="authRemove"]').is(':checked') == true ? 1 : 0);
var auth = arrayAuth.join('');
if(auth!='0000'){
array.push({
"whId": whid,
"wahousAuthMask": auth
});
}
});
$.ajax({
type : "POST",
url : prefix + "user/warehouseauth",
data : {
"authStrs":JSON.stringify(array),
"userId": $('#userId').val()
},
dataType:"json",
error : function(request) {
$.modal.alertError("系統錯誤");
},
success : function(data) {
$.operate.successCallback(data);
}
});
}
 
15 後臺轉josn 爲list對象
  答:在warehouseserviceimpl.java
      //操做使用fastjson進行字符串對象轉換
List<WarehouseAuth> WarehouseAuthList = new ArrayList<>();
JSONArray jsonArray= JSONArray.parseArray(authStrs);
for(int i = 0; i < jsonArray.size(); i++){
JSONObject jsonResult = jsonArray.getJSONObject(i);
WarehouseAuth warehouseAuth = JSONObject.toJavaObject(jsonResult,WarehouseAuth.class);
warehouseAuth.setUserId(userId);
warehouseAuth.setCreateBy(ShiroUtils.getLoginName());
WarehouseAuthList.add(warehouseAuth);
}
warehouseAuthMapper.deleteWarehouseAuthByUserId(userId);
return warehouseAuthMapper.insertUserWarehouseAuthMask(WarehouseAuthList);
16 行內編輯
   https://blog.csdn.net/hanxintong9/article/details/47084777
<span style="font-family:KaiTi_GB2312;font-size:18px;"> numId.click(function () { var tdObj = $(this); var text = tdObj.html(); tdObj.html(""); var inputObj = $("<input type='text'>").css("border-width", "0") .css("font-size", "16px").width(tdObj.width()) .css("background-color", tdObj.css("background-color")) .val(text).appendTo(tdObj); //是文本框插入以後被選中 inputObj.get(0).select(); inputObj.click(function () { return false; }); //處理文本框上回車和esc按鍵的操做 inputObj.keyup(function (event) { //獲取當前按下鍵盤的鍵值 //處理回車的狀況 var keycode = event.which if (keycode == 13) { var inputtext = $(this).val(); tdObj.html(inputtext); } if (keycode == 27) { tdObj.html(text); } }); });</span>
17.如何在datagrid、bootstrap-table、datatable選擇插件
   1.datagrid在github 用的比較少,datatable用的比bootstrap要多
   2.datatable 用到jquerytable
     bootstrap-table 用用bootstrap
  而datagrid用到是easyui裏面的集成插件
   3.daner用的是錄入明細時,選擇一種便捷的錄入方式,儘可能是在一個界面完成(參
     考datatable);
   4.H+ 自己支持bootstrap-table,rouyi也推薦bootstrap-table
 
  下載:
   image
image
以前版本
https://cdn.datatables.net/releases.html
18  Cannot read property 'style' of undefined TypeError: Cannot read property 'style' of undefined
   datatables edittables -行編輯器插件測試發生錯誤
  答:在您的代碼中。您試圖訪問未定義變量的屬性。您能夠從那裏調試。
  https://stackoverflow.com/questions/39376658/datatables-cannot-read-property-style-of-undefined#
19 DataTables warning: table id=podetail - Ajax error. For more information about this error, please see http://datatables.net/tn/7
image
主要是json數據存放路徑不對,應放在靜態文件夾下,老牛指導:
image
19 DataTables warning: table id=podetail - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
json 傳數據類型不對
image
json 寫這樣
{
"data": [
[
"001"
]
]
}
20 http://localhost:8089/po/po/potestajaxedittab
   Error in event handler for (unknown): SyntaxError: Unexpected token <
是因爲瀏覽器安裝了百度插件
21  設備類別分類沒法展開
37cff01ec7af41cfc0b7b639ec31636
老牛:主要是前端頁面問題
image
bootstrap-tree-table 原來寫爲bootstrap-table
image
22 想三級聯動把規格帶出
97fbf29dfe4fc8b2835e6a5b60cb405
image
 
23.回車到下一個輸入框
//回車後跳到下一個輸入框
function focusNextInput(thisInput)
{
var inputs = document.getElementsByTagName("input");
for(var i = 0;i<inputs.length;i++){
// 若是是最後一個,則焦點回到第一個
if(i==(inputs.length-1)){
inputs[0].focus(); break;
}else if(thisInput == inputs[i]){
inputs[i+1].focus(); break;
}
}
}
'data': 'specification', 'title': '規格 ', render: function (data, type, row, meta) {    return '<input type="text" name="specification"  onfocus="autofull(this,\'/basic/part/list\',\'specification\',\'specification\',' + meta.row + ');"/>'
相關文章
相關標籤/搜索