| | |
| | | :is-selection="true" |
| | | :border="true" |
| | | :table-loading="tableLoading" |
| | | :table-style="{ width: '100%', height: 'calc(100vh - 21.5em)' }" |
| | | :table-style="{ width: '100%', height: 'calc(100vh - 18.5em)' }" |
| | | :page="{ |
| | | current: page.current, |
| | | size: page.size, |
| | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | |
| | | size: 100, |
| | | }); |
| | | const usageRecordsTotal = ref(0); |
| | | const usageRecordsColumns = ref([ |
| | | { label: "车牌号", prop: "plateNumber", width: "120" }, |
| | | { label: "使用人", prop: "userName", width: "120" }, |
| | | { label: "目的地", prop: "destination", width: "150" }, |
| | | { label: "使用时间", prop: "useTime", width: "180" }, |
| | | { label: "还车时间", prop: "returnTime", width: "180" }, |
| | | { label: "使用前里程(km)", prop: "odometerBefore", width: "130" }, |
| | | { label: "还车时里程(km)", prop: "odometerAfter", width: "130" }, |
| | | { label: "本次行驶里程(km)", prop: "travelDistance", width: "140" }, |
| | | ]); |
| | | const currentVehicleId = ref(null); |
| | | |
| | | // 用户信息表单弹框数据 |
| | |
| | | }, |
| | | ]); |
| | | |
| | | // 使用记录表格列配置 |
| | | const usageRecordsColumns = ref([ |
| | | { label: "车牌号", prop: "plateNumber", width: "120" }, |
| | | { label: "使用人", prop: "userName", width: "120" }, |
| | | { label: "目的地", prop: "destination", width: "150" }, |
| | | { label: "使用时间", prop: "useTime", width: "180" }, |
| | | { label: "还车时间", prop: "returnTime", width: "180" }, |
| | | { label: "使用前里程(km)", prop: "odometerBefore", width: "130" }, |
| | | { label: "还车时里程(km)", prop: "odometerAfter", width: "130" }, |
| | | { label: "本次行驶里程(km)", prop: "travelDistance", width: "140" }, |
| | | ]); |
| | | |
| | | // 查询列表 |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | |
| | | odometer: 0, |
| | | remark: "", |
| | | }; |
| | | |
| | | let userLists = await userListNoPage(); |
| | | |
| | | const userLists = await userListNoPage(); |
| | | userList.value = userLists.data || []; |
| | | |
| | | if (type !== "add") { |
| | | currentId.value = row.id; |
| | | getVehicleById(row.id).then((res) => { |
| | | form.value = { ...res.data || res }; |
| | | form.value = { ...(res.data || res) }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "add") { |
| | | addVehicle(form.value).then((res) => { |
| | | addVehicle(form.value).then(() => { |
| | | proxy.$modal.msgSuccess("新增成功"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } else { |
| | | form.value.id = currentId.value; |
| | | updateVehicle(form.value).then((res) => { |
| | | updateVehicle(form.value).then(() => { |
| | | proxy.$modal.msgSuccess("修改成功"); |
| | | closeDia(); |
| | | getList(); |
| | |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | |
| | | // 打开发货弹框 |
| | | // 打开使用车辆弹框 |
| | | const openUseForm = async (row) => { |
| | | currentUseRow.value = row; |
| | | useForm.value = { |
| | |
| | | userId: "", |
| | | remark: "", |
| | | }; |
| | | |
| | | let userLists = await userListNoPage(); |
| | | |
| | | const userLists = await userListNoPage(); |
| | | userList.value = userLists.data || []; |
| | | |
| | | |
| | | useFormVisible.value = true; |
| | | }; |
| | | |
| | |
| | | const submitUseForm = () => { |
| | | proxy.$refs["useFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | useVehicle(useForm.value).then((res) => { |
| | | useVehicle(useForm.value).then(() => { |
| | | proxy.$modal.msgSuccess("使用车辆成功"); |
| | | closeUseDia(); |
| | | getList(); |
| | |
| | | userId: "", |
| | | remark: "", |
| | | }; |
| | | |
| | | let userLists = await userListNoPage(); |
| | | |
| | | const userLists = await userListNoPage(); |
| | | userList.value = userLists.data || []; |
| | | |
| | | |
| | | returnFormVisible.value = true; |
| | | }; |
| | | |
| | |
| | | const submitReturnForm = () => { |
| | | proxy.$refs["returnFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | returnVehicle(returnForm.value).then((res) => { |
| | | returnVehicle(returnForm.value).then(() => { |
| | | proxy.$modal.msgSuccess("还车成功"); |
| | | closeReturnDia(); |
| | | getList(); |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delVehicle(ids).then((res) => { |
| | | delVehicle(ids).then(() => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }); |