Commit 4cd7e7a5fd431151acfddd20f6e9e6e6ec40485b
1 parent
8d8c50ea
钥匙和车辆管理
Showing
7 changed files
with
795 additions
and
4 deletions
src/api/carInfo/carInfo.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | + | |
| 4 | +// 分页查询列表 | |
| 5 | +export function listLimitOfCarInfo(params,page,limit) { | |
| 6 | + return request({ | |
| 7 | + url: '/car/info/list/limit/'+page+'/'+limit, | |
| 8 | + method: 'post', | |
| 9 | + refreshTip:false, | |
| 10 | + params | |
| 11 | + }) | |
| 12 | +} | |
| 13 | +// 选择状态 | |
| 14 | +export function selectListOfStatus(params) { | |
| 15 | + return request({ | |
| 16 | + url: '/car/info/list/select/status', | |
| 17 | + method: 'get', | |
| 18 | + refreshTip:false, | |
| 19 | + params | |
| 20 | + }) | |
| 21 | +} | |
| 22 | + | |
| 23 | +// 选择列表 | |
| 24 | +export function selectListOfCarInfo(params) { | |
| 25 | + return request({ | |
| 26 | + url: '/car/info/list/select', | |
| 27 | + method: 'post', | |
| 28 | + params | |
| 29 | + }) | |
| 30 | +} | |
| 31 | +// 导出报表列表 | |
| 32 | +export function exportReportList(params) { | |
| 33 | + return request({ | |
| 34 | + url: '/car/info/export', | |
| 35 | + method: 'get', | |
| 36 | + params | |
| 37 | + }) | |
| 38 | +} | |
| 39 | + | |
| 40 | +//查询列表详情 | |
| 41 | +export function viewOfCarInfo(id) { | |
| 42 | + return request({ | |
| 43 | + url: '/car/info/view/'+id, | |
| 44 | + method: 'get' | |
| 45 | + }) | |
| 46 | +} | |
| 47 | + | |
| 48 | +// 添加数据 | |
| 49 | +export function addOfCarInfo(params) { | |
| 50 | + return request({ | |
| 51 | + url: '/car/info/add', | |
| 52 | + method: 'post', | |
| 53 | + params | |
| 54 | + }) | |
| 55 | +} | |
| 56 | + | |
| 57 | +//修改数据 | |
| 58 | +export function updateOfCarInfo(params) { | |
| 59 | + return request({ | |
| 60 | + url: "/car/info/update", | |
| 61 | + method: "post", | |
| 62 | + params | |
| 63 | + }) | |
| 64 | +} | |
| 65 | + | |
| 66 | + | |
| 67 | + //修改状态 | |
| 68 | +export function updateStatusOfCarInfo(params) { | |
| 69 | + return request({ | |
| 70 | + url: "/car/info/update/status", | |
| 71 | + method: "post", | |
| 72 | + params | |
| 73 | + }) | |
| 74 | +} | |
| 75 | + | |
| 76 | + //删除数据 | |
| 77 | +export function deleteOfCarInfo(id) { | |
| 78 | + return request({ | |
| 79 | + url: "/car/info/del/"+id, | |
| 80 | + method: "get" | |
| 81 | + }) | |
| 82 | +} | ... | ... |
src/api/equipment/equipment.js
| ... | ... | @@ -9,6 +9,16 @@ export function listEquipment(query) { |
| 9 | 9 | }) |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | + | |
| 13 | +export function selectList(data){ | |
| 14 | + return request({ | |
| 15 | + url: '/equipment/equipment/list/select', | |
| 16 | + method: 'post', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 12 | 22 | // 查询设备信息详细 |
| 13 | 23 | export function getEquipment(id) { |
| 14 | 24 | return request({ | ... | ... |
src/api/keyinfo/keyInfo.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | + | |
| 4 | +// 分页查询列表 | |
| 5 | +export function listLimitOfKeyInfo(params,page,limit) { | |
| 6 | + return request({ | |
| 7 | + url: '/key/info/list/limit/'+page+'/'+limit, | |
| 8 | + method: 'post', | |
| 9 | + refreshTip:false, | |
| 10 | + params | |
| 11 | + }) | |
| 12 | +} | |
| 13 | +// 获取异常报表列表 | |
| 14 | +export function getErrorReportList(params) { | |
| 15 | + return request({ | |
| 16 | + url: '/key/info/error/list', | |
| 17 | + method: 'get', | |
| 18 | + params | |
| 19 | + }) | |
| 20 | +} | |
| 21 | +// 导出报表列表 | |
| 22 | +export function exportReportList(params) { | |
| 23 | + return request({ | |
| 24 | + url: '/key/info/export', | |
| 25 | + method: 'get', | |
| 26 | + params | |
| 27 | + }) | |
| 28 | +} | |
| 29 | + | |
| 30 | +//查询列表详情 | |
| 31 | +export function viewOfKeyInfo(id) { | |
| 32 | + return request({ | |
| 33 | + url: '/key/info/view/'+id, | |
| 34 | + method: 'get' | |
| 35 | + }) | |
| 36 | +} | |
| 37 | + | |
| 38 | +// 添加数据 | |
| 39 | +export function addOfKeyInfo(params) { | |
| 40 | + return request({ | |
| 41 | + url: '/key/info/add', | |
| 42 | + method: 'post', | |
| 43 | + params | |
| 44 | + }) | |
| 45 | +} | |
| 46 | + | |
| 47 | +//修改数据 | |
| 48 | +export function updateOfKeyInfo(params) { | |
| 49 | + return request({ | |
| 50 | + url: "/key/info/update", | |
| 51 | + method: "post", | |
| 52 | + params | |
| 53 | + }) | |
| 54 | +} | |
| 55 | + | |
| 56 | + | |
| 57 | + //修改状态 | |
| 58 | +export function updateStatusOfKeyInfo(params) { | |
| 59 | + return request({ | |
| 60 | + url: "/key/info/update/status", | |
| 61 | + method: "post", | |
| 62 | + params | |
| 63 | + }) | |
| 64 | +} | |
| 65 | + | |
| 66 | + //删除数据 | |
| 67 | +export function deleteOfKeyInfo(id) { | |
| 68 | + return request({ | |
| 69 | + url: "/key/info/del/"+id, | |
| 70 | + method: "get" | |
| 71 | + }) | |
| 72 | +} | ... | ... |
src/utils/request.js
| ... | ... | @@ -22,6 +22,10 @@ const service = axios.create({ |
| 22 | 22 | |
| 23 | 23 | // request拦截器 |
| 24 | 24 | service.interceptors.request.use(config => { |
| 25 | + if(null == config.refreshTip|| undefined == config.refreshTip){ | |
| 26 | + config.refreshTip = true; | |
| 27 | + } | |
| 28 | + | |
| 25 | 29 | // 是否需要设置 token |
| 26 | 30 | const isToken = (config.headers || {}).isToken === false |
| 27 | 31 | // 是否需要防止数据重复提交 |
| ... | ... | @@ -51,9 +55,12 @@ service.interceptors.request.use(config => { |
| 51 | 55 | const s_time = sessionObj.time; // 请求时间 |
| 52 | 56 | const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交 |
| 53 | 57 | if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { |
| 54 | - const message = '数据正在处理,请勿重复提交'; | |
| 55 | - console.warn(`[${s_url}]: ` + message) | |
| 56 | - return Promise.reject(new Error(message)) | |
| 58 | + if(config.refreshTip){ | |
| 59 | + const message = '数据正在处理,请勿重复提交'; | |
| 60 | + console.warn(`[${s_url}]: ` + message) | |
| 61 | + return Promise.reject(new Error(message)) | |
| 62 | + } | |
| 63 | + | |
| 57 | 64 | } else { |
| 58 | 65 | cache.session.setJSON('sessionObj', requestObj) |
| 59 | 66 | } | ... | ... |
src/views/equipment/carinfo/carInfo.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <div class="query-from"> | |
| 4 | + <el-form :inline="true" :queryOfCarInfo="queryOfCarInfo" :model="queryParamsOfCarInfo" class="demo-form-inline"> | |
| 5 | + <el-form-item label="车牌号" props="plateNum"> | |
| 6 | + <el-input style="width: 120px;" v-model="queryParamsOfCarInfo.plateNum" placeholder="请输入车牌号" clearable @keyup.enter="handleQueryOfCarInfo" /> | |
| 7 | + </el-form-item> | |
| 8 | + <el-form-item label="车位号" props="parkingNo"> | |
| 9 | + <el-input style="width: 120px;" v-model="queryParamsOfCarInfo.parkingNo" placeholder="请输入车位号" clearable @keyup.enter="handleQueryOfCarInfo" /> | |
| 10 | + </el-form-item> | |
| 11 | + <el-form-item label="车辆状态" props="status"> | |
| 12 | + <el-select v-model="queryParamsOfCarInfo.status" clearable @keyup.enter="handleQueryOfCarInfo"> | |
| 13 | + <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" /> | |
| 14 | + </el-select> | |
| 15 | + </el-form-item> | |
| 16 | + | |
| 17 | + <el-form-item> | |
| 18 | + <el-button type="primary" icon="Search" @click="handleQueryOfCarInfo">搜索</el-button> | |
| 19 | + <el-button icon="Refresh" @click="resetQueryOfCarInfo">重置</el-button> | |
| 20 | + </el-form-item> | |
| 21 | + </el-form> | |
| 22 | + | |
| 23 | + <el-row :gutter="10" class="mb8"> | |
| 24 | + <el-col :span="1.5"> | |
| 25 | + <el-button type="primary" plain icon="Plus" @click="handleAddOfCarInfo" v-hasPermi="['car:info:add']">新增</el-button> | |
| 26 | + | |
| 27 | + </el-col> | |
| 28 | + <el-col :span="1.5"> | |
| 29 | + <el-button type="success" plain icon="Edit" :disabled="singleCarInfo" @click="handleUpdateOfCarInfo" v-hasPermi="['car:info:update']">修改</el-button> | |
| 30 | + | |
| 31 | + </el-col> | |
| 32 | + <el-col :span="1.5"> | |
| 33 | + <el-button type="danger" plain icon="Delete" :disabled=multipleCarInfo @click="handleDeleteOfCarInfo" v-hasPermi="['car:info:del']">删除</el-button> | |
| 34 | + | |
| 35 | + </el-col> | |
| 36 | + <el-col :span="1.5"> | |
| 37 | + <el-button type="warning" plain icon="Download" @click="handleExportOfCarInfo" v-hasPermi="['car:info:export']">导出</el-button> | |
| 38 | + | |
| 39 | + </el-col> | |
| 40 | + <right-toolbar v-model:showSearch="showSearchOfCarInfo" @queryTable="getListOfCarInfo"></right-toolbar> | |
| 41 | + </el-row> | |
| 42 | + </div> | |
| 43 | + | |
| 44 | + <el-table v-loading="loadingOfCarInfo" :data="listOfCarInfo" @selection-change="handleSelectionChangeOfCarInfo" border max-height="600" | |
| 45 | + :default-expand-all="false" :row-class-name="tableRowClassName" @sort-change="sortChangeOfCarInfo"> | |
| 46 | + <el-table-column type="selection" width="50" align="center" /> | |
| 47 | + <el-table-column label="序号" type="index" width="60" align="center"> | |
| 48 | + <template #default="scope"> | |
| 49 | + {{ (queryParamsOfCarInfo.pageNum - 1) * queryParamsOfCarInfo.pageSize + scope.$index + 1 }} | |
| 50 | + </template> | |
| 51 | + </el-table-column> | |
| 52 | + <el-table-column label="车牌号" align="center" prop="plateNum" sortable /> | |
| 53 | + <el-table-column label="车位号" align="center" prop="parkingNo" sortable /> | |
| 54 | + <el-table-column label="车辆状态" align="center" prop="statusLabel" sortable /> | |
| 55 | + <el-table-column label="创建时间" align="center" prop="createTimeStr" sortable /> | |
| 56 | + <el-table-column label="修改时间" align="center" prop="updateTiimeStr" sortable /> | |
| 57 | + | |
| 58 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="160"> | |
| 59 | + <template #default="scope"> | |
| 60 | + <el-button type="success" plain icon="Edit" :disabled="singleCarInfo" @click="handleUpdateOfCarInfo(scope.row)" v-hasPermi="['car:info:update']">修改</el-button> | |
| 61 | + | |
| 62 | + </template> | |
| 63 | + </el-table-column> | |
| 64 | + </el-table> | |
| 65 | + | |
| 66 | + <pagination v-show="totalOfCarInfo > 0" :total="totalOfCarInfo" v-model:pageOfCarInfo="queryParamsOfCarInfo.pageNum" v-model:limit="queryParamsOfCarInfo.pageSize" | |
| 67 | + @pagination="getListOfCarInfo" /> | |
| 68 | + | |
| 69 | + <el-dialog :title="titleOfCarInfo" v-model="openOfCarInfo" width="500px" append-to-body> | |
| 70 | + <el-form :model="formOfCarInfo" ref="rulesOfCarInfo" label-width="80px" :rules="checkRulesOfCarInfo"> | |
| 71 | + <el-form-item label="车牌号" prop="plateNum"> | |
| 72 | + <el-input el-input="input" v-model="formOfCarInfo.plateNum" placeholder="请输入车牌号" /> | |
| 73 | + </el-form-item> | |
| 74 | + <el-form-item label="车位号" prop="parkingNo"> | |
| 75 | + <el-input el-input="input" v-model="formOfCarInfo.parkingNo" placeholder="请输入车位号" /> | |
| 76 | + </el-form-item> | |
| 77 | + <el-form-item label="车辆状态" prop="status"> | |
| 78 | + <el-select v-model="formOfCarInfo.status" style="width: 380px;"> | |
| 79 | + <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" /> | |
| 80 | + </el-select> | |
| 81 | + </el-form-item> | |
| 82 | + </el-form> | |
| 83 | + | |
| 84 | + <template #footer> | |
| 85 | + <div class="dialog-footer"> | |
| 86 | + <el-button type="primary" @click="submitFormOfCarInfo">确 定</el-button> | |
| 87 | + <el-button @click="cancelOfCarInfo">取 消</el-button> | |
| 88 | + </div> | |
| 89 | + </template> | |
| 90 | + </el-dialog> | |
| 91 | + </div> | |
| 92 | +</template> | |
| 93 | + | |
| 94 | + | |
| 95 | +<script setup name="CarInfo"> | |
| 96 | + import { listLimitOfCarInfo, viewOfCarInfo, addOfCarInfo, updateOfCarInfo,updateStatusOfCarInfo,deleteOfCarInfo,selectListOfStatus } from "@/api/carInfo/carInfo"; | |
| 97 | + const { proxy } = getCurrentInstance(); | |
| 98 | + | |
| 99 | + const listOfCarInfo = ref([]); | |
| 100 | + const openOfCarInfo = ref(false); | |
| 101 | + const titleOfCarInfo = ref(""); | |
| 102 | + const loadingOfCarInfo = ref(true); | |
| 103 | + const showSearchOfCarInfo = ref(true); | |
| 104 | + const idsOfCarInfo = ref([]); | |
| 105 | + const singleCarInfo = ref(true); | |
| 106 | + const multipleCarInfo = ref(true); | |
| 107 | + const statusList = ref([]); | |
| 108 | + | |
| 109 | + | |
| 110 | + const pageOfCarInfo = ref(1) //第几页 | |
| 111 | + const sizeOfCarInfo = ref(10) //一页多少条 | |
| 112 | + const totalOfCarInfo = ref(0); | |
| 113 | + const pageSizesOfCarInfo = [5, 10, 20, 50]; //每页显示多少条 | |
| 114 | + const currentPageOfCarInfo = ref(1) // 当前页 | |
| 115 | + const globalRowOfCarInfo = ref(null) // 当前行数据 | |
| 116 | + | |
| 117 | + const changeFlagOfCarInfo = ref(true) | |
| 118 | + | |
| 119 | + | |
| 120 | + const dataOfCarInfo = reactive({ | |
| 121 | + formOfCarInfo: {}, | |
| 122 | + queryParamsOfCarInfo: { | |
| 123 | + pageNum: 1, | |
| 124 | + pageSize: 10, | |
| 125 | + id : null, | |
| 126 | + plateNum : null, | |
| 127 | + parkingNo : null, | |
| 128 | + status : null, | |
| 129 | + createBy : null, | |
| 130 | + createTime : null, | |
| 131 | + updateBy : null, | |
| 132 | + updateTime : null, | |
| 133 | + | |
| 134 | + }, | |
| 135 | + checkRulesOfCarInfo: { | |
| 136 | + id : [ | |
| 137 | + { required: true, message: "ID", trigger: "blur" } | |
| 138 | + ], | |
| 139 | + plateNum : [ | |
| 140 | + { required: true, message: "车牌号", trigger: "blur" } | |
| 141 | + ], | |
| 142 | + parkingNo : [ | |
| 143 | + { required: true, message: "车位号", trigger: "blur" } | |
| 144 | + ], | |
| 145 | + status : [ | |
| 146 | + { required: true, message: "车辆状态", trigger: "blur" } | |
| 147 | + ], | |
| 148 | + } | |
| 149 | + }); | |
| 150 | + | |
| 151 | + const { queryParamsOfCarInfo, formOfCarInfo, checkRulesOfCarInfo } = toRefs(dataOfCarInfo ); | |
| 152 | + | |
| 153 | + /** 查询设备信息列表 */ | |
| 154 | + function getListOfCarInfo() { | |
| 155 | + loadingOfCarInfo.value = true; | |
| 156 | + listLimitOfCarInfo(queryParamsOfCarInfo.value,queryParamsOfCarInfo.value.pageNum,queryParamsOfCarInfo.value.pageSize).then(response => { | |
| 157 | + listOfCarInfo.value = response.records; | |
| 158 | + totalOfCarInfo.value = response.total; | |
| 159 | + loadingOfCarInfo.value = false; | |
| 160 | + }); | |
| 161 | + } | |
| 162 | + | |
| 163 | + /**排序*/ | |
| 164 | + function sortChangeOfCarInfo(data){ | |
| 165 | + queryParamsOfCarInfo.value.order=data.order; | |
| 166 | + queryParamsOfCarInfo.value.prop=data.prop; | |
| 167 | + getListOfCarInfo(); | |
| 168 | + } | |
| 169 | + | |
| 170 | + | |
| 171 | + function getStatusList(){ | |
| 172 | + selectListOfStatus().then(response => { | |
| 173 | + statusList.value = response.data; | |
| 174 | + }); | |
| 175 | + } | |
| 176 | + | |
| 177 | + // 取消按钮 | |
| 178 | + function cancelOfCarInfo() { | |
| 179 | + openOfCarInfo.value = false; | |
| 180 | + globalRowOfCarInfo.value = null | |
| 181 | + resetOfCarInfo(); | |
| 182 | + } | |
| 183 | + | |
| 184 | + const handleSizeChange = (val) => { | |
| 185 | + sizeOfCarInfo.value = val; | |
| 186 | + } | |
| 187 | + const handleCurrentChange = (val) => { | |
| 188 | + pageOfCarInfo.value = val; | |
| 189 | + } | |
| 190 | + | |
| 191 | + | |
| 192 | + // 表单重置 | |
| 193 | + function resetOfCarInfo() { | |
| 194 | + formOfCarInfo.value = { | |
| 195 | + id : null, | |
| 196 | + plateNum : null, | |
| 197 | + parkingNo : null, | |
| 198 | + status : null, | |
| 199 | + createBy : null, | |
| 200 | + createTime : null, | |
| 201 | + updateBy : null, | |
| 202 | + updateTime : null, | |
| 203 | + }; | |
| 204 | + proxy.resetForm("rulesOfCarInfo"); | |
| 205 | + } | |
| 206 | + | |
| 207 | + /** 搜索按钮操作 */ | |
| 208 | + function handleQueryOfCarInfo() { | |
| 209 | + queryParamsOfCarInfo.value.pageNum = 1; | |
| 210 | + getListOfCarInfo(); | |
| 211 | + } | |
| 212 | + | |
| 213 | + /** 重置按钮操作 */ | |
| 214 | + function resetQueryOfCarInfo() { | |
| 215 | + proxy.resetForm("queryOfCarInfo"); | |
| 216 | + handleQueryOfCarInfo(); | |
| 217 | + } | |
| 218 | + | |
| 219 | + // 多选框选中数据 | |
| 220 | + function handleSelectionChangeOfCarInfo(selection) { | |
| 221 | + idsOfCarInfo.value = selection.map(item => item.id); | |
| 222 | + singleCarInfo.value = selection.length != 1; | |
| 223 | + multipleCarInfo.value = !selection.length; | |
| 224 | + } | |
| 225 | + | |
| 226 | + /** 新增按钮操作 */ | |
| 227 | + function handleAddOfCarInfo() { | |
| 228 | + resetOfCarInfo(); | |
| 229 | + changeFlagOfCarInfo.value = true; | |
| 230 | + openOfCarInfo.value = true; | |
| 231 | + titleOfCarInfo.value = "添加"; | |
| 232 | + } | |
| 233 | + | |
| 234 | + /** 修改按钮操作 */ | |
| 235 | + function handleUpdateOfCarInfo(row) { | |
| 236 | + resetOfCarInfo(); | |
| 237 | + const _id = row.id || idsOfCarInfo.value | |
| 238 | + viewOfCarInfo(_id).then(response => { | |
| 239 | + formOfCarInfo.value = response.data; | |
| 240 | + openOfCarInfo.value = true; | |
| 241 | + titleOfCarInfo.value = "修改"; | |
| 242 | + }); | |
| 243 | + } | |
| 244 | + | |
| 245 | + /** 提交按钮 */ | |
| 246 | + function submitFormOfCarInfo() { | |
| 247 | + proxy.$refs["rulesOfCarInfo"].validate(valid => { | |
| 248 | + if (valid) { | |
| 249 | + if (formOfCarInfo.value.id != null) { | |
| 250 | + updateOfCarInfo(formOfCarInfo.value).then(response => { | |
| 251 | + proxy.$modal.msgSuccess("修改成功"); | |
| 252 | + openOfCarInfo.value = false; | |
| 253 | + getListOfCarInfo(); | |
| 254 | + }); | |
| 255 | + } else { | |
| 256 | + addOfCarInfo(formOfCarInfo.value).then(response => { | |
| 257 | + proxy.$modal.msgSuccess("新增成功"); | |
| 258 | + openOfCarInfo.value = false; | |
| 259 | + getListOfCarInfo(); | |
| 260 | + }); | |
| 261 | + } | |
| 262 | + } | |
| 263 | + }); | |
| 264 | + } | |
| 265 | + | |
| 266 | + /** 删除按钮操作 */ | |
| 267 | + function handleDeleteOfCarInfo(row) { | |
| 268 | + const _idsOfCarInfo = row.id || idsOfCarInfo.value; | |
| 269 | + proxy.$modal.confirm('是否确认删除 为"' + _idsOfCarInfo + '"的数据项?').then(function () { | |
| 270 | + return deleteOfCarInfo(_idsOfCarInfo); | |
| 271 | + }).then(() => { | |
| 272 | + getListOfCarInfo(); | |
| 273 | + proxy.$modal.msgSuccess("删除成功"); | |
| 274 | + }).catch(() => { }); | |
| 275 | + } | |
| 276 | + | |
| 277 | + /** 导出按钮操作 */ | |
| 278 | + function handleExportOfCarInfo() { | |
| 279 | + proxy.download('car/info/export', { | |
| 280 | + ...queryParamsOfCarInfo.value | |
| 281 | + }, `CarInfo_${new Date().getTime()}.xlsx`) | |
| 282 | + } | |
| 283 | + | |
| 284 | + | |
| 285 | + getListOfCarInfo(); | |
| 286 | + getStatusList(); | |
| 287 | +</script> | |
| 0 | 288 | \ No newline at end of file | ... | ... |
src/views/equipment/equipment/index.vue
| ... | ... | @@ -113,9 +113,12 @@ |
| 113 | 113 | <el-form-item label="设备图片" prop="image"> |
| 114 | 114 | <image-upload v-model="form.image" /> |
| 115 | 115 | </el-form-item> |
| 116 | - <el-form-item v-if="changeFlag" label="设备号" prop="deviceId"> | |
| 116 | + <el-form-item label="设备号" prop="deviceId"> | |
| 117 | 117 | <el-input v-model="form.deviceId" placeholder="请输入设备号" /> |
| 118 | 118 | </el-form-item> |
| 119 | + <el-form-item label="格子数" prop="latticeNumber"> | |
| 120 | + <el-input v-model="form.latticeNumber" placeholder="请输入子数" /> | |
| 121 | + </el-form-item> | |
| 119 | 122 | </el-form> |
| 120 | 123 | <template #footer> |
| 121 | 124 | <div class="dialog-footer"> | ... | ... |
src/views/equipment/equipment_keyinfo/keyInfo.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <div class="query-from"> | |
| 4 | + <el-form :inline="true" :queryOfKeyInfo="queryOfKeyInfo" :model="queryParamsOfKeyInfo" class="demo-form-inline"> | |
| 5 | + <el-form-item label="名称" props="name"> | |
| 6 | + <el-input style="width: 120px;" v-model="queryParamsOfKeyInfo.name" placeholder="请输入名称(如:XX车的钥匙)" clearable | |
| 7 | + @keyup.enter="handleQueryOfKeyInfo" /> | |
| 8 | + </el-form-item> | |
| 9 | + <el-form-item label="车牌号" props="plateNum"> | |
| 10 | + <el-select v-model="queryParamsOfKeyInfo.plateNum" value-on-clear> | |
| 11 | + <el-option v-for="item in carNos" :key="item.plateNum" :label="item.plateNum" :value="item.plateNum" /> | |
| 12 | + </el-select> | |
| 13 | + </el-form-item> | |
| 14 | + | |
| 15 | + <el-form-item label="所在设备" prop="deviceId"> | |
| 16 | + <el-select v-model="queryParamsOfKeyInfo.deviceId" value-on-clear> | |
| 17 | + <el-option v-for="item in deviceIds" :key="item.id" :label="item.siteName" :value="item.id" /> | |
| 18 | + </el-select> | |
| 19 | + </el-form-item> | |
| 20 | + | |
| 21 | + <el-form-item> | |
| 22 | + <el-button type="primary" icon="Search" @click="handleQueryOfKeyInfo">搜索</el-button> | |
| 23 | + <el-button icon="Refresh" @click="resetQueryOfKeyInfo">重置</el-button> | |
| 24 | + </el-form-item> | |
| 25 | + </el-form> | |
| 26 | + | |
| 27 | + <el-row :gutter="10" class="mb8"> | |
| 28 | + <el-col :span="1.5"> | |
| 29 | + <el-button type="primary" plain icon="Plus" @click="handleAddOfKeyInfo" v-hasPermi="['key:info:add']">新增</el-button> | |
| 30 | + | |
| 31 | + </el-col> | |
| 32 | + <el-col :span="1.5"> | |
| 33 | + <el-button type="success" plain icon="Edit" :disabled="singleKeyInfo" @click="handleUpdateOfKeyInfo" v-hasPermi="['key:info:update']">修改</el-button> | |
| 34 | + | |
| 35 | + </el-col> | |
| 36 | + <el-col :span="1.5"> | |
| 37 | + <el-button type="danger" plain icon="Delete" :disabled=multipleKeyInfo @click="handleDeleteOfKeyInfo" v-hasPermi="['key:info:del']">删除</el-button> | |
| 38 | + | |
| 39 | + </el-col> | |
| 40 | + <el-col :span="1.5"> | |
| 41 | + <el-button type="warning" plain icon="Download" @click="handleExportOfKeyInfo" v-hasPermi="['key:info:export']">导出</el-button> | |
| 42 | + | |
| 43 | + </el-col> | |
| 44 | + <right-toolbar v-model:showSearch="showSearchOfKeyInfo" @queryTable="getListOfKeyInfo"></right-toolbar> | |
| 45 | + </el-row> | |
| 46 | + </div> | |
| 47 | + | |
| 48 | + <el-table v-loading="loadingOfKeyInfo" :data="listOfKeyInfo" @selection-change="handleSelectionChangeOfKeyInfo" border max-height="600" | |
| 49 | + :default-expand-all="false" :row-class-name="tableRowClassName" @sort-change="sortChangeFunction"> | |
| 50 | + <el-table-column type="selection" width="50" align="center" /> | |
| 51 | + <el-table-column label="序号" type="index" width="60" align="center"> | |
| 52 | + <template #default="scope"> | |
| 53 | + {{ (queryParamsOfKeyInfo.pageNum - 1) * queryParamsOfKeyInfo.pageSize + scope.$index + 1 }} | |
| 54 | + </template> | |
| 55 | + </el-table-column> | |
| 56 | + <el-table-column label="名称" align="center" prop="name" sortable /> | |
| 57 | + <el-table-column label="状态" align="center" prop="status" sortable /> | |
| 58 | + <el-table-column label="车牌号" align="center" prop="plateNum" sortable /> | |
| 59 | + <el-table-column label="所在设备" align="center" prop="deviceLabel" sortable /> | |
| 60 | + | |
| 61 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="160"> | |
| 62 | + <template #default="scope"> | |
| 63 | + <el-button type="success" plain icon="Edit" :disabled="singleKeyInfo" @click="handleUpdateOfKeyInfo(scope.row)" v-hasPermi="['key:info:update']">修改</el-button> | |
| 64 | + | |
| 65 | + </template> | |
| 66 | + </el-table-column> | |
| 67 | + </el-table> | |
| 68 | + | |
| 69 | + <pagination v-show="totalOfKeyInfo > 0" :total="totalOfKeyInfo" v-model:pageOfKeyInfo="queryParamsOfKeyInfo.pageNum" v-model:limit="queryParamsOfKeyInfo.pageSize" | |
| 70 | + @pagination="getListOfKeyInfo" /> | |
| 71 | + | |
| 72 | + <el-dialog :title="titleOfKeyInfo" v-model="openOfKeyInfo" width="500px" append-to-body> | |
| 73 | + <el-form :model="formOfKeyInfo" ref="rulesOfKeyInfo" label-width="80px" :rules="checkRulesOfKeyInfo"> | |
| 74 | + | |
| 75 | + <el-form-item label="名称" prop="name"> | |
| 76 | + <el-input el-input="input" v-model="formOfKeyInfo.name" placeholder="请输入名称(如:XX车的钥匙)" /> | |
| 77 | + </el-form-item> | |
| 78 | + <el-form-item label="车牌号" props="plateNum"> | |
| 79 | + <el-select v-model="formOfKeyInfo.plateNum" > | |
| 80 | + <el-option v-for="item in carNos" :key="item.plateNum" :label="item.plateNum" :value="item.plateNum" /> | |
| 81 | + </el-select> | |
| 82 | + </el-form-item> | |
| 83 | + <el-form-item label="所在设备" prop="deviceId">{{formOfKeyInfo.deviceId}} | |
| 84 | + <el-select v-model="formOfKeyInfo.deviceId" > | |
| 85 | + <el-option v-for="item in deviceIds" :key="item.id" :label="item.siteName" :value="item.id" /> | |
| 86 | + </el-select> | |
| 87 | + </el-form-item> | |
| 88 | + | |
| 89 | + | |
| 90 | + </el-form> | |
| 91 | + | |
| 92 | + <template #footer> | |
| 93 | + <div class="dialog-footer"> | |
| 94 | + <el-button type="primary" @click="submitFormOfKeyInfo">确 定</el-button> | |
| 95 | + <el-button @click="cancelOfKeyInfo">取 消</el-button> | |
| 96 | + </div> | |
| 97 | + </template> | |
| 98 | + </el-dialog> | |
| 99 | + </div> | |
| 100 | +</template> | |
| 101 | + | |
| 102 | + | |
| 103 | +<script setup name="KeyInfo"> | |
| 104 | + import { listLimitOfKeyInfo, viewOfKeyInfo, addOfKeyInfo, updateOfKeyInfo,updateStatusOfKeyInfo,deleteOfKeyInfo } from "@/api/keyInfo/keyInfo"; | |
| 105 | + import { selectListOfCarInfo } from "@/api/carInfo/carInfo"; | |
| 106 | + import { selectList } from "@/api/equipment/equipment"; | |
| 107 | + | |
| 108 | + const { proxy } = getCurrentInstance(); | |
| 109 | + | |
| 110 | + const listOfKeyInfo = ref([]); | |
| 111 | + const openOfKeyInfo = ref(false); | |
| 112 | + const titleOfKeyInfo = ref(""); | |
| 113 | + const loadingOfKeyInfo = ref(true); | |
| 114 | + const showSearchOfKeyInfo = ref(true); | |
| 115 | + const idsOfKeyInfo = ref([]); | |
| 116 | + const singleKeyInfo = ref(true); | |
| 117 | + const multipleKeyInfo = ref(true); | |
| 118 | + const deviceIds=ref([]); | |
| 119 | + const carNos=ref([]); | |
| 120 | + | |
| 121 | + | |
| 122 | + const pageOfKeyInfo = ref(1) //第几页 | |
| 123 | + const sizeOfKeyInfo = ref(10) //一页多少条 | |
| 124 | + const totalOfKeyInfo = ref(0); | |
| 125 | + const pageSizesOfKeyInfo = [5, 10, 20, 50]; //每页显示多少条 | |
| 126 | + const currentPageOfKeyInfo = ref(1) // 当前页 | |
| 127 | + const globalRowOfKeyInfo = ref(null) // 当前行数据 | |
| 128 | + | |
| 129 | + const changeFlagOfKeyInfo = ref(true) | |
| 130 | + | |
| 131 | + const dataOfKeyInfo = reactive({ | |
| 132 | + formOfKeyInfo: {}, | |
| 133 | + queryParamsOfKeyInfo: { | |
| 134 | + pageNum: 1, | |
| 135 | + pageSize: 10, | |
| 136 | + id : null, | |
| 137 | + name : null, | |
| 138 | + status : null, | |
| 139 | + delFlag : null, | |
| 140 | + createBy : null, | |
| 141 | + createTime : null, | |
| 142 | + updateby : null, | |
| 143 | + updateTime : null, | |
| 144 | + yardId : null, | |
| 145 | + deviceId : null, | |
| 146 | + cabinetno : null, | |
| 147 | + | |
| 148 | + }, | |
| 149 | + checkRulesOfKeyInfo: { | |
| 150 | + id : [ | |
| 151 | + { required: true, message: "ID", trigger: "blur" } | |
| 152 | + ], | |
| 153 | + name : [ | |
| 154 | + { required: true, message: "名称(如:XX车的钥匙)", trigger: "blur" } | |
| 155 | + ], | |
| 156 | + status : [ | |
| 157 | + { required: true, message: "状态", trigger: "blur" } | |
| 158 | + ], | |
| 159 | + delFlag : [ | |
| 160 | + { required: true, message: "是否删除", trigger: "blur" } | |
| 161 | + ], | |
| 162 | + createBy : [ | |
| 163 | + { required: true, message: "创建人员", trigger: "blur" } | |
| 164 | + ], | |
| 165 | + createTime : [ | |
| 166 | + { required: true, message: "创建时间", trigger: "blur" } | |
| 167 | + ], | |
| 168 | + updateby : [ | |
| 169 | + { required: true, message: "修改人员", trigger: "blur" } | |
| 170 | + ], | |
| 171 | + updateTime : [ | |
| 172 | + { required: true, message: "修改时间", trigger: "blur" } | |
| 173 | + ], | |
| 174 | + yardId : [ | |
| 175 | + { required: true, message: "钥匙所在场站ID", trigger: "blur" } | |
| 176 | + ], | |
| 177 | + deviceId : [ | |
| 178 | + { required: true, message: "钥匙锁在的设备ID", trigger: "blur" } | |
| 179 | + ], | |
| 180 | + cabinetno : [ | |
| 181 | + { required: true, message: "钥匙所在的位置", trigger: "blur" } | |
| 182 | + ], | |
| 183 | + } | |
| 184 | + }); | |
| 185 | + | |
| 186 | + const { queryParamsOfKeyInfo, formOfKeyInfo, checkRulesOfKeyInfo } = toRefs(dataOfKeyInfo ); | |
| 187 | + | |
| 188 | + /** 查询设备信息列表 */ | |
| 189 | + function getListOfKeyInfo() { | |
| 190 | + loadingOfKeyInfo.value = true; | |
| 191 | + listLimitOfKeyInfo(queryParamsOfKeyInfo.value,queryParamsOfKeyInfo.value.pageNum,queryParamsOfKeyInfo.value.pageSize).then(response => { | |
| 192 | + listOfKeyInfo.value = response.records; | |
| 193 | + totalOfKeyInfo.value = response.total; | |
| 194 | + loadingOfKeyInfo.value = false; | |
| 195 | + }); | |
| 196 | + } | |
| 197 | + | |
| 198 | + function getSelectListOfCarInfo(){ | |
| 199 | + selectListOfCarInfo({"status":1}).then(response=>{ | |
| 200 | + carNos.value=response.data; | |
| 201 | + }); | |
| 202 | + } | |
| 203 | + | |
| 204 | + function sortChangeFunction(data){ | |
| 205 | + queryParamsOfKeyInfo.value.order=data.order; | |
| 206 | + queryParamsOfKeyInfo.value.prop=data.prop; | |
| 207 | + getListOfKeyInfo(); | |
| 208 | + } | |
| 209 | + | |
| 210 | + // 取消按钮 | |
| 211 | + function cancelOfKeyInfo() { | |
| 212 | + openOfKeyInfo.value = false; | |
| 213 | + globalRowOfKeyInfo.value = null | |
| 214 | + resetOfKeyInfo(); | |
| 215 | + } | |
| 216 | + | |
| 217 | + const handleSizeChange = (val) => { | |
| 218 | + sizeOfKeyInfo.value = val; | |
| 219 | + } | |
| 220 | + const handleCurrentChange = (val) => { | |
| 221 | + pageOfKeyInfo.value = val; | |
| 222 | + } | |
| 223 | + | |
| 224 | + | |
| 225 | + // 表单重置 | |
| 226 | + function resetOfKeyInfo() { | |
| 227 | + formOfKeyInfo.value = { | |
| 228 | + id : null, | |
| 229 | + name : null, | |
| 230 | + status : null, | |
| 231 | + delFlag : null, | |
| 232 | + createBy : null, | |
| 233 | + createTime : null, | |
| 234 | + updateby : null, | |
| 235 | + updateTime : null, | |
| 236 | + yardId : null, | |
| 237 | + deviceId : null, | |
| 238 | + cabinetno : null, | |
| 239 | + }; | |
| 240 | + proxy.resetForm("rulesOfKeyInfo"); | |
| 241 | + } | |
| 242 | + | |
| 243 | + /** 搜索按钮操作 */ | |
| 244 | + function handleQueryOfKeyInfo() { | |
| 245 | + queryParamsOfKeyInfo.value.pageNum = 1; | |
| 246 | + getListOfKeyInfo(); | |
| 247 | + } | |
| 248 | + | |
| 249 | + /** 重置按钮操作 */ | |
| 250 | + function resetQueryOfKeyInfo() { | |
| 251 | + proxy.resetForm("queryOfKeyInfo"); | |
| 252 | + handleQueryOfKeyInfo(); | |
| 253 | + } | |
| 254 | + | |
| 255 | + // 多选框选中数据 | |
| 256 | + function handleSelectionChangeOfKeyInfo(selection) { | |
| 257 | + idsOfKeyInfo.value = selection.map(item => item.id); | |
| 258 | + singleKeyInfo.value = selection.length != 1; | |
| 259 | + multipleKeyInfo.value = !selection.length; | |
| 260 | + } | |
| 261 | + | |
| 262 | + /** 新增按钮操作 */ | |
| 263 | + function handleAddOfKeyInfo() { | |
| 264 | + resetOfKeyInfo(); | |
| 265 | + changeFlagOfKeyInfo.value = true; | |
| 266 | + openOfKeyInfo.value = true; | |
| 267 | + titleOfKeyInfo.value = "添加"; | |
| 268 | + } | |
| 269 | + | |
| 270 | + /** 修改按钮操作 */ | |
| 271 | + function handleUpdateOfKeyInfo(row) { | |
| 272 | + resetOfKeyInfo(); | |
| 273 | + const _id = row.id || idsOfKeyInfo.value | |
| 274 | + viewOfKeyInfo(_id).then(response => { | |
| 275 | + formOfKeyInfo.value = response.data; | |
| 276 | + openOfKeyInfo.value = true; | |
| 277 | + titleOfKeyInfo.value = "修改"; | |
| 278 | + }); | |
| 279 | + } | |
| 280 | + | |
| 281 | + /** 提交按钮 */ | |
| 282 | + function submitFormOfKeyInfo() { | |
| 283 | + proxy.$refs["rulesOfKeyInfo"].validate(valid => { | |
| 284 | + if (valid) { | |
| 285 | + if (formOfKeyInfo.value.id != null) { | |
| 286 | + updateOfKeyInfo(formOfKeyInfo.value).then(response => { | |
| 287 | + proxy.$modal.msgSuccess("修改成功"); | |
| 288 | + openOfKeyInfo.value = false; | |
| 289 | + getListOfKeyInfo(); | |
| 290 | + }); | |
| 291 | + } else { | |
| 292 | + addOfKeyInfo(formOfKeyInfo.value).then(response => { | |
| 293 | + proxy.$modal.msgSuccess("新增成功"); | |
| 294 | + openOfKeyInfo.value = false; | |
| 295 | + getListOfKeyInfo(); | |
| 296 | + }); | |
| 297 | + } | |
| 298 | + } | |
| 299 | + }); | |
| 300 | + } | |
| 301 | + | |
| 302 | + /** 删除按钮操作 */ | |
| 303 | + function handleDeleteOfKeyInfo(row) { | |
| 304 | + const _idsOfKeyInfo = row.id || idsOfKeyInfo.value; | |
| 305 | + proxy.$modal.confirm('是否确认删除 为"' + _idsOfKeyInfo + '"的数据项?').then(function () { | |
| 306 | + return deleteOfKeyInfo(_idsOfKeyInfo); | |
| 307 | + }).then(() => { | |
| 308 | + getListOfKeyInfo(); | |
| 309 | + proxy.$modal.msgSuccess("删除成功"); | |
| 310 | + }).catch(() => { }); | |
| 311 | + } | |
| 312 | + | |
| 313 | + /** 导出按钮操作 */ | |
| 314 | + function handleExportOfKeyInfo() { | |
| 315 | + proxy.download('key/info/export', { | |
| 316 | + ...queryParamsOfKeyInfo.value | |
| 317 | + }, `KeyInfo_${new Date().getTime()}.xlsx`) | |
| 318 | + } | |
| 319 | + | |
| 320 | + function selectEquipment(){ | |
| 321 | + selectList({"promise":4}).then(res=>{ | |
| 322 | + | |
| 323 | + deviceIds.value=res.data; | |
| 324 | + }) | |
| 325 | + } | |
| 326 | + | |
| 327 | + getListOfKeyInfo(); | |
| 328 | + selectEquipment(); | |
| 329 | + getSelectListOfCarInfo(); | |
| 330 | +</script> | |
| 0 | 331 | \ No newline at end of file | ... | ... |