正在显示
16 个修改的文件
包含
967 行增加
和
326 行删除
src/api/configurationCenter/carBrand.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增车辆品牌 | ||
| 4 | +export function addCarBrand(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/vehicle/brand/add', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询车辆品牌列表 | ||
| 13 | +export function queryCarBrand(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/vehicle/brand/getList', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除号牌种类 | ||
| 22 | +export function delCarBrand(data) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/vehicle/brand/delete', | ||
| 25 | + method: 'post', | ||
| 26 | + data | ||
| 27 | + }) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +// 编辑号牌种类 | ||
| 31 | +export function updateCarBrand(data) { | ||
| 32 | + return request({ | ||
| 33 | + url: '/system/vehicle/brand/edit', | ||
| 34 | + method: 'post', | ||
| 35 | + data | ||
| 36 | + }) | ||
| 37 | +} |
src/api/configurationCenter/carModel.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增车辆品牌 | ||
| 4 | +export function addCarModel(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/vehicle/model/add', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询车辆品牌列表 | ||
| 13 | +export function queryCarModel(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/vehicle/model/getList', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除号牌种类 | ||
| 22 | +export function delCarModel(data) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/vehicle/model/delete', | ||
| 25 | + method: 'post', | ||
| 26 | + data | ||
| 27 | + }) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +// 编辑号牌种类 | ||
| 31 | +export function updateCarModel(data) { | ||
| 32 | + return request({ | ||
| 33 | + url: '/system/vehicle/model/edit', | ||
| 34 | + method: 'post', | ||
| 35 | + data | ||
| 36 | + }) | ||
| 37 | +} |
src/api/configurationCenter/carNature.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增车辆品牌 | ||
| 4 | +export function addCarNature(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/vehicle/nature/add', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询车辆品牌列表 | ||
| 13 | +export function queryCarNature(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/vehicle/nature/getList', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除号牌种类 | ||
| 22 | +export function delCarNature(data) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/vehicle/nature/delete', | ||
| 25 | + method: 'post', | ||
| 26 | + data | ||
| 27 | + }) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +// 编辑号牌种类 | ||
| 31 | +export function updateCarNature(data) { | ||
| 32 | + return request({ | ||
| 33 | + url: '/system/vehicle/nature/edit', | ||
| 34 | + method: 'post', | ||
| 35 | + data | ||
| 36 | + }) | ||
| 37 | +} |
src/api/configurationCenter/carNum.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增号牌种类 | ||
| 4 | +export function addCarNum(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/licenseplat/type/add', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询号牌种类 | ||
| 13 | +export function queryCarNum(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/licenseplat/type/getList', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除号牌种类 | ||
| 22 | +export function delCarNum(data) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/licenseplat/type/delete', | ||
| 25 | + method: 'post', | ||
| 26 | + data | ||
| 27 | + }) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +// 编辑号牌种类 | ||
| 31 | +export function updateCarNum(data) { | ||
| 32 | + return request({ | ||
| 33 | + url: '/system/licenseplat/type/edit', | ||
| 34 | + method: 'post', | ||
| 35 | + data | ||
| 36 | + }) | ||
| 37 | +} |
src/api/configurationCenter/carType.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增车辆品牌 | ||
| 4 | +export function addCarType(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/vehicle/type/add', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询车辆品牌列表 | ||
| 13 | +export function queryCarType(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/vehicle/type/getList', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除号牌种类 | ||
| 22 | +export function delCarType(data) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/vehicle/type/delete', | ||
| 25 | + method: 'post', | ||
| 26 | + data | ||
| 27 | + }) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +// 编辑号牌种类 | ||
| 31 | +export function updateCarType(data) { | ||
| 32 | + return request({ | ||
| 33 | + url: '/system/vehicle/type/edit', | ||
| 34 | + method: 'post', | ||
| 35 | + data | ||
| 36 | + }) | ||
| 37 | +} |
src/api/configurationCenter/need.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增保险需求 | ||
| 4 | +export function addNeed(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/requirements/add', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询保险需求 | ||
| 13 | +export function queryNeed(query) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/requirements/getList', | ||
| 16 | + method: 'get', | ||
| 17 | + params: query | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | +// 删除保险需求 | ||
| 21 | +export function delNeed(data) { | ||
| 22 | + return request({ | ||
| 23 | + url: '/system/requirements/delete', | ||
| 24 | + method: 'post', | ||
| 25 | + data | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 修改保险需求 | ||
| 30 | +export function updateNeed(data) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/system/requirements/edit', | ||
| 33 | + method: 'post', | ||
| 34 | + data | ||
| 35 | + }) | ||
| 36 | +} |
src/api/configurationCenter/rules.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 新增规则 | ||
| 4 | +export function addRules(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/rule/addRules', | ||
| 7 | + method: 'post', | ||
| 8 | + data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 查询规则列表 | ||
| 13 | +export function queryRules() { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/rule/lsit', | ||
| 16 | + method: 'get' | ||
| 17 | + }) | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +// 删除号牌种类 | ||
| 21 | +export function delRules(data) { | ||
| 22 | + return request({ | ||
| 23 | + url: '/system/rule/removeRules', | ||
| 24 | + method: 'post', | ||
| 25 | + data | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 编辑号牌种类 | ||
| 30 | +export function updateRules(data) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/system/rule/editRules', | ||
| 33 | + method: 'post', | ||
| 34 | + data | ||
| 35 | + }) | ||
| 36 | +} |
| @@ -60,7 +60,15 @@ export const constantRoutes = [ | @@ -60,7 +60,15 @@ export const constantRoutes = [ | ||
| 60 | { | 60 | { |
| 61 | path: '', | 61 | path: '', |
| 62 | component: Layout, | 62 | component: Layout, |
| 63 | - redirect: '/policy/pending' | 63 | + redirect: '/index', |
| 64 | + children: [ | ||
| 65 | + { | ||
| 66 | + path: '/index', | ||
| 67 | + component: () => import('@/views/index'), | ||
| 68 | + name: 'Index', | ||
| 69 | + meta: { title: '首页', icon: 'dashboard', affix: true } | ||
| 70 | + } | ||
| 71 | + ] | ||
| 64 | }, | 72 | }, |
| 65 | { | 73 | { |
| 66 | path: '/user', | 74 | path: '/user', |
| @@ -7,24 +7,15 @@ | @@ -7,24 +7,15 @@ | ||
| 7 | :inline="true" | 7 | :inline="true" |
| 8 | label-width="68px" | 8 | label-width="68px" |
| 9 | > | 9 | > |
| 10 | - <el-form-item label="车辆品牌" prop="brandName"> | 10 | + <el-form-item label="车辆品牌" prop="name"> |
| 11 | <el-input | 11 | <el-input |
| 12 | - v-model="queryParams.brandName" | 12 | + v-model="queryParams.name" |
| 13 | placeholder="填写车辆品牌" | 13 | placeholder="填写车辆品牌" |
| 14 | clearable | 14 | clearable |
| 15 | style="width: 220px" | 15 | style="width: 220px" |
| 16 | @keyup.enter="handleQuery" | 16 | @keyup.enter="handleQuery" |
| 17 | /> | 17 | /> |
| 18 | </el-form-item> | 18 | </el-form-item> |
| 19 | - <el-form-item label="车辆型号" prop="modelName"> | ||
| 20 | - <el-input | ||
| 21 | - v-model="queryParams.modelName" | ||
| 22 | - placeholder="填写车辆型号" | ||
| 23 | - clearable | ||
| 24 | - style="width: 220px" | ||
| 25 | - @keyup.enter="handleQuery" | ||
| 26 | - /> | ||
| 27 | - </el-form-item> | ||
| 28 | <el-form-item> | 19 | <el-form-item> |
| 29 | <el-button type="primary" icon="Search" @click="handleQuery" | 20 | <el-button type="primary" icon="Search" @click="handleQuery" |
| 30 | >查询</el-button | 21 | >查询</el-button |
| @@ -80,15 +71,17 @@ | @@ -80,15 +71,17 @@ | ||
| 80 | width="120" | 71 | width="120" |
| 81 | align="center" | 72 | align="center" |
| 82 | /> | 73 | /> |
| 83 | - <el-table-column label="车辆品牌" prop="brandName" align="center" /> | ||
| 84 | - <el-table-column label="车辆型号" prop="modelName" align="center" /> | ||
| 85 | - <el-table-column label="操作时间" prop="authTime" align="center" /> | ||
| 86 | - <el-table-column | ||
| 87 | - label="操作人" | ||
| 88 | - prop="editAuth" | ||
| 89 | - width="100" | ||
| 90 | - align="center" | ||
| 91 | - /> | 74 | + <el-table-column label="车辆品牌" prop="name" align="center" /> |
| 75 | + <el-table-column label="操作时间" align="center"> | ||
| 76 | + <template #default="{ row }"> | ||
| 77 | + <span>{{ row.updateTime || row.createTime }}</span> | ||
| 78 | + </template> | ||
| 79 | + </el-table-column> | ||
| 80 | + <el-table-column label="操作人" align="center"> | ||
| 81 | + <template #default="{ row }"> | ||
| 82 | + <span>{{ row.updateBy || row.createBy }}</span> | ||
| 83 | + </template> | ||
| 84 | + </el-table-column> | ||
| 92 | <el-table-column | 85 | <el-table-column |
| 93 | label="操作" | 86 | label="操作" |
| 94 | fixed="right" | 87 | fixed="right" |
| @@ -112,11 +105,8 @@ | @@ -112,11 +105,8 @@ | ||
| 112 | <!-- 添加或修改车辆性质配置对话框 --> | 105 | <!-- 添加或修改车辆性质配置对话框 --> |
| 113 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> | 106 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| 114 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> | 107 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> |
| 115 | - <el-form-item label="车辆品牌" prop="brandName"> | ||
| 116 | - <el-input v-model="form.brandName" placeholder="请输入车辆性质名称" /> | ||
| 117 | - </el-form-item> | ||
| 118 | - <el-form-item label="车辆型号" prop="modelName"> | ||
| 119 | - <el-input v-model="form.modelName" placeholder="请输入车辆性质名称" /> | 108 | + <el-form-item label="车辆品牌" prop="name"> |
| 109 | + <el-input v-model="form.name" placeholder="请输入车辆性质名称" /> | ||
| 120 | </el-form-item> | 110 | </el-form-item> |
| 121 | </el-form> | 111 | </el-form> |
| 122 | <template #footer> | 112 | <template #footer> |
| @@ -177,6 +167,12 @@ | @@ -177,6 +167,12 @@ | ||
| 177 | </template> | 167 | </template> |
| 178 | 168 | ||
| 179 | <script setup> | 169 | <script setup> |
| 170 | +import { | ||
| 171 | + addCarBrand, | ||
| 172 | + updateCarBrand, | ||
| 173 | + queryCarBrand, | ||
| 174 | + delCarBrand, | ||
| 175 | +} from "@/api/configurationCenter/carBrand.js"; | ||
| 180 | import { getToken } from "@/utils/auth"; | 176 | import { getToken } from "@/utils/auth"; |
| 181 | const { proxy } = getCurrentInstance(); | 177 | const { proxy } = getCurrentInstance(); |
| 182 | /*** 型号导入参数 */ | 178 | /*** 型号导入参数 */ |
| @@ -194,29 +190,7 @@ const upload = reactive({ | @@ -194,29 +190,7 @@ const upload = reactive({ | ||
| 194 | // 上传的地址 | 190 | // 上传的地址 |
| 195 | url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData", | 191 | url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData", |
| 196 | }); | 192 | }); |
| 197 | -const dataList = ref([ | ||
| 198 | - { | ||
| 199 | - policyId: "1", | ||
| 200 | - brandName: "阿尔法-罗密欧", | ||
| 201 | - modelName: "156 4C Giulietta Mito", | ||
| 202 | - authTime: "2024-09-24 11:53:43", | ||
| 203 | - editAuth: "admin", | ||
| 204 | - }, | ||
| 205 | - { | ||
| 206 | - policyId: "2", | ||
| 207 | - brandName: "梅赛德斯-AMG", | ||
| 208 | - modelName: "C63AMG CLSAMG G63AMG S65AMG SL63AMG", | ||
| 209 | - authTime: "2024-09-24 11:53:43", | ||
| 210 | - editAuth: "admin", | ||
| 211 | - }, | ||
| 212 | - { | ||
| 213 | - policyId: "3", | ||
| 214 | - brandName: "阿斯顿-马丁", | ||
| 215 | - modelName: "DB9Cygnet DBS V12 Vantage V12 Zagato 一汽奥迪", | ||
| 216 | - authTime: "2024-09-24 11:53:43", | ||
| 217 | - editAuth: "admin", | ||
| 218 | - }, | ||
| 219 | -]); | 193 | +const dataList = ref([]); |
| 220 | const open = ref(false); | 194 | const open = ref(false); |
| 221 | const multiple = ref(true); | 195 | const multiple = ref(true); |
| 222 | const loading = ref(false); | 196 | const loading = ref(false); |
| @@ -232,10 +206,18 @@ const rules = ref({ | @@ -232,10 +206,18 @@ const rules = ref({ | ||
| 232 | const queryParams = reactive({ | 206 | const queryParams = reactive({ |
| 233 | pageNum: 1, | 207 | pageNum: 1, |
| 234 | pageSize: 10, | 208 | pageSize: 10, |
| 235 | - brandName: undefined, | ||
| 236 | - modelName: undefined, | 209 | + name: undefined, |
| 210 | +}); | ||
| 211 | +onMounted(() => { | ||
| 212 | + getList(); | ||
| 237 | }); | 213 | }); |
| 238 | 214 | ||
| 215 | +// 获取号牌列表 | ||
| 216 | +const getList = async () => { | ||
| 217 | + const { data } = await queryCarBrand(queryParams); | ||
| 218 | + dataList.value = data.records; | ||
| 219 | + total.value = data.total; | ||
| 220 | +}; | ||
| 239 | /**文件上传中处理 */ | 221 | /**文件上传中处理 */ |
| 240 | const handleFileUploadProgress = (event, file, fileList) => { | 222 | const handleFileUploadProgress = (event, file, fileList) => { |
| 241 | upload.isUploading = true; | 223 | upload.isUploading = true; |
| @@ -283,12 +265,11 @@ function handleUpdate(row) { | @@ -283,12 +265,11 @@ function handleUpdate(row) { | ||
| 283 | 265 | ||
| 284 | /** 删除按钮操作 */ | 266 | /** 删除按钮操作 */ |
| 285 | function handleDelete(row) { | 267 | function handleDelete(row) { |
| 286 | - const natureIds = row.natureId || ids.value; | ||
| 287 | - proxy.$modal | ||
| 288 | - .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') | ||
| 289 | - .then(function () { | ||
| 290 | - // return delRole(natureIds); | 268 | + const Ids = row.id ? [row.id] : ids.value; |
| 269 | + proxy.$modal.confirm("是否确认删除该数据项?").then(async () => { | ||
| 270 | + await delCarBrand(Ids); | ||
| 291 | proxy.$modal.msgSuccess("删除成功"); | 271 | proxy.$modal.msgSuccess("删除成功"); |
| 272 | + getList(); | ||
| 292 | }); | 273 | }); |
| 293 | } | 274 | } |
| 294 | /** 提交上传文件 */ | 275 | /** 提交上传文件 */ |
| @@ -298,36 +279,44 @@ function submitFileForm() { | @@ -298,36 +279,44 @@ function submitFileForm() { | ||
| 298 | /** 重置新增的表单以及其他数据 */ | 279 | /** 重置新增的表单以及其他数据 */ |
| 299 | function reset() { | 280 | function reset() { |
| 300 | form.value = { | 281 | form.value = { |
| 301 | - natureId: undefined, | ||
| 302 | - typeName: undefined, | ||
| 303 | - authTime: undefined, | ||
| 304 | - editAuth: undefined, | 282 | + id: undefined, |
| 283 | + name: undefined, | ||
| 305 | }; | 284 | }; |
| 306 | proxy.resetForm("natureRef"); | 285 | proxy.resetForm("natureRef"); |
| 307 | } | 286 | } |
| 308 | 287 | ||
| 309 | /** 多选框选中数据 */ | 288 | /** 多选框选中数据 */ |
| 310 | function handleSelectionChange(selection) { | 289 | function handleSelectionChange(selection) { |
| 311 | - ids.value = selection.map((item) => item.roleId); | 290 | + ids.value = selection.map((item) => item.id); |
| 312 | multiple.value = !selection.length; | 291 | multiple.value = !selection.length; |
| 313 | } | 292 | } |
| 314 | 293 | ||
| 315 | /** 搜索按钮操作 */ | 294 | /** 搜索按钮操作 */ |
| 316 | -function handleQuery() {} | 295 | +function handleQuery() { |
| 296 | + queryParams.pageNum = 1; | ||
| 297 | + getList(); | ||
| 298 | +} | ||
| 317 | 299 | ||
| 318 | /** 重置按钮操作 */ | 300 | /** 重置按钮操作 */ |
| 319 | function resetQuery() { | 301 | function resetQuery() { |
| 320 | proxy.resetForm("queryRef"); | 302 | proxy.resetForm("queryRef"); |
| 303 | + getList(); | ||
| 321 | } | 304 | } |
| 322 | 305 | ||
| 323 | /** 提交按钮 */ | 306 | /** 提交按钮 */ |
| 324 | function submitForm() { | 307 | function submitForm() { |
| 325 | - proxy.$refs["natureRef"].validate((valid) => { | 308 | + proxy.$refs["natureRef"].validate(async (valid) => { |
| 326 | if (valid) { | 309 | if (valid) { |
| 327 | - if (form.value.natureId != undefined) { | 310 | + if (form.value.id != undefined) { |
| 311 | + await updateCarBrand(form.value); | ||
| 328 | proxy.$modal.msgSuccess("修改成功"); | 312 | proxy.$modal.msgSuccess("修改成功"); |
| 313 | + getList(); | ||
| 314 | + open.value = false; | ||
| 329 | } else { | 315 | } else { |
| 316 | + await addCarBrand(form.value); | ||
| 317 | + getList(); | ||
| 330 | proxy.$modal.msgSuccess("新增成功"); | 318 | proxy.$modal.msgSuccess("新增成功"); |
| 319 | + open.value = false; | ||
| 331 | } | 320 | } |
| 332 | } | 321 | } |
| 333 | }); | 322 | }); |
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + <!-- 筛选条件 --> | ||
| 4 | + <el-form | ||
| 5 | + :model="queryParams" | ||
| 6 | + ref="queryRef" | ||
| 7 | + :inline="true" | ||
| 8 | + label-width="68px" | ||
| 9 | + > | ||
| 10 | + <el-form-item label="车辆品牌" prop="brandName"> | ||
| 11 | + <el-input | ||
| 12 | + v-model="queryParams.brandName" | ||
| 13 | + placeholder="填写车辆品牌" | ||
| 14 | + clearable | ||
| 15 | + style="width: 220px" | ||
| 16 | + @keyup.enter="handleQuery" | ||
| 17 | + /> | ||
| 18 | + </el-form-item> | ||
| 19 | + <el-form-item label="车辆型号" prop="modelName"> | ||
| 20 | + <el-input | ||
| 21 | + v-model="queryParams.modelName" | ||
| 22 | + placeholder="填写车辆型号" | ||
| 23 | + clearable | ||
| 24 | + style="width: 220px" | ||
| 25 | + @keyup.enter="handleQuery" | ||
| 26 | + /> | ||
| 27 | + </el-form-item> | ||
| 28 | + <el-form-item> | ||
| 29 | + <el-button type="primary" icon="Search" @click="handleQuery" | ||
| 30 | + >查询</el-button | ||
| 31 | + > | ||
| 32 | + <el-button icon="Refresh" @click="resetQuery">重置</el-button> | ||
| 33 | + </el-form-item> | ||
| 34 | + </el-form> | ||
| 35 | + <el-row :gutter="10" class="mb8"> | ||
| 36 | + <el-col :span="1.5"> | ||
| 37 | + <el-button | ||
| 38 | + type="primary" | ||
| 39 | + plain | ||
| 40 | + icon="Plus" | ||
| 41 | + v-hasPermi="['system:role:add']" | ||
| 42 | + @click="handleAdd" | ||
| 43 | + >新增</el-button | ||
| 44 | + > | ||
| 45 | + </el-col> | ||
| 46 | + <el-col :span="1.5"> | ||
| 47 | + <el-button | ||
| 48 | + type="danger" | ||
| 49 | + plain | ||
| 50 | + icon="Delete" | ||
| 51 | + :disabled="multiple" | ||
| 52 | + v-hasPermi="['system:role:remove']" | ||
| 53 | + @click="handleDelete" | ||
| 54 | + >删除</el-button | ||
| 55 | + > | ||
| 56 | + </el-col> | ||
| 57 | + <el-col :span="1.5"> | ||
| 58 | + <el-button | ||
| 59 | + type="info" | ||
| 60 | + plain | ||
| 61 | + icon="Upload" | ||
| 62 | + @click="handleImport" | ||
| 63 | + v-hasPermi="['system:user:import']" | ||
| 64 | + >导入</el-button | ||
| 65 | + > | ||
| 66 | + </el-col> | ||
| 67 | + <!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> --> | ||
| 68 | + </el-row> | ||
| 69 | + | ||
| 70 | + <!-- 表格数据 --> | ||
| 71 | + <el-table | ||
| 72 | + v-loading="loading" | ||
| 73 | + :data="dataList" | ||
| 74 | + @selection-change="handleSelectionChange" | ||
| 75 | + > | ||
| 76 | + <el-table-column type="selection" width="55" align="center" /> | ||
| 77 | + <el-table-column | ||
| 78 | + label="序号" | ||
| 79 | + prop="policyId" | ||
| 80 | + width="120" | ||
| 81 | + align="center" | ||
| 82 | + /> | ||
| 83 | + <el-table-column label="车辆品牌" prop="brandName" align="center" /> | ||
| 84 | + <el-table-column label="车辆型号" prop="name" align="center" /> | ||
| 85 | + <el-table-column label="操作时间" align="center"> | ||
| 86 | + <template #default="{ row }"> | ||
| 87 | + <span>{{ row.updateTime || row.createTime }}</span> | ||
| 88 | + </template> | ||
| 89 | + </el-table-column> | ||
| 90 | + <el-table-column label="操作人" align="center"> | ||
| 91 | + <template #default="{ row }"> | ||
| 92 | + <span>{{ row.updateBy || row.createBy }}</span> | ||
| 93 | + </template> | ||
| 94 | + </el-table-column> | ||
| 95 | + <el-table-column | ||
| 96 | + label="操作" | ||
| 97 | + fixed="right" | ||
| 98 | + align="center" | ||
| 99 | + prop="Feedback" | ||
| 100 | + > | ||
| 101 | + <template #default="{ row }"> | ||
| 102 | + <el-button type="primary" @click="handleUpdate(row)">编辑</el-button> | ||
| 103 | + <el-button type="danger" @click="handleDelete(row)">删除</el-button> | ||
| 104 | + </template> | ||
| 105 | + </el-table-column> | ||
| 106 | + </el-table> | ||
| 107 | + | ||
| 108 | + <pagination | ||
| 109 | + v-show="total > 0" | ||
| 110 | + :total="total" | ||
| 111 | + v-model:page="queryParams.pageNum" | ||
| 112 | + v-model:limit="queryParams.pageSize" | ||
| 113 | + /> | ||
| 114 | + | ||
| 115 | + <!-- 添加或修改车辆性质配置对话框 --> | ||
| 116 | + <el-dialog :title="title" v-model="open" width="500px" append-to-body> | ||
| 117 | + <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> | ||
| 118 | + <el-form-item label="车辆品牌" prop="brandId"> | ||
| 119 | + <el-select | ||
| 120 | + v-model="form.brandId" | ||
| 121 | + placeholder="选择车辆品牌" | ||
| 122 | + clearable | ||
| 123 | + > | ||
| 124 | + <el-option | ||
| 125 | + v-for="dict in brandList" | ||
| 126 | + :key="dict.id" | ||
| 127 | + :label="dict.name" | ||
| 128 | + :value="dict.id" | ||
| 129 | + /> | ||
| 130 | + </el-select> | ||
| 131 | + </el-form-item> | ||
| 132 | + <el-form-item label="车辆型号" prop="name"> | ||
| 133 | + <el-input v-model="form.name" placeholder="请输入车辆型号名称" /> | ||
| 134 | + </el-form-item> | ||
| 135 | + </el-form> | ||
| 136 | + <template #footer> | ||
| 137 | + <div class="dialog-footer"> | ||
| 138 | + <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 139 | + <el-button @click="cancel">取 消</el-button> | ||
| 140 | + </div> | ||
| 141 | + </template> | ||
| 142 | + </el-dialog> | ||
| 143 | + | ||
| 144 | + <!-- 用户导入对话框 --> | ||
| 145 | + <el-dialog | ||
| 146 | + :title="upload.title" | ||
| 147 | + v-model="upload.open" | ||
| 148 | + width="400px" | ||
| 149 | + append-to-body | ||
| 150 | + > | ||
| 151 | + <el-upload | ||
| 152 | + ref="uploadRef" | ||
| 153 | + :limit="1" | ||
| 154 | + accept=".xlsx, .xls" | ||
| 155 | + :headers="upload.headers" | ||
| 156 | + :action="upload.url + '?updateSupport=' + upload.updateSupport" | ||
| 157 | + :disabled="upload.isUploading" | ||
| 158 | + :on-progress="handleFileUploadProgress" | ||
| 159 | + :on-success="handleFileSuccess" | ||
| 160 | + :auto-upload="false" | ||
| 161 | + drag | ||
| 162 | + > | ||
| 163 | + <el-icon class="el-icon--upload"><upload-filled /></el-icon> | ||
| 164 | + <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> | ||
| 165 | + <template #tip> | ||
| 166 | + <div class="el-upload__tip text-center"> | ||
| 167 | + <div class="el-upload__tip"> | ||
| 168 | + <el-checkbox | ||
| 169 | + v-model="upload.updateSupport" | ||
| 170 | + />是否更新已经存在的型号数据 | ||
| 171 | + </div> | ||
| 172 | + <span>仅允许导入xls、xlsx格式文件。</span> | ||
| 173 | + <el-link | ||
| 174 | + type="primary" | ||
| 175 | + :underline="false" | ||
| 176 | + style="font-size: 12px; vertical-align: baseline" | ||
| 177 | + @click="importTemplate" | ||
| 178 | + >下载模板</el-link | ||
| 179 | + > | ||
| 180 | + </div> | ||
| 181 | + </template> | ||
| 182 | + </el-upload> | ||
| 183 | + <template #footer> | ||
| 184 | + <div class="dialog-footer"> | ||
| 185 | + <el-button type="primary" @click="submitFileForm">确 定</el-button> | ||
| 186 | + <el-button @click="upload.open = false">取 消</el-button> | ||
| 187 | + </div> | ||
| 188 | + </template> | ||
| 189 | + </el-dialog> | ||
| 190 | + </div> | ||
| 191 | +</template> | ||
| 192 | + | ||
| 193 | +<script setup> | ||
| 194 | +import { | ||
| 195 | + addCarModel, | ||
| 196 | + updateCarModel, | ||
| 197 | + queryCarModel, | ||
| 198 | + delCarModel, | ||
| 199 | +} from "@/api/configurationCenter/carModel.js"; | ||
| 200 | +import { queryCarBrand } from "@/api/configurationCenter/carBrand.js"; | ||
| 201 | +import { getToken } from "@/utils/auth"; | ||
| 202 | +const { proxy } = getCurrentInstance(); | ||
| 203 | +/*** 型号导入参数 */ | ||
| 204 | +const upload = reactive({ | ||
| 205 | + // 是否显示弹出层(用户导入) | ||
| 206 | + open: false, | ||
| 207 | + // 弹出层标题(用户导入) | ||
| 208 | + title: "", | ||
| 209 | + // 是否禁用上传 | ||
| 210 | + isUploading: false, | ||
| 211 | + // 是否更新已经存在的用户数据 | ||
| 212 | + updateSupport: 0, | ||
| 213 | + // 设置上传的请求头部 | ||
| 214 | + headers: { Authorization: "Bearer " + getToken() }, | ||
| 215 | + // 上传的地址 | ||
| 216 | + url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData", | ||
| 217 | +}); | ||
| 218 | +const dataList = ref([]); | ||
| 219 | +const open = ref(false); | ||
| 220 | +const multiple = ref(true); | ||
| 221 | +const loading = ref(false); | ||
| 222 | +const total = ref(0); | ||
| 223 | +const title = ref(""); | ||
| 224 | +const ids = ref([]); | ||
| 225 | +const form = ref({}); | ||
| 226 | +const rules = ref({ | ||
| 227 | + brandId: [{ required: true, message: "品牌名称不能为空", trigger: "change" }], | ||
| 228 | + modelName: [{ required: true, message: "型号名称不能为空", trigger: "blur" }], | ||
| 229 | +}); | ||
| 230 | +const queryParams = reactive({ | ||
| 231 | + pageNum: 1, | ||
| 232 | + pageSize: 10, | ||
| 233 | + brandName: undefined, | ||
| 234 | + modelName: undefined, | ||
| 235 | +}); | ||
| 236 | +const brandList = ref([]); | ||
| 237 | +onMounted(() => { | ||
| 238 | + getList(); | ||
| 239 | + getBrandList(); | ||
| 240 | +}); | ||
| 241 | + | ||
| 242 | +// 查询型号列表 | ||
| 243 | +const getList = async () => { | ||
| 244 | + const { data } = await queryCarModel(queryParams); | ||
| 245 | + dataList.value = data.records; | ||
| 246 | + total.value = data.total; | ||
| 247 | +}; | ||
| 248 | +// 查询品牌列表 | ||
| 249 | +const getBrandList = async () => { | ||
| 250 | + const { data } = await queryCarBrand({ pageNum: 1, pageSize: 500 }); | ||
| 251 | + brandList.value = data.records; | ||
| 252 | +}; | ||
| 253 | +/**文件上传中处理 */ | ||
| 254 | +const handleFileUploadProgress = (event, file, fileList) => { | ||
| 255 | + upload.isUploading = true; | ||
| 256 | +}; | ||
| 257 | +/** 文件上传成功处理 */ | ||
| 258 | +const handleFileSuccess = (response, file, fileList) => { | ||
| 259 | + upload.open = false; | ||
| 260 | + upload.isUploading = false; | ||
| 261 | + proxy.$refs["uploadRef"].handleRemove(file); | ||
| 262 | + proxy.$alert( | ||
| 263 | + "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + | ||
| 264 | + response.msg + | ||
| 265 | + "</div>", | ||
| 266 | + "导入结果", | ||
| 267 | + { dangerouslyUseHTMLString: true } | ||
| 268 | + ); | ||
| 269 | + // getList(); | ||
| 270 | +}; | ||
| 271 | +/** 导入按钮操作 */ | ||
| 272 | +function handleImport() { | ||
| 273 | + upload.title = "型号导入"; | ||
| 274 | + upload.open = true; | ||
| 275 | +} | ||
| 276 | +/** 下载模板操作 */ | ||
| 277 | +function importTemplate() { | ||
| 278 | + proxy.download( | ||
| 279 | + "system/user/importTemplate", | ||
| 280 | + {}, | ||
| 281 | + `user_template_${new Date().getTime()}.xlsx` | ||
| 282 | + ); | ||
| 283 | +} | ||
| 284 | +/** 添加车辆性质 */ | ||
| 285 | +function handleAdd() { | ||
| 286 | + reset(); | ||
| 287 | + open.value = true; | ||
| 288 | + title.value = "添加车辆性质"; | ||
| 289 | +} | ||
| 290 | +/** 修改角色 */ | ||
| 291 | +function handleUpdate(row) { | ||
| 292 | + reset(); | ||
| 293 | + form.value = row; | ||
| 294 | + title.value = "修改车辆性质"; | ||
| 295 | + open.value = true; | ||
| 296 | +} | ||
| 297 | + | ||
| 298 | +/** 删除按钮操作 */ | ||
| 299 | +function handleDelete(row) { | ||
| 300 | + const natureIds = row.id ? [row.id] : ids.value; | ||
| 301 | + proxy.$modal | ||
| 302 | + .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') | ||
| 303 | + .then(async () => { | ||
| 304 | + await delCarModel(natureIds); | ||
| 305 | + proxy.$modal.msgSuccess("删除成功"); | ||
| 306 | + getList(); | ||
| 307 | + }); | ||
| 308 | +} | ||
| 309 | +/** 提交上传文件 */ | ||
| 310 | +function submitFileForm() { | ||
| 311 | + proxy.$refs["uploadRef"].submit(); | ||
| 312 | +} | ||
| 313 | +/** 重置新增的表单以及其他数据 */ | ||
| 314 | +function reset() { | ||
| 315 | + form.value = { | ||
| 316 | + id: undefined, | ||
| 317 | + brandId: undefined, | ||
| 318 | + name: undefined, | ||
| 319 | + }; | ||
| 320 | + proxy.resetForm("natureRef"); | ||
| 321 | +} | ||
| 322 | + | ||
| 323 | +/** 多选框选中数据 */ | ||
| 324 | +function handleSelectionChange(selection) { | ||
| 325 | + ids.value = selection.map((item) => item.id); | ||
| 326 | + multiple.value = !selection.length; | ||
| 327 | +} | ||
| 328 | + | ||
| 329 | +/** 搜索按钮操作 */ | ||
| 330 | +function handleQuery() { | ||
| 331 | + queryParams.pageNum = 1; | ||
| 332 | + getList(); | ||
| 333 | +} | ||
| 334 | + | ||
| 335 | +/** 重置按钮操作 */ | ||
| 336 | +function resetQuery() { | ||
| 337 | + proxy.resetForm("queryRef"); | ||
| 338 | + getList(); | ||
| 339 | +} | ||
| 340 | + | ||
| 341 | +/** 提交按钮 */ | ||
| 342 | +function submitForm() { | ||
| 343 | + proxy.$refs["natureRef"].validate(async (valid) => { | ||
| 344 | + if (valid) { | ||
| 345 | + if (form.value.id != undefined) { | ||
| 346 | + await updateCarModel(form.value); | ||
| 347 | + proxy.$modal.msgSuccess("修改成功"); | ||
| 348 | + getList(); | ||
| 349 | + open.value = false; | ||
| 350 | + } else { | ||
| 351 | + await addCarModel(form.value); | ||
| 352 | + getList(); | ||
| 353 | + proxy.$modal.msgSuccess("新增成功"); | ||
| 354 | + open.value = false; | ||
| 355 | + } | ||
| 356 | + } | ||
| 357 | + }); | ||
| 358 | +} | ||
| 359 | +/** 取消按钮 */ | ||
| 360 | +function cancel() { | ||
| 361 | + open.value = false; | ||
| 362 | + reset(); | ||
| 363 | +} | ||
| 364 | +</script> | ||
| 365 | + | ||
| 366 | +<style></style> |
| @@ -32,15 +32,18 @@ | @@ -32,15 +32,18 @@ | ||
| 32 | @selection-change="handleSelectionChange" | 32 | @selection-change="handleSelectionChange" |
| 33 | > | 33 | > |
| 34 | <el-table-column type="selection" width="55" align="center" /> | 34 | <el-table-column type="selection" width="55" align="center" /> |
| 35 | - <el-table-column | ||
| 36 | - label="序号" | ||
| 37 | - prop="policyId" | ||
| 38 | - width="120" | ||
| 39 | - align="center" | ||
| 40 | - /> | ||
| 41 | - <el-table-column label="车辆性质名称" prop="natureName" align="center" /> | ||
| 42 | - <el-table-column label="操作时间" prop="authTime" align="center" /> | ||
| 43 | - <el-table-column label="操作人" prop="editAuth" align="center" /> | 35 | + <el-table-column label="序号" prop="id" width="120" align="center" /> |
| 36 | + <el-table-column label="车辆性质名称" prop="name" align="center" /> | ||
| 37 | + <el-table-column label="操作时间" align="center"> | ||
| 38 | + <template #default="{ row }"> | ||
| 39 | + <span>{{ row.updateTime || row.createTime }}</span> | ||
| 40 | + </template> | ||
| 41 | + </el-table-column> | ||
| 42 | + <el-table-column label="操作人" align="center"> | ||
| 43 | + <template #default="{ row }"> | ||
| 44 | + <span>{{ row.updateBy || row.createBy }}</span> | ||
| 45 | + </template> | ||
| 46 | + </el-table-column> | ||
| 44 | <el-table-column | 47 | <el-table-column |
| 45 | label="操作" | 48 | label="操作" |
| 46 | fixed="right" | 49 | fixed="right" |
| @@ -64,11 +67,8 @@ | @@ -64,11 +67,8 @@ | ||
| 64 | <!-- 添加或修改车辆性质配置对话框 --> | 67 | <!-- 添加或修改车辆性质配置对话框 --> |
| 65 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> | 68 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| 66 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> | 69 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> |
| 67 | - <el-form-item label="车辆性质名称" prop="natureName"> | ||
| 68 | - <el-input | ||
| 69 | - v-model="form.natureName" | ||
| 70 | - placeholder="请输入车辆性质名称" | ||
| 71 | - /> | 70 | + <el-form-item label="车辆性质名称" prop="name"> |
| 71 | + <el-input v-model="form.name" placeholder="请输入车辆性质名称" /> | ||
| 72 | </el-form-item> | 72 | </el-form-item> |
| 73 | </el-form> | 73 | </el-form> |
| 74 | <template #footer> | 74 | <template #footer> |
| @@ -82,27 +82,14 @@ | @@ -82,27 +82,14 @@ | ||
| 82 | </template> | 82 | </template> |
| 83 | 83 | ||
| 84 | <script setup> | 84 | <script setup> |
| 85 | +import { | ||
| 86 | + addCarNature, | ||
| 87 | + updateCarNature, | ||
| 88 | + queryCarNature, | ||
| 89 | + delCarNature, | ||
| 90 | +} from "@/api/configurationCenter/carNature.js"; | ||
| 85 | const { proxy } = getCurrentInstance(); | 91 | const { proxy } = getCurrentInstance(); |
| 86 | -const dataList = ref([ | ||
| 87 | - { | ||
| 88 | - policyId: "1", | ||
| 89 | - natureName: "营运车辆", | ||
| 90 | - authTime: "2024-09-24 11:53:43", | ||
| 91 | - editAuth: "admin", | ||
| 92 | - }, | ||
| 93 | - { | ||
| 94 | - policyId: "2", | ||
| 95 | - natureName: "公务车辆", | ||
| 96 | - authTime: "2024-09-24 11:53:43", | ||
| 97 | - editAuth: "admin", | ||
| 98 | - }, | ||
| 99 | - { | ||
| 100 | - policyId: "3", | ||
| 101 | - natureName: "私家车", | ||
| 102 | - authTime: "2024-09-24 11:53:43", | ||
| 103 | - editAuth: "admin", | ||
| 104 | - }, | ||
| 105 | -]); | 92 | +const dataList = ref([]); |
| 106 | const open = ref(false); | 93 | const open = ref(false); |
| 107 | const multiple = ref(true); | 94 | const multiple = ref(true); |
| 108 | const loading = ref(false); | 95 | const loading = ref(false); |
| @@ -111,15 +98,23 @@ const title = ref(""); | @@ -111,15 +98,23 @@ const title = ref(""); | ||
| 111 | const ids = ref([]); | 98 | const ids = ref([]); |
| 112 | const form = ref({}); | 99 | const form = ref({}); |
| 113 | const rules = ref({ | 100 | const rules = ref({ |
| 114 | - natureName: [ | ||
| 115 | - { required: true, message: "角色名称不能为空", trigger: "blur" }, | ||
| 116 | - ], | 101 | + name: [{ required: true, message: "角色名称不能为空", trigger: "blur" }], |
| 117 | }); | 102 | }); |
| 118 | const queryParams = reactive({ | 103 | const queryParams = reactive({ |
| 119 | pageNum: 1, | 104 | pageNum: 1, |
| 120 | pageSize: 10, | 105 | pageSize: 10, |
| 121 | }); | 106 | }); |
| 122 | 107 | ||
| 108 | +onMounted(() => { | ||
| 109 | + getList(); | ||
| 110 | +}); | ||
| 111 | + | ||
| 112 | +// 获取号牌列表 | ||
| 113 | +const getList = async () => { | ||
| 114 | + const { data } = await queryCarNature(queryParams); | ||
| 115 | + dataList.value = data.records; | ||
| 116 | + total.value = data.total; | ||
| 117 | +}; | ||
| 123 | /** 添加车辆性质 */ | 118 | /** 添加车辆性质 */ |
| 124 | function handleAdd() { | 119 | function handleAdd() { |
| 125 | reset(); | 120 | reset(); |
| @@ -136,40 +131,45 @@ function handleUpdate(row) { | @@ -136,40 +131,45 @@ function handleUpdate(row) { | ||
| 136 | 131 | ||
| 137 | /** 删除按钮操作 */ | 132 | /** 删除按钮操作 */ |
| 138 | function handleDelete(row) { | 133 | function handleDelete(row) { |
| 139 | - const natureIds = row.natureId || ids.value; | 134 | + const natureIds = row.id ? [row.id] : ids.value; |
| 140 | proxy.$modal | 135 | proxy.$modal |
| 141 | .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') | 136 | .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') |
| 142 | - .then(function () { | ||
| 143 | - // return delRole(natureIds); | 137 | + .then(async () => { |
| 138 | + await delCarNature(natureIds); | ||
| 144 | proxy.$modal.msgSuccess("删除成功"); | 139 | proxy.$modal.msgSuccess("删除成功"); |
| 140 | + getList(); | ||
| 145 | }); | 141 | }); |
| 146 | } | 142 | } |
| 147 | 143 | ||
| 148 | /** 重置新增的表单以及其他数据 */ | 144 | /** 重置新增的表单以及其他数据 */ |
| 149 | function reset() { | 145 | function reset() { |
| 150 | form.value = { | 146 | form.value = { |
| 151 | - natureId: undefined, | ||
| 152 | - natureName: undefined, | ||
| 153 | - authTime: undefined, | ||
| 154 | - editAuth: undefined, | 147 | + id: undefined, |
| 148 | + name: undefined, | ||
| 155 | }; | 149 | }; |
| 156 | proxy.resetForm("natureRef"); | 150 | proxy.resetForm("natureRef"); |
| 157 | } | 151 | } |
| 158 | 152 | ||
| 159 | /** 多选框选中数据 */ | 153 | /** 多选框选中数据 */ |
| 160 | function handleSelectionChange(selection) { | 154 | function handleSelectionChange(selection) { |
| 161 | - ids.value = selection.map((item) => item.roleId); | 155 | + ids.value = selection.map((item) => item.id); |
| 162 | multiple.value = !selection.length; | 156 | multiple.value = !selection.length; |
| 163 | } | 157 | } |
| 164 | 158 | ||
| 165 | /** 提交按钮 */ | 159 | /** 提交按钮 */ |
| 166 | function submitForm() { | 160 | function submitForm() { |
| 167 | - proxy.$refs["natureRef"].validate((valid) => { | 161 | + proxy.$refs["natureRef"].validate(async (valid) => { |
| 168 | if (valid) { | 162 | if (valid) { |
| 169 | - if (form.value.natureId != undefined) { | 163 | + if (form.value.id != undefined) { |
| 164 | + await updateCarNature(form.value); | ||
| 170 | proxy.$modal.msgSuccess("修改成功"); | 165 | proxy.$modal.msgSuccess("修改成功"); |
| 166 | + getList(); | ||
| 167 | + open.value = false; | ||
| 171 | } else { | 168 | } else { |
| 169 | + await addCarNature(form.value); | ||
| 170 | + getList(); | ||
| 172 | proxy.$modal.msgSuccess("新增成功"); | 171 | proxy.$modal.msgSuccess("新增成功"); |
| 172 | + open.value = false; | ||
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | }); | 175 | }); |
| @@ -2,12 +2,7 @@ | @@ -2,12 +2,7 @@ | ||
| 2 | <div class="app-container"> | 2 | <div class="app-container"> |
| 3 | <el-row :gutter="10" class="mb8"> | 3 | <el-row :gutter="10" class="mb8"> |
| 4 | <el-col :span="1.5"> | 4 | <el-col :span="1.5"> |
| 5 | - <el-button | ||
| 6 | - type="primary" | ||
| 7 | - plain | ||
| 8 | - icon="Plus" | ||
| 9 | - v-hasPermi="['system:role:add']" | ||
| 10 | - @click="handleAdd" | 5 | + <el-button type="primary" plain icon="Plus" @click="handleAdd" |
| 11 | >新增</el-button | 6 | >新增</el-button |
| 12 | > | 7 | > |
| 13 | </el-col> | 8 | </el-col> |
| @@ -17,12 +12,10 @@ | @@ -17,12 +12,10 @@ | ||
| 17 | plain | 12 | plain |
| 18 | icon="Delete" | 13 | icon="Delete" |
| 19 | :disabled="multiple" | 14 | :disabled="multiple" |
| 20 | - v-hasPermi="['system:role:remove']" | ||
| 21 | @click="handleDelete" | 15 | @click="handleDelete" |
| 22 | >删除</el-button | 16 | >删除</el-button |
| 23 | > | 17 | > |
| 24 | </el-col> | 18 | </el-col> |
| 25 | - <!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> --> | ||
| 26 | </el-row> | 19 | </el-row> |
| 27 | 20 | ||
| 28 | <!-- 表格数据 --> | 21 | <!-- 表格数据 --> |
| @@ -32,15 +25,18 @@ | @@ -32,15 +25,18 @@ | ||
| 32 | @selection-change="handleSelectionChange" | 25 | @selection-change="handleSelectionChange" |
| 33 | > | 26 | > |
| 34 | <el-table-column type="selection" width="55" align="center" /> | 27 | <el-table-column type="selection" width="55" align="center" /> |
| 35 | - <el-table-column | ||
| 36 | - label="序号" | ||
| 37 | - prop="policyId" | ||
| 38 | - width="120" | ||
| 39 | - align="center" | ||
| 40 | - /> | ||
| 41 | - <el-table-column label="号牌种类名称" prop="numSort" align="center" /> | ||
| 42 | - <el-table-column label="操作时间" prop="authTime" align="center" /> | ||
| 43 | - <el-table-column label="操作人" prop="editAuth" align="center" /> | 28 | + <el-table-column label="序号" prop="id" width="120" align="center" /> |
| 29 | + <el-table-column label="号牌种类名称" prop="name" align="center" /> | ||
| 30 | + <el-table-column label="操作时间" align="center"> | ||
| 31 | + <template #default="{ row }"> | ||
| 32 | + <span>{{ row.updateTime || row.createTime }}</span> | ||
| 33 | + </template> | ||
| 34 | + </el-table-column> | ||
| 35 | + <el-table-column label="操作人" align="center"> | ||
| 36 | + <template #default="{ row }"> | ||
| 37 | + <span>{{ row.updateBy || row.createBy }}</span> | ||
| 38 | + </template> | ||
| 39 | + </el-table-column> | ||
| 44 | <el-table-column | 40 | <el-table-column |
| 45 | label="操作" | 41 | label="操作" |
| 46 | fixed="right" | 42 | fixed="right" |
| @@ -64,8 +60,8 @@ | @@ -64,8 +60,8 @@ | ||
| 64 | <!-- 添加或修改车辆性质配置对话框 --> | 60 | <!-- 添加或修改车辆性质配置对话框 --> |
| 65 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> | 61 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| 66 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> | 62 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> |
| 67 | - <el-form-item label="号牌种类名称" prop="numSort"> | ||
| 68 | - <el-input v-model="form.numSort" placeholder="请输入号牌种类名称" /> | 63 | + <el-form-item label="号牌种类名称" prop="name"> |
| 64 | + <el-input v-model="form.name" placeholder="请输入号牌种类名称" /> | ||
| 69 | </el-form-item> | 65 | </el-form-item> |
| 70 | </el-form> | 66 | </el-form> |
| 71 | <template #footer> | 67 | <template #footer> |
| @@ -79,49 +75,48 @@ | @@ -79,49 +75,48 @@ | ||
| 79 | </template> | 75 | </template> |
| 80 | 76 | ||
| 81 | <script setup> | 77 | <script setup> |
| 78 | +import { | ||
| 79 | + addCarNum, | ||
| 80 | + updateCarNum, | ||
| 81 | + queryCarNum, | ||
| 82 | + delCarNum, | ||
| 83 | +} from "@/api/configurationCenter/carNum.js"; | ||
| 84 | +import { onMounted } from "vue"; | ||
| 82 | const { proxy } = getCurrentInstance(); | 85 | const { proxy } = getCurrentInstance(); |
| 83 | -const dataList = ref([ | ||
| 84 | - { | ||
| 85 | - policyId: "1", | ||
| 86 | - numSort: "蓝色车牌", | ||
| 87 | - authTime: "2024-09-24 11:53:43", | ||
| 88 | - editAuth: "admin", | ||
| 89 | - }, | ||
| 90 | - { | ||
| 91 | - policyId: "2", | ||
| 92 | - numSort: "黄色车牌", | ||
| 93 | - authTime: "2024-09-24 11:53:43", | ||
| 94 | - editAuth: "admin", | ||
| 95 | - }, | ||
| 96 | - { | ||
| 97 | - policyId: "3", | ||
| 98 | - numSort: "白色色车牌", | ||
| 99 | - authTime: "2024-09-24 11:53:43", | ||
| 100 | - editAuth: "admin", | ||
| 101 | - }, | ||
| 102 | -]); | 86 | +const dataList = ref([]); |
| 103 | const open = ref(false); | 87 | const open = ref(false); |
| 104 | const multiple = ref(true); | 88 | const multiple = ref(true); |
| 105 | const loading = ref(false); | 89 | const loading = ref(false); |
| 106 | -const total = ref(5); | 90 | +const total = ref(0); |
| 107 | const title = ref(""); | 91 | const title = ref(""); |
| 108 | const ids = ref([]); | 92 | const ids = ref([]); |
| 109 | const form = ref({}); | 93 | const form = ref({}); |
| 110 | const rules = ref({ | 94 | const rules = ref({ |
| 111 | - numSort: [{ required: true, message: "角色名称不能为空", trigger: "blur" }], | 95 | + name: [{ required: true, message: "角色名称不能为空", trigger: "blur" }], |
| 112 | }); | 96 | }); |
| 113 | const queryParams = reactive({ | 97 | const queryParams = reactive({ |
| 114 | pageNum: 1, | 98 | pageNum: 1, |
| 115 | pageSize: 10, | 99 | pageSize: 10, |
| 116 | }); | 100 | }); |
| 117 | 101 | ||
| 118 | -/** 添加车辆性质 */ | 102 | +onMounted(() => { |
| 103 | + getList(); | ||
| 104 | +}); | ||
| 105 | + | ||
| 106 | +// 获取号牌列表 | ||
| 107 | +const getList = async () => { | ||
| 108 | + const { data } = await queryCarNum(queryParams); | ||
| 109 | + dataList.value = data.records; | ||
| 110 | + total.value = data.total; | ||
| 111 | +}; | ||
| 112 | + | ||
| 113 | +/** 添加号牌 */ | ||
| 119 | function handleAdd() { | 114 | function handleAdd() { |
| 120 | reset(); | 115 | reset(); |
| 121 | open.value = true; | 116 | open.value = true; |
| 122 | title.value = "添加号牌种类"; | 117 | title.value = "添加号牌种类"; |
| 123 | } | 118 | } |
| 124 | -/** 修改角色 */ | 119 | +/** 修改号牌 */ |
| 125 | function handleUpdate(row) { | 120 | function handleUpdate(row) { |
| 126 | reset(); | 121 | reset(); |
| 127 | form.value = row; | 122 | form.value = row; |
| @@ -131,40 +126,43 @@ function handleUpdate(row) { | @@ -131,40 +126,43 @@ function handleUpdate(row) { | ||
| 131 | 126 | ||
| 132 | /** 删除按钮操作 */ | 127 | /** 删除按钮操作 */ |
| 133 | function handleDelete(row) { | 128 | function handleDelete(row) { |
| 134 | - const natureIds = row.natureId || ids.value; | ||
| 135 | - proxy.$modal | ||
| 136 | - .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') | ||
| 137 | - .then(function () { | ||
| 138 | - // return delRole(natureIds); | 129 | + const natureIds = row.id ? [row.id] : ids.value; |
| 130 | + proxy.$modal.confirm("是否确认删除该项的数据?").then(async () => { | ||
| 131 | + await delCarNum(natureIds); | ||
| 139 | proxy.$modal.msgSuccess("删除成功"); | 132 | proxy.$modal.msgSuccess("删除成功"); |
| 133 | + getList(); | ||
| 140 | }); | 134 | }); |
| 141 | } | 135 | } |
| 142 | 136 | ||
| 143 | /** 重置新增的表单以及其他数据 */ | 137 | /** 重置新增的表单以及其他数据 */ |
| 144 | function reset() { | 138 | function reset() { |
| 145 | form.value = { | 139 | form.value = { |
| 146 | - natureId: undefined, | ||
| 147 | - numSort: undefined, | ||
| 148 | - authTime: undefined, | ||
| 149 | - editAuth: undefined, | 140 | + id: undefined, |
| 141 | + name: undefined, | ||
| 150 | }; | 142 | }; |
| 151 | proxy.resetForm("natureRef"); | 143 | proxy.resetForm("natureRef"); |
| 152 | } | 144 | } |
| 153 | 145 | ||
| 154 | /** 多选框选中数据 */ | 146 | /** 多选框选中数据 */ |
| 155 | function handleSelectionChange(selection) { | 147 | function handleSelectionChange(selection) { |
| 156 | - ids.value = selection.map((item) => item.roleId); | 148 | + ids.value = selection.map((item) => item.id); |
| 157 | multiple.value = !selection.length; | 149 | multiple.value = !selection.length; |
| 158 | } | 150 | } |
| 159 | 151 | ||
| 160 | /** 提交按钮 */ | 152 | /** 提交按钮 */ |
| 161 | function submitForm() { | 153 | function submitForm() { |
| 162 | - proxy.$refs["natureRef"].validate((valid) => { | 154 | + proxy.$refs["natureRef"].validate(async (valid) => { |
| 163 | if (valid) { | 155 | if (valid) { |
| 164 | - if (form.value.natureId != undefined) { | 156 | + if (form.value.id != undefined) { |
| 157 | + await updateCarNum(form.value); | ||
| 165 | proxy.$modal.msgSuccess("修改成功"); | 158 | proxy.$modal.msgSuccess("修改成功"); |
| 159 | + getList(); | ||
| 160 | + open.value = false; | ||
| 166 | } else { | 161 | } else { |
| 162 | + await addCarNum(form.value); | ||
| 163 | + getList(); | ||
| 167 | proxy.$modal.msgSuccess("新增成功"); | 164 | proxy.$modal.msgSuccess("新增成功"); |
| 165 | + open.value = false; | ||
| 168 | } | 166 | } |
| 169 | } | 167 | } |
| 170 | }); | 168 | }); |
| @@ -55,15 +55,18 @@ | @@ -55,15 +55,18 @@ | ||
| 55 | @selection-change="handleSelectionChange" | 55 | @selection-change="handleSelectionChange" |
| 56 | > | 56 | > |
| 57 | <el-table-column type="selection" width="55" align="center" /> | 57 | <el-table-column type="selection" width="55" align="center" /> |
| 58 | - <el-table-column | ||
| 59 | - label="序号" | ||
| 60 | - prop="policyId" | ||
| 61 | - width="120" | ||
| 62 | - align="center" | ||
| 63 | - /> | ||
| 64 | - <el-table-column label="车辆类型" prop="typeName" align="center" /> | ||
| 65 | - <el-table-column label="操作时间" prop="authTime" align="center" /> | ||
| 66 | - <el-table-column label="操作人" prop="editAuth" align="center" /> | 58 | + <el-table-column label="序号" prop="id" width="120" align="center" /> |
| 59 | + <el-table-column label="车辆类型" prop="name" align="center" /> | ||
| 60 | + <el-table-column label="操作时间" align="center"> | ||
| 61 | + <template #default="{ row }"> | ||
| 62 | + <span>{{ row.updateTime || row.createTime }}</span> | ||
| 63 | + </template> | ||
| 64 | + </el-table-column> | ||
| 65 | + <el-table-column label="操作人" align="center"> | ||
| 66 | + <template #default="{ row }"> | ||
| 67 | + <span>{{ row.updateBy || row.createBy }}</span> | ||
| 68 | + </template> | ||
| 69 | + </el-table-column> | ||
| 67 | <el-table-column | 70 | <el-table-column |
| 68 | label="操作" | 71 | label="操作" |
| 69 | fixed="right" | 72 | fixed="right" |
| @@ -87,8 +90,8 @@ | @@ -87,8 +90,8 @@ | ||
| 87 | <!-- 添加或修改车辆性质配置对话框 --> | 90 | <!-- 添加或修改车辆性质配置对话框 --> |
| 88 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> | 91 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| 89 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> | 92 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> |
| 90 | - <el-form-item label="车辆类型名称" prop="typeName"> | ||
| 91 | - <el-input v-model="form.typeName" placeholder="请输入车辆性质名称" /> | 93 | + <el-form-item label="车辆类型名称" prop="name"> |
| 94 | + <el-input v-model="form.name" placeholder="请输入车辆性质名称" /> | ||
| 92 | </el-form-item> | 95 | </el-form-item> |
| 93 | </el-form> | 96 | </el-form> |
| 94 | <template #footer> | 97 | <template #footer> |
| @@ -102,27 +105,14 @@ | @@ -102,27 +105,14 @@ | ||
| 102 | </template> | 105 | </template> |
| 103 | 106 | ||
| 104 | <script setup> | 107 | <script setup> |
| 108 | +import { | ||
| 109 | + addCarType, | ||
| 110 | + updateCarType, | ||
| 111 | + queryCarType, | ||
| 112 | + delCarType, | ||
| 113 | +} from "@/api/configurationCenter/carType.js"; | ||
| 105 | const { proxy } = getCurrentInstance(); | 114 | const { proxy } = getCurrentInstance(); |
| 106 | -const dataList = ref([ | ||
| 107 | - { | ||
| 108 | - policyId: "1", | ||
| 109 | - typeName: "小型车", | ||
| 110 | - authTime: "2024-09-24 11:53:43", | ||
| 111 | - editAuth: "admin", | ||
| 112 | - }, | ||
| 113 | - { | ||
| 114 | - policyId: "2", | ||
| 115 | - typeName: "高级车型", | ||
| 116 | - authTime: "2024-09-24 11:53:43", | ||
| 117 | - editAuth: "admin", | ||
| 118 | - }, | ||
| 119 | - { | ||
| 120 | - policyId: "3", | ||
| 121 | - typeName: "三厢车型", | ||
| 122 | - authTime: "2024-09-24 11:53:43", | ||
| 123 | - editAuth: "admin", | ||
| 124 | - }, | ||
| 125 | -]); | 115 | +const dataList = ref([]); |
| 126 | const open = ref(false); | 116 | const open = ref(false); |
| 127 | const multiple = ref(true); | 117 | const multiple = ref(true); |
| 128 | const loading = ref(false); | 118 | const loading = ref(false); |
| @@ -141,38 +131,46 @@ const queryParams = reactive({ | @@ -141,38 +131,46 @@ const queryParams = reactive({ | ||
| 141 | typeName: undefined, | 131 | typeName: undefined, |
| 142 | }); | 132 | }); |
| 143 | 133 | ||
| 134 | +onMounted(() => { | ||
| 135 | + getList(); | ||
| 136 | +}); | ||
| 137 | + | ||
| 138 | +// 获取号牌列表 | ||
| 139 | +const getList = async () => { | ||
| 140 | + const { data } = await queryCarType(queryParams); | ||
| 141 | + dataList.value = data.records; | ||
| 142 | + total.value = data.total; | ||
| 143 | +}; | ||
| 144 | + | ||
| 144 | /** 添加车辆性质 */ | 145 | /** 添加车辆性质 */ |
| 145 | function handleAdd() { | 146 | function handleAdd() { |
| 146 | reset(); | 147 | reset(); |
| 147 | open.value = true; | 148 | open.value = true; |
| 148 | - title.value = "添加车辆性质"; | 149 | + title.value = "添加车辆类型"; |
| 149 | } | 150 | } |
| 150 | /** 修改角色 */ | 151 | /** 修改角色 */ |
| 151 | function handleUpdate(row) { | 152 | function handleUpdate(row) { |
| 152 | reset(); | 153 | reset(); |
| 153 | form.value = row; | 154 | form.value = row; |
| 154 | - title.value = "修改车辆性质"; | 155 | + title.value = "修改车辆类型"; |
| 155 | open.value = true; | 156 | open.value = true; |
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | /** 删除按钮操作 */ | 159 | /** 删除按钮操作 */ |
| 159 | function handleDelete(row) { | 160 | function handleDelete(row) { |
| 160 | - const natureIds = row.natureId || ids.value; | ||
| 161 | - proxy.$modal | ||
| 162 | - .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') | ||
| 163 | - .then(function () { | ||
| 164 | - // return delRole(natureIds); | 161 | + const natureIds = row.id ? [row.id] : ids.value; |
| 162 | + proxy.$modal.confirm("是否确认删除该项的数据?").then(async () => { | ||
| 163 | + await delCarType(natureIds); | ||
| 165 | proxy.$modal.msgSuccess("删除成功"); | 164 | proxy.$modal.msgSuccess("删除成功"); |
| 165 | + getList(); | ||
| 166 | }); | 166 | }); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | /** 重置新增的表单以及其他数据 */ | 169 | /** 重置新增的表单以及其他数据 */ |
| 170 | function reset() { | 170 | function reset() { |
| 171 | form.value = { | 171 | form.value = { |
| 172 | - natureId: undefined, | ||
| 173 | - typeName: undefined, | ||
| 174 | - authTime: undefined, | ||
| 175 | - editAuth: undefined, | 172 | + id: undefined, |
| 173 | + name: undefined, | ||
| 176 | }; | 174 | }; |
| 177 | proxy.resetForm("natureRef"); | 175 | proxy.resetForm("natureRef"); |
| 178 | } | 176 | } |
| @@ -193,12 +191,18 @@ function resetQuery() { | @@ -193,12 +191,18 @@ function resetQuery() { | ||
| 193 | 191 | ||
| 194 | /** 提交按钮 */ | 192 | /** 提交按钮 */ |
| 195 | function submitForm() { | 193 | function submitForm() { |
| 196 | - proxy.$refs["natureRef"].validate((valid) => { | 194 | + proxy.$refs["natureRef"].validate(async (valid) => { |
| 197 | if (valid) { | 195 | if (valid) { |
| 198 | - if (form.value.natureId != undefined) { | 196 | + if (form.value.id != undefined) { |
| 197 | + await updateCarType(form.value); | ||
| 199 | proxy.$modal.msgSuccess("修改成功"); | 198 | proxy.$modal.msgSuccess("修改成功"); |
| 199 | + getList(); | ||
| 200 | + open.value = false; | ||
| 200 | } else { | 201 | } else { |
| 202 | + await addCarType(form.value); | ||
| 203 | + getList(); | ||
| 201 | proxy.$modal.msgSuccess("新增成功"); | 204 | proxy.$modal.msgSuccess("新增成功"); |
| 205 | + open.value = false; | ||
| 202 | } | 206 | } |
| 203 | } | 207 | } |
| 204 | }); | 208 | }); |
| @@ -2,12 +2,7 @@ | @@ -2,12 +2,7 @@ | ||
| 2 | <div class="app-container"> | 2 | <div class="app-container"> |
| 3 | <el-row :gutter="10" class="mb8"> | 3 | <el-row :gutter="10" class="mb8"> |
| 4 | <el-col :span="1.5"> | 4 | <el-col :span="1.5"> |
| 5 | - <el-button | ||
| 6 | - type="primary" | ||
| 7 | - plain | ||
| 8 | - icon="Plus" | ||
| 9 | - v-hasPermi="['system:role:add']" | ||
| 10 | - @click="handleAdd" | 5 | + <el-button type="primary" plain icon="Plus" @click="handleAdd" |
| 11 | >新增</el-button | 6 | >新增</el-button |
| 12 | > | 7 | > |
| 13 | </el-col> | 8 | </el-col> |
| @@ -17,7 +12,6 @@ | @@ -17,7 +12,6 @@ | ||
| 17 | plain | 12 | plain |
| 18 | icon="Delete" | 13 | icon="Delete" |
| 19 | :disabled="multiple" | 14 | :disabled="multiple" |
| 20 | - v-hasPermi="['system:role:remove']" | ||
| 21 | @click="handleDelete" | 15 | @click="handleDelete" |
| 22 | >删除</el-button | 16 | >删除</el-button |
| 23 | > | 17 | > |
| @@ -32,15 +26,18 @@ | @@ -32,15 +26,18 @@ | ||
| 32 | @selection-change="handleSelectionChange" | 26 | @selection-change="handleSelectionChange" |
| 33 | > | 27 | > |
| 34 | <el-table-column type="selection" width="55" align="center" /> | 28 | <el-table-column type="selection" width="55" align="center" /> |
| 35 | - <el-table-column | ||
| 36 | - label="序号" | ||
| 37 | - prop="policyId" | ||
| 38 | - width="120" | ||
| 39 | - align="center" | ||
| 40 | - /> | ||
| 41 | - <el-table-column label="保险名称" prop="insuranceName" align="center" /> | ||
| 42 | - <el-table-column label="操作时间" prop="authTime" align="center" /> | ||
| 43 | - <el-table-column label="操作人" prop="editAuth" align="center" /> | 29 | + <el-table-column label="序号" prop="id" width="120" align="center" /> |
| 30 | + <el-table-column label="保险名称" prop="name" align="center" /> | ||
| 31 | + <el-table-column label="操作时间" align="center"> | ||
| 32 | + <template #default="{ row }"> | ||
| 33 | + <span>{{ row.updateTime || row.createTime }}</span> | ||
| 34 | + </template> | ||
| 35 | + </el-table-column> | ||
| 36 | + <el-table-column label="操作人" align="center"> | ||
| 37 | + <template #default="{ row }"> | ||
| 38 | + <span>{{ row.updateBy || row.createBy }}</span> | ||
| 39 | + </template> | ||
| 40 | + </el-table-column> | ||
| 44 | <el-table-column | 41 | <el-table-column |
| 45 | label="操作" | 42 | label="操作" |
| 46 | fixed="right" | 43 | fixed="right" |
| @@ -64,8 +61,8 @@ | @@ -64,8 +61,8 @@ | ||
| 64 | <!-- 添加或修改车辆性质配置对话框 --> | 61 | <!-- 添加或修改车辆性质配置对话框 --> |
| 65 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> | 62 | <el-dialog :title="title" v-model="open" width="500px" append-to-body> |
| 66 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> | 63 | <el-form ref="natureRef" :model="form" :rules="rules" label-width="120px"> |
| 67 | - <el-form-item label="保险名称" prop="insuranceName"> | ||
| 68 | - <el-input v-model="form.insuranceName" placeholder="请输入保险名称" /> | 64 | + <el-form-item label="保险名称" prop="name"> |
| 65 | + <el-input v-model="form.name" placeholder="请输入保险名称" /> | ||
| 69 | </el-form-item> | 66 | </el-form-item> |
| 70 | </el-form> | 67 | </el-form> |
| 71 | <template #footer> | 68 | <template #footer> |
| @@ -79,27 +76,14 @@ | @@ -79,27 +76,14 @@ | ||
| 79 | </template> | 76 | </template> |
| 80 | 77 | ||
| 81 | <script setup> | 78 | <script setup> |
| 79 | +import { | ||
| 80 | + addNeed, | ||
| 81 | + updateNeed, | ||
| 82 | + queryNeed, | ||
| 83 | + delNeed, | ||
| 84 | +} from "@/api/configurationCenter/need.js"; | ||
| 82 | const { proxy } = getCurrentInstance(); | 85 | const { proxy } = getCurrentInstance(); |
| 83 | -const dataList = ref([ | ||
| 84 | - { | ||
| 85 | - policyId: "1", | ||
| 86 | - insuranceName: "商业险", | ||
| 87 | - authTime: "2024-09-24 11:53:43", | ||
| 88 | - editAuth: "admin", | ||
| 89 | - }, | ||
| 90 | - { | ||
| 91 | - policyId: "2", | ||
| 92 | - insuranceName: "人身安全险", | ||
| 93 | - authTime: "2024-09-24 11:53:43", | ||
| 94 | - editAuth: "admin", | ||
| 95 | - }, | ||
| 96 | - { | ||
| 97 | - policyId: "3", | ||
| 98 | - insuranceName: "交强险", | ||
| 99 | - authTime: "2024-09-24 11:53:43", | ||
| 100 | - editAuth: "admin", | ||
| 101 | - }, | ||
| 102 | -]); | 86 | +const dataList = ref([]); |
| 103 | const open = ref(false); | 87 | const open = ref(false); |
| 104 | const multiple = ref(true); | 88 | const multiple = ref(true); |
| 105 | const loading = ref(false); | 89 | const loading = ref(false); |
| @@ -108,65 +92,76 @@ const title = ref(""); | @@ -108,65 +92,76 @@ const title = ref(""); | ||
| 108 | const ids = ref([]); | 92 | const ids = ref([]); |
| 109 | const form = ref({}); | 93 | const form = ref({}); |
| 110 | const rules = ref({ | 94 | const rules = ref({ |
| 111 | - insuranceName: [ | ||
| 112 | - { required: true, message: "角色名称不能为空", trigger: "blur" }, | ||
| 113 | - ], | 95 | + name: [{ required: true, message: "保险需求不能为空", trigger: "blur" }], |
| 114 | }); | 96 | }); |
| 115 | const queryParams = reactive({ | 97 | const queryParams = reactive({ |
| 116 | pageNum: 1, | 98 | pageNum: 1, |
| 117 | pageSize: 10, | 99 | pageSize: 10, |
| 118 | }); | 100 | }); |
| 119 | 101 | ||
| 102 | +onMounted(() => { | ||
| 103 | + getList(); | ||
| 104 | +}); | ||
| 105 | +// 获取需求列表 | ||
| 106 | +const getList = async () => { | ||
| 107 | + const { data } = await queryNeed(queryParams); | ||
| 108 | + dataList.value = data.records; | ||
| 109 | + total.value = data.total; | ||
| 110 | +}; | ||
| 111 | + | ||
| 120 | /** 添加车辆性质 */ | 112 | /** 添加车辆性质 */ |
| 121 | function handleAdd() { | 113 | function handleAdd() { |
| 122 | reset(); | 114 | reset(); |
| 123 | open.value = true; | 115 | open.value = true; |
| 124 | - title.value = "添加号牌种类"; | 116 | + title.value = "添加保险需求"; |
| 125 | } | 117 | } |
| 126 | /** 修改角色 */ | 118 | /** 修改角色 */ |
| 127 | function handleUpdate(row) { | 119 | function handleUpdate(row) { |
| 128 | reset(); | 120 | reset(); |
| 129 | form.value = row; | 121 | form.value = row; |
| 130 | - title.value = "修改号牌种类"; | 122 | + title.value = "修改保险需求"; |
| 131 | open.value = true; | 123 | open.value = true; |
| 132 | } | 124 | } |
| 133 | 125 | ||
| 134 | /** 删除按钮操作 */ | 126 | /** 删除按钮操作 */ |
| 135 | function handleDelete(row) { | 127 | function handleDelete(row) { |
| 136 | - const natureIds = row.natureId || ids.value; | ||
| 137 | - proxy.$modal | ||
| 138 | - .confirm('是否确认删除车辆性质编号为"' + natureIds + '"的数据项?') | ||
| 139 | - .then(function () { | ||
| 140 | - // return delRole(natureIds); | 128 | + const Ids = row.id ? [row.id] : ids.value; |
| 129 | + proxy.$modal.confirm("是否确认删除该数据项?").then(async () => { | ||
| 130 | + await delNeed(Ids); | ||
| 141 | proxy.$modal.msgSuccess("删除成功"); | 131 | proxy.$modal.msgSuccess("删除成功"); |
| 132 | + getList(); | ||
| 142 | }); | 133 | }); |
| 143 | } | 134 | } |
| 144 | 135 | ||
| 145 | /** 重置新增的表单以及其他数据 */ | 136 | /** 重置新增的表单以及其他数据 */ |
| 146 | function reset() { | 137 | function reset() { |
| 147 | form.value = { | 138 | form.value = { |
| 148 | - natureId: undefined, | ||
| 149 | - numSort: undefined, | ||
| 150 | - authTime: undefined, | ||
| 151 | - editAuth: undefined, | 139 | + id: undefined, |
| 140 | + name: undefined, | ||
| 152 | }; | 141 | }; |
| 153 | proxy.resetForm("natureRef"); | 142 | proxy.resetForm("natureRef"); |
| 154 | } | 143 | } |
| 155 | 144 | ||
| 156 | /** 多选框选中数据 */ | 145 | /** 多选框选中数据 */ |
| 157 | function handleSelectionChange(selection) { | 146 | function handleSelectionChange(selection) { |
| 158 | - ids.value = selection.map((item) => item.roleId); | 147 | + ids.value = selection.map((item) => item.id); |
| 159 | multiple.value = !selection.length; | 148 | multiple.value = !selection.length; |
| 160 | } | 149 | } |
| 161 | 150 | ||
| 162 | /** 提交按钮 */ | 151 | /** 提交按钮 */ |
| 163 | function submitForm() { | 152 | function submitForm() { |
| 164 | - proxy.$refs["natureRef"].validate((valid) => { | 153 | + proxy.$refs["natureRef"].validate(async (valid) => { |
| 165 | if (valid) { | 154 | if (valid) { |
| 166 | if (form.value.natureId != undefined) { | 155 | if (form.value.natureId != undefined) { |
| 156 | + await updateNeed(form.value); | ||
| 157 | + getList(); | ||
| 167 | proxy.$modal.msgSuccess("修改成功"); | 158 | proxy.$modal.msgSuccess("修改成功"); |
| 159 | + open.value = false; | ||
| 168 | } else { | 160 | } else { |
| 161 | + await addNeed(form.value); | ||
| 162 | + getList(); | ||
| 169 | proxy.$modal.msgSuccess("新增成功"); | 163 | proxy.$modal.msgSuccess("新增成功"); |
| 164 | + open.value = false; | ||
| 170 | } | 165 | } |
| 171 | } | 166 | } |
| 172 | }); | 167 | }); |
| @@ -33,21 +33,11 @@ | @@ -33,21 +33,11 @@ | ||
| 33 | @selection-change="handleSelectionChange" | 33 | @selection-change="handleSelectionChange" |
| 34 | > | 34 | > |
| 35 | <el-table-column type="selection" width="55" align="center" /> | 35 | <el-table-column type="selection" width="55" align="center" /> |
| 36 | - <el-table-column | ||
| 37 | - label="序号" | ||
| 38 | - prop="companyId" | ||
| 39 | - width="120" | ||
| 40 | - align="center" | ||
| 41 | - /> | ||
| 42 | - <el-table-column label="保险公司名称" prop="company" align="center" /> | ||
| 43 | - <el-table-column | ||
| 44 | - label="周分配订单" | ||
| 45 | - width="240" | ||
| 46 | - align="center" | ||
| 47 | - prop="orderNum" | ||
| 48 | - > | 36 | + <el-table-column label="序号" prop="id" align="center" /> |
| 37 | + <el-table-column label="保险公司名称" prop="deptName" align="center" /> | ||
| 38 | + <el-table-column label="周分配订单" width="240" align="center" prop="num"> | ||
| 49 | <template #default="{ row }"> | 39 | <template #default="{ row }"> |
| 50 | - <el-input v-model="row.orderNum" type="number" /> | 40 | + <el-input v-model="row.num" type="num" /> |
| 51 | </template> | 41 | </template> |
| 52 | </el-table-column> | 42 | </el-table-column> |
| 53 | <el-table-column | 43 | <el-table-column |
| @@ -57,9 +47,9 @@ | @@ -57,9 +47,9 @@ | ||
| 57 | width="180" | 47 | width="180" |
| 58 | prop="Feedback" | 48 | prop="Feedback" |
| 59 | > | 49 | > |
| 60 | - <template #default> | ||
| 61 | - <el-button type="primary">保存</el-button> | ||
| 62 | - <el-button type="danger">删除</el-button> | 50 | + <template #default="{ row }"> |
| 51 | + <el-button type="primary" @click="handleUpdate(row)">保存</el-button> | ||
| 52 | + <el-button type="danger" @click="handleDelete(row)">删除</el-button> | ||
| 63 | </template> | 53 | </template> |
| 64 | </el-table-column> | 54 | </el-table-column> |
| 65 | </el-table> | 55 | </el-table> |
| @@ -74,17 +64,25 @@ | @@ -74,17 +64,25 @@ | ||
| 74 | 64 | ||
| 75 | <!-- 添加或修改用户配置对话框 --> | 65 | <!-- 添加或修改用户配置对话框 --> |
| 76 | <el-dialog :title="title" v-model="open" width="600px" append-to-body> | 66 | <el-dialog :title="title" v-model="open" width="600px" append-to-body> |
| 77 | - <el-form :model="form" :rules="rules" ref="rulesRef" label-width="80px"> | ||
| 78 | - <el-form-item label="公司名称" prop="company"> | ||
| 79 | - <el-input | ||
| 80 | - v-model="form.company" | ||
| 81 | - placeholder="请输入保险公司名称" | ||
| 82 | - maxlength="30" | 67 | + <el-form :model="form" :rules="rules" ref="rulesRef" label-width="100px"> |
| 68 | + <el-form-item label="承保公司名称" prop="deptId"> | ||
| 69 | + <el-tree-select | ||
| 70 | + v-model="form.deptId" | ||
| 71 | + :data="deptOptions" | ||
| 72 | + :props="{ | ||
| 73 | + value: 'deptId', | ||
| 74 | + label: 'deptName', | ||
| 75 | + children: 'children', | ||
| 76 | + }" | ||
| 77 | + value-key="deptId" | ||
| 78 | + placeholder="选择承保公司" | ||
| 79 | + check-strictly | ||
| 80 | + style="width: 100%" | ||
| 83 | /> | 81 | /> |
| 84 | </el-form-item> | 82 | </el-form-item> |
| 85 | - <el-form-item label="周分配量" prop="orderNum"> | 83 | + <el-form-item label="周分配量" prop="num"> |
| 86 | <el-input | 84 | <el-input |
| 87 | - v-model="form.orderNum" | 85 | + v-model="form.num" |
| 88 | type="number" | 86 | type="number" |
| 89 | placeholder="请输入周分配订单量" | 87 | placeholder="请输入周分配订单量" |
| 90 | maxlength="30" | 88 | maxlength="30" |
| @@ -102,9 +100,19 @@ | @@ -102,9 +100,19 @@ | ||
| 102 | </template> | 100 | </template> |
| 103 | 101 | ||
| 104 | <script setup> | 102 | <script setup> |
| 103 | +import { | ||
| 104 | + addRules, | ||
| 105 | + updateRules, | ||
| 106 | + queryRules, | ||
| 107 | + delRules, | ||
| 108 | +} from "@/api/configurationCenter/rules.js"; | ||
| 109 | +import { listDept } from "@/api/system/dept"; | ||
| 105 | const { proxy } = getCurrentInstance(); | 110 | const { proxy } = getCurrentInstance(); |
| 106 | const loading = ref(false); | 111 | const loading = ref(false); |
| 107 | -const total = ref(3); | 112 | +const multiple = ref(true); |
| 113 | +const ids = ref([]); | ||
| 114 | +const total = ref(0); | ||
| 115 | +const deptOptions = ref([]); | ||
| 108 | const title = ref("添加分配规则"); | 116 | const title = ref("添加分配规则"); |
| 109 | const open = ref(false); | 117 | const open = ref(false); |
| 110 | const queryParams = reactive({ | 118 | const queryParams = reactive({ |
| @@ -112,24 +120,31 @@ const queryParams = reactive({ | @@ -112,24 +120,31 @@ const queryParams = reactive({ | ||
| 112 | pageSize: 10, | 120 | pageSize: 10, |
| 113 | }); | 121 | }); |
| 114 | 122 | ||
| 115 | -const form = reactive({}); | 123 | +const form = ref({}); |
| 116 | const rules = { | 124 | const rules = { |
| 117 | - company: [ | ||
| 118 | - { required: true, message: "公司名称不能为空", trigger: "blur" }, | ||
| 119 | - { | ||
| 120 | - min: 2, | ||
| 121 | - max: 20, | ||
| 122 | - message: "公司名称长度必须介于 2 和 20 之间", | ||
| 123 | - trigger: "blur", | ||
| 124 | - }, | ||
| 125 | - ], | ||
| 126 | - orderNum: [{ required: true, message: "订单量不能为空", trigger: "blur" }], | 125 | + deptId: [{ required: true, message: "公司名称不能为空", trigger: "change" }], |
| 126 | + num: [{ required: true, message: "订单量不能为空", trigger: "blur" }], | ||
| 127 | +}; | ||
| 128 | +const rulesList = ref([]); | ||
| 129 | + | ||
| 130 | +onMounted(() => { | ||
| 131 | + getList(); | ||
| 132 | + getDeptList(); | ||
| 133 | +}); | ||
| 134 | + | ||
| 135 | +// 获取规则列表 | ||
| 136 | +const getList = async () => { | ||
| 137 | + const { data } = await queryRules(); | ||
| 138 | + rulesList.value = data; | ||
| 139 | +}; | ||
| 140 | +/** 查询部门列表 */ | ||
| 141 | +const getDeptList = () => { | ||
| 142 | + loading.value = true; | ||
| 143 | + listDept().then((response) => { | ||
| 144 | + deptOptions.value = proxy.handleTree(response.data, "deptId"); | ||
| 145 | + loading.value = false; | ||
| 146 | + }); | ||
| 127 | }; | 147 | }; |
| 128 | -const rulesList = ref([ | ||
| 129 | - { companyId: 1, company: "平安银行", orderNum: 100 }, | ||
| 130 | - { companyId: 2, company: "太平洋保险", orderNum: 200 }, | ||
| 131 | - { companyId: 3, company: "北部湾保险", orderNum: 30 }, | ||
| 132 | -]); | ||
| 133 | 148 | ||
| 134 | /** 新增按钮操作 */ | 149 | /** 新增按钮操作 */ |
| 135 | function handleAdd() { | 150 | function handleAdd() { |
| @@ -138,34 +153,52 @@ function handleAdd() { | @@ -138,34 +153,52 @@ function handleAdd() { | ||
| 138 | title.value = "添加规则"; | 153 | title.value = "添加规则"; |
| 139 | } | 154 | } |
| 140 | 155 | ||
| 156 | +/** 修改角色 */ | ||
| 157 | +function handleUpdate(row) { | ||
| 158 | + reset(); | ||
| 159 | + form.value = row; | ||
| 160 | + title.value = "修改规则"; | ||
| 161 | + open.value = true; | ||
| 162 | +} | ||
| 163 | + | ||
| 164 | +/** 删除按钮操作 */ | ||
| 165 | +function handleDelete(row) { | ||
| 166 | + const Ids = row.id ? [row.id] : ids.value; | ||
| 167 | + proxy.$modal.confirm("是否确认删除该数据项?").then(async () => { | ||
| 168 | + await delRules(Ids); | ||
| 169 | + proxy.$modal.msgSuccess("删除成功"); | ||
| 170 | + getList(); | ||
| 171 | + }); | ||
| 172 | +} | ||
| 173 | + | ||
| 141 | /** 重置操作表单 */ | 174 | /** 重置操作表单 */ |
| 142 | function reset() { | 175 | function reset() { |
| 143 | form.value = { | 176 | form.value = { |
| 144 | - companyId: undefined, | ||
| 145 | - company: undefined, | ||
| 146 | - orderNum: undefined, | 177 | + id: undefined, |
| 178 | + deptId: undefined, | ||
| 179 | + num: undefined, | ||
| 147 | }; | 180 | }; |
| 148 | proxy.resetForm("rulesRef"); | 181 | proxy.resetForm("rulesRef"); |
| 149 | } | 182 | } |
| 150 | 183 | ||
| 151 | /** 多选框选中数据 */ | 184 | /** 多选框选中数据 */ |
| 152 | function handleSelectionChange(selection) { | 185 | function handleSelectionChange(selection) { |
| 153 | - // ids.value = selection.map(item => item.roleId); | ||
| 154 | - // single.value = selection.length != 1; | ||
| 155 | - // multiple.value = !selection.length; | ||
| 156 | - console.log(selection); | 186 | + ids.value = selection.map((item) => item.roleId); |
| 187 | + multiple.value = !selection.length; | ||
| 157 | } | 188 | } |
| 158 | 189 | ||
| 159 | -const getList = () => {}; | ||
| 160 | - | ||
| 161 | /** 提交按钮 */ | 190 | /** 提交按钮 */ |
| 162 | function submitForm() { | 191 | function submitForm() { |
| 163 | - proxy.$refs["rulesRef"].validate((valid) => { | 192 | + proxy.$refs["rulesRef"].validate(async (valid) => { |
| 164 | if (valid) { | 193 | if (valid) { |
| 165 | - if (form.value.userId != undefined) { | 194 | + if (form.value.id != undefined) { |
| 195 | + await updateRules(form.value); | ||
| 166 | proxy.$modal.msgSuccess("修改成功"); | 196 | proxy.$modal.msgSuccess("修改成功"); |
| 197 | + getList(); | ||
| 167 | open.value = false; | 198 | open.value = false; |
| 168 | } else { | 199 | } else { |
| 200 | + await addRules(form.value); | ||
| 201 | + getList(); | ||
| 169 | proxy.$modal.msgSuccess("新增成功"); | 202 | proxy.$modal.msgSuccess("新增成功"); |
| 170 | open.value = false; | 203 | open.value = false; |
| 171 | } | 204 | } |
-
请 注册 或 登录 后发表评论