From 0bbc87f96f249f8c86dc8960e295891b3d9837e2 Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期二, 09 九月 2025 16:59:17 +0800
Subject: [PATCH] 增加智能柜申领页面
---
ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue | 463 +++++++++++++++++++++++++++++++++++++--------------------
ui/admin-ui3/src/api/cwgl/smartLockerApplication.ts | 17 ++
2 files changed, 317 insertions(+), 163 deletions(-)
diff --git a/ui/admin-ui3/src/api/cwgl/smartLockerApplication.ts b/ui/admin-ui3/src/api/cwgl/smartLockerApplication.ts
index 68af655..2e1c566 100644
--- a/ui/admin-ui3/src/api/cwgl/smartLockerApplication.ts
+++ b/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'
+ })
+}
\ No newline at end of file
diff --git a/ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue b/ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue
index a92e75c..3801c99 100644
--- a/ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/smartLockerApplication/index.vue
@@ -1,184 +1,321 @@
<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" 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: '鏅鸿兘鏌滄牸鍙e彿',
- rules: [
- {
- required: true,
- message: "鏅鸿兘鏌滄牸鍙e彿涓嶈兘涓虹┖", trigger: "blur" }
- ], },
- status: {
- label: '鐘舵��(0:姝e父;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:姝e父;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) {
+ // 鍦ㄨ繖閲屾坊鍔犱綘鐨勮姹傛帴鍙i�昏緫
+ debouncedItemNameChange(val.value);
+ // 绀轰緥璇锋眰璋冪敤锛堥渶瑕佹浛鎹负瀹為檯鐨凙PI璋冪敤锛�
+ // yourApiRequestFunction(val).then(response => {
+ // // 澶勭悊鍝嶅簲
+ // }).catch(error => {
+ // // 澶勭悊閿欒
+ // });
+ }
+ }
+ },
+ lockerNo: {
+ label: '鏅鸿兘鏌滅紪鍙�',
+ minWidth: 180,
+ rules: [
+ {
+ required: true,
+ message: "鏅鸿兘鏌滅紪鍙蜂笉鑳戒负绌�", trigger: "blur"
+ }
+ ],
+ },
+ lockerPort: {
+ label: '鏅鸿兘鏌滄牸鍙e彿',
+ minWidth: 180,
+ rules: [
+ {
+ required: true,
+ message: "鏅鸿兘鏌滄牸鍙e彿涓嶈兘涓虹┖", trigger: "blur"
+ }
+ ],
+ },
+
+
+ cancelTime: {
+ label: '浣滃簾鏃堕棿',
+ minWidth: 180,
+ type: 'datetime', // 鏀逛负 datetime 绫诲瀷
+ format: 'YYYY-MM-DD HH:mm:ss',
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ addDisplay: false, // 鏂板鏃朵笉鏄剧ず
+
+ minWidth: 200,
+ },
+ receiveTime: {
+ label: '棰嗗彇鏃堕棿',
+ minWidth: 180,
+ type: 'datetime', // 鏀逛负 datetime 绫诲瀷
+ format: 'YYYY-MM-DD HH:mm:ss',
+ addDisplay: false, // 鏂板鏃朵笉鏄剧ず
+
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ minWidth: 200,
+ },
+ createTime: {
+ label: '鍒涘缓鏃堕棿',
+ minWidth: 180,
+ addDisplay: 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',
+ 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:姝e父;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 = '鎺ラ┏绔欐櫤鑳介挜鍖欐煖'
+ }
+ },
+ handleSelectionChangeFunc: (selection: any) => {
selectionList.value = selection;
}
})
+// 鍦� 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) {
+ // 鍦ㄨ繖閲屾坊鍔犱綘鐨勮姹傛帴鍙i�昏緫
+ 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);
+ })
+
+}
</script>
--
Gitblit v1.8.0