mooho-base-admin-plus 2.10.59 → 2.10.61

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,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.10.59",
4
+ "version": "2.10.61",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -37,7 +37,6 @@
37
37
  import mixinPage from '../../mixins/page';
38
38
  import mixin from './mixin';
39
39
  import tableSetting from './table-setting.vue';
40
- import { readonly } from 'vue';
41
40
 
42
41
  // register Handsontable's modules
43
42
  registerAllModules();
@@ -56,7 +55,6 @@
56
55
  hotSetting: {
57
56
  themeName: 'ht-theme-main',
58
57
  colHeaders: true,
59
- rowHeaders: true,
60
58
  height: 'auto',
61
59
  // columns: [],
62
60
  autoWrapCol: true,
@@ -104,14 +102,17 @@
104
102
  this.$refs.table.hotInstance.addHook('beforeOnCellMouseUp', (event, coords) => {
105
103
  this.coords = coords;
106
104
  if (event.detail === 2 && coords.row >= 0 && !this.readonly) {
107
- // 双击弹出窗口
108
- let column = this.hotSetting.columns[coords.col];
109
- let data = this.$refs.table.hotInstance.getSourceData();
110
-
111
- if (column.controlType === 'DialogSelect' && !column.readonly) {
112
- this.$refs.dialogTable.init(column.source, () => {
113
- this.$refs.dialogTable.open(this.getParam(data[coords.row], column, this.parentData));
114
- });
105
+ let isReadonly = this.$refs.table.hotInstance.getCellMeta(coords.row, coords.col).readOnly;
106
+ if (!isReadonly) {
107
+ // 双击弹出窗口
108
+ let column = this.hotSetting.columns[coords.col];
109
+ //let data = this.$refs.table.hotInstance.getSourceData();
110
+
111
+ if (column.controlType === 'DialogSelect' && !column.readonly) {
112
+ this.$refs.dialogTable.init(column.source, () => {
113
+ this.$refs.dialogTable.open(this.getParam(this.staticData[coords.row], column, this.parentData));
114
+ });
115
+ }
115
116
  }
116
117
  }
117
118
  });
@@ -213,6 +214,9 @@
213
214
  this.tableView = view.dataView;
214
215
  this.tableView.columns = view.viewColumns;
215
216
 
217
+ // 序号
218
+ this.hotSetting.rowHeaders = this.tableView.snEnable;
219
+
216
220
  // 文本必填
217
221
  Handsontable.validators.registerValidator('text-required', (value, callback) => {
218
222
  if (!(value || '').trim()) {
@@ -266,132 +270,122 @@
266
270
  if (!this.readonly) {
267
271
  if (item.controlType === 'Label' || item.isReadonly == true) {
268
272
  column.readOnly = true;
269
- } else if (item.controlType === 'TextInput') {
270
- column.type = 'text';
271
-
272
- if (column.isRequired) {
273
- column.validator = 'text-required';
274
- }
275
- } else if (item.controlType === 'NumberInput') {
276
- column.type = 'numeric';
277
- if (column.isRequired) {
278
- column.validator = 'numeric-required';
279
- }
280
- // column.validator = 'numeric';
281
- } else if (item.controlType === 'Check') {
282
- column.type = 'checkbox';
283
- } else if (item.controlType === 'Select') {
284
- column.editor = 'select';
285
- if (column.isRequired) {
286
- column.validator = 'select-required';
287
- }
288
-
289
- let dataSource = [];
290
-
291
- if (column.isStaticItem) {
292
- if (!!(column.itemData || '').trim()) {
293
- column.itemData.split(/[\n]/).forEach(item => {
294
- if (!!(item || '').trim()) {
295
- if (item.split(':').length > 1) {
296
- let key = item.split(':')[0];
297
- let value = item.split(':')[1];
298
-
299
- if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
300
- dataSource.push({
301
- id: parseInt(key),
302
- name: value
303
- });
304
- } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
305
- dataSource.push({
306
- id: parseFloat(key),
307
- name: value
308
- });
309
- } else if (column.dataType == 'Boolean') {
310
- dataSource.push({
311
- id: key.toUpperCase() == 'TRUE',
312
- name: value
313
- });
314
- } else {
315
- dataSource.push({
316
- id: key,
317
- name: value
318
- });
319
- }
320
- } else {
321
- if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
322
- dataSource.push({
323
- id: parseInt(item),
324
- name: item
325
- });
326
- } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
327
- dataSource.push({
328
- id: parseFloat(item),
329
- name: item
330
- });
331
- } else if (column.dataType == 'Boolean') {
332
- dataSource.push({
333
- id: item.toUpperCase() == 'TRUE',
334
- name: item
335
- });
273
+ } else {
274
+ column.validator = this.getValidator(column);
275
+
276
+ if (item.controlType === 'TextInput') {
277
+ column.type = 'text';
278
+ } else if (item.controlType === 'NumberInput') {
279
+ column.type = 'numeric';
280
+ } else if (item.controlType === 'Check') {
281
+ column.type = 'checkbox';
282
+ } else if (item.controlType === 'Select') {
283
+ column.editor = 'select';
284
+
285
+ let dataSource = [];
286
+
287
+ if (column.isStaticItem) {
288
+ if (!!(column.itemData || '').trim()) {
289
+ column.itemData.split(/[\n]/).forEach(item => {
290
+ if (!!(item || '').trim()) {
291
+ if (item.split(':').length > 1) {
292
+ let key = item.split(':')[0];
293
+ let value = item.split(':')[1];
294
+
295
+ if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
296
+ dataSource.push({
297
+ id: parseInt(key),
298
+ name: value
299
+ });
300
+ } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
301
+ dataSource.push({
302
+ id: parseFloat(key),
303
+ name: value
304
+ });
305
+ } else if (column.dataType == 'Boolean') {
306
+ dataSource.push({
307
+ id: key.toUpperCase() == 'TRUE',
308
+ name: value
309
+ });
310
+ } else {
311
+ dataSource.push({
312
+ id: key,
313
+ name: value
314
+ });
315
+ }
336
316
  } else {
337
- dataSource.push({
338
- id: item,
339
- name: item
340
- });
317
+ if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
318
+ dataSource.push({
319
+ id: parseInt(item),
320
+ name: item
321
+ });
322
+ } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
323
+ dataSource.push({
324
+ id: parseFloat(item),
325
+ name: item
326
+ });
327
+ } else if (column.dataType == 'Boolean') {
328
+ dataSource.push({
329
+ id: item.toUpperCase() == 'TRUE',
330
+ name: item
331
+ });
332
+ } else {
333
+ dataSource.push({
334
+ id: item,
335
+ name: item
336
+ });
337
+ }
341
338
  }
342
339
  }
340
+ });
341
+ }
342
+ } else {
343
+ if (column.dataType.startsWith('Enum:')) {
344
+ // 枚举
345
+ dataSource = this.getEnumList(column.dataType.split(':')[1]);
346
+ } else if (!!(column.source || '').trim()) {
347
+ let param = this.getParam(null, column, this.parentData);
348
+
349
+ // 选择框、单选框组
350
+ this.disableLoader();
351
+ let res;
352
+ if (column.isSourceCustom) {
353
+ res = await customModelApi.query(column.source, param); //, [column.sourceDataCode, column.sourceDisplayCode]);
354
+ } else {
355
+ res = await modelApi.query(column.source, param); //, [column.sourceDataCode, column.sourceDisplayCode]);
343
356
  }
344
- });
345
- }
346
- } else {
347
- if (column.dataType.startsWith('Enum:')) {
348
- // 枚举
349
- dataSource = this.getEnumList(column.dataType.split(':')[1]);
350
- } else if (!!(column.source || '').trim()) {
351
- let param = this.getParam(null, column, this.parentData);
352
-
353
- // 选择框、单选框组
354
- this.disableLoader();
355
- let res;
356
- if (column.isSourceCustom) {
357
- res = await customModelApi.query(column.source, param); //, [column.sourceDataCode, column.sourceDisplayCode]);
358
- } else {
359
- res = await modelApi.query(column.source, param); //, [column.sourceDataCode, column.sourceDisplayCode]);
357
+ this.enableLoader();
358
+
359
+ dataSource = res.data.map(item => {
360
+ return {
361
+ id: !(column.sourceDataCode || '').trim() ? item.id : this.parseData(item, column.sourceDataCode),
362
+ name: this.parseData(item, column.sourceDisplayCode)
363
+ };
364
+ });
360
365
  }
361
- this.enableLoader();
362
-
363
- dataSource = res.data.map(item => {
364
- return {
365
- id: !(column.sourceDataCode || '').trim() ? item.id : this.parseData(item, column.sourceDataCode),
366
- name: this.parseData(item, column.sourceDisplayCode)
367
- };
368
- });
369
366
  }
370
- }
371
367
 
372
- column.selectOptions = dataSource.map(option => {
373
- return option.id;
374
- });
375
- } else if (item.controlType === 'Date') {
376
- column.type = 'date';
377
- if (column.isRequired) {
378
- column.validator = 'date-required';
368
+ column.selectOptions = dataSource.map(option => {
369
+ return option.id;
370
+ });
371
+ } else if (item.controlType === 'Date') {
372
+ column.type = 'date';
373
+ column.dateFormat = 'YYYY-MM-DD';
374
+ column.correctFormat = true;
375
+ // column.renderer = function (instance, td, row, col, prop, value, cellProperties) {
376
+ // if (value) {
377
+ // td.innerHTML = dateFormat(new Date(value), 'yyyy-MM-dd');
378
+ // console.log(instance);
379
+ // console.log(td);
380
+ // console.log(row);
381
+ // console.log(col);
382
+ // console.log(prop);
383
+ // console.log(value);
384
+ // console.log(cellProperties);
385
+ // }
386
+ // return td;
387
+ // };
379
388
  }
380
- column.dateFormat = 'YYYY-MM-DD';
381
- column.correctFormat = true;
382
- // column.renderer = function (instance, td, row, col, prop, value, cellProperties) {
383
- // if (value) {
384
- // td.innerHTML = dateFormat(new Date(value), 'yyyy-MM-dd');
385
- // console.log(instance);
386
- // console.log(td);
387
- // console.log(row);
388
- // console.log(col);
389
- // console.log(prop);
390
- // console.log(value);
391
- // console.log(cellProperties);
392
- // }
393
- // return td;
394
- // };
395
389
  }
396
390
  }
397
391
 
@@ -661,6 +655,28 @@
661
655
  }
662
656
  });
663
657
  },
658
+ // 获取验证器
659
+ getValidator(column) {
660
+ if (column.controlType === 'TextInput' || column.controlType === 'Select' || column.controlType === 'DialogSelect') {
661
+ if (column.isRequired) {
662
+ return 'text-required';
663
+ } else {
664
+ return 'text';
665
+ }
666
+ } else if (column.controlType === 'NumberInput') {
667
+ if (column.isRequired) {
668
+ return 'numeric-required';
669
+ } else {
670
+ return 'numeric';
671
+ }
672
+ } else if (column.controlType === 'Date') {
673
+ if (column.isRequired) {
674
+ return 'date-required';
675
+ } else {
676
+ return 'date';
677
+ }
678
+ }
679
+ },
664
680
  /**
665
681
  * 加载数据
666
682
  *
@@ -850,16 +866,32 @@
850
866
  cells: (row, col, prop) => {
851
867
  let column = this.columns.find(item => item.code == prop);
852
868
 
869
+ let isShow = column.isShow;
870
+ let isReadonly = column.isReadonly;
871
+
853
872
  // 判断是否只读
854
873
  if (!!(column.readonlyJson || '').trim()) {
855
874
  let setting = JSON.parse(column.readonlyJson);
856
875
 
857
876
  if (setting.type == 'Condition' || setting.type == 'Expression') {
858
- let readOnly = this.judgeCondition(setting, this.staticData[row]);
877
+ isReadonly = this.judgeCondition(setting, this.staticData[row]);
878
+ }
879
+ }
880
+
881
+ // 判断是否显示
882
+ if (!!(column.showJson || '').trim()) {
883
+ let setting = JSON.parse(column.showJson);
859
884
 
860
- return { readOnly };
885
+ if (setting.type == 'Condition' || setting.type == 'Expression') {
886
+ isShow = this.judgeCondition(setting, this.staticData[row]);
861
887
  }
862
888
  }
889
+
890
+ if (!isShow) {
891
+ this.setData(this.staticData[row], prop, null);
892
+ }
893
+
894
+ return { readOnly: !isShow || isReadonly, validator: !isShow ? null : this.getValidator(column) };
863
895
  }
864
896
  });
865
897
  },
@@ -1151,7 +1151,8 @@
1151
1151
  title: this.$t('Front_Label_Sn'),
1152
1152
  slot: 'sn',
1153
1153
  align: 'center',
1154
- width: 60
1154
+ width: 60,
1155
+ fixed: this.columns.some(item => item.isFixed) ? 'left' : null
1155
1156
  });
1156
1157
  }
1157
1158
 
@@ -1 +1 @@
1
- import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
1
+ import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
@@ -1 +1 @@
1
- const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
1
+ const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
@@ -1 +1 @@
1
- import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};
1
+ import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};