feat():优化业务功能 10.9

master
zhang chengzhi 2024-10-09 16:38:47 +08:00
parent b73cb23886
commit f347e98eec
3 changed files with 318 additions and 302 deletions

View File

@ -12,7 +12,7 @@ export function findInformationList(data) {
// 新增 // 新增
export function insertInformation(data) { export function insertInformation(data) {
return request({ return request({
url: '/manage/carmsg/addCarMsg', url: '/enterprise/information/insertInformation',
method: 'post', method: 'post',
data data
}) })
@ -21,7 +21,7 @@ export function insertInformation(data) {
// 修改 // 修改
export function updateInformationById(data) { export function updateInformationById(data) {
return request({ return request({
url: '/manage/carmsg/updateInformationById', url: '/enterprise/carmsg/updateInformationById',
method: 'post', method: 'post',
data data
}) })
@ -38,7 +38,7 @@ export function deleteInformationById(id) {
// 根据ID查询信息 // 根据ID查询信息
export function findInformationByid(id) { export function findInformationByid(id) {
return request({ return request({
url: '/manage/carmsg/findInformationByid?id='+id, url: '/enterprise/carmsg/findInformationByid?id='+id,
method: 'post' method: 'post'
}) })
} }

View File

@ -128,7 +128,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加或修改部门对话框 --> <!-- 添加或修改电子围栏对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="600px"> <el-dialog :title="title" :visible.sync="open" append-to-body width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>

View File

@ -34,94 +34,6 @@
<div style="height: 40px;width: 700px"> <div style="height: 40px;width: 700px">
<el-button type="danger" plain @click="handleAdd"></el-button> <el-button type="danger" plain @click="handleAdd"></el-button>
</div> </div>
<el-dialog
title="添加"
:visible.sync="dialogVisibleAdd"
width="30%"
:before-close="handleClose">
<div style="margin: 20px;"></div>
<el-form : label-width="80px" :model="insertForm">
<el-form-item label="车辆VIn马">
<el-input v-model="insertForm.carVin"></el-input>
</el-form-item>
<el-form-item label="车辆品牌">
<el-input v-model="insertForm.carBrand"></el-input>
</el-form-item>
<el-form-item label="车辆类型外键">
<el-input v-model="insertForm.typeId"></el-input>
</el-form-item>
<el-form-item label="String">
<el-input v-model="insertForm.typeName"></el-input>
</el-form-item>
<el-form-item label="电子围栏外键">
<el-input v-model="insertForm.groupId"></el-input>
</el-form-item>
<el-form-item label="车辆电机厂商">
<el-input v-model="insertForm.carMotorManufacturer"></el-input>
</el-form-item>
<el-form-item label="电机型号">
<el-input v-model="insertForm.carMotorModel"></el-input>
</el-form-item>
<el-form-item label="车辆电池厂商">
<el-input v-model="insertForm.carBatteryManufacturer"></el-input>
</el-form-item>
<el-form-item label="电池型号">
<el-input v-model="insertForm.carBatteryModel"></el-input>
</el-form-item>
<el-form-item label="围栏组编码">
<el-input v-model="insertForm.groupCode"></el-input>
</el-form-item>
<el-form-item label="启用状态">
<el-input v-model="insertForm.state"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click=doAdd()> </el-button>
</span>
</el-dialog>
<!-- 修改-->
<el-dialog
title="修改"
:visible.sync="dialogVisibleUpd"
width="30%"
:before-close="handleClose">
<div style="margin: 20px;"></div>
<el-form : label-width="80px" :model="updateForm">
<el-form-item label="车辆VIn马">
<el-input v-model="updateForm.carVin"></el-input>
</el-form-item>
<el-form-item label="车辆品牌">
<el-input v-model="updateForm.carBrand"></el-input>
</el-form-item>
<el-form-item label="车辆类型外键">
<el-input v-model="updateForm.typeId"></el-input>
</el-form-item>
<el-form-item label="电子围栏外键">
<el-input v-model="updateForm.groupId"></el-input>
</el-form-item>
<el-form-item label="车辆电机厂商">
<el-input v-model="updateForm.carMotorManufacturer"></el-input>
</el-form-item>
<el-form-item label="电机型号">
<el-input v-model="updateForm.carMotorModel"></el-input>
</el-form-item>
<el-form-item label="车辆电池厂商">
<el-input v-model="updateForm.carBatteryManufacturer"></el-input>
</el-form-item>
<el-form-item label="电池型号">
<el-input v-model="updateForm.carBatteryModel"></el-input>
</el-form-item>
<el-form-item label="围栏组编码">
<el-input v-model="updateForm.groupCode"></el-input>
</el-form-item>
<el-form-item label="启用状态">
<el-input v-model="updateForm.state"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click=doUpd()> </el-button>
</span>
</el-dialog>
<!--列表--> <!--列表-->
<template> <template>
<el-table <el-table
@ -144,8 +56,10 @@
prop="typeName"> prop="typeName">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="电子围栏外键" label="是否绑定围栏">
prop="groupId"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_car_group" :value="scope.row.groupId"/>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="车辆电机厂商" label="车辆电机厂商"
@ -182,15 +96,16 @@
<el-button type="text" @click="handleEdit(scope.row)"></el-button> <el-button type="text" @click="handleEdit(scope.row)"></el-button>
<el-button type="text" @click="handleDelete(scope.row)"></el-button> <el-button type="text" @click="handleDelete(scope.row)"></el-button>
<el-button type="text" @click="configurationStrategy(scope.row)"></el-button> <el-button type="text" @click="configurationStrategy(scope.row)"></el-button>
<el-button type="text" class="el-icon-connection" @click="boundFenceGroup(scope.row)"></el-button> <el-button type="primary" class="el-icon-connection" @click="boundFenceGroup(scope.row)" v-show="scope.row.groupId==0"></el-button>
<el-button type="success" class="el-icon-link" @click="lookboundGroup(scope.row)" v-show="scope.row.groupId==1"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</template> </template>
<el-dialog <el-dialog
title="请为你的汽车配置预警策略" title="请为你的汽车配置预警策略"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%"> width="30%">
<span> <span>
<el-select v-model="strategyId" placeholder="请选择策略"> <el-select v-model="strategyId" placeholder="请选择策略">
<el-option <el-option
@ -202,11 +117,11 @@
</el-select> </el-select>
</span> </span>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="updCarStrategyId"> </el-button> <el-button type="primary" @click="updCarStrategyId"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-drawer <el-drawer
title="绑定围栏组" title="绑定围栏组"
@ -247,7 +162,85 @@
</el-drawer> </el-drawer>
<el-dialog
title="添加"
:visible.sync="dialogVisibleAdd"
width="30%"
:before-close="handleClose">
<div style="margin: 20px;"></div>
<el-form label-width="80px" :model="insertForm">
<el-form-item label="车辆VIn马">
<el-input v-model="insertForm.carVin"></el-input>
</el-form-item>
<el-form-item label="车辆品牌">
<el-input v-model="insertForm.carBrand"></el-input>
</el-form-item>
<el-form-item label="车辆类型外键">
<el-input v-model="insertForm.typeId"></el-input>
</el-form-item>
<el-form-item label="车辆电机厂商">
<el-input v-model="insertForm.carMotorManufacturer"></el-input>
</el-form-item>
<el-form-item label="电机型号">
<el-input v-model="insertForm.carMotorModel"></el-input>
</el-form-item>
<el-form-item label="车辆电池厂商">
<el-input v-model="insertForm.carBatteryManufacturer"></el-input>
</el-form-item>
<el-form-item label="电池型号">
<el-input v-model="insertForm.carBatteryModel"></el-input>
</el-form-item>
<el-form-item label="围栏组编码">
<el-input v-model="insertForm.groupCode"></el-input>
</el-form-item>
<el-form-item label="启用状态">
<el-input v-model="insertForm.state"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click=doAdd()> </el-button>
</span>
</el-dialog>
<!-- 修改-->
<el-dialog
title="修改"
:visible.sync="dialogVisibleUpd"
width="30%"
:before-close="handleClose">
<div style="margin: 20px;"></div>
<el-form label-width="80px" :model="updateForm">
<el-form-item label="车辆VIn马">
<el-input v-model="updateForm.carVin"></el-input>
</el-form-item>
<el-form-item label="车辆品牌">
<el-input v-model="updateForm.carBrand"></el-input>
</el-form-item>
<el-form-item label="车辆类型外键">
<el-input v-model="updateForm.typeId"></el-input>
</el-form-item>
<el-form-item label="车辆电机厂商">
<el-input v-model="updateForm.carMotorManufacturer"></el-input>
</el-form-item>
<el-form-item label="电机型号">
<el-input v-model="updateForm.carMotorModel"></el-input>
</el-form-item>
<el-form-item label="车辆电池厂商">
<el-input v-model="updateForm.carBatteryManufacturer"></el-input>
</el-form-item>
<el-form-item label="电池型号">
<el-input v-model="updateForm.carBatteryModel"></el-input>
</el-form-item>
<el-form-item label="围栏组编码">
<el-input v-model="updateForm.groupCode"></el-input>
</el-form-item>
<el-form-item label="启用状态">
<el-input v-model="updateForm.state"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click=doUpd()> </el-button>
</span>
</el-dialog>
</div> </div>
@ -265,226 +258,249 @@ import {
updCarStrategyId updCarStrategyId
} from '@/api/system/manage/carInformation' } from '@/api/system/manage/carInformation'
import { findStrategyListByCarTypeId, updateStrategy } from '@/api/warning/strategy' import { findStrategyListByCarTypeId, updateStrategy } from '@/api/warning/strategy'
import { boundGroupAndCar, selectAllGroup } from '@/api/fence/group' import { boundGroupAndCar, getGroupListResp, selectAllGroup } from '@/api/fence/group'
export default { export default {
//import使" dicts: ['sys_car_group'],
components: {}, //import使"
props: {}, components: {},
data() { props: {},
//" data() {
return { //"
GroupAndCarBound:{ return {
vin:null, GroupAndCarBound:{
// vin:null,
groupListResp: [], //
}, groupListResp: [],
insertForm: {},
updateForm: {},
//
groupList:[],
//
drawer:false,
//
direction:'rtl',
dialogVisibleAdd: false,
dialogVisibleUpd: false,
strategyId:null,
carId:null,
dialogVisible: false,
tableData: [],
//
selectInformation: {
pageNum: 1,
pageSize: 10,
carVin:'',
carType:'',
groupCode:'',
state:'1',
carMotorManufacturer:'',
carBatteryManufacturer:''
},
zt:{
status: ""
},
strategyList:[],
queryParams:{},
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
dobound(){
boundGroupAndCar(this.GroupAndCarBound).then(res=>{
this.$modal.msgSuccess("绑定成功");
this.drawer=false;
})
},
handleSelectionChange(val) {
this.GroupAndCarBound.groupListResp = val;
}, },
//
groupList:[],
//
drawer:false,
//
direction:'rtl',
handleClose(done) { strategyId:null,
this.$confirm('确认关闭?') carId:null,
.then(_ => { dialogVisible: false,
done(); tableData: [],
})
.catch(_ => {});
},
boundFenceGroup(row){ //
this.GroupAndCarBound.vin=row.carVin; selectInformation: {
selectAllGroup().then(res=>{ pageNum: 1,
pageSize: 10,
carVin:'',
carType:'',
groupCode:'',
state:'1',
carMotorManufacturer:'',
carBatteryManufacturer:''
},
zt:{
status: ""
},
strategyList:[],
queryParams:{},
this.groupList = res.data; insertForm: {},
updateForm: {},
dialogVisibleAdd: false,
dialogVisibleUpd: false,
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
console.log(this.groupList); lookboundGroup(row){
this.drawer =true; selectAllGroup().then(res=>{
}) this.groupList = res.data;
})
this.drawer=true;
}, getGroupListResp(row).then(res=>{
updCarStrategyId(){
updCarStrategyId(this.carId,this.strategyId).then((res)=>{
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
})
},
/** 给车辆配置策略*/
configurationStrategy(row){
this.dialogVisible = true
this.carId=row.id
this.getStrategyList(row.typeId);
},
getStrategyList(typeId) { let rows = res.data;
this.loading = true; console.log(rows)
findStrategyListByCarTypeId(typeId).then(response => { if (rows!=null&&rows!=undefined&&rows!=''){
this.strategyList = response.data.rows; rows.forEach(row => {
this.total = response.data.total; console.log(this.groupList[row.id-1]);
this.loading = false; console.log(row);
console.log(response) this.$refs.multipleTable.toggleRowSelection(this.groupList[row.id-1]);
}); });
},
/** 列表 */
getList() {
findInformationList(this.selectInformation).then(res => {
this.tableData = res.data;
}
);
},
//
handleStatusChange(row) {
let text = row.state === "0" ? "上线" : "下线";
this.$modal.confirm('确认要"' + text + '""' + row.carBrand + '"车辆吗?').then(function () {
return gaiZhuangTai(row.id, row.state);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function () {
row.state = row.state === "0" ? "1" : "0";
});
},
//
onSubmit(){
this.getList(this.selectInformation);
},
//
chongzhi(){
this.selectInformation={
carVin:'',
carType:'',
groupCode:'',
state:'',
carMotorManufacturer:'',
carBatteryManufacturer:''
} }
this.getList();
},
//
handleEdit(row){
this.dialogVisibleUpd = true
//
findInformationByid(row.id).then(res=>{
this.updateForm = res.data;
})
},
/** 删除 */
handleDelete(row){
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteInformationById(row.id).then(res=>{
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
})
})
},
//
handleAdd(){
this.dialogVisibleAdd = true
},
doAdd(){
insertInformation(this.insertForm).then(res=>{
alert(res.msg)
if(res.code == 200){
alert("添加成功")
this.getList();
}
})
},
doUpd(){
updateInformationById(this.updateForm).then(res=>{
alert(res.msg)
if(res.code == 200){
alert("修改成功")
this.getList();
}
}) })
}, },
dobound(){
boundGroupAndCar(this.GroupAndCarBound).then(res=>{
this.$modal.msgSuccess("绑定成功");
this.drawer=false;
})
},
handleSelectionChange(val) {
this.GroupAndCarBound.groupListResp = val;
}, },
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},
// - 访this", boundFenceGroup(row){
created() { this.GroupAndCarBound.vin=row.carVin;
selectAllGroup().then(res=>{
this.groupList = res.data;
console.log(this.groupList);
this.drawer =true;
})
},
updCarStrategyId(){
updCarStrategyId(this.carId,this.strategyId).then((res)=>{
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
})
},
/** 给车辆配置策略*/
configurationStrategy(row){
this.dialogVisible = true
this.carId=row.id
this.getStrategyList(row.typeId);
},
getStrategyList(typeId) {
this.loading = true;
findStrategyListByCarTypeId(typeId).then(response => {
this.strategyList = response.data.rows;
this.total = response.data.total;
this.loading = false;
console.log(response)
});
},
/** 列表 */
getList() {
findInformationList(this.selectInformation).then(res => {
this.tableData = res.data;
}
);
},
//
handleStatusChange(row) {
let text = row.state === "0" ? "上线" : "下线";
this.$modal.confirm('确认要"' + text + '""' + row.carBrand + '"车辆吗?').then(function () {
return gaiZhuangTai(row.id, row.state);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function () {
row.state = row.state === "0" ? "1" : "0";
});
},
//
onSubmit(){
this.getList(this.selectInformation);
},
//
chongzhi(){
this.selectInformation={
carVin:'',
carType:'',
groupCode:'',
state:'',
carMotorManufacturer:'',
carBatteryManufacturer:''
}
this.getList(); this.getList();
}, },
// - 访DOM", //
mounted() { handleEdit(row){
this.dialogVisibleUpd = true
//
findInformationByid(row.id).then(res=>{
this.updateForm = res.data;
})
}, },
beforeCreate() { /** 删除 */
}, // - ", handleDelete(row){
beforeMount() { this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
}, // - ", confirmButtonText: '确定',
beforeUpdate() { cancelButtonText: '取消',
}, // - ", type: 'warning'
updated() { }).then(() => {
}, // - ", deleteInformationById(row.id).then(res=>{
beforeDestroy() { this.$message({
}, // - ", type: 'success',
destroyed() { message: '删除成功!'
}, // - ", });
activated() { this.getList();
} //keep-alive", })
}; })
},
//
handleAdd(){
this.dialogVisibleAdd = true
},
doAdd(){
insertInformation(this.insertForm).then(res=>{
alert(res.msg)
if(res.code == 200){
alert("添加成功")
this.getList();
}
})
},
doUpd(){
updateInformationById(this.updateForm).then(res=>{
alert(res.msg)
if(res.code == 200){
alert("修改成功")
this.getList();
}
})
},
},
// - 访this",
created() {
this.getList();
},
// - 访DOM",
mounted() {
},
beforeCreate() {
}, // - ",
beforeMount() {
}, // - ",
beforeUpdate() {
}, // - ",
updated() {
}, // - ",
beforeDestroy() {
}, // - ",
destroyed() {
}, // - ",
activated() {
} //keep-alive",
};
</script> </script>
<style scoped> <style scoped>