feat():修复车辆管理前台问题

dev.saas
ruyaxie 2024-09-21 12:15:14 +08:00
parent 76309559a2
commit c3899c4f3c
3 changed files with 83 additions and 1 deletions

View File

@ -42,3 +42,4 @@ export function delCar(id) {
method: 'delete'
})
}

View File

@ -52,6 +52,12 @@ export function resetForm(refName) {
this.$refs[refName].resetFields();
}
}
// // 表单重置
// export function resetFormList(refName) {
// if (this.$refs[refName]) {
// this.$refs[refName].resetFields();
// }
// }
// 添加日期范围
export function addDateRange(params, dateRange, propName) {

View File

@ -107,6 +107,13 @@
@click="handleDelete(scope.row)"
v-hasPermi="['car:car:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAddStrategy(scope.row)"
v-hasPermi="['car:car:add']"
>添加策略信息</el-button>
</template>
</el-table-column>
</el-table>
@ -155,11 +162,41 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加预警策略对话框 -->
<el-dialog :title="title" :visible.sync="beginOpen" width="500px" append-to-body>
<el-form ref="formList" :model="formList" :rules="rules" label-width="80px">
<el-form-item label="车辆类型id" prop="carTypeId">
<el-input v-model="formList.carTypeId" placeholder="请输入车辆类型id" />
</el-form-item>
<el-form-item label="策略名称" prop="strategyName">
<el-input v-model="formList.strategyName" placeholder="请输入策略名称" />
</el-form-item>
<el-form-item label="报文模版id" prop="msgId">
<!-- <el-input v-model="formList.msgId" placeholder="请输入报文模版id" />-->
<el-select v-model="formList.msgId" placeholder="请选择报文模版id">
<el-option
v-for="item in templateList"
:key="item.messageTemplateId"
:label="item.messageTemplateName"
:value="item.messageTemplateId">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitAddForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listCar, getCar, delCar, addCar, updateCar} from "/src/api/car/car";
import {templateList} from "@/api/car/message/template";
import {addStrategy} from "@/api/platform/strategy";
export default {
name: "Car",
@ -179,10 +216,12 @@ export default {
total: 0,
//
carList: [],
templateList:[],
//
title: "",
//
open: false,
beginOpen:false,
//
queryParams: {
pageNum: 1,
@ -196,6 +235,7 @@ export default {
},
//
form: {},
formList:{},
//
rules: {
}
@ -242,8 +282,18 @@ export default {
updateTime: null,
remark: null
};
this.resetForm("form");
},
//
init() {
this.formList= {
carTypeId: null,
strategyName: null,
msgId: null
};
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -266,6 +316,22 @@ export default {
this.open = true;
this.title = "添加车辆基础信息";
},
/** 添加策略信息按钮 **/
handleAddStrategy(row) {
this.init();
const id = row.id || this.ids
getCar(id).then(response => {
this.formList.carTypeId = response.data.id;
this.beginOpen = true;
this.title ="添加策略信息";
});
templateList().then(response => {
this.templateList = response.data;
console.log(this.templateList);
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
@ -296,6 +362,14 @@ export default {
}
});
},
/** 添加策略信息**/
submitAddForm(){
addStrategy(this.formList).then(response => {
this.$modal.msgSuccess("添加策略信息成功");
this.beginOpen = false;
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
@ -306,6 +380,7 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('car/car/export', {