首页添加参数配置
parent
f1ae253314
commit
b741d45b32
@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
class="addtowerDialog"
|
||||
title="修改杆塔"
|
||||
:visible.sync="isShow"
|
||||
:close-on-click-modal="false"
|
||||
width="470px"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form
|
||||
label-position="left"
|
||||
ref="formInfo"
|
||||
label-width="100px"
|
||||
:rules="rules"
|
||||
:model="formdata"
|
||||
>
|
||||
<el-form-item label="线路名称:" prop="lineId">
|
||||
<el-select v-model="formdata.lineId" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in lineOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="杆塔名称:" prop="name">
|
||||
<el-input v-model="formdata.towerName" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="杆塔地址:" prop="address">
|
||||
<el-input v-model="formdata.address" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序号:" prop="order">
|
||||
<el-input-number
|
||||
controls-position="right"
|
||||
v-model="formdata.order"
|
||||
:min="0"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="isShow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm()">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { getLineListApi, addTowerApi, updateTowerApi } from "@/utils/api/index";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
lineOptions: [],
|
||||
formdata: {},
|
||||
rules: {
|
||||
towerName: [
|
||||
{ required: true, message: "请输入杆塔名称", trigger: "blur" },
|
||||
],
|
||||
lineId: [
|
||||
{ required: true, message: "请选择线路编号", trigger: "blur" },
|
||||
],
|
||||
// address: [
|
||||
// { required: true, message: "请输入杆塔地址", trigger: "blur" },
|
||||
// ],
|
||||
order: [{ required: true, message: "请输入排序号", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getLineListdata();
|
||||
},
|
||||
methods: {
|
||||
getLineListdata() {
|
||||
getLineListApi({ pageindex: 1, pagesize: 100 })
|
||||
.then((res) => {
|
||||
this.lineOptions = res.data.list;
|
||||
})
|
||||
.catch((err) => {});
|
||||
},
|
||||
//判断
|
||||
getdataform(val) {
|
||||
//this.formdata = val;
|
||||
this.formdata.order = 0;
|
||||
this.formdata = JSON.parse(JSON.stringify(val));
|
||||
},
|
||||
// 保存确定操作
|
||||
submitForm() {
|
||||
this.$refs.formInfo.validate((valid) => {
|
||||
if (valid) {
|
||||
updateTowerApi({
|
||||
id: this.formdata.towerId,
|
||||
name: this.formdata.towerName,
|
||||
address: null,
|
||||
lineId: this.formdata.lineId,
|
||||
lineName: this.formdata.lineName,
|
||||
order: this.formdata.order,
|
||||
})
|
||||
.then((res) => {
|
||||
this.isShow = false;
|
||||
//this.$message.success("修改成功");
|
||||
this.$message({
|
||||
duration: 1500,
|
||||
showClose: true,
|
||||
message: "修改成功",
|
||||
type: "success",
|
||||
});
|
||||
this.$parent.terminalList(); //刷新
|
||||
})
|
||||
.catch((err) => {
|
||||
//this.$message.error("修改失败");
|
||||
this.$message({
|
||||
duration: 1500,
|
||||
showClose: true,
|
||||
message: "修改失败",
|
||||
type: "error",
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
display() {
|
||||
this.isShow = true;
|
||||
},
|
||||
hide() {
|
||||
this.isShow = false;
|
||||
},
|
||||
handleClose() {
|
||||
this.$parent.terminalList(); //刷新
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less">
|
||||
.addtowerDialog {
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
.el-input-number {
|
||||
width: 100%;
|
||||
}
|
||||
.el-input-number .el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue