mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-11 13:02:49 +00:00
优化
This commit is contained in:
parent
a3666a2b8f
commit
e931fd7ec6
@ -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',
|
||||
|
||||
@ -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
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"
|
||||
: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)) {
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user