向input中输入数据报错

发布于 2022-09-06 09:02:18 字数 7632 浏览 18 评论 0

TypeError: Cannot create property 'productionNo' on string ''

at Object.eval [as setter] (eval at CSPcompile (avalon.js:78), <anonymous>:3:81)
at HTMLInputElement.updateVModel [as avalonSetter] (avalon.js:3993)

报错信息如上

以下为js代码




 /** 下达订单*/
             $(".grid-wrap").on("click", ".detail", function (e) {
                 
                 var t = $(this).parent().data("id");
                 var rowData = $("#grid").jqGrid('getRowData',t);
                 var orderNo = rowData.orderNo;
                 console.log('this is [orderNo]::::',orderNo);
                 $.ajax({
                     type:"POST",
                     url:"/api/produce/list",
                     data:{
                         "orderNo":orderNo,
                     },
                     success: function (data) {
                         console.log('this is data::::',data);
                         model.productionInfo=data;
                         console.log('this is [model.productionInfo22222222222]',model.productionInfo);
                         
                     },
                     beforeSend: function (xhr) {
                         xhr.setRequestHeader("X-AuthToken", token);
                     },
                     error: function (responseData, textStatus, errorThrown) {
                         alert("Failed: " + responseData);
                     }
                 });
                     model.edit($("#grid").getRowData(orderNo),orderNo);
                
             });
             
             
             
             
       //添加或更新
         edit: function (productionInfo,orderNo) {
             dialog({
                 title: '下达生产指令',
                 content: $('#editUser'),
                 okValue: "确定",
                 ok: function () {
             // 提交修改
                     console.log(model.productionInfo.productionNo);
                 $.ajax({    
                     type: "POST",
                     url: "/api/produce/save" ,
                     contentType: "application/json;charset=utf-8",
                     data:JSON.stringify(model.productionInfo.$model),
                     beforeSend: function (xhr) {
                         xhr.setRequestHeader("X-AuthToken", token);
                     },
                     success: function () {
                         
                         $.ajax({
                             type: "POST",
                             url: "/api/order/changeStatus" ,
//                                     contentType: "application/json;charset=utf-8",
                             data:{"orderNo":orderNo},
                             beforeSend: function (xhr) {
                                 xhr.setRequestHeader("X-AuthToken", token);
                             },
                             success: function () {
                                 window.history.go(0); 
                             },
                             error: function (responseData, textStatus, errorThrown) {
                                 alert("系统异常");
                             }
                         });
                     },
                         error: function (responseData, textStatus, errorThrown) {
                         alert("系统异常");
                     }
                 });
                //     }
                 },
                 cancelValue: "取消",
                 cancel: function () {}
             }).showModal();
         },
     

以下为html代码:

<div id="editUser" style="display: none; ">
        <form id="userForm" class="form-dl" style="height: 180px;">
            <table style="float: left; width: 50px">
                <tr>
                    <td class="left"><label>生产指令号:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="productionNo" name="productionNo" class="text required"
                        ms-duplex="productionInfo.productionNo" /></td>
                </tr>
                <tr>
                    <td class="left"><label>目的港:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="destination" name="destination" class="text required"
                        ms-duplex="productionInfo.destination" /></td>
                </tr>
                <tr>
                    <td class="left"><label>ceva:</label></td>
                    <td class="short applay_td"><input type="text" id="ceva"
                        name="ceva" class="text required" ms-duplex="productionInfo.ceva" /></td>
                </tr>

                <tr>
                    <td class="left"><label>质检部:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="qcDepartment" name="qcDepartment" class="text"
                        ms-duplex="productionInfo.qcDepartment" /></td>
                </tr>
            </table>

            <table style="float: left ;">
                <tr>
                    <td class="left"><label>投产时间:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="startingDate" name="startingDate" class="text required"
                        ms-duplex="productionInfo.startingDate" style="width: 95%;float: right;"/></td>
                </tr>
                <tr>
                    <td class="left"><label>货代:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="freightForwarding" name="freightForwarding"
                        class="text required" ms-duplex="productionInfo.freightForwarding" style="width: 95%;float: right;"/></td>
                </tr>
                <tr>
                    <td class="left"><label>编制/供销部:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="samDepartment" name="samDepartment" class="text required"
                        ms-duplex="productionInfo.samDepartment" style="width: 95%;float: right;"/></td>
                </tr>
                <tr>
                    <td class="left"><label>生产部:</label></td>
                    <td class="short applay_td"><input type="text"
                        id="productDepartment" name="productDepartment"
                        class="text required" ms-duplex="productionInfo.productDepartment" style="width: 95%;float: right;" /></td>
                </tr>
            </table>
            <table style="float: left ;">
                <tr>
                    <td class="left"><label>备注:</label></td>
                    </br>
                    <td class="short applay_td"><textarea type="text"
                        id="deliveriesStatus" name="deliveries_Status"
                        class="text required" ms-duplex="productionInfo.comment" style="width: 385px"></textarea></td>
                </tr>
            </table>
        </form>
    </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁的新欢旧爱 2022-09-13 09:02:18

错误是 console.log(model.productionInfo.productionNo);
这一行报的吧?

从错误信息上看,原因是你以为它是Object对象,但是实际上model.productionInfo是string

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文