动态生成表格并实现数据回显
<tr id="newRow">
<td width= "16% " colspan="1">
<p align="center">设备类别</p>
</td>
<td width= "16% " colspan="1">
<p align="center">设备编号</p>
</td>
<td width= "16% " colspan="1">
<p align="center">资产编号</p>
</td>
<td width= "9% " colspan="2">
<p align="center">单位</p>
</td>
<td width= "12% " colspan="1">
<p align="center">规格型号</p>
</td>
<td width= "10% " colspan="1">
<p align="center">产权所属</p>
</td>
<td width= "10% " colspan="1">
<p align="center">数量</p>
</td>
<td width= "80% " colspan="1">
<p align="center">单位(元)</p>
</td>
<td width= "80% " colspan="1">
<p align="center">安装费用(元)</p>
</td>
<td width= "80%" colspan="2">
<p align="center">合计(元)</p>
</td>
</tr>
<td width= "16% " colspan="1">
<input name="deviceName" id="deviceName" class="easyui-combobox" disabled style="width: 100px;">
</td>
<td width= "16% " colspan="1">
<input name="deviceNumber" disabled style="width: 100px;">
</td>
<td width= "16% " colspan="1">
<input name="assetsNumber" disabled style="width: 100px;">
</td>
<td width= "9% " colspan="2">
<input name="company" disabled style="width: 120px;">
</td>
<td width= "12% " colspan="1">
<input name="deviceSpec" disabled disabled style="width: 50px;">
</td>
<td width= "10% " colspan="1">
<input name="deviceSpec" disabled class="easyui-combobox" style="width: 40px;">
</td>
<td width= "10% " colspan="1">
<input name="number" value="123145" disabled style="width: 50px;">
</td>
<td width= "100% " colspan="1">
<input name="unitMoney" value="123145" disabled style="width: 56px;">
</td>
<td width= "100% " colspan="1">
<input name="installMoney" value="123145" disabled style="width: 50px;">
</td>
<td width= "100% " colspan="2">
<input name="total" value="12314121" disabled style="width: 70px;">
</td>
</tr>
动态生成表格行
key = $.util.request["deviceInstallCheckId"];
$.get("security/installapplycheckvo/getUid/" + key, function (data) {
debugger;
_this.getMainData = data;
$("#submit_form").form("load", data.data.installApplyCheckVo);
//初始化字典数据
$Core.DicCache.initDictionary("installdevName,publicserviceName,stockState,stockDeviceState,propertyAscription,installdevName", function () {
$.each(data.data.deviceUserList, function (k, j) {
var deviceName = j.deviceName;
var propertyAscription = j.propertyAscription;
var appendRow ="<tr> <td width= '16% ' colspan='1'> <input name='deviceName' id='deviceName' class='easyui-combobox' value='"+$Core.DicCache.get("installdevName")[deviceName]+
"'disabled style='width: 100px;'></td><td width= '16% ' colspan='1'> <input name='deviceNumber' value='"+j.deviceNumber+
"'disabled style='width: 100px;'></td><td width= '16% ' colspan='1'> <input name='assetsNumber' value='"+j.assetsNumber+
"'disabled style='width: 100px;'></td> <td width= '9% ' colspan='2'> <input name='company' value='"+j.company+
"'disabled style='width: 120px;'></td> <td width= '12% ' colspan='1'> <input name='deviceSpec' value='"+j.deviceSpec+
"'disabled style='width: 50px;'></td> <td width= '10% ' colspan='1'> <input name='propertyAscription' id='propertyAscription' value='"+$Core.DicCache.get("propertyAscription")[propertyAscription]+
"'disabled class='easyui-combobox' style='width: 40px;'></td><td width= '10% ' colspan='1'> <input name='number' value='"+j.number+
"'disabled style='width: 50px;'></td> <td width= '100% ' colspan='1'> <input name='unitMoney' value='"+j.unitMoney+
"'disabled style='width: 56px;'></td><td width= '100% ' colspan='1'> <input name='installMoney' value='"+j.installMoney+
"'disabled style='width: 50px;'></td> <td width= '100% ' colspan='2'> <input name='total' value='"+j.total+
"'disabled style='width: 70px;'></td></tr>"
$("#newRow").after(appendRow);
});
});
@RestController
@RequestMapping("/installapplycheckvo")
public class InstallApplyCheckVoController
@GetMapping("/getUid/{deviceInstallCheckId}")
public AssembleJSON get(@PathVariable Integer deviceInstallCheckId){
if(deviceInstallCheckId == null){
return AssembleJSON.FAILURE("非法的参数", -2);
}
return AssembleJSON.SUCCESS(service.getUid(deviceInstallCheckId));
}
}
public interface InstallCheckVoService extends BaseService<InstallCheckVo>{
Map<String, Object> getUid(Integer ovId);
}
@Override
public Map<String, Object> getUid(Integer deviceInstallCheckId) {
// TODO Auto-generated method stub
Map<String, Object> map = new HashMap<>();
InstallApplyCheckVo installApplyCheckVo = installApplyCheckVoMapper.getUid(deviceInstallCheckId);
map.put("installApplyCheckVo", installApplyCheckVo);
//明细
InstallCheckItem installCheckItem = new InstallCheckItem();
installCheckItem.setInstallCheckId(deviceInstallCheckId);
List<InstallCheckItem> removeApplyItems = installCheckItemMapper.select(installCheckItem);
map.put("deviceUserList", removeApplyItems);
return map;
}
public interface InstallApplyCheckVoMapper extends Mapper<InstallApplyCheckVo>{
InstallApplyCheckVo getUid(@RequestParam(value = "deviceInstallCheckId", required = false)Integer deviceInstallCheckId);
}
<mapper namespace="com.userprofilemanager.installcheck.dao.InstallApplyCheckVoMapper">
<select id="getUid" parameterType="java.lang.Integer" resultType="com.userprofilemanager.installcheck.model.InstallApplyCheckVo">
SELECT * FROM view_apply_report WHERE deviceInstallCheckId=#{deviceInstallCheckId}
</select>
</mapper>