mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-14 14:52:49 +00:00
优化
This commit is contained in:
parent
a3666a2b8f
commit
e931fd7ec6
@ -98,23 +98,23 @@ const Table = useTable({
|
|||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '姓名',
|
label: '姓名',
|
||||||
minWidth: 150
|
minWidth: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'nickName',
|
prop: 'nickName',
|
||||||
label: '昵称',
|
label: '昵称',
|
||||||
minWidth: 150
|
minWidth: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'departmentName',
|
prop: 'departmentName',
|
||||||
label: '部门名称',
|
label: '部门名称',
|
||||||
minWidth: 150
|
minWidth: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'roleName',
|
prop: 'roleName',
|
||||||
label: '角色',
|
label: '角色',
|
||||||
headerAlign: 'center',
|
headerAlign: 'center',
|
||||||
minWidth: 150,
|
minWidth: 160,
|
||||||
dict: [],
|
dict: [],
|
||||||
formatter(row) {
|
formatter(row) {
|
||||||
return row.roleName?.split(',');
|
return row.roleName?.split(',');
|
||||||
@ -123,7 +123,7 @@ const Table = useTable({
|
|||||||
{
|
{
|
||||||
prop: 'status',
|
prop: 'status',
|
||||||
label: '状态',
|
label: '状态',
|
||||||
minWidth: 120,
|
minWidth: 100,
|
||||||
component: {
|
component: {
|
||||||
name: 'cl-switch'
|
name: 'cl-switch'
|
||||||
}
|
}
|
||||||
@ -131,12 +131,13 @@ const Table = useTable({
|
|||||||
{
|
{
|
||||||
prop: 'phone',
|
prop: 'phone',
|
||||||
label: '手机号码',
|
label: '手机号码',
|
||||||
minWidth: 150
|
minWidth: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'remark',
|
prop: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
minWidth: 150
|
minWidth: 200,
|
||||||
|
showOverflowTooltip: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'createTime',
|
prop: 'createTime',
|
||||||
|
|||||||
@ -1,17 +1,13 @@
|
|||||||
import { defineComponent, } from 'vue';
|
import { defineComponent, } from 'vue';
|
||||||
|
import { CrudProps } from '../..';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'cl-render',
|
name: 'cl-render',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
...CrudProps,
|
||||||
modelValue: null,
|
modelValue: null,
|
||||||
scope: Object,
|
placeholder: String,
|
||||||
prop: String,
|
|
||||||
disabled: Boolean,
|
|
||||||
isDisabled: Boolean,
|
|
||||||
row: Object,
|
|
||||||
column: Object,
|
|
||||||
placeholder: String
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { slots, }) {
|
setup(props, { slots, }) {
|
||||||
|
|||||||
10
src/plugins/crud/index.ts
Normal file
10
src/plugins/crud/index.ts
Normal 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 // 是否禁用
|
||||||
|
};
|
||||||
@ -10,7 +10,6 @@
|
|||||||
:title="title"
|
:title="title"
|
||||||
:scrollbar="isScroll"
|
:scrollbar="isScroll"
|
||||||
append-to-body
|
append-to-body
|
||||||
v-bind="$attrs"
|
|
||||||
>
|
>
|
||||||
<div class="cl-editor-preview">
|
<div class="cl-editor-preview">
|
||||||
<el-tabs v-if="list.length > 1" v-model="active" type="card" @tab-change="onTabChange">
|
<el-tabs v-if="list.length > 1" v-model="active" type="card" @tab-change="onTabChange">
|
||||||
@ -34,7 +33,9 @@
|
|||||||
:name="`cl-editor-${name}`"
|
:name="`cl-editor-${name}`"
|
||||||
height="100%"
|
height="100%"
|
||||||
preview
|
preview
|
||||||
|
v-if="name"
|
||||||
/>
|
/>
|
||||||
|
<el-text v-else>{{ content }}</el-text>
|
||||||
|
|
||||||
<slot name="append"></slot>
|
<slot name="append"></slot>
|
||||||
</div>
|
</div>
|
||||||
@ -51,8 +52,9 @@
|
|||||||
import { useClipboard } from '@vueuse/core';
|
import { useClipboard } from '@vueuse/core';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { isObject, isString } from 'lodash-es';
|
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 { useCool } from '/@/cool';
|
||||||
|
import { CrudProps } from '../../crud';
|
||||||
|
|
||||||
interface TabItem {
|
interface TabItem {
|
||||||
name: string;
|
name: string;
|
||||||
@ -61,12 +63,10 @@ interface TabItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
...CrudProps,
|
||||||
modelValue: String,
|
modelValue: String,
|
||||||
title: String,
|
title: String,
|
||||||
name: {
|
name: String,
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '点击查看'
|
default: '点击查看'
|
||||||
@ -84,10 +84,8 @@ const props = defineProps({
|
|||||||
default: '60%'
|
default: '60%'
|
||||||
},
|
},
|
||||||
formatter: Function,
|
formatter: Function,
|
||||||
|
|
||||||
// 多个内容展示
|
// 多个内容展示
|
||||||
tabs: Array as PropType<TabItem[]>,
|
tabs: Array as PropType<TabItem[]>,
|
||||||
|
|
||||||
// 组件参数
|
// 组件参数
|
||||||
props: Object
|
props: Object
|
||||||
});
|
});
|
||||||
@ -154,6 +152,8 @@ async function open(data?: string | TabItem[]) {
|
|||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onOpened() {}
|
||||||
|
|
||||||
// 设置内容
|
// 设置内容
|
||||||
function setContent(val: any) {
|
function setContent(val: any) {
|
||||||
if (isString(val)) {
|
if (isString(val)) {
|
||||||
|
|||||||
@ -131,7 +131,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="cl-upload">
|
<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 { isArray, isEmpty, isNumber } from 'lodash-es';
|
||||||
import VueDraggable from 'vuedraggable';
|
import VueDraggable from 'vuedraggable';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
@ -144,8 +144,10 @@ import { getUrls, getType } from '../utils';
|
|||||||
import { useUpload } from '../hooks';
|
import { useUpload } from '../hooks';
|
||||||
import UploadItem from './upload-item/index.vue';
|
import UploadItem from './upload-item/index.vue';
|
||||||
import type { Upload } from '../types';
|
import type { Upload } from '../types';
|
||||||
|
import { CrudProps } from '../../crud';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
...CrudProps,
|
||||||
// 绑定值,单选时字符串,多选时字符串数组
|
// 绑定值,单选时字符串,多选时字符串数组
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [String, Array],
|
type: [String, Array],
|
||||||
@ -200,15 +202,11 @@ const props = defineProps({
|
|||||||
// 上传前钩子
|
// 上传前钩子
|
||||||
beforeUpload: Function,
|
beforeUpload: Function,
|
||||||
// 云端上传路径前缀
|
// 云端上传路径前缀
|
||||||
prefixPath: String,
|
prefixPath: String
|
||||||
|
|
||||||
// CRUD穿透值
|
|
||||||
isEdit: Boolean,
|
|
||||||
scope: Object,
|
|
||||||
prop: String,
|
|
||||||
isDisabled: Boolean
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mergeProps(props, CrudProps);
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'change', 'upload', 'success', 'error', 'progress']);
|
const emit = defineEmits(['update:modelValue', 'change', 'upload', 'success', 'error', 'progress']);
|
||||||
|
|
||||||
const { refs, setRefs } = useCool();
|
const { refs, setRefs } = useCool();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user