ocpview-pro 0.1.2 → 0.1.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpview-pro",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -26,6 +26,7 @@
26
26
  :loading="loading"
27
27
  :sort-config="{ remote: true, trigger: 'cell' }"
28
28
  :seq-config="seqConfig"
29
+ :cell-style="cellStyleMethod"
29
30
  @sort-change="RewriteTableOnSortChange"
30
31
  @cell-dblclick="RewriteTableCellDBlclick"
31
32
  >
@@ -347,6 +348,22 @@ export default {
347
348
  const { row } = params;
348
349
  this.dbclick(row);
349
350
  },
351
+ /**
352
+ * 单据状态列颜色渲染
353
+ */
354
+ cellStyleMethod({ row, column }) {
355
+ const item = this.tableColumns.find(
356
+ (c) => c.name === column.field
357
+ );
358
+ if (item && item._colorMap) {
359
+ const code = row[column.field];
360
+ const color = item._colorMap[code];
361
+ if (color) {
362
+ return { color };
363
+ }
364
+ }
365
+ return {};
366
+ },
350
367
  },
351
368
  mounted() {
352
369
  // console.log("我继承覆写了22222", this.myConfig);
@@ -78,6 +78,19 @@ import elementResizeDetectorMaker from "element-resize-detector";
78
78
  import QueryBar from "./querybar.vue";
79
79
  import GridColSet from "./gridcolset.vue";
80
80
  import { resolveComponent } from "vue";
81
+ const columnColorConfig = {
82
+ billstatus: {
83
+ A: "#FA8C16",
84
+ N: "#1677FF",
85
+ S: "#1677FF",
86
+ Q: "#F5222D",
87
+ T: "#F5222D",
88
+ W: "#FA8C16",
89
+ X: "#00875A",
90
+ Y: "#52C41A",
91
+ C: "#666666",
92
+ },
93
+ };
81
94
  export default {
82
95
  name: "mbillquerygrid",
83
96
  components: { QueryBar, GridColSet },
@@ -140,12 +153,14 @@ export default {
140
153
  ? this.OmdUrl.billQueryComboBoxCodeWithName
141
154
  : true; // 默认值为 true 表示有编码
142
155
  }
156
+ this.injectColumnRender(el);
143
157
  });
144
158
  if (this.myConfig.gridConfig.initRefresh !== undefined) {
145
159
  this.initRefresh = this.myConfig.gridConfig.initRefresh;
146
160
  }
147
161
  if (!this.myConfig.gridConfig.method) {
148
- this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
162
+ this.myConfig.gridConfig.method =
163
+ this.myConfig.classPrefix + ".search";
149
164
  }
150
165
  if (!this.myConfig.gridConfig.resources) {
151
166
  this.myConfig.gridConfig.resources = this.config.resources;
@@ -166,7 +181,7 @@ export default {
166
181
  this.myConfig.queryConfig = {};
167
182
  this.myConfig.queryConfig.curHelpUrl = this.config.curHelpUrl;
168
183
  this.myConfig.queryConfig.items = this.$Method.copy(
169
- this.myConfig.gridConfig.items,
184
+ this.myConfig.gridConfig.items
170
185
  );
171
186
  this.myConfig.queryConfig.modulecode = this.config.modulecode;
172
187
  this.myConfig.queryConfig.enablePermissions = this.enablePermissions;
@@ -179,12 +194,12 @@ export default {
179
194
  if (this.myConfig.usercustominfo) {
180
195
  if (this.myConfig.usercustominfo.filterscene) {
181
196
  this.myConfig.queryConfig.sceneData = this.$Method.copy(
182
- this.myConfig.usercustominfo.filterscene,
197
+ this.myConfig.usercustominfo.filterscene
183
198
  );
184
199
  }
185
200
  if (this.myConfig.usercustominfo.colset) {
186
201
  this.gridCol = JSON.parse(
187
- this.$Method.copy(this.myConfig.usercustominfo.colset),
202
+ this.$Method.copy(this.myConfig.usercustominfo.colset)
188
203
  );
189
204
  }
190
205
  }
@@ -192,12 +207,33 @@ export default {
192
207
  this.setChangeGridConfig();
193
208
  },
194
209
  methods: {
210
+ injectColumnRender(el) {
211
+ const colorMap = columnColorConfig[el.name];
212
+ if (
213
+ !colorMap ||
214
+ el.type !== "ComboBox" ||
215
+ el.render !== undefined
216
+ ) {
217
+ return;
218
+ }
219
+ const fieldName = el.name;
220
+ el.render = (h, params) => {
221
+ const code = params.row[fieldName];
222
+ const color = colorMap[code];
223
+ const text = this.$Method.formatComboBox(code, params.column);
224
+ if (color) {
225
+ return h("span", { style: { color } }, text);
226
+ }
227
+ return h("span", text);
228
+ };
229
+ el._colorMap = colorMap;
230
+ },
195
231
  initRowBtn() {
196
232
  if (this.enablePermissions) {
197
233
  let btns = [];
198
234
  this.moduleMethod.forEach((el) => {
199
235
  let btn = this.rowBtnData.find(
200
- (el2) => el.name === el2.name,
236
+ (el2) => el.name === el2.name
201
237
  );
202
238
  if (btn) {
203
239
  btns.push(btn);
@@ -262,7 +298,7 @@ export default {
262
298
  let culIndex = data.findIndex(
263
299
  (el) =>
264
300
  el[self.myConfig.gridConfig.bindSearchParam] ===
265
- self.ph_key,
301
+ self.ph_key
266
302
  );
267
303
  if (culIndex > -1) {
268
304
  index = culIndex;
@@ -334,7 +370,7 @@ export default {
334
370
  if (el.name && el.visible) {
335
371
  let tmp = this.myConfig.gridConfig.items.find(
336
372
  (el2) =>
337
- el.name === el2.name || el.name === el2.sname,
373
+ el.name === el2.name || el.name === el2.sname
338
374
  );
339
375
  if (tmp) {
340
376
  let tmp2 = this.$Method.copy(tmp);
@@ -383,7 +419,7 @@ export default {
383
419
  if (this.$refs.toolbar) {
384
420
  this.observer.removeListener(
385
421
  this.$refs.toolbar,
386
- this.setOutsideHeight,
422
+ this.setOutsideHeight
387
423
  );
388
424
  }
389
425
  },