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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
| /**
| * 主数据申请处理
| * @author wangting
| * @date 2022-4-15
| */
| layui.define(['layer','element','form','table','dynamicCondition' ,'tree','transfer','mdm/MdmEngineForm'],function(exports){
| var webUtil = $webUtil;
| var Class = function(){
| this.MODELNAME = "mdm/MdmApply";
| this.moduleKey = "MdmApply";
| this.backPath = configData.compatibility? path:configData.mdmService;
| this.url = {
| controller:'ducking/',
| gridPreDataFinish:'gridPreDataFinish',
| gridPreDataUnFinish:'gridPreDataUnFinish',
| editSave:'editSave'
| };
| this.getContent = function (){
| var that = this;
| if(that.sourceData && "page" in that.sourceData){
| that.id = that.id + "_" + that.sourceData.page;
| }
| return '<div id="UIContent_' + that.id + '" style="overflow: auto;padding:0 5px"></div>';
| };
| this.showContent=function(){
| var html = "";
| var that = this;
| html = [
| '<div class="layui-center">',
| that.getToolbarHtml(),
| '<table id="table_', that.id , '" lay-filter="table_',that.id , '" style="overflow-x:auto;"></table>',
| '</div>',
| ].join("");
| $("#UIContent_" + that.id).html(html);
| };
| this.getToolbarHtml =function(){
| var that = this;
| var html = [
| '<div layui-filter="toolbar_',that.id,'" class="layui-btn-container layui-buttons">',
| (that.sourceData.page=='executing'?'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_'+ that.id+ '_SETCLASS"><i class="layui-icon layui-icon-delete"></i>维护分类</button>':''),
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_ADVQUERY"><i class="layui-icon layui-icon-search"></i>查询</button>',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_', that.id, '_refresh"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
| '</div>'];
| return html.join('');
| };
| this.createSearchHtml = function () {
| var that = this;
| webUtil.createSearchHtml({id:"模板编号",name:"模板名称"},$("[layui-filter='toolbar_" + that.id + "']"),'table_'+that.id);
| webUtil.bindDefultButtonLisenter(that, that.id);
|
| };
| this.config={}
| this.init = function(){
| var that = this;
| webUtil.copyConfig(that,that.moduleKey);
| this.config[that.id] = {
| sourceData:that.sourceData
| };
| that.showContent();
| that.initTable(that.id)
| this.createSearchHtml()
| };
| this.initTable=function (configId){
| var that = this;
| var table=layui.table;
| that.checkColumns(configId);
| table.render({
| elem: '#table_' + configId,
| id: 'table_'+configId,
| url:that.url.controller+(that.config[configId].sourceData.page=='executing'?that.url.gridPreDataUnFinish:that.url.gridPreDataFinish),
| backPath: that.backPath,
| page: {
| limit: 20,
| page: 1
| },
| selectMode: table.selectMode.single,
| cols: [that.columns],
| done: function (res, cur, total) {
| }
| });
| }
| this.checkColumns=function (configId) {
| var that = this;
| var table = layui.table;
| if (that.columns == null || that.columns.length == 0) {
| that.columns = [table.getIndexColumn(), table.getCheckColumn(),
| {
| field: 'unique',
| title: '图号',
| sort: true,
| width: 120
| }, {
| field: 'num',
| title: '编码',
| sort: true,
| width: 120
| }, {
| field: 'model',
| title: '规格型号',
| width: 120
| }, {
| field: 'parttype',
| title: '零件类型',
| width: 100
| }, {
| field: 'unit',
| title: '计量单位',
| width: 60
| }, {
| field: 'type',
| title: '主题库编号',
| width: 100
| }, {
| field: 'classifyname',
| title: '分类名称',
| width: 100
| }, {
| field: 'datacode',
| title: '数据返回状态',
| width: 90
| }, {
| field: 'datamsg',
| title: '数据返回提示',
| width: 150
| }];
| that.dataFields = [{
| field: 'unique',
| title: '图号'
| }, {
| field: 'num',
| title: '编码'
| }, {
| field: 'model',
| title: '规格型号'
| }, {
| field: 'parttype',
| title: '零件类型'
| }, {
| field: 'type',
| title: '主题库编号'
| }, {
| field: 'classifyname',
| title: '分类名称'
| }, {
| field: 'datacode',
| title: '数据返回状态',
| type: 'combox',
| comboxKey: [{key: "200", value: "200"}, {key: "400", value: "400"}, {key: "500", value: "500"}]
| }]
| }
| }
| this.refresh = function (type,button){
| var that = this;
| var configId=$(button).attr('layui-filter').split('_')[1]
| layui.table.reload('table_' + configId);
| };
| this.ADVQUERY = function (type,button) {
| var that = this;
| var configId=$(button).attr('layui-filter').split('_')[1]
| if (!that.config[configId].serinorQueryInstance) {
| var dynamicCondition = layui.dynamicCondition;
| $('[layui-filter="toolbar_' + configId + '"]').append('<div id="toolbar' + configId + '" class="layui-inline"></div>');
| that.checkColumns(configId);
| that.config[configId].serinorQueryInstance = dynamicCondition.create({
| fields: that.dataFields//查询字段
| , tableId: "table_" + configId//需要查询的表格
| , type: "complex" //type:"simple"/"complex" 查询的方法 暂时写死为 complex
| , queryCallBack: function (requestData) {//查询之后的callback
|
| }
| });
| }
| that.config[configId].serinorQueryInstance.open();
| };
| this.SETCLASS=function (type,button) {
| var that = this;
| var configId = $(button).attr('layui-filter').split('_')[1];
| var oid = webUtil.getOidFromGrid('table_' + configId,true,true);
| if(!oid){
| return;
| }
| layui.use('vciWebReferTree',function (){
| var treeRefer = layui['vciWebReferTree'];
| treeRefer.showReferDialog({
| filter:configId+"_classify",
| name:"wupin",
| title:'选择分类',
| target: {
| setValue: function (filter,name,value,rawValue,closeDialog,allValues){
| webUtil.manualAjax('put', that.url.controller+that.url.editSave, JSON.stringify({oid:oid,classifyoid:value}), function (result) {
| if (result.success) {
| webUtil.showMsgFromResult(result, "分类设置成功");
| that.refresh(null,button);
| } else {
| webUtil.showErrorMsg(result.msg);
| }
| }, function (xhr, err) {
| webUtil.showErrorMsg("请求服务出现了错误,可能服务器未开启");
| }, that.backPath);
| }
| },
| options: {
| backPath:that.backPath,
| url:'codeClassifyController/referTree',
| isMuti:false,
| isQueryAllColumn: true,
| onlyLeaf:true,
| rootParams:{
| "conditionMap['id']":'wupin'
| },
| }
| });
| });
| }
| };
| var cs = new Class();
| exports(cs.MODELNAME,cs);
| });
|
|