向input中输入数据报错
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误是 console.log(model.productionInfo.productionNo);
这一行报的吧?
从错误信息上看,原因是你以为它是Object对象,但是实际上model.productionInfo是string