合并分支

master
fanluyan 2 years ago
commit 7bf6a3e8b0

@ -149,6 +149,30 @@ export function getScheduleRulelListJoggle(data) {
data, data,
}); });
} }
//2.新增任务规则
export function addScheduleRulel(data) {
return request({
url: "/test/addSchelduleRuleList",
method: "post",
data,
});
}
//3.删除任务规则
export function deleteScheduleRulel(data) {
return request({
url: "/test/deleteSchelduleRule",
method: "post",
data,
});
}
//4.修改任务规则
export function updateScheduleRulel(data) {
return request({
url: "/test/updateSchelduleRule",
method: "post",
data,
});
}
//线路信息管理接口数据 //线路信息管理接口数据
//获取电压等级列表 //获取电压等级列表

@ -1,31 +1,130 @@
<template> <template>
<el-dialog <el-dialog
class="adddeviceDialog" class="addLineDialog"
:title="deviceDialogTitle" :title="title"
:visible.sync="deviceDialog" :visible.sync="isShow"
width="420px" :close-on-click-modal="false"
width="40%"
> >
<p>内容</p> <el-form
label-position="left"
ref="formInfo"
label-width="100px"
:rules="rules"
:model="formdata"
>
<el-form-item label="名称:" prop="name">
<el-input
v-model="formdata.name"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item label="时间:" prop="time">
<el-time-picker
is-range
v-model="formdata.time"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="HH:mm:ss">
</el-time-picker>
</el-form-item>
<el-form-item label="间隔:" prop="span">
<!-- <el-input v-model="formdata.span" autocomplete="off" type="number"></el-input> -->
<el-input-number v-model="formdata.span" :min="1" ></el-input-number>
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input v-model="formdata.remark" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="closeDialog()"> </el-button> <el-button @click="isShow = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button> <el-button type="primary" @click="submitForm()"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { addScheduleRulel, updateScheduleRulel } from "@/utils/api/index";
export default { export default {
props: {}, props: {
title:String
},
data() { data() {
return {}; return {
isShow: false,
formdata: {},
rules: {
name: [
{ required: true, message: "请输入名称", trigger: "blur" },
],
time: [
{ required: true, message: "请选择时间", trigger: "blur" },
],
span: [
{ required: true, message: "请输入间隔", trigger: "blur", },
],
remark: [
{ required: true, message: "请输入备注", trigger: "blur", },
],
}
};
}, },
methods: { methods: {
//
getdataform(val){
console.log(val)
if (val==null) {
return this.formdata = {}
}
this.formdata = val
this.$set(this.formdata,'time',[val.startTime, val.endTime])
},
// //
submitForm() {}, submitForm() {
// this.$refs.formInfo.validate((valid) => {
closeDialog(flag) {}, if (valid) {
this.formdata.startTime=this.formdata.time[0]
this.formdata.endTime=this.formdata.time[1]
delete this.formdata.time
if (this.title == "新增") {
let formArr=[]
formArr.push(this.formdata)
addScheduleRulel({ list: formArr })
.then((res) => {
this.isShow = false
this.$message.success("添加成功");
this.$parent.deviceList()
})
.catch((err) => {
this.$message.error("添加失败");
});
} else {
updateScheduleRulel(this.formdata)
.then((res) => {
this.isShow = false
this.$message.success("修改成功");
this.$parent.deviceList()
})
.catch((err) => {
this.$message.error("修改失败");
});
}
} else {
console.log("error submit!!");
return false;
}
});
},
display() {
this.isShow = true
},
hide() {
this.isShow = false
}
},
mounted() {
}, },
mounted() {},
watch: {},
}; };
</script> </script>

@ -2,7 +2,7 @@
<div class="deviceInformation"> <div class="deviceInformation">
<div class="deviceBox"> <div class="deviceBox">
<div class="deviceBtnGroup"> <div class="deviceBtnGroup">
<el-button type="primary" icon="el-icon-plus" @click="handleAdddevice()" <el-button type="primary" icon="el-icon-plus" @click.native.stop="handleAdddevice()"
>新增</el-button >新增</el-button
> >
</div> </div>
@ -71,38 +71,42 @@
</div> </div>
</div> </div>
<!-- 新增线路 --> <!-- 新增线路 -->
<adddeviceDialog :title="title" ref="adddeviceDialogref" ></adddeviceDialog>
</div> </div>
</template> </template>
<script> <script>
import { getScheduleRulelListJoggle } from "@/utils/api/index"; import { getScheduleRulelListJoggle,deleteScheduleRulel } from "@/utils/api/index";
import adddeviceDialog from "./components/adddeviceDialog.vue";
export default { export default {
components: {}, components: {
adddeviceDialog
},
data() { data() {
return { return {
deviceDialogTitle: "", // title: "", //
deviceDialog: false,
formdeviceInfo: {}, //
deviceTableData: [], deviceTableData: [],
//multipleSelection: [], // //multipleSelection: [], //
//
deleteArr: [],
page: 1, // page: 1, //
pageSize: 20, // pageSize: 10, //
total: 0, // total: 0, //
}; };
}, },
created() {
this.deviceList();
},
methods: { methods: {
//线 //线
deviceList() { deviceList() {
getScheduleRulelListJoggle() getScheduleRulelListJoggle({
pageindex: this.page,
pagesize: this.pageSize
})
.then((res) => { .then((res) => {
console.log(res);
this.deviceTableData = res.data.list; this.deviceTableData = res.data.list;
this.total = res.data.total
}) })
.catch((err) => { .catch((err) => {});
console.log(err); //
});
}, },
// //
handleRowClick(row, column, event) { handleRowClick(row, column, event) {
@ -115,25 +119,45 @@ export default {
// //
handleAdddevice() { handleAdddevice() {
this.deviceDialog = true; this.title = "新增";
this.deviceDialogTitle = "新增"; this.$refs.adddeviceDialogref.display()
this.$refs.adddeviceDialogref.getdataform(null)
}, },
//handleResive 线 //handleResive 线
handleResive(data) {}, handleResive(data) {
this.title = "修改";
this.$refs.adddeviceDialogref.display()
this.$refs.adddeviceDialogref.getdataform(data)
},
// //
handleDelete() {}, handleDelete(data) {
let deleteArr=[]
deleteArr.push({
id: data.id,
});
this.$confirm("确定要删除记录吗,同时删除关联关系?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteScheduleRulel({ list: deleteArr }).then((res) => {
this.deviceList(); //
});
this.$message({ type: "success", message: "删除成功!" });
})
.catch(() => {
this.$message({ type: "info", message: "已取消删除" });
});
},
// //
handleCurrentChange(val) { handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.page = val; this.page = val;
//this.getTableList(); this.deviceList();
}, },
}, }
created() {
this.deviceList();
},
}; };
</script> </script>
<style lang="less"> <style lang="less">

@ -2,8 +2,6 @@
<div id="container"></div> <div id="container"></div>
</template> </template>
<script> <script>
//import AMapLoader from '@amap/amap-jsapi-loader';
export default { export default {
data() { data() {
return { return {

Loading…
Cancel
Save