@newview/ui 1.1.0 → 1.1.2
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/dist/newview-ui.js +158 -35
- package/dist/newview-ui.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/types/Grid.d.ts +11 -2
- package/types/LuckySheet.d.ts +11 -3
package/dist/newview-ui.js
CHANGED
|
@@ -8,11 +8,11 @@ import { BaseInstance } from "@newview/base-vue";
|
|
|
8
8
|
import { openBlock, createElementBlock, normalizeStyle, defineComponent, ref, resolveComponent, createVNode, reactive, watch, onMounted, onUnmounted, createBlock, withCtx, createElementVNode, Fragment, renderList, normalizeClass, withDirectives, createTextVNode, toDisplayString, createCommentVNode, createSlots, vShow, h, computed, nextTick, renderSlot, mergeProps, toHandlers, withModifiers, createApp, getCurrentInstance } from "vue";
|
|
9
9
|
import { VxeColumn, VxeColgroup, VxeGrid, VxeTable } from "vxe-table";
|
|
10
10
|
import { utilities } from "@newview/tools";
|
|
11
|
+
import { Space, Icon, Drawer, Button } from "view-ui-plus";
|
|
11
12
|
import dayjs from "dayjs";
|
|
12
13
|
import JSZip from "jszip";
|
|
13
14
|
import x2js from "x2js";
|
|
14
15
|
import linq from "linq";
|
|
15
|
-
import { Drawer, Space, Button } from "view-ui-plus";
|
|
16
16
|
import XLSX from "xlsx";
|
|
17
17
|
var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
18
18
|
(function() {
|
|
@@ -32382,6 +32382,11 @@ const propDefine$i = {
|
|
|
32382
32382
|
// 列配置项
|
|
32383
32383
|
type: Array,
|
|
32384
32384
|
default: () => []
|
|
32385
|
+
},
|
|
32386
|
+
xTable: {
|
|
32387
|
+
type: Object,
|
|
32388
|
+
default: () => {
|
|
32389
|
+
}
|
|
32385
32390
|
}
|
|
32386
32391
|
};
|
|
32387
32392
|
const _sfc_main$8 = defineComponent({
|
|
@@ -32630,6 +32635,19 @@ class GridColumnInstance extends BaseInstance {
|
|
|
32630
32635
|
}
|
|
32631
32636
|
return filterValue.toString();
|
|
32632
32637
|
};
|
|
32638
|
+
} else if (column.treeNode && this.utilities.isNull(column.format)) {
|
|
32639
|
+
column.format = (h2, params) => {
|
|
32640
|
+
const row = params.row;
|
|
32641
|
+
const hasChild = row.children && row.children.length > 0;
|
|
32642
|
+
let icon = "md-bookmarks";
|
|
32643
|
+
if (hasChild) {
|
|
32644
|
+
icon = this.props.xTable.isTreeExpandByRow(row) ? "ios-folder-open" : "ios-folder";
|
|
32645
|
+
}
|
|
32646
|
+
return h2(Space, { size: 4 }, () => [
|
|
32647
|
+
h2(Icon, { size: 16, type: icon, color: hasChild ? "#ff9900" : "#2db7f5" }),
|
|
32648
|
+
h2("span", row[column.field])
|
|
32649
|
+
]);
|
|
32650
|
+
};
|
|
32633
32651
|
}
|
|
32634
32652
|
}
|
|
32635
32653
|
/**
|
|
@@ -32671,7 +32689,7 @@ class GridColumnInstance extends BaseInstance {
|
|
|
32671
32689
|
}
|
|
32672
32690
|
//#endregion 事件 END
|
|
32673
32691
|
}
|
|
32674
|
-
const
|
|
32692
|
+
const GridColumn_vue_vue_type_style_index_0_scoped_1d0a8ef1_lang = "";
|
|
32675
32693
|
const _hoisted_1$6 = { class: "gridColumn" };
|
|
32676
32694
|
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
32677
32695
|
const _component_GridTitleContent = resolveComponent("GridTitleContent");
|
|
@@ -32693,7 +32711,10 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
32693
32711
|
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
32694
32712
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
|
|
32695
32713
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
32696
|
-
_ctx.getHasColgroup(column) ? (openBlock(), createBlock(_component_vxe_colgroup, {
|
|
32714
|
+
_ctx.getHasColgroup(column) ? (openBlock(), createBlock(_component_vxe_colgroup, {
|
|
32715
|
+
key: 0,
|
|
32716
|
+
align: column.align ? column.align : "center"
|
|
32717
|
+
}, {
|
|
32697
32718
|
header: withCtx(() => [
|
|
32698
32719
|
createVNode(_component_GridTitleContent, { column }, null, 8, ["column"])
|
|
32699
32720
|
]),
|
|
@@ -32703,7 +32724,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
32703
32724
|
}, null, 8, ["columns"])
|
|
32704
32725
|
]),
|
|
32705
32726
|
_: 2
|
|
32706
|
-
},
|
|
32727
|
+
}, 1032, ["align"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
32707
32728
|
column.colType == "seq" ? (openBlock(), createBlock(_component_vxe_column, {
|
|
32708
32729
|
key: 0,
|
|
32709
32730
|
type: "seq",
|
|
@@ -32945,7 +32966,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
32945
32966
|
}), 256))
|
|
32946
32967
|
]);
|
|
32947
32968
|
}
|
|
32948
|
-
const GridColumn = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-
|
|
32969
|
+
const GridColumn = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-1d0a8ef1"]]);
|
|
32949
32970
|
const propDefine$h = {
|
|
32950
32971
|
option: {
|
|
32951
32972
|
// Gird 配置项
|
|
@@ -33081,10 +33102,12 @@ let GridInstance$1 = class GridInstance2 extends BaseInstance {
|
|
|
33081
33102
|
* @param row
|
|
33082
33103
|
*/
|
|
33083
33104
|
__publicField(this, "setCurrentRow", (row) => {
|
|
33084
|
-
this.xTable.value
|
|
33085
|
-
|
|
33086
|
-
|
|
33087
|
-
|
|
33105
|
+
if (this.xTable.value) {
|
|
33106
|
+
this.xTable.value.setCurrentRow(row);
|
|
33107
|
+
if (this.props.option.event && this.props.option.event.currentChange) {
|
|
33108
|
+
const data2 = { "$table": this.xTable.value, row, newValue: row, oldValue: void 0, rowIndex: 1, columnIndex: 0 };
|
|
33109
|
+
this.props.option.event.currentChange(data2);
|
|
33110
|
+
}
|
|
33088
33111
|
}
|
|
33089
33112
|
});
|
|
33090
33113
|
//#region 全局值
|
|
@@ -33381,6 +33404,13 @@ let GridInstance$1 = class GridInstance2 extends BaseInstance {
|
|
|
33381
33404
|
__publicField(this, "getRowConfig", () => {
|
|
33382
33405
|
return this.utilities.isNull(this.props.option.setting) ? {} : this.props.option.setting.rowConfig;
|
|
33383
33406
|
});
|
|
33407
|
+
/**
|
|
33408
|
+
* 校验规则配置项
|
|
33409
|
+
* @returns
|
|
33410
|
+
*/
|
|
33411
|
+
__publicField(this, "getEditRules", () => {
|
|
33412
|
+
return this.utilities.isNull(this.props.option.setting) ? {} : this.props.option.setting.editRules;
|
|
33413
|
+
});
|
|
33384
33414
|
/**
|
|
33385
33415
|
* 获取树配置
|
|
33386
33416
|
* @returns
|
|
@@ -33452,6 +33482,9 @@ let GridInstance$1 = class GridInstance2 extends BaseInstance {
|
|
|
33452
33482
|
}
|
|
33453
33483
|
this.datas.value = _datas;
|
|
33454
33484
|
nextTick(() => {
|
|
33485
|
+
if (!this.xTable.value) {
|
|
33486
|
+
return;
|
|
33487
|
+
}
|
|
33455
33488
|
if (this.props.option.setting && this.props.option.setting.isTree && this.props.option.setting.treeConfig && this.props.option.setting.treeConfig.expandAll) {
|
|
33456
33489
|
this.xTable.value.setAllTreeExpand(true);
|
|
33457
33490
|
}
|
|
@@ -33710,6 +33743,10 @@ let GridInstance$1 = class GridInstance2 extends BaseInstance {
|
|
|
33710
33743
|
if (this.props.option.event && this.props.option.event.event_saveBefore && !this.props.option.event.event_saveBefore(saveDatas)) {
|
|
33711
33744
|
return;
|
|
33712
33745
|
}
|
|
33746
|
+
if (!await this.validate()) {
|
|
33747
|
+
this.message.warning("校验失败!");
|
|
33748
|
+
return;
|
|
33749
|
+
}
|
|
33713
33750
|
this.loadDataing.value = true;
|
|
33714
33751
|
const apiResult = this.getIsTree() ? await this.props.option.api.saveTree(saveDatas) : await this.props.option.api.saves(saveDatas);
|
|
33715
33752
|
const result = this.utilities.parseApiResult(apiResult);
|
|
@@ -33885,6 +33922,23 @@ let GridInstance$1 = class GridInstance2 extends BaseInstance {
|
|
|
33885
33922
|
await $table.setEditRow(row);
|
|
33886
33923
|
$table.clearEdit();
|
|
33887
33924
|
});
|
|
33925
|
+
/**
|
|
33926
|
+
* 编辑校验
|
|
33927
|
+
* @returns
|
|
33928
|
+
*/
|
|
33929
|
+
__publicField(this, "validate", async () => {
|
|
33930
|
+
const $table = this.xTable.value;
|
|
33931
|
+
if ($table) {
|
|
33932
|
+
const errMap = await $table.validate();
|
|
33933
|
+
if (errMap) {
|
|
33934
|
+
return false;
|
|
33935
|
+
} else {
|
|
33936
|
+
return true;
|
|
33937
|
+
}
|
|
33938
|
+
} else {
|
|
33939
|
+
return false;
|
|
33940
|
+
}
|
|
33941
|
+
});
|
|
33888
33942
|
this.props = props;
|
|
33889
33943
|
this.ctx = ctx;
|
|
33890
33944
|
this.useSearchPanel();
|
|
@@ -34006,7 +34060,7 @@ let GridInstance$1 = class GridInstance2 extends BaseInstance {
|
|
|
34006
34060
|
}
|
|
34007
34061
|
//#endregion 公开方法 END
|
|
34008
34062
|
};
|
|
34009
|
-
const
|
|
34063
|
+
const Grid_vue_vue_type_style_index_0_scoped_cb63f716_lang = "";
|
|
34010
34064
|
const _hoisted_1$5 = { class: "nv-crud" };
|
|
34011
34065
|
const _hoisted_2$4 = { class: "nv-crud-body" };
|
|
34012
34066
|
const _hoisted_3$3 = { class: "nv-crud-body-search" };
|
|
@@ -34116,6 +34170,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34116
34170
|
"row-config": _ctx.getRowConfig(),
|
|
34117
34171
|
"edit-config": _ctx.getEditConfig(),
|
|
34118
34172
|
"tree-config": _ctx.getTreeConfig(),
|
|
34173
|
+
"edit-rules": _ctx.getEditRules(),
|
|
34119
34174
|
onKeydownStart: _ctx.gridEvents.keydownStart,
|
|
34120
34175
|
onKeydown: _ctx.gridEvents.keydown,
|
|
34121
34176
|
onKeydownEnd: _ctx.gridEvents.keydownEnd,
|
|
@@ -34156,13 +34211,14 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34156
34211
|
default: withCtx(() => [
|
|
34157
34212
|
createVNode(_component_grid_column, {
|
|
34158
34213
|
columns: _ctx.option.columns,
|
|
34214
|
+
xTable: _ctx.xTable,
|
|
34159
34215
|
onClearRadioRow: _ctx.doClearRadioRow,
|
|
34160
34216
|
onDelete: _ctx.doDelete,
|
|
34161
34217
|
onAddchild: _ctx.doAddChild
|
|
34162
|
-
}, null, 8, ["columns", "onClearRadioRow", "onDelete", "onAddchild"])
|
|
34218
|
+
}, null, 8, ["columns", "xTable", "onClearRadioRow", "onDelete", "onAddchild"])
|
|
34163
34219
|
]),
|
|
34164
34220
|
_: 1
|
|
34165
|
-
}, 16, ["data", "border", "show-header", "row-config", "edit-config", "tree-config", "onKeydownStart", "onKeydown", "onKeydownEnd", "onPaste", "onCopy", "onCut", "onCurrentChange", "onRadioChange", "onCheckboxChange", "onCheckboxAll", "onCheckboxRangeStart", "onCheckboxRangeChange", "onCheckboxRangeEnd", "onCellClick", "onCellDblclick", "onCellMenu", "onCellMouseenter", "onCellMouseleave", "onHeaderCellClick", "onHeaderCellDblclick", "onHeaderCellMenu", "onFooterCellClick", "onFooterCellDblclick", "onFooterCellMenu", "onSortChange", "onFilterChange", "onResizableChange", "onToggleRowExpand", "onToggleTreeExpand", "onMenuClick", "onEditClosed", "onEditActived", "onEditDisabled", "onValidError", "onScroll", "onCustom"]), [
|
|
34221
|
+
}, 16, ["data", "border", "show-header", "row-config", "edit-config", "tree-config", "edit-rules", "onKeydownStart", "onKeydown", "onKeydownEnd", "onPaste", "onCopy", "onCut", "onCurrentChange", "onRadioChange", "onCheckboxChange", "onCheckboxAll", "onCheckboxRangeStart", "onCheckboxRangeChange", "onCheckboxRangeEnd", "onCellClick", "onCellDblclick", "onCellMenu", "onCellMouseenter", "onCellMouseleave", "onHeaderCellClick", "onHeaderCellDblclick", "onHeaderCellMenu", "onFooterCellClick", "onFooterCellDblclick", "onFooterCellMenu", "onSortChange", "onFilterChange", "onResizableChange", "onToggleRowExpand", "onToggleTreeExpand", "onMenuClick", "onEditClosed", "onEditActived", "onEditDisabled", "onValidError", "onScroll", "onCustom"]), [
|
|
34166
34222
|
[vShow, _ctx.showTable]
|
|
34167
34223
|
])
|
|
34168
34224
|
], 512)
|
|
@@ -34179,7 +34235,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34179
34235
|
])) : createCommentVNode("", true)
|
|
34180
34236
|
]);
|
|
34181
34237
|
}
|
|
34182
|
-
const Grid = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-
|
|
34238
|
+
const Grid = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-cb63f716"]]);
|
|
34183
34239
|
const propDefine$g = {
|
|
34184
34240
|
width: {
|
|
34185
34241
|
// Box 宽度
|
|
@@ -186904,6 +186960,9 @@ class PrintApi extends BaseInstance {
|
|
|
186904
186960
|
const order = Number(sheetHandle);
|
|
186905
186961
|
const sheet = this.luckysheet.getSheet({ order });
|
|
186906
186962
|
if (!this.utilities.isNull(sheet)) {
|
|
186963
|
+
if (sheet.config.printPage == void 0) {
|
|
186964
|
+
sheet.config.printPage = {};
|
|
186965
|
+
}
|
|
186907
186966
|
sheet.config.printPage.oriantation = isPortrait ? "portrait" : "landscape";
|
|
186908
186967
|
}
|
|
186909
186968
|
}
|
|
@@ -186919,6 +186978,9 @@ class PrintApi extends BaseInstance {
|
|
|
186919
186978
|
const order = Number(sheetHandle);
|
|
186920
186979
|
const sheet = this.luckysheet.getSheet({ order });
|
|
186921
186980
|
if (!this.utilities.isNull(sheet)) {
|
|
186981
|
+
if (sheet.config.printPage == void 0) {
|
|
186982
|
+
sheet.config.printPage = {};
|
|
186983
|
+
}
|
|
186922
186984
|
sheet.config.printPage.marginBottom = bottom;
|
|
186923
186985
|
sheet.config.printPage.marginLeft = left;
|
|
186924
186986
|
sheet.config.printPage.marginRight = right;
|
|
@@ -186933,8 +186995,12 @@ class PrintApi extends BaseInstance {
|
|
|
186933
186995
|
getOriantation(sheetHandle = "") {
|
|
186934
186996
|
const order = this.utilities.isNull(sheetHandle) ? this.reportApi.sheetApi.getSheetIndex() : Number(sheetHandle);
|
|
186935
186997
|
const sheet = this.reportApi.sheetApi.getSheet(order);
|
|
186936
|
-
|
|
186937
|
-
|
|
186998
|
+
if (sheet.config.printPage == void 0) {
|
|
186999
|
+
const oriantation = sheet.config.printPage.oriantation;
|
|
187000
|
+
return oriantation;
|
|
187001
|
+
} else {
|
|
187002
|
+
return "";
|
|
187003
|
+
}
|
|
186938
187004
|
}
|
|
186939
187005
|
/**
|
|
186940
187006
|
* 获取打印页设置
|
|
@@ -186944,7 +187010,8 @@ class PrintApi extends BaseInstance {
|
|
|
186944
187010
|
getPrintPage(sheetHandle = "") {
|
|
186945
187011
|
const order = this.utilities.isNull(sheetHandle) ? this.reportApi.sheetApi.getSheetIndex() : Number(sheetHandle);
|
|
186946
187012
|
const sheet = this.reportApi.sheetApi.getSheet(order);
|
|
186947
|
-
|
|
187013
|
+
const printPage = sheet.config.printPage;
|
|
187014
|
+
return printPage ?? {};
|
|
186948
187015
|
}
|
|
186949
187016
|
/**
|
|
186950
187017
|
* 自适应选定页A4
|
|
@@ -186967,7 +187034,7 @@ class PrintApi extends BaseInstance {
|
|
|
186967
187034
|
sheetIndexs.split(",").forEach((el) => {
|
|
186968
187035
|
let sheetHandle = el;
|
|
186969
187036
|
const sheet = this.luckysheet.getSheet({ order: sheetHandle });
|
|
186970
|
-
const oriantation = sheet.config.printPage.oriantation;
|
|
187037
|
+
const oriantation = sheet.config.printPage == void 0 ? "" : sheet.config.printPage.oriantation;
|
|
186971
187038
|
this.setSheetA4Size(sheetHandle, oriantation == "portrait", leftPx, rightPx, topPx, bottomPx);
|
|
186972
187039
|
});
|
|
186973
187040
|
}
|
|
@@ -188516,25 +188583,48 @@ class ReportApi extends BaseInstance {
|
|
|
188516
188583
|
}
|
|
188517
188584
|
/**
|
|
188518
188585
|
* 加载 模板及数据
|
|
188519
|
-
* @param content
|
|
188520
|
-
* @param callback
|
|
188586
|
+
* @param content
|
|
188587
|
+
* @param callback
|
|
188588
|
+
* @param isHttp
|
|
188521
188589
|
*/
|
|
188522
|
-
build(content, callback) {
|
|
188523
|
-
|
|
188524
|
-
|
|
188525
|
-
|
|
188526
|
-
|
|
188527
|
-
|
|
188528
|
-
if (
|
|
188529
|
-
jsonContent =
|
|
188590
|
+
build(content, callback, isHttp = false) {
|
|
188591
|
+
if (isHttp) {
|
|
188592
|
+
this.importReportByUrl(content, callback);
|
|
188593
|
+
} else {
|
|
188594
|
+
let jsonContent = {};
|
|
188595
|
+
if (content != null && content != "") {
|
|
188596
|
+
if (content.indexOf("<?xml") != -1) {
|
|
188597
|
+
jsonContent = LuckyConvert.transformSuXmlToLucky(content);
|
|
188530
188598
|
} else {
|
|
188531
|
-
|
|
188599
|
+
if (JSON.parse(content).constructor == Array) {
|
|
188600
|
+
jsonContent = JSON.parse(content);
|
|
188601
|
+
} else {
|
|
188602
|
+
jsonContent = JSON.parse(eval("" + content));
|
|
188603
|
+
}
|
|
188532
188604
|
}
|
|
188605
|
+
this.instanceopts.data = jsonContent;
|
|
188533
188606
|
}
|
|
188534
|
-
this.
|
|
188607
|
+
this.loadCallback = callback;
|
|
188608
|
+
luckysheet$2.create(this.instanceopts);
|
|
188535
188609
|
}
|
|
188536
|
-
|
|
188537
|
-
|
|
188610
|
+
}
|
|
188611
|
+
/**
|
|
188612
|
+
* 通过Url导入报表
|
|
188613
|
+
* @param fileUrl
|
|
188614
|
+
* @param callback
|
|
188615
|
+
*/
|
|
188616
|
+
importReportByUrl(fileUrl, callback2) {
|
|
188617
|
+
LuckyConvert.transformExcelToLuckyByUrl(fileUrl, "", (exportJson, luckysheetfile) => {
|
|
188618
|
+
if (exportJson.sheets == null || exportJson.sheets.length == 0) {
|
|
188619
|
+
this.message.warning(
|
|
188620
|
+
"Failed to read the content of the excel file, currently does not support xls files!"
|
|
188621
|
+
);
|
|
188622
|
+
return;
|
|
188623
|
+
}
|
|
188624
|
+
this.instanceopts.data = exportJson.sheets;
|
|
188625
|
+
this.loadCallback = callback2;
|
|
188626
|
+
luckysheet$2.create(this.instanceopts);
|
|
188627
|
+
});
|
|
188538
188628
|
}
|
|
188539
188629
|
/**
|
|
188540
188630
|
* 导入报表
|
|
@@ -190776,10 +190866,12 @@ class GridInstance extends BaseInstance {
|
|
|
190776
190866
|
* @param row
|
|
190777
190867
|
*/
|
|
190778
190868
|
__publicField(this, "setCurrentRow", (row) => {
|
|
190779
|
-
this.xTable.value
|
|
190780
|
-
|
|
190781
|
-
|
|
190782
|
-
|
|
190869
|
+
if (this.xTable.value) {
|
|
190870
|
+
this.xTable.value.setCurrentRow(row);
|
|
190871
|
+
if (this.props.option.event && this.props.option.event.currentChange) {
|
|
190872
|
+
const data2 = { "$table": this.xTable.value, row, newValue: row, oldValue: void 0, rowIndex: 1, columnIndex: 0 };
|
|
190873
|
+
this.props.option.event.currentChange(data2);
|
|
190874
|
+
}
|
|
190783
190875
|
}
|
|
190784
190876
|
});
|
|
190785
190877
|
//#region 全局值
|
|
@@ -191076,6 +191168,13 @@ class GridInstance extends BaseInstance {
|
|
|
191076
191168
|
__publicField(this, "getRowConfig", () => {
|
|
191077
191169
|
return this.utilities.isNull(this.props.option.setting) ? {} : this.props.option.setting.rowConfig;
|
|
191078
191170
|
});
|
|
191171
|
+
/**
|
|
191172
|
+
* 校验规则配置项
|
|
191173
|
+
* @returns
|
|
191174
|
+
*/
|
|
191175
|
+
__publicField(this, "getEditRules", () => {
|
|
191176
|
+
return this.utilities.isNull(this.props.option.setting) ? {} : this.props.option.setting.editRules;
|
|
191177
|
+
});
|
|
191079
191178
|
/**
|
|
191080
191179
|
* 获取树配置
|
|
191081
191180
|
* @returns
|
|
@@ -191147,6 +191246,9 @@ class GridInstance extends BaseInstance {
|
|
|
191147
191246
|
}
|
|
191148
191247
|
this.datas.value = _datas;
|
|
191149
191248
|
nextTick(() => {
|
|
191249
|
+
if (!this.xTable.value) {
|
|
191250
|
+
return;
|
|
191251
|
+
}
|
|
191150
191252
|
if (this.props.option.setting && this.props.option.setting.isTree && this.props.option.setting.treeConfig && this.props.option.setting.treeConfig.expandAll) {
|
|
191151
191253
|
this.xTable.value.setAllTreeExpand(true);
|
|
191152
191254
|
}
|
|
@@ -191405,6 +191507,10 @@ class GridInstance extends BaseInstance {
|
|
|
191405
191507
|
if (this.props.option.event && this.props.option.event.event_saveBefore && !this.props.option.event.event_saveBefore(saveDatas)) {
|
|
191406
191508
|
return;
|
|
191407
191509
|
}
|
|
191510
|
+
if (!await this.validate()) {
|
|
191511
|
+
this.message.warning("校验失败!");
|
|
191512
|
+
return;
|
|
191513
|
+
}
|
|
191408
191514
|
this.loadDataing.value = true;
|
|
191409
191515
|
const apiResult = this.getIsTree() ? await this.props.option.api.saveTree(saveDatas) : await this.props.option.api.saves(saveDatas);
|
|
191410
191516
|
const result = this.utilities.parseApiResult(apiResult);
|
|
@@ -191580,6 +191686,23 @@ class GridInstance extends BaseInstance {
|
|
|
191580
191686
|
await $table.setEditRow(row);
|
|
191581
191687
|
$table.clearEdit();
|
|
191582
191688
|
});
|
|
191689
|
+
/**
|
|
191690
|
+
* 编辑校验
|
|
191691
|
+
* @returns
|
|
191692
|
+
*/
|
|
191693
|
+
__publicField(this, "validate", async () => {
|
|
191694
|
+
const $table = this.xTable.value;
|
|
191695
|
+
if ($table) {
|
|
191696
|
+
const errMap = await $table.validate();
|
|
191697
|
+
if (errMap) {
|
|
191698
|
+
return false;
|
|
191699
|
+
} else {
|
|
191700
|
+
return true;
|
|
191701
|
+
}
|
|
191702
|
+
} else {
|
|
191703
|
+
return false;
|
|
191704
|
+
}
|
|
191705
|
+
});
|
|
191583
191706
|
this.props = props;
|
|
191584
191707
|
this.ctx = ctx;
|
|
191585
191708
|
this.useSearchPanel();
|