作者 shenhailong

公寓 新增 删除

@@ -39,11 +39,13 @@ @@ -39,11 +39,13 @@
39 <el-table-column :label="$t('table.actions')" align="center" class-name="small-padding fixed-width"> 39 <el-table-column :label="$t('table.actions')" align="center" class-name="small-padding fixed-width">
40 <template slot-scope="scope"> 40 <template slot-scope="scope">
41 <!--<el-button type="primary" size="small" @click="handleUpdate(scope.row)">快速编辑</el-button>--> 41 <!--<el-button type="primary" size="small" @click="handleUpdate(scope.row)">快速编辑</el-button>-->
42 - <el-button type="primary" size="small" @click="handleUpdate(scope.row)">新增</el-button>  
43 - <el-button size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">{{ $t('table.delete') }}</el-button> 42 + <el-button v-if="scope.row.type=='3'" disabled type="primary" size="small" @click="handleAdd(scope.row)">新增</el-button>
  43 + <el-button v-else type="primary" size="small" @click="handleAdd(scope.row)">新增</el-button>
44 44
45 - <el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>  
46 - <el-button v-else disabled="" type="primary" size="small" @click="pay(scope.row)">缴费</el-button> 45 + <el-button size="mini" type="danger" @click="handleDel(scope.row)">删除</el-button>
  46 +
  47 + <!--<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>-->
  48 + <!--<el-button v-else disabled="" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>-->
47 49
48 <el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="waterMeter(scope.row)">水表实时信息</el-button> 50 <el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="waterMeter(scope.row)">水表实时信息</el-button>
49 <el-button v-else disabled="" type="primary" size="small" @click="waterMeter(scope.row)">水表实时信息</el-button> 51 <el-button v-else disabled="" type="primary" size="small" @click="waterMeter(scope.row)">水表实时信息</el-button>
@@ -53,15 +55,13 @@ @@ -53,15 +55,13 @@
53 55
54 <!--<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="electrixityMeterEdit(scope.row)">编辑电表参数配置</el-button>--> 56 <!--<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="electrixityMeterEdit(scope.row)">编辑电表参数配置</el-button>-->
55 <!--<el-button v-else disabled="" type="primary" size="small" @click="electrixityMeterEdit(scope.row)">编辑电表参数配置</el-button>--> 57 <!--<el-button v-else disabled="" type="primary" size="small" @click="electrixityMeterEdit(scope.row)">编辑电表参数配置</el-button>-->
56 -  
57 -  
58 </template> 58 </template>
59 </el-table-column> 59 </el-table-column>
60 </el-table> 60 </el-table>
61 61
62 <!--工具条--> 62 <!--工具条-->
63 <el-col :span="24" class="toolbar"> 63 <el-col :span="24" class="toolbar">
64 - <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> 64 + <!--<el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button>-->
65 <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> 65 <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;">
66 </el-pagination> 66 </el-pagination>
67 </el-col> 67 </el-col>
@@ -252,6 +252,19 @@ @@ -252,6 +252,19 @@
252 </div> 252 </div>
253 </el-dialog> 253 </el-dialog>
254 254
  255 + <!--location新增界面-->
  256 + <el-dialog title="新增" :visible.sync="addFormLocationVisible" :close-on-click-modal="false">
  257 + <el-form :model="addLocationForm" label-width="80px" :rules="addLocationFormRules" ref="addLocationForm">
  258 + <el-form-item label="公寓名称" prop="adrName">
  259 + <el-input v-model="addLocationForm.adrName" auto-complete="off" placeholder="请输入名称"></el-input>
  260 + </el-form-item>
  261 + </el-form>
  262 + <div slot="footer" class="dialog-footer">
  263 + <el-button @click.native="addFormLocationVisible = false">取消</el-button>
  264 + <el-button type="primary" @click.native="addLocationParent" :loading="addLoading">提交</el-button>
  265 + </div>
  266 + </el-dialog>
  267 +
255 </section> 268 </section>
256 </template> 269 </template>
257 <style> 270 <style>
@@ -268,7 +281,7 @@ @@ -268,7 +281,7 @@
268 } 281 }
269 </style> 282 </style>
270 <script> 283 <script>
271 - import { getList,add} from '@/api/empt/location_api'; 284 + import { getList,add, remove} from '@/api/empt/location_api';
272 import {add as electicity, getEEModel, edit} from '@/api/empt/electricityParams'; 285 import {add as electicity, getEEModel, edit} from '@/api/empt/electricityParams';
273 import {findRealTime } from '@/api/empt/waterMeter'; 286 import {findRealTime } from '@/api/empt/waterMeter';
274 import moment from 'moment' 287 import moment from 'moment'
@@ -295,6 +308,13 @@ @@ -295,6 +308,13 @@
295 // 水表实施信息 308 // 水表实施信息
296 waterMeterVisible:false, 309 waterMeterVisible:false,
297 310
  311 + addFormLocationVisible: false,
  312 + addLocationFormRules:{
  313 + adrName: [
  314 + {required: true, message: '请输入公寓名称', trigger: 'blur'}
  315 + ]
  316 + },
  317 +
298 editLoading: false, 318 editLoading: false,
299 editFormRules: { 319 editFormRules: {
300 roleName: [ 320 roleName: [
@@ -369,6 +389,12 @@ @@ -369,6 +389,12 @@
369 roleSign: 1, 389 roleSign: 1,
370 permissions: [] 390 permissions: []
371 }, 391 },
  392 + // 公寓新增
  393 + addLocationForm:{
  394 + adrName: '',
  395 + parent: '',
  396 + type:''
  397 + },
372 centerDialogVisible: false, 398 centerDialogVisible: false,
373 dialogData:{ 399 dialogData:{
374 process:{ 400 process:{
@@ -440,7 +466,7 @@ @@ -440,7 +466,7 @@
440 one: function(prepaid){ 466 one: function(prepaid){
441 return prepaid?true:one='是'?false:one='否' 467 return prepaid?true:one='是'?false:one='否'
442 }, 468 },
443 - //性别显示转换 469 + //类型显示转换
444 formatType: function (row, column) { 470 formatType: function (row, column) {
445 let msg = '未知'; 471 let msg = '未知';
446 switch (row.type){ 472 switch (row.type){
@@ -458,7 +484,7 @@ @@ -458,7 +484,7 @@
458 break; 484 break;
459 } 485 }
460 return msg; 486 return msg;
461 - },//性别显示转换 487 + },//类型显示转换
462 formatperpaid: function (value) { 488 formatperpaid: function (value) {
463 return value === true ? "1" : "0"; 489 return value === true ? "1" : "0";
464 }, 490 },
@@ -470,6 +496,7 @@ @@ -470,6 +496,7 @@
470 let para = { 496 let para = {
471 pageNum: this.pageNum, 497 pageNum: this.pageNum,
472 pageSize: this.pageSize, 498 pageSize: this.pageSize,
  499 + processName: this.processName
473 }; 500 };
474 this.listLoading = true; 501 this.listLoading = true;
475 //NProgress.start(); 502 //NProgress.start();
@@ -493,20 +520,28 @@ @@ -493,20 +520,28 @@
493 520
494 }, 521 },
495 //删除 522 //删除
496 - handleDel: function (index, row) { 523 + handleDel: function (row) {
  524 + console.log(row.id);
497 this.$confirm('确认删除该记录吗?', '提示', { 525 this.$confirm('确认删除该记录吗?', '提示', {
498 type: 'warning' 526 type: 'warning'
499 }).then(() => { 527 }).then(() => {
500 this.listLoading = true; 528 this.listLoading = true;
501 //NProgress.start(); 529 //NProgress.start();
502 - let para = { roleId: row.roleId }; 530 + let para = { id: row.id };
503 remove(para).then((res) => { 531 remove(para).then((res) => {
504 this.listLoading = false; 532 this.listLoading = false;
505 - //NProgress.done(); 533 + if (res.data.code == 200) {
506 this.$message({ 534 this.$message({
507 message: '删除成功', 535 message: '删除成功',
508 type: 'success' 536 type: 'success'
509 }); 537 });
  538 + this.getList();
  539 + }else {
  540 + this.$message({
  541 + message:'请删除该下面的楼,层,房间',
  542 + type:"error"
  543 + })
  544 + }
510 }).catch((error) => { 545 }).catch((error) => {
511 this.listLoading = false; 546 this.listLoading = false;
512 alert(error); 547 alert(error);
@@ -528,6 +563,60 @@ @@ -528,6 +563,60 @@
528 }); 563 });
529 }, 564 },
530 565
  566 + // location 新增
  567 + handleAdd: function (row) {
  568 + if (row == undefined){
  569 + this.addFormLocationVisible = true;
  570 + this.addLocationForm.parent = 0;
  571 + this.addLocationForm.type = 0;
  572 + }else {
  573 + this.addFormLocationVisible = true;
  574 + this.addLocationForm.parent = row.id;
  575 + if (row.type == 3){
  576 + this.addLocationForm.type = row.type;
  577 + }else {
  578 + this.addLocationForm.type = row.type+1;
  579 + }
  580 + }
  581 +
  582 + },
  583 + // 公寓新增
  584 + addLocationParent: function () {
  585 + this.$refs.addLocationForm.validate((valid) => {
  586 + if (valid) {
  587 + this.$confirm('确认提交吗?', '提示', {}).then(() => {
  588 + this.addLoading = true;
  589 + //NProgress.start();
  590 + let para = Object.assign({}, this.addLocationForm);
  591 + add(para).then((res) => {
  592 + console.log(res.data.code);
  593 + this.addLoading = false;
  594 + if (res.data.code == 200) {
  595 + this.$message({
  596 + message: '提交成功',
  597 + type: 'success'
  598 + });
  599 + this.$refs['addLocationForm'].resetFields();
  600 + this.addFormLocationVisible = false;
  601 + this.getList();
  602 + }else if (res.data.code == 201){
  603 + this.$message({
  604 + message:'该名称已存在',
  605 + type:"error"
  606 + })
  607 + }else {
  608 + this.$message({
  609 + message: '网络异常',
  610 + type: 'error'
  611 + });
  612 + }
  613 + }).catch(error => alert(error));
  614 + });
  615 + }
  616 + });
  617 + },
  618 +
  619 + // 楼层新增
531 620
532 //电表参数配置新增界面,每次点开初始化数据 621 //电表参数配置新增界面,每次点开初始化数据
533 electrixityMeterConfiguration: function (row) { 622 electrixityMeterConfiguration: function (row) {
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 <el-table-column prop="paylocationname" label="房间号码" width="150"> 40 <el-table-column prop="paylocationname" label="房间号码" width="150">
41 </el-table-column> 41 </el-table-column>
42 42
43 - <el-table-column prop="paytypeaddress" label="房间号码" width="200"> 43 + <el-table-column prop="paytypeaddress" label="水表编号" width="200">
44 </el-table-column> 44 </el-table-column>
45 45
46 <el-table-column prop="paytime" label="充值日期" width="160"> 46 <el-table-column prop="paytime" label="充值日期" width="160">