ocpview-plus 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,77 +1,120 @@
1
1
  <template>
2
- <div >
3
- <Card :padding="0" dis-hover :bordered="false" style="background:#fff;padding:14px 16px 14px 16px">
4
- <div ref="toolbar" style="padding-bottom:14px">
5
- <QueryBar :config="myConfig.queryConfig" :dictData="dictData" :moduleMethod="moduleMethod" @conditionAction="conditionAction" @doAction="doAction"/>
6
- </div>
7
- <Card class="billquerygrid" :padding="0" :bordered="false" dis-hover>
8
- <Dropdown trigger="custom" :visible="colsetFlag" style="position:absolute;z-index:99;right:15px;top:1px;padding:7.5px; background-color: #F5F7FA;" placement="bottom-end" :transfer="transferFlag" @on-clickoutside="closeColset">
9
- <Tooltip placement="top">
10
- <template #content>
11
- <div>
12
- <span style="font-size:12px"> 表头设计 </span>
13
- </div>
2
+ <div>
3
+ <Card
4
+ :padding="0"
5
+ dis-hover
6
+ :bordered="false"
7
+ style="background: #fff; padding: 14px 16px 14px 16px"
8
+ >
9
+ <div ref="toolbar" style="padding-bottom: 14px">
10
+ <QueryBar
11
+ :config="myConfig.queryConfig"
12
+ :dictData="dictData"
13
+ :moduleMethod="moduleMethod"
14
+ @conditionAction="conditionAction"
15
+ @doAction="doAction"
16
+ />
17
+ </div>
18
+ <Card
19
+ class="billquerygrid"
20
+ :padding="0"
21
+ :bordered="false"
22
+ dis-hover
23
+ >
24
+ <Dropdown
25
+ trigger="custom"
26
+ :visible="colsetFlag"
27
+ style="
28
+ position: absolute;
29
+ z-index: 99;
30
+ right: 15px;
31
+ top: 1px;
32
+ padding: 7.5px;
33
+ background-color: #f5f7fa;
34
+ "
35
+ placement="bottom-end"
36
+ :transfer="transferFlag"
37
+ @on-clickoutside="closeColset"
38
+ >
39
+ <Tooltip placement="top">
40
+ <template #content>
41
+ <div>
42
+ <span style="font-size: 12px"> 表头设计 </span>
43
+ </div>
44
+ </template>
45
+ <p style="cursor: pointer" @click.stop="openColSet">
46
+ <Icon
47
+ custom="iconfont icon-custom-colset"
48
+ style="margin-top: 4px"
49
+ size="16"
50
+ color="#515a6e"
51
+ />
52
+ </p>
53
+ </Tooltip>
54
+ <template #list>
55
+ <DropdownMenu>
56
+ <GridColSet
57
+ ref="gridcol"
58
+ :config="myConfig.gridConfig"
59
+ @doAction="doAction"
60
+ />
61
+ </DropdownMenu>
14
62
  </template>
15
- <p style="cursor:pointer;" @click.stop="openColSet">
16
- <Icon custom="iconfont icon-custom-colset" style="margin-top: 4px;" size="16" color="#515a6e"/>
17
- </p>
18
- </Tooltip>
19
- <template #list>
20
- <DropdownMenu>
21
- <GridColSet ref="gridcol" :config="myConfig.gridConfig" @doAction="doAction" />
22
- </DropdownMenu>
23
- </template>
24
- </Dropdown>
25
- <SimpleViewGrid v-if="reset" ref="grid" :config="changeGridConfig" :dictData="dictData" @dbclick="dbclick" />
63
+ </Dropdown>
64
+ <SimpleViewGrid
65
+ v-if="reset"
66
+ ref="grid"
67
+ :config="changeGridConfig"
68
+ :dictData="dictData"
69
+ @dbclick="dbclick"
70
+ />
71
+ </Card>
26
72
  </Card>
27
- </Card>
28
- </div>
73
+ </div>
29
74
  </template>
30
75
 
31
76
  <script>
32
-
33
- import elementResizeDetectorMaker from 'element-resize-detector';
34
- import QueryBar from './querybar.vue';
35
- import GridColSet from './gridcolset.vue';
36
- import { resolveComponent } from 'vue';
77
+ import elementResizeDetectorMaker from "element-resize-detector";
78
+ import QueryBar from "./querybar.vue";
79
+ import GridColSet from "./gridcolset.vue";
80
+ import { resolveComponent } from "vue";
37
81
  export default {
38
- name:'mbillquerygrid',
39
- components:{QueryBar,GridColSet},
40
- data () {
82
+ name: "mbillquerygrid",
83
+ components: { QueryBar, GridColSet },
84
+ data() {
41
85
  return {
42
- myConfig:{
43
- },
44
- changeGridConfig:{},
45
- reset:true,
46
- rowBtnData:[],
47
- transferFlag:false,
48
- colsetFlag:false,
49
- operateFlag:false,
50
- enablePermissions:true,
51
- actionConfig:{},
52
- initRefresh:true,
53
- gridCol:[]
86
+ myConfig: {},
87
+ changeGridConfig: {},
88
+ reset: true,
89
+ rowBtnData: [],
90
+ transferFlag: false,
91
+ colsetFlag: false,
92
+ operateFlag: false,
93
+ enablePermissions: true,
94
+ actionConfig: {},
95
+ initRefresh: true,
96
+ gridCol: [],
54
97
  };
55
98
  },
56
- props:{
99
+ props: {
57
100
  config: {
58
- type:Object,
59
- default:null
101
+ type: Object,
102
+ default: null,
60
103
  },
61
104
  dictData: {
62
105
  type: Object,
63
- default:null
106
+ default: null,
64
107
  },
65
- moduleMethod:{
66
- type:Array,
108
+ moduleMethod: {
109
+ type: Array,
67
110
  default: () => {
68
- return [];
69
- }
70
- }
111
+ return [];
112
+ },
113
+ },
71
114
  },
72
- created () {
73
- this.myConfig = Object.assign({},this.myConfig, this.config);
74
- this.myConfig.gridConfig.headStyle='';
115
+ created() {
116
+ this.myConfig = Object.assign({}, this.myConfig, this.config);
117
+ this.myConfig.gridConfig.headStyle = "";
75
118
  this.myConfig.gridConfig.showCondition = false;
76
119
  this.myConfig.gridConfig.overrideData = this.gridOverrideData;
77
120
  this.myConfig.gridConfig.onSelectionChange = this.gridOnSelectionChange;
@@ -80,24 +123,31 @@ export default {
80
123
  this.myConfig.gridConfig.adjustHeight = 5;
81
124
  this.myConfig.gridConfig.showBorder = true;
82
125
  this.myConfig.gridConfig.showStripe = true;
83
- this.myConfig.gridConfig.method = this.config.classPrefix + '.search';
126
+ this.myConfig.gridConfig.method = this.config.classPrefix + ".search";
84
127
  this.myConfig.gridConfig.response = this.config.response;
85
128
  this.myConfig.gridConfig.generalOrientation = true;
86
- this.myConfig.gridConfig.pageSize="small";
87
- this.myConfig.gridConfig.items.forEach(el => {
88
- if (el.type !== 'CheckBox') {
129
+ this.myConfig.gridConfig.pageSize = "small";
130
+ this.myConfig.gridConfig.items.forEach((el) => {
131
+ if (el.type !== "CheckBox") {
89
132
  if (el.tooltip === undefined) {
90
133
  el.tooltip = true;
91
134
  }
92
- if (el.resizable === undefined) {
93
- el.resizable = true;
135
+ if (el.resizable === undefined) {
136
+ el.resizable = true;
94
137
  }
95
138
  }
139
+ // 新增:为 ComboBox 设置 codeWithName 默认值
140
+ if (el.type === "ComboBox" && el.codeWithName === undefined) {
141
+ el.codeWithName =
142
+ this.OmdUrl.billQueryComboBoxCodeWithName !== undefined
143
+ ? this.OmdUrl.billQueryComboBoxCodeWithName
144
+ : true; // 默认值为 true 表示有编码
145
+ }
96
146
  });
97
147
  if (this.myConfig.gridConfig.initRefresh !== undefined) {
98
148
  this.initRefresh = this.myConfig.gridConfig.initRefresh;
99
149
  }
100
- if (this.myConfig.enablePermissions !== undefined) {
150
+ if (this.myConfig.enablePermissions !== undefined) {
101
151
  this.enablePermissions = this.myConfig.enablePermissions;
102
152
  }
103
153
  if (this.myConfig.rowBtnData) {
@@ -106,47 +156,55 @@ export default {
106
156
  if (this.rowBtnData.length > 0) {
107
157
  this.initRowBtn();
108
158
  }
109
-
159
+
110
160
  this.myConfig.queryConfig = {};
111
161
  this.myConfig.queryConfig.curHelpUrl = this.config.curHelpUrl;
112
- this.myConfig.queryConfig.items = this.$Method.copy(this.myConfig.gridConfig.items);
162
+ this.myConfig.queryConfig.items = this.$Method.copy(
163
+ this.myConfig.gridConfig.items,
164
+ );
113
165
  this.myConfig.queryConfig.modulecode = this.config.modulecode;
114
166
  this.myConfig.queryConfig.enablePermissions = this.enablePermissions;
115
167
  if (this.myConfig.btnData) {
116
168
  this.myConfig.queryConfig.btnData = this.myConfig.btnData;
117
169
  }
118
- if (this.myConfig.addDataflag) {
170
+ if (this.myConfig.addDataflag) {
119
171
  this.myConfig.queryConfig.addDataflag = this.myConfig.addDataflag;
120
172
  }
121
173
  if (this.myConfig.usercustominfo) {
122
174
  if (this.myConfig.usercustominfo.filterscene) {
123
- this.myConfig.queryConfig.sceneData = this.$Method.copy(this.myConfig.usercustominfo.filterscene);
175
+ this.myConfig.queryConfig.sceneData = this.$Method.copy(
176
+ this.myConfig.usercustominfo.filterscene,
177
+ );
124
178
  }
125
179
  if (this.myConfig.usercustominfo.colset) {
126
- this.gridCol = JSON.parse(this.$Method.copy(this.myConfig.usercustominfo.colset)) ;
127
- }
180
+ this.gridCol = JSON.parse(
181
+ this.$Method.copy(this.myConfig.usercustominfo.colset),
182
+ );
183
+ }
128
184
  }
129
185
 
130
186
  this.setChangeGridConfig();
131
187
  },
132
188
  methods: {
133
- initRowBtn () {
189
+ initRowBtn() {
134
190
  if (this.enablePermissions) {
135
191
  let btns = [];
136
- this.moduleMethod.forEach(el => {
137
- let btn = this.rowBtnData.find(el2 => el.name === el2.name);
192
+ this.moduleMethod.forEach((el) => {
193
+ let btn = this.rowBtnData.find(
194
+ (el2) => el.name === el2.name,
195
+ );
138
196
  if (btn) {
139
- btns.push(btn);
197
+ btns.push(btn);
140
198
  }
141
199
  });
142
200
  this.rowBtnData = btns;
143
201
  }
144
202
  if (this.rowBtnData.length > 0) {
145
- this.actionConfig.label = '操作';
146
- this.actionConfig.key = 'actionbtn';
147
- this.actionConfig.align = 'center';
203
+ this.actionConfig.label = "操作";
204
+ this.actionConfig.key = "actionbtn";
205
+ this.actionConfig.align = "center";
148
206
  this.actionConfig.render = this.actionRender;
149
- this.actionConfig.fixed= 'right';
207
+ this.actionConfig.fixed = "right";
150
208
  if (this.rowBtnData.length > 3) {
151
209
  this.actionConfig.width = 200;
152
210
  } else {
@@ -156,19 +214,19 @@ export default {
156
214
  this.operateFlag = true;
157
215
  }
158
216
  },
159
- actionRender (h, params) {
160
- return h('div', [
161
- h(resolveComponent('RowBtnToolbar'), {
162
- config:{items:this.rowBtnData},
163
- onDoAction: (val) => {
164
- val.rowinfo = params;
165
- this.$emit('doAction',val);
166
- }
167
- })
217
+ actionRender(h, params) {
218
+ return h("div", [
219
+ h(resolveComponent("RowBtnToolbar"), {
220
+ config: { items: this.rowBtnData },
221
+ onDoAction: (val) => {
222
+ val.rowinfo = params;
223
+ this.$emit("doAction", val);
224
+ },
225
+ }),
168
226
  ]);
169
227
  },
170
- doAction (obj) {
171
- if (obj.name === 'saveGridCol') {
228
+ doAction(obj) {
229
+ if (obj.name === "saveGridCol") {
172
230
  this.gridCol = this.$Method.copy(obj.para);
173
231
  this.colsetFlag = false;
174
232
  this.setChangeGridConfig();
@@ -177,31 +235,35 @@ export default {
177
235
  this.reset = true;
178
236
  this.$nextTick(() => {
179
237
  this.refurbish();
180
- })
181
- })
182
- } else if (obj.name === 'closeGridCol') {
183
- this.colsetFlag = false;
184
- return;
238
+ });
239
+ });
240
+ } else if (obj.name === "closeGridCol") {
241
+ this.colsetFlag = false;
242
+ return;
185
243
  } else {
186
- if (obj.name !== 'saveScene') {
244
+ if (obj.name !== "saveScene") {
187
245
  obj.para = this.$refs.grid.getSelection();
188
246
  }
189
247
  }
190
- this.$emit('doAction', obj);
248
+ this.$emit("doAction", obj);
191
249
  },
192
- gridOverrideData (data) {
250
+ gridOverrideData(data) {
193
251
  let self = this;
194
252
  if (data && data.length > 0) {
195
253
  this.$nextTick(() => {
196
254
  let index = 0;
197
255
  if (self.ph_key) {
198
- let culIndex = data.findIndex(el => el[self.myConfig.gridConfig.bindSearchParam]=== self.ph_key);
256
+ let culIndex = data.findIndex(
257
+ (el) =>
258
+ el[self.myConfig.gridConfig.bindSearchParam] ===
259
+ self.ph_key,
260
+ );
199
261
  if (culIndex > -1) {
200
262
  index = culIndex;
201
263
  }
202
264
  }
203
- if(this.$refs.grid) {
204
- this.$refs.grid.setRowHighlight(index,true);
265
+ if (this.$refs.grid) {
266
+ this.$refs.grid.setRowHighlight(index, true);
205
267
  }
206
268
  });
207
269
  }
@@ -209,15 +271,15 @@ export default {
209
271
  },
210
272
  gridOnSelectionChange(rows) {
211
273
  let obj = {};
212
- obj.name = 'gridSelectionChange';
274
+ obj.name = "gridSelectionChange";
213
275
  obj.para = rows;
214
- this.$emit('doAction', obj);
276
+ this.$emit("doAction", obj);
215
277
  },
216
- clearData () {
278
+ clearData() {
217
279
  this.$refs.quick.clearData();
218
280
  this.refurbish();
219
281
  },
220
- refurbish (para) {
282
+ refurbish(para) {
221
283
  if (!para) {
222
284
  para = {};
223
285
  }
@@ -225,50 +287,53 @@ export default {
225
287
  this.$refs.grid.setSearchBeforeSearchParam(para);
226
288
  this.$refs.grid.refurbish();
227
289
  },
228
- getGrid () {
290
+ getGrid() {
229
291
  return this.$refs.grid;
230
292
  },
231
293
  getBtnToolbar() {
232
294
  return this.$refs.btn;
233
295
  },
234
- getQuick () {
296
+ getQuick() {
235
297
  return this.$refs.quick;
236
298
  },
237
- dbclick (e) {
299
+ dbclick(e) {
238
300
  let obj = {};
239
- obj.name ='gridDbClick';
301
+ obj.name = "gridDbClick";
240
302
  obj.para = e;
241
303
  this.ph_key = obj.para[this.myConfig.gridConfig.bindSearchParam];
242
- this.$emit('doAction', obj);
304
+ this.$emit("doAction", obj);
243
305
  },
244
306
  setPhkey(value) {
245
307
  this.ph_key = value;
246
308
  },
247
- quickChagne () {
309
+ quickChagne() {
248
310
  this.refurbish();
249
311
  },
250
312
  setOutsideHeight() {
251
- let height = this.$refs.toolbar.offsetHeight + 30;
313
+ let height = this.$refs.toolbar.offsetHeight + 30;
252
314
  this.$refs.grid.setOutsideHeight(height);
253
315
  },
254
316
  openColSet() {
255
317
  this.colsetFlag = true;
256
318
  },
257
- closeColset() {
319
+ closeColset() {
258
320
  this.colsetFlag = false;
259
321
  },
260
322
  setChangeGridConfig() {
261
- this.changeGridConfig = this.$Method.copy(this.myConfig.gridConfig);
323
+ this.changeGridConfig = this.$Method.copy(this.myConfig.gridConfig);
262
324
  let isFixed = false;
263
325
  if (this.gridCol.length > 0) {
264
326
  let items = [];
265
- this.gridCol.forEach(el => {
266
- if(el.name && el.visible) {
267
- let tmp = this.myConfig.gridConfig.items.find(el2 => el.name === el2.name || el.name === el2.sname);
327
+ this.gridCol.forEach((el) => {
328
+ if (el.name && el.visible) {
329
+ let tmp = this.myConfig.gridConfig.items.find(
330
+ (el2) =>
331
+ el.name === el2.name || el.name === el2.sname,
332
+ );
268
333
  if (tmp) {
269
334
  let tmp2 = this.$Method.copy(tmp);
270
335
  if (el.fixed) {
271
- tmp2.fixed = 'left';
336
+ tmp2.fixed = "left";
272
337
  if (!isFixed) {
273
338
  isFixed = true;
274
339
  }
@@ -285,16 +350,18 @@ export default {
285
350
  }
286
351
  },
287
352
  conditionAction(action) {
288
- if (action.name === 'condition_search' || action.name === 'condition_searchFilter') {
353
+ if (
354
+ action.name === "condition_search" ||
355
+ action.name === "condition_searchFilter"
356
+ ) {
289
357
  this.refurbish(action.para);
290
358
  }
291
- if (action.name === 'condition_clear') {
359
+ if (action.name === "condition_clear") {
292
360
  this.refurbish();
293
361
  }
294
- }
295
-
362
+ },
296
363
  },
297
- mounted () {
364
+ mounted() {
298
365
  this.observer = elementResizeDetectorMaker();
299
366
  if (this.$refs.toolbar) {
300
367
  this.observer.listenTo(this.$refs.toolbar, this.setOutsideHeight);
@@ -305,12 +372,14 @@ export default {
305
372
  if (this.gridCol.length > 0) {
306
373
  this.$refs.gridcol.setData(this.gridCol);
307
374
  }
308
-
309
375
  },
310
376
  beforeUnmount() {
311
377
  if (this.$refs.toolbar) {
312
- this.observer.removeListener(this.$refs.toolbar, this.setOutsideHeight);
378
+ this.observer.removeListener(
379
+ this.$refs.toolbar,
380
+ this.setOutsideHeight,
381
+ );
313
382
  }
314
- }
383
+ },
315
384
  };
316
385
  </script>