This commit is contained in:
icssoa 2023-05-31 16:56:43 +08:00
parent 09003b1a74
commit ff0c0f2b53
10 changed files with 38 additions and 18 deletions

View File

@ -9,7 +9,7 @@
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
},
"dependencies": {
"@cool-vue/crud": "^6.2.0",
"@cool-vue/crud": "^6.2.2",
"@element-plus/icons-vue": "^2.0.10",
"@vueuse/core": "^9.1.0",
"@wangeditor/editor": "^5.1.23",

View File

@ -454,7 +454,7 @@ declare namespace ClForm {
}) => void;
interface Config {
title?: string;
title?: any;
width?: string;
props: ElementPlus.FormProps;
items: Item[];
@ -473,7 +473,7 @@ declare namespace ClForm {
buttons?: Array<CloseAction | Render.OpButton>;
};
dialog: {
title?: string;
title?: any;
width?: string;
hideHeader?: boolean;
controls?: Array<"fullscreen" | "close">;

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/crud",
"version": "6.2.1",
"version": "6.2.2",
"private": false,
"main": "./dist/index.umd.min.js",
"typings": "types/index.d.ts",

View File

@ -38,7 +38,7 @@ export function parseNode(vnode: any, options: Options): VNode {
const rn = slots[vnode.name];
if (rn) {
return rn({ scope, ...options._data });
return rn({ scope, prop, ..._data });
} else {
return <cl-error-message title={`${vnode.name} is not found`} />;
}
@ -52,13 +52,14 @@ export function parseNode(vnode: any, options: Options): VNode {
// 处理 props
if (isFunction(vnode.props)) {
vnode.props = vnode.props({ scope, ...options._data });
vnode.props = vnode.props({ scope, prop, ..._data });
}
// 组件参数
const props = {
...vnode.props,
..._data,
prop,
scope
};

View File

@ -122,6 +122,7 @@ const Upsert = useUpsert({
prop: "dataType",
label: "类型",
value: 0,
required: true,
component: {
name: "el-radio-group",
options: options.dataType
@ -133,6 +134,7 @@ const Upsert = useUpsert({
hidden({ scope }) {
return scope.dataType != 0;
},
required: true,
component: {
name: "el-input",
props: {
@ -147,6 +149,7 @@ const Upsert = useUpsert({
hidden({ scope }) {
return scope.dataType != 1;
},
required: true,
component: {
name: "cl-editor",
props: {
@ -157,6 +160,7 @@ const Upsert = useUpsert({
{
prop: "data_2",
label: "数据",
required: true,
hidden({ scope }) {
return scope.dataType != 2;
},

View File

@ -20,8 +20,7 @@ export default defineComponent({
},
header: Array,
columns: {
type: Array as PropType<any[]>,
required: true
type: Array as PropType<any[]>
},
data: [Function, Array],
maxExportLimit: Number // 最大导出条数不传或者小于等于0为不限制

View File

@ -40,8 +40,7 @@ import { extname } from "/@/cool/utils";
const props = defineProps({
onConfig: Function,
onSubmit: {
type: Function,
required: true
type: Function
},
template: {
type: String,

View File

@ -169,7 +169,7 @@
</template>
<script lang="ts" setup name="cl-upload">
import { computed, ref, watch, PropType } from "vue";
import { computed, ref, watch, PropType, nextTick } from "vue";
import { isArray, isNumber } from "lodash-es";
import Draggable from "vuedraggable";
import { ElMessage } from "element-plus";
@ -180,6 +180,7 @@ import { useBase } from "/$/base";
import { fileName, fileType, getUrls } from "../utils";
import { Upload } from "../types";
import ItemViewer from "./items/viewer.vue";
import { useForm } from "@cool-vue/crud";
const props = defineProps({
modelValue: {
@ -223,6 +224,7 @@ const props = defineProps({
// 穿
isEdit: null,
scope: null,
prop: null,
isDisabled: Boolean
});
@ -230,6 +232,7 @@ const emit = defineEmits(["update:modelValue", "upload", "success", "error", "pr
const { service, refs, setRefs } = useCool();
const { user } = useBase();
const Form = useForm();
//
const { options } = module.get("upload");
@ -257,7 +260,19 @@ const limit = props.limit || options.limit.upload;
const limitSize = props.limitSize || options.limit.size;
//
const text = props.text === undefined ? options.text : props.text;
const text = computed(() => {
if (props.text) {
return props.text;
} else {
switch (props.type) {
case "file":
return "选择文件";
case "image":
return "选择图片";
}
}
});
//
const headers = computed(() => {
@ -507,6 +522,10 @@ function update() {
if (!check) {
emit("update:modelValue", getUrls(list.value));
nextTick(() => {
Form.value?.validateField(props.prop);
});
}
}

View File

@ -9,8 +9,6 @@ export default () => {
options: {
// 尺寸
size: 120,
// 显示文案
text: "选择图片",
// 限制
limit: {
// 上传最大数量

View File

@ -280,10 +280,10 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@cool-vue/crud@^6.2.0":
version "6.2.0"
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.2.0.tgz#37bae71336b89925186e82cfe9ff978a0f3495c7"
integrity sha512-XMiJfh72d/LsiWAkLd3euYKVyQHuAPVFmWyypQDeaiZbkaZomOLjuT4oJwiZKpGOYsbH9QiaeJbbaKfJa3G0LA==
"@cool-vue/crud@^6.2.2":
version "6.2.2"
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.2.2.tgz#4e24bfb157307b5aef249476b4a41acd61217e30"
integrity sha512-0NBn8ZtbjJ85HkuVWueEmJ8+Uvc+yNezGO12f3AuHn0Ru1uVk5Dmy3EFDK5XhoWurOmTgk1lDaG3/G+CCgtCtw==
dependencies:
array.prototype.flat "^1.2.4"
core-js "^3.21.1"