zhouwenxuan
2023-08-11 1c328d7233aaa6ea48fbdfb73b415eb9837956a6
src/views/basicDataManage/gasManage/index.vue
@@ -1,15 +1,104 @@
<template>
  <div>
    气体管理
  </div>
    <div class="system-gas-container">
        <el-card shadow="hover">
            <div class="system-menu-search mb15">
                <el-form :inline="true" >
                    <el-form-item label="气体名称:">
                        <el-input  v-model="state.tableData.listQuery.searchParams.gasName"  placeholder="气体名称" ></el-input>
                    </el-form-item>
                    <el-button size="default" type="primary" class="ml10">
                        <el-icon>
                            <ele-Search />
                        </el-icon>
                        查询
                    </el-button>
                    <el-button size="default" class="ml10" @click="reset()">
                        <el-icon>
                            <RefreshLeft />
                        </el-icon>
                        重置
                    </el-button>
                </el-form>
            </div>
            <el-button size="default" class="mb10" type="success" @click="openDialog('新增',{})">
                <el-icon>
                    <ele-FolderAdd />
                </el-icon>
                新增气体
            </el-button>
            <el-table :data="state.tableData.data" style="width: 100%">
                <el-table-column align="center" type="index" label="序号" width="60" />
                <el-table-column align="center" prop="gasName" label="气体名称"/>
                <el-table-column align="center" prop="gasMolecularFormula" label="气体分子式"/>
                <el-table-column align="center" prop="gasThreshold" label="气体阈值"/>
                <el-table-column align="center" prop="gasUnit" label="气体单位"/>
                <el-table-column label="操作" show-overflow-tooltip width="140">
                    <template #default="scope">
                        <el-button size="small" text type="primary" @click="openDialog('查看', scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br />
            <el-pagination
                @size-change="onHandleSizeChange"
                @current-change="onHandleCurrentChange"
                class="page-position"
                :pager-count="5"
                :page-sizes="[10, 20, 30]"
                v-model:current-page="state.tableData.listQuery.pageIndex"
                background
                v-model:page-size="state.tableData.listQuery.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="state.tableData.total">
            </el-pagination>
            <br />
            <br />
        </el-card>
        <gas-dialog ref="gasRef" @getGasData="initGasData"></gas-dialog>
    </div>
</template>
<script setup lang="ts">
import {reactive, ref} from "vue";
import { TableDataState } from "/@/types/gasManage";
import gasDialog from "./component/gasDialog.vue";
const gasRef = ref();
const state = reactive<TableDataState>({
    tableData: {
        data: [],
        total: 0,
        loading: false,
        listQuery: {
            pageIndex: 1,
            pageSize: 10,
            searchParams:{
                gasName:''
            }
        }
    }
});
const initGasData = () => {
    console.log("数据列表")
};
const onHandleSizeChange = (val: number) => {
    state.tableData.listQuery.pageSize = val;
    initGasData();
};
// 分页改变
const onHandleCurrentChange = (val: number) => {
    state.tableData.listQuery.pageIndex = val;
    initGasData();
};
const openDialog = (type: string, value: any) => {
    gasRef.value.openDialog(type, value);
};
const reset = () => {
    state.tableData.listQuery.searchParams.gasName = '';
}
</script>
<style scoped lang="scss">
</style>