cc1-form 1.1.22 → 1.1.23
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/cc1-form.js
CHANGED
|
@@ -887,13 +887,20 @@ class $e {
|
|
|
887
887
|
}
|
|
888
888
|
const W = $.EDialog, Se = (o) => {
|
|
889
889
|
const s = A(), r = A(), t = _({
|
|
890
|
+
/** 查询区域相关配置对象 */
|
|
890
891
|
search: {
|
|
892
|
+
/** 查询表单列集合 */
|
|
891
893
|
column: {
|
|
894
|
+
/** 搜索表单列列表 */
|
|
892
895
|
list: []
|
|
893
896
|
},
|
|
897
|
+
/** 搜索表单数据对象 */
|
|
894
898
|
form: {},
|
|
899
|
+
/** 搜索表单默认值 */
|
|
895
900
|
formDefault: {},
|
|
901
|
+
/** 获取占位符 */
|
|
896
902
|
getPlaceholder: (n, e = g.tCurd("placeholderInput")) => n.text?.search?.placeholder === void 0 ? `${e}${n.label}` : n.text?.search?.placeholder,
|
|
903
|
+
/** 组装实际要搜索的数据对象 */
|
|
897
904
|
getFormData: () => {
|
|
898
905
|
let n = {};
|
|
899
906
|
o.option.column.forEach((a) => {
|
|
@@ -902,34 +909,52 @@ const W = $.EDialog, Se = (o) => {
|
|
|
902
909
|
const e = o.option.search?.before?.(n);
|
|
903
910
|
return e && (n = e), n;
|
|
904
911
|
},
|
|
912
|
+
/** 重置搜索表单 */
|
|
905
913
|
reset: () => {
|
|
906
914
|
const n = t.search.formDefault;
|
|
907
915
|
Object.keys(n).forEach((e) => {
|
|
908
916
|
o.option.search?.resetMode === "none" ? n[e] = void 0 : n[e] = t.search.formDefault[e];
|
|
909
917
|
}), t.search.form = JSONUtil.cp(n), t.page.num = 1, o.option.init !== !1 && t.table.getList();
|
|
910
918
|
},
|
|
919
|
+
/** 提交搜索表单 */
|
|
911
920
|
submit: () => {
|
|
912
921
|
t.page.num = 1, t.table.getList();
|
|
913
922
|
}
|
|
914
923
|
},
|
|
924
|
+
/** 分页区域相关配置对象 */
|
|
915
925
|
page: {
|
|
926
|
+
/** 当前每页条数 */
|
|
916
927
|
size: o.option.page?.size || 10,
|
|
928
|
+
/** 支持切换的每页条数选项 */
|
|
917
929
|
sizeList: o.option.page?.sizeList || [10, 20, 50, 100],
|
|
930
|
+
/** 当前页码 */
|
|
918
931
|
num: 1,
|
|
932
|
+
/** 总条数 */
|
|
919
933
|
total: 0,
|
|
934
|
+
/** 分页控件的布局方式 */
|
|
920
935
|
layout: o.option.page?.layout || "total, sizes, prev, pager, next, jumper"
|
|
921
936
|
},
|
|
937
|
+
/** 表格区域相关配置对象 */
|
|
922
938
|
table: {
|
|
939
|
+
/** 操作列相关配置 */
|
|
923
940
|
op: {
|
|
941
|
+
/** 动态计算操作列宽度 */
|
|
924
942
|
width: (...n) => n.filter((a) => a).length * 30 + 60
|
|
925
943
|
},
|
|
944
|
+
/** 表格加载中状态 */
|
|
926
945
|
loading: !1,
|
|
946
|
+
/** 表格数据内容 */
|
|
927
947
|
data: [],
|
|
948
|
+
/** 表格展开行相关配置 */
|
|
928
949
|
expand: {
|
|
950
|
+
/** 当前是否全部展开 */
|
|
929
951
|
isExpand: !1,
|
|
952
|
+
/** 已经展开的行key集合 */
|
|
930
953
|
rowKeys: [],
|
|
954
|
+
/** 行展开触发变更函数 */
|
|
931
955
|
change: (n, e) => {
|
|
932
956
|
},
|
|
957
|
+
/** 全部展开/收起 */
|
|
933
958
|
all: () => {
|
|
934
959
|
if (t.table.expand.isExpand)
|
|
935
960
|
t.table.expand.rowKeys = [];
|
|
@@ -945,25 +970,19 @@ const W = $.EDialog, Se = (o) => {
|
|
|
945
970
|
t.table.expand.isExpand = !t.table.expand.isExpand;
|
|
946
971
|
}
|
|
947
972
|
},
|
|
973
|
+
/** 表格列相关配置 */
|
|
948
974
|
column: {
|
|
949
|
-
/**
|
|
950
|
-
* 渲染列数据
|
|
951
|
-
*/
|
|
975
|
+
/** 表格全部列(渲染用) */
|
|
952
976
|
list: [],
|
|
953
|
-
/**
|
|
954
|
-
* 表格列显示控制
|
|
955
|
-
*/
|
|
977
|
+
/** 表格可见列控制集合 */
|
|
956
978
|
show: {
|
|
957
|
-
/**
|
|
958
|
-
* 表格列源数据
|
|
959
|
-
*/
|
|
979
|
+
/** 表格列f原始源数据key数组 */
|
|
960
980
|
listSource: [],
|
|
961
|
-
/**
|
|
962
|
-
* 当前显示表格列数据
|
|
963
|
-
*/
|
|
981
|
+
/** 当前显示表格列数据key数组 */
|
|
964
982
|
list: []
|
|
965
983
|
}
|
|
966
984
|
},
|
|
985
|
+
/** 获取数据列表接口实现 */
|
|
967
986
|
getList: async () => {
|
|
968
987
|
t.table.loading = !0;
|
|
969
988
|
const n = o.option.api.list;
|
|
@@ -989,15 +1008,21 @@ const W = $.EDialog, Se = (o) => {
|
|
|
989
1008
|
t.table.loading = !1;
|
|
990
1009
|
}
|
|
991
1010
|
},
|
|
1011
|
+
/** 表格多选相关配置 */
|
|
992
1012
|
selection: {
|
|
1013
|
+
/** 已选数据项 */
|
|
993
1014
|
list: [],
|
|
1015
|
+
/** 选中状态回调 */
|
|
994
1016
|
change: (n) => {
|
|
995
1017
|
t.table.selection.list = n;
|
|
996
1018
|
}
|
|
997
1019
|
}
|
|
998
1020
|
},
|
|
1021
|
+
/** 导出相关配置与功能 */
|
|
999
1022
|
export: {
|
|
1023
|
+
/** 导出逻辑方法集合 */
|
|
1000
1024
|
run: {
|
|
1025
|
+
/** 执行指定方式的导出(如select、page、all) */
|
|
1001
1026
|
start: async (n) => {
|
|
1002
1027
|
let e = await t.export.run[n](), a = o.option.column;
|
|
1003
1028
|
const d = JSONUtil.cp({
|
|
@@ -1006,16 +1031,19 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1006
1031
|
}), m = o.option.tools?.export || {};
|
|
1007
1032
|
m.before && m.before(d), $e.exportToExcel(d.data, d.columns, m.fileName);
|
|
1008
1033
|
},
|
|
1034
|
+
/** 获取当前选中项进行导出 */
|
|
1009
1035
|
select: () => {
|
|
1010
1036
|
if (t.table.selection.list.length === 0)
|
|
1011
1037
|
throw $.fail(g.tCurd("selectDataToExport")), new Error(g.tCurd("selectDataToExport"));
|
|
1012
1038
|
return t.table.selection.list;
|
|
1013
1039
|
},
|
|
1040
|
+
/** 导出当前页的数据 */
|
|
1014
1041
|
page: () => {
|
|
1015
1042
|
if (t.table.data.length === 0)
|
|
1016
1043
|
throw $.fail(g.tCurd("noData")), new Error(g.tCurd("noData"));
|
|
1017
1044
|
return t.table.data;
|
|
1018
1045
|
},
|
|
1046
|
+
/** 导出所有数据 */
|
|
1019
1047
|
all: async () => {
|
|
1020
1048
|
t.export.loading = !0;
|
|
1021
1049
|
try {
|
|
@@ -1039,30 +1067,40 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1039
1067
|
}
|
|
1040
1068
|
}
|
|
1041
1069
|
},
|
|
1070
|
+
/** 导出时loading状态 */
|
|
1042
1071
|
loading: !1,
|
|
1072
|
+
/** 执行导出操作的触发函数 */
|
|
1043
1073
|
click: (n) => {
|
|
1044
1074
|
t.export.loading || t.export.run.start(n);
|
|
1045
1075
|
}
|
|
1046
1076
|
},
|
|
1077
|
+
/** 表单增删改弹窗相关对象 */
|
|
1047
1078
|
update: {
|
|
1079
|
+
/** 弹窗标题 */
|
|
1048
1080
|
title: "",
|
|
1081
|
+
/** 当前表单校验规则 */
|
|
1049
1082
|
rules: {},
|
|
1083
|
+
/** 弹窗显示控制 */
|
|
1050
1084
|
show: !1,
|
|
1085
|
+
/** 弹窗内容部分显示控制 */
|
|
1051
1086
|
showContent: !1,
|
|
1087
|
+
/** 弹窗loading */
|
|
1052
1088
|
loading: !1,
|
|
1089
|
+
/** 当前操作类型,插入或修改 */
|
|
1053
1090
|
type: W.Insert,
|
|
1091
|
+
/** 当前操作表单数据 */
|
|
1054
1092
|
form: {},
|
|
1093
|
+
/** 表单默认值 */
|
|
1055
1094
|
formDefault: {},
|
|
1095
|
+
/** 表单所有列,二维数组结构按行分组 */
|
|
1056
1096
|
formColumn: [],
|
|
1097
|
+
/** 判断是否禁用当前字段 */
|
|
1057
1098
|
getDisabled: (n) => n.disabled?.[t.update.type === W.Insert ? "create" : "update"],
|
|
1099
|
+
/** 编辑相关数据与方法 */
|
|
1058
1100
|
edit: {
|
|
1059
|
-
/**
|
|
1060
|
-
* 编辑原数据
|
|
1061
|
-
*/
|
|
1101
|
+
/** 当前编辑的数据原始项对象 */
|
|
1062
1102
|
data: {},
|
|
1063
|
-
/**
|
|
1064
|
-
* 将form填入数据和data比对差异数据返回
|
|
1065
|
-
*/
|
|
1103
|
+
/** 返回编辑时与原值的变更数据,用于局部更新API */
|
|
1066
1104
|
getApiData: (n) => {
|
|
1067
1105
|
if (o.option.form?.editAll)
|
|
1068
1106
|
return n;
|
|
@@ -1074,6 +1112,7 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1074
1112
|
}), e;
|
|
1075
1113
|
}
|
|
1076
1114
|
},
|
|
1115
|
+
/** 打开增改弹窗 */
|
|
1077
1116
|
open: (n, e) => {
|
|
1078
1117
|
t.update.showContent || FunUtil.throttle(async () => {
|
|
1079
1118
|
$.loading(!0);
|
|
@@ -1092,6 +1131,7 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1092
1131
|
}
|
|
1093
1132
|
});
|
|
1094
1133
|
},
|
|
1134
|
+
/** 提交增改表单操作 */
|
|
1095
1135
|
submit: () => {
|
|
1096
1136
|
FunUtil.throttle(async () => {
|
|
1097
1137
|
await r.value?.validate(async (d, m) => new Promise((p, c) => {
|
|
@@ -1119,22 +1159,30 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1119
1159
|
}
|
|
1120
1160
|
});
|
|
1121
1161
|
},
|
|
1162
|
+
/** 关闭弹窗和内容 */
|
|
1122
1163
|
close: () => {
|
|
1123
1164
|
t.update.show = !1, setTimeout(() => {
|
|
1124
1165
|
t.update.showContent = !1;
|
|
1125
1166
|
}, 350);
|
|
1126
1167
|
}
|
|
1127
1168
|
},
|
|
1169
|
+
/** 行内编辑相关对象 */
|
|
1128
1170
|
inlineEdit: {
|
|
1171
|
+
/** 行内编辑当前行对象 */
|
|
1129
1172
|
row: null,
|
|
1173
|
+
/** 行内编辑表单数据副本 */
|
|
1130
1174
|
form: {},
|
|
1175
|
+
/** 行内编辑loading */
|
|
1131
1176
|
loading: !1,
|
|
1177
|
+
/** 打开行内编辑 */
|
|
1132
1178
|
open: (n) => {
|
|
1133
1179
|
t.inlineEdit.row = n, t.inlineEdit.form = JSONUtil.cp(n);
|
|
1134
1180
|
},
|
|
1181
|
+
/** 关闭行内编辑 */
|
|
1135
1182
|
close: () => {
|
|
1136
1183
|
t.inlineEdit.row = null, t.inlineEdit.form = {};
|
|
1137
1184
|
},
|
|
1185
|
+
/** 行内保存提交 */
|
|
1138
1186
|
submit: () => {
|
|
1139
1187
|
FunUtil.throttle(async () => {
|
|
1140
1188
|
t.inlineEdit.loading = !0;
|
|
@@ -1152,14 +1200,21 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1152
1200
|
});
|
|
1153
1201
|
}
|
|
1154
1202
|
},
|
|
1203
|
+
/** 删除操作弹窗与数据对象 */
|
|
1155
1204
|
remove: {
|
|
1205
|
+
/** 删除弹窗标题 */
|
|
1156
1206
|
title: g.tCurd("confirmDelete"),
|
|
1207
|
+
/** 删除弹窗显示控制 */
|
|
1157
1208
|
show: !1,
|
|
1209
|
+
/** 待删除数据项集合 */
|
|
1158
1210
|
items: [],
|
|
1211
|
+
/** 删除操作loading */
|
|
1159
1212
|
loading: !1,
|
|
1213
|
+
/** 关闭删除弹窗 */
|
|
1160
1214
|
close: () => {
|
|
1161
1215
|
t.remove.show = !1;
|
|
1162
1216
|
},
|
|
1217
|
+
/** 打开删除弹窗并设置待删除项 */
|
|
1163
1218
|
open: (n) => {
|
|
1164
1219
|
if (n.length === 0) {
|
|
1165
1220
|
$.fail(g.tCurd("selectDataToDelete"));
|
|
@@ -1167,6 +1222,7 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1167
1222
|
}
|
|
1168
1223
|
t.remove.items = n, t.remove.show = !0;
|
|
1169
1224
|
},
|
|
1225
|
+
/** 执行删除实际操作 */
|
|
1170
1226
|
submit: () => {
|
|
1171
1227
|
FunUtil.throttle(async () => {
|
|
1172
1228
|
t.remove.loading = !0;
|
|
@@ -1185,10 +1241,13 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1185
1241
|
});
|
|
1186
1242
|
}
|
|
1187
1243
|
},
|
|
1244
|
+
/** 初始化curd关联所有默认与依赖配置及表单列 */
|
|
1188
1245
|
init: () => {
|
|
1189
1246
|
t.initCurdConfig(), t.initColumnOptions(), t.initColumnForm();
|
|
1190
1247
|
},
|
|
1248
|
+
/** 下拉请求等数据缓存 */
|
|
1191
1249
|
apiDataMap: {},
|
|
1250
|
+
/** 获取并绑定curd中所有下拉数据等远程依赖 */
|
|
1192
1251
|
initApiData: async (n) => {
|
|
1193
1252
|
const e = [], a = (d) => {
|
|
1194
1253
|
if (d.children && d.children.length) {
|
|
@@ -1214,6 +1273,7 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1214
1273
|
a(d);
|
|
1215
1274
|
}), await Promise.all(e), !0;
|
|
1216
1275
|
},
|
|
1276
|
+
/** 初始化curd配置(option默认值合并等) */
|
|
1217
1277
|
initCurdConfig: () => {
|
|
1218
1278
|
const n = JSONUtil.cp(S.config);
|
|
1219
1279
|
n.table.emptyText = g.tCurd("noData");
|
|
@@ -1223,7 +1283,7 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1223
1283
|
});
|
|
1224
1284
|
},
|
|
1225
1285
|
/**
|
|
1226
|
-
* 初始化curd
|
|
1286
|
+
* 初始化curd选项配置,每列merge默认配置等
|
|
1227
1287
|
* @param column
|
|
1228
1288
|
* @returns
|
|
1229
1289
|
*/
|
|
@@ -1269,6 +1329,7 @@ const W = $.EDialog, Se = (o) => {
|
|
|
1269
1329
|
};
|
|
1270
1330
|
o.option.column.forEach(e), o.option.table?.column?.forEach(e);
|
|
1271
1331
|
},
|
|
1332
|
+
/** 初始化配置并生成表单列及默认值及规则 */
|
|
1272
1333
|
initColumnForm: () => {
|
|
1273
1334
|
const n = o.option;
|
|
1274
1335
|
t.update.formColumn = [], t.table.column.show = {
|
|
@@ -1834,7 +1895,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1834
1895
|
onExpandChange: l(e).table.expand.change
|
|
1835
1896
|
}), {
|
|
1836
1897
|
default: b(() => [
|
|
1837
|
-
o.option.table?.selectable
|
|
1898
|
+
o.option.table?.selectable || l(n)(o.option.tools?.delete) || o.option.tools?.export?.show ? (f(), y(l(Z), {
|
|
1838
1899
|
key: 0,
|
|
1839
1900
|
type: "selection",
|
|
1840
1901
|
selectable: typeof o.option.table?.selectable == "function" ? o.option.table?.selectable : void 0,
|
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.cc1Form={},u.Vue,u.ElementPlus))})(this,(function(u,e,p){"use strict";class b{static config={page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},dialog:{width:"980px",closeOnClickModal:!1},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0},columnConfig:{type:"input",form:{labelWidth:"100px",width:"100%"},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=i=>{b.config=ObjectUtil.deepMerge(b.config,i)}}class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(i,s)=>Array.isArray(i)?i.some(l=>typeof l=="function"?l(s):l):typeof i=="function"?i(s):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async i=>{if(!k.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const s=await k.moduleObj[i]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(i,s,l={}){const a=Date.now();if(!this.tipMessages[i]||a-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=a;const t=Object.assign({message:i,type:s},l);p.ElMessage(t),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,s={})=>{this.showMessage(i,"error",s)};static success=(i,s={})=>{this.showMessage(i,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=p.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,s=!0)=>{if(s){let l=screen.width/2-500,a=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+l)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(s,l)=>{let a=document.getElementById(i.id);const t=await k.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let c=n.toDataURL("image/png");s(c)})}catch(n){l(n)}})}class C{static customComponent={};static findOptions=(i,s)=>{const l=i.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(n,c)=>c.toUpperCase());if(l)return l.options[a(l.type)]};static setOptionsData=(i,s,l)=>{const a=C.findOptions(i,s);a&&(a.data=l)};static form={openBefore:{parentId:(i,s,l,a)=>{const t=b.config.table.rowKey;i?s.type===k.EDialog.Insert?(s.form.parentId=i[t],s.form.sort=i.children.length+1):s.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=l.length+1),C.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:l}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(i,s,l)=>{s[i]||(s[i]=[]);const a=b.config.table.rowKey;s[i].forEach(t=>{l.forEach(n=>{let c=n.default??"";n.type==="number"&&(c=n.default??0),n.type==="boolean"&&(c=n.default??!1),n.type==="time"&&(c=n.default??new Date),t[n.value]===void 0&&(t[n.value]=c)}),t[a]||(t[a]=E.getIdFun())})};static add=(i,s,l,a)=>{const t=JSONUtil.cp(l);E.setId(i,s,l);const n=b.config.table.rowKey;s[i].push(t.reduce((c,m)=>{let h=m.default??"";return m.type==="number"&&(h=m.default??0),m.type==="boolean"&&(h=m.default??!1),m.type==="time"&&(h=m.default??new Date),c[m.value]=h,c},{[n]:E.getIdFun()})),a?.(s)};static remove=(i,s,l,a)=>{const t=b.config.table.rowKey;s[i]=s[i].filter(n=>n[t]!==l[t]),a?.(s)};static getNoIdData=(i,s)=>{const l=JSONUtil.cp(i),a=b.config.table.rowKey;return l.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&E.getNoIdData(t[s],s)}),l}}const I={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},S=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(o,{emit:i}){const s=o,l=e.reactive({show:!1,add:(t,n,c)=>{E.add(t,n,c,()=>{a("change")})},remove:(t,n,c)=>{E.remove(t,n,c,()=>{a("change")})}});e.onMounted(()=>{E.setId(s.field,s.row,s.itemFields),l.show=!0});const a=i;return(t,n)=>{const c=e.resolveComponent("el-button"),m=e.resolveComponent("el-input");return l.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"list-start",{row:o.row}),e.createElementVNode("div",null,[e.createVNode(c,{link:"",type:"primary",onClick:n[0]||(n[0]=h=>l.add(o.field,o.row,o.itemFields))},{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.row[o.field],h=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"item-start",{item:h,row:o.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.itemFields,f=>(e.openBlock(),e.createBlock(m,{modelValue:h[f.value],"onUpdate:modelValue":r=>h[f.value]=r,style:e.normalizeStyle({width:o.inputWidth}),class:e.normalizeClass(o.inputClass),placeholder:f[o.label]||f[o.value],onChange:n[1]||(n[1]=r=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:o.row}),e.createVNode(c,{link:"",type:"danger",onClick:f=>l.remove(o.field,o.row,h)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:o.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(o,{expose:i}){const s=k.isFun,l=k.EDialog,a=e.ref(),t=o,n=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:c=>c.disabled?.[(t.type||l.Insert)===l.Insert?"create":"update"],initColumnForm:async()=>{const c=t.option;n.formColumn=[];const m=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let r=[];const d=g=>{if(n.formDefault[g.key]=g.value,g.isForm){g.form=g.form||{span:f},g.form.span=g.form.span??f;let w=g.form.span,V=r.reduce((x,Ce)=>x+Ce.span,w);const B=r.length;r.push({item:g,span:w}),(B===1&&r[0].span===0||V>=h||w===0&&B>1)&&(m.push(r),r=[]),g.rules&&(n.rules[g.key]=g.rules)}};c.column.forEach(g=>{g.isForm=!0,d(g)}),r.length>0&&m.push(r),n.formColumn=m,n.form=JSONUtil.cp(n.formDefault)},init:async()=>{n.show=!1,await e.nextTick(),n.initColumnForm()}});return n.initColumnForm(),i({ref:a,conf:n}),(c,m)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:a,model:n.form,rules:n.rules},{default:e.withCtx(()=>[n.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.formColumn,h=>(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(c.$slots,"form-start",{row:n.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(f.item.show?.form,n.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f.item.form.span>0?`col-${f.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"form-"+f.item.key+"-start",{row:n.form,item:f.item}),e.renderSlot(c.$slots,"form-"+f.item.key,{row:n.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:n.form,field:f.item.key},{ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(C).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(c.$slots,"form-"+f.item.key+"-end",{row:n.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(c.$slots,"form-end",{row:n.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ve(o){return o}const j={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class y{static t(i,...s){if(typeof i=="function")return i(...s);i=String(i);let l=0;return i.replace(/{([^}]+)}/g,(a,t)=>l<s.length?String(s[l++]):`{${t}}`)}static setI18n=i=>{y.curd=ObjectUtil.deepMerge(y.curd,i)};static tCurd(i,...s){return this.t(this.curd[i],...s)}static curd=j}class F{static exportToExcel=async(i,s,l)=>{if(!i||i.length===0)return;const a=await k.loadModule("xlsx"),t=i.map(m=>{const h={};return s.forEach(f=>{h[f.label]=m[f.key]}),h}),n=a.utils.json_to_sheet(t),c=a.utils.book_new();a.utils.book_append_sheet(c,n,"Sheet1"),l?typeof l=="function"&&(l=l()):l=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(c,`${l}.xlsx`)}}const N=k.EDialog,z=o=>{const i=e.ref(),s=e.ref(),l=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,t=y.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${t}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};o.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(l.search.form):n.show?.search)&&(a[n.key]=l.search.form[n.key])});const t=o.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const a=l.search.formDefault;Object.keys(a).forEach(t=>{o.option.search?.resetMode==="none"?a[t]=void 0:a[t]=l.search.formDefault[t]}),l.search.form=JSONUtil.cp(a),l.page.num=1,o.option.init!==!1&&l.table.getList()},submit:()=>{l.page.num=1,l.table.getList()}},page:{size:o.option.page?.size||10,sizeList:o.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:o.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...a)=>a.filter(n=>n).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{if(l.table.expand.isExpand)l.table.expand.rowKeys=[];else{const a=t=>{let n=[];return t.forEach(c=>{n.push(c[o.option.table.rowKey]),c.children&&c.children.length>0&&(n=n.concat(a(c.children)))}),n};l.table.expand.rowKeys=a(l.table.data)}l.table.expand.isExpand=!l.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{l.table.loading=!0;const a=o.option.api.list;try{await l.initApiData("init");const t=await a({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()}),n=b.config.result,c=t.data||{[n.list]:t};let m=(Array.isArray(c[n.list]),c[n.list]);const h=l.update.formColumn.flat(),f=JSONUtil.cp(m).map(r=>(Object.keys(r).forEach(g=>{const w=h.find(V=>V.item.key===g);if(w&&w.item.type==="select"){const V=w.item.options?.select?.data?.find(B=>B.value==r[g])?.label;V&&(r[g]=V)}}),r));l.table.data=o.option.data?await o.option.data(f,m):f,l.page.total=c[n.total]||0}catch(t){console.error(t)}finally{l.table.loading=!1}},selection:{list:[],change:a=>{l.table.selection.list=a}}},export:{run:{start:async a=>{let t=await l.export.run[a](),n=o.option.column;const c=JSONUtil.cp({data:t,columns:n}),m=o.option.tools?.export||{};m.before&&m.before(c),F.exportToExcel(c.data,c.columns,m.fileName)},select:()=>{if(l.table.selection.list.length===0)throw k.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return l.table.selection.list},page:()=>{if(l.table.data.length===0)throw k.fail(y.tCurd("noData")),new Error(y.tCurd("noData"));return l.table.data},all:async()=>{l.export.loading=!0;try{if(o.option.tools?.export?.all){await o.option.tools?.export?.all({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()});return}const a=o.option.api.list,t=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(a){console.error(a)}finally{l.export.loading=!1}}},loading:!1,click:a=>{l.export.loading||l.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>a.disabled?.[l.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(o.option.form?.editAll)return a;let t={[o.option.table?.rowKey]:l.update.edit.data[o.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(n=>{a[n]!==l.update.edit.data[n]&&(t[n]=a[n])}),t}},open:(a,t)=>{l.update.showContent||FunUtil.throttle(async()=>{k.loading(!0);try{await l.initApiData("update");const n=a===N.Insert;if(!n&&o.option.table?.inlineEdit){l.inlineEdit.open(t);return}l.update.type=a,l.update.edit.data=t,l.update.title=n?y.tCurd("add"):y.tCurd("edit"),l.update.form=JSONUtil.cp(n?l.update.formDefault:t),await o.option.form?.openBefore?.(t,l.update),l.update.show=!0,l.update.showContent=!0,o.option.form?.openAfter?.(t,l.update)}catch(n){console.error(n)}finally{k.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(c,m)=>new Promise((h,f)=>{c||(k.fail(y.tCurd("checkFormData")),f(!1)),h()})),l.update.loading=!0;const a=l.update.type===N.Insert?o.option.api.create:o.option.api.update;let t=JSONUtil.cp(l.update.form);delete t.children,await o.option.form?.submitBefore?.(t,l.update);const n=new Set(o.option.column.filter(c=>c.type==="datetime").map(c=>c.key));Object.keys(t).forEach(c=>{if(n.has(c)&&t[c]!=null){const m=new Date(t[c]).getTime();isNaN(m)||(t[c]=m)}});try{if(!a)return;await a({...t}),l.update.close(),await l.table.getList(),o.option.form?.submitAfter?.(t,l.update)}catch(c){console.error(c)}finally{l.update.loading=!1}})},close:()=>{l.update.show=!1,setTimeout(()=>{l.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{l.inlineEdit.row=a,l.inlineEdit.form=JSONUtil.cp(a)},close:()=>{l.inlineEdit.row=null,l.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{l.inlineEdit.loading=!0;const a=o.option.api.update;let t=JSONUtil.cp(l.inlineEdit.form);delete t.children;try{if(!a)return;await a({...t}),l.inlineEdit.close(),await l.table.getList(),k.success(y.tCurd("operationSuccess"))}catch(n){console.error(n)}finally{l.inlineEdit.loading=!1}})}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{l.remove.show=!1},open:a=>{if(a.length===0){k.fail(y.tCurd("selectDataToDelete"));return}l.remove.items=a,l.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{l.remove.loading=!0;const a=o.option.api.delete;try{if(!a)return;await a({[o.option.table?.rowKey]:l.remove.items.map(t=>t[o.option.table?.rowKey]),items:l.remove.items}),k.success(y.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(t){console.error(t)}finally{l.remove.loading=!1}})}},init:()=>{l.initCurdConfig(),l.initColumnOptions(),l.initColumnForm()},apiDataMap:{},initApiData:async a=>{const t=[],n=c=>{if(c.children&&c.children.length){c.children.forEach(m=>n(m));return}if(c.type==="select"&&c.options?.select?.dataApi&&c.options?.select?.dataApiConfig?.[a]){if(l.apiDataMap[c.key]&&c.options?.select?.dataApiConfig?.once)return;const m=(async()=>{try{let h=await c.options?.select?.dataApi?.();if(h){const f=c.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),c.options.select.data=h,l.apiDataMap[c.key]=h}}catch{}})();t.push(m)}};return o.option.column.forEach(c=>{n(c)}),await Promise.all(t),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=y.tCurd("noData");const t=ObjectUtil.deepMerge(a,o.option||{});Object.keys(t).forEach(n=>{o.option[n]=t[n]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:y.tCurd("switchOn"),inactiveLabel:y.tCurd("switchOff")}});const t=n=>{if(n.table=ObjectUtil.deepMerge(a.table,n.table||{}),n.children){n.children.forEach(c=>{t(c)});return}n.options=ObjectUtil.deepMerge(a.options,n.options||{}),n.form=ObjectUtil.deepMerge(a.form,n.form||{}),n.show=ObjectUtil.deepMerge(a.show,n.show||{}),n.sort=ObjectUtil.deepMerge(a.sort,n.sort||{}),n.type=n.type||a.type,n.type==="switch"&&(n.options.switch.tableBeforeChange=async(c,m)=>{const h=n.options?.switch;try{await i.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),l.table.loading=!0;try{return o.option.api.update?(await o.option.api.update({[o.option.table?.rowKey]:m[o.option.table?.rowKey],[c]:m[c]===h.activeValue?h.inactiveValue:h.activeValue,final(f,r,d){l.table.loading=!1}}),l.table.loading=!1,k.success(y.tCurd("operationSuccess")),l.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{l.table.loading=!1}}catch{return!1}}),n.type==="tree-select"&&(n.options.treeSelect.rowKey=o.option.table?.rowKey,n.options.treeSelect.nodeKey=o.option.table?.rowKey)};o.option.column.forEach(t),o.option.table?.column?.forEach(t)},initColumnForm:()=>{const a=o.option;l.update.formColumn=[],l.table.column.show={list:[],listSource:[]};const t=[],n=o.option.form?.maxSpan||12,c=o.option.form?.defaultSpan||n/2;let m=[];const h=d=>{if(d.children){l.table.column.show.list.push(d.key),d.children.forEach(g=>{h(g)});return}if(l.update.formDefault[d.key]=d.value,d.table.table&&(d.show.table&&l.table.column.show.list.push(d.key),d.table.table&&l.table.column.show.listSource.push(d.key)),d.isForm){d.form=d.form||{span:c},d.form.span=d.form.span??c;let g=d.form.span,w=m.reduce((B,x)=>B+x.span,g);const V=m.length;if(m.push({item:d,span:g}),(V===1&&m[0].span===0||w>=n||g===0&&V>1)&&(t.push(m),m=[]),d.rules){const B={input:y.tCurd("placeholderInput"),select:y.tCurd("placeholderSelect")},x=(B[d.type]||B.input)+d.label;l.update.rules[d.key]=typeof d.rules=="boolean"?[{required:!0,message:x,trigger:"blur"}]:d.rules}}},f=(d,g)=>{d.isForm=g,Array.isArray(d.children)&&d.children.forEach(w=>f(w,g))};a.column.forEach(d=>{d.isForm=!0,f(d,!0),h(d)}),o.option.table?.column?.forEach(d=>{f(d,!1),h(d)}),l.search.column.list=a.column.concat(a.table?.column||[]),l.table.column.list=l.search.column.list.filter(d=>d.table?.table),l.search.column.list.sort((d,g)=>d.sort?.search-g.sort?.search),l.table.column.list.sort((d,g)=>d.sort?.table-g.sort?.table),m.length>0&&t.push(m),l.update.formColumn=t;const r=o.option.search?.formDefault;r&&Object.keys(r).forEach(d=>{l.search.formDefault[d]=r[d]}),a.column.forEach(d=>{d.show?.search||(l.search.formDefault[d.key]=void 0)}),l.search.form=JSONUtil.cp(l.search.formDefault)}});return l.init(),e.onMounted(()=>{o.option.init!==!1&&l.table.getList()}),{conf:l,switchConfirmRef:i,ruleFormRef:s}},R={class:"dialog-footer"},A=e.defineComponent({__name:"switchConfirm",setup(o,{expose:i}){const s=e.ref(!1),l=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,n=null;const c=f=>(f?.title&&(l.value=f.title),f?.content&&(a.value=f.content),s.value=!0,new Promise((r,d)=>{t=r,n=d})),m=()=>{s.value=!1,t?.(!0),t=null,n=null},h=()=>{s.value=!1,n?.(new Error("用户取消操作")),t=null,n=null};return i({open:c}),(f,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=d=>s.value=d),title:l.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",R,[e.createVNode(e.unref(p.ElButton),{onClick:h},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:m},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"]))}}),U=(o,i)=>{const s=o.__vccOpts||o;for(const[l,a]of i)s[l]=a;return s},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(o,i){return e.openBlock(),e.createElementBlock("svg",H,[...i[0]||(i[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const W=U(K,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(o,i){return e.openBlock(),e.createElementBlock("svg",G,[...i[0]||(i[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)])])}const Q=U(q,[["render",X]]),Y={class:"row flex-center table-header-label"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(o){const i=e.getCurrentInstance().type;return(s,l)=>{const a=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.key},[o.conf.table.column.show.list.includes(t.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:t.key,label:t.label},{ref_for:!0},t.table),{header:e.withCtx(()=>[e.renderSlot(s.$slots,"table-header-"+t.key,{item:t},()=>[e.createElementVNode("div",Y,[t.table?.tooltip?(e.openBlock(),e.createBlock(a,{key:0,effect:"dark",content:t.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:1},8,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.label),1)])])]),default:e.withCtx(({row:n})=>[t.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[0]||(l[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),{conf:o.conf,columnList:t.children,option:o.option},e.createSlots({_:2},[e.renderList(s.$slots,(c,m)=>({name:m,fn:e.withCtx(h=>[e.renderSlot(s.$slots,m,e.mergeProps({ref_for:!0},h||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.show?.form&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===n&&(t.type==="input"||t.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.inlineEdit.form[t.key],"onUpdate:modelValue":c=>o.conf.inlineEdit.form[t.key]=c},{ref_for:!0},t.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:o.conf.inlineEdit.form[t.key],"onUpdate:modelValue":c=>o.conf.inlineEdit.form[t.key]=c},{ref_for:!0},t.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(s.$slots,"table-"+t.key,{key:1,row:n,item:t},()=>[t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:n[t.key],"onUpdate:modelValue":c=>n[t.key]=c,"before-change":()=>t.options?.switch?.tableBeforeChange?.(t.key,n)},{ref_for:!0},t.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":t.table?.click?.color}),class:e.normalizeClass({"table-text-click":t.table?.click?.callback}),onClick:c=>t.table?.click?.callback?.(n)},e.toDisplayString(n[t.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),$=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(o){return(i,s)=>o.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.input,e.toHandlers(o.item.item.options?.input?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.switch,{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.select,e.toHandlers(o.item.item.options?.select?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.select?.data,l=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:o.conf.update.form,field:o.item.item.key},o.item.item.options?.list,e.toHandlers(o.item.item.options?.list?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.treeSelect,e.toHandlers(o.item.item.options?.treeSelect?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):o.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.datetime,e.toHandlers(o.item.item.options?.datetime?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type&&e.unref(C).customComponent[o.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[o.item.item.type]),e.mergeProps({key:6,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.[o.item.item.type],e.toHandlers(o.item.item.options?.[o.item.item.type]?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),v={class:"col relative cc1-form-box"},ee={class:"absolute row fit",style:{overflow:"hidden"}},te={class:"col column fit-width no-wrap"},oe={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ne={class:"flex items-center",style:{gap:"10px"}},ae={key:0},re={key:1},ie={key:2},se={class:"export-btn"},ce={class:"flex items-center",style:{gap:"10px"}},de={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},me={class:"row justify-end mt-10 mb-10"},pe={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ge={class:"row form-item-content",style:{width:"100%"}},ye={class:"col"},ke={class:"dialog-footer"},be={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(o,{expose:i}){const s=k.EDialog,l=o,a=k.isFun,{conf:t,switchConfirmRef:n,ruleFormRef:c}=z(l);return i({conf:t}),(m,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(m.$slots,"box-left"),e.createElementVNode("div",te,[o.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(p.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(t).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-"+r.key,{row:e.unref(t).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d,placeholder:e.unref(t).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.input,e.toHandlers(r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.switch,e.toHandlers(r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.select,e.toHandlers(r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d},{ref_for:!0},r.options?.datetime,e.toHandlers(r.options?.datetime?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(C).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d},{ref_for:!0},r.options?.[r.type],e.toHandlers(r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(m.$slots,"search-"+r.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(m.$slots,"search-center",{row:e.unref(t).search.form}),o.option.tools?.search||o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0},{default:e.withCtx(()=>[o.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.unref(a)(o.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:h[0]||(h[0]=r=>e.unref(t).update.open(e.unref(s).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.table?.selectable&&e.unref(a)(o.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:h[1]||(h[1]=r=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:h[2]||(h[2]=r=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[o.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(p.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(p.ElButton),{type:"warning",loading:e.unref(t).export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(m.$slots,"tools-right"),o.option.tools?.refresh===void 0||o.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...r)=>e.unref(t).table.getList&&e.unref(t).table.getList(...r))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",de,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:e.unref(t).table.data,border:o.option.table?.border===void 0?!0:o.option.table?.border},o.option.table,{onSelectionChange:e.unref(t).table.selection.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change}),{default:e.withCtx(()=>[o.option.table?.selectable&&(e.unref(a)(o.option.tools?.delete)||o.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof o.option.table?.selectable=="function"?o.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(_,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:o.option},e.createSlots({_:2},[e.renderList(m.$slots,(r,d)=>({name:d,fn:e.withCtx(g=>[e.renderSlot(m.$slots,d,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(o.option.table?.add)||e.unref(a)(o.option.table?.update)||e.unref(a)(o.option.table?.delete)||m.$slots["table-op-left"]||m.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(a)(o.option.table?.add),e.unref(a)(o.option.table?.update),e.unref(a)(o.option.table?.delete),m.$slots["table-op-left"],m.$slots["table-op-right"]),align:"center",fixed:"right"},o.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(m.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.renderSlot(m.$slots,"table-op-left",{row:r}),o.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(p.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{link:"",type:"primary",onClick:e.unref(t).inlineEdit.submit,loading:e.unref(t).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(m.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(o.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:d=>e.unref(t).update.open(e.unref(s).Insert,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:d=>e.unref(t).update.open(e.unref(s).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:d=>e.unref(t).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-op-right",{row:r})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",me,[o.option.page?.show===void 0||o.option.page?.show?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=r=>e.unref(t).page.num=r),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=r=>e.unref(t).page.size=r),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":7,layout:e.unref(t).page.layout,total:e.unref(t).page.total,onSizeChange:e.unref(t).table.getList,onCurrentChange:e.unref(t).table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(m.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=r=>e.unref(t).update.show=r),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},o.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ke,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:c,model:e.unref(t).update.form,rules:e.unref(t).update.rules},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(t).update.formColumn,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(()=>{const d=[],g=w=>{if(w.children)return g(w.children);d.push(...w.map(V=>V.item.show?.form))};return g(r),d},e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:o.option.form?.stripe===void 0?!0:o.option.form?.stripe}])},[e.renderSlot(m.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,d=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(d.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(d.item.form.span>0?`col-${d.item.form.span}`:"col")},[d.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.children,g=>(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof g.item.text?.form?.label=="boolean"?!g.item.text?.form?.label:!1}),label:typeof g.item.text?.form?.label=="string"?g.item.text?.form?.label:g.item.label,prop:g.item.key,"label-width":g.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[e.renderSlot(m.$slots,"form-"+g.item.key+"-start",{row:e.unref(t).update.form,item:g.item}),e.createElementVNode("div",he,[e.renderSlot(m.$slots,"form-"+g.item.key,{row:e.unref(t).update.form,item:g.item},()=>[e.createVNode($,{conf:e.unref(t),item:d},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+g.item.key+"-right",{row:e.unref(t).update.form,item:g.item})]),e.renderSlot(m.$slots,"form-"+g.item.key+"-end",{row:e.unref(t).update.form,item:g.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof d.item.text?.form?.label=="boolean"?!d.item.text?.form?.label:!1}),label:typeof d.item.text?.form?.label=="string"?d.item.text?.form?.label:d.item.label,prop:d.item.key,"label-width":d.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.renderSlot(m.$slots,"form-"+d.item.key+"-start",{row:e.unref(t).update.form,item:d.item}),e.createElementVNode("div",ye,[e.renderSlot(m.$slots,"form-"+d.item.key,{row:e.unref(t).update.form,item:d.item},()=>[e.createVNode($,{conf:e.unref(t),item:d},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+d.item.key+"-right",{row:e.unref(t).update.form,item:d.item})]),e.renderSlot(m.$slots,"form-"+d.item.key+"-end",{row:e.unref(t).update.form,item:d.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(m.$slots,"form-end",{row:e.unref(t).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(p.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=r=>e.unref(t).remove.show=r),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(y).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(A,{ref_key:"switchConfirmRef",ref:n},null,512)])}}});class ue{static async download(i,s="download.png"){const l=document.createElement("a");l.style.display="none",l.href=i,l.setAttribute("download",s),typeof l.download>"u"&&l.setAttribute("target","_blank"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i)}static exportJSONFile=(i,s)=>{const l=new Blob([JSON.stringify(i)],{type:"application/json"}),a=URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async i=>new Promise((s,l)=>{const a=document.createElement("input");a.type="file";const t=i?.accept||".json";a.accept=t,a.style.display="none",a.onchange=n=>{const c=n.target.files[0];if(!c){k.fail("未选择文件"),l("未选择文件");return}const m=new FileReader;m.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},m.onerror=()=>{k.fail("文件读取失败"),l("文件读取失败")},m.readAsText(c),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(o,i)=>{if(o.component("TCurd",O),o.component("TFormList",S),o.component("TColumn",D),i?.customComponent){C.customComponent=i.customComponent;for(const s in i.customComponent)o.component(s,i.customComponent[s])}},we={install:T};u.ArrUtil=E,u.ExcelUtil=F,u.TColumn=D,u.TCurd=O,u.TFile=ue,u.TForm=C,u.TFormConfig=b,u.TFormI18n=y,u.TFormList=S,u.TSys=k,u.default=we,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.cc1Form={},u.Vue,u.ElementPlus))})(this,(function(u,e,p){"use strict";class b{static config={page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},dialog:{width:"980px",closeOnClickModal:!1},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0},columnConfig:{type:"input",form:{labelWidth:"100px",width:"100%"},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=i=>{b.config=ObjectUtil.deepMerge(b.config,i)}}class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(i,s)=>Array.isArray(i)?i.some(l=>typeof l=="function"?l(s):l):typeof i=="function"?i(s):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async i=>{if(!k.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const s=await k.moduleObj[i]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(i,s,l={}){const a=Date.now();if(!this.tipMessages[i]||a-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=a;const t=Object.assign({message:i,type:s},l);p.ElMessage(t),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,s={})=>{this.showMessage(i,"error",s)};static success=(i,s={})=>{this.showMessage(i,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=p.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,s=!0)=>{if(s){let l=screen.width/2-500,a=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+l)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(s,l)=>{let a=document.getElementById(i.id);const t=await k.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let c=n.toDataURL("image/png");s(c)})}catch(n){l(n)}})}class C{static customComponent={};static findOptions=(i,s)=>{const l=i.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(n,c)=>c.toUpperCase());if(l)return l.options[a(l.type)]};static setOptionsData=(i,s,l)=>{const a=C.findOptions(i,s);a&&(a.data=l)};static form={openBefore:{parentId:(i,s,l,a)=>{const t=b.config.table.rowKey;i?s.type===k.EDialog.Insert?(s.form.parentId=i[t],s.form.sort=i.children.length+1):s.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=l.length+1),C.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:l}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(i,s,l)=>{s[i]||(s[i]=[]);const a=b.config.table.rowKey;s[i].forEach(t=>{l.forEach(n=>{let c=n.default??"";n.type==="number"&&(c=n.default??0),n.type==="boolean"&&(c=n.default??!1),n.type==="time"&&(c=n.default??new Date),t[n.value]===void 0&&(t[n.value]=c)}),t[a]||(t[a]=E.getIdFun())})};static add=(i,s,l,a)=>{const t=JSONUtil.cp(l);E.setId(i,s,l);const n=b.config.table.rowKey;s[i].push(t.reduce((c,m)=>{let h=m.default??"";return m.type==="number"&&(h=m.default??0),m.type==="boolean"&&(h=m.default??!1),m.type==="time"&&(h=m.default??new Date),c[m.value]=h,c},{[n]:E.getIdFun()})),a?.(s)};static remove=(i,s,l,a)=>{const t=b.config.table.rowKey;s[i]=s[i].filter(n=>n[t]!==l[t]),a?.(s)};static getNoIdData=(i,s)=>{const l=JSONUtil.cp(i),a=b.config.table.rowKey;return l.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&E.getNoIdData(t[s],s)}),l}}const I={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},S=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(o,{emit:i}){const s=o,l=e.reactive({show:!1,add:(t,n,c)=>{E.add(t,n,c,()=>{a("change")})},remove:(t,n,c)=>{E.remove(t,n,c,()=>{a("change")})}});e.onMounted(()=>{E.setId(s.field,s.row,s.itemFields),l.show=!0});const a=i;return(t,n)=>{const c=e.resolveComponent("el-button"),m=e.resolveComponent("el-input");return l.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"list-start",{row:o.row}),e.createElementVNode("div",null,[e.createVNode(c,{link:"",type:"primary",onClick:n[0]||(n[0]=h=>l.add(o.field,o.row,o.itemFields))},{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.row[o.field],h=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"item-start",{item:h,row:o.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.itemFields,f=>(e.openBlock(),e.createBlock(m,{modelValue:h[f.value],"onUpdate:modelValue":r=>h[f.value]=r,style:e.normalizeStyle({width:o.inputWidth}),class:e.normalizeClass(o.inputClass),placeholder:f[o.label]||f[o.value],onChange:n[1]||(n[1]=r=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:o.row}),e.createVNode(c,{link:"",type:"danger",onClick:f=>l.remove(o.field,o.row,h)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:o.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(o,{expose:i}){const s=k.isFun,l=k.EDialog,a=e.ref(),t=o,n=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:c=>c.disabled?.[(t.type||l.Insert)===l.Insert?"create":"update"],initColumnForm:async()=>{const c=t.option;n.formColumn=[];const m=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let r=[];const d=g=>{if(n.formDefault[g.key]=g.value,g.isForm){g.form=g.form||{span:f},g.form.span=g.form.span??f;let w=g.form.span,V=r.reduce((x,Ce)=>x+Ce.span,w);const B=r.length;r.push({item:g,span:w}),(B===1&&r[0].span===0||V>=h||w===0&&B>1)&&(m.push(r),r=[]),g.rules&&(n.rules[g.key]=g.rules)}};c.column.forEach(g=>{g.isForm=!0,d(g)}),r.length>0&&m.push(r),n.formColumn=m,n.form=JSONUtil.cp(n.formDefault)},init:async()=>{n.show=!1,await e.nextTick(),n.initColumnForm()}});return n.initColumnForm(),i({ref:a,conf:n}),(c,m)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:a,model:n.form,rules:n.rules},{default:e.withCtx(()=>[n.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.formColumn,h=>(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(c.$slots,"form-start",{row:n.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(f.item.show?.form,n.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f.item.form.span>0?`col-${f.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"form-"+f.item.key+"-start",{row:n.form,item:f.item}),e.renderSlot(c.$slots,"form-"+f.item.key,{row:n.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:n.form,field:f.item.key},{ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(C).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(c.$slots,"form-"+f.item.key+"-end",{row:n.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(c.$slots,"form-end",{row:n.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ve(o){return o}const j={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class y{static t(i,...s){if(typeof i=="function")return i(...s);i=String(i);let l=0;return i.replace(/{([^}]+)}/g,(a,t)=>l<s.length?String(s[l++]):`{${t}}`)}static setI18n=i=>{y.curd=ObjectUtil.deepMerge(y.curd,i)};static tCurd(i,...s){return this.t(this.curd[i],...s)}static curd=j}class F{static exportToExcel=async(i,s,l)=>{if(!i||i.length===0)return;const a=await k.loadModule("xlsx"),t=i.map(m=>{const h={};return s.forEach(f=>{h[f.label]=m[f.key]}),h}),n=a.utils.json_to_sheet(t),c=a.utils.book_new();a.utils.book_append_sheet(c,n,"Sheet1"),l?typeof l=="function"&&(l=l()):l=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(c,`${l}.xlsx`)}}const N=k.EDialog,z=o=>{const i=e.ref(),s=e.ref(),l=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,t=y.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${t}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};o.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(l.search.form):n.show?.search)&&(a[n.key]=l.search.form[n.key])});const t=o.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const a=l.search.formDefault;Object.keys(a).forEach(t=>{o.option.search?.resetMode==="none"?a[t]=void 0:a[t]=l.search.formDefault[t]}),l.search.form=JSONUtil.cp(a),l.page.num=1,o.option.init!==!1&&l.table.getList()},submit:()=>{l.page.num=1,l.table.getList()}},page:{size:o.option.page?.size||10,sizeList:o.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:o.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...a)=>a.filter(n=>n).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{if(l.table.expand.isExpand)l.table.expand.rowKeys=[];else{const a=t=>{let n=[];return t.forEach(c=>{n.push(c[o.option.table.rowKey]),c.children&&c.children.length>0&&(n=n.concat(a(c.children)))}),n};l.table.expand.rowKeys=a(l.table.data)}l.table.expand.isExpand=!l.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{l.table.loading=!0;const a=o.option.api.list;try{await l.initApiData("init");const t=await a({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()}),n=b.config.result,c=t.data||{[n.list]:t};let m=(Array.isArray(c[n.list]),c[n.list]);const h=l.update.formColumn.flat(),f=JSONUtil.cp(m).map(r=>(Object.keys(r).forEach(g=>{const w=h.find(V=>V.item.key===g);if(w&&w.item.type==="select"){const V=w.item.options?.select?.data?.find(B=>B.value==r[g])?.label;V&&(r[g]=V)}}),r));l.table.data=o.option.data?await o.option.data(f,m):f,l.page.total=c[n.total]||0}catch(t){console.error(t)}finally{l.table.loading=!1}},selection:{list:[],change:a=>{l.table.selection.list=a}}},export:{run:{start:async a=>{let t=await l.export.run[a](),n=o.option.column;const c=JSONUtil.cp({data:t,columns:n}),m=o.option.tools?.export||{};m.before&&m.before(c),F.exportToExcel(c.data,c.columns,m.fileName)},select:()=>{if(l.table.selection.list.length===0)throw k.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return l.table.selection.list},page:()=>{if(l.table.data.length===0)throw k.fail(y.tCurd("noData")),new Error(y.tCurd("noData"));return l.table.data},all:async()=>{l.export.loading=!0;try{if(o.option.tools?.export?.all){await o.option.tools?.export?.all({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()});return}const a=o.option.api.list,t=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(a){console.error(a)}finally{l.export.loading=!1}}},loading:!1,click:a=>{l.export.loading||l.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>a.disabled?.[l.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(o.option.form?.editAll)return a;let t={[o.option.table?.rowKey]:l.update.edit.data[o.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(n=>{a[n]!==l.update.edit.data[n]&&(t[n]=a[n])}),t}},open:(a,t)=>{l.update.showContent||FunUtil.throttle(async()=>{k.loading(!0);try{await l.initApiData("update");const n=a===N.Insert;if(!n&&o.option.table?.inlineEdit){l.inlineEdit.open(t);return}l.update.type=a,l.update.edit.data=t,l.update.title=n?y.tCurd("add"):y.tCurd("edit"),l.update.form=JSONUtil.cp(n?l.update.formDefault:t),await o.option.form?.openBefore?.(t,l.update),l.update.show=!0,l.update.showContent=!0,o.option.form?.openAfter?.(t,l.update)}catch(n){console.error(n)}finally{k.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(c,m)=>new Promise((h,f)=>{c||(k.fail(y.tCurd("checkFormData")),f(!1)),h()})),l.update.loading=!0;const a=l.update.type===N.Insert?o.option.api.create:o.option.api.update;let t=JSONUtil.cp(l.update.form);delete t.children,await o.option.form?.submitBefore?.(t,l.update);const n=new Set(o.option.column.filter(c=>c.type==="datetime").map(c=>c.key));Object.keys(t).forEach(c=>{if(n.has(c)&&t[c]!=null){const m=new Date(t[c]).getTime();isNaN(m)||(t[c]=m)}});try{if(!a)return;await a({...t}),l.update.close(),await l.table.getList(),o.option.form?.submitAfter?.(t,l.update)}catch(c){console.error(c)}finally{l.update.loading=!1}})},close:()=>{l.update.show=!1,setTimeout(()=>{l.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{l.inlineEdit.row=a,l.inlineEdit.form=JSONUtil.cp(a)},close:()=>{l.inlineEdit.row=null,l.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{l.inlineEdit.loading=!0;const a=o.option.api.update;let t=JSONUtil.cp(l.inlineEdit.form);delete t.children;try{if(!a)return;await a({...t}),l.inlineEdit.close(),await l.table.getList(),k.success(y.tCurd("operationSuccess"))}catch(n){console.error(n)}finally{l.inlineEdit.loading=!1}})}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{l.remove.show=!1},open:a=>{if(a.length===0){k.fail(y.tCurd("selectDataToDelete"));return}l.remove.items=a,l.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{l.remove.loading=!0;const a=o.option.api.delete;try{if(!a)return;await a({[o.option.table?.rowKey]:l.remove.items.map(t=>t[o.option.table?.rowKey]),items:l.remove.items}),k.success(y.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(t){console.error(t)}finally{l.remove.loading=!1}})}},init:()=>{l.initCurdConfig(),l.initColumnOptions(),l.initColumnForm()},apiDataMap:{},initApiData:async a=>{const t=[],n=c=>{if(c.children&&c.children.length){c.children.forEach(m=>n(m));return}if(c.type==="select"&&c.options?.select?.dataApi&&c.options?.select?.dataApiConfig?.[a]){if(l.apiDataMap[c.key]&&c.options?.select?.dataApiConfig?.once)return;const m=(async()=>{try{let h=await c.options?.select?.dataApi?.();if(h){const f=c.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),c.options.select.data=h,l.apiDataMap[c.key]=h}}catch{}})();t.push(m)}};return o.option.column.forEach(c=>{n(c)}),await Promise.all(t),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=y.tCurd("noData");const t=ObjectUtil.deepMerge(a,o.option||{});Object.keys(t).forEach(n=>{o.option[n]=t[n]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:y.tCurd("switchOn"),inactiveLabel:y.tCurd("switchOff")}});const t=n=>{if(n.table=ObjectUtil.deepMerge(a.table,n.table||{}),n.children){n.children.forEach(c=>{t(c)});return}n.options=ObjectUtil.deepMerge(a.options,n.options||{}),n.form=ObjectUtil.deepMerge(a.form,n.form||{}),n.show=ObjectUtil.deepMerge(a.show,n.show||{}),n.sort=ObjectUtil.deepMerge(a.sort,n.sort||{}),n.type=n.type||a.type,n.type==="switch"&&(n.options.switch.tableBeforeChange=async(c,m)=>{const h=n.options?.switch;try{await i.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),l.table.loading=!0;try{return o.option.api.update?(await o.option.api.update({[o.option.table?.rowKey]:m[o.option.table?.rowKey],[c]:m[c]===h.activeValue?h.inactiveValue:h.activeValue,final(f,r,d){l.table.loading=!1}}),l.table.loading=!1,k.success(y.tCurd("operationSuccess")),l.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{l.table.loading=!1}}catch{return!1}}),n.type==="tree-select"&&(n.options.treeSelect.rowKey=o.option.table?.rowKey,n.options.treeSelect.nodeKey=o.option.table?.rowKey)};o.option.column.forEach(t),o.option.table?.column?.forEach(t)},initColumnForm:()=>{const a=o.option;l.update.formColumn=[],l.table.column.show={list:[],listSource:[]};const t=[],n=o.option.form?.maxSpan||12,c=o.option.form?.defaultSpan||n/2;let m=[];const h=d=>{if(d.children){l.table.column.show.list.push(d.key),d.children.forEach(g=>{h(g)});return}if(l.update.formDefault[d.key]=d.value,d.table.table&&(d.show.table&&l.table.column.show.list.push(d.key),d.table.table&&l.table.column.show.listSource.push(d.key)),d.isForm){d.form=d.form||{span:c},d.form.span=d.form.span??c;let g=d.form.span,w=m.reduce((B,x)=>B+x.span,g);const V=m.length;if(m.push({item:d,span:g}),(V===1&&m[0].span===0||w>=n||g===0&&V>1)&&(t.push(m),m=[]),d.rules){const B={input:y.tCurd("placeholderInput"),select:y.tCurd("placeholderSelect")},x=(B[d.type]||B.input)+d.label;l.update.rules[d.key]=typeof d.rules=="boolean"?[{required:!0,message:x,trigger:"blur"}]:d.rules}}},f=(d,g)=>{d.isForm=g,Array.isArray(d.children)&&d.children.forEach(w=>f(w,g))};a.column.forEach(d=>{d.isForm=!0,f(d,!0),h(d)}),o.option.table?.column?.forEach(d=>{f(d,!1),h(d)}),l.search.column.list=a.column.concat(a.table?.column||[]),l.table.column.list=l.search.column.list.filter(d=>d.table?.table),l.search.column.list.sort((d,g)=>d.sort?.search-g.sort?.search),l.table.column.list.sort((d,g)=>d.sort?.table-g.sort?.table),m.length>0&&t.push(m),l.update.formColumn=t;const r=o.option.search?.formDefault;r&&Object.keys(r).forEach(d=>{l.search.formDefault[d]=r[d]}),a.column.forEach(d=>{d.show?.search||(l.search.formDefault[d.key]=void 0)}),l.search.form=JSONUtil.cp(l.search.formDefault)}});return l.init(),e.onMounted(()=>{o.option.init!==!1&&l.table.getList()}),{conf:l,switchConfirmRef:i,ruleFormRef:s}},R={class:"dialog-footer"},A=e.defineComponent({__name:"switchConfirm",setup(o,{expose:i}){const s=e.ref(!1),l=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,n=null;const c=f=>(f?.title&&(l.value=f.title),f?.content&&(a.value=f.content),s.value=!0,new Promise((r,d)=>{t=r,n=d})),m=()=>{s.value=!1,t?.(!0),t=null,n=null},h=()=>{s.value=!1,n?.(new Error("用户取消操作")),t=null,n=null};return i({open:c}),(f,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=d=>s.value=d),title:l.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",R,[e.createVNode(e.unref(p.ElButton),{onClick:h},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:m},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"]))}}),U=(o,i)=>{const s=o.__vccOpts||o;for(const[l,a]of i)s[l]=a;return s},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(o,i){return e.openBlock(),e.createElementBlock("svg",H,[...i[0]||(i[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const W=U(K,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(o,i){return e.openBlock(),e.createElementBlock("svg",G,[...i[0]||(i[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)])])}const Q=U(q,[["render",X]]),Y={class:"row flex-center table-header-label"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(o){const i=e.getCurrentInstance().type;return(s,l)=>{const a=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.key},[o.conf.table.column.show.list.includes(t.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:t.key,label:t.label},{ref_for:!0},t.table),{header:e.withCtx(()=>[e.renderSlot(s.$slots,"table-header-"+t.key,{item:t},()=>[e.createElementVNode("div",Y,[t.table?.tooltip?(e.openBlock(),e.createBlock(a,{key:0,effect:"dark",content:t.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:1},8,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.label),1)])])]),default:e.withCtx(({row:n})=>[t.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[0]||(l[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),{conf:o.conf,columnList:t.children,option:o.option},e.createSlots({_:2},[e.renderList(s.$slots,(c,m)=>({name:m,fn:e.withCtx(h=>[e.renderSlot(s.$slots,m,e.mergeProps({ref_for:!0},h||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.show?.form&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===n&&(t.type==="input"||t.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.inlineEdit.form[t.key],"onUpdate:modelValue":c=>o.conf.inlineEdit.form[t.key]=c},{ref_for:!0},t.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:o.conf.inlineEdit.form[t.key],"onUpdate:modelValue":c=>o.conf.inlineEdit.form[t.key]=c},{ref_for:!0},t.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(s.$slots,"table-"+t.key,{key:1,row:n,item:t},()=>[t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:n[t.key],"onUpdate:modelValue":c=>n[t.key]=c,"before-change":()=>t.options?.switch?.tableBeforeChange?.(t.key,n)},{ref_for:!0},t.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":t.table?.click?.color}),class:e.normalizeClass({"table-text-click":t.table?.click?.callback}),onClick:c=>t.table?.click?.callback?.(n)},e.toDisplayString(n[t.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),$=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(o){return(i,s)=>o.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.input,e.toHandlers(o.item.item.options?.input?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.switch,{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.select,e.toHandlers(o.item.item.options?.select?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.select?.data,l=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:o.conf.update.form,field:o.item.item.key},o.item.item.options?.list,e.toHandlers(o.item.item.options?.list?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.treeSelect,e.toHandlers(o.item.item.options?.treeSelect?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):o.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.datetime,e.toHandlers(o.item.item.options?.datetime?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type&&e.unref(C).customComponent[o.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[o.item.item.type]),e.mergeProps({key:6,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=l=>o.conf.update.form[o.item.item.key]=l)},o.item.item.options?.[o.item.item.type],e.toHandlers(o.item.item.options?.[o.item.item.type]?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),v={class:"col relative cc1-form-box"},ee={class:"absolute row fit",style:{overflow:"hidden"}},te={class:"col column fit-width no-wrap"},oe={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ne={class:"flex items-center",style:{gap:"10px"}},ae={key:0},re={key:1},ie={key:2},se={class:"export-btn"},ce={class:"flex items-center",style:{gap:"10px"}},de={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},me={class:"row justify-end mt-10 mb-10"},pe={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ge={class:"row form-item-content",style:{width:"100%"}},ye={class:"col"},ke={class:"dialog-footer"},be={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(o,{expose:i}){const s=k.EDialog,l=o,a=k.isFun,{conf:t,switchConfirmRef:n,ruleFormRef:c}=z(l);return i({conf:t}),(m,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(m.$slots,"box-left"),e.createElementVNode("div",te,[o.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(p.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(t).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-"+r.key,{row:e.unref(t).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d,placeholder:e.unref(t).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.input,e.toHandlers(r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.switch,e.toHandlers(r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.select,e.toHandlers(r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d},{ref_for:!0},r.options?.datetime,e.toHandlers(r.options?.datetime?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(C).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":d=>e.unref(t).search.form[r.key]=d},{ref_for:!0},r.options?.[r.type],e.toHandlers(r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(m.$slots,"search-"+r.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(m.$slots,"search-center",{row:e.unref(t).search.form}),o.option.tools?.search||o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0},{default:e.withCtx(()=>[o.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.unref(a)(o.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:h[0]||(h[0]=r=>e.unref(t).update.open(e.unref(s).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.table?.selectable&&e.unref(a)(o.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:h[1]||(h[1]=r=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:h[2]||(h[2]=r=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[o.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(p.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(p.ElButton),{type:"warning",loading:e.unref(t).export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(m.$slots,"tools-right"),o.option.tools?.refresh===void 0||o.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...r)=>e.unref(t).table.getList&&e.unref(t).table.getList(...r))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",de,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:e.unref(t).table.data,border:o.option.table?.border===void 0?!0:o.option.table?.border},o.option.table,{onSelectionChange:e.unref(t).table.selection.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change}),{default:e.withCtx(()=>[o.option.table?.selectable||e.unref(a)(o.option.tools?.delete)||o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof o.option.table?.selectable=="function"?o.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(_,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:o.option},e.createSlots({_:2},[e.renderList(m.$slots,(r,d)=>({name:d,fn:e.withCtx(g=>[e.renderSlot(m.$slots,d,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(o.option.table?.add)||e.unref(a)(o.option.table?.update)||e.unref(a)(o.option.table?.delete)||m.$slots["table-op-left"]||m.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(a)(o.option.table?.add),e.unref(a)(o.option.table?.update),e.unref(a)(o.option.table?.delete),m.$slots["table-op-left"],m.$slots["table-op-right"]),align:"center",fixed:"right"},o.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(m.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.renderSlot(m.$slots,"table-op-left",{row:r}),o.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(p.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{link:"",type:"primary",onClick:e.unref(t).inlineEdit.submit,loading:e.unref(t).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(m.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(o.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:d=>e.unref(t).update.open(e.unref(s).Insert,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:d=>e.unref(t).update.open(e.unref(s).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:d=>e.unref(t).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-op-right",{row:r})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",me,[o.option.page?.show===void 0||o.option.page?.show?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=r=>e.unref(t).page.num=r),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=r=>e.unref(t).page.size=r),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":7,layout:e.unref(t).page.layout,total:e.unref(t).page.total,onSizeChange:e.unref(t).table.getList,onCurrentChange:e.unref(t).table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(m.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=r=>e.unref(t).update.show=r),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},o.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ke,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:c,model:e.unref(t).update.form,rules:e.unref(t).update.rules},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(t).update.formColumn,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(()=>{const d=[],g=w=>{if(w.children)return g(w.children);d.push(...w.map(V=>V.item.show?.form))};return g(r),d},e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:o.option.form?.stripe===void 0?!0:o.option.form?.stripe}])},[e.renderSlot(m.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,d=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(d.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(d.item.form.span>0?`col-${d.item.form.span}`:"col")},[d.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.children,g=>(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof g.item.text?.form?.label=="boolean"?!g.item.text?.form?.label:!1}),label:typeof g.item.text?.form?.label=="string"?g.item.text?.form?.label:g.item.label,prop:g.item.key,"label-width":g.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[e.renderSlot(m.$slots,"form-"+g.item.key+"-start",{row:e.unref(t).update.form,item:g.item}),e.createElementVNode("div",he,[e.renderSlot(m.$slots,"form-"+g.item.key,{row:e.unref(t).update.form,item:g.item},()=>[e.createVNode($,{conf:e.unref(t),item:d},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+g.item.key+"-right",{row:e.unref(t).update.form,item:g.item})]),e.renderSlot(m.$slots,"form-"+g.item.key+"-end",{row:e.unref(t).update.form,item:g.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof d.item.text?.form?.label=="boolean"?!d.item.text?.form?.label:!1}),label:typeof d.item.text?.form?.label=="string"?d.item.text?.form?.label:d.item.label,prop:d.item.key,"label-width":d.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.renderSlot(m.$slots,"form-"+d.item.key+"-start",{row:e.unref(t).update.form,item:d.item}),e.createElementVNode("div",ye,[e.renderSlot(m.$slots,"form-"+d.item.key,{row:e.unref(t).update.form,item:d.item},()=>[e.createVNode($,{conf:e.unref(t),item:d},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+d.item.key+"-right",{row:e.unref(t).update.form,item:d.item})]),e.renderSlot(m.$slots,"form-"+d.item.key+"-end",{row:e.unref(t).update.form,item:d.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(m.$slots,"form-end",{row:e.unref(t).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(p.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=r=>e.unref(t).remove.show=r),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(y).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(A,{ref_key:"switchConfirmRef",ref:n},null,512)])}}});class ue{static async download(i,s="download.png"){const l=document.createElement("a");l.style.display="none",l.href=i,l.setAttribute("download",s),typeof l.download>"u"&&l.setAttribute("target","_blank"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i)}static exportJSONFile=(i,s)=>{const l=new Blob([JSON.stringify(i)],{type:"application/json"}),a=URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async i=>new Promise((s,l)=>{const a=document.createElement("input");a.type="file";const t=i?.accept||".json";a.accept=t,a.style.display="none",a.onchange=n=>{const c=n.target.files[0];if(!c){k.fail("未选择文件"),l("未选择文件");return}const m=new FileReader;m.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},m.onerror=()=>{k.fail("文件读取失败"),l("文件读取失败")},m.readAsText(c),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(o,i)=>{if(o.component("TCurd",O),o.component("TFormList",S),o.component("TColumn",D),i?.customComponent){C.customComponent=i.customComponent;for(const s in i.customComponent)o.component(s,i.customComponent[s])}},we={install:T};u.ArrUtil=E,u.ExcelUtil=F,u.TColumn=D,u.TCurd=O,u.TFile=ue,u.TForm=C,u.TFormConfig=b,u.TFormI18n=y,u.TFormList=S,u.TSys=k,u.default=we,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -81,9 +81,9 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
81
81
|
value: string;
|
|
82
82
|
row: any;
|
|
83
83
|
itemFields: any[];
|
|
84
|
-
field: string;
|
|
85
84
|
inputWidth: string;
|
|
86
85
|
inputClass: string;
|
|
86
|
+
field: string;
|
|
87
87
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
88
88
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
89
89
|
row: {
|
|
@@ -138,9 +138,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
138
138
|
value: string;
|
|
139
139
|
row: any;
|
|
140
140
|
itemFields: any[];
|
|
141
|
-
field: string;
|
|
142
141
|
inputWidth: string;
|
|
143
142
|
inputClass: string;
|
|
143
|
+
field: string;
|
|
144
144
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
145
145
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
146
146
|
export default _default;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import { type CurdConfig, type CurdConfigColumn, type CurdOption } from './components/TCurd/indexType';
|
|
3
|
+
import type { curdConfType } from './components/TCurd/index';
|
|
3
4
|
import TColumn from './components/TCurd/com/form/column.vue';
|
|
4
5
|
import TFormList from './components/TCurd/com/form/list.vue';
|
|
5
6
|
import './components/TCurd/index.less';
|
|
@@ -45,7 +46,7 @@ export declare const install: (app: App, options?: {
|
|
|
45
46
|
[key: string]: any;
|
|
46
47
|
};
|
|
47
48
|
}) => void;
|
|
48
|
-
export { ArrUtil, ExcelUtil, TColumn, TCurd, TForm, TFormList, TFormI18n, TSys, TFile, TFormConfig, type CurdConfig, type CurdConfigColumn, type CurdOption };
|
|
49
|
+
export { ArrUtil, ExcelUtil, TColumn, TCurd, TForm, TFormList, TFormI18n, TSys, TFile, TFormConfig, type CurdConfig, type CurdConfigColumn, type CurdOption, type curdConfType };
|
|
49
50
|
declare const _default: {
|
|
50
51
|
install: (app: App, options?: {
|
|
51
52
|
/**
|