添加层户功能完善
Showing
5 changed files
with
145 additions
and
85 deletions
... | @@ -11,9 +11,18 @@ export function getLpbMenuTree (data) { | ... | @@ -11,9 +11,18 @@ export function getLpbMenuTree (data) { |
11 | }, | 11 | }, |
12 | }) | 12 | }) |
13 | } | 13 | } |
14 | |||
15 | /** | 14 | /** |
16 | * 新增幢单元接口信息 | 15 | * 添加逻辑幢信息接口 |
16 | */ | ||
17 | export function insertLjzInfo (data) { | ||
18 | return request({ | ||
19 | url: '/system/qjLjz/insertQjLjz', | ||
20 | method: 'post', | ||
21 | data:data | ||
22 | }) | ||
23 | } | ||
24 | /** | ||
25 | * 添加幢单元接口信息 | ||
17 | */ | 26 | */ |
18 | export function insertZdyInfo (data) { | 27 | export function insertZdyInfo (data) { |
19 | return request({ | 28 | return request({ |
... | @@ -22,3 +31,13 @@ export function insertZdyInfo (data) { | ... | @@ -22,3 +31,13 @@ export function insertZdyInfo (data) { |
22 | data:data | 31 | data:data |
23 | }) | 32 | }) |
24 | } | 33 | } |
34 | /** | ||
35 | * 添加层户接口信息 | ||
36 | */ | ||
37 | export function insertChInfo (data) { | ||
38 | return request({ | ||
39 | url: 'fw/lpb/insertQjCH', | ||
40 | method: 'post', | ||
41 | data:data | ||
42 | }) | ||
43 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -69,16 +69,6 @@ export function queryYzgy(id) { | ... | @@ -69,16 +69,6 @@ export function queryYzgy(id) { |
69 | params: {id} | 69 | params: {id} |
70 | }) | 70 | }) |
71 | } | 71 | } |
72 | /** | ||
73 | * 新增逻辑幢信息接口 | ||
74 | */ | ||
75 | export function insertLjzInfo (data) { | ||
76 | return request({ | ||
77 | url: '/system/qjLjz/insertQjLjz', | ||
78 | method: 'post', | ||
79 | data:data | ||
80 | }) | ||
81 | } | ||
82 | 72 | ||
83 | /** | 73 | /** |
84 | * 新增逻辑幢信息接口 | 74 | * 新增逻辑幢信息接口 | ... | ... |
1 | <template> | 1 | <template> |
2 | <div class="addCh"> | 2 | <div class="addCh"> |
3 | <el-table | 3 | <el-table class="addChTable" :data="tableData" style="width: 100%" border> |
4 | class="addChTable" | ||
5 | :data="tableData" | ||
6 | style="width: 100%" | ||
7 | border | ||
8 | > | ||
9 | <el-table-column prop="cz" width="40" align="center"> | 4 | <el-table-column prop="cz" width="40" align="center"> |
10 | <template slot-scope="scope"> | 5 | <template slot-scope="scope"> |
11 | <span class="cp" @click="handleRowClick(scope.row,scope.$index)">{{scope.row.cz}}</span> | 6 | <span class="cp" @click="handleRowClick(scope.row, scope.$index)">{{ |
7 | scope.row.cz | ||
8 | }}</span> | ||
12 | </template> | 9 | </template> |
13 | </el-table-column> | 10 | </el-table-column> |
14 | <el-table-column prop="ljzbsm" label="逻辑幢" align="center"> | 11 | <el-table-column prop="ljzmc" label="逻辑幢" align="center"> |
15 | <template slot-scope="scope"> | 12 | <!-- <template slot-scope="scope"> |
16 | <el-input size="small" v-model="scope.row.ljzbsm"></el-input> | 13 | <el-input size="small" v-model="scope.row.ljzbsm"></el-input> |
17 | </template> | 14 | </template> --> |
18 | </el-table-column> | 15 | </el-table-column> |
19 | <el-table-column prop="zdybsm" label="幢单元" align="center"> | 16 | <el-table-column prop="zdymc" label="幢单元" align="center"> |
20 | <template slot-scope="scope"> | 17 | <!-- <template slot-scope="scope"> |
21 | <el-input size="small" v-model="scope.row.zdybsm"></el-input> | 18 | <el-input size="small" v-model="scope.row.zdybsm"></el-input> |
22 | </template> | 19 | </template> --> |
23 | </el-table-column> | 20 | </el-table-column> |
24 | <el-table-column prop="qsc" label="起始层" align="center"> | 21 | <el-table-column prop="qsc" label="起始层" align="center"> |
25 | <template slot-scope="scope"> | 22 | <template slot-scope="scope"> |
... | @@ -41,61 +38,132 @@ | ... | @@ -41,61 +38,132 @@ |
41 | </template> | 38 | </template> |
42 | 39 | ||
43 | <script> | 40 | <script> |
41 | import { insertChInfo } from "../../../../../api/lpb"; | ||
44 | export default { | 42 | export default { |
45 | name:"", | 43 | name: "", |
46 | components:{}, | 44 | components: {}, |
47 | props:{}, | 45 | props: { |
48 | data(){ | 46 | treeData: {}, |
47 | dialogVisible: { | ||
48 | type: Boolean, | ||
49 | default: false, | ||
50 | }, | ||
51 | }, | ||
52 | data() { | ||
49 | return { | 53 | return { |
50 | tableData:[ | 54 | ljzBsm: null, |
51 | 55 | zdyBsm: null, | |
52 | ], | 56 | zrzBsm: null, |
53 | formData:{ | 57 | tableData: [], |
54 | cz:'+', | 58 | formData: { |
55 | ljzbsm:'', | 59 | cz: "+", |
56 | zdybsm:'', | 60 | ljzbsm: "", |
57 | qsc:'', | 61 | ljzmc:"", |
58 | jsc:'', | 62 | zdymc:"", |
59 | mchs:'', | 63 | zdybsm: "", |
60 | } | 64 | zrzbsm: "", |
61 | } | 65 | syclx: "0", |
66 | qsc: "", | ||
67 | jsc: "", | ||
68 | hs: "", | ||
62 | }, | 69 | }, |
63 | created(){ | 70 | }; |
64 | this.tableData.push(this.formData) | ||
65 | }, | 71 | }, |
66 | mounted(){}, | 72 | created() {}, |
67 | methods:{ | 73 | mounted() { |
74 | console.log(this.treeData, "treeData"); | ||
75 | }, | ||
76 | methods: { | ||
68 | //行操作 | 77 | //行操作 |
69 | handleRowClick(row,index){ | 78 | handleRowClick(row, index) { |
79 | console.log(this.tableData, "this.tableData"); | ||
80 | console.log(this.formData, "this.formData"); | ||
70 | console.log(index); | 81 | console.log(index); |
71 | if(row.cz =='+'){ | 82 | if (row.cz == "+") { |
72 | let temp = JSON.parse(JSON.stringify(this.formData)); | 83 | let temp = JSON.parse(JSON.stringify(this.formData)); |
73 | temp.cz = '-'; | 84 | temp.cz = "-"; |
74 | this.tableData.push(temp); | 85 | this.tableData.push(temp); |
75 | }else{ | 86 | } else { |
76 | this.tableData.splice(index, 1) | 87 | this.tableData.splice(index, 1); |
88 | } | ||
89 | }, | ||
90 | onSave(bsm) { | ||
91 | insertChInfo(this.tableData).then((res) => { | ||
92 | if (res.code === 200) { | ||
93 | this.$message.success("保存成功"); | ||
94 | //更新树结构数据 | ||
95 | console.log(this); | ||
96 | this.$parent.$parent.getLpbMenuTree(bsm); | ||
97 | //关闭弹框 | ||
98 | this.$parent.$parent.closeDaialog(); | ||
77 | } | 99 | } |
100 | }); | ||
78 | }, | 101 | }, |
79 | //重置数据 | 102 | //重置数据 |
80 | reset(){ | 103 | reset() { |
81 | this.tableData = [ | 104 | this.tableData = [ |
82 | { | 105 | { |
83 | cz:'+', | 106 | cz: "+", |
84 | ljzbsm:'', | 107 | ljzbsm: "", |
85 | zdybsm:'', | 108 | zdybsm: "", |
86 | qsc:'', | 109 | qsc: "", |
87 | jsc:'', | 110 | jsc: "", |
88 | mchs:'', | 111 | mchs: "", |
89 | } | 112 | }, |
90 | ] | 113 | ]; |
91 | } | 114 | }, |
92 | }, | 115 | }, |
93 | computed: {}, | 116 | computed: {}, |
94 | watch: {}, | 117 | watch: { |
95 | } | 118 | treeData: { |
119 | handler(n) { | ||
120 | this.formData = { | ||
121 | cz: "+", | ||
122 | ljzbsm: "", | ||
123 | zdybsm: "", | ||
124 | zrzbsm: "", | ||
125 | syclx: "0", | ||
126 | qsc: "", | ||
127 | jsc: "", | ||
128 | hs: "", | ||
129 | }; | ||
130 | switch (n.type) { | ||
131 | case "zrz": | ||
132 | this.formData.zrzbsm = n.bsm; | ||
133 | break; | ||
134 | case "ljz": | ||
135 | this.formData.zrzbsm = n.zrzbsm; | ||
136 | this.formData.ljzbsm = n.bsm; | ||
137 | this.formData.ljzmc = n.ljzmc; | ||
138 | break; | ||
139 | case "zdy": | ||
140 | this.formData.zrzbsm = n.zrzbsm; | ||
141 | this.formData.ljzbsm = n.ljzbsm; | ||
142 | this.formData.ljzmc = n.ljzmc; | ||
143 | this.formData.zdybsm = n.bsm; | ||
144 | this.formData.zdymc = n.mc; | ||
145 | break; | ||
146 | default: | ||
147 | break; | ||
148 | } | ||
149 | this.tableData = []; | ||
150 | this.tableData.push(this.formData); | ||
151 | }, | ||
152 | //深度监听,第一次接收到父组件传值就触发事件 | ||
153 | immediate: true, | ||
154 | deep: true, | ||
155 | }, | ||
156 | // dialogVisible(n){ | ||
157 | // this.tableData = []; | ||
158 | // if(n){ | ||
159 | // this.tableData.push(this.formData); | ||
160 | // } | ||
161 | // } | ||
162 | }, | ||
163 | }; | ||
96 | </script> | 164 | </script> |
97 | <style lang="less"> | 165 | <style lang="less"> |
98 | .addCh{ | 166 | .addCh { |
99 | .addChTable { | 167 | .addChTable { |
100 | .el-input__inner { | 168 | .el-input__inner { |
101 | height: 20px; | 169 | height: 20px; |
... | @@ -109,9 +177,8 @@ export default { | ... | @@ -109,9 +177,8 @@ export default { |
109 | text-align: center; | 177 | text-align: center; |
110 | } | 178 | } |
111 | } | 179 | } |
112 | .cp{ | 180 | .cp { |
113 | cursor: pointer; | 181 | cursor: pointer; |
114 | } | 182 | } |
115 | } | 183 | } |
116 | |||
117 | </style> | 184 | </style> | ... | ... |
... | @@ -38,7 +38,7 @@ | ... | @@ -38,7 +38,7 @@ |
38 | <LineTree :pd="pd" class="treeData" :islpb="islpb"></LineTree> | 38 | <LineTree :pd="pd" class="treeData" :islpb="islpb"></LineTree> |
39 | <p | 39 | <p |
40 | @click="createFlag = false" | 40 | @click="createFlag = false" |
41 | style="width:20px;float:left;cursor:pointer;" | 41 | style="width:20px;float:left;margin-top: 12px;margin-left:10px;cursor:pointer;" |
42 | > | 42 | > |
43 | X | 43 | X |
44 | </p> | 44 | </p> |
... | @@ -96,7 +96,7 @@ | ... | @@ -96,7 +96,7 @@ |
96 | <addZdy ref="zdy"></addZdy> | 96 | <addZdy ref="zdy"></addZdy> |
97 | </div> | 97 | </div> |
98 | <div class="addCh" v-show="menuType == 'ch'"> | 98 | <div class="addCh" v-show="menuType == 'ch'"> |
99 | <addCh ref="ch"></addCh> | 99 | <addCh ref="ch" :dialogVisible="dialogVisible" :treeData="treeData"></addCh> |
100 | </div> | 100 | </div> |
101 | <div class="btnGroup"> | 101 | <div class="btnGroup"> |
102 | <el-button type="primary" @click="saveInfo">保存</el-button> | 102 | <el-button type="primary" @click="saveInfo">保存</el-button> |
... | @@ -203,7 +203,7 @@ export default { | ... | @@ -203,7 +203,7 @@ export default { |
203 | this.getHeight(); | 203 | this.getHeight(); |
204 | }, | 204 | }, |
205 | mounted() { | 205 | mounted() { |
206 | this.getLpbMenuTree("d1b82b27f2a6ab7bf3f0e7708c96e46f"); | 206 | this.getLpbMenuTree("1e0c83dfe2e73284f834a80a0947f0c9"); |
207 | // 楼盘表绘制区域宽度计算:楼盘表区域宽度-图例宽度34-滚动条宽度6 | 207 | // 楼盘表绘制区域宽度计算:楼盘表区域宽度-图例宽度34-滚动条宽度6 |
208 | setTimeout(() => { | 208 | setTimeout(() => { |
209 | this.lpbContentwidth = this.$store.state.contentWidth - 34 - 6; | 209 | this.lpbContentwidth = this.$store.state.contentWidth - 34 - 6; |
... | @@ -243,8 +243,8 @@ export default { | ... | @@ -243,8 +243,8 @@ export default { |
243 | this.$refs.zdy.submitForm("form", this.pd[0].bsm, this.treeData.bsm); | 243 | this.$refs.zdy.submitForm("form", this.pd[0].bsm, this.treeData.bsm); |
244 | break; | 244 | break; |
245 | case "ch": | 245 | case "ch": |
246 | this.$refs.ch.onSave(this.pd[0].bsm); | ||
246 | break; | 247 | break; |
247 | |||
248 | default: | 248 | default: |
249 | break; | 249 | break; |
250 | } | 250 | } |
... | @@ -276,15 +276,6 @@ export default { | ... | @@ -276,15 +276,6 @@ export default { |
276 | }, | 276 | }, |
277 | }, | 277 | }, |
278 | computed: { | 278 | computed: { |
279 | // tabContentWidth(){ | ||
280 | // let w = this.$refs.tabContent != undefined ? this.$refs.tabContent.offsetWidth : 0 | ||
281 | // return w; | ||
282 | // // if(this.$refs.tabContent != undefined){ | ||
283 | // // return this.$refs.tabContent.offsetWidth | ||
284 | // // }else{ | ||
285 | // // return | ||
286 | // // } | ||
287 | // } | ||
288 | }, | 279 | }, |
289 | destroyed() { | 280 | destroyed() { |
290 | window.removeEventListener("resize", this.getHeight); | 281 | window.removeEventListener("resize", this.getHeight); |
... | @@ -304,13 +295,6 @@ export default { | ... | @@ -304,13 +295,6 @@ export default { |
304 | this.lpbContentwidth += 260; | 295 | this.lpbContentwidth += 260; |
305 | } | 296 | } |
306 | }, | 297 | }, |
307 | // tabContentWidth(n){ | ||
308 | // debugger | ||
309 | // if(n != 0){ | ||
310 | // // 楼盘表绘制区域宽度计算:楼盘表区域宽度-图例宽度34-滚动条宽度6 | ||
311 | // this.lpbContentwidth = this.$refs.tabContent.offsetWidth - 34 - 6; | ||
312 | // } | ||
313 | // } | ||
314 | }, | 298 | }, |
315 | }; | 299 | }; |
316 | </script> | 300 | </script> | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment