作者 shenhailong

公寓 新增 删除

... ... @@ -39,11 +39,13 @@
<el-table-column :label="$t('table.actions')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!--<el-button type="primary" size="small" @click="handleUpdate(scope.row)">快速编辑</el-button>-->
<el-button type="primary" size="small" @click="handleUpdate(scope.row)">新增</el-button>
<el-button size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">{{ $t('table.delete') }}</el-button>
<el-button v-if="scope.row.type=='3'" disabled type="primary" size="small" @click="handleAdd(scope.row)">新增</el-button>
<el-button v-else type="primary" size="small" @click="handleAdd(scope.row)">新增</el-button>
<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>
<el-button v-else disabled="" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>
<el-button size="mini" type="danger" @click="handleDel(scope.row)">删除</el-button>
<!--<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>-->
<!--<el-button v-else disabled="" type="primary" size="small" @click="pay(scope.row)">缴费</el-button>-->
<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="waterMeter(scope.row)">水表实时信息</el-button>
<el-button v-else disabled="" type="primary" size="small" @click="waterMeter(scope.row)">水表实时信息</el-button>
... ... @@ -53,15 +55,13 @@
<!--<el-button v-if="scope.row.type=='3'" type="primary" size="small" @click="electrixityMeterEdit(scope.row)">编辑电表参数配置</el-button>-->
<!--<el-button v-else disabled="" type="primary" size="small" @click="electrixityMeterEdit(scope.row)">编辑电表参数配置</el-button>-->
</template>
</el-table-column>
</el-table>
<!--工具条-->
<el-col :span="24" class="toolbar">
<el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button>
<!--<el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button>-->
<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;">
</el-pagination>
</el-col>
... ... @@ -252,6 +252,19 @@
</div>
</el-dialog>
<!--location新增界面-->
<el-dialog title="新增" :visible.sync="addFormLocationVisible" :close-on-click-modal="false">
<el-form :model="addLocationForm" label-width="80px" :rules="addLocationFormRules" ref="addLocationForm">
<el-form-item label="公寓名称" prop="adrName">
<el-input v-model="addLocationForm.adrName" auto-complete="off" placeholder="请输入名称"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="addFormLocationVisible = false">取消</el-button>
<el-button type="primary" @click.native="addLocationParent" :loading="addLoading">提交</el-button>
</div>
</el-dialog>
</section>
</template>
<style>
... ... @@ -268,7 +281,7 @@
}
</style>
<script>
import { getList,add} from '@/api/empt/location_api';
import { getList,add, remove} from '@/api/empt/location_api';
import {add as electicity, getEEModel, edit} from '@/api/empt/electricityParams';
import {findRealTime } from '@/api/empt/waterMeter';
import moment from 'moment'
... ... @@ -295,6 +308,13 @@
// 水表实施信息
waterMeterVisible:false,
addFormLocationVisible: false,
addLocationFormRules:{
adrName: [
{required: true, message: '请输入公寓名称', trigger: 'blur'}
]
},
editLoading: false,
editFormRules: {
roleName: [
... ... @@ -369,6 +389,12 @@
roleSign: 1,
permissions: []
},
// 公寓新增
addLocationForm:{
adrName: '',
parent: '',
type:''
},
centerDialogVisible: false,
dialogData:{
process:{
... ... @@ -440,7 +466,7 @@
one: function(prepaid){
return prepaid?true:one='是'?false:one='否'
},
//性别显示转换
//类型显示转换
formatType: function (row, column) {
let msg = '未知';
switch (row.type){
... ... @@ -458,7 +484,7 @@
break;
}
return msg;
},//性别显示转换
},//类型显示转换
formatperpaid: function (value) {
return value === true ? "1" : "0";
},
... ... @@ -470,6 +496,7 @@
let para = {
pageNum: this.pageNum,
pageSize: this.pageSize,
processName: this.processName
};
this.listLoading = true;
//NProgress.start();
... ... @@ -493,20 +520,28 @@
},
//删除
handleDel: function (index, row) {
handleDel: function (row) {
console.log(row.id);
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.listLoading = true;
//NProgress.start();
let para = { roleId: row.roleId };
let para = { id: row.id };
remove(para).then((res) => {
this.listLoading = false;
//NProgress.done();
this.$message({
message: '删除成功',
type: 'success'
});
if (res.data.code == 200) {
this.$message({
message: '删除成功',
type: 'success'
});
this.getList();
}else {
this.$message({
message:'请删除该下面的楼,层,房间',
type:"error"
})
}
}).catch((error) => {
this.listLoading = false;
alert(error);
... ... @@ -528,6 +563,60 @@
});
},
// location 新增
handleAdd: function (row) {
if (row == undefined){
this.addFormLocationVisible = true;
this.addLocationForm.parent = 0;
this.addLocationForm.type = 0;
}else {
this.addFormLocationVisible = true;
this.addLocationForm.parent = row.id;
if (row.type == 3){
this.addLocationForm.type = row.type;
}else {
this.addLocationForm.type = row.type+1;
}
}
},
// 公寓新增
addLocationParent: function () {
this.$refs.addLocationForm.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.addLoading = true;
//NProgress.start();
let para = Object.assign({}, this.addLocationForm);
add(para).then((res) => {
console.log(res.data.code);
this.addLoading = false;
if (res.data.code == 200) {
this.$message({
message: '提交成功',
type: 'success'
});
this.$refs['addLocationForm'].resetFields();
this.addFormLocationVisible = false;
this.getList();
}else if (res.data.code == 201){
this.$message({
message:'该名称已存在',
type:"error"
})
}else {
this.$message({
message: '网络异常',
type: 'error'
});
}
}).catch(error => alert(error));
});
}
});
},
// 楼层新增
//电表参数配置新增界面,每次点开初始化数据
electrixityMeterConfiguration: function (row) {
... ...
... ... @@ -40,7 +40,7 @@
<el-table-column prop="paylocationname" label="房间号码" width="150">
</el-table-column>
<el-table-column prop="paytypeaddress" label="房间号码" width="200">
<el-table-column prop="paytypeaddress" label="水表编号" width="200">
</el-table-column>
<el-table-column prop="paytime" label="充值日期" width="160">
... ...