el-plus-crud 0.0.74 → 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 (25) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/el-plus-crud.mjs +9 -9
  3. package/example/App.vue +68 -68
  4. package/lib/components/el-plus-form/ElPlusFormDialog.vue +89 -89
  5. package/lib/components/el-plus-form/components/ElPlusFormFile.vue +48 -48
  6. package/lib/components/el-plus-form/components/ElPlusFormInput.vue +63 -63
  7. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +283 -283
  8. package/lib/components/el-plus-form/components/ElPlusFormLkuser.vue +491 -491
  9. package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +148 -148
  10. package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +45 -45
  11. package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +97 -97
  12. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +163 -163
  13. package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +51 -51
  14. package/lib/components/el-plus-form/components/ElPlusFormUpbtn.vue +145 -145
  15. package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +370 -370
  16. package/lib/components/el-plus-form/components/components/file-icons/FileIcons.vue +136 -136
  17. package/lib/components/el-plus-table/components/columnItem.vue +213 -213
  18. package/lib/components/el-plus-table/components/settingColumn.vue +179 -179
  19. package/lib/components/el-plus-table/util/index.ts +148 -148
  20. package/lib/config/index.ts +32 -32
  21. package/lib/index.ts +52 -52
  22. package/package-lock.json +2 -2
  23. package/package.json +1 -1
  24. package/types/formList.d.ts +1 -0
  25. package/types/global.d.ts +13 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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
+
5
7
  ### [0.0.74](https://github.com/KDJack/el-plus-crud/compare/v0.0.73...v0.0.74) (2023-09-04)
6
8
 
7
9
  ### [0.0.73](https://github.com/KDJack/el-plus-crud/compare/v0.0.72...v0.0.73) (2023-09-04)
@@ -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-e757586c"), 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-e757586c"), d = d(), Vu(), d), qj = { class: "el-b
4136
4136
  };
4137
4137
  }
4138
4138
  });
4139
- const Cl = /* @__PURE__ */ Ge(tz, [["__scopeId", "data-v-e757586c"]]), 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-647fba8b"]]), 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-e5d0b5fa"), 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-e5d0b5fa"]]), g2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Gi }, Symbol.toStringTag, { value: "Module" })), N2 = (d) => (Uu("data-v-a6b27e5a"), 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-e5d0b5fa"]]), g2 = /* @
5361
5361
  };
5362
5362
  }
5363
5363
  });
5364
- const Zi = /* @__PURE__ */ Ge(w2, [["__scopeId", "data-v-a6b27e5a"]]), 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-8cf9fc98"]]), 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",
@@ -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-9d331899"]]);
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
  }
@@ -7532,7 +7532,7 @@ const VD = /* @__PURE__ */ Ge(UD, [["__scopeId", "data-v-43f282da"]]), QD = { st
7532
7532
  };
7533
7533
  }
7534
7534
  });
7535
- const Li = /* @__PURE__ */ Ge(FD, [["__scopeId", "data-v-19d5e9b1"]]), 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,68 +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
- 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>
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>
@@ -1,89 +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
- 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>
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>
@@ -1,48 +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 { 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>
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>
@@ -1,63 +1,63 @@
1
- <template>
2
- <el-input v-if="isInit" style="display: flex" v-bind="attrs" v-on="onEvents" :disabled="disabled" v-model="currentValue">
3
- <template v-for="(item, key, index) of slots" #[key] :key="index">
4
- <slot :name="key" />
5
- </template>
6
- </el-input>
7
- </template>
8
- <script lang="ts">
9
- export default {
10
- name: 'ElPlusFormInput',
11
- inheritAttrs: false,
12
- typeName: 'input',
13
- customOptions: {}
14
- }
15
- </script>
16
- <script lang="ts" setup>
17
- import { ref, watch, useAttrs, useSlots, onBeforeMount, inject } from 'vue'
18
- import { getAttrs, getEvents } from '../mixins'
19
- import { ICRUDConfig } from 'types/formList'
20
-
21
- const defaultConf = inject('defaultConf') as ICRUDConfig
22
-
23
- const props = defineProps<{
24
- modelValue?: string | null
25
- field: string
26
- desc: { [key: string]: any }
27
- formData: { [key: string]: any }
28
- disabled?: boolean
29
- }>()
30
-
31
- const emits = defineEmits(['update:modelValue', 'validateThis'])
32
- const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
33
- const attrs = ref({} as any)
34
- const isInit = ref(false)
35
- const onEvents = ref(getEvents(props))
36
-
37
- const currentValue = ref()
38
- emits('update:modelValue', currentValue)
39
-
40
- onBeforeMount(async () => {
41
- attrs.value = await getAttrs(props, { autocomplete: 'new-password', maxlength: defaultConf.form?.leng?.input || 0, clearable: true, ...useAttrs() })
42
- isInit.value = true
43
- })
44
-
45
- watch(
46
- () => props.modelValue,
47
- (data: string | null | undefined) => {
48
- // 这里要截取一下字符串长度
49
- if (data && data.length > attrs.value.maxlength) {
50
- data = data.substring(0, attrs.value.maxlength)
51
- }
52
- currentValue.value = data
53
- },
54
- { immediate: true }
55
- )
56
-
57
- watch(
58
- () => currentValue.value,
59
- () => {
60
- emits('validateThis')
61
- }
62
- )
63
- </script>
1
+ <template>
2
+ <el-input v-if="isInit" style="display: flex" v-bind="attrs" v-on="onEvents" :disabled="disabled" v-model="currentValue">
3
+ <template v-for="(item, key, index) of slots" #[key] :key="index">
4
+ <slot :name="key" />
5
+ </template>
6
+ </el-input>
7
+ </template>
8
+ <script lang="ts">
9
+ export default {
10
+ name: 'ElPlusFormInput',
11
+ inheritAttrs: false,
12
+ typeName: 'input',
13
+ customOptions: {}
14
+ }
15
+ </script>
16
+ <script lang="ts" setup>
17
+ import { ref, watch, useAttrs, useSlots, onBeforeMount, inject } from 'vue'
18
+ import { getAttrs, getEvents } from '../mixins'
19
+ import { ICRUDConfig } from 'types/formList'
20
+
21
+ const defaultConf = inject('defaultConf') as ICRUDConfig
22
+
23
+ const props = defineProps<{
24
+ modelValue?: string | null
25
+ field: string
26
+ desc: { [key: string]: any }
27
+ formData: { [key: string]: any }
28
+ disabled?: boolean
29
+ }>()
30
+
31
+ const emits = defineEmits(['update:modelValue', 'validateThis'])
32
+ const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
33
+ const attrs = ref({} as any)
34
+ const isInit = ref(false)
35
+ const onEvents = ref(getEvents(props))
36
+
37
+ const currentValue = ref()
38
+ emits('update:modelValue', currentValue)
39
+
40
+ onBeforeMount(async () => {
41
+ attrs.value = await getAttrs(props, { autocomplete: 'new-password', maxlength: defaultConf.form?.leng?.input || 0, clearable: true, ...useAttrs() })
42
+ isInit.value = true
43
+ })
44
+
45
+ watch(
46
+ () => props.modelValue,
47
+ (data: string | null | undefined) => {
48
+ // 这里要截取一下字符串长度
49
+ if (data && data.length > attrs.value.maxlength) {
50
+ data = data.substring(0, attrs.value.maxlength)
51
+ }
52
+ currentValue.value = data
53
+ },
54
+ { immediate: true }
55
+ )
56
+
57
+ watch(
58
+ () => currentValue.value,
59
+ () => {
60
+ emits('validateThis')
61
+ }
62
+ )
63
+ </script>