优化代码

This commit is contained in:
java110 2021-04-06 14:05:54 +08:00
parent d608f762a1
commit 035656841a
4 changed files with 405 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<div id="forceFinishRepairModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<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">
<label class="col-sm-2 col-form-label">说明</label>
<div class="col-sm-10">
<textarea placeholder="必填,请填写说明" cols="15" class="form-control"
v-model="forceFinishRepairInfo.context"></textarea>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="_forceFinishRepairInfo()">
<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>

View File

@ -0,0 +1,109 @@
(function (vc) {
vc.extends({
data: {
forceFinishRepairInfo: {
repairId: '',
repairType: '',
staffId: '',
staffName: '',
context: '',
action: '',
repairTypeUsers: []
}
},
_initMethod: function () {
//vc.component._initDispatchRepairInfo();
},
_initEvent: function () {
vc.on('forceFinishRepair', 'openDispatchRepairModal', function (_repair) {
$that.forceFinishRepairInfo.repairId = _repair.repairId;
$('#forceFinishRepairModel').modal('show');
});
},
methods: {
forceFinishRepairValidate() {
return vc.validate.validate({
forceFinishRepairInfo: vc.component.forceFinishRepairInfo
}, {
'forceFinishRepairInfo.repairId': [
{
limit: "required",
param: "",
errInfo: "报修单不能为空"
}
],
'forceFinishRepairInfo.context': [
{
limit: "required",
param: "",
errInfo: "说明不能为空"
}
]
});
},
_forceFinishRepairInfo: function () {
if (!vc.component.forceFinishRepairValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.component.forceFinishRepairInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'ownerRepair.repairForceFinish',
JSON.stringify(vc.component.forceFinishRepairInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#forceFinishRepairModel').modal('hide');
vc.component.clearDispatchRepairInfo();
vc.emit('repairPoolManage', 'listRepairPool', {});
vc.emit('repairForceFinishManage', 'listRepairPool', {});
vc.toast("操作成功");
} else if(_json.code == 404){
vc.toast(_json.msg);
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
clearDispatchRepairInfo: function () {
vc.component.forceFinishRepairInfo = {
repairId: '',
repairType: '',
staffId: '',
staffName: '',
context: '',
action: '',
repairTypeUsers: []
};
},
_listRepairTypeUsers: function () {
var param = {
params: {
page: 1,
row: 50,
communityId: vc.getCurrentCommunity().communityId,
repairType: $that.forceFinishRepairInfo.repairType,
state: '9999'
}
};
//发送get请求
vc.http.apiGet('repair.listRepairTypeUsers',
param,
function (json, res) {
var _repairTypeUserManageInfo = JSON.parse(json);
vc.component.forceFinishRepairInfo.repairTypeUsers = _repairTypeUserManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
}
});
})(window.vc);

View File

@ -0,0 +1,114 @@
<div class="animated fadeInRight ecommerce">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>查询条件</h5>
<div class="ibox-tools" style="top:10px;">
<!-- <button type="button" class="btn btn-link btn-sm" style="margin-right:10px;"
v-on:click="_moreCondition()">{{repairForceFinishManageInfo.moreCondition == true?'隐藏':'更多'}}
</button> -->
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<select class="custom-select" v-model="repairForceFinishManageInfo.conditions.repairType">
<option selected value="">请选择报修类型</option>
<option v-for="(item,index) in repairForceFinishManageInfo.repairSettings"
:value="item.repairType">{{item.repairTypeName}}
</option>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" placeholder="请输入报修人"
v-model="repairForceFinishManageInfo.conditions.repairName" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" placeholder="请输入报修电话" v-model="repairForceFinishManageInfo.conditions.tel"
class=" form-control">
</div>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryRepairPoolMethod()">
<i class="fa fa-search"></i> 查询
</button>
<button type="button" class="btn btn-info btn-sm" v-on:click="_resetRepairPoolMethod()"
style="margin-left: 20px;">
<i class="fa fa-repeat"></i> 重置
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5><span v-text="repairForceFinishManageInfo.conditions.roomName"></span>强制回单</h5>
<div class="ibox-tools" style="top:10px;">
</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">工单编码</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>
</thead>
<tbody>
<tr v-for="repairPool in repairForceFinishManageInfo.repairPools">
<td class="text-center">{{repairPool.repairId}}</td>
<td class="text-center">{{repairPool.repairObjName}}</td>
<td class="text-center">{{repairPool.repairTypeName}}</td>
<td class="text-center">{{repairPool.repairName}}</td>
<td class="text-center">{{repairPool.tel}}</td>
<td class="text-center">{{repairPool.appointmentTime}}</td>
<td class="text-center">
{{repairPool.stateName}}
</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openForceFinishRepairModel(repairPool)">强制回单
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openRepairDetail(repairPool)">详情
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="property/forceFinishRepair"></vc:create>
</div>

View File

@ -0,0 +1,150 @@
/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
repairForceFinishManageInfo: {
repairPools: [],
total: 0,
records: 1,
moreCondition: false,
repairName: '',
repairSettings: [],
states: [],
conditions: {
repairId: '',
repairName: '',
tel: '',
repairType: '',
roomId: '',
roomName: '',
ownerId: '',
state: '1100'
}
}
},
_initMethod: function () {
//vc.component._listRepairPools(DEFAULT_PAGE, DEFAULT_ROWS);
//vc.component._validateParam();
$that._listRepairSettings(DEFAULT_PAGE, 50);
vc.getDict('r_repair_pool', "state", function (_data) {
vc.component.repairForceFinishManageInfo.states = _data;
});
vc.component._listRepairPools(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('repairForceFinishManage', 'listRepairPool', function (_param) {
vc.component._listRepairPools(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listRepairPools(_currentPage, DEFAULT_ROWS);
});
},
methods: {
//查询方法
_listRepairPools: function (_page, _rows) {
vc.component.repairForceFinishManageInfo.conditions.page = _page;
vc.component.repairForceFinishManageInfo.conditions.row = _rows;
vc.component.repairForceFinishManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
var param = {
params: vc.component.repairForceFinishManageInfo.conditions
};
//报修人查询框去空
param.params.repairName = param.params.repairName.trim();
//报修ID查询框去空
param.params.repairId = param.params.repairId.trim();
//报修电话查询框去空
param.params.tel = param.params.tel.trim();
//发送get请求
vc.http.get('ownerRepairManage',
'list',
param,
function (json, res) {
var _repairForceFinishManageInfo = JSON.parse(json);
vc.component.repairForceFinishManageInfo.total = _repairForceFinishManageInfo.total;
vc.component.repairForceFinishManageInfo.records = _repairForceFinishManageInfo.records;
vc.component.repairForceFinishManageInfo.repairPools = _repairForceFinishManageInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.repairForceFinishManageInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
//重置方法
_resetRepairPools: function (_page, _rows) {
vc.component.repairForceFinishManageInfo.conditions.repairType = '';
vc.component.repairForceFinishManageInfo.conditions.repairName = '';
vc.component.repairForceFinishManageInfo.conditions.state = '';
vc.component.repairForceFinishManageInfo.conditions.repairId = '';
vc.component.repairForceFinishManageInfo.conditions.tel = '';
var param = {
params: vc.component.repairForceFinishManageInfo.conditions
};
//发送get请求
vc.http.get('ownerRepairManage',
'list',
param,
function (json, res) {
var _repairForceFinishManageInfo = JSON.parse(json);
vc.component.repairForceFinishManageInfo.total = _repairForceFinishManageInfo.total;
vc.component.repairForceFinishManageInfo.records = _repairForceFinishManageInfo.records;
vc.component.repairForceFinishManageInfo.repairPools = _repairForceFinishManageInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.repairForceFinishManageInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openRepairDetail: function (_repairPool) {
vc.jumpToPage('/admin.html#/pages/property/ownerRepairDetail?repairId=' + _repairPool.repairId)
},
//查询
_queryRepairPoolMethod: function () {
vc.component._listRepairPools(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetRepairPoolMethod: function () {
vc.component._resetRepairPools(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
if (vc.component.repairForceFinishManageInfo.moreCondition) {
vc.component.repairForceFinishManageInfo.moreCondition = false;
} else {
vc.component.repairForceFinishManageInfo.moreCondition = true;
}
},
_openForceFinishRepairModel: function (_repair) {
vc.emit('forceFinishRepair', 'openDispatchRepairModal', _repair);
},
_listRepairSettings: function (_page, _rows) {
var param = {
params: {
page: _page,
row: _rows,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('repair.listRepairSettings',
param,
function (json, res) {
var _repairSettingManageInfo = JSON.parse(json);
vc.component.repairForceFinishManageInfo.repairSettings = _repairSettingManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
}
}
});
})(window.vc);