el-plus-crud 0.0.72 → 0.0.75

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/el-plus-crud.mjs +12 -12
  3. package/example/App.vue +68 -67
  4. package/lib/components/el-plus-form/ElPlusForm.vue +1 -0
  5. package/lib/components/el-plus-form/ElPlusFormDialog.vue +89 -88
  6. package/lib/components/el-plus-form/ElPlusFormGroup.vue +1 -0
  7. package/lib/components/el-plus-form/components/ElPlusFormBtn.vue +1 -0
  8. package/lib/components/el-plus-form/components/ElPlusFormBtns.vue +1 -0
  9. package/lib/components/el-plus-form/components/ElPlusFormFile.vue +48 -47
  10. package/lib/components/el-plus-form/components/ElPlusFormInput.vue +63 -62
  11. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +283 -282
  12. package/lib/components/el-plus-form/components/ElPlusFormLkuser.vue +491 -490
  13. package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +148 -147
  14. package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +45 -44
  15. package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +97 -96
  16. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +163 -162
  17. package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +51 -50
  18. package/lib/components/el-plus-form/components/ElPlusFormUpbtn.vue +145 -144
  19. package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +370 -369
  20. package/lib/components/el-plus-form/components/components/file-icons/FileIcons.vue +136 -135
  21. package/lib/components/el-plus-table/ElPlusTable.vue +1 -0
  22. package/lib/components/el-plus-table/components/columnItem.vue +213 -212
  23. package/lib/components/el-plus-table/components/header.vue +1 -0
  24. package/lib/components/el-plus-table/components/settingColumn.vue +179 -178
  25. package/lib/components/el-plus-table/util/index.ts +148 -147
  26. package/lib/config/index.ts +32 -30
  27. package/lib/index.ts +52 -51
  28. package/package-lock.json +2 -2
  29. package/package.json +1 -1
  30. package/types/formList.d.ts +98 -91
  31. package/types/global.d.ts +13 -145
  32. package/types/axios.d.ts +0 -13
  33. package/types/layout.d.ts +0 -57
  34. package/types/mitt.d.ts +0 -38
  35. package/types/pinia.d.ts +0 -149
  36. package/types/views.d.ts +0 -329
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.75](https://github.com/KDJack/el-plus-crud/compare/v0.0.74...v0.0.75) (2023-09-04)
6
+
7
+ ### [0.0.74](https://github.com/KDJack/el-plus-crud/compare/v0.0.73...v0.0.74) (2023-09-04)
8
+
9
+ ### [0.0.73](https://github.com/KDJack/el-plus-crud/compare/v0.0.72...v0.0.73) (2023-09-04)
10
+
5
11
  ### [0.0.72](https://github.com/KDJack/el-plus-crud/compare/v0.0.71...v0.0.72) (2023-09-01)
6
12
 
7
13
  ### [0.0.71](https://github.com/KDJack/el-plus-crud/compare/v0.0.70...v0.0.71) (2023-09-01)
@@ -4040,7 +4040,7 @@ function Kj(d, s, l, o, p, g) {
4040
4040
  return D(), V("svg", Gj, Hj);
4041
4041
  }
4042
4042
  var Jj = /* @__PURE__ */ Nl(Wj, [["render", Kj], ["__file", "warning-filled.vue"]]);
4043
- const $j = (d) => (Uu("data-v-7746b4bb"), d = d(), Vu(), d), qj = { class: "el-button el-plus-form-up-btn" }, Xj = /* @__PURE__ */ $j(() => /* @__PURE__ */ ve("div", null, null, -1)), ez = {
4043
+ const $j = (d) => (Uu("data-v-0866afea"), d = d(), Vu(), d), qj = { class: "el-button el-plus-form-up-btn" }, Xj = /* @__PURE__ */ $j(() => /* @__PURE__ */ ve("div", null, null, -1)), ez = {
4044
4044
  name: "ElPlusFormUpbtn",
4045
4045
  inheritAttrs: !1,
4046
4046
  typeName: "upbtn",
@@ -4136,7 +4136,7 @@ const $j = (d) => (Uu("data-v-7746b4bb"), d = d(), Vu(), d), qj = { class: "el-b
4136
4136
  };
4137
4137
  }
4138
4138
  });
4139
- const Cl = /* @__PURE__ */ Ge(tz, [["__scopeId", "data-v-7746b4bb"]]), nz = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Cl }, Symbol.toStringTag, { value: "Module" })), lz = /* @__PURE__ */ ve("i", { class: "ele-ArrowDown el-icon--right" }, null, -1), rz = {
4139
+ const Cl = /* @__PURE__ */ Ge(tz, [["__scopeId", "data-v-0866afea"]]), nz = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Cl }, Symbol.toStringTag, { value: "Module" })), lz = /* @__PURE__ */ ve("i", { class: "ele-ArrowDown el-icon--right" }, null, -1), rz = {
4140
4140
  name: "ElPlusFormBtns",
4141
4141
  inheritAttrs: !1,
4142
4142
  typeName: "btns",
@@ -4720,7 +4720,7 @@ const Uz = (d = "", s, l = !1) => d ? (l ? Vz(d) : d.length) > s ? d.substring(0
4720
4720
  };
4721
4721
  }
4722
4722
  });
4723
- const Zz = /* @__PURE__ */ Ge(Gz, [["__scopeId", "data-v-8343f7e6"]]), Hz = {
4723
+ const Zz = /* @__PURE__ */ Ge(Gz, [["__scopeId", "data-v-d9487625"]]), Hz = {
4724
4724
  key: 1,
4725
4725
  class: "no-img-tip"
4726
4726
  }, Kz = {
@@ -4857,7 +4857,7 @@ const n2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4857
4857
  ]), 1040, ["disabled", "modelValue"])) : X("", !0);
4858
4858
  };
4859
4859
  }
4860
- }), r2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Wi }, Symbol.toStringTag, { value: "Module" })), u2 = (d) => (Uu("data-v-f4467b2e"), d = d(), Vu(), d), o2 = { class: "el-plus-form-link" }, s2 = {
4860
+ }), r2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Wi }, Symbol.toStringTag, { value: "Module" })), u2 = (d) => (Uu("data-v-1574c09b"), d = d(), Vu(), d), o2 = { class: "el-plus-form-link" }, s2 = {
4861
4861
  style: { width: "100%" },
4862
4862
  class: "form-link-dialog"
4863
4863
  }, i2 = { class: "panel-left" }, a2 = {
@@ -5024,7 +5024,7 @@ const n2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5024
5024
  };
5025
5025
  }
5026
5026
  });
5027
- const Gi = /* @__PURE__ */ Ge(d2, [["__scopeId", "data-v-f4467b2e"]]), g2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Gi }, Symbol.toStringTag, { value: "Module" })), N2 = (d) => (Uu("data-v-e8e51c12"), d = d(), Vu(), d), p2 = { class: "el-plus-form-link-user" }, j2 = {
5027
+ const Gi = /* @__PURE__ */ Ge(d2, [["__scopeId", "data-v-1574c09b"]]), g2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Gi }, Symbol.toStringTag, { value: "Module" })), N2 = (d) => (Uu("data-v-aea8f33b"), d = d(), Vu(), d), p2 = { class: "el-plus-form-link-user" }, j2 = {
5028
5028
  style: { width: "100%" },
5029
5029
  class: "form-link-user-dialog"
5030
5030
  }, z2 = { class: "panel-left" }, y2 = { class: "dept-breadcrumb" }, D2 = { style: { display: "flex", "align-items": "center" } }, _2 = { class: "panel-right" }, m2 = /* @__PURE__ */ N2(() => /* @__PURE__ */ ve("div", { class: "right-title" }, "已选中项:", -1)), h2 = { class: "btn-panel" }, v2 = {
@@ -5361,7 +5361,7 @@ const Gi = /* @__PURE__ */ Ge(d2, [["__scopeId", "data-v-f4467b2e"]]), g2 = /* @
5361
5361
  };
5362
5362
  }
5363
5363
  });
5364
- const Zi = /* @__PURE__ */ Ge(w2, [["__scopeId", "data-v-e8e51c12"]]), A2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Zi }, Symbol.toStringTag, { value: "Module" })), I2 = {
5364
+ const Zi = /* @__PURE__ */ Ge(w2, [["__scopeId", "data-v-aea8f33b"]]), A2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Zi }, Symbol.toStringTag, { value: "Module" })), I2 = {
5365
5365
  name: "ElPlusFormNbinput",
5366
5366
  inheritAttrs: !1,
5367
5367
  typeName: "nbinput",
@@ -5486,7 +5486,7 @@ const Y2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5486
5486
  };
5487
5487
  }
5488
5488
  });
5489
- const Ki = /* @__PURE__ */ Ge(T2, [["__scopeId", "data-v-a0cef206"]]), E2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Ki }, Symbol.toStringTag, { value: "Module" })), b2 = {
5489
+ const Ki = /* @__PURE__ */ Ge(T2, [["__scopeId", "data-v-8f959b46"]]), E2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Ki }, Symbol.toStringTag, { value: "Module" })), b2 = {
5490
5490
  name: "ElPlusFormPassword",
5491
5491
  inheritAttrs: !1,
5492
5492
  typeName: "password",
@@ -6926,7 +6926,7 @@ const _D = {
6926
6926
  title: { default: "" },
6927
6927
  tableRef: {},
6928
6928
  success: {},
6929
- successTip: { default: "操作成功!" }
6929
+ successTip: { type: [String, Function], default: "操作成功!" }
6930
6930
  },
6931
6931
  emits: ["update:show", "update:modelValue"],
6932
6932
  setup(d, { emit: s }) {
@@ -6944,7 +6944,7 @@ const _D = {
6944
6944
  }
6945
6945
  }), g = _(null), { width: h, top: m, modal: f, appendToBody: a, showClose: v, draggable: j, closeOnClickModal: Y, ...O } = Object.assign({ width: "700px", draggable: !0, top: "15vh", closeOnClickModal: !1, showCancel: !0 }, Ie()), T = { width: h, top: m, modal: f, appendToBody: a, showClose: v, draggable: j, closeOnClickModal: Y };
6946
6946
  function A(U) {
6947
- l.success ? l.success(U) : l.tableRef && (cn.success(l.successTip), l.tableRef.reload(), p.value = !1, setTimeout(() => {
6947
+ l.success ? l.success(U) : l.tableRef && (cn.success(typeof l.successTip == "function" ? l.successTip() : l.successTip), l.tableRef.reload(), p.value = !1, setTimeout(() => {
6948
6948
  U.callBack();
6949
6949
  }, 200));
6950
6950
  }
@@ -7198,7 +7198,7 @@ const ID = { class: "el-plus-table-edit-column" }, YD = { class: "select-panel"
7198
7198
  };
7199
7199
  }
7200
7200
  });
7201
- const Yi = /* @__PURE__ */ Ge(TD, [["__scopeId", "data-v-c53d7d2d"]]);
7201
+ const Yi = /* @__PURE__ */ Ge(TD, [["__scopeId", "data-v-9e07d863"]]);
7202
7202
  function ED() {
7203
7203
  return !!navigator.userAgent.match(/('phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone')/i);
7204
7204
  }
@@ -7451,7 +7451,7 @@ const xD = (d, s) => {
7451
7451
  };
7452
7452
  }
7453
7453
  });
7454
- const VD = /* @__PURE__ */ Ge(UD, [["__scopeId", "data-v-65fb4aed"]]), QD = { style: { width: "100%", display: "flex" } }, FD = /* @__PURE__ */ fe({
7454
+ const VD = /* @__PURE__ */ Ge(UD, [["__scopeId", "data-v-43f282da"]]), QD = { style: { width: "100%", display: "flex" } }, FD = /* @__PURE__ */ fe({
7455
7455
  __name: "columnItem",
7456
7456
  props: {
7457
7457
  modelValue: {},
@@ -7532,7 +7532,7 @@ const VD = /* @__PURE__ */ Ge(UD, [["__scopeId", "data-v-65fb4aed"]]), QD = { st
7532
7532
  };
7533
7533
  }
7534
7534
  });
7535
- const Li = /* @__PURE__ */ Ge(FD, [["__scopeId", "data-v-a05a9b79"]]), RD = { class: "el-plus-table-content" }, WD = {
7535
+ const Li = /* @__PURE__ */ Ge(FD, [["__scopeId", "data-v-8f824803"]]), RD = { class: "el-plus-table-content" }, WD = {
7536
7536
  key: 1,
7537
7537
  class: "table-tabs-panel"
7538
7538
  }, GD = { class: "el-plus-table-main" }, ZD = { key: 1 }, HD = {
package/example/App.vue CHANGED
@@ -1,67 +1,68 @@
1
- <template>
2
- <el-config-provider :locale="zhCn">
3
- <div class="layout-padding">
4
- <ElPlusFormGroup v-model="formData" :formGroup="formGroupConfig">
5
- <template #default0>default0插槽</template>
6
- <template #default1>default1插槽</template>
7
- <template #default2>default2插槽</template>
8
- </ElPlusFormGroup>
9
- </div>
10
- </el-config-provider>
11
- </template>
12
-
13
- <script setup lang="ts" name="systemUser">
14
- import { reactive, ref, onMounted } from 'vue'
15
- import zhCn from 'element-plus/es/locale/lang/zh-cn'
16
- import { ElMessage } from 'element-plus'
17
-
18
- let formData = reactive({
19
- name: 'xiaoha'
20
- } as any)
21
- const formGroupConfig = ref({
22
- column: 2,
23
- requestFn: () => {},
24
- beforeRequest: (data: any) => {
25
- return data
26
- },
27
- success: (formBack: IFormBack) => {
28
- ElMessage.success('保存成功~')
29
- // 表单回调
30
- formBack.callBack && formBack.callBack()
31
- },
32
- group: [
33
- {
34
- title: '基本信息',
35
- formDesc: {
36
- name: { type: 'input', label: '名称', require: true, attrs: { maxlength: 30 } },
37
- contactsName: { type: 'input', label: '联系人', require: true, attrs: { maxlength: 20 } },
38
- contactsPhone: { type: 'input', label: '联系电话', rules: 'phone', require: true }
39
- } as IFormDesc
40
- },
41
- {
42
- title: '地址信息',
43
- formDesc: {
44
- // _area: { type: 'area', label: '所在地区', require: true },
45
- address: { type: 'input', label: '详细地址', require: true, attrs: { maxlength: 50 } }
46
- } as IFormDesc
47
- },
48
- // {
49
- // title: '文件上传',
50
- // formDesc: {
51
- // businessLicense: { type: 'upload', label: '营业执照', require: true, colspan: 2 },
52
- // appendix: { type: 'upload', upType: 'file', label: '附件', multiple: true, require: true, colspan: 2 }
53
- // } as IFormDesc
54
- // },
55
- {
56
- title: '备注信息',
57
- formDesc: {
58
- remark: { type: 'textarea', label: '备注', colspan: 2, require: true }
59
- } as IFormDesc
60
- }
61
- ]
62
- } as IFormGroupConfig)
63
-
64
- onMounted(async () => {
65
- // 初始化部门列表
66
- })
67
- </script>
1
+ <template>
2
+ <el-config-provider :locale="zhCn">
3
+ <div class="layout-padding">
4
+ <ElPlusFormGroup v-model="formData" :formGroup="formGroupConfig">
5
+ <template #default0>default0插槽</template>
6
+ <template #default1>default1插槽</template>
7
+ <template #default2>default2插槽</template>
8
+ </ElPlusFormGroup>
9
+ </div>
10
+ </el-config-provider>
11
+ </template>
12
+
13
+ <script setup lang="ts" name="systemUser">
14
+ import { reactive, ref, onMounted } from 'vue'
15
+ import zhCn from 'element-plus/es/locale/lang/zh-cn'
16
+ import { ElMessage } from 'element-plus'
17
+ import { IFormBack, IFormDesc, IFormGroupConfig } from 'types/formList'
18
+
19
+ let formData = reactive({
20
+ name: 'xiaoha'
21
+ } as any)
22
+ const formGroupConfig = ref({
23
+ column: 2,
24
+ // requestFn: () => {},
25
+ beforeRequest: (data: any) => {
26
+ return data
27
+ },
28
+ success: (formBack: IFormBack) => {
29
+ ElMessage.success('保存成功~')
30
+ // 表单回调
31
+ formBack.callBack && formBack.callBack()
32
+ },
33
+ group: [
34
+ {
35
+ title: '基本信息',
36
+ formDesc: {
37
+ name: { type: 'input', label: '名称', require: true, attrs: { maxlength: 30 } },
38
+ contactsName: { type: 'input', label: '联系人', require: true, attrs: { maxlength: 20 } },
39
+ contactsPhone: { type: 'input', label: '联系电话', rules: 'phone', require: true }
40
+ } as IFormDesc
41
+ },
42
+ {
43
+ title: '地址信息',
44
+ formDesc: {
45
+ // _area: { type: 'area', label: '所在地区', require: true },
46
+ address: { type: 'input', label: '详细地址', require: true, attrs: { maxlength: 50 } }
47
+ } as IFormDesc
48
+ },
49
+ // {
50
+ // title: '文件上传',
51
+ // formDesc: {
52
+ // businessLicense: { type: 'upload', label: '营业执照', require: true, colspan: 2 },
53
+ // appendix: { type: 'upload', upType: 'file', label: '附件', multiple: true, require: true, colspan: 2 }
54
+ // } as IFormDesc
55
+ // },
56
+ {
57
+ title: '备注信息',
58
+ formDesc: {
59
+ remark: { type: 'textarea', label: '备注', colspan: 2, require: true }
60
+ } as IFormDesc
61
+ }
62
+ ]
63
+ } as IFormGroupConfig)
64
+
65
+ onMounted(async () => {
66
+ // 初始化部门列表
67
+ })
68
+ </script>
@@ -45,6 +45,7 @@ import * as validates from './util/validate'
45
45
  import { typeList } from './components/index'
46
46
  import ElPlusFormBtn from './components/ElPlusFormBtn.vue'
47
47
  import { cloneDeep } from 'lodash'
48
+ import { ICRUDConfig, IFormBack, IFormDescItem } from 'types/formList'
48
49
 
49
50
  // IFormProps定义
50
51
  export interface IFormProps {
@@ -1,88 +1,89 @@
1
- <template>
2
- <el-dialog class="el-plus-form-dialog" v-model="currentShow" :title="props.title" v-bind="dialogAttrs" @closed="handelClosed">
3
- <!-- title 插槽 -->
4
- <template #header>
5
- <slot name="header" />
6
- </template>
7
- <ElPlusForm ref="refElPlusDialogForm" style="padding: 20px" :isDialog="true" v-model="currentValue" v-bind="attrs" :success="dialogSuccess" @cancel="currentShow = false">
8
- <template #top>
9
- <slot name="top" />
10
- </template>
11
- <template #default>
12
- <slot name="default" />
13
- </template>
14
- </ElPlusForm>
15
- </el-dialog>
16
- </template>
17
- <script lang="ts">
18
- export default {
19
- name: 'ElPlusFormDialog',
20
- inheritAttrs: false,
21
- customOptions: {}
22
- }
23
- </script>
24
- <script lang="ts" setup>
25
- import { ref, computed, useAttrs } from 'vue'
26
- import ElPlusForm from './ElPlusForm.vue'
27
- import { ElMessage } from 'element-plus'
28
-
29
- const emits = defineEmits(['update:show', 'update:modelValue'])
30
- const props = withDefaults(defineProps<{ modelValue?: { [key: string]: any } | {}; show?: boolean; title?: string; tableRef?: any; success?: Function; successTip?: string }>(), {
31
- title: '',
32
- modelValue: () => {
33
- return {}
34
- },
35
- show: false,
36
- successTip: '操作成功!'
37
- })
38
-
39
- // 重新定义当前值
40
- const currentValue = computed({
41
- get: () => props.modelValue,
42
- set(val: any) {
43
- emits('update:modelValue', val)
44
- }
45
- })
46
-
47
- // 是否显示弹框
48
- const currentShow = computed({
49
- get() {
50
- return props.show
51
- },
52
- set(val: boolean) {
53
- emits('update:show', val)
54
- }
55
- })
56
- const refElPlusDialogForm = ref(null as any)
57
-
58
- // 合并属性
59
- const { width, top, modal, appendToBody, showClose, draggable, closeOnClickModal, ...attrs } = Object.assign({ width: '700px', draggable: true, top: '15vh', closeOnClickModal: false, showCancel: true }, useAttrs())
60
- // 弹框属性
61
- const dialogAttrs = { width, top, modal, appendToBody, showClose, draggable, closeOnClickModal }
62
-
63
- /**
64
- * 这里重新定义一下成功事件
65
- * @param formBack
66
- */
67
- function dialogSuccess(formBack: IFormBack) {
68
- if (props.success) {
69
- props.success(formBack)
70
- } else {
71
- if (props.tableRef) {
72
- ElMessage.success(props.successTip)
73
- props.tableRef.reload()
74
- currentShow.value = false
75
- setTimeout(() => {
76
- formBack.callBack()
77
- }, 200)
78
- }
79
- }
80
- }
81
-
82
- /**
83
- * 处理弹框关闭
84
- */
85
- function handelClosed() {
86
- refElPlusDialogForm.value?.clear()
87
- }
88
- </script>
1
+ <template>
2
+ <el-dialog class="el-plus-form-dialog" v-model="currentShow" :title="props.title" v-bind="dialogAttrs" @closed="handelClosed">
3
+ <!-- title 插槽 -->
4
+ <template #header>
5
+ <slot name="header" />
6
+ </template>
7
+ <ElPlusForm ref="refElPlusDialogForm" style="padding: 20px" :isDialog="true" v-model="currentValue" v-bind="attrs" :success="dialogSuccess" @cancel="currentShow = false">
8
+ <template #top>
9
+ <slot name="top" />
10
+ </template>
11
+ <template #default>
12
+ <slot name="default" />
13
+ </template>
14
+ </ElPlusForm>
15
+ </el-dialog>
16
+ </template>
17
+ <script lang="ts">
18
+ export default {
19
+ name: 'ElPlusFormDialog',
20
+ inheritAttrs: false,
21
+ customOptions: {}
22
+ }
23
+ </script>
24
+ <script lang="ts" setup>
25
+ import { ref, computed, useAttrs } from 'vue'
26
+ import ElPlusForm from './ElPlusForm.vue'
27
+ import { ElMessage } from 'element-plus'
28
+ import { IFormBack } from 'types/formList'
29
+
30
+ const emits = defineEmits(['update:show', 'update:modelValue'])
31
+ const props = withDefaults(defineProps<{ modelValue?: { [key: string]: any } | {}; show?: boolean; title?: string; tableRef?: any; success?: Function; successTip?: string | ((data?: any) => string) }>(), {
32
+ title: '',
33
+ modelValue: () => {
34
+ return {}
35
+ },
36
+ show: false,
37
+ successTip: '操作成功!'
38
+ })
39
+
40
+ // 重新定义当前值
41
+ const currentValue = computed({
42
+ get: () => props.modelValue,
43
+ set(val: any) {
44
+ emits('update:modelValue', val)
45
+ }
46
+ })
47
+
48
+ // 是否显示弹框
49
+ const currentShow = computed({
50
+ get() {
51
+ return props.show
52
+ },
53
+ set(val: boolean) {
54
+ emits('update:show', val)
55
+ }
56
+ })
57
+ const refElPlusDialogForm = ref(null as any)
58
+
59
+ // 合并属性
60
+ const { width, top, modal, appendToBody, showClose, draggable, closeOnClickModal, ...attrs } = Object.assign({ width: '700px', draggable: true, top: '15vh', closeOnClickModal: false, showCancel: true }, useAttrs())
61
+ // 弹框属性
62
+ const dialogAttrs = { width, top, modal, appendToBody, showClose, draggable, closeOnClickModal }
63
+
64
+ /**
65
+ * 这里重新定义一下成功事件
66
+ * @param formBack
67
+ */
68
+ function dialogSuccess(formBack: IFormBack) {
69
+ if (props.success) {
70
+ props.success(formBack)
71
+ } else {
72
+ if (props.tableRef) {
73
+ ElMessage.success(typeof props.successTip === 'function' ? props.successTip() : props.successTip)
74
+ props.tableRef.reload()
75
+ currentShow.value = false
76
+ setTimeout(() => {
77
+ formBack.callBack()
78
+ }, 200)
79
+ }
80
+ }
81
+ }
82
+
83
+ /**
84
+ * 处理弹框关闭
85
+ */
86
+ function handelClosed() {
87
+ refElPlusDialogForm.value?.clear()
88
+ }
89
+ </script>
@@ -23,6 +23,7 @@ export default {
23
23
  import { cloneDeep } from 'lodash'
24
24
  import { computed, ref, useSlots } from 'vue'
25
25
  import ElPlusForm, { IFormProps } from './ElPlusForm.vue'
26
+ import { IFormDesc, IFormGroupConfig } from 'types/formList'
26
27
 
27
28
  const emits = defineEmits(['update:show', 'update:modelValue', 'before-validate', 'before-request', 'request-success', 'request-error', 'request-end', 'request'])
28
29
  const props = defineProps<{
@@ -29,6 +29,7 @@ export default {
29
29
  <script lang="ts" setup>
30
30
  import { ref, computed, useAttrs, watch, inject } from 'vue'
31
31
  import { cloneDeep } from 'lodash'
32
+ import { IBtnBack, ICRUDConfig } from 'types/formList'
32
33
 
33
34
  const defaultConf = inject('defaultConf') as ICRUDConfig
34
35
 
@@ -35,6 +35,7 @@ import { ref, computed, watch, onMounted } from 'vue'
35
35
  import ElPlusFormBtn from './ElPlusFormBtn.vue'
36
36
  import ElPlusFormUpbtn from './ElPlusFormUpbtn.vue'
37
37
  import { ElMessageBox } from 'element-plus'
38
+ import { IBtnBack } from 'types/formList'
38
39
 
39
40
  const props = defineProps<{
40
41
  field: string
@@ -1,47 +1,48 @@
1
- <template>
2
- <div class="ele-form-file" :style="{ marginTop: props.modelValue && props.modelValue.length > 0 ? '10px' : '0' }">
3
- <template v-if="props.modelValue && props.modelValue.length > 0">
4
- <FileIcons :files="props.modelValue" showName preview />
5
- </template>
6
- <span v-else class="no-img-tip">暂无内容</span>
7
- </div>
8
- </template>
9
- <script lang="ts">
10
- export default {
11
- name: 'ElPlusFormFile',
12
- inheritAttrs: false,
13
- typeName: 'file',
14
- customOptions: {}
15
- }
16
- </script>
17
- <script lang="ts" setup>
18
- import FileIcons from './components/file-icons/FileIcons.vue'
19
-
20
- const props = defineProps<{
21
- modelValue?: Array<IOssInfo>
22
- field: string
23
- loading?: boolean
24
- desc: { [key: string]: any }
25
- formData: { [key: string]: any }
26
- }>()
27
- </script>
28
- <style lang="scss">
29
- .ele-form-file {
30
- width: 100%;
31
- display: flex;
32
- justify-content: center;
33
- margin-top: 10px;
34
-
35
- .form-file-list {
36
- display: flex;
37
- flex-direction: column;
38
- width: 100%;
39
- }
40
-
41
- .no-img-tip {
42
- width: 100%;
43
- color: #999999;
44
- padding-left: 20px;
45
- }
46
- }
47
- </style>
1
+ <template>
2
+ <div class="ele-form-file" :style="{ marginTop: props.modelValue && props.modelValue.length > 0 ? '10px' : '0' }">
3
+ <template v-if="props.modelValue && props.modelValue.length > 0">
4
+ <FileIcons :files="props.modelValue" showName preview />
5
+ </template>
6
+ <span v-else class="no-img-tip">暂无内容</span>
7
+ </div>
8
+ </template>
9
+ <script lang="ts">
10
+ export default {
11
+ name: 'ElPlusFormFile',
12
+ inheritAttrs: false,
13
+ typeName: 'file',
14
+ customOptions: {}
15
+ }
16
+ </script>
17
+ <script lang="ts" setup>
18
+ import { IOssInfo } from 'types/formList'
19
+ import FileIcons from './components/file-icons/FileIcons.vue'
20
+
21
+ const props = defineProps<{
22
+ modelValue?: Array<IOssInfo>
23
+ field: string
24
+ loading?: boolean
25
+ desc: { [key: string]: any }
26
+ formData: { [key: string]: any }
27
+ }>()
28
+ </script>
29
+ <style lang="scss">
30
+ .ele-form-file {
31
+ width: 100%;
32
+ display: flex;
33
+ justify-content: center;
34
+ margin-top: 10px;
35
+
36
+ .form-file-list {
37
+ display: flex;
38
+ flex-direction: column;
39
+ width: 100%;
40
+ }
41
+
42
+ .no-img-tip {
43
+ width: 100%;
44
+ color: #999999;
45
+ padding-left: 20px;
46
+ }
47
+ }
48
+ </style>