This commit is contained in:
神仙都没用 2024-12-30 14:24:14 +08:00
parent a3666a2b8f
commit e931fd7ec6
5 changed files with 35 additions and 30 deletions

View File

@ -98,23 +98,23 @@ const Table = useTable({
{
prop: 'name',
label: '姓名',
minWidth: 150
minWidth: 120
},
{
prop: 'nickName',
label: '昵称',
minWidth: 150
minWidth: 120
},
{
prop: 'departmentName',
label: '部门名称',
minWidth: 150
minWidth: 120
},
{
prop: 'roleName',
label: '角色',
headerAlign: 'center',
minWidth: 150,
minWidth: 160,
dict: [],
formatter(row) {
return row.roleName?.split(',');
@ -123,7 +123,7 @@ const Table = useTable({
{
prop: 'status',
label: '状态',
minWidth: 120,
minWidth: 100,
component: {
name: 'cl-switch'
}
@ -131,12 +131,13 @@ const Table = useTable({
{
prop: 'phone',
label: '手机号码',
minWidth: 150
minWidth: 120
},
{
prop: 'remark',
label: '备注',
minWidth: 150
minWidth: 200,
showOverflowTooltip: true
},
{
prop: 'createTime',

View File

@ -1,17 +1,13 @@
import { defineComponent, } from 'vue';
import { CrudProps } from '../..';
export default defineComponent({
name: 'cl-render',
props: {
...CrudProps,
modelValue: null,
scope: Object,
prop: String,
disabled: Boolean,
isDisabled: Boolean,
row: Object,
column: Object,
placeholder: String
placeholder: String,
},
setup(props, { slots, }) {

10
src/plugins/crud/index.ts Normal file
View File

@ -0,0 +1,10 @@
export const CrudProps = {
prop: String, // Key
column: Object, // 列数据
row: Object, // 行数据
index: Number, // 行索引
scope: Object, // 表单作用域
disabled: Boolean, // 是否禁用
isEdit: Boolean, // 是否编辑
isDisabled: Boolean // 是否禁用
};

View File

@ -10,7 +10,6 @@
:title="title"
:scrollbar="isScroll"
append-to-body
v-bind="$attrs"
>
<div class="cl-editor-preview">
<el-tabs v-if="list.length > 1" v-model="active" type="card" @tab-change="onTabChange">
@ -34,7 +33,9 @@
:name="`cl-editor-${name}`"
height="100%"
preview
v-if="name"
/>
<el-text v-else>{{ content }}</el-text>
<slot name="append"></slot>
</div>
@ -51,8 +52,9 @@
import { useClipboard } from '@vueuse/core';
import { ElMessage } from 'element-plus';
import { isObject, isString } from 'lodash-es';
import { nextTick, ref, computed, type PropType } from 'vue';
import { nextTick, ref, computed, type PropType, useAttrs, mergeProps } from 'vue';
import { useCool } from '/@/cool';
import { CrudProps } from '../../crud';
interface TabItem {
name: string;
@ -61,12 +63,10 @@ interface TabItem {
}
const props = defineProps({
...CrudProps,
modelValue: String,
title: String,
name: {
type: String,
required: true
},
name: String,
text: {
type: String,
default: '点击查看'
@ -84,10 +84,8 @@ const props = defineProps({
default: '60%'
},
formatter: Function,
//
tabs: Array as PropType<TabItem[]>,
//
props: Object
});
@ -154,6 +152,8 @@ async function open(data?: string | TabItem[]) {
visible.value = true;
}
function onOpened() {}
//
function setContent(val: any) {
if (isString(val)) {

View File

@ -131,7 +131,7 @@
</template>
<script lang="ts" setup name="cl-upload">
import { computed, ref, watch, type PropType, nextTick } from 'vue';
import { computed, ref, watch, type PropType, nextTick, mergeProps } from 'vue';
import { isArray, isEmpty, isNumber } from 'lodash-es';
import VueDraggable from 'vuedraggable';
import { ElMessage } from 'element-plus';
@ -144,8 +144,10 @@ import { getUrls, getType } from '../utils';
import { useUpload } from '../hooks';
import UploadItem from './upload-item/index.vue';
import type { Upload } from '../types';
import { CrudProps } from '../../crud';
const props = defineProps({
...CrudProps,
//
modelValue: {
type: [String, Array],
@ -200,15 +202,11 @@ const props = defineProps({
//
beforeUpload: Function,
//
prefixPath: String,
// CRUD穿
isEdit: Boolean,
scope: Object,
prop: String,
isDisabled: Boolean
prefixPath: String
});
mergeProps(props, CrudProps);
const emit = defineEmits(['update:modelValue', 'change', 'upload', 'success', 'error', 'progress']);
const { refs, setRefs } = useCool();