优化保养标准

This commit is contained in:
wuxw 2022-11-07 00:06:08 +08:00
parent ccf614692f
commit a162364147
9 changed files with 415 additions and 2 deletions

View File

@ -0,0 +1,77 @@
<div id="chooseMaintainanceStandardItemModel" class="modal fade" role="dialog"
aria-labelledby="chooseMaintainanceStandardItemModelLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="chooseMaintainanceStandardItemModelLabel"><span><vc:i18n name="选择检查项" namespace="chooseMaintainanceStandardItem"></vc:i18n></span></h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="row">
<div class="col-sm-7 m-b-xs">
</div>
<div class="col-sm-5">
<div class="input-group">
<input :placeholder="vc.i18n('输入检查项','chooseMaintainanceStandardItem')" type="text"
v-model="chooseMaintainanceStandardItemInfo.itemTitle"
class="form-control form-control-sm">
<span class="input-group-append">
<button type="button" class="btn btn-sm btn-primary"
v-on:click="queryItems()">
<i class="fa fa-search"></i><span><vc:i18n name="查询" namespace="chooseMaintainanceStandardItem"></vc:i18n></span>
</button>
</span>
</div>
</div>
</div>
<div class="table-responsive" style="margin-top:15px">
<table class="table table-striped">
<thead>
<tr>
<th class="text-center">
<input type="checkbox" class="i-checks " @click="checkAll($event)"
id="quan">
</th>
<th class="text-center"><span><vc:i18n name="检查项" namespace="chooseMaintainanceStandardItem"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="编号" namespace="chooseMaintainanceStandardItem"></vc:i18n></span></th>
</tr>
</thead>
<tbody>
<tr v-for="item in chooseMaintainanceStandardItemInfo.items">
<td class="text-center">
<input type="checkbox" class="i-checks checkItem"
v-bind:value="item.itemId"
v-model="chooseMaintainanceStandardItemInfo.selectItems">
</td>
<td class="text-center">{{item.itemTitle}}</td>
<td class="text-center">{{item.itemId}}</td>
</tr>
</tbody>
</table>
<!-- 分页 -->
<vc:create namespace="chooseMaintainanceStandardItem"
path="frame/paginationPlus"></vc:create>
<div class="ibox-content" v-if="chooseMaintainanceStandardItemInfo.items.length > 0">
<button class="btn btn-primary float-right" type="button"
v-on:click="_chooseMaintainanceStandardItem()">
<i class="fa fa-check"></i>&nbsp;提交
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">
<i class="fa fa-times"></i>&nbsp;取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,131 @@
(function (vc) {
var DEFAULT_ROWS = 10;
vc.extends({
propTypes: {
emitListener: vc.propTypes.string,
emitFunction: vc.propTypes.string
},
data: {
chooseMaintainanceStandardItemInfo: {
items: [],
itemTitle: '',
standardId: '',
routeName: '',
selectItems: []
}
},
watch: { // 监视双向绑定的数据数组
checkData: {
handler() { // 数据数组有变化将触发此函数
if ($that.chooseMaintainanceStandardItemInfo.selectItems.length == $that.chooseMaintainanceStandardItemInfo.items.length) {
document.querySelector('#quan').checked = true;
} else {
document.querySelector('#quan').checked = false;
}
},
deep: true // 深度监视
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('chooseMaintainanceStandardItem', 'openchooseMaintainanceStandardItemModal', function (_param) {
$that._refreshChooseMaintainanceStandardItemInfo();
$('#chooseMaintainanceStandardItemModel').modal('show');
vc.copyObject(_param, $that.chooseMaintainanceStandardItemInfo);
$that._loadAllItemsInfo(1, 10, '');
});
vc.on('chooseMaintainanceStandardItem', 'paginationPlus', 'page_event', function (_currentPage) {
$that._loadAllItemsInfo(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_loadAllItemsInfo: function (_page, _row, _name) {
let param = {
params: {
page: _page,
row: _row,
itemTitle: _name,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/maintainance.listMaintainanceItem',
param,
function (json) {
var _pointInfo = JSON.parse(json);
$that.chooseMaintainanceStandardItemInfo.items = _pointInfo.data;
vc.emit('chooseMaintainanceStandardItem', 'paginationPlus', 'init', {
total: _pointInfo.records,
currentPage: _page
});
}, function () {
console.log('请求失败处理');
}
);
},
_chooseMaintainanceStandardItem: function (_org) {
let _selectItems = $that.chooseMaintainanceStandardItemInfo.selectItems;
if (_selectItems.length < 1) {
vc.toast("请选择检查项");
return;
}
let _objData = {
communityId: vc.getCurrentCommunity().communityId,
standardId: $that.chooseMaintainanceStandardItemInfo.standardId,
items: _selectItems
}
vc.http.apiPost('/maintainance.saveMaintainanceStandardItem',
JSON.stringify(_objData),
{
emulateJSON: true
},
function (json, res) {
let _json = JSON.parse(json);
if (_json.code == 0) {
$('#chooseMaintainanceStandardItemModel').modal('hide');
vc.emit('maintainanceStandardItem', 'loadItem', {
standardId: $that.chooseMaintainanceStandardItemInfo.standardId
});
return;
}
vc.toast(_json.msg);
}, function () {
console.log('请求失败处理');
}
);
$('#chooseMaintainanceStandardItemModel').modal('hide');
},
//查询
queryItems: function () {
$that._loadAllItemsInfo(1, 10, $that.chooseMaintainanceStandardItemInfo.inspectionName);
},
//重置
resetItems: function () {
$that.chooseMaintainanceStandardItemInfo.inspectionName = "";
$that._loadAllItemsInfo(1, 10, $that.chooseMaintainanceStandardItemInfo.inspectionName);
},
_refreshChooseMaintainanceStandardItemInfo: function () {
$that.chooseMaintainanceStandardItemInfo = {
items: [],
itemTitle: '',
standardId: '',
routeName: '',
selectItems: []
};
},
checkAll: function (e) {
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
if (e.target.checked) { // 判定全选checkbox的勾选状态
for (var i = 0; i < checkObj.length; i++) {
if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中
$that.chooseMaintainanceStandardItemInfo.selectItems.push(checkObj[i].value);
}
}
} else { // 如果是去掉全选则清空checkbox选项绑定数组
$that.chooseMaintainanceStandardItemInfo.selectItems = [];
}
}
}
});
})(window.vc);

View File

@ -0,0 +1,19 @@
<div class="modal fade" id="deleteMaintainanceStandardItemModel" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><span><vc:i18n name="请确认您的操作" namespace="deleteMaintainanceStandardItem"></vc:i18n></span>!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<tr align="center"><th><span><vc:i18n name="确定删除巡检点" namespace="deleteMaintainanceStandardItem"></vc:i18n></span></th></tr>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="closedeleteMaintainanceStandardItemModel()"><span><vc:i18n name="点错了" namespace="deleteMaintainanceStandardItem"></vc:i18n></span></button>
<button type="button" class="btn btn-primary" v-on:click="deleteMaintainanceStandardItem()"><span><vc:i18n name="确认删除" namespace="deleteMaintainanceStandardItem"></vc:i18n></span></button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,53 @@
(function(vc,vm){
vc.extends({
data:{
deleteMaintainanceStandardItemInfo:{
}
},
_initMethod:function(){
},
_initEvent:function(){
vc.on('deleteMaintainanceStandardItem','openDeleteMaintainanceStandardItemModal',function(_params){
vc.component.deleteMaintainanceStandardItemInfo = _params;
$('#deleteMaintainanceStandardItemModel').modal('show');
});
},
methods:{
deleteMaintainanceStandardItem:function(){
vc.component.deleteMaintainanceStandardItemInfo.communityId=vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'/maintainance.deleteMaintainanceStandardItem',
JSON.stringify(vc.component.deleteMaintainanceStandardItemInfo),
{
emulateJSON:true
},
function(json,res){
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if(_json.code == 0){
//关闭model
$('#deleteMaintainanceStandardItemModel').modal('hide');
vc.emit('maintainanceStandardItem', 'loadItem',$that.deleteMaintainanceStandardItemInfo);
return ;
}
vc.toast(_json.msg);
},
function(errInfo,error){
console.log('请求失败处理');
vc.toast(json);
});
},
closedeleteMaintainanceStandardItemModel:function(){
$('#deleteMaintainanceStandardItemModel').modal('hide');
}
}
});
})(window.vc,window.vc.component);

View File

@ -44,7 +44,7 @@
<div class="ibox">
<div class="ibox-title">
<h5>
<span><vc:i18n name="检项" namespace="maintainanceItem"></vc:i18n></span>
<span><vc:i18n name="项" namespace="maintainanceItem"></vc:i18n></span>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-white btn-sm" v-on:click="_goBack()">

View File

@ -0,0 +1,52 @@
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5><span><vc:i18n name="检查项" namespace="maintainanceStandardItem"></vc:i18n></span></h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-white btn-sm " v-on:click="_goBack()" style="margin-right:10px">
<span><vc:i18n name="返回" namespace="maintainanceStandardItem"></vc:i18n></span>
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddMaintainanceStandardItemModal()">
<i class="fa fa-plus"></i><span><vc:i18n name="添加" namespace="maintainanceStandardItem"></vc:i18n></span>
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center"><span><vc:i18n name="检查项" namespace="maintainanceStandardItem"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="编号" namespace="maintainanceStandardItem"></vc:i18n></span></th>
<th class="text-right"><span><vc:i18n name="操作" namespace="maintainanceStandardItem"></vc:i18n></span></th>
</tr>
</thead>
<tbody>
<tr v-for="item in maintainanceStandardItemInfo.items">
<td class="text-center">{{item.itemTitle}}</td>
<td class="text-center">{{item.itemId}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openDeleteMaintainanceStandardItemModel(item)"><span><vc:i18n name="删除"></vc:i18n></span>
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="8">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/paginationPlus" namespace="maintainanceStandardItem"></vc:create>
</div>
</div>
</div>
<vc:create path="property/chooseMaintainanceStandardItem" emitListener="maintainanceStandardItem" emitFunction="listInspectionPoint">
</vc:create>
<vc:create path="property/deleteMaintainanceStandardItem"></vc:create>
</div>

View File

@ -0,0 +1,72 @@
/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
maintainanceStandardItemInfo: {
items: [],
standardId: '',
total: 0,
records: 1,
routeName: ''
}
},
_initMethod: function() {
vc.component.maintainanceStandardItemInfo.standardId = vc.getParam('standardId');
vc.component._listMaintainanceStandardItems(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function() {
vc.on('maintainanceStandardItem', 'loadItem', function() {
vc.component._listMaintainanceStandardItems(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('maintainanceStandardItem', 'paginationPlus', 'page_event', function(_currentPage) {
vc.component._listMaintainanceStandardItems(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listMaintainanceStandardItems: function(_page, _rows) {
let param = {
params: {
page: _page,
row: _rows,
communityId: vc.getCurrentCommunity().communityId,
standardId: vc.component.maintainanceStandardItemInfo.standardId
}
};
//发送get请求
vc.http.apiGet('/maintainance.listMaintainanceStandardItem',
param,
function(json, res) {
var _inspectionRouteManageInfo = JSON.parse(json);
vc.component.maintainanceStandardItemInfo.total = _inspectionRouteManageInfo.total;
vc.component.maintainanceStandardItemInfo.records = _inspectionRouteManageInfo.records;
vc.component.maintainanceStandardItemInfo.items = _inspectionRouteManageInfo.data;
vc.emit('maintainanceStandardItem', 'paginationPlus', 'init', {
total: vc.component.maintainanceStandardItemInfo.records,
dataCount: vc.component.maintainanceStandardItemInfo.total,
currentPage: _page
});
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddMaintainanceStandardItemModal: function() {
vc.emit('chooseMaintainanceStandardItem', 'openchooseMaintainanceStandardItemModal', {
standardId:$that.maintainanceStandardItemInfo.standardId
});
},
_openDeleteMaintainanceStandardItemModel: function(_inspectionPoint) {
_inspectionPoint.standardId = $that.maintainanceStandardItemInfo.standardId;
vc.emit('deleteMaintainanceStandardItem', 'openDeleteMaintainanceStandardItemModal', _inspectionPoint);
},
_goBack: function() {
vc.goBack();
}
}
});
})(window.vc);

View File

@ -89,6 +89,12 @@
<vc:i18n name='删除'></vc:i18n>
</span></button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_maintainanceItem(maintainanceStandard)"><span>
<vc:i18n name='检查项'></vc:i18n>
</span></button>
</div>
</td>
</tr>

View File

@ -36,7 +36,7 @@
vc.component.maintainanceStandardManageInfo.conditions.page = _page;
vc.component.maintainanceStandardManageInfo.conditions.row = _rows;
var param = {
let param = {
params: vc.component.maintainanceStandardManageInfo.conditions
};
@ -76,6 +76,9 @@
} else {
vc.component.maintainanceStandardManageInfo.moreCondition = true;
}
},
_maintainanceItem:function(_maintainanceStandard){
vc.jumpToPage('/#/pages/property/maintainanceStandardItem?standardId='+_maintainanceStandard.standardId)
}