fe2bdbd0 by 杨威

添加层户功能完善

1 parent e0d614ec
......@@ -11,9 +11,18 @@ export function getLpbMenuTree (data) {
},
})
}
/**
* 新增幢单元接口信息
* 添加逻辑幢信息接口
*/
export function insertLjzInfo (data) {
return request({
url: '/system/qjLjz/insertQjLjz',
method: 'post',
data:data
})
}
/**
* 添加幢单元接口信息
*/
export function insertZdyInfo (data) {
return request({
......@@ -21,4 +30,14 @@ export function insertZdyInfo (data) {
method: 'post',
data:data
})
}
/**
* 添加层户接口信息
*/
export function insertChInfo (data) {
return request({
url: 'fw/lpb/insertQjCH',
method: 'post',
data:data
})
}
\ No newline at end of file
......
......@@ -69,16 +69,6 @@ export function queryYzgy(id) {
params: {id}
})
}
/**
* 新增逻辑幢信息接口
*/
export function insertLjzInfo (data) {
return request({
url: '/system/qjLjz/insertQjLjz',
method: 'post',
data:data
})
}
/**
* 新增逻辑幢信息接口
......
<template>
<div class="addCh">
<el-table
class="addChTable"
:data="tableData"
style="width: 100%"
border
>
<el-table-column prop="cz" width="40" align="center">
<template slot-scope="scope">
<span class="cp" @click="handleRowClick(scope.row,scope.$index)">{{scope.row.cz}}</span>
</template>
</el-table-column>
<el-table-column prop="ljzbsm" label="逻辑幢" align="center">
<div class="addCh">
<el-table class="addChTable" :data="tableData" style="width: 100%" border>
<el-table-column prop="cz" width="40" align="center">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.ljzbsm"></el-input>
<span class="cp" @click="handleRowClick(scope.row, scope.$index)">{{
scope.row.cz
}}</span>
</template>
</el-table-column>
<el-table-column prop="zdybsm" label="幢单元" align="center">
<template slot-scope="scope">
<el-table-column prop="ljzmc" label="逻辑幢" align="center">
<!-- <template slot-scope="scope">
<el-input size="small" v-model="scope.row.ljzbsm"></el-input>
</template> -->
</el-table-column>
<el-table-column prop="zdymc" label="幢单元" align="center">
<!-- <template slot-scope="scope">
<el-input size="small" v-model="scope.row.zdybsm"></el-input>
</template>
</template> -->
</el-table-column>
<el-table-column prop="qsc" label="起始层" align="center">
<template slot-scope="scope">
......@@ -30,88 +27,158 @@
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.jsc"></el-input>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="mchs" label="每层户数" align="center">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.mchs"></el-input>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import { insertChInfo } from "../../../../../api/lpb";
export default {
name:"",
components:{},
props:{},
data(){
return {
tableData:[
],
formData:{
cz:'+',
ljzbsm:'',
zdybsm:'',
qsc:'',
jsc:'',
mchs:'',
}
}
},
created(){
this.tableData.push(this.formData)
},
mounted(){},
methods:{
//行操作
handleRowClick(row,index){
console.log(index);
if(row.cz =='+'){
let temp = JSON.parse(JSON.stringify(this.formData));
temp.cz = '-';
this.tableData.push(temp);
}else{
this.tableData.splice(index, 1)
}
},
//重置数据
reset(){
this.tableData = [
{
cz:'+',
ljzbsm:'',
zdybsm:'',
qsc:'',
jsc:'',
mchs:'',
}
]
}
},
computed: {},
watch: {},
}
name: "",
components: {},
props: {
treeData: {},
dialogVisible: {
type: Boolean,
default: false,
},
},
data() {
return {
ljzBsm: null,
zdyBsm: null,
zrzBsm: null,
tableData: [],
formData: {
cz: "+",
ljzbsm: "",
ljzmc:"",
zdymc:"",
zdybsm: "",
zrzbsm: "",
syclx: "0",
qsc: "",
jsc: "",
hs: "",
},
};
},
created() {},
mounted() {
console.log(this.treeData, "treeData");
},
methods: {
//行操作
handleRowClick(row, index) {
console.log(this.tableData, "this.tableData");
console.log(this.formData, "this.formData");
console.log(index);
if (row.cz == "+") {
let temp = JSON.parse(JSON.stringify(this.formData));
temp.cz = "-";
this.tableData.push(temp);
} else {
this.tableData.splice(index, 1);
}
},
onSave(bsm) {
insertChInfo(this.tableData).then((res) => {
if (res.code === 200) {
this.$message.success("保存成功");
//更新树结构数据
console.log(this);
this.$parent.$parent.getLpbMenuTree(bsm);
//关闭弹框
this.$parent.$parent.closeDaialog();
}
});
},
//重置数据
reset() {
this.tableData = [
{
cz: "+",
ljzbsm: "",
zdybsm: "",
qsc: "",
jsc: "",
mchs: "",
},
];
},
},
computed: {},
watch: {
treeData: {
handler(n) {
this.formData = {
cz: "+",
ljzbsm: "",
zdybsm: "",
zrzbsm: "",
syclx: "0",
qsc: "",
jsc: "",
hs: "",
};
switch (n.type) {
case "zrz":
this.formData.zrzbsm = n.bsm;
break;
case "ljz":
this.formData.zrzbsm = n.zrzbsm;
this.formData.ljzbsm = n.bsm;
this.formData.ljzmc = n.ljzmc;
break;
case "zdy":
this.formData.zrzbsm = n.zrzbsm;
this.formData.ljzbsm = n.ljzbsm;
this.formData.ljzmc = n.ljzmc;
this.formData.zdybsm = n.bsm;
this.formData.zdymc = n.mc;
break;
default:
break;
}
this.tableData = [];
this.tableData.push(this.formData);
},
//深度监听,第一次接收到父组件传值就触发事件
immediate: true,
deep: true,
},
// dialogVisible(n){
// this.tableData = [];
// if(n){
// this.tableData.push(this.formData);
// }
// }
},
};
</script>
<style lang="less">
.addCh{
.addChTable {
.el-input__inner {
height: 20px;
margin: 0;
line-height: 20px;
outline: none;
border: none;
color: #606764;
overflow: visible;
cursor: text;
text-align: center;
}
}
.cp{
cursor: pointer;
}
.addCh {
.addChTable {
.el-input__inner {
height: 20px;
margin: 0;
line-height: 20px;
outline: none;
border: none;
color: #606764;
overflow: visible;
cursor: text;
text-align: center;
}
}
.cp {
cursor: pointer;
}
}
</style>
\ No newline at end of file
</style>
......
......@@ -38,7 +38,7 @@
<LineTree :pd="pd" class="treeData" :islpb="islpb"></LineTree>
<p
@click="createFlag = false"
style="width:20px;float:left;cursor:pointer;"
style="width:20px;float:left;margin-top: 12px;margin-left:10px;cursor:pointer;"
>
X
</p>
......@@ -96,7 +96,7 @@
<addZdy ref="zdy"></addZdy>
</div>
<div class="addCh" v-show="menuType == 'ch'">
<addCh ref="ch"></addCh>
<addCh ref="ch" :dialogVisible="dialogVisible" :treeData="treeData"></addCh>
</div>
<div class="btnGroup">
<el-button type="primary" @click="saveInfo">保存</el-button>
......@@ -203,7 +203,7 @@ export default {
this.getHeight();
},
mounted() {
this.getLpbMenuTree("d1b82b27f2a6ab7bf3f0e7708c96e46f");
this.getLpbMenuTree("1e0c83dfe2e73284f834a80a0947f0c9");
// 楼盘表绘制区域宽度计算:楼盘表区域宽度-图例宽度34-滚动条宽度6
setTimeout(() => {
this.lpbContentwidth = this.$store.state.contentWidth - 34 - 6;
......@@ -243,8 +243,8 @@ export default {
this.$refs.zdy.submitForm("form", this.pd[0].bsm, this.treeData.bsm);
break;
case "ch":
this.$refs.ch.onSave(this.pd[0].bsm);
break;
default:
break;
}
......@@ -276,15 +276,6 @@ export default {
},
},
computed: {
// tabContentWidth(){
// let w = this.$refs.tabContent != undefined ? this.$refs.tabContent.offsetWidth : 0
// return w;
// // if(this.$refs.tabContent != undefined){
// // return this.$refs.tabContent.offsetWidth
// // }else{
// // return
// // }
// }
},
destroyed() {
window.removeEventListener("resize", this.getHeight);
......@@ -304,13 +295,6 @@ export default {
this.lpbContentwidth += 260;
}
},
// tabContentWidth(n){
// debugger
// if(n != 0){
// // 楼盘表绘制区域宽度计算:楼盘表区域宽度-图例宽度34-滚动条宽度6
// this.lpbContentwidth = this.$refs.tabContent.offsetWidth - 34 - 6;
// }
// }
},
};
</script>
......