9个文件已修改
564 ■■■■ 已修改文件
quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/domain/SmartLockerApplication.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/mapper/SmartLockerApplicationMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/service/ISmartLockerApplicationService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/service/impl/KeyCollectionInfoServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/service/impl/SmartLockerApplicationServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/resources/mapper/cwgl/SmartLockerApplicationMapper.xml 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ui/admin-ui3/src/api/cwgl/smartLockerApplication.ts 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue 496 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
@@ -7,8 +7,10 @@
import com.ruoyi.cwgl.domain.EstimatedReceivable;
import com.ruoyi.cwgl.domain.PendingSettlementBusiness;
import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule;
import com.ruoyi.cwgl.mapper.SmartLockerApplicationMapper;
import com.ruoyi.cwgl.service.IEstimatedReceivableService;
import com.ruoyi.cwgl.service.IPendingSettlementBusinessService;
import com.ruoyi.cwgl.service.ISmartLockerApplicationService;
import com.ruoyi.cwgl.service.impl.ExactPricingRuleMatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +36,8 @@
    private IPendingSettlementBusinessService pendingSettlementBusinessService;
    @Autowired
    private IEstimatedReceivableService estimatedReceivableService;
    @Autowired
    private ISmartLockerApplicationService smartLockerApplicationService;
    public void insertPendingSettlement()
    {
@@ -108,7 +112,9 @@
        }
    }
    public void checkExpiredApplications() {
        smartLockerApplicationService.updateExpiredStatus();
    }
}
service/src/main/java/com/ruoyi/cwgl/domain/SmartLockerApplication.java
@@ -96,6 +96,10 @@
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @TableField("create_time")
    private Date createTime;
    /** 截止日期 */
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @TableField("deadline_time")
    private Date deadlineTime;
    /** 更新时间 */
service/src/main/java/com/ruoyi/cwgl/mapper/SmartLockerApplicationMapper.java
@@ -90,4 +90,6 @@
    Integer selectCwByLicensePlateNumber(String licensePlateNumber);
    int updateExpiredStatus();
}
service/src/main/java/com/ruoyi/cwgl/service/ISmartLockerApplicationService.java
@@ -108,4 +108,10 @@
    int invalid(Integer id);
    Integer selectCwByLicensePlateNumber(String licensePlateNumber);
    /**
     * 查询是否过期
     */
    void updateExpiredStatus();
}
service/src/main/java/com/ruoyi/cwgl/service/impl/KeyCollectionInfoServiceImpl.java
@@ -220,7 +220,7 @@
            return AjaxResult.error("要求出发时间"+ dateToStr+",领取钥匙超时"+keyTimeout+"个小时");
        }
        AjaxResult success = new AjaxResult(0, "成功",1);
        success.put("boxNum",keyCollectionInfo.getBoxNum());
        success.put("boxNumber",keyCollectionInfo.getBoxNum());
        logger.info("成功返回{}",success);
        return success;
    }
@@ -235,7 +235,7 @@
        smartLockerApplication.setReceiveTime(new Date());
        smartLockerApplicationMapper.updateSmartLockerApplication(smartLockerApplication);
        AjaxResult success = new AjaxResult(0, "成功",1);
        success.put("boxNum",smartLockerApplication.getLockerPort());
        success.put("boxNumber",smartLockerApplication.getLockerPort());
        logger.info("成功返回{}",success);
        return success;
    }
service/src/main/java/com/ruoyi/cwgl/service/impl/SmartLockerApplicationServiceImpl.java
@@ -202,4 +202,12 @@
        }
        return integer;
    }
    @Override
    public void updateExpiredStatus() {
        int i = smartLockerApplicationMapper.updateExpiredStatus();
        logger.info("更新{}条数据过期状态成功",i);
    }
}
service/src/main/resources/mapper/cwgl/SmartLockerApplicationMapper.xml
@@ -22,10 +22,11 @@
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="deleted"    column="deleted"    />
        <result property="deadlineTime"    column="deadline_time"    />
    </resultMap>
    <sql id="selectSmartLockerApplicationVo">
        select thisTab.id, thisTab.command_type, thisTab.applicant_code, thisTab.applicant_name, thisTab.item_type, thisTab.item_name, thisTab.locker_no, thisTab.locker_port, thisTab.status, thisTab.cancel_time, thisTab.receive_time, thisTab.create_time, thisTab.update_time, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.deleted from smart_locker_application AS thisTab
        select thisTab.id, thisTab.command_type, thisTab.applicant_code, thisTab.applicant_name, thisTab.item_type, thisTab.item_name, thisTab.locker_no, thisTab.locker_port, thisTab.status, thisTab.cancel_time, thisTab.receive_time, thisTab.create_time, thisTab.update_time, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.deleted, thisTab.deadline_time from smart_locker_application AS thisTab
    </sql>
    <sql id="selectSmartLockerApplicationVoCount">
        select count(0) from smart_locker_application as thisTab
@@ -98,6 +99,7 @@
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="deleted != null">deleted,</if>
            <if test="deadlineTime != null">deadline_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="commandType != null">#{commandType},</if>
@@ -116,17 +118,18 @@
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="deadlineTime != null">#{deadlineTime},</if>
         </trim>
    </insert>
    <insert id="insertSmartLockerApplicationBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into smart_locker_application
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,command_type,applicant_code,applicant_name,item_type,item_name,locker_no,locker_port,status,cancel_time,receive_time,create_time,update_time,remark,create_by,update_by,deleted,
            id,command_type,applicant_code,applicant_name,item_type,item_name,locker_no,locker_port,status,cancel_time,receive_time,create_time,update_time,remark,create_by,update_by,deleted,deadline_time,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.commandType},#{item.applicantCode},#{item.applicantName},#{item.itemType},#{item.itemName},#{item.lockerNo},#{item.lockerPort},#{item.status},#{item.cancelTime},#{item.receiveTime},#{item.createTime},#{item.updateTime},#{item.remark},#{item.createBy},#{item.updateBy},#{item.deleted},
                #{item.id},#{item.commandType},#{item.applicantCode},#{item.applicantName},#{item.itemType},#{item.itemName},#{item.lockerNo},#{item.lockerPort},#{item.status},#{item.cancelTime},#{item.receiveTime},#{item.createTime},#{item.updateTime},#{item.remark},#{item.createBy},#{item.updateBy},#{item.deleted},#{item.deadlineTime},
            </trim>
        </foreach>
    </insert>
@@ -151,6 +154,7 @@
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="deadlineTime != null">deadline_time = #{deadlineTime},</if>
        </trim>
        where id = #{id}
    </update>
@@ -175,10 +179,19 @@
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.deleted != null">deleted = #{item.deleted},</if>
                <if test="item.deadlineTime != null">deadline_time = #{item.deadlineTime},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
    <update id="updateExpiredStatus">
        UPDATE smart_locker_application
        SET status = 3, update_time = NOW()
        WHERE status = 0
        AND deadline_time &lt;  NOW()
    </update>
    <!--删除-->
    <delete id="deleteSmartLockerApplicationById" parameterType="Integer">
ui/admin-ui3/src/api/cwgl/smartLockerApplication.ts
@@ -65,3 +65,20 @@
        download('/cwgl/smartLockerApplication/export',query);
    })
}
/*  */
export const smartLockerApplicationQuery:requestType = (query) => {
    return request({
        url: '/cwgl/smartLockerApplication/licensePlate/query',
        method:'get',
        params:query
    })
}
/**
 * 作废
 */
export const smartLockerApplicationInvalid:requestType = (id) => {
    return request({
        url: '/cwgl/smartLockerApplication/invalid/' + id,
        method:'get'
    })
}
ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue
@@ -1,184 +1,354 @@
<template>
  <basicContainer >
    <avue-crud
        :option="option"
        :table-loading="pageF.loading"
        :data="tableData"
        :page="page"
        :permission="permissionList"
        :before-open="beforeOpen"
        v-model="form"
        ref="crudRef"
        @row-update="rowUpdate"
        @row-save="rowSave"
        @refresh-change="refreshChange"
        @row-del="rowDel"
        @search-change="searchChange"
        @search-reset="searchReset"
        @selection-change="selectionChange"
        @current-change="currentChange"
        @size-change="sizeChange"
        @on-load="onLoad"
    >
  <basicContainer>
    <avue-crud :option="option" :table-loading="pageF.loading" :data="tableData" :page="page"
      :permission="permissionList" :before-open="beforeOpen" v-model="form" ref="crudRef" @row-update="rowUpdate"
      @row-save="rowSave" @refresh-change="refreshChange" @row-del="rowDel" @search-change="searchChange"
      @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
      @size-change="sizeChange" @on-load="onLoad">
      <template #menu-left>
        <el-button
            type="success"
            icon="Edit"
            :disabled="pageF.single"
            v-hasPermi="['cwgl:smartLockerApplication:edit']"
            @click="handleUpdate">修改
        </el-button>
        <el-button
            type="danger"
            icon="Delete"
            :disabled="pageF.multiple"
            @click="handleDelete"
            v-hasPermi="['cwgl:smartLockerApplication:remove']"
        >删除
        </el-button>
        <el-button
            type="warning"
            plain
            icon="Download"
            @click="handleExport"
            v-hasPermi="['cwgl:smartLockerApplication:export']"
        >导出
        </el-button>
        <!-- <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:smartLockerApplication:edit']"
          @click="handleUpdate">修改
        </el-button> -->
        <!-- <el-button type="danger" icon="Delete" :disabled="pageF.multiple" @click="handleDelete"
          v-hasPermi="['cwgl:smartLockerApplication:remove']">删除
        </el-button> -->
        <!-- <el-button type="warning" plain icon="Download" @click="handleExport"
          v-hasPermi="['cwgl:smartLockerApplication:export']">导出
        </el-button> -->
      </template>
      <template #menu="{ size, row, index }">
       <el-link class="link-btn" type="primary" :underline="false" plain :size="size"
          @click="handleEditBtn(row, index)" v-if="row.status == 0"
          v-hasPermi="['cwgl:smartLockerApplication:cancel']"> 编辑
        </el-link>
        <el-link class="link-btn"  v-if="row.status == 0" type="primary" :underline="false" plain  @click="handleInvalid(row)"
          v-hasPermi="['cwgl:smartLockerApplication:invalid']"> 作废
        </el-link>
      </template>
    </avue-crud>
  </basicContainer>
</template>
<script setup name="smartLockerApplication" lang="ts">
  import {SmartLockerApplicationI,addSmartLockerApplication, delSmartLockerApplication, exportSmartLockerApplication, getSmartLockerApplication, listSmartLockerApplication, updateSmartLockerApplication} from "@/api/cwgl/smartLockerApplication";
  import useCurrentInstance from "@/utils/useCurrentInstance";
  import {computed,reactive, ref, toRefs} from "vue";
  import {PagesInterface, PageQueryInterface} from "@/utils/globalInterface";
  import {usePagePlus} from "@/hooks/usePagePlus";
  import {hasPermission} from "@/utils/permissionUtils";
import { SmartLockerApplicationI, addSmartLockerApplication, delSmartLockerApplication, exportSmartLockerApplication, getSmartLockerApplication, listSmartLockerApplication, updateSmartLockerApplication, smartLockerApplicationQuery,
  smartLockerApplicationInvalid
 } from "@/api/cwgl/smartLockerApplication";
import useCurrentInstance from "@/utils/useCurrentInstance";
import { computed, reactive, ref, toRefs } from "vue";
import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface";
import { usePagePlus } from "@/hooks/usePagePlus";
import { hasPermission } from "@/utils/permissionUtils";
  const { proxy } = useCurrentInstance();
  const crudRef = ref();
const { proxy } = useCurrentInstance();
const crudRef = ref();
  const permissionList = computed(()=>{
    return {
      addBtn: hasPermission(["cwgl:smartLockerApplication:add"]),
      delBtn: hasPermission(["cwgl:smartLockerApplication:remove"]),
      editBtn: hasPermission(["cwgl:smartLockerApplication:edit"]),
      viewBtn: hasPermission(["cwgl:smartLockerApplication:query"]),
    }
  })
const permissionList = computed(() => {
  return {
    addBtn: hasPermission(["cwgl:smartLockerApplication:add"]),
    delBtn: hasPermission(["cwgl:smartLockerApplication:remove"]),
    editBtn: hasPermission(["cwgl:smartLockerApplication:edit"]),
    viewBtn: hasPermission(["cwgl:smartLockerApplication:query"]),
  }
})
  const data = reactive({
    form:<SmartLockerApplicationI>{},
    queryParams:<SmartLockerApplicationI&PageQueryInterface>{},
    page: <PagesInterface>{
      pageSize: 10,
      total: 0,
      currentPage: 1,
const data = reactive({
  form: <SmartLockerApplicationI>{},
  queryParams: <SmartLockerApplicationI & PageQueryInterface>{},
  page: <PagesInterface>{
    pageSize: 10,
    total: 0,
    currentPage: 1,
  },
  selectionList: [],
})
const { queryParams, form, page, selectionList } = toRefs(data);
const option = ref({
  pageKey: 'SmartLockerApplication',
  rowKey: 'id',
  searchLabelWidth: 100,
  labelWidth: 120,
  addBtn: true,     // 隐藏新增按钮
  editBtn: false,    // 隐藏编辑按钮
  viewBtn: false,
  delBtn: false,
  column: {
    // id: {
    //   label: 'ID',
    // },
    commandType: {
      label: '指令类型',
      search: true,
      minWidth: 120,
      dataType: 'string',
      type: 'select',
      // addDisplay: false,  // 新增时不显示
      // editDisplay: false, // 修改时不显示
      dicUrl: '/system/dict/data/type/sys_command_type',
    },
    selectionList:[],
  })
  const {queryParams,form,page,selectionList} = toRefs(data);
  const option = ref({
    pageKey: 'SmartLockerApplication',
    rowKey: 'id',
    column: {
                                id: {
          label: 'ID',
                            },
                                commandType: {
          label: '指令类型(0:开门指令;1:流转指令)',
                            },
                                applicantCode: {
          label: '申领人编码',
                                rules: [
              {
                required: true,
                message: "申领人编码不能为空", trigger: "blur" }
            ],                  },
                                applicantName: {
          label: '申领人姓名',
                                rules: [
              {
                required: true,
                message: "申领人姓名不能为空", trigger: "blur" }
            ],                  },
                                itemType: {
          label: '领取物品类型(0:车钥匙;1:文件;2:印章;3:其他)',
                            },
                                itemName: {
          label: '物品名称',
                                rules: [
              {
                required: true,
                message: "物品名称不能为空", trigger: "blur" }
            ],                  },
                                lockerNo: {
          label: '智能柜编号默认接驳站智能钥匙柜',
                            },
                                lockerPort: {
          label: '智能柜格口号',
                                rules: [
              {
                required: true,
                message: "智能柜格口号不能为空", trigger: "blur" }
            ],                  },
                                status: {
          label: '状态(0:正常;1:作废;2:领取)',
                            },
                                cancelTime: {
          label: '作废时间',
                            },
                                receiveTime: {
          label: '领取时间',
                            },
                                createTime: {
          label: '创建时间',
                                rules: [
              {
                required: true,
                message: "创建时间不能为空", trigger: "blur" }
            ],                  },
                                updateTime: {
          label: '更新时间',
                            },
                                remark: {
          label: '备注',
                      type: 'textarea', minRows: 3, maxRows: 5,
                            },
                                createBy: {
          label: '创建人',
                            },
                                updateBy: {
          label: '更新人',
                            },
                                deleted: {
          label: '删除标记(0:正常;1:删除)',
                            },
          }
  })
    applicantCode: {
      label: '申领人编码',
      minWidth: 180,
      rules: [
        {
          required: true,
          message: "申领人编码不能为空", trigger: "blur"
        }
      ],
    },
    applicantName: {
      label: '申领人姓名',
      minWidth: 180,
      rules: [
        {
          required: true,
          message: "申领人姓名不能为空", trigger: "blur"
        }
      ],
    },
    itemType: {
      label: '领取物品类型',
      search: true,
      minWidth: 120,
      dataType: 'string',
      type: 'select',
      rules: [
        {
          required: true,
          message: "领取物品类型不能为空", trigger: "change"
        }
      ],
      // addDisplay: false,  // 新增时不显示
      // editDisplay: false, // 修改时不显示
      dicUrl: '/system/dict/data/type/sys_item_type',
      change: (val: any) => {
        if (val.value === '1') {
          if (form.value.itemName !== '' && form.value.itemName !== undefined) {
  const { tableData,pageF,rowSave,rowUpdate,rowDel,beforeOpen,searchChange,
    searchReset,selectionChange,onLoad,currentChange,sizeChange,handleDelete,handleExport,handleUpdate,refreshChange} = usePagePlus({
    form:form,
    option:option,
    queryParams:queryParams,
    idKey:'id',
    page:page.value,
    getListApi:listSmartLockerApplication,
    getDetailApi:getSmartLockerApplication,
    exportApi:exportSmartLockerApplication,
    deleteApi:delSmartLockerApplication,
    addApi:addSmartLockerApplication,
    updateApi:updateSmartLockerApplication,
    handleUpdateFunc:()=>{
          }
        }
      }
    },
    itemName: {
      label: '物品名称',
      showOverflowTooltip: true,
      minWidth: 180,
      rules: [
        {
          required: true,
          message: "物品名称不能为空", trigger: "blur"
        }
      ],
      change: (val: any) => {
        // 判断 itemType 是否为 '0',并且 itemName 有值
        if (form.value.itemType === '0' && val) {
          // 在这里添加你的请求接口逻辑
          debouncedItemNameChange(val.value);
          // 示例请求调用(需要替换为实际的API调用)
          // yourApiRequestFunction(val).then(response => {
          //   // 处理响应
          // }).catch(error => {
          //   // 处理错误
          // });
        }
      }
    },
    lockerNo: {
      label: '智能柜编号',
      minWidth: 180,
      rules: [
        {
          required: true,
          message: "智能柜编号不能为空", trigger: "blur"
        }
      ],
    },
    lockerPort: {
      label: '智能柜格口号',
      minWidth: 180,
      rules: [
        {
          required: true,
          message: "智能柜格口号不能为空", trigger: "blur"
        }
      ],
    },
    deadlineTime: {
      label: '领取截止时间',
      minWidth: 180,
      type: 'datetime',  // 改为 datetime 类型
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      addDisplay: true,  // 新增时不显示
      minWidth: 200,
        rules: [
        {
          required: true,
          message: "领取截止时间不能为空", trigger: "change"
        }
      ],
    },
    cancelTime: {
      label: '作废时间',
      minWidth: 180,
      type: 'datetime',  // 改为 datetime 类型
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      editDisplay: false,
      addDisplay: false,  // 新增时不显示
      minWidth: 200,
    },
    receiveTime: {
      label: '领取时间',
      minWidth: 180,
      type: 'datetime',  // 改为 datetime 类型
      format: 'YYYY-MM-DD HH:mm:ss',
      editDisplay: false,
      addDisplay: false,  // 新增时不显示
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      minWidth: 200,
    },
    createTime: {
      label: '创建时间',
      minWidth: 180,
      addDisplay: false,  // 新增时不显示
      editDisplay: false,
      type: 'datetime',  // 改为 datetime 类型
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      minWidth: 200,
      rules: [
        {
          required: true,
          message: "创建时间不能为空", trigger: "blur"
        }
      ],
    },
    status: {
      label: '状态',
      search: true,
      minWidth: 120,
      fixed: 'right',
      dataType: 'string',
      type: 'select',
      editDisplay: false,
      addDisplay: false,  // 新增时不显示
      dicUrl: '/system/dict/data/type/sys_apply_status',
    },
    // updateTime: {
    //   label: '更新时间',
    // },
    // remark: {
    //   label: '备注',
    //   type: 'textarea', minRows: 3, maxRows: 5,
    // },
    // createBy: {
    //   label: '创建人',
    // },
    // updateBy: {
    //   label: '更新人',
    // },
    // deleted: {
    //   label: '删除标记(0:正常;1:删除)',
    // },
  }
})
const { tableData, pageF, rowSave, rowUpdate, rowDel, beforeOpen, searchChange,
  searchReset, selectionChange, onLoad, currentChange, sizeChange, handleDelete, handleExport, handleUpdate, refreshChange } = usePagePlus({
    form: form,
    option: option,
    queryParams: queryParams,
    idKey: 'id',
    page: page.value,
    getListApi: listSmartLockerApplication,
    getDetailApi: getSmartLockerApplication,
    exportApi: exportSmartLockerApplication,
    deleteApi: delSmartLockerApplication,
    addApi: addSmartLockerApplication,
    updateApi: updateSmartLockerApplication,
    handleUpdateFunc: () => {
      crudRef.value.rowEdit(selectionList.value[0]);
    },
    handleSelectionChangeFunc:(selection:any)=>{
    handleBeforeOpenFunc: (done: Function, type: string) => {
      if (done == 'add') {
        option.value.column.lockerNo.value = '接驳站智能钥匙柜'
        option.value.column.deadlineTime.value =formatDateTime(new Date(Date.now() + 24 * 60 * 60 * 1000));
      }
    },
    handleSelectionChangeFunc: (selection: any) => {
      selectionList.value = selection;
    }
  })
  const formatDateTime = (date) => {
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
  const hours = String(date.getHours()).padStart(2, '0');
  const minutes = String(date.getMinutes()).padStart(2, '0');
  const seconds = String(date.getSeconds()).padStart(2, '0');
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
// 在 script setup 部分定义防抖节流函数
let debounceTimer: NodeJS.Timeout | null = null;
let throttleTimer: NodeJS.Timeout | null = null;
// 防抖函数
const debounce = (func: Function, delay: number) => {
  return function (...args: any[]) {
    if (debounceTimer) {
      clearTimeout(debounceTimer);
    }
    debounceTimer = setTimeout(() => {
      func.apply(this, args);
    }, delay);
  };
};
// 节流函数
const throttle = (func: Function, delay: number) => {
  return function (...args: any[]) {
    if (!throttleTimer) {
      throttleTimer = setTimeout(() => {
        func.apply(this, args);
        throttleTimer = null;
      }, delay);
    }
  };
};
// 定义实际要执行的函数
const handleItemNameChange = (val: any) => {
  // 判断 itemType 是否为 '0',并且 itemName 有值
  if (form.value.itemType === '0' && val) {
    // 在这里添加你的请求接口逻辑
    smartLockerApplicationQuery({ licensePlateNumber: val }).then(response => {
      if(response.code == 200){
         form.value.lockerPort = response.data || '';
      }
      // 处理响应
    })
  }
};
// 创建防抖版本的函数(推荐使用防抖)
const debouncedItemNameChange = debounce(handleItemNameChange, 500);
const handleInvalid = (row: any) => {
  proxy.$modal.confirm(`是否作废该申领人编码 :${row.applicantCode}?`).then(function () {
    return smartLockerApplicationInvalid(row.id);
  }).then((res) => {
    onLoad(page.value);
    proxy.$modal.msgSuccess(res.msg);
  })
}
const handleEditBtn = (row, index) => {
  crudRef.value.rowEdit(row, index)
  // option.value.editBtn = true;
}
</script>