mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-16 00:22:53 +00:00
优化
This commit is contained in:
parent
09003b1a74
commit
ff0c0f2b53
@ -9,7 +9,7 @@
|
|||||||
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
|
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cool-vue/crud": "^6.2.0",
|
"@cool-vue/crud": "^6.2.2",
|
||||||
"@element-plus/icons-vue": "^2.0.10",
|
"@element-plus/icons-vue": "^2.0.10",
|
||||||
"@vueuse/core": "^9.1.0",
|
"@vueuse/core": "^9.1.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
|
|||||||
4
packages/crud/index.d.ts
vendored
4
packages/crud/index.d.ts
vendored
@ -454,7 +454,7 @@ declare namespace ClForm {
|
|||||||
}) => void;
|
}) => void;
|
||||||
|
|
||||||
interface Config {
|
interface Config {
|
||||||
title?: string;
|
title?: any;
|
||||||
width?: string;
|
width?: string;
|
||||||
props: ElementPlus.FormProps;
|
props: ElementPlus.FormProps;
|
||||||
items: Item[];
|
items: Item[];
|
||||||
@ -473,7 +473,7 @@ declare namespace ClForm {
|
|||||||
buttons?: Array<CloseAction | Render.OpButton>;
|
buttons?: Array<CloseAction | Render.OpButton>;
|
||||||
};
|
};
|
||||||
dialog: {
|
dialog: {
|
||||||
title?: string;
|
title?: any;
|
||||||
width?: string;
|
width?: string;
|
||||||
hideHeader?: boolean;
|
hideHeader?: boolean;
|
||||||
controls?: Array<"fullscreen" | "close">;
|
controls?: Array<"fullscreen" | "close">;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-vue/crud",
|
"name": "@cool-vue/crud",
|
||||||
"version": "6.2.1",
|
"version": "6.2.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "./dist/index.umd.min.js",
|
"main": "./dist/index.umd.min.js",
|
||||||
"typings": "types/index.d.ts",
|
"typings": "types/index.d.ts",
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export function parseNode(vnode: any, options: Options): VNode {
|
|||||||
const rn = slots[vnode.name];
|
const rn = slots[vnode.name];
|
||||||
|
|
||||||
if (rn) {
|
if (rn) {
|
||||||
return rn({ scope, ...options._data });
|
return rn({ scope, prop, ..._data });
|
||||||
} else {
|
} else {
|
||||||
return <cl-error-message title={`${vnode.name} is not found`} />;
|
return <cl-error-message title={`${vnode.name} is not found`} />;
|
||||||
}
|
}
|
||||||
@ -52,13 +52,14 @@ export function parseNode(vnode: any, options: Options): VNode {
|
|||||||
|
|
||||||
// 处理 props
|
// 处理 props
|
||||||
if (isFunction(vnode.props)) {
|
if (isFunction(vnode.props)) {
|
||||||
vnode.props = vnode.props({ scope, ...options._data });
|
vnode.props = vnode.props({ scope, prop, ..._data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件参数
|
// 组件参数
|
||||||
const props = {
|
const props = {
|
||||||
...vnode.props,
|
...vnode.props,
|
||||||
..._data,
|
..._data,
|
||||||
|
prop,
|
||||||
scope
|
scope
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,7 @@ const Upsert = useUpsert({
|
|||||||
prop: "dataType",
|
prop: "dataType",
|
||||||
label: "类型",
|
label: "类型",
|
||||||
value: 0,
|
value: 0,
|
||||||
|
required: true,
|
||||||
component: {
|
component: {
|
||||||
name: "el-radio-group",
|
name: "el-radio-group",
|
||||||
options: options.dataType
|
options: options.dataType
|
||||||
@ -133,6 +134,7 @@ const Upsert = useUpsert({
|
|||||||
hidden({ scope }) {
|
hidden({ scope }) {
|
||||||
return scope.dataType != 0;
|
return scope.dataType != 0;
|
||||||
},
|
},
|
||||||
|
required: true,
|
||||||
component: {
|
component: {
|
||||||
name: "el-input",
|
name: "el-input",
|
||||||
props: {
|
props: {
|
||||||
@ -147,6 +149,7 @@ const Upsert = useUpsert({
|
|||||||
hidden({ scope }) {
|
hidden({ scope }) {
|
||||||
return scope.dataType != 1;
|
return scope.dataType != 1;
|
||||||
},
|
},
|
||||||
|
required: true,
|
||||||
component: {
|
component: {
|
||||||
name: "cl-editor",
|
name: "cl-editor",
|
||||||
props: {
|
props: {
|
||||||
@ -157,6 +160,7 @@ const Upsert = useUpsert({
|
|||||||
{
|
{
|
||||||
prop: "data_2",
|
prop: "data_2",
|
||||||
label: "数据",
|
label: "数据",
|
||||||
|
required: true,
|
||||||
hidden({ scope }) {
|
hidden({ scope }) {
|
||||||
return scope.dataType != 2;
|
return scope.dataType != 2;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20,8 +20,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
header: Array,
|
header: Array,
|
||||||
columns: {
|
columns: {
|
||||||
type: Array as PropType<any[]>,
|
type: Array as PropType<any[]>
|
||||||
required: true
|
|
||||||
},
|
},
|
||||||
data: [Function, Array],
|
data: [Function, Array],
|
||||||
maxExportLimit: Number // 最大导出条数,不传或者小于等于0为不限制
|
maxExportLimit: Number // 最大导出条数,不传或者小于等于0为不限制
|
||||||
|
|||||||
@ -40,8 +40,7 @@ import { extname } from "/@/cool/utils";
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
onConfig: Function,
|
onConfig: Function,
|
||||||
onSubmit: {
|
onSubmit: {
|
||||||
type: Function,
|
type: Function
|
||||||
required: true
|
|
||||||
},
|
},
|
||||||
template: {
|
template: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
@ -169,7 +169,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="cl-upload">
|
<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 { isArray, isNumber } from "lodash-es";
|
||||||
import Draggable from "vuedraggable";
|
import Draggable from "vuedraggable";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
@ -180,6 +180,7 @@ import { useBase } from "/$/base";
|
|||||||
import { fileName, fileType, getUrls } from "../utils";
|
import { fileName, fileType, getUrls } from "../utils";
|
||||||
import { Upload } from "../types";
|
import { Upload } from "../types";
|
||||||
import ItemViewer from "./items/viewer.vue";
|
import ItemViewer from "./items/viewer.vue";
|
||||||
|
import { useForm } from "@cool-vue/crud";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -223,6 +224,7 @@ const props = defineProps({
|
|||||||
// 穿透值
|
// 穿透值
|
||||||
isEdit: null,
|
isEdit: null,
|
||||||
scope: null,
|
scope: null,
|
||||||
|
prop: null,
|
||||||
isDisabled: Boolean
|
isDisabled: Boolean
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -230,6 +232,7 @@ const emit = defineEmits(["update:modelValue", "upload", "success", "error", "pr
|
|||||||
|
|
||||||
const { service, refs, setRefs } = useCool();
|
const { service, refs, setRefs } = useCool();
|
||||||
const { user } = useBase();
|
const { user } = useBase();
|
||||||
|
const Form = useForm();
|
||||||
|
|
||||||
// 模块配置
|
// 模块配置
|
||||||
const { options } = module.get("upload");
|
const { options } = module.get("upload");
|
||||||
@ -257,7 +260,19 @@ const limit = props.limit || options.limit.upload;
|
|||||||
const limitSize = props.limitSize || options.limit.size;
|
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(() => {
|
const headers = computed(() => {
|
||||||
@ -507,6 +522,10 @@ function update() {
|
|||||||
|
|
||||||
if (!check) {
|
if (!check) {
|
||||||
emit("update:modelValue", getUrls(list.value));
|
emit("update:modelValue", getUrls(list.value));
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
Form.value?.validateField(props.prop);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,6 @@ export default () => {
|
|||||||
options: {
|
options: {
|
||||||
// 尺寸
|
// 尺寸
|
||||||
size: 120,
|
size: 120,
|
||||||
// 显示文案
|
|
||||||
text: "选择图片",
|
|
||||||
// 限制
|
// 限制
|
||||||
limit: {
|
limit: {
|
||||||
// 上传最大数量
|
// 上传最大数量
|
||||||
|
|||||||
@ -280,10 +280,10 @@
|
|||||||
"@babel/helper-validator-identifier" "^7.19.1"
|
"@babel/helper-validator-identifier" "^7.19.1"
|
||||||
to-fast-properties "^2.0.0"
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@cool-vue/crud@^6.2.0":
|
"@cool-vue/crud@^6.2.2":
|
||||||
version "6.2.0"
|
version "6.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.2.0.tgz#37bae71336b89925186e82cfe9ff978a0f3495c7"
|
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.2.2.tgz#4e24bfb157307b5aef249476b4a41acd61217e30"
|
||||||
integrity sha512-XMiJfh72d/LsiWAkLd3euYKVyQHuAPVFmWyypQDeaiZbkaZomOLjuT4oJwiZKpGOYsbH9QiaeJbbaKfJa3G0LA==
|
integrity sha512-0NBn8ZtbjJ85HkuVWueEmJ8+Uvc+yNezGO12f3AuHn0Ru1uVk5Dmy3EFDK5XhoWurOmTgk1lDaG3/G+CCgtCtw==
|
||||||
dependencies:
|
dependencies:
|
||||||
array.prototype.flat "^1.2.4"
|
array.prototype.flat "^1.2.4"
|
||||||
core-js "^3.21.1"
|
core-js "^3.21.1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user