提交 a9b2315d 编写于 作者: 水晶土豆

Thu Nov 16 14:26:00 CST 2023 inscode

上级 7ceaf26e
......@@ -121,6 +121,7 @@ provide("rowID", rowID);
provide("changeState",()=>{
console.log(1111);
})
provide("subString","子分类")
provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") {
if (row.state == "正常") {
......
......@@ -9,14 +9,14 @@ import { ref, provide, onMounted } from 'vue';
import { getHumanResourcesDepartment } from '@/api/api';
import { FlatToTree } from '@/util/toTree';
import { deepClone } from '@/util/deepCode';
const addText = ref('添加分类');
const addText = ref('添加部门');
let tableData = ref([
])
onMounted(async()=>{
onMounted(async () => {
let data = (await getHumanResourcesDepartment()).data.data.data;
console.log(FlatToTree(data));
tableData.value = FlatToTree(data).tree;
console.log(deepClone(data));
tableData.value = FlatToTree(deepClone(data)).tree;
})
let tableType = ref([
......@@ -27,27 +27,27 @@ let tableType = ref([
isSort: false,
align: "center"
},
{
name: "排序",
type: "sort",
width: "100px",
isSort: true,
align: "center"
},
{
name: '上级ID',
type: "parentID",
width: "auto",
width: "80px",
isSort: false,
align: "left"
},
{
name: '部门名称',
type: "departmentName",
width: "80px",
width: "auto",
isSort: false,
align: "center"
},
{
name: "排序",
type: "sort",
width: "100px",
isSort: true,
align: "center"
},
{
name: '部门负责人',
type: "departmentHead",
......@@ -58,9 +58,14 @@ let tableType = ref([
{
name: '部门电话',
type: "departmentPhone",
width: "100px",
width: "200px",
isSort: false,
align: "center"
},
{
name:'状态',
type:'state',
width:'120px',
}
]
);
......@@ -103,9 +108,10 @@ provide("deleteDialog", deleteDialog);
provide("tableData", tableData);
provide("rowID", rowID);
provide("changeState",()=>{
console.log(1111);
provide("changeState", () => {
console.log(1111);
})
provide("subString","子部门");
provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") {
if (row.state == "正常") {
......@@ -123,7 +129,7 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
</script>
<template>
<mains :tableType="tableType" :operation="operation" >
<mains :tableType="tableType" :operation="operation">
<headers>
<!-- <headerFmainsorm></headerForm> -->
<addDownload>
......
<script setup>
import { inject } from 'vue';
const subStirng = inject('subString')? inject('subString') : "";
</script>
<template>
<el-button color="#16baaa" style="color: #fff;">添加子分类</el-button>
<el-button color="#16baaa" style="color: #fff;">添加{{ subStirng }}</el-button>
</template>
<style scoped></style>
......@@ -28,15 +28,16 @@ const changeState:any = inject("changeState");
</script>
<template>
<div>
<el-table :data="tableData" :header-cell-style="headRowStyle" :cell-style="cellSetStyle" max-height="600px"
<el-table
:data="tableData" :header-cell-style="headRowStyle" :cell-style="cellSetStyle" max-height="600px"
style="max-width: 100%; margin-bottom: 20px" row-key="id" border default-expand-all>
<el-table-column class="head" v-for="(item, index) in prop.tableType.filter(item => item.type != 'state')"
:prop="item.type" :label="item.name" :width="item.width" :align="item.align" :sortable="item.isSort"
:min-width="item.minWidth">
<template #default="data">
<span v-if="item.hasBeforeSlot" :style="item.hasBeforeSlot.style">{{ item.hasBeforeSlot.data }}</span>
<div :style="item.contentBackground">{{ data.row[item.type] }}</div>
<span v-if="item.hasAfterSlot" :style="item.hasAfterSlot.style">{{ item.hasAfterSlot.data }}</span>
<span v-if="item.hasBeforeSlot" :style="item.hasBeforeSlot.style" style="display:inline">{{ item.hasBeforeSlot.data }}</span>
<div :style="item.contentBackground" style="display:inline">{{ data.row[item.type] }}</div>
<span v-if="item.hasAfterSlot" :style="item.hasAfterSlot.style" style="display:inline">{{ item.hasAfterSlot.data }}</span>
</template>
</el-table-column>
<el-table-column v-if="isExitState" fixed="right" class="head" prop="state" :width="isExitState.width ? isExitState.width : 130" label="状态" :align="isExitState.align ? isExitState.align : 'center'">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册