zhuguifei
2026-03-10 58402bd5e762361363a0f7d7907153c77dbb819f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
        var sparePartGrid;
        $(function(){
            sparePartGrid = $('#sparePartGrid').datagrid({
                fit : true,
                fitColumns : true,
                border : false,
                pagination : true,
                idField : 'id',
                striped : true,
                rownumbers :true,
                pageSize : 10,
                pageList : [ 10, 20, 30, 40, 50 ],
                sortName : 'id',
                sortOrder : 'desc',
                singleSelect:true,
                checkOnSelect : true,
                selectOnCheck : false,
                nowrap : false,
                showPageList:false,
                columns : [ [ {
                    field : 'id',
                    title : '编号',
                    hidden:true
                },{
                    field : 'name',
                    title : '名称',
                    align:'center',
                    width:200,
                    sortable : true
                }, {
                    field : 'number',
                    title : '库存',
                    width:100,
                    align:'center',
                }, {
                    field : 'type',
                    title : '型号',
                    width:200,
                    align:'center',
                }, {
                    field : 'num',
                    title : '使用数量',
                    width:200,
                    align:'center',
                    editor:{
                        type:'numberbox',
                        options:{
                            valueField:'num', 
                            min:0,
                            precision:2
                        }
                    }
                }] ],
                toolbar : '#topToolbar',
                onLoadSuccess : function() {
                    $(this).datagrid('tooltip');
                },
                onDblClickCell:function(rowIndex, field, value){
                    $(this).datagrid('beginEdit', rowIndex);
                    var ed = $(this).datagrid('getEditor', {index:rowIndex,field:field});
                    $(ed.target).focus();
                },
                onAfterEdit:function(rowIndex, rowData, changes){
                    changes.id=rowData.id;
                    //保存备件更换信息
                    saveSparePart(changes);
                }
            });
        });
        //查询备件
        function querySparePart(){
            sparePartGrid.datagrid({
                url : "${pageContext.request.contextPath}/pms/overhaul/chooseSparePart.do",
                queryParams :$("#searchForm").form("getData"),
                onLoadError : function(data) {
                    $.messager.show('提示', "查询备件信息异常!", 'error');
                }
            });
            $('#sparePartGrid').datagrid('clearSelections');
        }
        //保存备件的使用信息
        function saveSparePart(partsInfo){
            var cid="${param.callId}";
            partsInfo.callId=cid;
            $.post("${pageContext.request.contextPath}/pms/overhaul/saveChooseSparePart.do",partsInfo,function(json){
                if (json.success) {
                    $.messager.show('提示', json.msg, 'info');
                }else{
                    $.messager.show('提示', json.msg, 'error');
                }
            },"JSON");
        }
        
</script>
<div class="easyui-layout" data-options="fit : true,border : false">
<div data-options="region:'center',border:false">
        <div id="topToolbar"  style="display: none;width:100%;">
            <form id="searchForm" style="margin:4px 0px 0px 0px;">
                <div class="topTool">
                    <fieldset>
                        <div>
                            <span class="label" style="width:90px">名称:</span>
                            <input id="stim" name="desc" type="text"  style="width:120px"/>
                        </div>    
                    </fieldset>
                </div>
            </form>
            <div class="easyui-toolbar" >
                    <a onclick="querySparePart()" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-standard-zoom'">查询</a>
                    <a onclick="clearForm();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-standard-table-refresh'">重置</a>
            </div>
        </div>
    <table id="sparePartGrid"></table>
</div>    
</div>