keyWorkLocation.vue 14.1 KB
<template>
    <div class="app-container">
        <div class="query-from">
            <el-form :inline="true"  :model="queryParamsOfLinggangKeyWorkLocation" class="demo-form-inline">
              
                <el-form-item label="车辆信息" props="请输入车辆信息">
                    <el-input style="width: 160px;" v-model="queryParamsOfLinggangKeyWorkLocation.nbbm" placeholder="车辆信息" clearable  @keyup.enter="handleQueryOfLinggangKeyWorkLocation" />
                </el-form-item>
             
                <el-form-item label="操作时间" props="请选择时间">
                     <el-date-picker style="width: 140px;" v-model="queryParamsOfLinggangKeyWorkLocation.time" type="date" align="right" unlink-panels
                        format="YYYY/MM/DD" value-format="YYYY-MM-DD" @keyup.enter="handleQueryOfLinggangKeyWorkLocation">
                      </el-date-picker>
               </el-form-item>

               <el-form-item>
                <el-button type="primary" icon="Search" @click="handleQueryOfLinggangKeyWorkLocation">搜索</el-button>
                <el-button icon="Refresh" @click="resetQueryOfLinggangKeyWorkLocation">重置</el-button>
              </el-form-item>
            </el-form>
        </div>

        <el-table v-loading="loadingOfLinggangKeyWorkLocation" :data="listOfLinggangKeyWorkLocation" @selection-change="handleSelectionChangeOfLinggangKeyWorkLocation" border max-height="600"
                  :default-expand-all="false" :row-class-name="tableRowClassName" @sort-change="sortChangeOfLinggangKeyWorkLocation">
            <el-table-column type="selection" width="50" align="center" />
            <el-table-column label="序号" type="index" width="60" align="center">
                <template #default="scope">
                    {{ (queryParamsOfLinggangKeyWorkLocation.pageNum - 1) * queryParamsOfLinggangKeyWorkLocation.pageSize + scope.$index + 1 }}
                </template>
            </el-table-column>
            <el-table-column label="场站名称" align="center" prop="yardName" sortable />
            <el-table-column label="设备号" align="center" prop="device" sortable />
            <el-table-column label="车辆信息" align="center" prop="nbbm"  />
            <el-table-column label="操作人员" align="center" prop="jobCode"  />
            <el-table-column label="操作时间" align="center" prop="time" sortable />
            <el-table-column label="操作类型" align="center" prop="eventType" sortable >
                <template #default="scope">
                    <view v-if="scope.row.eventType==16">管理员操作</view>
                    <view v-else-if="scope.row.eventType==17">紧急操作</view>
                    <view v-else>司机操作</view>
                </template>
            </el-table-column>
            <el-table-column label="存取状态" align="center" prop="type1" sortable >
                <template #default="scope">
                    <view v-if="scope.row.type1==0">归还</view>
                    <view v-else-if="scope.row.type1==1">借出</view>
                    <view v-else-if="scope.row.type1==2">初始状态</view>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="totalOfLinggangKeyWorkLocation > 0" :total="totalOfLinggangKeyWorkLocation" v-model:page="queryParamsOfLinggangKeyWorkLocation.pageNum" v-model:limit="queryParamsOfLinggangKeyWorkLocation.pageSize"
                    @pagination="getListOfLinggangKeyWorkLocation" @current-change=""/>

    
    </div>
</template>


<script setup name="LinggangKeyWorkLocation">
    import { getDicts,getDictsDelFlag } from '@/api/system/dict/data';
    import { listLimitOfLinggangKeyWorkLocation, viewOfLinggangKeyWorkLocation, addOfLinggangKeyWorkLocation, updateOfLinggangKeyWorkLocation,updateStatusOfLinggangKeyWorkLocation,deleteOfLinggangKeyWorkLocation } from "@/api/scheduling/keyWorkLocation/keyWorkLocation";
    const { proxy } = getCurrentInstance();

    const listOfLinggangKeyWorkLocation = ref([]);
    const openOfLinggangKeyWorkLocation = ref(false);
    const titleOfLinggangKeyWorkLocation = ref("");
    const loadingOfLinggangKeyWorkLocation = ref(true);
    const showSearchOfLinggangKeyWorkLocation = ref(true);
    const idsOfLinggangKeyWorkLocation = ref([]);
    const singleLinggangKeyWorkLocation = ref(true);
    const multipleLinggangKeyWorkLocation = ref(true);


    const pageOfLinggangKeyWorkLocation = ref(1) //第几页
    const sizeOfLinggangKeyWorkLocation = ref(10) //一页多少条
    const totalOfLinggangKeyWorkLocation = ref(0);
    const pageSizesOfLinggangKeyWorkLocation = [5, 10, 20, 50]; //每页显示多少条
    const currentPageOfLinggangKeyWorkLocation = ref(1) // 当前页
    const globalRowOfLinggangKeyWorkLocation = ref(null) // 当前行数据

    const changeFlagOfLinggangKeyWorkLocation = ref(true)
    const deleteFlagsOfLinggangKeyWorkLocation = ref([])

    const YardIds=ref([]);
    const KeyInfoIds=ref([]);
    const SchedulingIds=ref([]);

    const dataOfLinggangKeyWorkLocation = reactive({
        formOfLinggangKeyWorkLocation: {},
        queryParamsOfLinggangKeyWorkLocation: {
            pageNum: 1,
            pageSize: 10,
            id : null,
            yardId : null,
            yardName : null,
            device : null,
            cabinetNo : null,
            createBy : null,
            createTime : null,
            updateBy : null,
            updateTime : null,
            delFlag : null,
            eventType : null,
            keyInfoId : null,
            scheduleDate : null,
            schedulingId : null,
            type : null,
            type1 : null,
            time : null,
            nbbm  :null,
        },
        checkRulesOfLinggangKeyWorkLocation: {
            id : [
                { required: true, message: "ID", trigger: "blur" }
            ],
            yardId : [
                { required: true, message: "场站ID", trigger: "blur" }
            ],
            yardName : [
                { required: true, message: "场站名称", trigger: "blur" }
            ],
            device : [
                { required: true, message: "设备号", trigger: "blur" }
            ],
            cabinetNo : [
                { required: true, message: "钥匙位编号", trigger: "blur" }
            ],
            createBy : [
                { required: true, message: "创建人员", trigger: "blur" }
            ],
            createTime : [
                { required: true, message: "创建时间", trigger: "blur" }
            ],
            updateBy : [
                { required: true, message: "修改人员", trigger: "blur" }
            ],
            updateTime : [
                { required: true, message: "修改时间", trigger: "blur" }
            ],
            delFlag : [
                { required: true, message: "是否删除;0为未删除,1已删除", trigger: "blur" }
            ],
            eventType : [
                { required: true, message: "操作类型;-0司机操作,16管理员操作,17紧急操作", trigger: "blur" }
            ],
            keyInfoId : [
                { required: true, message: "钥匙ID", trigger: "blur" }
            ],
            scheduleDate : [
                { required: true, message: "排班时间", trigger: "blur" }
            ],
            schedulingId : [
                { required: true, message: "排班ID", trigger: "blur" }
            ],
            type : [
                { required: true, message: "状态:0存入,1取出 ,16:钥匙未归还,255异常", trigger: "blur" }
            ],
            type1 : [
                { required: true, message: "状态:1 是归还;0是借出;2是初始状态", trigger: "blur" }
            ],
            time : [
                { required: true, message: "", trigger: "blur" }
            ],
        }
    });

    const { queryParamsOfLinggangKeyWorkLocation, formOfLinggangKeyWorkLocation, checkRulesOfLinggangKeyWorkLocation } = toRefs(dataOfLinggangKeyWorkLocation );

    /** 查询设备信息列表 */
    function getListOfLinggangKeyWorkLocation() {
        loadingOfLinggangKeyWorkLocation.value = true;
        console.log(queryParamsOfLinggangKeyWorkLocation.value.pageNum);
      
        
        listLimitOfLinggangKeyWorkLocation(queryParamsOfLinggangKeyWorkLocation.value,queryParamsOfLinggangKeyWorkLocation.value.pageNum,queryParamsOfLinggangKeyWorkLocation.value.pageSize).then(response => {
            listOfLinggangKeyWorkLocation.value = response.records;
            totalOfLinggangKeyWorkLocation.value = response.total;
            
            loadingOfLinggangKeyWorkLocation.value = false;

            // deleteFlagsOfLinggangKeyWorkLocationFunction(function (){
               
            // })
        });
    }

    function currentChangeFun(val){
        console.log("currentChangeFun--------------------->");
        
    }

    function deleteFlagsOfLinggangKeyWorkLocationFunction(fun){
        getDictsDelFlag().then(response=>{
            deleteFlagsOfLinggangKeyWorkLocation.value =  response.data;


            if(fun){
                fun(response);
            }
        });
    }
    /**排序*/
    function sortChangeOfLinggangKeyWorkLocation(data){
        queryParamsOfLinggangKeyWorkLocation.value.order=data.order;
        queryParamsOfLinggangKeyWorkLocation.value.prop=data.prop;
        getListOfLinggangKeyWorkLocation();
    }

    // 取消按钮
    function cancelOfLinggangKeyWorkLocation() {
        openOfLinggangKeyWorkLocation.value = false;
        globalRowOfLinggangKeyWorkLocation.value = null
        resetOfLinggangKeyWorkLocation();
    }

    const handleSizeChange = (val) => {
        sizeOfLinggangKeyWorkLocation.value = val;
    }
    const handleCurrentChange = (val) => {
        pageOfLinggangKeyWorkLocation.value = val;
    }


    // 表单重置
    function resetOfLinggangKeyWorkLocation() {
        formOfLinggangKeyWorkLocation.value = {
            id  : null,
            yardId  : null,
            yardName  : null,
            device  : null,
            cabinetNo  : null,
            createBy  : null,
            createTime  : null,
            updateBy  : null,
            updateTime  : null,
            delFlag  : null,
            eventType  : null,
            keyInfoId  : null,
            scheduleDate  : null,
            schedulingId  : null,
            type  : null,
            type1  : null,
            time  : null,
        };
        proxy.resetForm("rulesOfLinggangKeyWorkLocation");
    }

    /** 搜索按钮操作 */
    function handleQueryOfLinggangKeyWorkLocation() {
        queryParamsOfLinggangKeyWorkLocation.value.pageNum = 1;
        getListOfLinggangKeyWorkLocation();
    }

    /** 重置按钮操作 */
    function resetQueryOfLinggangKeyWorkLocation() {
        dataOfLinggangKeyWorkLocation.queryParamsOfLinggangKeyWorkLocation.nbbm = null;
        dataOfLinggangKeyWorkLocation.queryParamsOfLinggangKeyWorkLocation.time = null;
        handleQueryOfLinggangKeyWorkLocation();
    }

    // 多选框选中数据
    function handleSelectionChangeOfLinggangKeyWorkLocation(selection) {
        idsOfLinggangKeyWorkLocation.value = selection.map(item => item.id);
        singleLinggangKeyWorkLocation.value = selection.length != 1;
        multipleLinggangKeyWorkLocation.value = !selection.length;
    }

    /** 新增按钮操作 */
    function handleAddOfLinggangKeyWorkLocation() {
        resetOfLinggangKeyWorkLocation();
        changeFlagOfLinggangKeyWorkLocation.value = true;
        openOfLinggangKeyWorkLocation.value = true;
        titleOfLinggangKeyWorkLocation.value = "添加";
    }

    /** 修改按钮操作 */
    function handleUpdateOfLinggangKeyWorkLocation(row) {
        resetOfLinggangKeyWorkLocation();
        const _id = row.id || idsOfLinggangKeyWorkLocation.value
        viewOfLinggangKeyWorkLocation(_id).then(response => {
            formOfLinggangKeyWorkLocation.value = response.data;
            openOfLinggangKeyWorkLocation.value = true;
            titleOfLinggangKeyWorkLocation.value = "修改";
        });
    }

    /** 提交按钮 */
    function submitFormOfLinggangKeyWorkLocation() {
        proxy.$refs["rulesOfLinggangKeyWorkLocation"].validate(valid => {
            if (valid) {
                if (formOfLinggangKeyWorkLocation.value.id != null) {
                    updateOfLinggangKeyWorkLocation(formOfLinggangKeyWorkLocation.value).then(response => {
                        proxy.$modal.msgSuccess("修改成功");
                        openOfLinggangKeyWorkLocation.value = false;
                        getListOfLinggangKeyWorkLocation();
                    });
                } else {
                    addOfLinggangKeyWorkLocation(formOfLinggangKeyWorkLocation.value).then(response => {
                        proxy.$modal.msgSuccess("新增成功");
                        openOfLinggangKeyWorkLocation.value = false;
                        getListOfLinggangKeyWorkLocation();
                    });
                }
            }
        });
    }

    /** 删除按钮操作 */
    function handleDeleteOfLinggangKeyWorkLocation(row) {
        const _idsOfLinggangKeyWorkLocation = row.id || idsOfLinggangKeyWorkLocation.value;
        proxy.$modal.confirm('是否确认删除  为"' + _idsOfLinggangKeyWorkLocation + '"的数据项?').then(function () {
            return deleteOfLinggangKeyWorkLocation(_idsOfLinggangKeyWorkLocation);
        }).then(() => {
            getListOfLinggangKeyWorkLocation();
            proxy.$modal.msgSuccess("删除成功");
        }).catch(() => { });
    }

    /** 导出按钮操作 */
    function handleExportOfLinggangKeyWorkLocation() {
        proxy.download('Linggang/key/work/location/export', {
            ...queryParamsOfLinggangKeyWorkLocation.value
        }, `LinggangKeyWorkLocation_${new Date().getTime()}.xlsx`)
    }

        // function init_YardId(){
        //     ().then(res=>{YardIds.value=res.data});
        // }
        // function init_KeyInfoId(){
        //     ().then(res=>{KeyInfoIds.value=res.data});
        // }
        // function init_SchedulingId(){
        //     ().then(res=>{SchedulingIds.value=res.data});
        // }

    getListOfLinggangKeyWorkLocation();
</script>