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

Thu Nov 16 14:26:00 CST 2023 inscode

上级 7ceaf26e
...@@ -121,6 +121,7 @@ provide("rowID", rowID); ...@@ -121,6 +121,7 @@ provide("rowID", rowID);
provide("changeState",()=>{ provide("changeState",()=>{
console.log(1111); console.log(1111);
}) })
provide("subString","子分类")
provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => { provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") { if (column.property === "state") {
if (row.state == "正常") { if (row.state == "正常") {
......
...@@ -9,14 +9,14 @@ import { ref, provide, onMounted } from 'vue'; ...@@ -9,14 +9,14 @@ import { ref, provide, onMounted } from 'vue';
import { getHumanResourcesDepartment } from '@/api/api'; import { getHumanResourcesDepartment } from '@/api/api';
import { FlatToTree } from '@/util/toTree'; import { FlatToTree } from '@/util/toTree';
import { deepClone } from '@/util/deepCode'; import { deepClone } from '@/util/deepCode';
const addText = ref('添加分类'); const addText = ref('添加部门');
let tableData = ref([ let tableData = ref([
]) ])
onMounted(async()=>{ onMounted(async () => {
let data = (await getHumanResourcesDepartment()).data.data.data; let data = (await getHumanResourcesDepartment()).data.data.data;
console.log(FlatToTree(data)); console.log(deepClone(data));
tableData.value = FlatToTree(data).tree; tableData.value = FlatToTree(deepClone(data)).tree;
}) })
let tableType = ref([ let tableType = ref([
...@@ -27,27 +27,27 @@ let tableType = ref([ ...@@ -27,27 +27,27 @@ let tableType = ref([
isSort: false, isSort: false,
align: "center" align: "center"
}, },
{
name: "排序",
type: "sort",
width: "100px",
isSort: true,
align: "center"
},
{ {
name: '上级ID', name: '上级ID',
type: "parentID", type: "parentID",
width: "auto", width: "80px",
isSort: false, isSort: false,
align: "left" align: "left"
}, },
{ {
name: '部门名称', name: '部门名称',
type: "departmentName", type: "departmentName",
width: "80px", width: "auto",
isSort: false, isSort: false,
align: "center" align: "center"
}, },
{
name: "排序",
type: "sort",
width: "100px",
isSort: true,
align: "center"
},
{ {
name: '部门负责人', name: '部门负责人',
type: "departmentHead", type: "departmentHead",
...@@ -58,9 +58,14 @@ let tableType = ref([ ...@@ -58,9 +58,14 @@ let tableType = ref([
{ {
name: '部门电话', name: '部门电话',
type: "departmentPhone", type: "departmentPhone",
width: "100px", width: "200px",
isSort: false, isSort: false,
align: "center" align: "center"
},
{
name:'状态',
type:'state',
width:'120px',
} }
] ]
); );
...@@ -103,9 +108,10 @@ provide("deleteDialog", deleteDialog); ...@@ -103,9 +108,10 @@ provide("deleteDialog", deleteDialog);
provide("tableData", tableData); provide("tableData", tableData);
provide("rowID", rowID); provide("rowID", rowID);
provide("changeState",()=>{ provide("changeState", () => {
console.log(1111); console.log(1111);
}) })
provide("subString","子部门");
provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => { provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") { if (column.property === "state") {
if (row.state == "正常") { if (row.state == "正常") {
...@@ -123,7 +129,7 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => { ...@@ -123,7 +129,7 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
</script> </script>
<template> <template>
<mains :tableType="tableType" :operation="operation" > <mains :tableType="tableType" :operation="operation">
<headers> <headers>
<!-- <headerFmainsorm></headerForm> --> <!-- <headerFmainsorm></headerForm> -->
<addDownload> <addDownload>
......
<script setup> <script setup>
import { inject } from 'vue';
const subStirng = inject('subString')? inject('subString') : "";
</script> </script>
<template> <template>
<el-button color="#16baaa" style="color: #fff;">添加子分类</el-button> <el-button color="#16baaa" style="color: #fff;">添加{{ subStirng }}</el-button>
</template> </template>
<style scoped></style> <style scoped></style>
...@@ -28,15 +28,16 @@ const changeState:any = inject("changeState"); ...@@ -28,15 +28,16 @@ const changeState:any = inject("changeState");
</script> </script>
<template> <template>
<div> <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> 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')" <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" :prop="item.type" :label="item.name" :width="item.width" :align="item.align" :sortable="item.isSort"
:min-width="item.minWidth"> :min-width="item.minWidth">
<template #default="data"> <template #default="data">
<span v-if="item.hasBeforeSlot" :style="item.hasBeforeSlot.style">{{ item.hasBeforeSlot.data }}</span> <span v-if="item.hasBeforeSlot" :style="item.hasBeforeSlot.style" style="display:inline">{{ item.hasBeforeSlot.data }}</span>
<div :style="item.contentBackground">{{ data.row[item.type] }}</div> <div :style="item.contentBackground" style="display:inline">{{ data.row[item.type] }}</div>
<span v-if="item.hasAfterSlot" :style="item.hasAfterSlot.style">{{ item.hasAfterSlot.data }}</span> <span v-if="item.hasAfterSlot" :style="item.hasAfterSlot.style" style="display:inline">{{ item.hasAfterSlot.data }}</span>
</template> </template>
</el-table-column> </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'"> <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.
先完成此消息的编辑!
想要评论请 注册