<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px">
            <el-form-item label="设备名称" prop="equipmentName">
                <el-input v-model="queryParams.equipmentName" placeholder="请输入设备名称" clearable />
            </el-form-item>
            <el-form-item label="领用人" prop="recipientBy">
                <el-input v-model="queryParams.recipientBy" placeholder="请输入领用人" clearable />
            </el-form-item>

            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table border v-loading="loading" :data="acquisitionRecord" stripe>
            <el-table-column label="序号" type="index" width="55" align="center" />
            <el-table-column label="自编码" align="center" prop="encode" />
            <el-table-column label="设备名称" align="center" prop="equipmentName" />
            <el-table-column label="型号" align="center" prop="model" />
            <el-table-column label="领用日期" align="center" prop="recipientTime" />
            <el-table-column label="领用人" align="center" prop="recipientBy" />
            <el-table-column label="操作" align="center">
                <template v-slot="scope">
                    <el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)">查看
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList"></pagination>
        <el-dialog title="详细信息" :visible.sync="dialogVisible" width="1200px" append-to-body>
            <el-form ref="postForm" :model="postForm" label-width="110px" :disabled="isEdit">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="自编码" prop="encode">
                            <el-input v-model="postForm.encode"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="设备名称" prop="equipmentName">
                            <el-input v-model="postForm.equipmentName"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="型号" prop="model">
                            <el-input v-model="postForm.model"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="领用日期:" prop="recipientTime">
                            <el-date-picker v-model="postForm.recipientTime" type="datetime" style="width: 100%;"
                                value-format="yyyy-MM-dd HH:mm:ss" clearable></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="领用人" prop="recipientBy">
                            <el-input v-model="postForm.recipientBy" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>


            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
            </span>

        </el-dialog>
    </div>
</template>

<script>
import {
    listTeacherly,
    listTeacherlyxq
} from "@/api/smartSchool/personWork/propertyManagement";
export default {
    data() {
        return {
            queryParams: {
                equipmentName: '',
                recipientBy: '',
                pageNum: 1,
                pageSize: 10,
            },


            acquisitionRecord: [],
            loading: false,
            total: 0,
            dialogVisible: false,
            postForm: {
                equipmentid: '',
            },
            isEdit: false,
        }
    },
    created() {
        this.getList();
    },
    methods: {
        //获取数据信息
        getList() {
            listTeacherly(this.queryParams).then((response) => {
                this.acquisitionRecord = response.rows;
                this.loading = false;
                console.log(111, response.rows);
                this.total = response.total;
            });
        },
        handleLook(row) {
            console.log(row);
            const params = {
                id: row.id,
            }
            listTeacherlyxq(params).then(response => {
                this.postForm = response.data;
                console.log(this.postForm);
                this.dialogVisible = true;
                this.isEdit = true;
            });
        },

        //重置
        resetQuery() {
            this.queryParams = {
                equipmentName: '',
                recipientBy: '',
                pageNum: 1,
                pageSize: 10,
            },
                this.getList();
        },

    }

}
</script>

<style lang="scss" scoped></style>
<style lang="scss" scoped></style>
