优化代码

This commit is contained in:
java110 2022-03-21 10:21:51 +08:00
parent 887aed39e2
commit e981e0414f
5 changed files with 118 additions and 45 deletions

View File

@ -0,0 +1,29 @@
<div id="inspectionPointQrCodeModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">巡检二维码</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<div class="col-sm-12" style="position: relative;">
<div id="qrcode" style="width:200px; height:200px; "></div>
</div>
<div class="col-sm-12 text-center margin-top ">
<span>{{inspectionPointQrCodeInfo.inspectionName}}</span>
</div>
<div class="col-sm-12 text-center margin-top ">
<span>请截图贴在巡检点的地方</span>
</div>
</div>
<div class="ibox-content">
<button type="button" class="btn btn-white float-right" style="margin-right:20px;" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,35 @@
(function(vc) {
vc.extends({
data: {
inspectionPointQrCodeInfo: {
url: '',
inspectionName: '',
}
},
_initMethod: function() {},
_initEvent: function() {
vc.on('inspectionPointQrCode', 'openInspectionPointQrCodeModal', function(_param) {
vc.copyObject(_param, $that.inspectionPointQrCodeInfo);
$('#inspectionPointQrCodeModel').modal('show');
$that._viewQr($that.inspectionPointQrCodeInfo.url);
});
},
methods: {
// 两分钟后显示遮罩层
_viewQr: function(_url) {
document.getElementById("qrcode").innerHTML = "";
let qrcode = new QRCode(document.getElementById("qrcode"), {
text: "213", //你想要填写的文本
width: 200, //生成的二维码的宽度
height: 200, //生成的二维码的高度
colorDark: "#000000", // 生成的二维码的深色部分
colorLight: "#ffffff", //生成二维码的浅色部分
correctLevel: QRCode.CorrectLevel.L
});
qrcode.makeCode(_url);
}
}
});
})(window.vc);

View File

@ -8,8 +8,7 @@
</select> </select>
</div> </div>
<div class="col-lg-10 text-right" v-if="simplifyMeterWaterFeeInfo.roomId"> <div class="col-lg-10 text-right" v-if="simplifyMeterWaterFeeInfo.roomId">
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" <button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_openAddMeterWaterModal()">
v-on:click="_openAddMeterWaterModal()">
水电抄表 水电抄表
</button> </button>
</div> </div>
@ -17,37 +16,38 @@
<div class="margin-top"> <div class="margin-top">
<table class="footable table table-stripped toggle-arrow-tiny" style="margin-top:10px" data-page-size="10"> <table class="footable table table-stripped toggle-arrow-tiny" style="margin-top:10px" data-page-size="10">
<thead> <thead>
<tr> <tr>
<th class="text-center">表类型</th> <th class="text-center">表类型</th>
<th class="text-center">对象名称</th> <th class="text-center">对象名称</th>
<th class="text-center">上期度数</th> <th class="text-center">上期度数</th>
<th class="text-center">本期度数</th> <th class="text-center">本期度数</th>
<th class="text-center">上期读表时间</th> <th class="text-center">上期读表时间</th>
<th class="text-center">本期读表时间</th> <th class="text-center">本期读表时间</th>
<th class="text-center">创建时间</th> <th class="text-center">创建时间</th>
<th class="text-center">操作</th> <th class="text-center">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="meterWater in simplifyMeterWaterFeeInfo.meterWaters"> <tr v-for="meterWater in simplifyMeterWaterFeeInfo.meterWaters">
<td class="text-center">{{_getMeteTypeName(meterWater.meterType)}}</td> <!-- <td class="text-center">{{_getMeteTypeName(meterWater.meterType)}}</td> -->
<td class="text-center">{{meterWater.objName}}</td> <td class="text-center">{{meterWater.meterTypeName}}</td>
<td class="text-center">{{meterWater.preDegrees}}</td> <td class="text-center">{{meterWater.objName}}</td>
<td class="text-center">{{meterWater.curDegrees}}</td> <td class="text-center">{{meterWater.preDegrees}}</td>
<td class="text-center">{{meterWater.preReadingTime}}</td> <td class="text-center">{{meterWater.curDegrees}}</td>
<td class="text-center">{{meterWater.curReadingTime}}</td> <td class="text-center">{{meterWater.preReadingTime}}</td>
<td class="text-center">{{meterWater.createTime}}</td> <td class="text-center">{{meterWater.curReadingTime}}</td>
<td class="text-center"> <td class="text-center">{{meterWater.createTime}}</td>
<div class="btn-group"> <td class="text-center">
<button class="btn-white btn btn-xs" v-on:click="_openEditMeterWaterModel(meterWater)">修改 <div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openEditMeterWaterModel(meterWater)">修改
</button> </button>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openDeleteMeterWaterModel(meterWater)">删除 <button class="btn-white btn btn-xs" v-on:click="_openDeleteMeterWaterModel(meterWater)">删除
</button> </button>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="row"> <div class="row">

View File

@ -93,6 +93,10 @@
<button class="btn-white btn btn-xs" v-on:click="_openDeleteInspectionPointModel(inspectionPoint)">删除 <button class="btn-white btn btn-xs" v-on:click="_openDeleteInspectionPointModel(inspectionPoint)">删除
</button> </button>
</div> </div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_pointQrCode(inspectionPoint)">二维码
</button>
</div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -113,4 +117,5 @@
<vc:create path="property/addInspectionPoint" callBackListener="" callBackFunction=""></vc:create> <vc:create path="property/addInspectionPoint" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="property/editInspectionPoint"></vc:create> <vc:create path="property/editInspectionPoint"></vc:create>
<vc:create path="property/deleteInspectionPoint"></vc:create> <vc:create path="property/deleteInspectionPoint"></vc:create>
<vc:create path="property/inspectionPointQrCode"></vc:create>
</div> </div>

View File

@ -1,7 +1,7 @@
/** /**
入驻小区 入驻小区
**/ **/
(function (vc) { (function(vc) {
var DEFAULT_PAGE = 1; var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10; var DEFAULT_ROWS = 10;
vc.extends({ vc.extends({
@ -22,23 +22,23 @@
} }
} }
}, },
_initMethod: function () { _initMethod: function() {
//与字典表关联 //与字典表关联
vc.getDict('inspection_point', "point_obj_type", function (_data) { vc.getDict('inspection_point', "point_obj_type", function(_data) {
vc.component.inspectionPointManageInfo.pointObjTypes = _data; vc.component.inspectionPointManageInfo.pointObjTypes = _data;
}); });
vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
}, },
_initEvent: function () { _initEvent: function() {
vc.on('inspectionPointManage', 'listInspectionPoint', function (_param) { vc.on('inspectionPointManage', 'listInspectionPoint', function(_param) {
vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
}); });
vc.on('pagination', 'page_event', function (_currentPage) { vc.on('pagination', 'page_event', function(_currentPage) {
vc.component._listInspectionPoints(_currentPage, DEFAULT_ROWS); vc.component._listInspectionPoints(_currentPage, DEFAULT_ROWS);
}); });
}, },
methods: { methods: {
_listInspectionPoints: function (_page, _rows) { _listInspectionPoints: function(_page, _rows) {
vc.component.inspectionPointManageInfo.conditions.page = _page; vc.component.inspectionPointManageInfo.conditions.page = _page;
vc.component.inspectionPointManageInfo.conditions.row = _rows; vc.component.inspectionPointManageInfo.conditions.row = _rows;
vc.component.inspectionPointManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId; vc.component.inspectionPointManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
@ -52,7 +52,7 @@
vc.http.get('inspectionPointManage', vc.http.get('inspectionPointManage',
'list', 'list',
param, param,
function (json, res) { function(json, res) {
var _inspectionPointManageInfo = JSON.parse(json); var _inspectionPointManageInfo = JSON.parse(json);
vc.component.inspectionPointManageInfo.total = _inspectionPointManageInfo.total; vc.component.inspectionPointManageInfo.total = _inspectionPointManageInfo.total;
vc.component.inspectionPointManageInfo.records = _inspectionPointManageInfo.records; vc.component.inspectionPointManageInfo.records = _inspectionPointManageInfo.records;
@ -62,39 +62,43 @@
dataCount: vc.component.inspectionPointManageInfo.total, dataCount: vc.component.inspectionPointManageInfo.total,
currentPage: _page currentPage: _page
}); });
}, function (errInfo, error) { },
function(errInfo, error) {
console.log('请求失败处理'); console.log('请求失败处理');
} }
); );
}, },
_openAddInspectionPointModal: function () { _openAddInspectionPointModal: function() {
vc.emit('addInspectionPoint', 'openAddInspectionPointModal', {}); vc.emit('addInspectionPoint', 'openAddInspectionPointModal', {});
}, },
_openEditInspectionPointModel: function (_inspectionPoint) { _openEditInspectionPointModel: function(_inspectionPoint) {
vc.emit('editInspectionPoint', 'openEditInspectionPointModal', _inspectionPoint); vc.emit('editInspectionPoint', 'openEditInspectionPointModal', _inspectionPoint);
}, },
_openDeleteInspectionPointModel: function (_inspectionPoint) { _openDeleteInspectionPointModel: function(_inspectionPoint) {
vc.emit('deleteInspectionPoint', 'openDeleteInspectionPointModal', _inspectionPoint); vc.emit('deleteInspectionPoint', 'openDeleteInspectionPointModal', _inspectionPoint);
}, },
//查询 //查询
_queryInspectionPointMethod: function () { _queryInspectionPointMethod: function() {
vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
}, },
//重置 //重置
_resetInspectionPointMethod: function () { _resetInspectionPointMethod: function() {
vc.component.inspectionPointManageInfo.conditions.inspectionId = ''; vc.component.inspectionPointManageInfo.conditions.inspectionId = '';
vc.component.inspectionPointManageInfo.conditions.inspectionName = ''; vc.component.inspectionPointManageInfo.conditions.inspectionName = '';
vc.component.inspectionPointManageInfo.conditions.machineCode = ''; vc.component.inspectionPointManageInfo.conditions.machineCode = '';
vc.component.inspectionPointManageInfo.conditions.pointObjType = ''; vc.component.inspectionPointManageInfo.conditions.pointObjType = '';
vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
}, },
_moreCondition: function () { _moreCondition: function() {
if (vc.component.inspectionPointManageInfo.moreCondition) { if (vc.component.inspectionPointManageInfo.moreCondition) {
vc.component.inspectionPointManageInfo.moreCondition = false; vc.component.inspectionPointManageInfo.moreCondition = false;
} else { } else {
vc.component.inspectionPointManageInfo.moreCondition = true; vc.component.inspectionPointManageInfo.moreCondition = true;
} }
},
_pointQrCode: function(_inspectionPoint) {
vc.emit('inspectionPointQrCode', 'openInspectionPointQrCodeModal', _inspectionPoint);
} }
} }
}); });
})(window.vc); })(window.vc);