From cc8f0bb4e4586e89e628efec167704ea54893a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9C=8B?= Date: Fri, 12 Apr 2024 18:11:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vehicles/components/AddNEditDialog.vue | 47 ++++++------------- .../views/vehicles/data.js | 22 +++++---- .../views/vehicles/index.vue | 9 ++-- 3 files changed, 33 insertions(+), 45 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/components/AddNEditDialog.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/components/AddNEditDialog.vue index e7054d3f..e535c09b 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/components/AddNEditDialog.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/components/AddNEditDialog.vue @@ -116,6 +116,7 @@ export default { label: "车辆状态:", key: "vehicleStatus", type: "select", + required: true, options: { options: [ { @@ -160,19 +161,19 @@ export default { handler(bool) { if (!bool) return; - console.log("vehicleTypeList:",this.vehicleTypeList); - - let abc = this.vehicleTypeList.map((item) => ({ + this.formList.filter((item) => item.key == "vehicleType")[0].options.options = this.vehicleTypeList.map((item) => ({ key: item.dictValue, label: item.dictLabel, - })) - console.log("-----1:",abc); + })); + + if(this.data){ + this.formData = this.data; + this.formData.vehicleType = this.data.vehicleType.toString(); + }else{ + this.formData = null; + } - this.formData = !this.data ? null : { - organizationId: this.data.organizationId, - vehiclePlate: this.data.vehiclePlate, - vehicleType: this.data.vehicleType, - }; + this.$forceUpdate(); }, }, }, @@ -180,40 +181,20 @@ export default { async getOptions() { - // this.vehicleTypeList.map((item) => ({ - // key: item.dictValue, - // label: item.dictLabel, - // })) - // console.log("-----1:",this.vehicleTypeList); - - console.log("this.vehicleTypeList:",this.vehicleTypeList); - - const result = await getSelectOptionsStation(1); + const result = await getSelectOptionsStation(); this.formList[0].options.options = result; this.formList[0].default = result[0].key; - // this.formList[0].options.options.push({ - // disabled: false, - // key: 0, - // label: "无", - // }); - // console.log(this.formList[0].options.options); }, handleSubmit() { this.$refs.FormConfigRef.validate().then((data) => { this.submitting = true; - if (this.data) data.id = this.data.dcOrganizations.id; + if (this.data) data.id = this.data.id; - if (typeof data.parentId != "number") data.parentId = 0; - if (data.stakeMark[0]) { - data.stakeMark = `K${data.stakeMark[0]}+${data.stakeMark[1]}`; - } else { - data.stakeMark = ""; - } request({ - url: `/business/organization`, + url: `/business/vehicles`, method: this.data ? "PUT" : "POST", data, }) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/data.js b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/data.js index 896354e5..907c7fc4 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/data.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/data.js @@ -2,26 +2,30 @@ export const searchFormList = [ { - label: "机构类型:", - key: "organizationType", + label: "车辆类型:", + key: "vehicleType", + type: "select", + options: { + clearable: true, + options: [], + }, + }, + { + label: "车辆状态:", + key: "vehicleStatus", type: "select", options: { clearable: true, options: [ { key: 1, - label: "运营中心", + label: "可用", }, { key: 2, - label: "驻点", + label: "使用中", }, ], }, }, - { - label: "机构名称:", - key: "organizationName", - type: "input", - }, ]; diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/index.vue index 8ba43854..d01e108c 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/vehicles/index.vue @@ -112,7 +112,7 @@ export default { key: "vehicleType", label: "车辆类型", value: (item) => { - return this.vehicleTypeList.find((dicts) => dicts.dictValue == item.vehicleStatus).dictLabel; + return this.vehicleTypeList.find((dicts) => dicts.dictValue == item.vehicleType).dictLabel; }, }, { @@ -147,6 +147,10 @@ export default { .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) => {}); }, @@ -154,7 +158,7 @@ export default { await confirm({ message: "是否要删除该车辆?" }); request({ - url: `/business/vehicles/${data.dcvehicless.id}`, + url: `/business/vehicles/${data.id}`, method: "DELETE", data: {}, }) @@ -171,7 +175,6 @@ export default { handleOpenDialogAddEdit(data) { this.addNEditDialogVisible = true; this.dialogData = data; - console.log("Dialog", data); }, handleSearch(data) {