This commit is contained in:
南思 2023-07-06 16:17:57 +08:00
parent c873429f9d
commit 5d2fd4741d
11 changed files with 2124 additions and 9 deletions

View File

@ -13,8 +13,8 @@
</template> </template>
</TableHeader> </TableHeader>
<!-- 组件表格主体 --> <!-- 组件表格主体 -->
<TableData :tableList="tableList" :tableData="tableData" :tableType="tableType" @changeDisabledIf="changeDisabledIf" <TableData :tableList="tableList" :tableData="tableData" :treeShow="treeShow" :tableType="tableType" @changeDisabledIf="changeDisabledIf"
@changeSingleDisabledIf="changeSingleDisabledIf" @handleSortChange="handleSortChange" ref="TableDataRef"> @changeSingleDisabledIf="changeSingleDisabledIf" @handleSortChange="handleSortChange" @handleTree="handleTree" ref="TableDataRef">
<!-- 添加插槽 --> <!-- 添加插槽 -->
<template v-slot:default="{ currentCol, currentData }"> <template v-slot:default="{ currentCol, currentData }">
<slot :currentCol="currentCol" :currentData="currentData" :name="currentCol.name" /> <slot :currentCol="currentCol" :currentData="currentData" :name="currentCol.name" />
@ -51,9 +51,12 @@ const props = defineProps({
pagination: { pagination: {
type: Object, type: Object,
}, },
treeShow: {
type: Boolean,
},
}); });
console.log(props);
const emit = defineEmits(["handleTableHeader", "handleTablePagination", "handleTableSort"]); const emit = defineEmits(["handleTableHeader", "handleTablePagination", "handleTableSort","handleTree"]);
const TableHeaderRef = ref(); // TableHeaderRef ref const TableHeaderRef = ref(); // TableHeaderRef ref
const TableDataRef = ref(); // TableData ref const TableDataRef = ref(); // TableData ref
@ -97,7 +100,9 @@ const handlePagination = (current) => {
const handleSortChange = (column, prop, order) => { const handleSortChange = (column, prop, order) => {
emit("handleTableSort", column, prop, order) emit("handleTableSort", column, prop, order)
} }
const handleTree = (val) =>{
emit('handleTree', val)
}
// //
const selectData = ref([]); const selectData = ref([]);
onMounted(() => { onMounted(() => {

View File

@ -1,5 +1,12 @@
<template> <template>
<div class="table-data"> <div class="table-data" style="display: flex; position: relative;">
<div class="trees">
<el-scrollbar height="80vh">
<div v-for="item in 100" :key="item" v-if="treeShow" class="treeData" @click="handleTree(item)">
测试数据 测试数据 测试数据
</div>
</el-scrollbar>
</div>
<el-table :data="tableData" ref="multipleTableRef" style="width: 100%" :height="tableHeight" <el-table :data="tableData" ref="multipleTableRef" style="width: 100%" :height="tableHeight"
v-loading="tableType.tableLoading" :row-class-name="rowClass" :row-key="tableType.tableTree ? 'id' : undefined" v-loading="tableType.tableLoading" :row-class-name="rowClass" :row-key="tableType.tableTree ? 'id' : undefined"
:tree-props="{ children: tableType.tableTreeName ? tableType.tableTreeName : 'children' }" :tree-props="{ children: tableType.tableTreeName ? tableType.tableTreeName : 'children' }"
@ -41,9 +48,13 @@ const props = defineProps({
type: Array, type: Array,
default: () => [] default: () => []
}, },
treeShow: {
type: Boolean,
default: false
}
}) })
const emit = defineEmits(['changeDisabledIf', 'changeSingleDisabledIf', 'handleSortChange']) const emit = defineEmits(['changeDisabledIf', 'changeSingleDisabledIf', 'handleSortChange','handleTree'])
// ref // ref
const multipleTableRef = ref() const multipleTableRef = ref()
@ -105,7 +116,9 @@ watch(() => props.tableData, () => {
selectData.value = [] selectData.value = []
} }
}) })
const handleTree = (val) =>{
emit('handleTree', val)
}
// //
const handleSortChange = ({ column, prop, order }) => { const handleSortChange = ({ column, prop, order }) => {
emit('handleSortChange', column, prop, order) emit('handleSortChange', column, prop, order)
@ -120,4 +133,23 @@ defineExpose({
.el-table :deep(.slecleRowColor) td { .el-table :deep(.slecleRowColor) td {
background: #ecf5ff !important; background: #ecf5ff !important;
} }
.trees {
position: relative;
top: -2px;
.treeData {
width: 11.4167vw;
margin-right: 1.0417vw;
padding: 15px;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
&:hover {
background-color: #086dd9a0;
color: white;
}
}
}
</style> </style>

View File

@ -5,6 +5,7 @@
<template v-for="(item, index) in tableHeader[0].buttons"> <template v-for="(item, index) in tableHeader[0].buttons">
<el-button v-permission="tableHeader[2]?.create" type="primary" icon="Plus" v-if="item === 'create'" <el-button v-permission="tableHeader[2]?.create" type="primary" icon="Plus" v-if="item === 'create'"
@click="emit('handle', 'create')" :key="index">新增</el-button> @click="emit('handle', 'create')" :key="index">新增</el-button>
<el-button type="primary" icon="Edit" :disabled="singleDisabledIf" v-if="item === 'edit'" <el-button type="primary" icon="Edit" :disabled="singleDisabledIf" v-if="item === 'edit'"
v-permission="tableHeader[2]?.edit" @click="emit('handle', 'edit')" :key="index">编辑</el-button> v-permission="tableHeader[2]?.edit" @click="emit('handle', 'edit')" :key="index">编辑</el-button>
<span v-if="item === 'delete'" v-permission="tableHeader[2]?.delete"> <span v-if="item === 'delete'" v-permission="tableHeader[2]?.delete">
@ -14,6 +15,10 @@
</template> </template>
</el-popconfirm> </el-popconfirm>
</span> </span>
<el-button type="primary" icon="Connection" :disabled="singleDisabledIf" v-if="item === 'detail'"
v-permission="tableHeader[2]?.edit" @click="emit('handle', 'detail ')" :key="index">详情</el-button>
<template v-if="Object.prototype.toString.call(item) === '[object Object]'"> <template v-if="Object.prototype.toString.call(item) === '[object Object]'">
<el-button type="primary" :disabled="customDisabled(item)" :icon="item.icon" v-permission="item.permission" <el-button type="primary" :disabled="customDisabled(item)" :icon="item.icon" v-permission="item.permission"
@click="emit('handle', item.name)" v-if="item.type === 'custom'" :key="index">{{ item.title }}</el-button> @click="emit('handle', item.name)" v-if="item.type === 'custom'" :key="index">{{ item.title }}</el-button>

View File

@ -36,11 +36,52 @@ const routes = [
*/ */
// 项目管理 // 项目管理
{ {
path: "/project-manage", path: "/dc/project-manage",
component: () => import("../views/projectManage/index.vue"), component: () => import("../views/projectManage/index.vue"),
name: "ProjectManage", name: "ProjectManage",
meta: { title: "项目管理" }, meta: { title: "项目管理" },
}, },
// 规则管理
{
path: "/dc/rule",
component: () => import("../views/rule/index.vue"),
name: "rule",
meta: { title: "规则管理" },
},
// 元数据管理
{
path: "/dc/metaData",
component: () => import("../views/metaData/index.vue"),
name: "metaData",
meta: { title: "元数据管理" },
},
//清洗任务
{
path: "/dc/cleaningTask",
component: () => import("../views/cleaningTask/index.vue"),
name: "cleaningTask",
meta: { title: "清洗任务" },
},
//服务接口
{
path: "/dc/serviceInterface",
component: () => import("../views/serviceInterface/index.vue"),
name: "cleaningTask",
meta: { title: "服务接口" },
},
{
path: "/dc/configurefields",
component: () => import("../views/configurefields/index.vue"),
name: "configurefields",
meta: { title: "配置字段" },
},
{
path: "/dc/addprovide",
component: () => import("../views/addprovide/index.vue"),
name: "addprovide",
meta: { title: "新增服务接口" },
},
], ],
}, },
{ {

View File

@ -0,0 +1,358 @@
<template>
<!-- 使用示例 -->
<div class="example">
<el-main>
<el-form ref="ruleFormRef" :model="form.region" :rules="addpro">
<el-row style="margin-bottom: 24px">
<el-col :span="24">
<el-button type="primary" @click="submitForm(ruleFormRef)"
>保存</el-button
>
<el-button @click="sysDept(ruleFormRef)">重置</el-button>
<el-button @click="route.back">返回</el-button>
</el-col>
</el-row>
<el-form-item label="服务名称" prop="name">
<el-input v-model="form.region.name" />
</el-form-item>
<el-row>
<el-col :span="11">
<el-form-item label="所属部门" prop="deptId">
<el-select
@change="log"
v-model="form.region.deptId"
placeholder="请选择部门"
>
<el-option
v-for="(item, index) in play.oplen"
:key="index"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="2" />
<el-col :span="11">
<el-form-item label="资源目录" prop="metadataId">
<el-select
v-model="form.region.metadataId"
placeholder="请选择资源目录"
>
<el-option
v-for="(item, index) in play.region"
:key="index"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="是否需要用户认证" prop="isAuth">
<el-select v-model="form.region.isAuth" placeholder="请选择">
<el-option label="是" :value="1" />
<el-option label="否" :value="0" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="2" />
<el-col :span="11">
<el-form-item label="是否外网公开" prop="isPublic">
<el-select v-model="form.region.isPublic" placeholder="请选择">
<el-option label="是" :value="1" />
<el-option label="否" :value="0" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="资源描述" prop="intro">
<el-input v-model="form.region.intro" type="textarea" />
</el-form-item>
</el-form>
</el-main>
<el-footer>
<el-row style="margin-bottom: 24px">
<el-col :span="2">
<el-button type="primary" @click="opneDialogs">新建</el-button>
</el-col>
</el-row>
<el-table
:header-cell-style="{ background: '#eef1f6', color: '#606266' }"
:data="form.region.interfaceList"
>
<el-table-column prop="sortNo" label="序号" />
<el-table-column prop="name" label="接口名称" />
<el-table-column prop="url" label="接口地址" />
<el-table-column prop="scope" label="开发范围" />
<el-table-column prop="intro" label="接口描述" />
<el-table-column prop="操作" label="操作">
<template #default="scope">
<el-button type="danger" text @click="delet(scope)">删除</el-button
><el-button type="primary" text @click="fromVlauesj(scope)"
>编辑</el-button
>
</template>
</el-table-column>
</el-table>
</el-footer>
<!-- <yd_diainputXMGL
ref="childrenRef"
@funFlag="funFlag"
@resetForm="resetForm"
:inputArray="inputArray"
:width="width"
:inputArrays="inputArrays"
:dialogVisible="moreConditionsXmgl"
:control="true"
/> -->
</div>
</template>
<script setup>
import { ref, reactive, watch, nextTick } from "vue";
// import yd_diainputXMGL from "@/components/yd_diang_xmgl.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import http from "@/utils/request.js";
import { useRoute, useRouter } from "vue-router";
const route = useRouter();
const routes = useRoute();
const ruleFormRef = ref();
const play = reactive({
oplen: [],
region: [],
index: "",
});
const form = reactive({
region: {
deptId: "",
deptStr: "",
id: "",
interfaceList: [],
intro: "",
isAuth: 0,
isPublic: 0,
metadataId: "",
name: "",
},
});
//
const childrenRef = ref(null);
//
const handleChildren1 = () => childrenRef.value.resetForms();
const width = ref("40%");
const inputArray = reactive([
{
type: "input",
title: "序号",
model: "sortNo",
row: 24,
placeholder: "请输入",
optionsValue: "updataOption",
SetectPla: "请选择",
},
{
type: "input",
title: "接口名称",
model: "name",
row: 24,
placeholder: "请输入",
optionsValue: "updataOption",
SetectPla: "请选择",
},
{
type: "input",
title: "接口地址",
model: "url",
row: 24,
placeholder: "请输入",
optionsValue: "updataOption",
SetectPla: "请选择",
},
{
type: "input",
title: "开发范围",
model: "scope",
row: 24,
placeholder: "请输入",
optionsValue: "updataOption",
SetectPla: "请选择",
},
{
type: "input",
title: "接口描述",
model: "intro",
row: 24,
placeholder: "请输入",
optionsValue: "updataOption",
SetectPla: "请选择",
},
]);
//
const inputArrays = reactive({
sortNo: [{ required: true, message: "内容不能为空", trigger: "blur" }],
name: [{ required: true, message: "内容不能为空", trigger: "blur" }],
url: [{ required: true, message: "内容不能为空", trigger: "blur" }],
scope: [{ required: true, message: "内容不能为空", trigger: "blur" }],
intro: [{ required: true, message: "内容不能为空", trigger: "blur" }],
});
const addpro = reactive({
name: [{ required: true, message: "内容不能为空", trigger: "blur" }],
deptId: [{ required: true, message: "内容不能为空", trigger: "blur" }],
metadataId: [{ required: true, message: "内容不能为空", trigger: "blur" }],
isAuth: [{ required: true, message: "内容不能为空", trigger: "blur" }],
isPublic: [{ required: true, message: "内容不能为空", trigger: "blur" }],
intro: [{ required: true, message: "内容不能为空", trigger: "blur" }],
});
/* 更多弹框 */
const moreConditionsXmgl = ref(false);
//
const opneDialogs = () => {
// watch
inputArray.forEach((element, index) => {
if (element.model) {
element.lable = null;
}
});
moreConditionsXmgl.value = !moreConditionsXmgl.value;
};
//
const fromVlauesj = (datas) => {
play.index = datas.$index;
inputArray.forEach((element, index) => {
if (element.model) {
element.lable = datas.row[element.model];
}
});
// id
moreConditionsXmgl.value = !moreConditionsXmgl.value;
};
//
const funFlag = (val) => {
if (play.index == "") {
form.region.interfaceList.push(JSON.parse(JSON.stringify(val)));
handleChildren1();
} else {
form.region.interfaceList[play.index] = JSON.parse(JSON.stringify(val));
play.index = "";
handleChildren1();
}
};
const resetForm = (val) => {
console.log(val);
};
const sysDept = (formEl) => {
if (!formEl) return;
formEl.resetFields();
form.region.interfaceList = [];
};
//
const metadataProject = () => {
http.get("/metadata/sysDept").then((resp) => {
if (resp.code == 200) {
play.oplen = resp.data;
} else {
ElMessage.error(resp.message);
}
});
};
const deptId = (e) => {
http.get(`/metadata/metadata/list/?deptId=${e}`).then((resp) => {
if (resp.code == 200) {
play.region = resp.data;
} else {
ElMessage.error(resp.message);
}
});
};
const log = (e) => {
http
.get(`/metadata/metadata/list/?deptId=${form.region.deptId}`)
.then((resp) => {
form.region.metadataId = "";
if (resp.code == 200) {
play.region = resp.data;
} else {
ElMessage.error(resp.message);
}
});
};
const dataCatalog = async () => {
http.post("/metadata/dataCatalog", form.region).then((resp) => {
if (resp.code == 200) {
ElMessage.success("保存成功");
} else {
ElMessage.error(resp.message);
}
});
};
const submitForm = async (formEl) => {
if (!formEl) return;
await formEl.validate((valid, fields) => {
if (valid) {
console.log(form.region.interfaceList.length);
if (form.region.interfaceList.length == 0) {
ElMessage.error("需创建一条接口数据");
} else {
dataCatalog();
}
} else {
console.log("error submit!", fields);
}
});
};
const delet = (e) => {
if (form.region.interfaceList.length <= 1) {
ElMessage.error("需保留一条数据");
} else {
form.region.interfaceList.splice(e.$index, 1);
}
};
metadataProject();
</script>
<style lang="scss" scoped>
.example {
.el-header {
background-color: rgb(246, 246, 246);
}
.el-aside {
width: 15%;
min-width: 200px;
background-color: #fff;
.el-menu {
min-height: calc(100vh - 130px);
border: #fff solid;
.el-menu-item.is-active {
color: #409eff;
}
}
}
.el-main {
background-color: #fff;
.el-scrollbar {
padding-right: 15px;
}
:deep(.set-select) {
width: 100%;
}
:deep(.el-select) {
width: 100%;
}
}
.el-footer {
padding-top: 15px;
margin-top: 16px;
min-height: calc(50.3vh);
background-color: #fff;
}
}
.el-button {
padding: 8px 10px;
}
</style>

View File

@ -0,0 +1,359 @@
<template>
<div class="example">
<TableBody v-bind="data" @handleTableHeader="handleTableHeader" @handleTablePagination="handleTablePagination"
@handleTableSort="handleTableSort" ref="TableBodyRef">
<!-- 表格插槽使用 -->
<template #slotName="{ currentCol, currentData }">
<span style="color: #729880">{{ currentData }}</span>
</template>
</TableBody>
<FormDialog v-model="formDialog" v-bind="FormDialogData" @handleSubmit="handleSubmit">
<template #default>
<el-form :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%" />
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" placeholder="Pick a time" style="width: 100%" />
</el-col>
</el-form-item>
</el-form>
</template>
</FormDialog>
</div>
</template>
<script setup>
import { ref, reactive } from "vue";
import TableBody from "@/components/TableBody/TableBody.vue";
import FormDialog from "@/components/FormDialog/FormDialog.vue";
const TableBodyRef = ref();
const data = reactive({
/**
* @type {Object}
* @description 表格头部
*/
tableHeader: [
{
buttons: [
"delete",
],
},
{
buttons: [
"refresh",
"filter",
{
name: "mixInput", //
options: [
{ label: 1, value: 1 },
{ label: 1, value: 1 },
],
// permission: false, //
},
{
type: "custom", // custom popconfirm ,
name: "addButton", // handleTableHeader
title: "新建任务", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
}, {
type: "custom", // custom popconfirm ,
name: "dataButton", // handleTableHeader
title: "已清洗数据", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
}, {
type: "custom", // custom popconfirm ,
name: "fontButton", // handleTableHeader
title: "立即清洗", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
},{
type: "custom", // custom popconfirm ,
name: "fontButton", // handleTableHeader
title: "修改任务", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
},
],
},
// permission
// undefinedfalse
{
create: undefined,
edit: false,
delete: false,
search: false,
advanced: false,
refresh: false,
bulkDelete: false,
filter: false,
},
],
/**
* @type {Array}
* @description 表格参数
*/
tableType: {
selection: false, // Boolean
tableLoading: false, // Boolean loading
tableIndex: true, // Boolean
tableTree: true, // Boolean id
tableTreeName: "children", // String 'children'
isExpand: true, // Boolean false
isHiddenPagination: false, // Boolean false
changeHeight: false, // String / Number false
},
/**
* @type {Array}
* @description 表格配置
*/
tableList: [
{
type: "slot", // slot 使
name: "slotName", // name
label: "插槽",
show: true, //
sortable: true, // Boolean | 'custom' ( 'custom' handleTableSort )
// 使 sortable true
sortableMethod: (a, b) => {
console.log(a.date);
// a b (a b )
// 0 a b 0 0 a b
return new Date(a.date).getTime() - new Date(b.date).getTime();
},
width: 100,
},
{
name: "date",
label: "时间",
show: true,
sortable: "custom",
},
{
name: "name",
label: "姓名",
show: true,
},
{
name: "state",
label: "状态",
show: true,
},
{
name: "city",
label: "城市",
show: true,
},
{
name: "address",
label: "地址",
show: true,
},
{
name: "zip",
label: "邮编",
show: true,
},
],
/**
* @type {Array}
* @description 表格数据(模拟数据)
*/
tableData: [
{
id: 1,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
children: [
{
id: 2,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 3,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
},
{
id: 4,
date: "2016-05-02",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 5,
date: "2016-05-03",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 6,
date: "2016-05-04",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 7,
date: "2016-05-05",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
/**
* @type {Object}
* @description 分页数据
*/
pagination: {
pageSize: 10,
current: 1,
total: 0,
},
});
//
const handleTableHeader = ({ type, data }) => {
console.log(type, data);
switch (type) {
case "create":
handleCreate();
console.log(type, data);
break;
case "edit":
console.log(type, data);
break;
}
};
//
const handleTablePagination = (current) => {
console.log(current);
};
//
const handleTableSort = (column, prop, order) => {
console.log(column, prop, order);
};
//
const handleSlot = (val) => {
console.log(val);
};
//
const handleCreate = () => {
console.log(12);
formDialog.value = true
};
//
// TableBodyRef.value.clearMixInput()
//
// TableBodyRef.value.clearSearch()
/* 表单弹框 */
const formDialog = ref(false)
const FormDialogData = reactive({
title: '新增', // String | |
width: '30%', // String | 30% |
formType: 'slot', // 'slot' slot | 'json' json
// json
formJosnRules: {}, // {}
formJosnLabelWidth: '120px', // 120px label
// form
formJosnElement: [
{
type: 'input', //
cloSpan: '24', // 24
disabled: false, // false
label: '姓名', // label
placeholder: '请填写姓名', // placeholder
model: 'name', // form key
// options: [] // type select []
// dateType: [] // type date date
// dateValueformat: [] // type date YYYY-MM-DD
},
],
formJosnDisabled: false, //
formJsonData: {}, //
})
const handleSubmit = (formJsonValue) => {
formDialog.value = false
}
const form = ref({})
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,296 @@
<template>
<div class="tc">
<div class="at">
<div class="dx">
<div class="shang"><span>字段选择</span></div>
<div :class="data.sjlbs.length > 0 ? 'xia' : 'xia2'">
<el-radio-group
v-model="values"
v-if="data.sjlbs.length > 0"
@change="log"
>
<div
class="xz"
v-for="(item, index) in data.sjlbs"
:key="index"
style="padding-right;:10px;display: block;width: 100%;"
>
<el-radio :label="item.id" size="large">{{ item.name }}</el-radio>
</div>
</el-radio-group>
<div class="wsj" v-if="data.sjlbs.length <= 0">无数据</div>
</div>
</div>
<el-transfer
@change="change"
:props="{
key: 'id',
label: 'name',
}"
:titles="['规则选择', '已选规则']"
v-model="value"
:data="data.sjlb"
/>
</div>
<el-table
:data="data.tableData"
style="width: 100%"
max-height="268"
:header-cell-style="{ background: '#eef1f6', color: '#606266' }"
>
<el-table-column prop="metadataStr" label="元数据名称" />
<el-table-column prop="columnStr" label="字段名称" />
<el-table-column prop="ruleStr" label="规则名称" />
</el-table>
<div class="ats">
<div style="padding-right;:10px">
<el-button @click="fh">取消</el-button>
</div>
<div style="padding-left: 10px">
<el-button @click="bc" type="primary">确定</el-button>
</div>
</div>
</div>
</template>
<script setup >
import { ref, reactive, watch, nextTick } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import http from "@/utils/request.js";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router = useRouter();
const value = ref([]);
const values = ref([]);
const handleChange = (value, direction, movedKeys) => {
console.log(value, direction, movedKeys);
};
const data = reactive({
codeid: "",
tableData: [],
tableDatas: [],
pagination: {
pageSize: "99999",
page: "1",
},
sjlb: [],
sjlbs: [],
param: {
metadataColumnRuleList: {},
metadataId: route.query.id,
},
});
//
const metadataProject = () => {
const params = {
size: data.pagination.pageSize,
page: data.pagination.current,
};
http.get(`/metadata/columnRule/`, params).then((resp) => {
if (resp.code == 200) {
value.value = [];
data.sjlb = resp.data.records;
data.tableData.forEach((element) => {
if (data.codeid == element.columnId) {
value.value.push(element.ruleId);
}
});
} else {
ElMessage.error(resp.message);
}
});
};
const metadata = () => {
const params = {
metadataId: route.query.id,
size: data.pagination.pageSize,
page: data.pagination.current,
};
http.get("/metadata/metadataColumn", params).then((resp) => {
if (resp.code == 200) {
data.sjlbs = resp.data.records;
} else {
ElMessage.error(resp.message);
}
});
};
const bc = () => {
data.param.metadataColumnRuleList = [];
let ll = [];
let ls = [];
value.value.forEach((element, indexs) => {
ll.push({
columnId: values.value,
id: "",
metadataId: route.query.id,
ruleId: element,
});
});
data.tableData.forEach((element, index) => {
ll.forEach((elements, indexs) => {
if (element.columnId == elements.columnId) {
if (element.ruleId == elements.ruleId) {
ll[indexs] = {
columnId: element.columnId,
id: element.id,
metadataId: element.metadataId,
ruleId: element.ruleId,
};
}
} else {
ls.push({
columnId: element.columnId,
id: element.id,
metadataId: element.metadataId,
ruleId: element.ruleId,
});
}
});
});
var newDataList = removalDuplicate(ls, "id");
console.log(newDataList);
console.log(ll);
data.param.metadataColumnRuleList = [...ll, ...newDataList];
meta();
};
function removalDuplicate(dataList, byName) {
var result = [];
var tem = {};
for (var i = 0; i < dataList.length; i++) {
if (!tem[dataList[i][byName]]) {
result.push(dataList[i]);
tem[dataList[i][byName]] = 1;
}
}
return result;
}
const meta = () => {
console.log(data.param);
http.post("/metadata/metadata/config", data.param).then((resp) => {
if (resp.code == 200) {
ElMessage.success("保存成功");
metadata();
Project();
} else {
metadata();
Project();
ElMessage.error(resp.message);
}
});
};
watch(
values,
(newval) => {
if (values.value.length !== 0) {
metadataProject();
} else {
data.sjlb = [];
value.value = [];
}
},
{ deep: true }
);
//
const fh = () => {
router.back();
};
const log = (e) => {
data.codeid = e;
metadataProject();
};
const Project = () => {
http.get(`/metadata/metadata/config/${route.query.id}`).then((resp) => {
if (resp.code == 200) {
data.tableData = resp.data;
} else {
ElMessage.error(resp.message);
}
});
};
metadata();
Project();
</script>
<style lang="scss" scoped>
.el-transfer {
--el-transfer-border-color: var(--el-border-color-lighter);
--el-transfer-border-radius: var(--el-border-radius-base);
--el-transfer-panel-width: 285px;
--el-transfer-panel-header-height: 53px;
--el-transfer-panel-header-bg-color: var(--el-fill-color-light);
--el-transfer-panel-footer-height: 40px;
--el-transfer-panel-body-height: 298px;
--el-transfer-item-height: 30px;
--el-transfer-filter-height: 32px;
}
.tc {
width: 100%;
}
.at {
text-align: center;
margin: 2vw auto;
display: flex;
justify-content: space-evenly;
.dx {
width: 285px;
border: 1px solid #ebeef5;
height: 352px;
background-color: #fff;
.shang {
background-color: var(--el-fill-color-light);
border-bottom: 1px solid #ebeef5;
text-align: left;
line-height: 53px;
height: 53px;
width: 100%;
span {
padding-left: 20px;
}
}
.xia {
text-align: left;
width: 285px;
height: 298px;
overflow-y: scroll;
.wsj {
margin: 0;
height: var(--el-transfer-item-height);
line-height: var(--el-transfer-item-height);
padding: 6px 15px 0;
color: var(--el-text-color-secondary);
text-align: center;
}
.xz {
padding-left: 20px;
}
}
}
.xia2 {
text-align: left;
width: 285px;
height: 298px;
.wsj {
margin: 0;
height: var(--el-transfer-item-height);
line-height: var(--el-transfer-item-height);
padding: 6px 15px 0;
color: var(--el-text-color-secondary);
text-align: center;
}
.xz {
padding-left: 20px;
}
}
}
.ats {
margin-top: 2vw;
margin-bottom: 2vw;
width: 100%;
display: flex;
justify-content: center;
.el-button {
padding: 8px 10px;
}
}
</style>

View File

@ -0,0 +1,359 @@
<template>
<div class="example">
<TableBody v-bind="data" @handleTableHeader="handleTableHeader" @handleTablePagination="handleTablePagination"
@handleTableSort="handleTableSort" ref="TableBodyRef">
<!-- 表格插槽使用 -->
<template #slotName="{ currentCol, currentData }">
<span style="color: #729880">{{ currentData }}</span>
</template>
</TableBody>
<FormDialog v-model="formDialog" v-bind="FormDialogData" @handleSubmit="handleSubmit">
<template #default>
<el-form :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%" />
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" placeholder="Pick a time" style="width: 100%" />
</el-col>
</el-form-item>
</el-form>
</template>
</FormDialog>
</div>
</template>
<script setup>
import { ref, reactive } from "vue";
import TableBody from "@/components/TableBody/TableBody.vue";
import FormDialog from "@/components/FormDialog/FormDialog.vue";
const TableBodyRef = ref();
const data = reactive({
/**
* @type {Object}
* @description 表格头部
*/
tableHeader: [
{
buttons: [
"create",
"edit",
"delete",
"detail",
],
},
{
buttons: [
"refresh",
"filter",
{
name: "mixInput", //
options: [
{ label: 1, value: 1 },
{ label: 1, value: 1 },
],
// permission: false, //
},
{
name: "sort", //
options: [
{ label: "按企业名称", value: 1 },
{ label: "按姓名", value: 2 },
],
// permission: false, //
},
{
type: "custom", // custom popconfirm ,
name: "ruleButton", // handleTableHeader
title: "配置规则", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
}, {
type: "custom", // custom popconfirm ,
name: "dataButton", // handleTableHeader
title: "数据", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
}, {
type: "custom", // custom popconfirm ,
name: "Button", // handleTableHeader
title: "字段管理", //
icon: "Switch", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
},
],
},
// permission
// undefinedfalse
{
create: undefined,
edit: false,
delete: false,
search: false,
advanced: false,
refresh: false,
bulkDelete: false,
filter: false,
},
],
/**
* @type {Array}
* @description 表格参数
*/
tableType: {
selection: false, // Boolean
tableLoading: false, // Boolean loading
tableIndex: true, // Boolean
tableTree: true, // Boolean id
tableTreeName: "children", // String 'children'
isExpand: true, // Boolean false
isHiddenPagination: false, // Boolean false
changeHeight: false, // String / Number false
},
/**
* @type {Array}
* @description 表格配置
*/
tableList: [
{
type: "slot", // slot 使
name: "slotName", // name
label: "插槽",
show: true, //
sortable: true, // Boolean | 'custom' ( 'custom' handleTableSort )
// 使 sortable true
sortableMethod: (a, b) => {
console.log(a.date);
// a b (a b )
// 0 a b 0 0 a b
return new Date(a.date).getTime() - new Date(b.date).getTime();
},
width: 100,
},
{
name: "date",
label: "时间",
show: true,
sortable: "custom",
},
{
name: "name",
label: "姓名",
show: true,
},
{
name: "state",
label: "状态",
show: true,
},
{
name: "city",
label: "城市",
show: true,
},
{
name: "address",
label: "地址",
show: true,
},
{
name: "zip",
label: "邮编",
show: true,
},
],
/**
* @type {Array}
* @description 表格数据(模拟数据)
*/
tableData: [
{
id: 1,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
children: [
{
id: 2,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 3,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
},
{
id: 4,
date: "2016-05-02",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 5,
date: "2016-05-03",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 6,
date: "2016-05-04",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 7,
date: "2016-05-05",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
/**
* @type {Object}
* @description 分页数据
*/
pagination: {
pageSize: 10,
current: 1,
total: 0,
},
});
//
const handleTableHeader = ({ type, data }) => {
console.log(type, data);
switch (type) {
case "create":
handleCreate();
console.log(type, data);
break;
case "edit":
console.log(type, data);
break;
}
};
//
const handleTablePagination = (current) => {
console.log(current);
};
//
const handleTableSort = (column, prop, order) => {
console.log(column, prop, order);
};
//
const handleSlot = (val) => {
console.log(val);
};
//
const handleCreate = () => {
console.log(12);
formDialog.value = true
};
//
// TableBodyRef.value.clearMixInput()
//
// TableBodyRef.value.clearSearch()
/* 表单弹框 */
const formDialog = ref(false)
const FormDialogData = reactive({
title: '新增', // String | |
width: '30%', // String | 30% |
formType: 'slot', // 'slot' slot | 'json' json
// json
formJosnRules: {}, // {}
formJosnLabelWidth: '120px', // 120px label
// form
formJosnElement: [
{
type: 'input', //
cloSpan: '24', // 24
disabled: false, // false
label: '姓名', // label
placeholder: '请填写姓名', // placeholder
model: 'name', // form key
// options: [] // type select []
// dateType: [] // type date date
// dateValueformat: [] // type date YYYY-MM-DD
},
],
formJosnDisabled: false, //
formJsonData: {}, //
})
const handleSubmit = (formJsonValue) => {
formDialog.value = false
}
const form = ref({})
</script>
<style lang="scss" scoped></style>

View File

@ -64,6 +64,7 @@ const data = reactive({
"create", "create",
"edit", "edit",
"delete", "delete",
"detail",
{ {
type: "custom", // // custom popconfirm , type: "custom", // // custom popconfirm ,
name: "customButton", // handleTableHeader name: "customButton", // handleTableHeader

310
src/views/rule/index.vue Normal file
View File

@ -0,0 +1,310 @@
<template>
<div class="example">
<TableBody v-bind="data" @handleTableHeader="handleTableHeader" @handleTablePagination="handleTablePagination"
@handleTableSort="handleTableSort" ref="TableBodyRef">
<!-- 表格插槽使用 -->
<template #slotName="{ currentCol, currentData }">
<span style="color: #729880">{{ currentData }}</span>
</template>
</TableBody>
<FormDialog v-model="formDialog" v-bind="FormDialogData" @handleSubmit="handleSubmit">
<template #default>
<el-form :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%" />
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" placeholder="Pick a time" style="width: 100%" />
</el-col>
</el-form-item>
</el-form>
</template>
</FormDialog>
</div>
</template>
<script setup>
import { ref, reactive } from "vue";
import TableBody from "@/components/TableBody/TableBody.vue";
import FormDialog from "@/components/FormDialog/FormDialog.vue";
const TableBodyRef = ref();
const data = reactive({
/**
* @type {Object}
* @description 表格头部
*/
tableHeader: [
{
buttons: [
"create",
"edit",
"delete",
"detail",
],
},
{
buttons: [
"search",
"refresh",
"filter",
],
},
// permission
// undefinedfalse
{
create: undefined,
edit: false,
delete: false,
search: false,
advanced: false,
refresh: false,
bulkDelete: false,
filter: false,
},
],
/**
* @type {Array}
* @description 表格参数
*/
tableType: {
selection: false, // Boolean
tableLoading: false, // Boolean loading
tableIndex: true, // Boolean
tableTree: true, // Boolean id
tableTreeName: "children", // String 'children'
isExpand: true, // Boolean false
isHiddenPagination: false, // Boolean false
changeHeight: false, // String / Number false
},
/**
* @type {Array}
* @description 表格配置
*/
tableList: [
{
type: "slot", // slot 使
name: "slotName", // name
label: "插槽",
show: true, //
sortable: true, // Boolean | 'custom' ( 'custom' handleTableSort )
// 使 sortable true
sortableMethod: (a, b) => {
console.log(a.date);
// a b (a b )
// 0 a b 0 0 a b
return new Date(a.date).getTime() - new Date(b.date).getTime();
},
width: 100,
},
{
name: "date",
label: "时间",
show: true,
sortable: "custom",
},
{
name: "name",
label: "姓名",
show: true,
},
{
name: "state",
label: "状态",
show: true,
},
{
name: "city",
label: "城市",
show: true,
},
{
name: "address",
label: "地址",
show: true,
},
{
name: "zip",
label: "邮编",
show: true,
},
],
/**
* @type {Array}
* @description 表格数据(模拟数据)
*/
tableData: [
{
id: 1,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
children: [
{
id: 2,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 3,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
},
{
id: 4,
date: "2016-05-02",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 5,
date: "2016-05-03",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 6,
date: "2016-05-04",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 7,
date: "2016-05-05",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
/**
* @type {Object}
* @description 分页数据
*/
pagination: {
pageSize: 10,
current: 1,
total: 0,
},
});
//
const handleTableHeader = ({ type, data }) => {
console.log(type, data);
switch (type) {
case "create":
handleCreate();
console.log(type, data);
break;
case "edit":
console.log(type, data);
break;
}
};
//
const handleTablePagination = (current) => {
console.log(current);
};
//
const handleTableSort = (column, prop, order) => {
console.log(column, prop, order);
};
//
const handleSlot = (val) => {
console.log(val);
};
//
const handleCreate = () => {
console.log(12);
formDialog.value = true
};
//
// TableBodyRef.value.clearMixInput()
//
// TableBodyRef.value.clearSearch()
/* 表单弹框 */
const formDialog = ref(false)
const FormDialogData = reactive({
title: '新增', // String | |
width: '30%', // String | 30% |
formType: 'slot', // 'slot' slot | 'json' json
// json
formJosnRules: {}, // {}
formJosnLabelWidth: '120px', // 120px label
// form
formJosnElement: [
{
type: 'input', //
cloSpan: '24', // 24
disabled: false, // false
label: '姓名', // label
placeholder: '请填写姓名', // placeholder
model: 'name', // form key
// options: [] // type select []
// dateType: [] // type date date
// dateValueformat: [] // type date YYYY-MM-DD
},
],
formJosnDisabled: false, //
formJsonData: {}, //
})
const handleSubmit = (formJsonValue) => {
formDialog.value = false
}
const form = ref({})
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,349 @@
<template>
<div class="example">
<TableBody v-bind="data" @handleTableHeader="handleTableHeader" @handleTablePagination="handleTablePagination"
@handleTableSort="handleTableSort" @handleTree="handleTree" ref="TableBodyRef">
<!-- 表格插槽使用 -->
<template #slotName="{ currentCol, currentData }">
<span style="color: #729880">{{ currentData }}</span>
</template>
</TableBody>
<FormDialog v-model="formDialog" v-bind="FormDialogData" @handleSubmit="handleSubmit">
<template #default>
<el-form :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date"
style="width: 100%" />
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" placeholder="Pick a time" style="width: 100%" />
</el-col>
</el-form-item>
</el-form>
</template>
</FormDialog>
</div>
</template>
<script setup>
import { ref, reactive } from "vue";
import TableBody from "@/components/TableBody/TableBody.vue";
import FormDialog from "@/components/FormDialog/FormDialog.vue";
const TableBodyRef = ref();
const data = reactive({
/**
* @type {Object}
* @description 表格头部
*/
treeShow: true,
tableHeader: [
{
buttons: [
],
},
{
buttons: [
"search",
"search",
"search",
{
type: "custom", // custom popconfirm ,
name: "customButton", // handleTableHeader
title: "搜索", //
icon: "Message", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
},
{
type: "custom", // custom popconfirm ,
name: "customButton", // handleTableHeader
title: "重置", //
icon: "Message", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
},
{
type: "custom", // custom popconfirm ,
name: "customButton", // handleTableHeader
title: "新建", //
icon: "Message", // element icon
// 1. 'single'2. 'Arbitrary '
// 3. 'custom '4.
isOpen: "custom",
// isOpen custom Boolean | | function
disabled: false,
// permission: false, //
},
],
},
// permission
// undefinedfalse
{
create: undefined,
edit: false,
delete: false,
search: false,
advanced: false,
refresh: false,
bulkDelete: false,
filter: false,
},
],
/**
* @type {Array}
* @description 表格参数
*/
tableType: {
selection: false, // Boolean
tableLoading: false, // Boolean loading
tableIndex: true, // Boolean
tableTree: true, // Boolean id
tableTreeName: "children", // String 'children'
isExpand: true, // Boolean false
isHiddenPagination: false, // Boolean false
changeHeight: false, // String / Number false
},
/**
* @type {Array}
* @description 表格配置
*/
tableList: [
{
type: "slot", // slot 使
name: "slotName", // name
label: "插槽",
show: true, //
sortable: true, // Boolean | 'custom' ( 'custom' handleTableSort )
// 使 sortable true
sortableMethod: (a, b) => {
console.log(a.date);
// a b (a b )
// 0 a b 0 0 a b
return new Date(a.date).getTime() - new Date(b.date).getTime();
},
width: 100,
},
{
name: "date",
label: "时间",
show: true,
sortable: "custom",
},
{
name: "name",
label: "姓名",
show: true,
},
{
name: "state",
label: "状态",
show: true,
},
{
name: "city",
label: "城市",
show: true,
},
{
name: "address",
label: "地址",
show: true,
},
{
name: "zip",
label: "邮编",
show: true,
},
],
/**
* @type {Array}
* @description 表格数据(模拟数据)
*/
tableData: [
{
id: 1,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
children: [
{
id: 2,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 3,
date: "2016-05-01",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
},
{
id: 4,
date: "2016-05-02",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 5,
date: "2016-05-03",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 6,
date: "2016-05-04",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
{
id: 7,
date: "2016-05-05",
name: "Tom",
state: "California",
city: "Los Angeles",
address: "No. 189, Grove St, Los Angeles",
zip: "CA 90036",
slotName: "插槽",
},
],
/**
* @type {Object}
* @description 分页数据
*/
pagination: {
pageSize: 10,
current: 1,
total: 0,
},
});
//
const handleTableHeader = ({ type, data }) => {
console.log(type, data);
switch (type) {
case "create":
handleCreate();
console.log(type, data);
break;
case "edit":
console.log(type, data);
break;
}
};
//
const handleTablePagination = (current) => {
console.log(current);
};
//
const handleTableSort = (column, prop, order) => {
console.log(column, prop, order);
};
//
const handleSlot = (val) => {
console.log(val);
};
//
const handleCreate = () => {
console.log(12);
formDialog.value = true
};
const handleTree = (val) =>{
console.log('111111111',val);
}
//
// TableBodyRef.value.clearMixInput()
//
// TableBodyRef.value.clearSearch()
/* 表单弹框 */
const formDialog = ref(false)
const FormDialogData = reactive({
title: '新增', // String | |
width: '30%', // String | 30% |
formType: 'slot', // 'slot' slot | 'json' json
// json
formJosnRules: {}, // {}
formJosnLabelWidth: '120px', // 120px label
// form
formJosnElement: [
{
type: 'input', //
cloSpan: '24', // 24
disabled: false, // false
label: '姓名', // label
placeholder: '请填写姓名', // placeholder
model: 'name', // form key
// options: [] // type select []
// dateType: [] // type date date
// dateValueformat: [] // type date YYYY-MM-DD
},
],
formJosnDisabled: false, //
formJsonData: {}, //
})
const handleSubmit = (formJsonValue) => {
formDialog.value = false
}
const form = ref({})
</script>
<style lang="scss" scoped></style>