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

Thu Nov 16 11:00:00 CST 2023 inscode

上级 83f8b031
<script setup> <script setup>
import mainer from '../main/main.vue' import mains from '@/component/main/main.vue'
import headers from '../main/header/header.vue'; import headers from '@/component/main/header/header.vue';
import addDownload from '../main/header/add_download/addDownload.vue'; import addDownload from '@/component/main/header/add_download/addDownload.vue';
import buttoner from '../main/header/add_download/button.vue'; import buttoner from '@/component/main/header/add_download/button.vue';
import downloadItem from '../main/header/add_download/downloadItem.vue'; import downloadItem from '@/component/main/header/add_download/downloadItem.vue';
import ejectDialog from '../main/ejectDialog.vue'; import ejectDialog from '@/component/main/ejectDialog.vue';
import { ref, provide } from 'vue'; import { ref, provide } from 'vue';
const addText = ref('添加分类'); const addText = ref('添加分类');
...@@ -118,8 +118,8 @@ provide("deleteDialog", deleteDialog); ...@@ -118,8 +118,8 @@ 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("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => { provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") { if (column.property === "state") {
...@@ -138,9 +138,9 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => { ...@@ -138,9 +138,9 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
</script> </script>
<template> <template>
<mainer :tableType="tableType" :operation="operation" > <mains :tableType="tableType" :operation="operation" >
<headers> <headers>
<!-- <headerForm></headerForm> --> <!-- <headerFmainsorm></headerForm> -->
<addDownload> <addDownload>
<buttoner class="left" @openDialog="addDialog = true"> <buttoner class="left" @openDialog="addDialog = true">
{{ addText }} {{ addText }}
...@@ -160,7 +160,7 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => { ...@@ -160,7 +160,7 @@ provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
<ejectDialog v-model:openDialog="deleteDialog"> <ejectDialog v-model:openDialog="deleteDialog">
<template #header>fdsafs</template> <template #header>fdsafs</template>
</ejectDialog> </ejectDialog>
</mainer> </mains>
</template> </template>
<style scoped> <style scoped>
......
<script setup>
import mains from '@/component/main/main.vue'
import headers from '@/component/main/header/header.vue';
import addDownload from '@/component/main/header/add_download/addDownload.vue';
import buttoner from '@/component/main/header/add_download/button.vue';
import downloadItem from '@/component/main/header/add_download/downloadItem.vue';
import ejectDialog from '@/component/main/ejectDialog.vue';
import { ref, provide } from 'vue';
const addText = ref('添加分类');
let tableData = ref([
{
id: 1,
sort: 1,
typeName: "普通公告",
parent: 0,
state: true,
},
{
id: 2,
sort: 2,
typeName: "紧急公告",
parent: 0,
state: true,
children: [
{
id: 6,
sort: 0,
typeName: "紧急公告",
state: true,
parent: 2,
}
]
},
{
id: 3,
sort: 3,
typeName: "防疫公告",
state: true,
parent: 0,
},
])
let tableType = ref([
{
name: "id号",
type: "id",
width: "150px",
isSort: false,
align: "center"
},
{
name: "排序",
type: "sort",
width: "100px",
isSort: true,
align: "center"
},
{
name: '分类名称',
type: "typeName",
width: "auto",
isSort: false,
align: "left"
},
{
name: '父级id',
type: "parent",
width: "80px",
isSort: false,
align: "center"
},
{
name: '状态',
type: "state",
width: "100px",
isSort: false,
align: "center"
}
]
);
let operation = ref({ type: ["addSubcategories", "edit", "delete"], width: "220px" });
const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") {
if (row.state == "正常")
return {
color: "#16b777"
};
}
return;
}
const addDialog = ref(false);
const addSubcategoriesDialog = ref(false);
const disabledDialog = ref(false);
const detailsDialog = ref(false);
const editDialog = ref(false);
const deleteDialog = ref(false);
const rowID = ref();
provide("addSubcategoriesDialog", addSubcategoriesDialog);
provide("disabledDialog", disabledDialog);
provide("detailsDialog", detailsDialog);
provide("editDialog", editDialog);
provide("deleteDialog", deleteDialog);
provide("tableData", tableData);
provide("rowID", rowID);
provide("changeState",()=>{
console.log(1111);
})
provide("cellSetStyle", ({ row, column, rowIndex, columnIndex }) => {
if (column.property === "state") {
if (row.state == "正常") {
return {
color: "#16b777"
};
} else if (row.state == "禁用") {
return {
color: "#F56C6C"
}
}
}
return;
});
</script>
<template>
<mains :tableType="tableType" :operation="operation" >
<headers>
<!-- <headerFmainsorm></headerForm> -->
<addDownload>
<buttoner class="left" @openDialog="addDialog = true">
{{ addText }}
</buttoner>
<downloadItem></downloadItem>
</addDownload>
</headers>
<ejectDialog v-model:openDialog="addDialog">
<template #header>fdsafs</template>
</ejectDialog>
<ejectDialog v-model:openDialog="addSubcategoriesDialog">
<template #header>fdsafs</template>
</ejectDialog>
<ejectDialog v-model:openDialog="editDialog">
<template #header>fdsafs</template>
</ejectDialog>
<ejectDialog v-model:openDialog="deleteDialog">
<template #header>fdsafs</template>
</ejectDialog>
</mains>
</template>
<style scoped>
.left {
margin-right: auto;
}
</style>
<script lang="ts" setup> <script lang="ts" setup>
import { inject } from 'vue'; import { inject,computed } from 'vue';
import operationr from './operation/operations.vue'; import operationr from './operation/operations.vue';
interface TableType { interface TableType {
...@@ -14,7 +14,9 @@ interface TableType { ...@@ -14,7 +14,9 @@ interface TableType {
contentBackground: string, contentBackground: string,
isReadOnly: boolean isReadOnly: boolean
} }
const isExitState = computed(()=>{
return prop.tableType.find(item => item.type == 'state');
})
const prop = defineProps<{ const prop = defineProps<{
tableType: TableType[], tableType: TableType[],
operation: { type: string[], width: string, coordin: Map<number, Set<string>> }, operation: { type: string[], width: string, coordin: Map<number, Set<string>> },
...@@ -37,10 +39,10 @@ const changeState:any = inject("changeState"); ...@@ -37,10 +39,10 @@ const changeState:any = inject("changeState");
<span v-if="item.hasAfterSlot" :style="item.hasAfterSlot.style">{{ item.hasAfterSlot.data }}</span> <span v-if="item.hasAfterSlot" :style="item.hasAfterSlot.style">{{ item.hasAfterSlot.data }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" class="head" prop="state" width="130px" label="状态" 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'">
<template #default="{ row }"> <template #default="{ row }">
<el-switch :model-value="row.state" inline-prompt @update:model-value="(newValue: any) => { <el-switch :model-value="row.state" inline-prompt @update:model-value="(newValue: any) => {
if (prop.tableType.find(item => item.type == 'state')?.isReadOnly) { if (!isExitState?.isReadOnly) {
changeState(); changeState();
return row.state = newValue; return row.state = newValue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册