Compare commits

...

5 Commits

  1. 8
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/index.vue
  2. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/components/AddNEditDialog.vue
  3. 241
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/components/AddNEditDialog.vue
  4. 31
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/data.js
  5. 267
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/index.vue

8
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/index.vue

@ -25,6 +25,7 @@ import DutyOfficer from "./views/dutyOfficer/index.vue";
import EmergencyAgencies from "./views/emergencyAgencies/index.vue";
import JurisdictionalManagement from "./views/jurisdictionalManagement/index.vue";
import FirstResponders from "./views/firstResponders/index.vue";
import Vehicles from "./views/vehicles/index.vue";
export default {
name: 'BusinessDataManagement',
@ -35,7 +36,8 @@ export default {
DutyOfficer,
EmergencyAgencies,
FirstResponders,
JurisdictionalManagement
JurisdictionalManagement,
Vehicles
},
provide() {
return {
@ -67,6 +69,10 @@ export default {
label: "辖段管理",
key: "JurisdictionalManagement"
},
{
label: "车辆管理",
key: "vehicles"
},
],
total: 0,
currentPage: 1

2
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/components/AddNEditDialog.vue

@ -81,7 +81,7 @@ export default {
},
{
key: 2,
label: "应急人员",
label: "交警人员",
},
],
},

241
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/components/AddNEditDialog.vue

@ -0,0 +1,241 @@
<template>
<Dialog v-model="modelVisible" :title="data ? '修改' : '新增'" width="550px">
<div class="AddNEditDialog">
<Form
v-model="formData"
class="form"
ref="FormConfigRef"
:formList="formList"
column="1"
labelWidth="90px"
/>
</div>
<template #footer>
<Button
style="background-color: rgba(0, 179, 204, 0.3)"
@click.native="(modelVisible = false), (submitting = false)"
>
取消
</Button>
<Button @click.native="handleSubmit" :loading="submitting"> 确定 </Button>
</template>
</Dialog>
</template>
<script>
import Dialog from "@screen/components/Dialog/index.vue";
import Button from "@screen/components/Buttons/Button.vue";
import Form from "@screen/components/FormConfig";
import * as PresetFormItems from "@screen/common/PresetFormItems.js";
import request from "@/utils/request";
import { CameraDirectionEnumList } from "@screen/utils/enum.js";
import { Message } from "element-ui";
import { cloneDeep, merge } from "lodash";
import { getSelectOptionsStation } from "@screen/pages/control/event/businessDataManagement/utils.js";
export default {
name: "AddNEditDialog",
components: {
Dialog,
Button,
Form,
},
model: {
prop: "visible",
event: "update:value",
},
props: {
visible: Boolean,
data: Object,
vehicleTypeList:Array
},
inject: ["setCurrentPage"],
data() {
return {
submitting: false,
formData: {},
formList: [
{
label: "所属机构:",
key: "organizationId",
type: "select",
options: {
clearable: false,
options: [],
},
},
// {
// label: "2233:",
// key: "organizationType",
// required: true,
// type: 'select',
// ons: {
// change: (value, { data }) => {
// if (value == 1) {
// data.parentId = null;
// }
// this.formList[0].options.options.forEach((item, index) => {
// item.disabled = value == 1
// })
// }
// },
// options: {
// options: [
// {
// key: 1,
// label: ""
// },
// {
// key: 2,
// label: ""
// },
// ]
// }
// },
{
label: "车牌号:",
key: "vehiclePlate",
required: true,
},
{
label: "车辆类型:",
key: "vehicleType",
required: true,
type: "select",
options: {
options: this.vehicleTypeList.map((item) => ({
key: item.dictValue,
label: item.dictLabel,
})),
},
},
{
label: "车辆状态:",
key: "vehicleStatus",
type: "select",
required: true,
options: {
options: [
{
key: 1,
label: "可用",
},
{
key: 2,
label: "使用中",
}
]
}
},
{
label: "备注:",
key: "remark",
isAlone: true,
options: {
type: "textarea",
autosize: true,
maxlength: 150,
autosize: { minRows: 6, maxRows: 6 },
showWordLimit: true,
},
},
],
};
},
computed: {
modelVisible: {
get() {
return this.visible;
},
set(val) {
this.$emit("update:value", val);
},
},
},
watch: {
modelVisible: {
immediate: true,
handler(bool) {
if (!bool) return;
this.formList.filter((item) => item.key == "vehicleType")[0].options.options = this.vehicleTypeList.map((item) => ({
key: item.dictValue,
label: item.dictLabel,
}));
if(this.data){
this.formData = this.data;
this.formData.vehicleType = this.data.vehicleType.toString();
}else{
this.formData = null;
}
this.$forceUpdate();
},
},
},
methods: {
async getOptions() {
const result = await getSelectOptionsStation();
this.formList[0].options.options = result;
this.formList[0].default = result[0].key;
},
handleSubmit() {
this.$refs.FormConfigRef.validate().then((data) => {
this.submitting = true;
if (this.data) data.id = this.data.id;
request({
url: `/business/vehicles`,
method: this.data ? "PUT" : "POST",
data,
})
.then((result) => {
if (result.code != 200) return Message.error(`提交失败!`);
Message.success(`提交成功!`);
this.modelVisible = false;
this.setCurrentPage(1);
})
.catch((err) => {
console.log(
"%c [ err ]-110-「DeviceControlDialog.vue」",
"font-size:15px; background:#547bf2; color:#98bfff;",
err
);
Message.error(`提交失败!`);
})
.finally(() => {
this.submitting = false;
});
});
},
},
mounted() {
this.getOptions();
},
};
</script>
<style lang="scss" scoped>
.AddNEditDialog {
width: 450px;
display: flex;
flex-direction: column;
gap: 15px;
.tips {
font-size: 12px;
}
}
</style>

31
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/data.js

@ -0,0 +1,31 @@
// import * as PresetFormItems from "@screen/pages/control/event/event/FormEvent/PresetFormItems.js";
export const searchFormList = [
{
label: "车辆类型:",
key: "vehicleType",
type: "select",
options: {
clearable: true,
options: [],
},
},
{
label: "车辆状态:",
key: "vehicleStatus",
type: "select",
options: {
clearable: true,
options: [
{
key: 1,
label: "可用",
},
{
key: 2,
label: "使用中",
},
],
},
},
];

267
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/index.vue

@ -0,0 +1,267 @@
<template>
<div class="Vehicles">
<div class="filter">
<div>
<ButtonGradient @click.native="handleOpenDialogAddEdit()">
<template #prefix>
<img src="@screen/images/insert.svg" />
</template>
新增
</ButtonGradient>
<ButtonGradient @click.native="handleExport">
<template #prefix>
<img src="@screen/images/export.svg" />
</template>
导出
</ButtonGradient>
<ButtonGradient @click.native="onRefreshForm">
<template #prefix>
<img src="@screen/images/refresh.svg" />
</template>
刷新
</ButtonGradient>
</div>
<InputSearch
ref="searchComp"
style="width: 402px"
:formList="searchFormList"
:formConfigOptions="{ labelWidth: '90px' }"
@handleSearch="handleSearch"
/>
</div>
<div class="body">
<!-- <ElEmpty v-if="!data.length && !isFirst" description="暂无数据" style="width: 100%;height: 100%;position: absolute;" /> -->
<div
v-if="!dataList.length && !isFirst"
class="no-data"
style="position: absolute"
>
暂无数据
</div>
<template v-else>
<Card
v-for="(item, index) in dataList"
:keyMap="keyMap"
:cardData="item"
:key="index"
>
<template #button>
<Button @click.native="() => handleOpenDialogAddEdit(item)">
修改
</Button>
<Button
style="background-color: #ff5f5f"
@click.native="handleDelete(item)"
>
删除
</Button>
</template>
</Card>
</template>
</div>
<AddNEditDialog v-model="addNEditDialogVisible" :data="dialogData" :vehicleTypeList="vehicleTypeList" />
</div>
</template>
<script>
import Card from "@screen/components/Card1/index.vue";
import InputSearch from "@screen/components/InputSearch/index.vue";
import ButtonGradient from "@screen/components/Buttons/ButtonGradient.vue";
import Button from "@screen/components/Buttons/Button.vue";
import AddNEditDialog from "./components/AddNEditDialog.vue";
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js";
import { delay, exportFile, confirm } from "@screen/utils/common";
import { Message } from "element-ui";
// let vehicleTypeList = [];
//
export default {
name: "Vehicles",
inject: ["getPagination", "setTotal", "setCurrentPage"],
components: {
Card,
ButtonGradient,
InputSearch,
Button,
AddNEditDialog,
},
data() {
return {
searchFormList,
addNEditDialogVisible: false,
dialogData: null,
dataList: [],
keyMap: [
{
key: "organizationName",
label: "机构名称",
},
{
key: "vehiclePlate",
label: "车牌号",
},
{
key: "vehicleType",
label: "车辆类型",
value: (item) => {
return this.vehicleTypeList.find((dicts) => dicts.dictValue == item.vehicleType).dictLabel;
},
},
{
key: "vehicleStatus",
label: "车辆状态",
value: (item) => {
return item.vehicleStatus == 1 ? "可用" : "使用中";
},
}
],
isFirst: true,
vehicleTypeList: [],
};
},
created() {
this.getData();
this.getVehicleTypeList();
},
methods: {
onRefreshForm(){
this.$refs.searchComp.handleResetForm();
this.setCurrentPage(1);
},
getVehicleTypeList() {
if (this.vehicleTypeList.length) return;
request({
url: `/system/dict/data/type/vehicle_type`,
method: "GET",
params: {},
})
.then(({ data, code }) => {
if (code != 200) return; //Message.error("");
this.vehicleTypeList = data;
searchFormList.filter((item) => item.key == "vehicleType")[0].options.options = this.vehicleTypeList.map((item) => ({
key: item.dictValue,
label: item.dictLabel,
}));
})
.catch((err) => {});
},
async handleDelete(data) {
await confirm({ message: "是否要删除该车辆?" });
request({
url: `/business/vehicles/${data.id}`,
method: "DELETE",
data: {},
})
.then((result) => {
if (result.code != 200) return Message.error(`删除失败!`);
this.setCurrentPage(1);
Message.success(`删除成功!`);
})
.catch((err) => {
Message.error(`删除失败!`);
});
},
handleOpenDialogAddEdit(data) {
this.addNEditDialogVisible = true;
this.dialogData = data;
},
handleSearch(data) {
this.searchData = data;
this.getData();
},
handleExport() {
exportFile({
url: "/business/vehicles/export",
filename: "车辆列表",
data: {
...this.searchData,
...this.getPagination(),
},
});
},
async getData() {
const closeLoading = setLoading();
await delay(150);
request({
url: `/business/vehicles/list`,
method: "get",
params: {
...this.searchData,
...this.getPagination(),
},
})
.then((result) => {
if (result.code != 200) return;
this.dataList = result.rows;
// let data = [];
// this.vehicleTypeList.forEach((items) => {
// this.dataList.forEach((item) => {
// if (item.car.length > 0) {
// for (var i = 0; i < item.car.length; i++) {
// if (item.car[i].vehicleType == items.dictValue) {
// data.push(items.dictLabel + "*" + item.car[i].carNum);
// // item.cars = items.dictLabel + "*" + item.car[i].carNum;
// }
// }
// }
// });
// });
// this.dataList.forEach((item) => {
// if (item.car.length > 0) {
// item.cars = data.join("");
// }
// });
this.setTotal(result.total);
})
.finally(() => {
closeLoading();
this.isFirst = false;
});
},
},
};
</script>
<style lang="scss" scoped>
.Vehicles {
.body {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 21px;
// grid-row-gap: 9px;
// grid-column-gap: 9px;
grid-auto-rows: min-content;
.endSpecial {
font-size: 14px;
font-weight: 400;
color: #00b3cc;
line-height: 16px;
span:first-child {
color: rgba(0, 179, 204, 1) #000;
}
span:last-child {
color: rgba(217, 0, 27, 1);
}
}
}
}
</style>
Loading…
Cancel
Save